My Project
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
ParaEngine::BlockTessellatorBase Class Reference

generate tessellated vertices for a given block in the world. More...

#include <BlockTessellators.h>

Inheritance diagram for ParaEngine::BlockTessellatorBase:
ParaEngine::BlockGeneralTessellator

Public Member Functions

 BlockTessellatorBase (CBlockWorld *pWorld)
 
virtual void SetWorld (CBlockWorld *pWorld)
 
int32_t GetAvgVertexLight (int32_t v1, int32_t v2, int32_t v3, int32_t v4)
 
int32_t GetMaxVertexLight (int32_t v1, int32_t v2, int32_t v3, int32_t v4)
 not used. More...
 
uint8 GetMeshBrightness (BlockTemplate *pBlockTemplate, uint8 *blockBrightness)
 
uint32_t CalculateCubeAO ()
 calculate ambient occlusion flags for cube model. More...
 
virtual int32 TessellateBlock (BlockChunk *pChunk, uint16 packedBlockId, BlockRenderMethod dwShaderID, BlockVertexCompressed **pOutputData)
 generate triangles for a given block in a block world, taking all nearby blocks into consideration. More...
 

Public Attributes

BlockneighborBlocks [27]
 
uint8_t blockBrightness [27 *3]
 
BlockModel tessellatedModel
 

Protected Member Functions

bool UpdateCurrentBlock (BlockChunk *pChunk, uint16 packedBlockId)
 update the current block info, including all block position, m_pCurBlockModel, m_nBlockData, etc. More...
 
void FetchNearbyBlockInfo (BlockChunk *pChunk, const Uint16x3 &packedBlockId, int nNearbyBlockCount=27, int nNearbyLightCount=-1)
 fetch and update nearby (3*3*3=27 blocks) block id and block brightness. More...
 

Protected Attributes

CBlockWorldm_pWorld
 
BlockTemplatem_pCurBlockTemplate
 
uint32 m_nBlockData
 
BlockModelm_pCurBlockModel
 
Uint16x3 m_blockId_ws
 
BlockChunkm_pChunk
 
Uint16x3 m_blockId_cs
 

Detailed Description

generate tessellated vertices for a given block in the world.

Member Function Documentation

§ CalculateCubeAO()

uint32_t ParaEngine::BlockTessellatorBase::CalculateCubeAO ( )

calculate ambient occlusion flags for cube model.

Returns
ao_flags

§ FetchNearbyBlockInfo()

void ParaEngine::BlockTessellatorBase::FetchNearbyBlockInfo ( BlockChunk pChunk,
const Uint16x3 packedBlockId,
int  nNearbyBlockCount = 27,
int  nNearbyLightCount = -1 
)
protected

fetch and update nearby (3*3*3=27 blocks) block id and block brightness.

Parameters
nNearbyBlockCounthow many nearby blocks to update. 1 means only the center block, 7 means including 6 neighbors. by default it is 27, which fetches all blocks in 3*3*3=27 block region.
nNearbyLightCountdefault it is -1, which means same as nNearbyBlockCount. if 0 it will disable fetching any light data

§ GetMaxVertexLight()

int32_t ParaEngine::BlockTessellatorBase::GetMaxVertexLight ( int32_t  v1,
int32_t  v2,
int32_t  v3,
int32_t  v4 
)

not used.

old algorithm for GetAvgVertexLight

§ GetMeshBrightness()

uint8 ParaEngine::BlockTessellatorBase::GetMeshBrightness ( BlockTemplate pBlockTemplate,
uint8 *  blockBrightness 
)
Parameters
brightnessat least array of 7 values. first is center, the following 6 is neighbours.

§ TessellateBlock()

int32 ParaEngine::BlockTessellatorBase::TessellateBlock ( BlockChunk pChunk,
uint16  packedBlockId,
BlockRenderMethod  dwShaderID,
BlockVertexCompressed **  pOutputData 
)
virtual

generate triangles for a given block in a block world, taking all nearby blocks into consideration.

generate block vertex data for rendering in relative chunk space. [threading]: this function is not thread safe, since it internally use global static object as the output.

Parameters
pOutputDatagenerated vertex data. use it immediately and do not keep a reference to it. it will be invalid after the next call to this function.
Returns
rect face count is returned. this value*4 is the number of generated vertices in pOutputData.

Reimplemented in ParaEngine::BlockGeneralTessellator.

§ UpdateCurrentBlock()

bool ParaEngine::BlockTessellatorBase::UpdateCurrentBlock ( BlockChunk pChunk,
uint16  packedBlockId 
)
protected

update the current block info, including all block position, m_pCurBlockModel, m_nBlockData, etc.

will be updated.


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