PxClothMeshDesc.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12 
13 
14 #ifndef PX_PHYSICS_NX_CLOTHMESHDESC
15 #define PX_PHYSICS_NX_CLOTHMESHDESC
16 
22 
23 #ifndef PX_DOXYGEN
24 namespace physx
25 {
26 #endif
27 
35 {
36 public:
37 
42 
51 
67 
83 
88 
96  PX_INLINE void setToDefault();
101  PX_INLINE bool isValid() const;
102 };
103 
104 PX_INLINE PxClothMeshDesc::PxClothMeshDesc() //constructor sets to default
105 {
106 }
107 
109 {
110  *this = PxClothMeshDesc();
111 }
112 
114 {
115  if(points.count < 3) //at least 1 trig's worth of points
116  return false;
117  if(points.count > 0xffff && flags & PxMeshFlag::e16_BIT_INDICES)
118  return false;
119  if(!points.data)
120  return false;
121  if(points.stride < sizeof(PxVec3)) //should be at least one point's worth of data
122  return false;
123 
124  if(invMasses.data && invMasses.stride < sizeof(float))
125  return false;
126  if(invMasses.data && invMasses.count != points.count)
127  return false;
128 
129  if (!triangles.count && !quads.count) // no support for non-indexed mesh
130  return false;
131  if (triangles.count && !triangles.data)
132  return false;
133  if (quads.count && !quads.data)
134  return false;
135 
136  PxU32 indexSize = (flags & PxMeshFlag::e16_BIT_INDICES) ? sizeof(PxU16) : sizeof(PxU32);
137  if(triangles.count && triangles.stride < indexSize*3)
138  return false;
139  if(quads.count && quads.stride < indexSize*4)
140  return false;
141 
142  return true;
143 }
144 
145 #ifndef PX_DOXYGEN
146 } // namespace physx
147 #endif
148 
150 #endif


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com