common static functions to block api, mostly standalone math API
More...
#include <BlockCommon.h>
|
static Vector3 | ConvertToRealPosition (uint16 x, uint16 y, uint16 z, int nSide=-1) |
| convert from block index to real world coordinate. More...
|
|
static float | ConvertToRealY (uint16 y) |
|
static void | GetBlockPosBySide (int &x, int &y, int &z, int nSide=4) |
| convert from block x,y,z, to new x,y,z accordig to side. More...
|
|
static void | ConvertToBlockIndex (float x, float y, float z, uint16 &idx_x, uint16 &idx_y, uint16 &idx_z) |
| convert real world coordinate x,y,z to block index.
|
|
static Vector3 | GetBlockCenter (float x, float y, float z) |
| get the block center, based on a real world position.
|
|
static Vector3 | GetNormalBySide (int nSide) |
| get the block normal according to block side id More...
|
|
static bool | IsOppositeSide (int nSide1, int nSide2) |
| whether the two side is opposite side. More...
|
|
static bool | IsCornerSide (int nSide1, int nSide2) |
| whether the two side form a corner side. More...
|
|
static void | ConstrainPos (Vector3 &vMovePos, const Vector3 &vMinPos, const Vector3 &vMaxPos) |
| constrain pos in a AABB cubic space
|
|
static void | ConstrainPos (DVector3 &vMovePos, const Vector3 &vMinPos, const Vector3 &vMaxPos) |
|
static void | ConstrainPosOuter (Vector3 &vMovePos, const Vector3 &vMinPos, const Vector3 &vMaxPos, float fBoarderDist) |
| constrain pos outside a AABB cubic space. More...
|
|
|
static const Int16x3 | NeighborOfsTable [27] |
|
static const int32_t | NeighborLightOrder [] |
| 96 relative block position of the 24 vertices. (each vertex has 4 rbp position)
|
|
static const int32_t | RBP_SixNeighbors [] |
| relative block position of the six most close neighbors out of the 27 neighbor RBP positions. in block rendering order More...
|
|
static int32 | g_xzDirectionsConst [4][2] = { { 1, 0 }, { 0, 1 }, { -1, 0 }, { 0, -1 } } |
|
common static functions to block api, mostly standalone math API
§ ConstrainPosOuter()
void ParaEngine::BlockCommon::ConstrainPosOuter |
( |
Vector3 & |
vMovePos, |
|
|
const Vector3 & |
vMinPos, |
|
|
const Vector3 & |
vMaxPos, |
|
|
float |
fBoarderDist |
|
) |
| |
|
static |
constrain pos outside a AABB cubic space.
if there is AABB's side whose distance to point is smaller than fBoarderDist, then the point will be pushed to that side only.
§ ConvertToRealPosition()
Vector3 ParaEngine::BlockCommon::ConvertToRealPosition |
( |
uint16 |
x, |
|
|
uint16 |
y, |
|
|
uint16 |
z, |
|
|
int |
nSide = -1 |
|
) |
| |
|
static |
convert from block index to real world coordinate.
- Parameters
-
nSide | default to -1. -1 is the block center, 4 is top. 5 is bottom. |
- Returns
- : the returned position is always the center of the block.
§ GetBlockPosBySide()
void ParaEngine::BlockCommon::GetBlockPosBySide |
( |
int & |
x, |
|
|
int & |
y, |
|
|
int & |
z, |
|
|
int |
nSide = 4 |
|
) |
| |
|
static |
convert from block x,y,z, to new x,y,z accordig to side.
- Parameters
-
nSide | default to -1. -1 is the block center, 4 is top. 5 is bottom. |
§ GetNormalBySide()
Vector3 ParaEngine::BlockCommon::GetNormalBySide |
( |
int |
nSide | ) |
|
|
static |
get the block normal according to block side id
- Parameters
-
nSide | in range [0,5], where 4 up, 5 bottom, etc. |
§ IsCornerSide()
bool ParaEngine::BlockCommon::IsCornerSide |
( |
int |
nSide1, |
|
|
int |
nSide2 |
|
) |
| |
|
static |
whether the two side form a corner side.
0,1 and 2, 3, and 4, 5 are not side. and anything equal is not corner side
§ IsOppositeSide()
bool ParaEngine::BlockCommon::IsOppositeSide |
( |
int |
nSide1, |
|
|
int |
nSide2 |
|
) |
| |
|
static |
whether the two side is opposite side.
0,1 and 2, 3, and 4, 5 are opposite side.
§ NeighborOfsTable
const Int16x3 ParaEngine::BlockCommon::NeighborOfsTable |
|
static |
Initial value:=
{
Int16x3(0,0,0),
Int16x3(1,0,0),
Int16x3(-1,0,0),
Int16x3(0,1,0),
Int16x3(0,-1,0),
Int16x3(0,0,1),
Int16x3(0,0,-1),
Int16x3(1,1,0),
Int16x3(1,-1,0),
Int16x3(1,0,1),
Int16x3(1,0,-1),
Int16x3(-1,1,0),
Int16x3(-1,-1,0),
Int16x3(-1,0,1),
Int16x3(-1,0,-1),
Int16x3(0,1,1),
Int16x3(0,1,-1),
Int16x3(0,-1,1),
Int16x3(0,-1,-1),
Int16x3(1,1,1),
Int16x3(1,1,-1),
Int16x3(1,-1,1),
Int16x3(1,-1,-1),
Int16x3(-1,1,1),
Int16x3(-1,1,-1),
Int16x3(-1,-1,1),
Int16x3(-1,-1,-1),
}
§ RBP_SixNeighbors
const int32_t ParaEngine::BlockCommon::RBP_SixNeighbors |
|
static |
Initial value:= {
rbp_pY,
rbp_nZ,
rbp_nY,
rbp_nX,
rbp_pX,
rbp_pZ,
}
relative block position of the six most close neighbors out of the 27 neighbor RBP positions. in block rendering order
The documentation for this class was generated from the following files:
- Client/trunk/ParaEngineClient/BlockEngine/BlockCommon.h
- Client/trunk/ParaEngineClient/BlockEngine/BlockCommon.cpp