My Project
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
ParaEngine::BlockModel Class Reference

Public Types

enum  EdgeVertexFlag {
  evf_none = 0, evf_topFront = 0x001, evf_topLeft = 0x002, evf_topRight = 0x004,
  evf_topBack = 0x008, evf_LeftFront = 0x010, evf_leftBack = 0x020, evf_rightFont = 0x040,
  evf_rightBack = 0x080, evf_bottomFront = 0x100, evf_bottomLeft = 0x200, evf_bottomRight = 0x400,
  evf_bottomBack = 0x800, evf_xyz = 0x01000, evf_xyNz = 0x02000, evf_xNyz = 0x04000,
  evf_xNyNz = 0x08000, evf_Nxyz = 0x10000, evf_NxyNz = 0x20000, evf_NxNyz = 0x40000,
  evf_NxNyNz = 0x80000
}
 

Public Member Functions

 BlockModel (int32_t texFaceNum=0)
 
void CloneRenderData (const BlockModel &from_block)
 clone the given block model. More...
 
void Clone (const BlockModel &from_block)
 
void ClearVertices ()
 clear all vertices
 
int AddVertex (const BlockVertexCompressed &vertex)
 add a new vertex More...
 
int AddVertex (const BlockModel &from_block, int32 nVertexIndex)
 add vertex from another block. More...
 
void CloneVertices (const BlockModel &from_block)
 
std::vector< BlockVertexCompressed > & Vertices ()
 vertices
 
void SetAOMask (uint32_t edges)
 
void SetVerticalScale (EdgeVertexFlag vertexId, float scale)
 
void TranslateVertices (float dx, float dy, float dz)
 offset the vertices
 
void SetLightIntensity (uint32_t vertexId, float value)
 only used for fixed function pipeline.
 
void SetVertexLight (uint32_t vertexId, uint8_t nBlockLight, uint8_t nSunLight)
 
void SetCategoryID (DWORD nCategoryID)
 set category id. More...
 
void GetBoundingBoxVertices (Vector3 *pVertices, int *pNumber)
 get bounding box vertices
 
bool IsCubeAABB ()
 whether AABB is a cube
 
void SetIsCubeAABB (bool bIsCube)
 
void GetAABB (CShapeAABB *pOut) const
 get axis aligned bounding box for the model. More...
 
const CShapeAABBGetAABB () const
 
void SetAABB (const Vector3 &vMin, const Vector3 &vMax)
 
bool IsUseAmbientOcclusion ()
 whether use ambient occlusion. More...
 
void SetUseAmbientOcclusion (bool bValue)
 
int GetFaceCount ()
 get face count. More...
 
void SetFaceCount (int nFaceCount)
 
int IncrementFaceCount (int nDelta=1)
 
int GetVerticesCount ()
 get number of vertices
 
void ReserveVertices (int nReservedSize=24)
 
bool IsDisableFaceCulling ()
 Is disable face culling.
 
void SetDisableFaceCulling (bool bDisabled)
 
bool IsUsingSelfLighting ()
 whether to disable block and sun lighting when rendering this block. More...
 
void SetUsingSelfLighting (bool bEnable)
 
bool IsUniformLighting () const
 whether all vertices have same lighting value. More...
 
void SetUniformLighting (bool val)
 
void Transform (const Matrix4 &mat)
 transform each vertex of the model by this mat. More...
 
void Transform (const Vector3 &vOffset, float fScaling)
 transform by scale and translate
 
void RemoveFace (int nFirstIndex)
 remove a given face by making infinite small triangle. More...
 
BlockVertexCompressedGetVertices ()
 get vertice array
 
const BlockVertexCompressedGetVerticesConst () const
 
int GetTextureIndex () const
 get texture index into the Block template's texture array. More...
 
void SetTextureIndex (int val)
 
void SetColor (DWORD color)
 set the uniform block color. More...
 
void LoadModel (BlockTemplate *pTemplate, const std::string &filename, const Matrix4 &mat, int nTextureIndex=0)
 load static model from parax file. More...
 
void LoadModelByTexture (int32_t texFaceNum)
 
void LoadCubeModel ()
 
void LoadModel (const std::string &sModelName)
 load from known model name
 
void SetVertexShadow (int nIndex, unsigned char nShadowLevel)
 set the vertex in shadow as in ao calculation. More...
 
void SetVertexShadowFromAOFlags (int nIndex, int nCubeIndex, uint32 aoFlags)
 
void SetVertexColor (int nIndex, DWORD color)
 
unsigned char CalculateCubeVertexAOShadowLevel (int nIndex, uint32 aoFlags)
 
void SetVertexHeightScale (int nIndex, float scale)
 

Static Public Member Functions

static void GetBoundingBoxVertices (CShapeAABB &aabb, Vector3 *pVertices, int *pNumber)
 

Static Public Attributes

static const int32_t g_topLB = 0
 
static const int32_t g_topLT = 1
 
static const int32_t g_topRT = 2
 
static const int32_t g_topRB = 3
 
static const int32_t g_frtLB = 4
 
static const int32_t g_frtLT = 5
 
static const int32_t g_frtRT = 6
 
static const int32_t g_frtRB = 7
 
static const int32_t g_btmLB = 8
 
static const int32_t g_btmLT = 9
 
static const int32_t g_btmRT = 10
 
static const int32_t g_btmRB = 11
 
static const int32_t g_leftLB = 12
 
static const int32_t g_leftLT = 13
 
static const int32_t g_leftRT = 14
 
static const int32_t g_leftRB = 15
 
static const int32_t g_rightLB = 16
 
static const int32_t g_rightLT = 17
 
static const int32_t g_rightRT = 18
 
static const int32_t g_rightRB = 19
 
static const int32_t g_bkLB = 20
 
static const int32_t g_bkLT = 21
 
static const int32_t g_bkRT = 22
 
static const int32_t g_bkRB = 23
 

Friends

class BlockModelManager
 
class IBlockModelProvider
 

Member Function Documentation

§ AddVertex() [1/2]

int ParaEngine::BlockModel::AddVertex ( const BlockVertexCompressed vertex)

add a new vertex

Returns
the added vertex index.

§ AddVertex() [2/2]

int ParaEngine::BlockModel::AddVertex ( const BlockModel from_block,
int32  nVertexIndex 
)

add vertex from another block.

Returns
the added vertex index.

§ CalculateCubeVertexAOShadowLevel()

unsigned char ParaEngine::BlockModel::CalculateCubeVertexAOShadowLevel ( int  nIndex,
uint32  aoFlags 
)
Returns
[0,255] the shadow level from current ambient occlusion flags.

§ CloneRenderData()

void ParaEngine::BlockModel::CloneRenderData ( const BlockModel from_block)

clone the given block model.

§ GetAABB()

void ParaEngine::BlockModel::GetAABB ( CShapeAABB pOut) const

get axis aligned bounding box for the model.

§ GetFaceCount()

int ParaEngine::BlockModel::GetFaceCount ( )
inline

get face count.

§ GetTextureIndex()

int ParaEngine::BlockModel::GetTextureIndex ( ) const

get texture index into the Block template's texture array.

§ IsUniformLighting()

bool ParaEngine::BlockModel::IsUniformLighting ( ) const
inline

whether all vertices have same lighting value.

§ IsUseAmbientOcclusion()

bool ParaEngine::BlockModel::IsUseAmbientOcclusion ( )
inline

whether use ambient occlusion.

§ IsUsingSelfLighting()

bool ParaEngine::BlockModel::IsUsingSelfLighting ( )
inline

whether to disable block and sun lighting when rendering this block.

§ LoadModel()

void ParaEngine::BlockModel::LoadModel ( BlockTemplate pTemplate,
const std::string &  filename,
const Matrix4 mat,
int  nTextureIndex = 0 
)

load static model from parax file.

§ RemoveFace()

void ParaEngine::BlockModel::RemoveFace ( int  nFirstIndex)

remove a given face by making infinite small triangle.

§ SetCategoryID()

void ParaEngine::BlockModel::SetCategoryID ( DWORD  nCategoryID)

set category id.

§ SetColor()

void ParaEngine::BlockModel::SetColor ( DWORD  color)

set the uniform block color.

default to white

§ SetVertexLight()

void ParaEngine::BlockModel::SetVertexLight ( uint32_t  vertexId,
uint8_t  nBlockLight,
uint8_t  nSunLight 
)
inline
Parameters
nBlockLight0-255
nSunLight0-255

§ SetVertexShadow()

void ParaEngine::BlockModel::SetVertexShadow ( int  nIndex,
unsigned char  nShadowLevel 
)

set the vertex in shadow as in ao calculation.

Parameters
nShadowLevel[0,255]. 255 is completely dark. 0 is un-shadowed

§ Transform()

void ParaEngine::BlockModel::Transform ( const Matrix4 mat)

transform each vertex of the model by this mat.


The documentation for this class was generated from the following files: