HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups 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  ~OBJ_DopNet() override;
87 
88  static CH_LocalVariable theVariables[];
89  /// Handle the evaluation of standards string local variables.
90  bool evalVariableValue(
92  int index,
93  int thread) override;
95  fpreal &v,
96  int i,
97  int thr) override
98  {
99  return OBJ_Node::
100  evalVariableValue(v, i, thr);
101  }
102 
103  const char *getChildType() const override;
104  OBJ_OBJECT_TYPE getObjectType() const override;
105  OP_OpTypeId getChildTypeID() const override;
106 
107  static const char *theChildTableName;
108 
109  OP_Node *getRenderNodePtr() override;
110  int isObjectRenderable(fpreal t) const override;
111 
112  // Functions for going through all our simulation objects and returning
113  // the geometry representing each one.
114  int getNumDOPGeometries() const;
115  GU_ConstDetailHandle getDOPGeometry(int index,
116  UT_DMatrix4 &xform,
117  bool fordisplay,
118  bool acceptguide) const;
119  const SIM_Data *getDOPData(int index) const;
120  const SIM_RootData *getDOPRootData(int index) const;
121  const SIM_RenderParms *getDOPRenderParms(int index) const;
122  bool getDOPIsGuide(int index) const;
123  bool getIsTimeless() const override
124  { return TIMELESS(); }
125 
126  DOP_Parent *castToDOPParent() override;
127  const DOP_Parent *castToDOPParent() const override;
128 
129  static OP_Node *myConstructor(OP_Network *net,
130  const char *name,
131  OP_Operator *entry);
132  static PRM_Template *getObsolete();
133  static PRM_Template *getTemplateList();
134 
135  int isObjectLitBy(OBJ_Node *, fpreal) override { return 1; }
136  bool isLightInLightMask(const OBJ_Node *, fpreal) override
137  { return true; }
138 
139  int doDrawLit() const override { return 1; }
140 
142  { STR_OBJ_PARM("displayfilter", I_DOPNETDISPLAYFILTER, 0, 0.0); }
143 
144  bool ISPLAYER() const
145  { INT_OBJ_PARM("isplayer", I_DOPNETISPLAYER, 0, 0.0); }
146  void PLAYFILESNAME(UT_String &str) const
147  { STR_OBJ_PARM("playfilesname", I_DOPNETPLAYFILESNAME, 0, 0.0); }
148 
150  { STR_OBJ_PARM("initialstate", I_DOPNETINITIALSTATE, 0, 0.0); }
152  { FLOAT_OBJ_PARM("timestep", I_DOPNETTIMESTEP, 0, 0.0); }
153  int SUBSTEP()
154  { INT_OBJ_PARM("substep", I_DOPNETSUBSTEP, 0, 0.0); }
156  { FLOAT_OBJ_PARM("timeoffset", I_DOPNETTIMEOFFSET, 0, 0.0); }
158  { INT_OBJ_PARM("startframe", I_DOPNETFRAMEOFFSET, 0, 0.0); }
160  { FLOAT_OBJ_PARM("timescale", I_DOPNETTIMESCALE, 0, 0.0); }
162  { INT_OBJ_PARM("maxfeedback", I_DOPNETMAXFEEDBACK, 0, 0.0); }
164  { INT_OBJ_PARM("interpolate", I_DOPNETINTERPOLATE, 0, 0.0); }
165  int AUTORESIM()
166  { INT_OBJ_PARM("autoresim", I_DOPNETAUTORESIM, 0, 0.0); }
167  int DATAHINTS()
168  { INT_OBJ_PARM("datahints", I_DOPNETDATAHINTS, 0, 0.0); }
170  { INT_OBJ_PARM("cacheenabled", I_DOPNETCACHEENABLED, 0, 0.0); }
172  { INT_OBJ_PARM("cachetodisk", I_DOPNETCACHETODISK, 0, 0.0); }
174  { INT_OBJ_PARM("cachetodisknoninteractive", I_DOPNETCACHETODISKNONINTERACTIVE, 0, 0.0); }
176  { INT_OBJ_PARM("cachesubsteps", I_DOPNETCACHESUBSTEPS, 0, 0.0); }
178  { INT_OBJ_PARM("cachemaxsize", I_DOPNETCACHEMAXSIZE, 0, 0.0); }
179 
181  { STR_OBJ_PARM("compresssims", I_DOPNETCOMPRESSSIMS, 0, 0.0); }
182 
184  { INT_OBJ_PARM("explicitcache", I_DOPNETEXPLICITCACHE, 0, 0.0); }
186  { STR_OBJ_PARM("explicitcachename", I_DOPNETEXPLICITCACHENAME, 0, 0.0); }
188  { INT_OBJ_PARM("explicitcachensteps", I_DOPNETEXPLICITCACHENSTEPS, 0, 0.0); }
190  { INT_OBJ_PARM("explicitcachecheckpointspacing", I_DOPNETEXPLICITCACHECHECKPOINTSPACING, 0, 0.0); }
191  static int resimulateStatic(void *, int, fpreal, const PRM_Template *);
192 
193  // This must be const so we thus don't use the indirect.
194  int TIMELESS() const
195  { return evalInt("timeless", 0, 0.0); }
196 
197  // The display and render ops of a DOP Network are always equal.
198  int getDandROpsEqual() override;
199  int updateDandROpsEqual(int check_inputs = 1) override;
200 
201  // Override clearInterrupted to avoid invalidating the whole cache when
202  // the user interrupts a cook.
203  void clearInterrupted() override;
204 
205  OBJ_DopNet *castToOBJDopNet() override { return this; }
206 
207  // invalidate any cached data
208  void clearCache() override;
209 
210  bool opIsPlayer() const override { return ISPLAYER(); }
211 
212 protected:
213  bool updateParmsFlags() override;
214  void getDescriptiveName(UT_String &name) const override;
215  void getDescriptiveParmName(UT_String &name) const override;
216 
217  // Used to get pointer to indirection indices for each object type
218  int *getIndirect() const override
219  { return myDopNetIndirect; }
220 
221  void childFlagChange(OP_Node *) override;
222 
223  // In the dark ages we had a parmchange call back to detect
224  // if sim parameter changed, so required this to know of
225  // any changed. However, this should no longer be required.
226  bool cookedDataUsesAllParameters() const override
227  { return false; }
228 
229  // Override DOP_Parent virtual functions.
230  const DOP_Engine &getEngineSubclass() const override;
231  void setDOPTimeSubclass(const SIM_Time &t) override;
233  void filterDataSubclass(const SIM_Time &t) override;
234 
235  void handleRefilterParms(const SIM_Time &t) override;
236  void handleResimParms(const SIM_Time &t) override;
237 
240  const CH_ChannelList &channels) override;
242  PRM_ParmNameMap &nmap,
243  UT_String &errors) override;
244 
245  void getOwnedMicroNodes(
246  DEP_MicroNodeList &micronodes) override;
247 
248  void dumpMicroNodes(
249  std::ostream &os,
250  bool as_DOT,
251  int indent_level) const override;
252 
253 private:
254  DOP_Engine myEngine;
256  SIM_ConstDataArray myData;
257  UT_Array<GU_ConstDetailHandle> myGeometries;
258  UT_Array<UT_DMatrix4> myPositionData;
260  UT_BitArray myGeoIsGuide;
261 
262  static int *myDopNetIndirect;
263  static int myLastInternalParmIndex;
264 };
265 
266 #undef FLOAT_OBJ_PARM
267 #undef INT_OBJ_PARM
268 #undef STR_OBJ_PARM
269 
270 #endif
bool opIsPlayer() const override
Checks to see if the dop is in play mode.
Definition: OBJ_DopNet.h:210
OP_OpTypeId getChildTypeID() const override
GT_API const UT_StringHolder selection
bool cookedDataUsesAllParameters() const override
Definition: OBJ_DopNet.h:226
virtual DOP_Engine & getNonConstEngineSubclass()=0
int doDrawLit() const override
Definition: OBJ_DopNet.h:139
static const char * theChildTableName
Definition: OBJ_DopNet.h:107
fpreal TIMESTEP()
Definition: OBJ_DopNet.h:151
const GLdouble * v
Definition: glcorearb.h:837
bool EXPLICITCACHE()
Definition: OBJ_DopNet.h:183
int CACHEENABLED()
Definition: OBJ_DopNet.h:169
#define FLOAT_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:22
virtual void handleRefilterParms(const SIM_Time &t)
Definition: DOP_Parent.h:199
virtual OBJ_OBJECT_TYPE getObjectType() const =0
virtual DOP_Parent * castToDOPParent()
Definition: OP_Node.h:2685
int getDandROpsEqual() override
int CACHEMAXSIZE()
Definition: OBJ_DopNet.h:177
int INTERPOLATE()
Definition: OBJ_DopNet.h:163
#define STR_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:26
bool createSpareParametersForLoad(UT_StringArray &names, PRM_ParmNameMap &nmap, UT_String &errors) override
int isObjectLitBy(OBJ_Node *, fpreal) override
Definition: OBJ_DopNet.h:135
virtual void childFlagChange(OP_Node *)
bool getIsTimeless() const override
Definition: OBJ_DopNet.h:123
virtual void clearInterrupted()
Definition: OP_Node.h:2477
bool evalVariableValue(fpreal &val, int var_id, int thread) override
int EXPLICITCACHENSTEPS()
Definition: OBJ_DopNet.h:187
int AUTORESIM()
Definition: OBJ_DopNet.h:165
int TIMELESS() const
Definition: OBJ_DopNet.h:194
int CACHETODISKNONINTERACTIVE()
Definition: OBJ_DopNet.h:173
virtual const DOP_Engine & getEngineSubclass() const =0
void EXPLICITCACHENAME(UT_String &str)
Definition: OBJ_DopNet.h:185
virtual void handleResimParms(const SIM_Time &t)
Definition: DOP_Parent.h:200
void PLAYFILESNAME(UT_String &str) const
Definition: OBJ_DopNet.h:146
OBJ_DopNetIndex
Definition: OBJ_DopNet.h:34
virtual void getDescriptiveName(UT_String &str) const
int SUBSTEP()
Definition: OBJ_DopNet.h:153
int updateDandROpsEqual(int check_inputs=1) override
OP_OpTypeId
Definition: OP_OpTypeId.h:18
virtual OP_Node * getRenderNodePtr()
GLuint const GLchar * name
Definition: glcorearb.h:786
bool ISPLAYER() const
Definition: OBJ_DopNet.h:144
#define INT_OBJ_PARM(name, idx, vi, t)
Definition: OBJ_DopNet.h:24
GLdouble t
Definition: glad.h:2397
int * getIndirect() const override
Definition: OBJ_DopNet.h:218
fpreal STARTFRAME()
Definition: OBJ_DopNet.h:157
virtual void getDescriptiveParmName(UT_String &str) const
**Note that the tasks the is the thread number *for the or if it s being executed by a non pool thread(this *can happen in cases where the whole pool is occupied and the calling *thread contributes to running the work load).**Thread pool.Have fun
int CACHESUBSTEPS()
Definition: OBJ_DopNet.h:175
OBJ_DopNet * castToOBJDopNet() override
Definition: OBJ_DopNet.h:205
virtual int isObjectRenderable(fpreal t) const
int MAXFEEDBACK()
Definition: OBJ_DopNet.h:161
fpreal64 fpreal
Definition: SYS_Types.h:277
void COMPRESSSIMS(UT_String &str)
Definition: OBJ_DopNet.h:180
GLuint index
Definition: glcorearb.h:786
void DISPLAYFILTER(UT_String &str)
Definition: OBJ_DopNet.h:141
bool createSpareParametersFromChannels(UT_BitArray &selection, const CH_ChannelList &channels) override
fpreal TIMEOFFSET()
Definition: OBJ_DopNet.h:155
bool updateParmsFlags() override
const char * getChildType() const override
bool isLightInLightMask(const OBJ_Node *, fpreal) override
Function to resolve lighting based on light masks.
Definition: OBJ_DopNet.h:136
Definition: core.h:1131
virtual void getOwnedMicroNodes(DEP_MicroNodeList &micronodes)
exint evalInt(int pi, int vi, fpreal t) const
static PRM_Template * getObsolete()
bool evalVariableValue(fpreal &v, int i, int thr) override
Definition: OBJ_DopNet.h:94
#define OBJ_API
Definition: OBJ_API.h:10
virtual void setDOPTimeSubclass(const SIM_Time &t)
int CACHETODISK()
Definition: OBJ_DopNet.h:171
int DATAHINTS()
Definition: OBJ_DopNet.h:167
void INITIALSTATE(UT_String &str)
Definition: OBJ_DopNet.h:149
int EXPLICITCACHECHECKPOINTSPACING()
Definition: OBJ_DopNet.h:189
virtual void filterDataSubclass(const SIM_Time &t)=0
virtual void dumpMicroNodes(std::ostream &os, bool as_DOT, int indent_level) const
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 void clearCache()
fpreal TIMESCALE()
Definition: OBJ_DopNet.h:159