HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros 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  virtual ~RAY_ProcIsoBase();
24 
25  virtual const char *className() const = 0;
26 
27  //
28  // The sub-class is responsible for initializing parameters. The
29  // initialization follows the rules for RAY_Procedural.
30  virtual int initialize(const UT_BoundingBox *box) = 0;
31  //
32  // The evalDensity method is used to evaluate the density of the iso
33  // surface. The surface will be generated where the density is 0.
34  virtual fpreal evaluateDensity(const float pos[3]) const = 0;
35 
36  //
37  // The render method may require the full surface to be split into smaller
38  // procedurals. The box passed in to the createChild() method is the
39  // bounding box without motion vectors applied. This method is responsible
40  // for:
41  // a) Creating a new sub-class instance
42  // b) Setting the myBox member data. The myBox must be
43  // totally enclosed in the bounding box passed in.
44  // c) Setting the myVelBox member data (possibly to the same
45  // value as myBox if there is no motion blur)
46  //
47  virtual RAY_ProcIsoBase *createChild(const UT_BoundingBox &box) = 0;
48 
49  //
50  // Attributes must be created for geometry before it's added to mantra, but
51  // after the points and polygons have been created. The attributes can be
52  // arbitrary. However, since velocity is used in generation of motion blur
53  // data, the index of the velocity attribute in the gdp needs to be
54  // returned by this method. Thus the return codes are:
55  //
56  // false - An un-recoverable error
57  // true - The velocity_attribute parameter is either invalid (no
58  // velocity attribute) or valid and refers to the velocity
59  // attribute.
60  //
61  // By default there is no velocity attribute added
62  //
63  // If velocity attributes are added to the detail, an arbitrary scale can
64  // also be applied to the velocity (i.e. shutter).
65  virtual bool addAttributes(GU_Detail *gdp, float &velocityscale,
66  GA_ROHandleV3 &velocity_attribute);
67 
68  //
69  // By default, this will return the bounding box with velocity motion
70  // vectors applied. This is required since mantra needs to know the entire
71  // possible range of geometry.
72  virtual void getBoundingBox(UT_BoundingBox &box);
73 
74  //
75  // The render method does not need to be overridden by the sub-class.
76  virtual void render();
77 
78 protected:
79  // Data which is unique per iso-procedural
80  // Member data is:
81  // myBox - The bounding box without velocity motion blur
82  // information applied.
83  // myVelBox - The bounding box including motion blur vectors
84  // myLodScale - An level of detail scale independent of the shading
85  // quality of the instance. This allows larger polygons
86  // to be generated without sacrificing shading.
89  float myLodScale;
90 };
91 
92 #endif
93 
UT_BoundingBox myBox
virtual void render()=0
Procedural primitive for mantra (RAY)
virtual const char * className() const =0
virtual void getBoundingBox(UT_BoundingBox &box)=0
The bounding box is the "object space" bounds of the procedural.
RAY_ProceduralChildPtr createChild() const
virtual int initialize(const UT_BoundingBox *box)=0
double fpreal
Definition: SYS_Types.h:263
#define RAY_API
Definition: RAY_API.h:12
UT_BoundingBox myVelBox