PxCooking.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_COOKING_H
15 #define PX_COOKING_H
16 
21 #include "cooking/Pxc.h"
22 
25 
26 #ifndef PX_DOXYGEN
27 namespace physx
28 {
29 #endif
30 
31 class PxOutputStream;
32 class PxBinaryConverter;
34 
35 struct PxPlatform
36 {
37  enum Enum
38  {
39  ePC,
43  eWIIU
44  };
45 };
46 
51 {
52  enum Enum
53  {
58 
65 
69  eFAILURE
70  };
71 };
72 
80 {
81  enum Enum
82  {
86  eWELD_VERTICES = 1 << 0,
87 
91  PX_DEPRECATED eREMOVE_UNREFERENCED_VERTICES = 1 << 1,
92 
96  PX_DEPRECATED eREMOVE_DUPLICATED_TRIANGLES = 1 << 2,
97 
106  eDISABLE_CLEAN_MESH = 1 << 3,
107 
111  eDISABLE_ACTIVE_EDGES_PRECOMPUTE = 1 << 4,
112 
118  eFORCE_32BIT_INDICES = 1 << 5
119  };
120 };
121 
123 
126 {
127  enum Enum
128  {
129  eSIM_PERFORMANCE = 0,
130  eCOOKING_PERFORMANCE = 1
131  };
132 };
133 
141 {
152 
171  float skinWidth;
172 
186 
195 
203 
212 
219 
226 
243 
256 
258  skinWidth(0.025f*sc.length),
259  areaTestEpsilon(0.06f*sc.length*sc.length),
260  suppressTriangleMeshRemapTable(false),
261  buildTriangleAdjacencies(false),
262  scale(sc),
263  meshPreprocessParams(0),
264  meshCookingHint(PxMeshCookingHint::eSIM_PERFORMANCE),
265  meshWeldTolerance(0.f),
266  meshSizePerformanceTradeOff(0.55f)
267  {
268 #if defined(PX_X86) || defined(PX_X64)
269  targetPlatform = PxPlatform::ePC;
270 #elif defined(PX_X360)
271  targetPlatform = PxPlatform::eXENON;
272 #elif defined(PX_PS3)
273  targetPlatform = PxPlatform::ePLAYSTATION3;
274 #elif defined(PX_ARM) || defined(PX_A64)
275  targetPlatform = PxPlatform::eARM;
276 #elif defined(PX_WIIU)
277  targetPlatform = PxPlatform::eWIIU;
278 #else
279 #error Unknown platform
280 #endif
281  }
282 };
283 
285 {
286 public:
295  virtual void release() = 0;
296 
304  virtual void setParams(const PxCookingParams& params) = 0;
305 
313  virtual const PxCookingParams& getParams() = 0;
314 
320  virtual bool platformMismatch() = 0;
321 
341  virtual bool cookTriangleMesh(const PxTriangleMeshDesc& desc, PxOutputStream& stream) = 0;
342 
352  virtual PxTriangleMesh* createTriangleMesh(const PxTriangleMeshDesc& desc, PxPhysicsInsertionCallback& insertionCallback) = 0;
353 
367  virtual bool validateTriangleMesh(const PxTriangleMeshDesc& desc) = 0;
368 
393  virtual bool cookConvexMesh(const PxConvexMeshDesc& desc, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition = NULL) = 0;
394 
416  virtual bool computeHullPolygons(const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback, PxU32& nbVerts, PxVec3*& vertices,
417  PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons) = 0;
418 
433  virtual bool cookHeightField(const PxHeightFieldDesc& desc, PxOutputStream& stream) = 0;
434 
444  virtual PxHeightField* createHeightField(const PxHeightFieldDesc& desc, PxPhysicsInsertionCallback& insertionCallback) = 0;
445 
446 
447 protected:
448  virtual ~PxCooking(){}
449 };
450 
451 #ifndef PX_DOXYGEN
452 } // namespace physx
453 #endif
454 
473  physx::PxFoundation& foundation,
474  const physx::PxCookingParams& params);
475 
477 #endif


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