RenderMan API  23.0
RixPattern.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 RixPattern_h
39 #define RixPattern_h
40 
41 #include <cstddef> // for NULL
42 #include "RixShading.h" // for RixSCParamInfo (ptr only), etc
43 #include "prmanapi.h" // for PRMANEXPORT
44 #include "ri.h" // for RtConstPointer
45 #include "ndspy.h" // for UserParameter
46 
47 class RixBakeContext;
48 
59 {
60 public:
61  virtual int GetInterface() const override { return k_RixPattern; }
62 
63  struct OutputSpec
64  {
65  int paramId;
68  };
69 
77  virtual int ComputeOutputParams(
78  RixShadingContext const* sCtx,
79  int* numOutputs,
80  OutputSpec** outputs,
81  RtPointer instanceData,
82  RixSCParamInfo const* instanceTable) = 0;
83 
85  struct Bake2dSpec
86  {
87  Bake2dSpec(int _uTile, int _vTile, int _paramId) :
88  uTile(_uTile), vTile(_vTile), paramId(_paramId) {}
89  int const uTile;
90  int const vTile;
91  int const paramId;
95  RtUString primVar[2];
98  int resolution[2];
101  };
102 
115  virtual bool Bake2dOutput(
116  RixBakeContext const* bCtx,
117  Bake2dSpec& output,
118  RtPointer instanceData) = 0;
119 
121  struct Bake3dSpec
122  {
123  Bake3dSpec(int _paramId) : paramId(_paramId) {}
124  int const paramId;
128  float maxDistance;
133  };
134 
144  virtual bool Bake3dOutput(
145  RixBakeContext const* bCtx,
146  Bake3dSpec& output,
147  RtPointer instanceData) = 0;
148 
149 protected:
151  virtual ~RixPattern() {}
152 };
153 
154 #define RIX_PATTERNCREATE \
155  extern "C" PRMANEXPORT RixPattern* CreateRixPattern(const char* hint)
156 
157 #define RIX_PATTERNDESTROY \
158  extern "C" PRMANEXPORT void DestroyRixPattern(RixPattern* pattern)
159 
165 {
166 public:
168  virtual void* Allocate(size_t size) const = 0;
169 
170 protected:
172  virtual ~RixBakeContext() {}
173 };
174 
175 #endif
RixSCType dataType
Output data type. Default is that of the output parameter.
Definition: RixPattern.h:125
int const paramId
Constant paramId index.
Definition: RixPattern.h:124
Output specification for 3d baking.
Definition: RixPattern.h:121
int const paramId
Constant paramId index.
Definition: RixPattern.h:91
RixSCDetail detail
output detail may be determined by inputs
Definition: RixPattern.h:66
RtBoolean atlas
Bake multi-tile output such as UDIM. Default is RI_FALSE.
Definition: RixPattern.h:97
void * RtPointer
Definition: ri.h:69
int displayParamCount
Number of display parameters.
Definition: RixPattern.h:131
virtual int GetInterface() const override
Definition: RixPattern.h:61
int displayParamCount
Number of display parameters.
Definition: RixPattern.h:99
RixSCType dataType
Output data type. Default is that of the output parameter.
Definition: RixPattern.h:92
RtUString filename
Output filename.
Definition: RixPattern.h:126
Definition: ndspy.h:343
Output specification for 2d baking.
Definition: RixPattern.h:85
RtUString filename
Output filename.
Definition: RixPattern.h:93
int const uTile
Constant u-tile index, base 0.
Definition: RixPattern.h:89
RixSCDetail
Definition: RixShading.h:376
virtual int ComputeOutputParams(RixShadingContext const *sCtx, int *numOutputs, OutputSpec **outputs, RtPointer instanceData, RixSCParamInfo const *instanceTable)=0
virtual bool Bake2dOutput(RixBakeContext const *bCtx, Bake2dSpec &output, RtPointer instanceData)=0
virtual bool Bake3dOutput(RixBakeContext const *bCtx, Bake3dSpec &output, RtPointer instanceData)=0
Bake3dSpec(int _paramId)
Definition: RixPattern.h:123
Bake2dSpec(int _uTile, int _vTile, int _paramId)
Definition: RixPattern.h:87
RixSCType
Definition: RixShading.h:349
RtConstPointer value
output values
Definition: RixPattern.h:67
pxrcore::UString RtUString
RtUString coordsys
Baking coordinate space. Default is object.
Definition: RixPattern.h:129
int const vTile
Constant v-tile index, base 0.
Definition: RixPattern.h:90
#define k_RixShadingVersion
Definition: RixShading.h:97
UserParameter * displayParam
User specified display parameters.
Definition: RixPattern.h:132
short RtBoolean
Definition: ri.h:53
void const * RtConstPointer
Definition: ri.h:86
int paramId
into param table
Definition: RixPattern.h:65
RtUString display
Display driver name, e.g. openexr, tiff.
Definition: RixPattern.h:94
virtual ~RixPattern()
Definition: RixPattern.h:151
float maxDistance
Worldspace baking distance. Smaller values bake more points.
Definition: RixPattern.h:128
RtBoolean interpolate
Interpolate output points. Default is RI_FALSE.
Definition: RixPattern.h:130
RtUString display
Display driver name, e.g. pointcloud.
Definition: RixPattern.h:127
RtBoolean vInvert
Invert v coords when baking. Default is RI_FALSE.
Definition: RixPattern.h:96
virtual ~RixBakeContext()
Definition: RixPattern.h:172
UserParameter * displayParam
User specified display parameters.
Definition: RixPattern.h:100