HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OBJ_Rivet.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_Rivet.h (Custom Library, C++)
7  *
8  * COMMENTS: An object that attaches itself to another object (i.e.
9  * geometry). Based on three chosen points of the
10  * object, it constructs a local reference frame on the
11  * object's surface, and attaches itself to that frame.
12  * When surface moves, the attached rivet object also
13  * moves with it.
14  *
15  */
16 
17 #ifndef __OBJ_Rivet__
18 #define __OBJ_Rivet__
19 
20 #include "OBJ_API.h"
21 #include <UT/UT_Vector2.h>
22 #include <UT/UT_Vector3Array.h>
23 #include <GU/GU_DetailHandle.h>
24 #include "OBJ_Null.h"
25 
26 // order should correspond to OBJrivetTemplate
28 {
35 
37 };
38 
39 
40 class OBJ_API OBJ_Rivet : public OBJ_Null
41 {
42 public:
43  OBJ_Rivet(OP_Network *net,
44  const char *name,
45  OP_Operator *op);
46  virtual ~OBJ_Rivet();
47 
48  virtual OBJ_OBJECT_TYPE getObjectType() const;
49 
50  static OP_Node *myConstructor(OP_Network *net,
51  const char *name,
52  OP_Operator *entry);
53 
54  static PRM_Template *getTemplateList();
55  virtual OBJ_Rivet *castToOBJRivet() { return this; }
56 
57 
58  // accessors of the parameters
59  void RIVET_GEOPATH( UT_String &str, fpreal t )
60  {
61  evalString(str, "rivetsop", 0, t);
62  }
64  {
65  evalString(str, "rivetgroup", 0, t);
66  }
68  {
69  return evalInt("rivetuseattribs", 0, 0.0f);
70  }
72  {
73  evalString(str, "rivetxattrib", 0, t);
74  }
76  {
77  evalString(str, "rivetzattrib", 0, t);
78  }
79 
81  CH_StringMeaning meaning, fpreal t)
82  {
83  setString(str, meaning, "rivetsop", 0, t);
84  }
86  CH_StringMeaning meaning, fpreal t)
87  {
88  setString(str, meaning, "rivetgroup", 0,t);
89  }
90 
91 protected:
92  virtual bool updateParmsFlags();
93 
94  // Used to get pointer to indirection indices for each object type
95  virtual int *getIndirect() const
96  { return rivetIndirect; }
97 
98  virtual OP_ERROR cookMyObj(OP_Context &context);
99 
100  GU_DetailHandle getStuckGdp(fpreal t);
101 
102  virtual void buildPointGroupMenu( PRM_Name *menu,
103  int size,
104  const PRM_SpareData *spare,
105  const PRM_Parm *parm);
107  {
108  return evalFloat("rivetweights", k, t);
109  }
110 
111 private:
112  // obtains array of points based on which a local surface frame is build
113  // also, for each point, obtains normals (z-axis) and tangents (x-axis)
114  // if the attribute names are provided for them by the rivet parameters
115  void getRivetPoints( OP_Context &context,
116  SOP_Node *sop,
117  UT_Vector3RArray &points,
118  UT_Vector3RArray &tangents,
119  UT_Vector3RArray &normals );
120 
121  // obtains the weights for the points
122  void getPointWeights( fpreal t,
123  UT_FprealArray &weights,
124  int point_count);
125 
126 private:
127  static int *rivetIndirect;
128 };
129 
130 #endif
131 
void RIVET_GEOPATH(UT_String &str, fpreal t)
Definition: OBJ_Rivet.h:59
OBJ_RivetIndex
Definition: OBJ_Rivet.h:27
static PRM_Template * getTemplateList()
CH_StringMeaning
void RIVET_POINTGROUP(UT_String &str, fpreal t)
Definition: OBJ_Rivet.h:63
void setRIVET_GEOPATH(UT_String &str, CH_StringMeaning meaning, fpreal t)
Definition: OBJ_Rivet.h:80
fpreal evalFloat(int pi, int vi, fpreal t) const
fpreal RIVET_POINTWEIGHT(fpreal t, int k)
Definition: OBJ_Rivet.h:106
UT_ErrorSeverity
Definition: UT_Error.h:25
static void buildPointGroupMenu(void *o, PRM_Name *, int, const PRM_SpareData *, const PRM_Parm *)
static OP_Node * myConstructor(OP_Network *net, const char *name, OP_Operator *entry)
void setString(const UT_StringRef &val, CH_StringMeaning meaning, int parmi, int vectori, fpreal t)
virtual OBJ_OBJECT_TYPE getObjectType() const
Definition: OBJ_Null.h:47
GLsizeiptr size
Definition: glcorearb.h:663
virtual int * getIndirect() const
Definition: OBJ_Rivet.h:95
GLfloat f
Definition: glcorearb.h:1925
void evalString(UT_String &val, int pi, int vi, fpreal t) const
virtual OP_ERROR cookMyObj(OP_Context &context)
GLuint const GLchar * name
Definition: glcorearb.h:785
void RIVET_X_ATTRIB_NAME(UT_String &str, fpreal t)
Definition: OBJ_Rivet.h:71
double fpreal
Definition: SYS_Types.h:270
void setRIVET_POINTGROUP(UT_String &str, CH_StringMeaning meaning, fpreal t)
Definition: OBJ_Rivet.h:85
void RIVET_Z_ATTRIB_NAME(UT_String &str, fpreal t)
Definition: OBJ_Rivet.h:75
bool RIVET_USE_ATTRIBS()
Definition: OBJ_Rivet.h:67
exint evalInt(int pi, int vi, fpreal t) const
virtual bool updateParmsFlags()
#define OBJ_API
Definition: OBJ_API.h:10
virtual OBJ_Rivet * castToOBJRivet()
Definition: OBJ_Rivet.h:55
OBJ_OBJECT_TYPE
Definition: OBJ_Node.h:71