RenderMan API  23.0
Riley.h
Go to the documentation of this file.
1 /*
2 # ------------------------------------------------------------------------------
3 #
4 # Copyright (c) 1986-2019 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.2
39  *
40  * This is a preview release and is not supported. This API will change substantially
41  * in the next release of RenderMan. Names, namespaces, methods, parameters, types,
42  * enums, and the structure of the interface are expected to change.
43  *
44  */
45 
46 #ifndef Riley_h
47 #define Riley_h
48 
49 #include "RiTypesHelper.h" // RtUString
50 #include "RixInterfaces.h"
51 #include "RtParamList.h"
52 
53 // Id for acquiring Riley from RixContext::GetRixInterface
54 #define k_RixRileyManager RixInterfaceId(-1)
55 
56 namespace riley
57 {
58 enum class CameraId : uint32_t
59 {
60  k_InvalidId = UINT32_MAX,
61 };
62 
63 enum class GeometryInstanceId : uint32_t
64 {
65  k_InvalidId = 0,
66 };
67 
68 enum class GeometryMasterId : uint32_t
69 {
70  k_InvalidId = 0,
71 };
72 
73 enum class MaterialId : uint32_t
74 {
75  k_DefaultId = 0,
76  k_InvalidId = UINT32_MAX,
77 };
78 
79 enum class DisplacementId : uint32_t
80 {
81  k_InvalidId = UINT32_MAX,
82 };
83 
84 enum class IntegratorId : uint32_t
85 {
86  k_InvalidId = UINT32_MAX,
87 };
88 
89 enum class LightInstanceId : uint32_t
90 {
91  k_InvalidId = UINT32_MAX,
92 };
93 
94 enum class LightMasterId : uint32_t
95 {
96  k_InvalidId = UINT32_MAX,
97 };
98 
99 enum class LightShaderId : uint32_t
100 {
101  k_InvalidId = UINT32_MAX,
102 };
103 
104 enum class LightFilterId : uint32_t
105 {
106  k_InvalidId = UINT32_MAX,
107 };
108 
109 enum class CoordinateSystemId : uint32_t
110 {
111  k_InvalidId = UINT32_MAX,
112 };
113 
114 enum class CameraResult
115 {
116  k_Error,
117  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
137 };
138 
140 {
141  k_Error,
142  k_Success,
143  k_ResendPrimVars
144 };
145 
146 enum class MaterialResult
147 {
148  k_Error,
149  k_Success,
150  k_ResendPrimVars
151 };
152 
154 {
155  k_Error,
156  k_Success,
157  k_ResendPrimVars
158 };
159 
161 {
162  k_Error,
163  k_Success,
164  k_ResendPrimVars
165 };
166 
168 {
169  k_Error,
170  k_Success,
171  k_ResendPrimVars
172 };
173 
174 // New Render Target API
175 
177 {
178  k_Success,
179  k_Error,
182 };
183 
184 enum class RenderOutputType : uint8_t
185 {
186  k_Float, // 32-bit single precision floating point number
187  k_Integer, // 32-bit one's complement integer
188  k_Color, // 3-k_Float
189  k_Vector // 3-k_Float
190 };
191 
192 enum class RenderOutputId : uint32_t
193 {
194  k_InvalidId = UINT32_MAX,
195 };
196 
198 {
199  k_Success,
200  k_Error,
201  k_ErrorDisplayAttached
202 };
203 
204 enum class DisplayResult
205 {
206  k_Success,
207  k_Error,
208 };
209 
210 enum class RenderTargetId : uint32_t
211 {
212  k_InvalidId = UINT32_MAX,
213 };
214 
215 enum class DisplayId : uint32_t
216 {
217  k_InvalidId = UINT32_MAX,
218 };
219 
222 // TODO: actually I think we only support a single integrator for all render views.
224 {
228 };
229 
230 enum class RenderMode
231 {
232  k_Batch,
234 };
235 
237 {
243 };
244 
246 {
247  enum Type
248  {
259  };
260 
265 };
266 
267 struct Transform
268 {
269  unsigned samples;
271  float const* time;
272 };
273 
275 {
276  unsigned count;
278 };
279 
284 class Riley
285 {
286 public:
287  virtual ~Riley(){};
288 
294  virtual void Begin() = 0;
295 
297  virtual void End() = 0;
298 
309  virtual void Render(uint32_t numRenderViews, RenderView const* renderViews,
310  RenderSettings settings) = 0;
311 
312  virtual void RequestUpdate() = 0;
313 
315  virtual void Stop() = 0;
316 
317  virtual void SetOptions(RtParamList const& options) = 0;
318 
354  virtual RenderOutputId CreateRenderOutput( //
355  RtUString name, RenderOutputType type, RtUString source, RtUString accumulationRule,
356  RtUString filter, float const* filterSize, float relativePixelVariance,
357  RtParamList const& params) = 0;
358 
365  virtual RenderOutputResult ModifyRenderOutput( //
366  RenderOutputId renderOutput, RtUString const* name, RenderOutputType const* type,
367  RtUString const* source, RtUString const* accumulationRule, RtUString const* filter,
368  float const* const* filterSize, float* relativePixelVariance,
369  RtParamList const* params) = 0;
370 
375  virtual RenderOutputResult DeleteRenderOutput(RenderOutputId renderOutput) = 0;
376 
390  virtual RenderTargetId CreateRenderTarget( //
391  uint32_t numRenderOutputs, RenderOutputId const* renderOutputs, uint32_t const* extent,
392  RtUString filterMode, float pixelVariance, RtParamList const& params) = 0;
393 
400  virtual RenderTargetResult ModifyRenderTarget( //
401  RenderTargetId renderTarget, uint32_t const* numRenderOutputs,
402  RenderOutputId const* const* renderOutputs, uint32_t const* const* extent,
403  RtUString const* filterMode, float const* pixelVariance, RtParamList const* params) = 0;
404 
409  virtual RenderTargetResult DeleteRenderTarget(RenderTargetId renderTargetId) = 0;
410 
428  virtual DisplayId CreateDisplay(RenderTargetId renderTarget, RtUString name, RtUString driver,
429  uint32_t numRenderOutputs, RenderOutputId const* renderOutputs,
430  RtParamList const& driverParams) = 0;
431 
436  virtual DisplayResult DeleteDisplay(DisplayId displayId) = 0;
437 
443  virtual void CreateDisplayFilterChain(riley::ShadingNode const* nodes, int nNodes) = 0;
444 
450  virtual void CreateSampleFilterChain(riley::ShadingNode const* nodes, int nNodes) = 0;
451 
481  virtual CameraId CreateCamera(RtUString name, ShadingNode const& projection,
482  Transform const& xform, RtParamList const& properties) = 0;
483 
509  virtual CameraResult ModifyCamera(CameraId cameraId, ShadingNode const* projection,
510  Transform const* xform, RtParamList const* properties) = 0;
511 
518  virtual void DeleteCamera(CameraId cameraId) = 0;
519 
534  virtual void SetClippingPlanes(uint32_t numClippingPlanes, Transform const* xforms,
535  float (*params)[6]) = 0;
536 
543  virtual void SetActiveCamera(CameraId cameraId) = 0;
544 
550  virtual IntegratorId CreateIntegrator(ShadingNode const& integratorNode) = 0;
551 
567  virtual IntegratorResult ModifyIntegrator(IntegratorId integratorId,
568  ShadingNode const* integratorNode) = 0;
569 
576  virtual IntegratorResult DeleteIntegrator(IntegratorId integratorId) = 0;
577 
587  virtual CoordinateSystemId CreateCoordinateSystem(Transform const& xform,
588  RtParamList const& attributes) = 0;
589 
603  virtual CoordinateSystemResult ModifyCoordinateSystem(CoordinateSystemId coordsysId,
604  Transform const* xform,
605  RtParamList const* attributes) = 0;
606 
613  virtual void DeleteCoordinateSystem(CoordinateSystemId coordsysId) = 0;
614 
628  virtual DisplacementId CreateDisplacement(ShadingNode const* shadingNodes,
629  int nShadingNodes) = 0;
630 
653  virtual DisplacementResult ModifyDisplacement(DisplacementId displacementId,
654  ShadingNode const* shadingNodes,
655  int nShadingNodes) = 0;
656 
663  virtual void DeleteDisplacement(DisplacementId displacementId) = 0;
664 
677  virtual LightShaderId CreateLightShader(ShadingNode const* lightNodes, int nLightNodes,
678  ShadingNode const* filterNodes, int nFilterNodes) = 0;
679 
703  virtual LightShaderResult ModifyLightShader(LightShaderId lightShaderId,
704  ShadingNode const* lightNodes, int nLightNodes,
705  ShadingNode const* filterNodes,
706  int nFilterNodes) = 0;
707 
714  virtual void DeleteLightShader(LightShaderId lightShaderId) = 0;
715 
735  virtual MaterialId CreateMaterial(ShadingNode const* shadingNodes, int nShadingNodes) = 0;
736 
758  virtual MaterialResult ModifyMaterial(MaterialId materialId, ShadingNode const* shadingNodes,
759  int nShadingNodes) = 0;
760 
767  virtual void DeleteMaterial(MaterialId materialId) = 0;
768 
784  virtual GeometryMasterId CreateGeometryMaster(RtUString type, DisplacementId displacementId,
785  RtParamList const& primvars) = 0;
786 
787  typedef bool (*CreateGeometryMasterCB)(void* fnData, RtParamList& primvars);
788 
826  virtual GeometryMasterId CreateGeometryMasterDeferred(RtUString type,
827  DisplacementId displacementId,
828  RtParamList const& primvars,
829  CreateGeometryMasterCB fn,
830  void* fnData) = 0;
831 
862  virtual GeometryMasterResult ModifyGeometryMaster(RtUString type, GeometryMasterId geoMasterId,
863  DisplacementId const* displacementId,
864  RtParamList const* primvars) = 0;
865 
872  virtual void DeleteGeometryMaster(GeometryMasterId geoMasterId) = 0;
873 
904  virtual GeometryInstanceId CreateGeometryInstance(GeometryMasterId groupMasterId,
905  GeometryMasterId geoMasterId,
906  MaterialId materialId,
907  ScopedCoordinateSystem const& coordsys,
908  Transform const& xform,
909  RtParamList const& attributes) = 0;
910 
953  virtual GeometryInstanceResult ModifyGeometryInstance(GeometryMasterId groupMasterId,
954  GeometryInstanceId instanceId,
955  MaterialId const* materialId,
956  ScopedCoordinateSystem const* coordsys,
957  Transform const* xform,
958  RtParamList const* attributes) = 0;
959 
973  virtual void DeleteGeometryInstance(GeometryMasterId groupMasterId,
974  GeometryInstanceId instanceId) = 0;
975 
1011  virtual LightInstanceId CreateLightInstance(GeometryMasterId groupMasterId,
1012  GeometryMasterId geoMasterId, MaterialId materialId,
1013  LightShaderId lightShaderId,
1014  ScopedCoordinateSystem const& coordsys,
1015  Transform const& xform,
1016  RtParamList const& attributes) = 0;
1017 
1066  virtual LightInstanceResult ModifyLightInstance(GeometryMasterId groupMasterId,
1067  LightInstanceId lightInstanceId,
1068  MaterialId const* materialId,
1069  LightShaderId const* lightShaderId,
1070  ScopedCoordinateSystem const* coordsys,
1071  Transform const* xform,
1072  RtParamList const* attributes) = 0;
1073 
1087  virtual void DeleteLightInstance(GeometryMasterId groupMasterId,
1088  LightInstanceId lightInstanceId) = 0;
1089 };
1090 
1091 } // namespace riley
1092 
1094 {
1095 public:
1100  virtual riley::Riley* CreateRiley(char const* rendervariant) = 0;
1101  virtual void DestroyRiley(riley::Riley* rl) = 0;
1102 
1105  virtual void GetOptionOverrides(RtParamList& options) const = 0;
1106 
1107 protected:
1109  {}
1110 };
1111 
1112 #endif
IntegratorId integratorId
Definition: Riley.h:226
RenderTargetId renderTargetId
Definition: Riley.h:225
CameraResult
Definition: Riley.h:114
LightInstanceId
Definition: Riley.h:89
LightMasterId
Definition: Riley.h:94
RtUString handle
Definition: Riley.h:263
RtUString name
Definition: Riley.h:262
pxrcore::ParamList RtParamList
Definition: RtParamList.h:47
MaterialId
Definition: Riley.h:73
DisplacementId
Definition: Riley.h:79
RenderMode
Definition: Riley.h:230
float const * time
Definition: Riley.h:271
RenderMode mode
Definition: Riley.h:242
CoordinateSystemId
Definition: Riley.h:109
RtParamList params
Definition: Riley.h:264
Definition: Riley.h:56
CoordinateSystemResult
Definition: Riley.h:120
unsigned samples
Definition: Riley.h:269
GeometryInstanceId
Definition: Riley.h:63
GeometryMasterId
Definition: Riley.h:68
virtual ~Riley()
Definition: Riley.h:287
IntegratorResult
Definition: Riley.h:133
LightInstanceResult
Definition: Riley.h:167
RenderOutputId
Definition: Riley.h:192
DisplayResult
Definition: Riley.h:204
pxrcore::UString RtUString
CameraId cameraId
Definition: Riley.h:227
RenderOutputType
Definition: Riley.h:184
CoordinateSystemId const * coordsysIds
Definition: Riley.h:277
RtMatrix4x4 const * matrix
Definition: Riley.h:270
pxrcore::Matrix4x4 RtMatrix4x4
Definition: RiTypesHelper.h:73
MaterialResult
Definition: Riley.h:146
RenderTargetResult
Definition: Riley.h:197
GeometryMasterResult
Definition: Riley.h:153
DisplayId
Definition: Riley.h:215
RenderTargetId
Definition: Riley.h:210
LightShaderResult
Definition: Riley.h:139
IntegratorId
Definition: Riley.h:84
CameraId
Definition: Riley.h:58
DisplacementResult
Definition: Riley.h:126
LightShaderId
Definition: Riley.h:99
LightFilterId
Definition: Riley.h:104
RenderOutputResult
Definition: Riley.h:176
GeometryInstanceResult
Definition: Riley.h:160