RenderMan  26.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
RixPattern.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 #ifndef RixPattern_h
38 #define RixPattern_h
39 
40 #include <cstddef> // for NULL
41 #include "RixShading.h" // for RixSCParamInfo (ptr only), etc
42 #include "prmanapi.h" // for PRMANEXPORT
43 #include "RiTypesHelper.h" // for RtUString, etc
44 #include "ndspy.h" // for UserParameter
45 
46 class RixBakeContext;
47 
58 {
59 public:
60  int GetInterface() const override { return k_RixPattern; }
61 
62  struct OutputSpec
63  {
64  int paramId;
66  void const* value;
67  };
68 
76  virtual int ComputeOutputParams(
77  RixShadingContext const* sCtx,
78  int* numOutputs,
79  OutputSpec** outputs,
80  void* instanceData,
81  RixSCParamInfo const* instanceTable) = 0;
82 
84  struct Bake2dSpec
85  {
86  Bake2dSpec(int _uTile, int _vTile, int _paramId) :
87  uTile(_uTile), vTile(_vTile), paramId(_paramId) {}
88  int const uTile;
89  int const vTile;
90  int const paramId;
92  RtUString filename;
93  RtUString display;
94  RtUString primVar[2];
95  bool vInvert;
96  bool atlas;
97  int udimStride;
98  int udimOffset;
99  int resolution[2];
101  UserParameter *displayParam;
102  };
103 
116  virtual bool Bake2dOutput(
117  RixBakeContext const* bCtx,
118  Bake2dSpec& output,
119  void* instanceData) = 0;
120 
122  struct Bake3dSpec
123  {
124  Bake3dSpec(int _paramId) : paramId(_paramId) {}
125  int const paramId;
127  RtUString filename;
128  RtUString display;
129  float maxDistance;
130  RtUString coordsys;
131  bool interpolate;
133  UserParameter *displayParam;
134  };
135 
145  virtual bool Bake3dOutput(
146  RixBakeContext const* bCtx,
147  Bake3dSpec& output,
148  void* instanceData) = 0;
149 
150 protected:
152  virtual ~RixPattern() {}
153 };
154 
155 #define RIX_PATTERNCREATE \
156  extern "C" PRMANEXPORT RixPattern* CreateRixPattern(const char* hint)
157 
158 #define RIX_PATTERNDESTROY \
159  extern "C" PRMANEXPORT void DestroyRixPattern(RixPattern* pattern)
160 
166 {
167 public:
169  virtual void* Allocate(size_t size) const = 0;
170 
171 protected:
173  ~RixBakeContext() override {}
174 };
175 
176 #endif