PxCooking.h

Go to the documentation of this file.
00001 // This code contains NVIDIA Confidential Information and is disclosed to you
00002 // under a form of NVIDIA software license agreement provided separately to you.
00003 //
00004 // Notice
00005 // NVIDIA Corporation and its licensors retain all intellectual property and
00006 // proprietary rights in and to this software and related documentation and
00007 // any modifications thereto. Any use, reproduction, disclosure, or
00008 // distribution of this software and related documentation without an express
00009 // license agreement from NVIDIA Corporation is strictly prohibited.
00010 //
00011 // ALL NVIDIA DESIGN SPECIFICATIONS, CODE ARE PROVIDED "AS IS.". NVIDIA MAKES
00012 // NO WARRANTIES, EXPRESSED, IMPLIED, STATUTORY, OR OTHERWISE WITH RESPECT TO
00013 // THE MATERIALS, AND EXPRESSLY DISCLAIMS ALL IMPLIED WARRANTIES OF NONINFRINGEMENT,
00014 // MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE.
00015 //
00016 // Information and code furnished is believed to be accurate and reliable.
00017 // However, NVIDIA Corporation assumes no responsibility for the consequences of use of such
00018 // information or for any infringement of patents or other rights of third parties that may
00019 // result from its use. No license is granted by implication or otherwise under any patent
00020 // or patent rights of NVIDIA Corporation. Details are subject to change without notice.
00021 // This code supersedes and replaces all information previously supplied.
00022 // NVIDIA Corporation products are not authorized for use as critical
00023 // components in life support devices or systems without express written approval of
00024 // NVIDIA Corporation.
00025 //
00026 // Copyright (c) 2008-2018 NVIDIA Corporation. All rights reserved.
00027 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
00028 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
00029 
00030 
00031 #ifndef PX_COOKING_H
00032 #define PX_COOKING_H
00033 
00036 #include "common/PxPhysXCommonConfig.h"
00037 #include "common/PxTolerancesScale.h"
00038 #include "cooking/Pxc.h"
00039 
00040 #include "cooking/PxConvexMeshDesc.h"
00041 #include "cooking/PxTriangleMeshDesc.h"
00042 #include "cooking/PxMidphaseDesc.h"
00043 #include "cooking/PxBVHStructureDesc.h"
00044 #include "geometry/PxTriangleMesh.h"
00045 #include "geometry/PxBVHStructure.h"
00046 
00047 #if !PX_DOXYGEN
00048 namespace physx
00049 {
00050 #endif
00051 
00052 class PxPhysicsInsertionCallback;
00053 class PxFoundation;
00054 
00058 struct PxConvexMeshCookingResult
00059 {
00060     enum Enum
00061     {
00065         eSUCCESS,
00066 
00072         eZERO_AREA_TEST_FAILED,
00073 
00081         ePOLYGONS_LIMIT_REACHED,
00082 
00086         eFAILURE
00087     };
00088 };
00089 
00091 struct PxConvexMeshCookingType
00092 {
00093     enum Enum
00094     {
00107         eINFLATION_INCREMENTAL_HULL PX_DEPRECATED = 0,
00108 
00114         eQUICKHULL
00115     };
00116 };
00117 
00121 struct PxTriangleMeshCookingResult
00122 {
00123     enum Enum
00124     {
00128         eSUCCESS            = 0,
00129 
00133         eLARGE_TRIANGLE,
00134 
00138         eFAILURE
00139     };
00140 };
00141 
00148 struct PxMeshPreprocessingFlag
00149 {
00150     enum Enum
00151     {
00155         eWELD_VERTICES                  =   1 << 0, 
00156 
00165         eDISABLE_CLEAN_MESH                             =   1 << 1, 
00166 
00170         eDISABLE_ACTIVE_EDGES_PRECOMPUTE                =   1 << 2,
00171 
00177         eFORCE_32BIT_INDICES                            =   1 << 3
00178     };
00179 };
00180 
00181 typedef PxFlags<PxMeshPreprocessingFlag::Enum,PxU32> PxMeshPreprocessingFlags;
00182 
00189 struct PxCookingParams
00190 {
00213     PX_DEPRECATED float     skinWidth;
00214 
00227     float       areaTestEpsilon;
00228 
00249     float       planeTolerance;
00250 
00258     PxConvexMeshCookingType::Enum convexMeshCookingType;
00259 
00267     bool        suppressTriangleMeshRemapTable;
00268 
00275     bool        buildTriangleAdjacencies;
00276 
00282     bool        buildGPUData;
00283 
00291     PxTolerancesScale scale;
00292 
00298     PxMeshPreprocessingFlags    meshPreprocessParams;
00299 
00315     PxReal      meshWeldTolerance;
00316 
00324     PxMidphaseDesc midphaseDesc;
00325 
00333     PxU32   gaussMapLimit;
00334 
00335     PxCookingParams(const PxTolerancesScale& sc):
00336         skinWidth                       (0.025f*sc.length),
00337         areaTestEpsilon                 (0.06f*sc.length*sc.length),
00338         planeTolerance                  (0.0007f),
00339         convexMeshCookingType           (PxConvexMeshCookingType::eQUICKHULL),
00340         suppressTriangleMeshRemapTable  (false),
00341         buildTriangleAdjacencies        (false),
00342         buildGPUData                    (false),
00343         scale                           (sc),
00344         meshPreprocessParams            (0),
00345         meshWeldTolerance               (0.f),
00346         gaussMapLimit                   (32)
00347     {
00348     }
00349 };
00350 
00351 class PxCooking
00352 {
00353 public:
00362     virtual void  release() = 0;
00363 
00371     virtual void  setParams(const PxCookingParams& params) = 0;
00372 
00380     virtual const PxCookingParams& getParams() const = 0;
00381 
00387     virtual bool  platformMismatch() const = 0;
00388 
00409     virtual bool  cookTriangleMesh(const PxTriangleMeshDesc& desc, PxOutputStream& stream, PxTriangleMeshCookingResult::Enum* condition = NULL) const = 0;
00410 
00411 
00424     virtual PxTriangleMesh*    createTriangleMesh(const PxTriangleMeshDesc& desc, PxPhysicsInsertionCallback& insertionCallback, PxTriangleMeshCookingResult::Enum* condition = NULL) const = 0;
00425 
00439     virtual bool  validateTriangleMesh(const PxTriangleMeshDesc& desc) const = 0;
00440 
00441 
00465     virtual bool  cookConvexMesh(const PxConvexMeshDesc& desc, PxOutputStream& stream, PxConvexMeshCookingResult::Enum* condition = NULL) const = 0;
00466 
00482     virtual PxConvexMesh*    createConvexMesh(const PxConvexMeshDesc& desc, PxPhysicsInsertionCallback& insertionCallback, PxConvexMeshCookingResult::Enum* condition = NULL) const = 0;
00483 
00497     virtual bool  validateConvexMesh(const PxConvexMeshDesc& desc) const = 0;
00498 
00499 
00521     virtual bool  computeHullPolygons(const PxSimpleTriangleMesh& mesh, PxAllocatorCallback& inCallback, PxU32& nbVerts, PxVec3*& vertices,
00522                                             PxU32& nbIndices, PxU32*& indices, PxU32& nbPolygons, PxHullPolygon*& hullPolygons) const = 0;
00523 
00538     virtual bool  cookHeightField(const PxHeightFieldDesc& desc, PxOutputStream& stream) const = 0;
00539 
00549     virtual PxHeightField*    createHeightField(const PxHeightFieldDesc& desc, PxPhysicsInsertionCallback& insertionCallback) const = 0;
00550 
00563     virtual bool  cookBVHStructure(const PxBVHStructureDesc& desc, PxOutputStream& stream) const = 0;
00564 
00579     virtual PxBVHStructure*    createBVHStructure(const PxBVHStructureDesc& desc, PxPhysicsInsertionCallback& insertionCallback) const = 0;
00580 protected:
00581     virtual ~PxCooking(){}
00582 };
00583 
00584 #if !PX_DOXYGEN
00585 } // namespace physx
00586 #endif
00587 
00605 PX_C_EXPORT PX_PHYSX_COOKING_API physx::PxCooking* PX_CALL_CONV PxCreateCooking(physx::PxU32 version,
00606                                                                                 physx::PxFoundation& foundation,
00607                                                                                 const physx::PxCookingParams& params);
00608 
00610 #endif


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