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