55 using namespace HDK_Sample;
75 PRM_Name(
"clear",
"Re-load VEX Functions"),
76 PRM_Name(
"autobind",
"Autobind by Name"),
77 PRM_Name(
"bindings",
"Number of Bindings"),
97 &names[5], 0, &vexsrcMenu),
100 &names[4], 0, 0, 0, 0,
103 1, &names[0], &scriptDefault),
122 myCodeGenerator(
this,
169 "No script specified. Using null.");
174 int argc = script.
parse(argv, 4096);
213 const int chunksize = 1024;
285 namespace HDK_Sample {
326 delete [] myBuffer[i];
327 myBufLen[i] = src.myBufLen[i];
329 if (src.
buffer(i) && src.myBufLen[i])
331 myBuffer[i] =
new char[myBufLen[i]];
332 memcpy(myBuffer[i], src.
buffer(i), src.myBufLen[i]);
343 delete [] myBuffer[i];
349 delete [] myBuffer[bufnum];
353 myBuffer[bufnum] =
new char [
sizeof(
int) * n];
356 myBuffer[bufnum] =
new char [
sizeof(
float) * n];
359 myBuffer[bufnum] =
new char [3*
sizeof(
float) * n];
362 myBuffer[bufnum] =
new char [4*
sizeof(
float) * n];
368 myBufLen[bufnum] =
n;
383 for (
int i = 0; i <
n; i++)
386 ((
int *)myBuffer[bufnum])[i] = handle.
get(primoff);
393 for (
int i = 0; i <
n; i++)
396 ((
float *)myBuffer[bufnum])[i] = handle.
get(primoff);
403 for (
int i = 0; i <
n; i++)
413 for (
int i = 0; i <
n; i++)
439 for (
int i = 0,
src = 0; i <
n; i++,
src += inc)
442 handle.
set(primoff, ((
int *)myBuffer[bufnum])[src]);
449 for (
int i = 0,
src = 0; i <
n; i++,
src += inc)
452 handle.
set(primoff, ((
float *)myBuffer[bufnum])[src]);
459 for (
int i = 0,
src = 0; i <
n; i++,
src += inc)
469 for (
int i = 0,
src = 0; i <
n; i++,
src += inc)
487 const char *
name()
const {
return myName; };
489 const char *
buffer(
int bufnum)
const {
return myBuffer[bufnum]; }
490 char *
buffer(
int bufnum) {
return myBuffer[bufnum]; }
503 int argc,
char **argv,
568 if (!context.
load(argc, argv))
578 for (
int i = 0; i <
n; i++)
615 fpreal32 curtime, curtimeinc, curframe;
650 context.
run(n,
true, &rundata);
void endUpdate(int update_level)
static PRM_Name theVopCompilerName
SYS_FORCE_INLINE void bumpDataId()
static PRM_SpareData shopCVEX
typedef int(APIENTRYP RE_PFNGLXSWAPINTERVALSGIPROC)(int)
Definition of a geometry attribute.
GLenum GLuint GLenum GLsizei const GLchar * buf
void afterAddNode(OP_Node *node)
PRM_API const PRM_Type PRM_CALLBACK
virtual UT_Vector3 baryCenter() const
bool evalVariableValue(fpreal &val, int index, int thread) override
OP_ERROR cookMySop(OP_Context &context) override
void addNode(OP_Node *node, int notify=1, int explicitly=1) override
bool evalVariableValue(UT_String &value, int index, int thread) override
Code generation variables.
bool addInput(const UT_StringHolder &name, CVEX_Type type, bool varying)
PRM_API const PRM_Type PRM_STRING
const OP_NodeFlags & flags() const
DEP_ContextOptionsReadHandle getContextOptions() const
int getTupleSize() const
Size of the AIFTuple, if it exists. If it doesn't, 1.
const PRM_Template * getSpareParmTemplates() const
const char * getChildType() const override
void beforeAddNode(OP_Node *node)
SYS_FORCE_INLINE bool atEnd() const
VOP_CodeGenerator * getVopCodeGenerator() override
OP_Channels * getChannels() const
void opChanged(OP_EventType reason, void *data=0) override
We need special alerts now that we contain VOPs.
PRM_API const PRM_Type PRM_ORD
SOP_PrimVOP(OP_Network *net, const char *, OP_Operator *entry)
virtual void finishedLoadingNetwork(bool is_child_call=false)
bool isVarying() const
Query whether the VEX value is uniform or varying.
void setTimeDependent(bool v)
Parameters for OP_Node::getInfoText()/OP_Node::getNodeSpecificInfoText()
bool setRawData(CVEX_Type type, void *data, int array_size)
Type unsafe way of setting VEX data. Avoid using if possible.
const CVEX_ValueT< PREC > * findOutput(const UT_StringRef &name, CVEX_Type type) const
Find an output by name/type.
**But if you need a or simply need to know when the task has note that the like this
static PRM_Name theVopForceCompileName
virtual bool hasShaderParameter(const char *parm_name)
bool addOperator(OP_Operator *op, std::ostream *err=nullptr)
static const char * theChildTableName
int void appendSeparator()
Append a section separator.
bool getVariableString(int index, UT_String &value)
void addError(int code, const char *msg=0)
void setSize(exint newsize)
SYS_FORCE_INLINE iterator begin(GA_AttributeScope scope=GA_SCOPE_INVALID) const
static bool forceCompile(OP_Node *node)
const char * buffer(int bufnum) const
CH_Manager * getChannelManager()
void opChanged(OP_EventType reason, void *data=0) override
SYS_FORCE_INLINE const UT_StringHolder & getName() const
SYS_FORCE_INLINE GEO_Primitive * getGEOPrimitive(GA_Offset primoff)
A class representing a VEX value.
bool setTypedData(VEXint< PREC > *data, int array_size)
static PRM_Template myTemplateList[]
OP_OperatorFilter * getOperatorFilter()
bool isTimeDependent() const
IMATH_NAMESPACE::V2f float
CH_Manager * CHgetManager()
fpreal getSample(fpreal t) const
void SCRIPT(UT_String &s, fpreal t)
void allocateBuffer(int bufnum, int n)
void addWarning(SOP_ErrorCodes code, const char *msg=0)
fpreal getSamplesPerSec() const
GA_StorageClass getStorageClass() const
Returns the approximate type of the attribute.
const CVEX_ValueT< PREC > * findInput(const UT_StringRef &name, CVEX_Type type) const
Find an input by name/type.
void setTime(fpreal time)
void finishedLoadingNetwork(bool is_child_call=false) override
VOP and VEX functions.
const DEP_ContextOptionsStack * getContextOptionsStack() const
Return the options associated with the calling context.
void SHOPPATH(UT_String &path, fpreal t)
char * buffer(int bufnum)
bool hasVexShaderParameter(const char *parm_name) override
sop_bindparms(const sop_bindparms &src)
void harden()
Take shallow copy and make it deep.
virtual bool buildShaderString(UT_String &result, fpreal now, const UT_Options *options, OP_Node *obj=0, OP_Node *sop=0, SHOP_TYPE interpret_type=SHOP_INVALID)
void ownerChanged(OP_EventType reason, void *data)
bool run(int array_size, bool interruptable, CVEX_RunDataT< PREC > *rundata=nullptr)
#define GA_FOR_ALL_PRIMITIVES(gdp, prim)
void setProcId(exint *procid)
SYS_FORCE_INLINE T get(GA_Offset off, int comp=0) const
UT_StringHolder getFullPath() const
GLuint const GLchar * name
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
CVEX_Type
The CVEX_Type enum defines the VEX types available to CVEX.
PRM_API const PRM_Type PRM_COMMAND
GLenum GLenum GLsizei void * table
void executeVex(int argc, char **argv, fpreal t, OP_Caller &opcaller)
void setManagesDataIDs(bool onOff)
int buildVexCommand(UT_String &result, const PRM_Template *templatelist, fpreal now, int start_parm=0, int end_parm=INT_MAX, bool use_parmvop_tag=true)
SYS_FORCE_INLINE const GA_Attribute * findPrimitiveAttribute(GA_AttributeScope s, const UT_StringRef &name) const
sop_bindparms & operator=(const sop_bindparms &src)
exint entries() const
Alias of size(). size() is preferred.
void getNodeSpecificInfoText(OP_Context &context, OP_NodeInfoParms &parms) override
static CH_LocalVariable theLocalVariables[]
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *entry)
SYS_FORCE_INLINE GA_Size getNumVertices() const
Return the number verticies in the entire detail.
**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
SYS_FORCE_INLINE GA_Index getMapIndex() const
Gets the index of this primitive in the detail containing it.
virtual void addNode(OP_Node *node, int notify=1, int explicitly=1)
void setGeoCommandQueue(VEX_GeoCommandQueue< PREC > *geocmd)
Sets the command queue for this context.
Push & restore the evaluation time (and optionally a channel collection)
const char * name() const
virtual void addExtraInput(OP_Node *op, OP_InterestType type)
SYS_FORCE_INLINE void set(GA_Offset off, const T &val) const
void setTimeDep(bool on_off)
void marshallDataToGdp(int bufnum, GU_Detail *gdp, int *primid, int n, int inc)
SYS_FORCE_INLINE GA_Offset primitiveOffset(GA_Index index) const
Given a primitive's index (in append order), return its data offset.
SYS_FORCE_INLINE const GA_AttributeDict & primitiveAttribs() const
OP_API OP_Director * OPgetDirector()
void newSopOperator(OP_OperatorTable *table)
sop_bindparms(const char *name, CVEX_Type type)
SYS_FORCE_INLINE GA_Size getNumPrimitives() const
Return the number of primitives.
const DEP_ContextOptionsStack * getContextOptionsStack() const
Per-run data for CVEX execution.
DEP_ContextOptionsReadHandle getContextOptions() const
Return the options associated with the calling context.
SHOP_Node * findSHOPNode(const char *path) const
static const int INPUT_BUFFER
void append(const char *string)
Append a string to the text buffer.
void marshallIntoBuffer(int bufnum, GU_Detail *gdp, int *primid, int n)
int parse(char *argv[], int max_args, const char *quotes="\"'", bool keep_quotes=false)
void setOpCaller(UT_OpCaller *caller)
bool load(int argc, const char *const argv[])
void ownerFinishedLoadingNetwork()
const UT_String & getVexWarnings() const
OP_OpTypeId getChildTypeID() const override
OP_OperatorFilter * getOperatorFilter() override
Overriding these are what allow us to contain VOPs.
void processVexBlock(CVEX_Context &context, CVEX_RunData &rundata, int argc, char **argv, int *primid, int n, fpreal t)
const UT_String & getVexErrors() const
static PRM_Default theVopCompilerVexDefault
void getNodeSpecificInfoText(OP_Context &context, OP_NodeInfoParms &iparms) override
VOP_CodeGenerator myCodeGenerator
static const int NUM_BUFFERS
static const int OUTPUT_BUFFER
void buildScript(UT_String &script, fpreal t)
void appendQueue(VEX_GeoCommandQueue< PREC > &geocmd)
SYS_FORCE_INLINE GA_Size getNumPoints() const
Return the number of points.
OP_ERROR duplicateSource(unsigned index, OP_Context &context, GU_Detail *gdp, bool clean=true)