Panda3D
physxClothMeshDesc.I
Go to the documentation of this file.
1 /**
2  * PANDA 3D SOFTWARE
3  * Copyright (c) Carnegie Mellon University. All rights reserved.
4  *
5  * All use of this software is subject to the terms of the revised BSD
6  * license. You should have received a copy of this license along
7  * with this source code in a file named "LICENSE."
8  *
9  * @file physxClothMeshDesc.I
10  * @author enn0x
11  * @date 2010-03-28
12  */
13 
14 /**
15  *
16  */
17 INLINE PhysxClothMeshDesc::
18 PhysxClothMeshDesc() {
19 
20  _desc.flags = 0;
21  _desc.pointStrideBytes = sizeof(NxVec3);
22  _desc.triangleStrideBytes = 3*sizeof(NxU32);
23  _desc.points = nullptr;
24  _desc.triangles = nullptr;
25 
26  _points = nullptr;
27  _triangles = nullptr;
28  _texcoords = nullptr;
29 }
30 
31 /**
32  *
33  */
34 INLINE PhysxClothMeshDesc::
35 ~PhysxClothMeshDesc() {
36 
37  if (_points) {
38  delete [] _points;
39  }
40 
41  if (_triangles) {
42  delete [] _triangles;
43  }
44 
45  if (_texcoords) {
46  delete [] _texcoords;
47  }
48 }
49 
50 /**
51  * Returns true if the descriptor is valid.
52  */
53 INLINE bool PhysxClothMeshDesc::
54 is_valid() const {
55 
56  return _desc.isValid();
57 }
58 
59 /**
60  *
61  */
62 INLINE const NxClothMeshDesc &PhysxClothMeshDesc::
63 get_desc() const {
64 
65  return _desc;
66 }
67 
68 /**
69  *
70  */
71 INLINE const plist<LPoint2f> PhysxClothMeshDesc::
72 get_texcoords() const {
73 
74  plist<LPoint2f> texcoords;
75 
76  for (unsigned int i=0; i < _desc.numVertices; i++) {
77  LPoint2f uv = _texcoords[i];
78  texcoords.push_back(uv);
79  }
80 
81  return texcoords;
82 }
bool is_valid() const
Returns true if the descriptor is valid.
This is our own Panda specialization on the default STL list.
Definition: plist.h:35