载入中...
搜索中...
未找到
eve::physics::DistanceField3D类 参考

Regular 3D signed-distance grid for terrain and voxel collision queries. Negative samples are solid, positive samples are empty. Samples are stored at grid vertices and queried with trilinear interpolation. 更多...

#include <DistanceField3D.h>

Public 成员函数

 DistanceField3D (int width, int height, int depth, float cellSize, float originX, float originY, float originZ, float outsideDistance)
 Distance field 3 d.
 
void setDistances (const std::vector< float > &distances)
 Replace every sample in x-fastest, then y, then z order.
 
void fill (float distance)
 Set every grid sample to the same finite distance.
 
void setDistanceRegion (int x, int y, int z, int width, int height, int depth, const std::vector< float > &distances)
 Atomically replace a grid subregion in x-fastest, then y, then z order.
 
void fillRegion (int x, int y, int z, int width, int height, int depth, float distance)
 Fill an in-bounds grid subregion with one finite signed distance.
 
void setDistance (int x, int y, int z, float distance)
 Set a signed-distance sample at a grid vertex.
 
float getDistance (int x, int y, int z) const
 Read a grid vertex; out-of-range vertices return the outside distance.
 
float sample (float x, float y, float z) const
 Trilinearly sample the field in world coordinates.
 
int getWidth () const
 Number of grid vertices along the X axis.
 
int getHeight () const
 Number of grid vertices along the Y axis.
 
int getDepth () const
 Number of grid vertices along the Z axis.
 
int getSampleCount () const
 Total number of signed-distance samples.
 
float getCellSize () const
 World-space distance between adjacent grid vertices.
 
float getOriginX () const
 World-space X coordinate of grid vertex (0,0,0).
 
float getOriginY () const
 World-space Y coordinate of grid vertex (0,0,0).
 
float getOriginZ () const
 World-space Z coordinate of grid vertex (0,0,0).
 
float getOutsideDistance () const
 Distance returned for world samples outside the grid.
 
unsigned int getRevision () const
 Monotonic wrapping counter incremented once after each successful mutation.
 
void sampleNormal (float x, float y, float z)
 Estimate the normalized outward field gradient at a world position.
 
float getNormalX () const
 X component of the most recently sampled collision normal.
 
float getNormalY () const
 Y component of the most recently sampled collision normal.
 
float getNormalZ () const
 Z component of the most recently sampled collision normal.
 
bool checkSphere (float x, float y, float z, float radius)
 Test a sphere against the solid (distance <= radius).
 
bool checkCapsule (float ax, float ay, float az, float bx, float by, float bz, float radius)
 Test a capsule defined by two sphere centers against the solid.
 
bool castSphere (float x, float y, float z, float radius, float deltaX, float deltaY, float deltaZ)
 Sweep a sphere through the field and cache the earliest contact.
 
bool castCapsule (float ax, float ay, float az, float bx, float by, float bz, float radius, float deltaX, float deltaY, float deltaZ)
 Sweep a capsule through the field and cache the earliest contact.
 
bool moveCapsule (float ax, float ay, float az, float bx, float by, float bz, float radius, float deltaX, float deltaY, float deltaZ)
 Resolve a capsule displacement against the field with sliding and depenetration. The capsule coordinates are not stored; apply getMoverDeltaX/Y/Z to both endpoints.
 
void setMoverUp (float x, float y, float z)
 Set the normalized reference-up direction used for ground classification.
 
void setMoverSlopeLimit (float degrees)
 Set the maximum walkable slope angle in degrees, clamped to [0, 89.9].
 
void setMoverSkinWidth (float width)
 Set the non-negative separation retained from surfaces by moveCapsule.
 
float getMoverSkinWidth () const
 Current mover separation from collision surfaces.
 
void setMoverGroundSnap (float distance)
 Set the non-negative distance used to snap onto walkable ground after movement.
 
float getMoverGroundSnap () const
 Current post-move ground-snap distance.
 
void setMoverStepHeight (float height)
 Set the maximum non-negative ledge height automatically climbed by moveCapsule.
 
float getMoverStepHeight () const
 Current automatic step height; zero disables step climbing.
 
float getCollisionDistance () const
 Signed clearance from the last check (negative means penetration).
 
float getCollisionX () const
 X coordinate of the closest sampled point from the last collision check.
 
float getCollisionY () const
 Y coordinate of the closest sampled point from the last collision check.
 
float getCollisionZ () const
 Z coordinate of the closest sampled point from the last collision check.
 
float getSurfaceX () const
 X coordinate of the projected signed-distance-field surface point.
 
float getSurfaceY () const
 Y coordinate of the projected signed-distance-field surface point.
 
float getSurfaceZ () const
 Z coordinate of the projected signed-distance-field surface point.
 
float getShapeContactX () const
 X coordinate on the sphere or capsule surface along the contact normal.
 
float getShapeContactY () const
 Y coordinate on the sphere or capsule surface along the contact normal.
 
float getShapeContactZ () const
 Z coordinate on the sphere or capsule surface along the contact normal.
 
float getPenetrationDepth () const
 Non-negative overlap depth from the most recent overlap, cast, or move query.
 
float getCastFraction () const
 Fraction in [0,1] of the requested displacement at the last cast hit.
 
float getCastDistance () const
 World-space travel distance at the last cast hit.
 
bool didCastStartInside () const
 Whether the most recent cast began overlapping the solid.
 
float getMoverDeltaX () const
 Resolved X displacement from the most recent moveCapsule call.
 
float getMoverDeltaY () const
 Resolved Y displacement from the most recent moveCapsule call.
 
float getMoverDeltaZ () const
 Resolved Z displacement from the most recent moveCapsule call.
 
float getMoverNormalX () const
 X component of the most recent blocking or recovery normal.
 
float getMoverNormalY () const
 Y component of the most recent blocking or recovery normal.
 
float getMoverNormalZ () const
 Z component of the most recent blocking or recovery normal.
 
int getMoverIterations () const
 Number of solver passes used by the most recent moveCapsule call.
 
bool isMoverGrounded () const
 Whether the latest move encountered a normal within the walkable slope limit.
 
float getMoverGroundDot () const
 Greatest dot product between mover Up and a normal from the latest move.
 
bool didMoverHitWall () const
 Whether the latest move encountered a non-walkable contact normal.
 

详细描述

Regular 3D signed-distance grid for terrain and voxel collision queries. Negative samples are solid, positive samples are empty. Samples are stored at grid vertices and queried with trilinear interpolation.

在文件 DistanceField3D.h 第 16 行定义.

构造及析构函数说明

◆ DistanceField3D()

eve::physics::DistanceField3D::DistanceField3D ( int  width,
int  height,
int  depth,
float  cellSize,
float  originX,
float  originY,
float  originZ,
float  outsideDistance 
)

Distance field 3 d.

在文件 DistanceField3D.cpp 第 22 行定义.

引用了 count, depth, height , 以及 width.

成员函数说明

◆ castCapsule()

bool eve::physics::DistanceField3D::castCapsule ( float  ax,
float  ay,
float  az,
float  bx,
float  by,
float  bz,
float  radius,
float  deltaX,
float  deltaY,
float  deltaZ 
)

Sweep a capsule through the field and cache the earliest contact.

返回
True when the swept capsule starts in or reaches the solid.

在文件 DistanceField3D.cpp 第 313 行定义.

引用了 ax, ay, az, bx, by, bz, previous, radius , 以及 steps.

被这些函数引用 moveCapsule().

◆ castSphere()

bool eve::physics::DistanceField3D::castSphere ( float  x,
float  y,
float  z,
float  radius,
float  deltaX,
float  deltaY,
float  deltaZ 
)

Sweep a sphere through the field and cache the earliest contact.

参数
xInitial sphere-center X coordinate.
yInitial sphere-center Y coordinate.
zInitial sphere-center Z coordinate.
radiusSphere radius.
deltaXSweep displacement along X.
deltaYSweep displacement along Y.
deltaZSweep displacement along Z.
返回
True when the swept sphere starts in or reaches the solid.

在文件 DistanceField3D.cpp 第 265 行定义.

引用了 previous, px, py, pz, radius, sample(), steps, x, y , 以及 z.

◆ checkCapsule()

bool eve::physics::DistanceField3D::checkCapsule ( float  ax,
float  ay,
float  az,
float  bx,
float  by,
float  bz,
float  radius 
)

Test a capsule defined by two sphere centers against the solid.

在文件 DistanceField3D.cpp 第 210 行定义.

引用了 ax, ay, az, best, bx, by, bz, radius , 以及 sampleNormal().

被这些函数引用 moveCapsule().

◆ checkSphere()

bool eve::physics::DistanceField3D::checkSphere ( float  x,
float  y,
float  z,
float  radius 
)

Test a sphere against the solid (distance <= radius).

在文件 DistanceField3D.cpp 第 203 行定义.

引用了 radius, x, y , 以及 z.

◆ didCastStartInside()

bool eve::physics::DistanceField3D::didCastStartInside ( ) const
inline

Whether the most recent cast began overlapping the solid.

在文件 DistanceField3D.h 第 151 行定义.

◆ didMoverHitWall()

bool eve::physics::DistanceField3D::didMoverHitWall ( ) const
inline

Whether the latest move encountered a non-walkable contact normal.

在文件 DistanceField3D.h 第 171 行定义.

◆ fill()

void eve::physics::DistanceField3D::fill ( float  distance)

Set every grid sample to the same finite distance.

在文件 DistanceField3D.cpp 第 66 行定义.

引用了 distance.

◆ fillRegion()

void eve::physics::DistanceField3D::fillRegion ( int  x,
int  y,
int  z,
int  width,
int  height,
int  depth,
float  distance 
)

Fill an in-bounds grid subregion with one finite signed distance.

在文件 DistanceField3D.cpp 第 98 行定义.

引用了 depth, distance, height, index, width, x, y , 以及 z.

◆ getCastDistance()

float eve::physics::DistanceField3D::getCastDistance ( ) const
inline

World-space travel distance at the last cast hit.

在文件 DistanceField3D.h 第 149 行定义.

◆ getCastFraction()

float eve::physics::DistanceField3D::getCastFraction ( ) const
inline

Fraction in [0,1] of the requested displacement at the last cast hit.

在文件 DistanceField3D.h 第 147 行定义.

◆ getCellSize()

float eve::physics::DistanceField3D::getCellSize ( ) const
inline

World-space distance between adjacent grid vertices.

在文件 DistanceField3D.h 第 56 行定义.

◆ getCollisionDistance()

float eve::physics::DistanceField3D::getCollisionDistance ( ) const
inline

Signed clearance from the last check (negative means penetration).

在文件 DistanceField3D.h 第 125 行定义.

◆ getCollisionX()

float eve::physics::DistanceField3D::getCollisionX ( ) const
inline

X coordinate of the closest sampled point from the last collision check.

在文件 DistanceField3D.h 第 127 行定义.

◆ getCollisionY()

float eve::physics::DistanceField3D::getCollisionY ( ) const
inline

Y coordinate of the closest sampled point from the last collision check.

在文件 DistanceField3D.h 第 129 行定义.

◆ getCollisionZ()

float eve::physics::DistanceField3D::getCollisionZ ( ) const
inline

Z coordinate of the closest sampled point from the last collision check.

在文件 DistanceField3D.h 第 131 行定义.

◆ getDepth()

int eve::physics::DistanceField3D::getDepth ( ) const
inline

Number of grid vertices along the Z axis.

在文件 DistanceField3D.h 第 52 行定义.

◆ getDistance()

float eve::physics::DistanceField3D::getDistance ( int  x,
int  y,
int  z 
) const

Read a grid vertex; out-of-range vertices return the outside distance.

在文件 DistanceField3D.cpp 第 122 行定义.

引用了 index, x, y , 以及 z.

被这些函数引用 sample().

◆ getHeight()

int eve::physics::DistanceField3D::getHeight ( ) const
inline

Number of grid vertices along the Y axis.

在文件 DistanceField3D.h 第 50 行定义.

◆ getMoverDeltaX()

float eve::physics::DistanceField3D::getMoverDeltaX ( ) const
inline

Resolved X displacement from the most recent moveCapsule call.

在文件 DistanceField3D.h 第 153 行定义.

◆ getMoverDeltaY()

float eve::physics::DistanceField3D::getMoverDeltaY ( ) const
inline

Resolved Y displacement from the most recent moveCapsule call.

在文件 DistanceField3D.h 第 155 行定义.

◆ getMoverDeltaZ()

float eve::physics::DistanceField3D::getMoverDeltaZ ( ) const
inline

Resolved Z displacement from the most recent moveCapsule call.

在文件 DistanceField3D.h 第 157 行定义.

◆ getMoverGroundDot()

float eve::physics::DistanceField3D::getMoverGroundDot ( ) const
inline

Greatest dot product between mover Up and a normal from the latest move.

在文件 DistanceField3D.h 第 169 行定义.

◆ getMoverGroundSnap()

float eve::physics::DistanceField3D::getMoverGroundSnap ( ) const
inline

Current post-move ground-snap distance.

在文件 DistanceField3D.h 第 119 行定义.

◆ getMoverIterations()

int eve::physics::DistanceField3D::getMoverIterations ( ) const
inline

Number of solver passes used by the most recent moveCapsule call.

在文件 DistanceField3D.h 第 165 行定义.

◆ getMoverNormalX()

float eve::physics::DistanceField3D::getMoverNormalX ( ) const
inline

X component of the most recent blocking or recovery normal.

在文件 DistanceField3D.h 第 159 行定义.

◆ getMoverNormalY()

float eve::physics::DistanceField3D::getMoverNormalY ( ) const
inline

Y component of the most recent blocking or recovery normal.

在文件 DistanceField3D.h 第 161 行定义.

◆ getMoverNormalZ()

float eve::physics::DistanceField3D::getMoverNormalZ ( ) const
inline

Z component of the most recent blocking or recovery normal.

在文件 DistanceField3D.h 第 163 行定义.

◆ getMoverSkinWidth()

float eve::physics::DistanceField3D::getMoverSkinWidth ( ) const
inline

Current mover separation from collision surfaces.

在文件 DistanceField3D.h 第 115 行定义.

◆ getMoverStepHeight()

float eve::physics::DistanceField3D::getMoverStepHeight ( ) const
inline

Current automatic step height; zero disables step climbing.

在文件 DistanceField3D.h 第 123 行定义.

◆ getNormalX()

float eve::physics::DistanceField3D::getNormalX ( ) const
inline

X component of the most recently sampled collision normal.

在文件 DistanceField3D.h 第 71 行定义.

◆ getNormalY()

float eve::physics::DistanceField3D::getNormalY ( ) const
inline

Y component of the most recently sampled collision normal.

在文件 DistanceField3D.h 第 73 行定义.

◆ getNormalZ()

float eve::physics::DistanceField3D::getNormalZ ( ) const
inline

Z component of the most recently sampled collision normal.

在文件 DistanceField3D.h 第 75 行定义.

◆ getOriginX()

float eve::physics::DistanceField3D::getOriginX ( ) const
inline

World-space X coordinate of grid vertex (0,0,0).

在文件 DistanceField3D.h 第 58 行定义.

◆ getOriginY()

float eve::physics::DistanceField3D::getOriginY ( ) const
inline

World-space Y coordinate of grid vertex (0,0,0).

在文件 DistanceField3D.h 第 60 行定义.

◆ getOriginZ()

float eve::physics::DistanceField3D::getOriginZ ( ) const
inline

World-space Z coordinate of grid vertex (0,0,0).

在文件 DistanceField3D.h 第 62 行定义.

◆ getOutsideDistance()

float eve::physics::DistanceField3D::getOutsideDistance ( ) const
inline

Distance returned for world samples outside the grid.

在文件 DistanceField3D.h 第 64 行定义.

◆ getPenetrationDepth()

float eve::physics::DistanceField3D::getPenetrationDepth ( ) const
inline

Non-negative overlap depth from the most recent overlap, cast, or move query.

在文件 DistanceField3D.h 第 145 行定义.

◆ getRevision()

unsigned int eve::physics::DistanceField3D::getRevision ( ) const
inline

Monotonic wrapping counter incremented once after each successful mutation.

在文件 DistanceField3D.h 第 66 行定义.

◆ getSampleCount()

int eve::physics::DistanceField3D::getSampleCount ( ) const
inline

Total number of signed-distance samples.

在文件 DistanceField3D.h 第 54 行定义.

◆ getShapeContactX()

float eve::physics::DistanceField3D::getShapeContactX ( ) const
inline

X coordinate on the sphere or capsule surface along the contact normal.

在文件 DistanceField3D.h 第 139 行定义.

◆ getShapeContactY()

float eve::physics::DistanceField3D::getShapeContactY ( ) const
inline

Y coordinate on the sphere or capsule surface along the contact normal.

在文件 DistanceField3D.h 第 141 行定义.

◆ getShapeContactZ()

float eve::physics::DistanceField3D::getShapeContactZ ( ) const
inline

Z coordinate on the sphere or capsule surface along the contact normal.

在文件 DistanceField3D.h 第 143 行定义.

◆ getSurfaceX()

float eve::physics::DistanceField3D::getSurfaceX ( ) const
inline

X coordinate of the projected signed-distance-field surface point.

在文件 DistanceField3D.h 第 133 行定义.

◆ getSurfaceY()

float eve::physics::DistanceField3D::getSurfaceY ( ) const
inline

Y coordinate of the projected signed-distance-field surface point.

在文件 DistanceField3D.h 第 135 行定义.

◆ getSurfaceZ()

float eve::physics::DistanceField3D::getSurfaceZ ( ) const
inline

Z coordinate of the projected signed-distance-field surface point.

在文件 DistanceField3D.h 第 137 行定义.

◆ getWidth()

int eve::physics::DistanceField3D::getWidth ( ) const
inline

Number of grid vertices along the X axis.

在文件 DistanceField3D.h 第 48 行定义.

◆ isMoverGrounded()

bool eve::physics::DistanceField3D::isMoverGrounded ( ) const
inline

Whether the latest move encountered a normal within the walkable slope limit.

在文件 DistanceField3D.h 第 167 行定义.

◆ moveCapsule()

bool eve::physics::DistanceField3D::moveCapsule ( float  ax,
float  ay,
float  az,
float  bx,
float  by,
float  bz,
float  radius,
float  deltaX,
float  deltaY,
float  deltaZ 
)

Resolve a capsule displacement against the field with sliding and depenetration. The capsule coordinates are not stored; apply getMoverDeltaX/Y/Z to both endpoints.

返回
True when solid geometry constrained or depenetrated the capsule.

在文件 DistanceField3D.cpp 第 407 行定义.

引用了 a, ax, ay, az, b, bx, by, bz, castCapsule(), checkCapsule(), dx, dy, dz, iterations, length, moveCapsule(), normal, nx, ny, nz, planes, position, radius, state, up, value, x, y , 以及 z.

被这些函数引用 moveCapsule().

◆ sample()

float eve::physics::DistanceField3D::sample ( float  x,
float  y,
float  z 
) const

Trilinearly sample the field in world coordinates.

在文件 DistanceField3D.cpp 第 126 行定义.

引用了 a, b, getDistance(), t, x, y , 以及 z.

被这些函数引用 castSphere() , 以及 sampleNormal().

◆ sampleNormal()

void eve::physics::DistanceField3D::sampleNormal ( float  x,
float  y,
float  z 
)

Estimate the normalized outward field gradient at a world position.

在文件 DistanceField3D.cpp 第 151 行定义.

引用了 center, h, length, nx, ny, nz, sample(), x, y , 以及 z.

被这些函数引用 checkCapsule().

◆ setDistance()

void eve::physics::DistanceField3D::setDistance ( int  x,
int  y,
int  z,
float  distance 
)

Set a signed-distance sample at a grid vertex.

在文件 DistanceField3D.cpp 第 114 行定义.

引用了 distance, index, x, y , 以及 z.

◆ setDistanceRegion()

void eve::physics::DistanceField3D::setDistanceRegion ( int  x,
int  y,
int  z,
int  width,
int  height,
int  depth,
const std::vector< float > &  distances 
)

Atomically replace a grid subregion in x-fastest, then y, then z order.

参数
xFirst grid-vertex X index.
yFirst grid-vertex Y index.
zFirst grid-vertex Z index.
widthNumber of vertices along X; must be positive and in bounds.
heightNumber of vertices along Y; must be positive and in bounds.
depthNumber of vertices along Z; must be positive and in bounds.
distancesExactly width*height*depth finite samples.

在文件 DistanceField3D.cpp 第 73 行定义.

引用了 count, depth, distance, height, index, source, width, x, y , 以及 z.

◆ setDistances()

void eve::physics::DistanceField3D::setDistances ( const std::vector< float > &  distances)

Replace every sample in x-fastest, then y, then z order.

在文件 DistanceField3D.cpp 第 56 行定义.

引用了 distance.

◆ setMoverGroundSnap()

void eve::physics::DistanceField3D::setMoverGroundSnap ( float  distance)

Set the non-negative distance used to snap onto walkable ground after movement.

在文件 DistanceField3D.cpp 第 393 行定义.

引用了 distance.

◆ setMoverSkinWidth()

void eve::physics::DistanceField3D::setMoverSkinWidth ( float  width)

Set the non-negative separation retained from surfaces by moveCapsule.

在文件 DistanceField3D.cpp 第 387 行定义.

引用了 width.

◆ setMoverSlopeLimit()

void eve::physics::DistanceField3D::setMoverSlopeLimit ( float  degrees)

Set the maximum walkable slope angle in degrees, clamped to [0, 89.9].

在文件 DistanceField3D.cpp 第 380 行定义.

引用了 degrees.

◆ setMoverStepHeight()

void eve::physics::DistanceField3D::setMoverStepHeight ( float  height)

Set the maximum non-negative ledge height automatically climbed by moveCapsule.

在文件 DistanceField3D.cpp 第 400 行定义.

引用了 height.

◆ setMoverUp()

void eve::physics::DistanceField3D::setMoverUp ( float  x,
float  y,
float  z 
)

Set the normalized reference-up direction used for ground classification.

在文件 DistanceField3D.cpp 第 369 行定义.

引用了 x, y , 以及 z.


该类的文档由以下文件生成: