RenderMan  26.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Riley.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 2020 Pixar. All rights reserved.
5 #
6 # The information in this file (the "Software") is provided for the exclusive
7 # use of the software licensees of Pixar ("Licensees"). Licensees have the
8 # right to incorporate the Software into other products for use by other
9 # authorized software licensees of Pixar, without fee. Except as expressly
10 # permitted herein, the Software may not be disclosed to third parties, copied
11 # or duplicated in any form, in whole or in part, without the prior written
12 # permission of Pixar.
13 #
14 # The copyright notices in the Software and this entire statement, including the
15 # above license grant, this restriction and the following disclaimer, must be
16 # included in all copies of the Software, in whole or in part, and all permitted
17 # derivative works of the Software, unless such copies or derivative works are
18 # solely in the form of machine-executable object code generated by a source
19 # language processor.
20 #
21 # PIXAR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
22 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL PIXAR BE
23 # LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
24 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
25 # OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
26 # CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. IN NO CASE WILL
27 # PIXAR'S TOTAL LIABILITY FOR ALL DAMAGES ARISING OUT OF OR IN CONNECTION WITH
28 # THE USE OR PERFORMANCE OF THIS SOFTWARE EXCEED $50.
29 #
30 # Pixar
31 # 1200 Park Ave
32 # Emeryville CA 94608
33 #
34 # ------------------------------------------------------------------------------
35 */
36 
37 /*
38  * Version 0.4
39  *
40  * This is a preview release and is not supported. This API will change substantially in the next
41  * release of RenderMan.
42  * Names, namespaces, methods, parameters, types, enums, and the structure of the interface itself
43  * are expected to change.
44  *
45  */
46 
47 #ifndef Riley_h
48 #define Riley_h
49 
50 #include "Riley_version.h" // Riley versioned namespace
51 
52 #include "RileyIds.h"
53 
54 #include "RiTypesHelper.h" // RtUString
55 #include "RixInterfaces.h"
56 
57 RILEY_NAMESPACE_ENTER
58 
59 
60 //
61 // Result types.
62 //
63 enum class CameraResult
64 {
65  k_Error,
66  k_Success
67 };
68 
70 {
71  k_Error,
72  k_Success
73 };
74 
76 {
77  k_Error,
78  k_Success
79 };
80 
82 {
83  k_Error,
84  k_Success,
86 };
87 
88 enum class DisplayResult
89 {
90  k_Success,
91  k_Error,
92 };
93 
94 enum class RenderViewResult
95 {
96  k_Error,
97  k_Success
98 };
99 
101 {
102  k_Error,
103  k_Success
104 };
105 
107 {
108  k_Error,
109  k_Success,
111 };
112 
114 {
115  k_Error,
116  k_Success,
118 };
119 
121 {
122  k_Error,
123  k_Success
124 };
125 
127 {
128  k_Error,
129  k_Success,
131 };
132 
134 {
135  k_Error,
136  k_Success,
138 };
139 
140 enum class MaterialResult
141 {
142  k_Error,
143  k_Success,
145 };
146 
148 {
149  k_Success,
150  k_Error,
153 };
154 
156 {
157  k_Success,
158  k_Error,
160 };
161 
163 {
164  k_Error,
165  k_Success
166 };
167 
168 enum class StopResult
169 {
170  k_Success,
172 };
173 
174 //
175 // Input types.
176 //
177 struct Extent
178 {
179  uint32_t x;
180  uint32_t y;
181  uint32_t z;
182 };
183 
185 {
186  float width;
187  float height;
188 };
189 
191 {
192  k_Float, // 32-bit single precision floating point number
193  k_Integer, // 32-bit one's complement integer
194  k_Color, // 3-k_Float
195  k_Vector // 3-k_Float
196 };
197 
204 struct ShadingNode;
206 {
207  uint32_t nodeCount;
209 };
210 
212 {
213  enum class Type
214  {
215  k_Invalid,
216  k_Pattern,
217  k_Bxdf,
218  k_Integrator,
219  k_Light,
221  k_Projection,
225  };
226 
228  RtUString name;
229  RtUString handle;
230  RtParamList params;
231 };
232 
233 struct Transform
234 {
235  uint32_t samples;
236  RtMatrix4x4 const* matrix;
237  float const* time;
238 };
239 
240 //
241 // List types.
242 // Multiple APIs require a list of ids. Declaring an explicit type of these yields clearer code.
243 //
245 {
246  uint32_t count;
247  CoordinateSystemId const* ids;
248 };
249 
251 {
252  uint32_t count;
253  DisplayFilterId const* ids;
254 };
255 
257 {
258  uint32_t count;
259  SampleFilterId const* ids;
260 };
261 
263 {
264  uint32_t count;
265  RenderOutputId const* ids;
266 };
267 
269 {
270  uint32_t count;
271  RenderViewId const* ids;
272 };
273 
275 {
277  UserId userId;
278 
281  GeometryPrototypeId groupPrototypeId;
282 
284  GeometryPrototypeId geoPrototypeId;
285 
287  MaterialId materialId;
288 
291 
293  Transform const* xform;
294 
296  RtParamList const* attributes;
297 };
298 
300 {
303  GeometryPrototypeId groupPrototypeId;
304 
306  GeometryInstanceId instanceId;
307 
309  MaterialId const* materialId;
310 
313 
315  Transform const* xform;
316 
320  RtParamList const* attributes;
321 };
322 
324 {
327  GeometryPrototypeId groupPrototypeId;
328 
330  GeometryInstanceId instanceId;
331 };
332 
334 {
336  UserId userId;
337 
340  GeometryPrototypeId groupPrototypeId;
341 
344  GeometryPrototypeId geoPrototypeId;
345 
347  MaterialId materialId;
348 
350  LightShaderId lightShaderId;
351 
354 
356  Transform const* xform;
357 
359  RtParamList const* attributes;
360 };
361 
363 {
366  GeometryPrototypeId groupPrototypeId;
367 
370  LightInstanceId lightInstanceId;
371 
373  MaterialId const* materialId;
374 
376  LightShaderId const* lightShaderId;
377 
380 
382  Transform const* xform;
383 
387  RtParamList const* attributes;
388 };
389 
391 {
394  GeometryPrototypeId groupPrototypeId;
395 
397  LightInstanceId lightInstanceId;
398 };
399 
400 // Additional batch interface list types.
401 // Multiple APIs require a list of ids. Declaring an explicit type of these yields clearer code.
402 
404 {
405  size_t count;
407 };
408 
410 {
411  size_t count;
413 };
414 
416 {
417  size_t count;
419 };
420 
422 {
423  size_t count;
424  GeometryInstanceId* ids;
425 };
426 
428 {
429  size_t count;
431 };
432 
434 {
435  size_t count;
437 };
438 
440 {
441  size_t count;
443 };
444 
446 {
447  size_t count;
449 };
450 
452 {
453  size_t count;
454  LightInstanceId* ids;
455 };
456 
458 {
459  size_t count;
461 };
462 
466 class Riley
467 {
468 public:
469  virtual ~Riley(){};
470 
482 
498  virtual void Render(RenderViewList const& renderViews, RtParamList const& renderOptions) = 0;
499 
505  virtual StopResult RequestUpdate() = 0;
506 
512  virtual StopResult Stop() = 0;
513 
520  virtual bool SetRenderSettings(RtParamList const& renderOptions) = 0;
521 
527  virtual bool SetRenderMetadata(CameraId id, RtParamList const& metadata) = 0;
528  virtual bool SetRenderMetadata(GeometryPrototypeId groupId, GeometryInstanceId id,
529  RtParamList const& metadata) = 0;
530  virtual bool SetRenderMetadata(GeometryPrototypeId id, RtParamList const& metadata) = 0;
531  virtual bool SetRenderMetadata(MaterialId id, RtParamList const& metadata) = 0;
532  virtual bool SetRenderMetadata(DisplacementId id, RtParamList const& metadata) = 0;
533  virtual bool SetRenderMetadata(IntegratorId id, RtParamList const& metadata) = 0;
534  virtual bool SetRenderMetadata(LightInstanceId id, RtParamList const& metadata) = 0;
535  virtual bool SetRenderMetadata(LightShaderId id, RtParamList const& metadata) = 0;
536  virtual bool SetRenderMetadata(CoordinateSystemId id, RtParamList const& metadata) = 0;
537  virtual bool SetRenderMetadata(RenderOutputId id, RtParamList const& metadata) = 0;
538  virtual bool SetRenderMetadata(RenderTargetId id, RtParamList const& metadata) = 0;
539  virtual bool SetRenderMetadata(DisplayId id, RtParamList const& metadata) = 0;
540 
549 
556  virtual void SetOptions(RtParamList const& sceneOptions) = 0;
557 
563  virtual void InvalidateTexture(RtUString const filename) = 0;
564 
603  virtual RenderOutputId CreateRenderOutput( //
604  UserId userId, RtUString name, RenderOutputType type, RtUString source,
605  RtUString accumulationRule, RtUString filter, FilterSize const& filterSize,
606  float relativePixelVariance, RtParamList const& params) = 0;
607 
612  RenderOutputId renderOutput, RtUString const* name, RenderOutputType const* type,
613  RtUString const* source, RtUString const* accumulationRule, RtUString const* filter,
614  FilterSize const* filterSize, float const* relativePixelVariance, RtParamList const* params) = 0;
615 
620  virtual RenderOutputResult DeleteRenderOutput(RenderOutputId renderOutput) = 0;
621 
637  virtual RenderTargetId CreateRenderTarget( //
638  UserId userId, RenderOutputList const& renderOutputs, Extent const& extent,
639  RtUString filterMode, float pixelVariance, RtParamList const& params) = 0;
640 
648  RenderTargetId renderTarget, RenderOutputList const* renderOutputs, Extent const* extent,
649  RtUString const* filterMode, float const* pixelVariance, RtParamList const* params) = 0;
650 
655  virtual RenderTargetResult DeleteRenderTarget(RenderTargetId renderTarget) = 0;
656 
675  virtual DisplayId CreateDisplay( //
676  UserId userId, RenderTargetId renderTarget, RtUString name, RtUString driver,
677  RenderOutputList const& renderOutputs, RtParamList const& driverParams) = 0;
678 
683  virtual DisplayResult ModifyDisplay( //
684  DisplayId display, RenderTargetId const* renderTarget, RtUString const* name,
685  RtUString const* driver, RenderOutputList const* renderOutputs,
686  RtParamList const* driverParams) = 0;
687 
692  virtual DisplayResult DeleteDisplay(DisplayId display) = 0;
693 
714  virtual RenderViewId CreateRenderView( //
715  UserId userId, RenderTargetId renderTargetId, CameraId cameraId, IntegratorId integratorId,
716  DisplayFilterList const& displayFilters, SampleFilterList const& sampleFilters,
717  RtParamList const& params) = 0;
718 
724  RenderViewId renderViewId, RenderTargetId const* renderTargetId, CameraId const* cameraId,
725  IntegratorId const* integratorId, DisplayFilterList const* displayFilters,
726  SampleFilterList const* sampleFilters, RtParamList const* params) = 0;
727 
731  virtual RenderViewResult DeleteRenderView(RenderViewId renderViewId) = 0;
732 
743  virtual DisplayFilterId CreateDisplayFilter( //
744  UserId userId, ShadingNetwork const& displayFilter, RtParamList const& attributes) = 0;
745 
758  DisplayFilterId displayFilterId, ShadingNetwork const* displayFilter,
759  RtParamList const* attributes) = 0;
760 
764  virtual DisplayFilterResult DeleteDisplayFilter(DisplayFilterId displayFilterId) = 0;
765 
776  virtual SampleFilterId CreateSampleFilter( //
777  UserId userId, ShadingNetwork const& sampleFilter, RtParamList const& attributes) = 0;
778 
791  SampleFilterId sampleFilterId, ShadingNetwork const* sampleFilter,
792  RtParamList const* attributes) = 0;
793 
797  virtual SampleFilterResult DeleteSampleFilter(SampleFilterId sampleFilterId) = 0;
798 
830  virtual CameraId CreateCamera( //
831  UserId userId, RtUString name, ShadingNode const& projection, Transform const& xform,
832  RtParamList const& properties) = 0;
833 
853  virtual CameraResult ModifyCamera( //
854  CameraId cameraId, ShadingNode const* projection, Transform const* xform,
855  RtParamList const* properties) = 0;
856 
860  virtual void DeleteCamera(CameraId cameraId) = 0;
861 
862  // A clipping plane should be specified by a transform only. 'params' allows for optional values
863  // to be provided, either for backward compatibility (i.e. provide a plane normal and origin
864  // point), or to support future features (e.g. use a clipping portal, different shapes, etc...).
865  virtual ClippingPlaneId CreateClippingPlane( //
866  Transform const& xform, RtParamList const& params) = 0;
868  ClippingPlaneId clippingPlaneId, Transform const* xform, RtParamList const* params) = 0;
869  virtual ClippingPlaneResult DeleteClippingPlane(ClippingPlaneId clippingPlaneId) = 0;
870 
876  virtual void SetDefaultDicingCamera(CameraId cameraId) = 0;
877 
886  virtual IntegratorId CreateIntegrator(UserId userId, ShadingNode const& integratorNode) = 0;
887 
898  IntegratorId integratorId, ShadingNode const* integratorNode) = 0;
899 
903  virtual IntegratorResult DeleteIntegrator(IntegratorId integratorId) = 0;
904 
916  virtual CoordinateSystemId CreateCoordinateSystem( //
917  UserId userId, Transform const& xform, RtParamList const& attributes) = 0;
918 
929  CoordinateSystemId coordsysId, Transform const* xform, RtParamList const* attributes) = 0;
930 
934  virtual void DeleteCoordinateSystem(CoordinateSystemId coordsysId) = 0;
935 
944  virtual DisplacementId CreateDisplacement( //
945  UserId userId, ShadingNetwork const& displacement, RtParamList const& attributes) = 0;
946 
961  DisplacementId displacementId, ShadingNetwork const* displacement,
962  RtParamList const* attributes) = 0;
963 
967  virtual void DeleteDisplacement(DisplacementId displacementId) = 0;
968 
979  virtual LightShaderId CreateLightShader( //
980  UserId userId, ShadingNetwork const& light, ShadingNetwork const& lightFilter) = 0;
981 
996  LightShaderId lightShaderId, ShadingNetwork const* light,
997  ShadingNetwork const* lightFilter) = 0;
998 
1005  virtual void DeleteLightShader(LightShaderId lightShaderId) = 0;
1006 
1021  virtual MaterialId CreateMaterial( //
1022  UserId userId, ShadingNetwork const& bxdf, RtParamList const& attributes) = 0;
1023 
1035  virtual MaterialResult ModifyMaterial( //
1036  MaterialId materialId, ShadingNetwork const* bxdf, RtParamList const* attributes) = 0;
1037 
1041  virtual void DeleteMaterial(MaterialId materialId) = 0;
1042 
1058  virtual GeometryPrototypeId CreateGeometryPrototype( //
1059  UserId userId, RtUString type, DisplacementId displacementId,
1060  RtPrimVarList const& primvars) = 0;
1061 
1081  RtUString type, GeometryPrototypeId geoPrototypeId, DisplacementId const* displacementId,
1082  RtPrimVarList const* primvars) = 0;
1083 
1087  virtual void DeleteGeometryPrototype(GeometryPrototypeId geoPrototypeId) = 0;
1088 
1111  virtual GeometryInstanceId CreateGeometryInstance( //
1112  UserId userId, GeometryPrototypeId groupPrototypeId, GeometryPrototypeId geoPrototypeId,
1113  MaterialId materialId, CoordinateSystemList const& coordsysList, Transform const& xform,
1114  RtParamList const& attributes) = 0;
1115 
1145  GeometryPrototypeId groupPrototypeId, GeometryInstanceId instanceId,
1146  MaterialId const* materialId, CoordinateSystemList const* coordsysList,
1147  Transform const* xform, RtParamList const* attributes) = 0;
1148 
1156  virtual void DeleteGeometryInstance( //
1157  GeometryPrototypeId groupPrototypeId, GeometryInstanceId instanceId) = 0;
1158 
1182  virtual LightInstanceId CreateLightInstance( //
1183  UserId userId, GeometryPrototypeId groupPrototypeId, GeometryPrototypeId geoPrototypeId,
1184  MaterialId materialId, LightShaderId lightShaderId,
1185  CoordinateSystemList const& coordsysList, Transform const& xform,
1186  RtParamList const& attributes) = 0;
1187 
1222  GeometryPrototypeId groupPrototypeId, LightInstanceId lightInstanceId,
1223  MaterialId const* materialId, LightShaderId const* lightShaderId,
1224  CoordinateSystemList const* coordsysList, Transform const* xform,
1225  RtParamList const* attributes) = 0;
1226 
1234  virtual void DeleteLightInstance( //
1235  GeometryPrototypeId groupPrototypeId, LightInstanceId lightInstanceId) = 0;
1236 
1253  virtual void CreateGeometryInstances(GeometryInstanceCreateList const& instances,
1254  GeometryInstanceIdList& ids) = 0;
1255 
1276  virtual void ModifyGeometryInstances(GeometryInstanceModifyList const& instances,
1277  GeometryInstanceResultList& results) = 0;
1278 
1288  virtual void DeleteGeometryInstances(GeometryInstanceDeleteList const& instances) = 0;
1289 
1306  virtual void CreateLightInstances(LightInstanceCreateList const& instances,
1307  LightInstanceIdList& ids) = 0;
1308 
1329  virtual void ModifyLightInstances(LightInstanceModifyList const& instances,
1330  LightInstanceResultList& results) = 0;
1331 
1341  virtual void DeleteLightInstances(LightInstanceDeleteList const& instances) = 0;
1342 };
1343 
1344 RILEY_NAMESPACE_HEADER_EXIT
1345 
1347 {
1348 public:
1358  virtual riley::Riley* CreateRiley(RtUString rendervariant, RtParamList const& params) = 0;
1359  virtual void DestroyRiley(riley::Riley* rl) = 0;
1360 
1363  virtual void GetOptionOverrides(RtParamList& options) const = 0;
1364 
1365 protected:
1367  {}
1368 };
1369 
1370 #endif