HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
SIM_TriangulatedGeometry.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  */
7 
8 #ifndef __SIM_TriangulatedGeometry_H__
9 #define __SIM_TriangulatedGeometry_H__
10 
11 #include "SIM_API.h"
12 #include "SIM_Data.h"
13 #include "SIM_DataUtils.h"
14 
15 #include <UT/UT_FloatArray.h>
16 #include <UT/UT_IntArray.h>
17 #include <UT/UT_Vector4Array.h>
18 
19 /// This class holds a polyized geometry for which people can query.
20 /// This is an alternative representation.
21 /// This caches the point positions in the SIM_Geometry's space,
22 /// so are independent of SIM_Geometry's transform.
24 {
25 public:
26  /// initializes alternate geometry for lite functions
27  void init() const;
28 
29  /// Gets the position of a point in SIM_Geometry space, given point ID
30  UT_Vector3 getPointPos(int ptId) const;
31  /// Gets the position of a point in SIM_Geometry space,
32  ///given primitive ID and vertex number
33  UT_Vector3 getPointPos(int primId, int vtNum) const;
34  /// Returns the total number of points
35  int getPointCount() const;
36  /// Gets the corresponding point id given a vertex number and a
37  /// primitive id
38  int getPointId(int primId, int vtNum) const;
39  /// Gets the number of primitives
40  int getPrimitiveCount() const;
41  /// Gets the number of vertices of a given primitive
42  int getVertexCount(int primNum = 0) const;
43  /// Returns the baryCenter of a given primitive
44  /// Gets the point density, given point ID
45  float getPointDensity(int ptId) const;
46  /// Gets the point density, given primitive ID and vertex number
47  float getPointDensity(int primId, int vtNum) const;
48 
49  /// Returns the barycenter of the triangle.
50  /// It is estimated from point density (if any)
51  UT_Vector3 getBaryCenter(int primNum) const;
52 
53 protected:
54  explicit SIM_TriangulatedGeometry(const SIM_DataFactory *factory);
55  virtual ~SIM_TriangulatedGeometry();
56 
57  /// Overrides to properly implement this class as a SIM_Data.
58  /// This object is meant to be updated from the object's geometry at
59  /// each frame, so we only implement skeleton save, and load methods.
60  virtual bool getIsAlternateRepresentationSubclass() const;
61  virtual int64 getMemorySizeSubclass() const;
62  virtual void initAlternateRepresentationSubclass(const SIM_Data &);
63 
64 private:
65  UT_Vector3Array myPointPos;
66  UT_IntArray myPointNum;
67  UT_FloatArray myDensity;
68 
70 
72  SIM_Data,
73  "TriangulatedGeometry",
75 };
76 
77 #endif
#define DECLARE_STANDARD_GETCASTTOTYPE()
Definition: SIM_DataUtils.h:45
virtual bool getIsAlternateRepresentationSubclass() const
virtual int64 getMemorySizeSubclass() const
#define DECLARE_DATAFACTORY(DataClass, SuperClass, Description, DopParms)
Definition: SIM_DataUtils.h:58
long long int64
Definition: SYS_Types.h:100
#define SIM_API
Definition: SIM_API.h:10
virtual void initAlternateRepresentationSubclass(const SIM_Data &)
static const SIM_DopDescription * getEmptyDopDescription()
A DOP description that says not to create an automatic DOP.