RenderMan API  23.0
RixProjection.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 #ifndef RixProjection_h
39 #define RixProjection_h
40 
41 #include "RixInterfaces.h" // for RixContext
42 #include "RixShading.h" // for RixParameterList (ptr only), etc
43 #include "prmanapi.h" // for PRMANEXPORT
44 #include "ri.h" // for RtPoint2
45 
47 struct RtRayGeometry;
48 
54 
56 {
57 public:
59 
60  int m_version;
61 
63  int width;
64  int height;
65 
68 
70  float clippingNear;
71  float clippingFar;
72 
78 
80  float shutterOpen;
81  float shutterClose;
82 
86  float const* worldToCameraTimes;
87 
88  char _reserved[32];
89 };
90 
92 {
93 public:
94 
99  {
102  k_Spherical
103  };
104 
110  {
111  k_cameraZ = 0,
112  k_rayLength = 1
113  };
114 
115  // Projections can be queried at the beginning of rendering for
116  // general properties interesting to the renderer. They should
117  // return k_RixSCInvalidDetail if a particular property is
118  // unsupported. If a property is supported, k_RixSCUniform or
119  // k_RixSCVarying should be returned according to the detail of
120  // the result. A trivial implementation that supports no
121  // properties of any sort should simply return
122  // k_RixSCInvalidDetail.
124  {
125  // enum DicingHint - see above
127 
128  // enum DeepMetric - see above
130 
131  // float: field of view of the plugin for perspective and
132  // spherical. Used by the renderer as hint on how to dice
133  // geometry.
135 
136  // float: depth of field (defocus) for perspective projections
140  };
141 
142  virtual RixSCDetail GetProperty(
144  void const** result) const = 0;
145 
149 
150  virtual void Project(RixProjectionContext& pCtx) = 0;
151 
152  virtual void RenderBegin(RixContext& ctx, RixProjectionEnvironment const& env,
153  RixParameterList const* instanceParams) = 0;
154 
155  virtual void RenderEnd(RixContext& rixCtx) {
156  PIXAR_ARGUSED(rixCtx);
157  }
158 
159 protected:
160  virtual ~RixProjection() {};
161 };
162 
164 {
165 public:
166  virtual int GetInterface() const override { return k_RixProjectionFactory; }
167 
168  // Projection plugins do not support InstanceData. As a consequence, the following methods are
169  // not expected to be implemented and won't be called by the renderer.
170  virtual void CreateInstanceData(RixContext& rixCtx, RtUString const handle,
171  RixParameterList const* instanceParams,
172  InstanceData* instanceData) override final
173  {
174  PIXAR_ARGUSED(rixCtx);
175  PIXAR_ARGUSED(handle);
176  PIXAR_ARGUSED(instanceParams);
177  PIXAR_ARGUSED(instanceData);
178  }
179 
180  virtual void SynchronizeInstanceData(RixContext& rixCtx, RtUString const handle,
181  RixParameterList const* instanceParams,
182  uint32_t const editHints,
183  InstanceData* instanceData) override final
184  {
185  PIXAR_ARGUSED(rixCtx);
186  PIXAR_ARGUSED(handle);
187  PIXAR_ARGUSED(instanceParams);
188  PIXAR_ARGUSED(editHints);
189  PIXAR_ARGUSED(instanceData);
190  }
191 
192  virtual RixProjection* CreateProjection(
193  RixContext& ctx,
194  RtUString const handle,
195  RixParameterList const* pList) = 0;
196 
197  virtual void DestroyProjection(RixProjection const* projection) = 0;
198 
199 protected:
202 };
203 
204 #define RIX_PROJECTIONFACTORYCREATE \
205  extern "C" PRMANEXPORT RixProjectionFactory* CreateRixProjectionFactory(RtUString const hint)
206 
207 #define RIX_PROJECTIONFACTORYDESTROY \
208  extern "C" PRMANEXPORT void DestroyRixProjectionFactory(RixProjectionFactory* factory)
209 
213 
215 {
216 public:
217  int numRays;
218 
224 
225  RtPoint2 const* screen;
226 
233 
234  RtPoint2 const* lens;
236 
243 
244  float* time;
245 
254 
256 
261 
263 
271 
272  virtual void TransformOrigins(
273  RtUString const fromSpace,
274  RtUString const toSpace) = 0;
275  virtual void TransformDirections(
276  RtUString const fromSpace,
277  RtUString const toSpace) = 0;
278 
279 protected:
282 };
283 
284 #endif
float clippingNear
Distance to near and far clipping plane.
Definition: RixProjection.h:70
pxrcore::ColorRGB RtColorRGB
virtual ~RixProjectionFactory()
virtual ~RixProjection()
RtRayGeometry * rays
virtual void RenderEnd(RixContext &rixCtx)
RtPoint2 const * aperture
float shutterOpen
Shutter.
Definition: RixProjection.h:80
RixSCDetail
Definition: RixShading.h:376
float pixelAspectRatio
Aspect ratio of pixels.
Definition: RixProjection.h:67
virtual void CreateInstanceData(RixContext &rixCtx, RtUString const handle, RixParameterList const *instanceParams, InstanceData *instanceData) override final
RtPoint2 const * lens
virtual int GetInterface() const override
RtMatrix4x4 const * worldToCameraMatrix
Definition: RixProjection.h:85
RtPoint2 const * screen
pxrcore::UString RtUString
#define k_RixShadingVersion
Definition: RixShading.h:97
virtual ~RixProjectionContext()
pxrcore::Matrix4x4 RtMatrix4x4
Definition: RiTypesHelper.h:73
virtual void SynchronizeInstanceData(RixContext &rixCtx, RtUString const handle, RixParameterList const *instanceParams, uint32_t const editHints, InstanceData *instanceData) override final
int width
Width and height of the image in pixels.
Definition: RixProjection.h:63
float screenWindowLeft
Screen window.
Definition: RixProjection.h:74
unsigned worldToCameraNumSamples
World to camera transform.
Definition: RixProjection.h:84
float const * worldToCameraTimes
Definition: RixProjection.h:86
#define PIXAR_ARGUSED(x)
Definition: prmanapi.h:171