Changeset 2609 for GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h
- Timestamp:
- 01/17/08 21:46:32 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/Mesh.h
r2575 r2609 62 62 63 63 /** Mesh containing polygonal patches */ 64 class Mesh { 64 class Mesh 65 { 65 66 66 67 public: 67 68 68 69 /// Default constructor 69 Mesh(): mVertices(), mFaces(), mMaterial(NULL), mKdTree(NULL), mId(0) {}70 Mesh(): mVertices(), mFaces(), mMaterial(NULL), mKdTree(NULL), mId(0) {} 70 71 71 72 /// Constructor with container preallocation 72 Mesh(const int vertices, const int faces): 73 mFaces(), 74 mMaterial(NULL), 75 mKdTree(NULL), 76 mVertices(), 77 mIsConvex(false), 78 mIsWatertight(false), 79 mId(0) 80 { 81 mVertices.reserve(vertices); 82 mFaces.reserve(faces); 83 } 84 73 Mesh(const int vertices, const int faces); 85 74 /** Constructor setting a unqiue mesh id. 86 75 */ 87 76 Mesh(const int id); 88 89 77 /** Setting unique mesh id and using preallocation. 90 78 */ 91 79 Mesh(const int id, const int vertices, const int faces); 92 93 80 /** Copy constructor making a deep copy of the faces. 94 81 */ 95 82 Mesh(const Mesh &rhs); 96 97 83 /** Assignement operator. 98 84 @note does not copy id … … 116 102 void AddFace(Face *face) 117 103 { 118 104 mFaces.push_back(face); 119 105 } 120 106 121 107 void ComputeBoundingBox(); 122 123 108 /** This function must be called after creating the mesh 124 109 because it creates the local kd tree and the bounding box. … … 132 117 void ApplyTransformation(const Matrix4x4 &m); 133 118 134 /** Axis aligned bounding box of the mesh in local mesh coordinates. 135 */ 136 AxisAlignedBox3 mBox; 137 138 /** Vertices forming the mesh. 139 */ 119 /// Axis aligned bounding box of the mesh in local mesh coordinates. 120 AxisAlignedBox3 mBox; 121 /// Vertices forming the mesh. 140 122 VertexContainer mVertices; 141 142 /** Patches forming the mesh. 143 */ 123 /// Patches forming the mesh. 144 124 FaceContainer mFaces; 145 146 /** Global mesh material. 147 */ 125 /// Global mesh material. 148 126 Material *mMaterial; 149 150 /** true if the mesh is a convex mesh. 151 */ 127 /// true if the mesh is a convex mesh. 152 128 bool mIsConvex; 153 154 /** true if the mesh is a convex mesh. 155 */ 129 /// true if the mesh is a convex mesh. 156 130 bool mIsWatertight; 157 131 … … 202 176 /** Returns unique mesh id. 203 177 */ 204 int GetId() const 205 { 206 return mId; 207 } 178 int GetId() const { return mId; } 208 179 209 180 … … 245 216 246 217 public: 247 MeshInstance(Mesh *mesh): Intersectable(), mMesh(mesh), mMaterial(NULL)218 MeshInstance(Mesh *mesh): Intersectable(), mMesh(mesh), mMaterial(NULL) 248 219 { 249 220 } … … 315 286 { 316 287 public: 317 TransformedMeshInstance(Mesh *mesh); 318 319 virtual AxisAlignedBox3 GetBox() const; 320 321 322 virtual int CastRay(Ray &ray); 323 324 virtual int CastRay(Ray &ray, const std::vector<int> &faces); 325 326 virtual int Type() const { return TRANSFORMED_MESH_INSTANCE; } 327 328 int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal); 329 330 /** Transforms this mesh instance by m. 331 */ 332 void ApplyWorldTransform(const Matrix4x4 &m); 333 334 /** Loads the transformation matrix into this mesh instance. 335 */ 336 void LoadWorldTransform(const Matrix4x4 &m); 337 338 /** The transformation is returned in m. 339 */ 340 void GetWorldTransform(Matrix4x4 &m) const; 341 342 /** Transforms a mesh according to the stored world transform. 343 @param transformedMesh returns the tranformed mesh. 344 */ 345 void GetTransformedMesh(Mesh &transformedMesh) const; 346 347 Vector3 GetNormal(const int idx) const; 288 TransformedMeshInstance(Mesh *mesh); 289 290 virtual AxisAlignedBox3 GetBox() const; 291 292 virtual int CastRay(Ray &ray); 293 294 virtual int CastRay(Ray &ray, const std::vector<int> &faces); 295 296 virtual int Type() const { return TRANSFORMED_MESH_INSTANCE; } 297 298 int GetRandomSurfacePoint(Vector3 &point, Vector3 &normal); 299 300 /** Transforms this mesh instance by m. 301 */ 302 void ApplyWorldTransform(const Matrix4x4 &m); 303 /** Loads the transformation matrix into this mesh instance. 304 */ 305 void LoadWorldTransform(const Matrix4x4 &m); 306 /** The transformation is returned in m. 307 */ 308 void GetWorldTransform(Matrix4x4 &m) const; 309 /** Transforms a mesh according to the stored world transform. 310 @param transformedMesh returns the tranformed mesh. 311 */ 312 void GetTransformedMesh(Mesh &transformedMesh) const; 313 314 Vector3 GetNormal(const int idx) const; 348 315 349 316 protected:
Note: See TracChangeset
for help on using the changeset viewer.