00001 // Filename: physxClothMeshDesc.I 00002 // Created by: enn0x (28Mar10) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: PhysxClothMeshDesc::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE PhysxClothMeshDesc:: 00022 PhysxClothMeshDesc() { 00023 00024 _desc.flags = 0; 00025 _desc.pointStrideBytes = sizeof(NxVec3); 00026 _desc.triangleStrideBytes = 3*sizeof(NxU32); 00027 _desc.points = NULL; 00028 _desc.triangles = NULL; 00029 00030 _points = NULL; 00031 _triangles = NULL; 00032 _texcoords = NULL; 00033 } 00034 00035 //////////////////////////////////////////////////////////////////// 00036 // Function: PhysxClothMeshDesc::Destructor 00037 // Access: Public 00038 // Description: 00039 //////////////////////////////////////////////////////////////////// 00040 INLINE PhysxClothMeshDesc:: 00041 ~PhysxClothMeshDesc() { 00042 00043 if (_points) { 00044 delete [] _points; 00045 } 00046 00047 if (_triangles) { 00048 delete [] _triangles; 00049 } 00050 00051 if (_texcoords) { 00052 delete [] _texcoords; 00053 } 00054 } 00055 00056 //////////////////////////////////////////////////////////////////// 00057 // Function: PhysxClothMeshDesc::is_valid 00058 // Access: Published 00059 // Description: Returns true if the descriptor is valid. 00060 //////////////////////////////////////////////////////////////////// 00061 INLINE bool PhysxClothMeshDesc:: 00062 is_valid() const { 00063 00064 return _desc.isValid(); 00065 } 00066 00067 //////////////////////////////////////////////////////////////////// 00068 // Function: PhysxClothMeshDesc::get_desc 00069 // Access: Public 00070 // Description: 00071 //////////////////////////////////////////////////////////////////// 00072 INLINE const NxClothMeshDesc &PhysxClothMeshDesc:: 00073 get_desc() const { 00074 00075 return _desc; 00076 } 00077 00078 //////////////////////////////////////////////////////////////////// 00079 // Function: PhysxClothMeshDesc::get_texcoords 00080 // Access: Public 00081 // Description: 00082 //////////////////////////////////////////////////////////////////// 00083 INLINE const plist<LPoint2f> PhysxClothMeshDesc:: 00084 get_texcoords() const { 00085 00086 plist<LPoint2f> texcoords; 00087 00088 for (unsigned int i=0; i < _desc.numVertices; i++) { 00089 LPoint2f uv = _texcoords[i]; 00090 texcoords.push_back(uv); 00091 } 00092 00093 return texcoords; 00094 } 00095