RavEngine
Loading...
Searching...
No Matches
PxHeightField.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_HEIGHTFIELD_H
30#define PX_HEIGHTFIELD_H
35#include "geometry/PxHeightFieldFlag.h"
36#include "geometry/PxHeightFieldSample.h"
37#include "common/PxBase.h"
38
39#if !PX_DOXYGEN
40namespace physx
41{
42#endif
43
44class PxHeightFieldDesc;
45
84{
85 public:
91 virtual void release() = 0;
92
105 virtual PxU32 saveCells(void* destBuffer, PxU32 destBufferSize) const = 0;
106
127 virtual bool modifySamples(PxI32 startCol, PxI32 startRow, const PxHeightFieldDesc& subfieldDesc, bool shrinkBounds = false) = 0;
128
136 virtual PxU32 getNbRows() const = 0;
137
145 virtual PxU32 getNbColumns() const = 0;
146
155
163 virtual PxU32 getSampleStride() const = 0;
164
172 virtual PxReal getConvexEdgeThreshold() const = 0;
173
181 virtual PxHeightFieldFlags getFlags() const = 0;
182
188 virtual PxReal getHeight(PxReal x, PxReal z) const = 0;
189
198 virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const = 0;
199
208 virtual PxVec3 getTriangleNormal(PxTriangleID triangleIndex) const = 0;
209
217 virtual const PxHeightFieldSample& getSample(PxU32 row, PxU32 column) const = 0;
218
227 virtual PxU32 getTimestamp() const = 0;
228
229 virtual const char* getConcreteTypeName() const { return "PxHeightField"; }
230
231protected:
232 PX_INLINE PxHeightField(PxType concreteType, PxBaseFlags baseFlags) : PxRefCounted(concreteType, baseFlags) {}
233 PX_INLINE PxHeightField(PxBaseFlags baseFlags) : PxRefCounted(baseFlags) {}
234 virtual ~PxHeightField() {}
235 virtual bool isKindOf(const char* name) const { return !::strcmp("PxHeightField", name) || PxRefCounted::isKindOf(name); }
236};
237
238#if !PX_DOXYGEN
239} // namespace physx
240#endif
241
243#endif
Descriptor class for #PxHeightField.
Definition PxHeightFieldDesc.h:53
A height field class.
Definition PxHeightField.h:84
virtual PxU32 getNbRows() const =0
Retrieves the number of sample rows in the samples array.
virtual PxReal getConvexEdgeThreshold() const =0
Retrieves the convex edge threshold.
virtual const PxHeightFieldSample & getSample(PxU32 row, PxU32 column) const =0
Returns heightfield sample of given row and column
virtual PxVec3 getTriangleNormal(PxTriangleID triangleIndex) const =0
Returns a triangle face normal for a given triangle index.
virtual PxU32 getSampleStride() const =0
Retrieves the offset in bytes between consecutive samples in the array.
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxHeightField.h:235
virtual PxU32 saveCells(void *destBuffer, PxU32 destBufferSize) const =0
Writes out the sample data array.
virtual PxU32 getNbColumns() const =0
Retrieves the number of sample columns in the samples array.
virtual PxMaterialTableIndex getTriangleMaterialIndex(PxTriangleID triangleIndex) const =0
Returns material table index of given triangle.
virtual PxHeightFieldFormat::Enum getFormat() const =0
Retrieves the format of the sample data.
virtual void release()=0
Decrements the reference count of a height field and releases it if the new reference count is zero.
virtual PxU32 getTimestamp() const =0
Returns the number of times the heightfield data has been modified.
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition PxHeightField.h:229
virtual PxHeightFieldFlags getFlags() const =0
Retrieves the flags bits, combined from values of the enum ::PxHeightFieldFlag.
virtual bool modifySamples(PxI32 startCol, PxI32 startRow, const PxHeightFieldDesc &subfieldDesc, bool shrinkBounds=false)=0
Replaces a rectangular subfield in the sample data array.
virtual PxReal getHeight(PxReal x, PxReal z) const =0
Retrieves the height at the given coordinates in grid space.
Base class for ref-counted objects.
Definition PxBase.h:200
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxBase.h:231
3 Element vector class.
Definition PxVec3.h:50
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
Enum
Definition PxHeightFieldFlag.h:49
Heightfield sample format.
Definition PxHeightFieldSample.h:67