HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OBJ_Geometry.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: OBJ library (C++)
7  *
8  * COMMENTS: Definition for geometry object
9  *
10  */
11 
12 #ifndef __OBJ_Geometry_h__
13 #define __OBJ_Geometry_h__
14 
15 #include "OBJ_API.h"
16 #include "OBJ_Node.h"
17 #include "OBJ_Shared.h"
18 
19 #include <DEP/DEP_MicroNode.h>
20 
21 class CHOP_Node;
22 class OP_Bundle;
23 
24 typedef enum {
30 
32 {
35  // Misc
39  I_N_GEO_INDICES // should always be last in the list
40 };
41 
42 #define INT_OBJ_PARM(name, idx) evalInt(name, &getIndirect()[idx], 0, 0.0)
43 
45 {
46 public:
47  OBJ_Geometry(OP_Network *, const char *, OP_Operator *);
48  ~OBJ_Geometry() override;
49 
50  static PRM_Template *getObsolete();
51  static OP_Node *myConstructor(OP_Network *net,
52  const char *name, OP_Operator *entry);
53 
55  PRM_ParmList *obsolete_parms) override;
56 
57  void getShaderSpace(OP_Context &context,
58  UT_DMatrix4 &xform);
59  void getDisplacementSpace(UT_DMatrix4 &xform, fpreal t);
60  void getShaderSpace(OP_Context &context, UT_Matrix4 &xform);
61  void getDisplacementSpace(UT_Matrix4 &xform, fpreal t);
62 
63  OP_Bundle *getReflectBundle(fpreal t);
64 
65  // If you need to get the light mask bundle, check to make sure you don't
66  // actually want to get the list of light mask objects.
67  OP_Bundle *getLightMaskBundle(fpreal t);
68 
69  // getLightMaskObjects differs from getLightMaskBundle method in that it
70  // will expand light subnets and return the list of objects that will light
71  // this geo.
72  void getLightMaskObjects(OP_NodeList &lights, fpreal t);
73 
74  int isObjectLitBy(OBJ_Node *light,
75  fpreal t) override;
76  bool isLightInLightMask(const OBJ_Node *light,
77  fpreal now) override;
78  int isObjectLitBySubnet(OBJ_Node *subnet,
79  fpreal t) override;
80 
82  const UT_ValArray<OBJ_Ambient *> &lights,
84  fpreal t) override;
85 
86  /// Interface to manipulate object level parameters
88 
89  int doDrawLit() const override { return 1; }
90 
91  OBJ_OBJECT_TYPE getObjectType() const override;
92 
93  virtual CHOP_Node *getSoundMaterial(fpreal t);
94  static PRM_Template *getTemplateList(OBJ_ParmsStyle style);
95 
96  OBJ_Geometry *castToOBJGeometry() override { return this; }
97 
101  const CH_ChannelList &channels) override;
104  UT_StringArray &names,
105  PRM_ParmNameMap &nmap) override;
106 
107  obj_OnionSkin getOnionSkin() override;
108 
109 protected:
110  // Used to get pointer to indirection indices for each object type
111  int *getIndirect() const override
112  { return geoIndirect; }
113 
114  GU_DetailHandle getBoundingBoxGeometryHandle(OP_Context &context);
115  GU_DetailHandle getBoundingSphereGeometryHandle(OP_Context &context);
116 
117  void buildParmDependency( int parm_index ) override;
118 
119  // Flags for Use Parent Parameter
120 public:
121  int SMOOTH(fpreal now);
122  int NOBACK(fpreal now);
123  void DETAIL(UT_String &str, fpreal t);
124  void DETAIL_FILE(UT_String &str, fpreal t);
125  void DETAIL_AUTOARCHIVE(UT_String &str, fpreal t);
126  void DETAIL_RIBPROC(UT_String &str, fpreal t);
127  void DETAIL_MANTRAPROC(UT_String &str, fpreal t);
128  int DETAIL_BLUR(fpreal t);
129  void DETAIL_MIN(fpreal *v, fpreal t);
130  void DETAIL_MAX(fpreal *v, fpreal t);
131  int AUTOREFLECT(fpreal t);
132  void REFLMAP(UT_String &str, fpreal t);
133  int REFLRES(fpreal t);
134  void LIGHTMASK(UT_String &str,fpreal t);
135  void REFLMASK(UT_String &str, fpreal t);
136  void RISHADER(UT_String &str, fpreal t);
137  void RIDISPLACE(UT_String &str, fpreal t);
138  void RIINTERIOR(UT_String &str, fpreal t);
139  bool INSTANCEGROUP(UT_String &str, fpreal now);
140  OBJ_PHOTON_MODE CAUSTICSMODE(fpreal t);
141  OBJ_PHOTON_MODE GLOBILLUMMODE(fpreal t);
142  int RI_COLOR(fpreal now);
143  void RI_CS(fpreal v[3], fpreal t);
144  void RI_OS(fpreal v[3], fpreal t);
145  void RI_PHOTON(UT_String &str, fpreal t);
146  bool SHADESPACE(UT_String &str, fpreal t);
147  bool DISPSPACE(UT_String &str, fpreal t);
148 
149  // This parameter in the Misc tab only exists for geometry objects.
150  int VPORT_SHADEOPEN() override
151  {
152  fetchGeoDispOpts();
153  return myShadeOpenCurves;
154  }
155  int VPORT_DISPLAYASSUBDIV() override
156  {
157  fetchGeoDispOpts();
158  return myDisplaySubD;
159  }
160 
161  // method for building a menu containing primitive groups
163  int size,
164  const PRM_SpareData *spare,
165  const PRM_Parm *parm) override;
166 
167 private:
168 
169  void fetchGeoDispOpts()
170  {
171  if(myGeoDispOptMicroNode.requiresUpdate(0.0))
172  {
173  myShadeOpenCurves = INT_OBJ_PARM("vport_shadeopen",
175  myDisplaySubD = INT_OBJ_PARM("vport_displayassubdiv",
177  auto i_shade = getIndirect()[I_VPORT_SHADEOPEN];
178  if(i_shade >= 0)
179  myGeoDispOptMicroNode.addExplicitInput(
180  parmMicroNode(i_shade, 0),false);
181 
182  auto i_style = getIndirect()[I_VPORT_DISPLAYASSUBDIV];
183  if(i_style >= 0)
184  myGeoDispOptMicroNode.addExplicitInput(
185  parmMicroNode(i_style, 0),false);
186  myGeoDispOptMicroNode.update(0.0);
187  }
188  }
189 
190  GU_DetailHandle myPopStandInGdpHandle;
191  int myShaderHint;
192 
193  DEP_MicroNode myOnionSkinDepNode;
194  DEP_MicroNode myGeoDispOptMicroNode;
195  int myOnionSkinState;
196  int myShadeOpenCurves;
197  int myDisplaySubD;
198 
199  static int *geoIndirect;
200 };
201 
202 #undef INT_OBJ_PARM
203 
204 #endif
GT_API const UT_StringHolder selection
int VPORT_DISPLAYASSUBDIV() override
Definition: OBJ_Geometry.h:155
OBJ_ParmsStyle
Definition: OBJ_Node.h:207
virtual int isObjectLitBySubnet(OBJ_Node *, fpreal)
Definition: OBJ_Node.h:957
const GLdouble * v
Definition: glcorearb.h:837
int VPORT_SHADEOPEN() override
Definition: OBJ_Geometry.h:150
int * getIndirect() const override
Definition: OBJ_Geometry.h:111
#define INT_OBJ_PARM(name, idx)
Definition: OBJ_Geometry.h:42
virtual int collectPropertiesFromParms(PI_EditScriptedParms &editparms, UT_StringArray &names, PRM_ParmNameMap &nmap)
virtual OBJ_OBJECT_TYPE getObjectType() const =0
virtual SOP_ObjectAppearancePtr getObjectAppearance()
int doDrawLit() const override
Definition: OBJ_Geometry.h:89
virtual bool isLightInLightMask(const OBJ_Node *light, fpreal now)
Function to resolve lighting based on light masks.
Definition: OBJ_Node.h:953
virtual int * getIndirect() const =0
virtual int collectPropertiesFromChannels(PI_EditScriptedParms &editparms, UT_BitArray &selection, const CH_ChannelList &channels)
OBJ_PHOTON_MODE
Definition: OBJ_Geometry.h:24
GLuint const GLchar * name
Definition: glcorearb.h:786
void resolveObsoleteParms(PRM_ParmList *obsolete_parms) override
DEP_MicroNode & parmMicroNode(int parm_idx, int vi)
Definition: OP_Node.h:1633
that also have some descendant prim *whose name begins with which in turn has a child named baz where *the predicate active
GLdouble t
Definition: glad.h:2397
OBJ_GeoIndex
Definition: OBJ_Geometry.h:31
GLsizeiptr size
Definition: glcorearb.h:664
virtual int isObjectLitBy(OBJ_Node *, fpreal)
Definition: OBJ_Node.h:951
fpreal64 fpreal
Definition: SYS_Types.h:277
static void buildPrimitiveGroupMenu(void *o, PRM_Name *, int, const PRM_SpareData *, const PRM_Parm *)
virtual void buildParmDependency(int parm_index)
virtual void getActingLightSubset(const UT_ValArray< OBJ_Ambient * > &lights, UT_ValArray< OBJ_Ambient * > &active, fpreal t)
static PRM_Template * getObsolete()
#define OBJ_API
Definition: OBJ_API.h:10
OBJ_OBJECT_TYPE
Definition: OBJ_Node.h:73
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)
virtual obj_OnionSkin getOnionSkin()
Definition: OBJ_Node.h:732
OBJ_Geometry * castToOBJGeometry() override
Definition: OBJ_Geometry.h:96