00001 /* 00002 * PROPRIETARY INFORMATION. This software is proprietary to 00003 * Side Effects Software Inc., and is not to be reproduced, 00004 * transmitted, or disclosed in any way without written permission. 00005 * 00006 * Produced by: 00007 * Yin Zhao 00008 * Side Effects Software Inc 00009 * 123 Front Street West, Suite 1401 00010 * Toronto, Ontario 00011 * Canada M5J 2M2 00012 * 416-504-9876 00013 */ 00014 00015 #ifndef __SIM_TriangulatedGeometry_H__ 00016 #define __SIM_TriangulatedGeometry_H__ 00017 00018 #include "SIM_API.h" 00019 #include "SIM_Data.h" 00020 #include "SIM_DataUtils.h" 00021 00022 #include <UT/UT_FloatArray.h> 00023 #include <UT/UT_IntArray.h> 00024 #include <UT/UT_Vector4Array.h> 00025 00026 /// This class holds a polyized geometry for which people can query. 00027 /// This is an alternative representation. 00028 /// This caches the point positions in the SIM_Geometry's space, 00029 /// so are independent of SIM_Geometry's transform. 00030 class SIM_API SIM_TriangulatedGeometry : public SIM_Data 00031 { 00032 public: 00033 /// initializes alternate geometry for lite functions 00034 void init() const; 00035 00036 /// Gets the position of a point in SIM_Geometry space, given point ID 00037 UT_Vector4 getPointPos(int ptId) const; 00038 /// Gets the position of a point in SIM_Geometry space, 00039 ///given primitive ID and vertex number 00040 UT_Vector4 getPointPos(int primId, int vtNum) const; 00041 /// Returns the total number of points 00042 int getPointCount() const; 00043 /// Gets the corresponding point id given a vertex number and a 00044 /// primitive id 00045 int getPointId(int primId, int vtNum) const; 00046 /// Gets the number of primitives 00047 int getPrimitiveCount() const; 00048 /// Gets the number of vertices of a given primitive 00049 int getVertexCount(int primNum = 0) const; 00050 /// Returns the baryCenter of a given primitive 00051 /// Gets the point density, given point ID 00052 float getPointDensity(int ptId) const; 00053 /// Gets the point density, given primitive ID and vertex number 00054 float getPointDensity(int primId, int vtNum) const; 00055 00056 /// Returns the barycenter of the triangle. 00057 /// It is estimated from point density (if any) 00058 UT_Vector3 getBaryCenter(int primNum) const; 00059 00060 protected: 00061 explicit SIM_TriangulatedGeometry(const SIM_DataFactory *factory); 00062 virtual ~SIM_TriangulatedGeometry(); 00063 00064 /// Overrides to properly implement this class as a SIM_Data. 00065 /// This object is meant to be updated from the object's geometry at 00066 /// each frame, so we only implement skeleton save, and load methods. 00067 virtual bool getIsAlternateRepresentationSubclass() const; 00068 virtual int64 getMemorySizeSubclass() const; 00069 virtual void initAlternateRepresentationSubclass(const SIM_Data &); 00070 00071 private: 00072 UT_Vector4Array myPointPos; 00073 UT_IntArray myPointNum; 00074 UT_FloatArray myDensity; 00075 00076 DECLARE_STANDARD_GETCASTTOTYPE(); 00077 00078 DECLARE_DATAFACTORY(SIM_TriangulatedGeometry, 00079 SIM_Data, 00080 "TriangulatedGeometry", 00081 getEmptyDopDescription()); 00082 }; 00083 00084 #endif
1.5.9