PxHeightFieldGeometry.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_HEIGHTFIELD_GEOMETRY
15 #define PX_PHYSICS_NX_HEIGHTFIELD_GEOMETRY
16 
21 
22 #ifndef PX_DOXYGEN
23 namespace physx
24 {
25 #endif
26 
27 #define PX_MIN_HEIGHTFIELD_XZ_SCALE 1e-8f
28 #define PX_MIN_HEIGHTFIELD_Y_SCALE (0.0001f / PxReal(0xFFFF))
29 
30 class PxHeightField;
31 
40 {
41 public:
43  PxGeometry (PxGeometryType::eHEIGHTFIELD),
44  heightField (NULL),
45  heightScale (1.0f),
46  rowScale (1.0f),
47  columnScale (1.0f),
48  heightFieldFlags(0)
49  {}
50 
53  PxReal heightScale_,
54  PxReal rowScale_,
55  PxReal columnScale_) :
56  PxGeometry (PxGeometryType::eHEIGHTFIELD),
57  heightField (hf) ,
58  heightScale (heightScale_),
59  rowScale (rowScale_),
60  columnScale (columnScale_),
61  heightFieldFlags (flags)
62  {
63  }
64 
75  PX_INLINE bool isValid() const;
76 
77 public:
82 
87 
92 
97 
102 
103  PxPadding<3> paddingFromFlags; //< padding for mesh flags.
104 };
105 
106 
108 {
109  if (mType != PxGeometryType::eHEIGHTFIELD)
110  return false;
111  if (!PxIsFinite(heightScale) || !PxIsFinite(rowScale) || !PxIsFinite(columnScale))
112  return false;
113  if (rowScale < PX_MIN_HEIGHTFIELD_XZ_SCALE || columnScale < PX_MIN_HEIGHTFIELD_XZ_SCALE || heightScale < PX_MIN_HEIGHTFIELD_Y_SCALE)
114  return false;
115  if (!heightField)
116  return false;
117 
118  return true;
119 }
120 
121 #ifndef PX_DOXYGEN
122 } // namespace physx
123 #endif
124 
126 #endif


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