HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
RAY_ProcIsoBase.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: RAY_ProcIsoBase.h ( RAY Library, C++)
7  *
8  * COMMENTS: Iso-surface procedural baseclass
9  */
10 
11 #ifndef __RAY_ProcIsoBase__
12 #define __RAY_ProcIsoBase__
13 
14 #include "RAY_API.h"
15 #include <GA/GA_Handle.h>
16 #include <UT/UT_BoundingBox.h>
17 #include "RAY_Procedural.h"
18 
20 {
21 public:
23  ~RAY_ProcIsoBase() override;
24 
25  //
26  // The evalDensity method is used to evaluate the density of the iso
27  // surface. The surface will be generated where the density is 0.
28  virtual fpreal evaluateDensity(const float pos[3]) const = 0;
29 
30  //
31  // The render method may require the full surface to be split into smaller
32  // procedurals. The box passed in to the createChild() method is the
33  // bounding box without motion vectors applied. This method is responsible
34  // for:
35  // a) Creating a new sub-class instance
36  // b) Setting the myBox member data. The myBox must be
37  // totally enclosed in the bounding box passed in.
38  // c) Setting the myVelBox member data (possibly to the same
39  // value as myBox if there is no motion blur)
40  //
41  virtual RAY_ProcIsoBase *createChild(const UT_BoundingBox &box) = 0;
42 
43  //
44  // Attributes must be created for geometry before it's added to mantra, but
45  // after the points and polygons have been created. The attributes can be
46  // arbitrary. However, since velocity is used in generation of motion blur
47  // data, the index of the velocity attribute in the gdp needs to be
48  // returned by this method. Thus the return codes are:
49  //
50  // false - An un-recoverable error
51  // true - The velocity_attribute parameter is either invalid (no
52  // velocity attribute) or valid and refers to the velocity
53  // attribute.
54  //
55  // By default there is no velocity attribute added
56  //
57  // If velocity attributes are added to the detail, an arbitrary scale can
58  // also be applied to the velocity (i.e. shutter).
59  virtual bool addAttributes(GU_Detail *gdp, float &velocityscale,
60  GA_ROHandleV3 &velocity_attribute);
61 
62  //
63  // By default, this will return the bounding box with velocity motion
64  // vectors applied. This is required since mantra needs to know the entire
65  // possible range of geometry.
66  void getBoundingBox(UT_BoundingBox &box) override;
67 
68  //
69  // The render method does not need to be overridden by the sub-class.
70  void render() override;
71 
72 protected:
73  // Data which is unique per iso-procedural
74  // Member data is:
75  // myBox - The bounding box without velocity motion blur
76  // information applied.
77  // myVelBox - The bounding box including motion blur vectors
78  // myLodScale - An level of detail scale independent of the shading
79  // quality of the instance. This allows larger polygons
80  // to be generated without sacrificing shading.
83  float myLodScale;
84 };
85 
86 #endif
87 
UT_BoundingBox myBox
virtual void render()=0
Procedural primitive for mantra (RAY)
virtual void getBoundingBox(UT_BoundingBox &box)=0
The bounding box is the "object space" bounds of the procedural.
RAY_ProceduralChildPtr createChild() const
#define RAY_API
Definition: RAY_API.h:12
fpreal64 fpreal
Definition: SYS_Types.h:277
UT_BoundingBox myVelBox