HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SIM_ConAnchorObjSurfacePos.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: SIM_ConAnchorObjSurfacePos.h ( SIM Library, C++)
7  *
8  * COMMENTS:
9  * This anchor represents a surface on an object (a group of polygons)
10  * This can be used to attach a cloth object to fixed positions on the
11  * surface of an animated, deforming body object.
12  */
13 
14 #ifndef __SIM_ConAnchorObjSurfacePos__
15 #define __SIM_ConAnchorObjSurfacePos__
16 
17 #include "SIM_API.h"
18 #include "SIM_ConAnchor.h"
19 #include <vector>
20 
21 // This consists of the barycentric coordinates with respect
22 // to a triangle and an offset from the triangle surface
23 // (in a direction that depends only on the winding order).
25 {
27  {
28  // invalid point indices
29  myPS[0] = -1;
30  myPS[1] = -1;
31  myPS[2] = -1;
32 
33  // invalid weights
34  myBary[0] = 0;
35  myBary[1] = 0;
36  myBary[2] = 0;
37  }
38 
39  // Indices of triangle
41  // Weights for each of the triangle corner points (should sum up to 1)
43 };
44 
46 {
47 public:
49  typedef std::vector<AttachPoint> AttachPoints;
50 
52 
53  /// Store the group of primitives that restrict the attachment surface
55 
56  const std::vector<GA_Index>& primitiveIndices() const;
57 
58  void initializeAttachPoints(AttachPoints& attach_points);
59 
60  const AttachPoints& attachPoints() const;
61 
62  // Print attachment points, for debug purposes
63  void print(std::ostream& os) const;
64 
65 protected:
67  virtual ~SIM_ConAnchorObjSurfacePos();
68 
69  virtual bool getNeedsInitSubclass() const;
70  virtual void initAnchorSubclass(const SIM_Object *object);
71 
72  virtual bool getObjectSpecificationSubclass(UT_String &str) const;
73 
75  const SIM_Options &options,
76  const GU_DetailHandle &gdh,
77  const SIM_Relationship &rel,
78  const SIM_Time &t) const;
79 
80 
81  virtual void makeEqualSubclass(const SIM_Data *source);
82  virtual void saveSubclass(std::ostream &os) const;
83  virtual bool loadSubclass(UT_IStream &is);
84 
85 private:
86  // Unordered set of primitives that define the attachment surface on
87  // the object
88  std::vector<GA_Index> myPrimitiveIndices;
89 
90  // For each constrained point, the closest bary point anywhere on
91  // any of the surface primitives
92  AttachPoints myAttachPoints;
93 
94  static const SIM_DopDescription *getDopDescription();
95 
99  "Anchor: Object Surface Position",
100  getDopDescription());
101 };
102 
103 #endif
104 
virtual void makeEqualSubclass(const SIM_Data *source)
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
virtual bool loadSubclass(UT_IStream &is)
virtual bool getObjectSpecificationSubclass(UT_String &str) const
Implements the real functionality of getObjectSpecification.
#define GETSET_DATA_FUNCS_S(DataName, FuncName)
virtual void buildAnchorGuideGeometrySubclass(const SIM_Options &options, const GU_DetailHandle &gdh, const SIM_Relationship &rel, const SIM_Time &t) const
Default implementation does nothing.
virtual void initAnchorSubclass(const SIM_Object *object)
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
std::vector< AttachPoint > AttachPoints
GLfloat f
Definition: glcorearb.h:1925
GLsizei GLsizei GLchar * source
Definition: glcorearb.h:802
virtual void saveSubclass(std::ostream &os) const
virtual bool getNeedsInitSubclass() const
GA_Size GA_Index
Define the strictness of GA_Offset/GA_Index.
Definition: GA_Types.h:611
double fpreal
Definition: SYS_Types.h:270
#define SIM_NAME_OBJECT
Definition: SIM_Names.h:224
#define SIM_API
Definition: SIM_API.h:10
#define SIM_NAME_PRIMITIVEGROUP
Definition: SIM_Names.h:171