HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OBJ_DopNet.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_DopNet.h (Custom Library, C++)
7  *
8  * COMMENTS: An object to describe a motion capture handle
9  *
10  */
11 
12 #ifndef __OBJ_DopNet__
13 #define __OBJ_DopNet__
14 
15 #include "OBJ_API.h"
16 #include "OBJ_Node.h"
17 #include <DOP/DOP_Engine.h>
18 #include <DOP/DOP_Parent.h>
19 #include <SYS/SYS_Types.h>
20 
21 
22 #define FLOAT_OBJ_PARM(name, idx, vi, t) \
23  return evalFloat(name, &getIndirect()[idx], vi, t);
24 #define INT_OBJ_PARM(name, idx, vi, t) \
25  return evalInt(name, &getIndirect()[idx], vi, t);
26 #define STR_OBJ_PARM(name, idx, vi, t) \
27  evalString(str, name, &getIndirect()[idx], vi, t);
28 
29 
30 class SIM_RenderParms;
31 class UT_String;
32 
33 
35 {
61 
63 };
64 
65 enum
66 {
78 };
79 
80 class OBJ_API OBJ_DopNet : public OBJ_Node, public DOP_Parent
81 {
82 public:
84  const char *name,
85  OP_Operator *op);
86  virtual ~OBJ_DopNet();
87 
88  static CH_LocalVariable theVariables[];
89  /// Handle the evaluation of standards string local variables.
90  virtual bool evalVariableValue(
91  UT_String &value, int index, int thread);
92  virtual bool evalVariableValue(fpreal &v, int i, int thr)
93  {
94  return OBJ_Node::
95  evalVariableValue(v, i, thr);
96  }
97 
98  virtual const char *getChildType() const;
99  virtual OBJ_OBJECT_TYPE getObjectType() const;
100  virtual OP_OpTypeId getChildTypeID() const;
101 
102  static const char *theChildTableName;
103 
104  virtual OP_Node *getRenderNodePtr();
105  virtual int isObjectRenderable(fpreal t) const;
106 
107  // Functions for going through all our simulation objects and returning
108  // the geometry representing each one.
109  int getNumDOPGeometries() const;
110  GU_ConstDetailHandle getDOPGeometry(int index,
111  UT_DMatrix4 &xform,
112  bool fordisplay,
113  bool acceptguide) const;
114  const SIM_Data *getDOPData(int index) const;
115  const SIM_RootData *getDOPRootData(int index) const;
116  const SIM_RenderParms *getDOPRenderParms(int index) const;
117  bool getDOPIsGuide(int index) const;
118  virtual bool getIsTimeless() const { return TIMELESS(); }
119 
120  virtual DOP_Parent *castToDOPParent();
121  virtual const DOP_Parent *castToDOPParent() const;
122 
123  static OP_Node *myConstructor(OP_Network *net,
124  const char *name,
125  OP_Operator *entry);
126  static PRM_Template *getObsolete();
127  static PRM_Template *getTemplateList();
128 
129  virtual int isObjectLitBy(OBJ_Node *, fpreal) { return 1; }
130  virtual bool isLightInLightMask(const OBJ_Node *, fpreal)
131  { return true; }
132 
133  virtual int doDrawLit() const { return 1; }
134 
136  { STR_OBJ_PARM("displayfilter", I_DOPNETDISPLAYFILTER, 0, 0.0); }
137 
138  bool ISPLAYER() const
139  { INT_OBJ_PARM("isplayer", I_DOPNETISPLAYER, 0, 0.0); }
140  void PLAYFILESNAME(UT_String &str) const
141  { STR_OBJ_PARM("playfilesname", I_DOPNETPLAYFILESNAME, 0, 0.0); }
142 
144  { STR_OBJ_PARM("initialstate", I_DOPNETINITIALSTATE, 0, 0.0); }
146  { FLOAT_OBJ_PARM("timestep", I_DOPNETTIMESTEP, 0, 0.0); }
147  int SUBSTEP()
148  { INT_OBJ_PARM("substep", I_DOPNETSUBSTEP, 0, 0.0); }
150  { FLOAT_OBJ_PARM("timeoffset", I_DOPNETTIMEOFFSET, 0, 0.0); }
152  { INT_OBJ_PARM("startframe", I_DOPNETFRAMEOFFSET, 0, 0.0); }
154  { FLOAT_OBJ_PARM("timescale", I_DOPNETTIMESCALE, 0, 0.0); }
156  { INT_OBJ_PARM("maxfeedback", I_DOPNETMAXFEEDBACK, 0, 0.0); }
158  { INT_OBJ_PARM("interpolate", I_DOPNETINTERPOLATE, 0, 0.0); }
159  int AUTORESIM()
160  { INT_OBJ_PARM("autoresim", I_DOPNETAUTORESIM, 0, 0.0); }
161  int DATAHINTS()
162  { INT_OBJ_PARM("datahints", I_DOPNETDATAHINTS, 0, 0.0); }
164  { INT_OBJ_PARM("cacheenabled", I_DOPNETCACHEENABLED, 0, 0.0); }
166  { INT_OBJ_PARM("cachetodisk", I_DOPNETCACHETODISK, 0, 0.0); }
168  { INT_OBJ_PARM("cachetodisknoninteractive", I_DOPNETCACHETODISKNONINTERACTIVE, 0, 0.0); }
170  { INT_OBJ_PARM("cachesubsteps", I_DOPNETCACHESUBSTEPS, 0, 0.0); }
172  { INT_OBJ_PARM("cachemaxsize", I_DOPNETCACHEMAXSIZE, 0, 0.0); }
173 
175  { STR_OBJ_PARM("compresssims", I_DOPNETCOMPRESSSIMS, 0, 0.0); }
176 
178  { INT_OBJ_PARM("explicitcache", I_DOPNETEXPLICITCACHE, 0, 0.0); }
180  { STR_OBJ_PARM("explicitcachename", I_DOPNETEXPLICITCACHENAME, 0, 0.0); }
182  { INT_OBJ_PARM("explicitcachensteps", I_DOPNETEXPLICITCACHENSTEPS, 0, 0.0); }
184  { INT_OBJ_PARM("explicitcachecheckpointspacing", I_DOPNETEXPLICITCACHECHECKPOINTSPACING, 0, 0.0); }
185  static int resimulateStatic(void *, int, fpreal, const PRM_Template *);
186 
187  // This must be const so we thus don't use the indirect.
188  int TIMELESS() const
189  { return evalInt("timeless", 0, 0.0); }
190 
191  // The display and render ops of a DOP Network are always equal.
192  virtual int getDandROpsEqual();
193  virtual int updateDandROpsEqual(int check_inputs = 1);
194 
195  // Override clearInterrupted to avoid invalidating the whole cache when
196  // the user interrupts a cook.
197  virtual void clearInterrupted();
198 
199  virtual OBJ_DopNet *castToOBJDopNet() { return this; }
200 
201  // invalidate any cached data
202  virtual void clearCache();
203 
204  virtual bool opIsPlayer() const { return ISPLAYER(); }
205 
206 protected:
207  virtual bool updateParmsFlags();
208  virtual void getDescriptiveName(UT_String &name) const;
209  virtual void getDescriptiveParmName(UT_String &name) const;
210 
211  // Used to get pointer to indirection indices for each object type
212  virtual int *getIndirect() const
213  { return myDopNetIndirect; }
214 
215  virtual void childFlagChange(OP_Node *);
216 
217  // Returns true so we evaluate all parms when cooking. This ensures that
218  // any parm dependencies in our simulation parms get set up.
219  virtual bool cookedDataUsesAllParameters() const
220  { return true; }
221 
222  // Override DOP_Parent virtual functions.
223  virtual const DOP_Engine &getEngineSubclass() const;
224  virtual void setDOPTimeSubclass(const SIM_Time &t);
226  virtual void filterDataSubclass(const SIM_Time &t);
227 
228  virtual void handleRefilterParms(const SIM_Time &t);
229  virtual void handleResimParms(const SIM_Time &t);
230 
232  UT_BitArray &selection,
233  const CH_ChannelList &channels);
234  virtual bool createSpareParametersForLoad(UT_StringArray &names,
235  PRM_ParmNameMap &nmap,
236  UT_String &errors);
237 
238  virtual void getOwnedMicroNodes(
239  DEP_MicroNodeList &micronodes);
240 
241  virtual void dumpMicroNodes(
242  std::ostream &os,
243  bool as_DOT,
244  int indent_level) const;
245 
246 private:
247  DOP_Engine myEngine;
249  SIM_ConstDataArray myData;
250  UT_Array<GU_ConstDetailHandle> myGeometries;
251  UT_Array<UT_DMatrix4> myPositionData;
253  UT_BitArray myGeoIsGuide;
254 
255  static int *myDopNetIndirect;
256  static int myLastInternalParmIndex;
257 };
258 
259 #undef FLOAT_OBJ_PARM
260 #undef INT_OBJ_PARM
261 #undef STR_OBJ_PARM
262 
263 #endif
virtual int getDandROpsEqual()
virtual int isObjectLitBy(OBJ_Node *, fpreal)
Definition: OBJ_DopNet.h:129
virtual DOP_Engine & getNonConstEngineSubclass()=0
static const char * theChildTableName
Definition: OBJ_DopNet.h:102
fpreal TIMESTEP()
Definition: OBJ_DopNet.h:145
const GLdouble * v
Definition: glcorearb.h:836
bool EXPLICITCACHE()
Definition: OBJ_DopNet.h:177
int CACHEENABLED()
Definition: OBJ_DopNet.h:163
virtual bool isLightInLightMask(const OBJ_Node *, fpreal)
Function to resolve lighting based on light masks.
Definition: OBJ_DopNet.h:130
#define FLOAT_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:22
virtual void handleRefilterParms(const SIM_Time &t)
Definition: DOP_Parent.h:190
virtual OBJ_OBJECT_TYPE getObjectType() const =0
virtual DOP_Parent * castToDOPParent()
Definition: OP_Node.h:2519
virtual bool cookedDataUsesAllParameters() const
Definition: OBJ_DopNet.h:219
int CACHEMAXSIZE()
Definition: OBJ_DopNet.h:171
int INTERPOLATE()
Definition: OBJ_DopNet.h:157
virtual OBJ_DopNet * castToOBJDopNet()
Definition: OBJ_DopNet.h:199
png_uint_32 i
Definition: png.h:2877
#define STR_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:26
virtual void childFlagChange(OP_Node *)
virtual void clearInterrupted()
Definition: OP_Node.h:2337
virtual OP_OpTypeId getChildTypeID() const override
int EXPLICITCACHENSTEPS()
Definition: OBJ_DopNet.h:181
virtual bool opIsPlayer() const
Checks to see if the dop is in play mode.
Definition: OBJ_DopNet.h:204
int AUTORESIM()
Definition: OBJ_DopNet.h:159
virtual const char * getChildType() const override
int TIMELESS() const
Definition: OBJ_DopNet.h:188
int CACHETODISKNONINTERACTIVE()
Definition: OBJ_DopNet.h:167
virtual bool createSpareParametersForLoad(UT_StringArray &names, PRM_ParmNameMap &nmap, UT_String &errors) override
virtual const DOP_Engine & getEngineSubclass() const =0
void EXPLICITCACHENAME(UT_String &str)
Definition: OBJ_DopNet.h:179
virtual void handleResimParms(const SIM_Time &t)
Definition: DOP_Parent.h:191
void PLAYFILESNAME(UT_String &str) const
Definition: OBJ_DopNet.h:140
virtual bool getIsTimeless() const
Definition: OBJ_DopNet.h:118
OBJ_DopNetIndex
Definition: OBJ_DopNet.h:34
virtual void getDescriptiveName(UT_String &str) const
int SUBSTEP()
Definition: OBJ_DopNet.h:147
virtual bool evalVariableValue(fpreal &v, int i, int thr)
Definition: OBJ_DopNet.h:92
virtual OP_Node * getRenderNodePtr()
virtual bool evalVariableValue(fpreal &val, int var_id, int thread) override
GLuint const GLchar * name
Definition: glcorearb.h:785
virtual int * getIndirect() const
Definition: OBJ_DopNet.h:212
bool ISPLAYER() const
Definition: OBJ_DopNet.h:138
OP_OpTypeId
Definition: OP_Node.h:263
#define INT_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:24
fpreal STARTFRAME()
Definition: OBJ_DopNet.h:151
virtual void getDescriptiveParmName(UT_String &str) const
GLsizei const GLfloat * value
Definition: glcorearb.h:823
double fpreal
Definition: SYS_Types.h:263
int CACHESUBSTEPS()
Definition: OBJ_DopNet.h:169
virtual int isObjectRenderable(fpreal t) const
int MAXFEEDBACK()
Definition: OBJ_DopNet.h:155
void COMPRESSSIMS(UT_String &str)
Definition: OBJ_DopNet.h:174
GLuint index
Definition: glcorearb.h:785
void DISPLAYFILTER(UT_String &str)
Definition: OBJ_DopNet.h:135
fpreal TIMEOFFSET()
Definition: OBJ_DopNet.h:149
virtual void getOwnedMicroNodes(DEP_MicroNodeList &micronodes)
virtual bool createSpareParametersFromChannels(UT_BitArray &selection, const CH_ChannelList &channels) override
exint evalInt(int pi, int vi, fpreal t) const
virtual int updateDandROpsEqual(int check_inputs=1)
static PRM_Template * getObsolete()
#define OBJ_API
Definition: OBJ_API.h:10
virtual void setDOPTimeSubclass(const SIM_Time &t)
int CACHETODISK()
Definition: OBJ_DopNet.h:165
int DATAHINTS()
Definition: OBJ_DopNet.h:161
void INITIALSTATE(UT_String &str)
Definition: OBJ_DopNet.h:143
virtual int doDrawLit() const
Definition: OBJ_DopNet.h:133
int EXPLICITCACHECHECKPOINTSPACING()
Definition: OBJ_DopNet.h:183
virtual void filterDataSubclass(const SIM_Time &t)=0
virtual bool updateParmsFlags() override
virtual void dumpMicroNodes(std::ostream &os, bool as_DOT, int indent_level) const
OBJ_OBJECT_TYPE
Definition: OBJ_Node.h:70
virtual void clearCache()
fpreal TIMESCALE()
Definition: OBJ_DopNet.h:153