RenderMan API  23.0
RixDisplacement.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 RixDisplacement_h
39 #define RixDisplacement_h
40 
41 #include "RixShading.h" // for RixShadingPlugin
42 #include "ri.h" // for RtConstPointer, RtPoint3
43 
44 class RixDisplacement;
45 
47 {
48 public:
49  virtual int GetInterface() const override { return k_RixDisplacementFactory; }
50 
52  RixShadingContext const*,
54  RtPointer instanceData) = 0;
55 
56  virtual void EndDisplacement(class RixDisplacement* disp) = 0;
57 
58 protected:
61 };
62 
64 {
65 public:
67  : shadingCtx(sCtx), displacementFactory(fact)
68  {
69  }
70 
71  virtual ~RixDisplacement() {}
72 
73  virtual bool GetDisplacement(RtPoint3* P) = 0;
74 
75  RixShadingContext const* GetShadingCtx() const { return shadingCtx; }
76 
78  {
79  return displacementFactory;
80  }
81 
87  virtual void Release()
88  {
89  if (displacementFactory)
90  displacementFactory->EndDisplacement(this);
91  }
92 
93 protected:
96 };
97 
98 // clang-format off
99 #define RIX_DISPLACEMENTCREATE \
100  extern "C" PRMANEXPORT RixDisplacementFactory* CreateRixDisplacementFactory(const char* hint)
101 
102 #define RIX_DISPLACEMENTDESTROY \
103  extern "C" PRMANEXPORT void DestroyRixDisplacementFactory(RixDisplacementFactory* bxdf)
104 // clang-format on
105 
106 #endif
RixShadingContext const * GetShadingCtx() const
void * RtPointer
Definition: ri.h:69
virtual int GetInterface() const override
RixSCShadingMode
Definition: RixShading.h:497
RixShadingContext const * shadingCtx
RtFloat3 RtPoint3
Definition: RiTypesHelper.h:69
RixDisplacementFactory * displacementFactory
RixDisplacementFactory * GetDisplacementFactory() const
virtual RixDisplacement * BeginDisplacement(RixShadingContext const *, RixSCShadingMode, RtPointer instanceData)=0
virtual ~RixDisplacementFactory()
#define k_RixShadingVersion
Definition: RixShading.h:97
RixDisplacement(RixShadingContext const *sCtx, RixDisplacementFactory *fact)
virtual ~RixDisplacement()
virtual void Release()
virtual void EndDisplacement(class RixDisplacement *disp)=0