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

Block Max file format parser. More...

#include <BMaxParser.h>

Public Types

enum  BlockIDNum { TransparentBlockId = 118, BoneBlockId = 253, BlockModelBlockId = 254 }
 block id
 

Public Member Functions

 BMaxParser (const char *pBuffer, int32 nSize, const char *filename=NULL, BMaxParser *pParent=NULL)
 
CParaXModel * ParseParaXModel ()
 
CParaXModel * ParseParaXModel (uint32 nMaxTriangleCount)
 
const std::string & GetFilename () const
 
void SetFilename (const std::string &val)
 

Protected Member Functions

bool IsFileNameRecursiveLoaded (const std::string &filename)
 check if the given filename belongs to one of its parent's filename
 
void AddAnimation (const ModelAnimation &anim)
 
int GetAnimationsCount ()
 
BMaxParser * GetParent () const
 
void SetParent (BMaxParser *val)
 
void SetAutoScale (bool value)
 
bool IsAutoScale ()
 
const Vector3 & GetCenterPos () const
 
void MergeCoplanerBlockFace ()
 
bool IsCoplaneNode (BMaxNode *node1, BMaxNode *node2, int nFaceIndex)
 
void FindCoplanerFace (BMaxNode *node, uint32 nFaceIndex)
 
void FindNeighbourFace (Rectangle *rectangle, uint32 i, uint32 nFaceIndex)
 
void CalculateLod (uint32 nMaxTriangleCount)
 
void GetLodTable (uint32 faceCount, vector< uint32 > &lodTable)
 
void PerformLod ()
 
void CalculateAABB (vector< BMaxNodePtr > &nodes)
 
void CalculateLodNode (map< int64, BMaxNodePtr > &nodeMap, int x, int y, int z)
 
uint64 GetNodeIndex (uint16 x, uint16 y, uint16 z)
 
BMaxNode * GetBMaxNode (int x, int y, int z)
 
BMaxNode * GetNode (uint16 x, uint16 y, uint16 z)
 
BMaxNode * GetNodeByIndex (int64 index)
 
int64 InsertNode (BMaxNodePtr &nodePtr)
 return node index
 
void Load (const char *pBuffer, int32 nSize)
 
void ParseBlocks (BMaxXMLDocument &doc)
 
void ParseBlocks_Internal (const char *value)
 
void ParseVisibleBlocks ()
 
void ParseHead (BMaxXMLDocument &doc)
 
void ParseBlockFrames ()
 
void CreateDefaultAnimations ()
 
void AutoAddWalkAnimation (int nAnimID, int nStartTime, int nEndTime, float fMoveSpeed=4.f, bool bMoveForward=true)
 
BMaxFrameNode * GetFrameNode (int16 x, int16 y, int16 z)
 
void CalculateBoneWeights ()
 
void CalculateBoneWeightFromNeighbours (BMaxNode *node)
 
void CalculateBoneSkin (BMaxFrameNode *pBoneNode)
 
void CalculateBoneWeightForBlock (BMaxFrameNode *pBoneNode, BMaxNode *node, bool bMustBeSameColor=true)
 
int FindRootBoneIndex ()
 find the first root bone index. More...
 
void ParseBlockAnimations (BMaxXMLDocument &doc)
 
void ParseBlockAnimationSet (BMaxXMLElement *node)
 
void ParseBlockAnimation (BMaxXMLElement *node)
 
void ParseBlockAnimationKeys (uint16 x, uint16 y, uint16 z, BMaxXMLElement *node, int nIndex)
 
void ParseBlockAnimationKey (BMaxXMLElement *node, Bone *bone, const std::string propertyType)
 
void ClearModel ()
 
void FillParaXModelData (CParaXModel *pMesh)
 
void FillVerticesAndIndices ()
 
int GetBoneIndex (uint16 x, uint16 y, uint16 z)
 
void ScaleModels ()
 
float CalculateScale (float length)
 
int64 GetIndexFromXmlElement (BMaxXMLElement *node, const char *name, int &x, int &y, int &z)
 
bool ReadValue (BMaxXMLElement *node, const char *name, int32_t &value)
 
bool ReadValue (BMaxXMLElement *node, const char *name, float &value)
 
bool ReadValue (BMaxXMLElement *node, const char *name, Vector3 &value)
 
bool ReadValue (BMaxXMLElement *node, const char *name, std::string &value)
 
bool ReadValue (BMaxXMLElement *node, const char *name, Vector4 &value)
 
int GetNameAppearanceCount (const std::string &name, bool bAdd=true)
 how many times that a given name has appeared. More...
 
CParaXModel * CreateGetRefModel (const std::string &sFilename)
 filename is relative to current world directory. More...
 
ModelGeoset * AddGeoset ()
 
ModelRenderPass * AddRenderPass ()
 
BMaxAnimGenerator * GetAnimGenerator ()
 

Protected Attributes

BMaxParser * m_pParent
 
std::string m_filename
 
std::vector< BlockModel * > m_blockModels
 
std::map< uint64, BMaxNodePtr > m_nodes
 
std::map< std::string, ref_ptr< CParaXModel > > m_refModels
 
vector< BMaxFrameNodePtr > m_bones
 array of bone nodes, array index is the bone index.
 
std::map< std::string, int > m_name_occurances
 
bool m_bAutoScale
 
bool m_bHasBoneBlock
 
float m_fScale
 
map< BlockModel *, BMaxNode * > m_blockModelsMapping
 
vector< ModelAnimation > m_anims
 
bool m_bHasAnimation
 
vector< ModelVertex > m_vertices
 
vector< RectanglePtr > m_rectangles
 
vector< uint16 > m_indices
 
std::vector< ModelGeoset > m_geosets
 
std::vector< ModelRenderPass > m_renderPasses
 
CShapeBox m_blockAABB
 aabb in block world coordinate
 
Vector3 m_centerPos
 the center point in block world coordinate
 
Vector3 m_minExtent
 
Vector3 m_maxExtent
 
int m_nHelperBlockId
 the block id used to extend AABB. More...
 
int m_nLodLevel
 
BMaxAnimGenerator * m_pAnimGenerator
 

Static Protected Attributes

static const int MaxBoneLengthHorizontal = 50
 
static const int MaxBoneLengthVertical = 100
 

Friends

struct BMaxNode
 
struct BMaxFrameNode
 
struct BMaxBlockModelNode
 
class BMaxAnimGenerator
 

Detailed Description

Block Max file format parser.

For *.bmax

Member Function Documentation

§ CalculateBoneWeightForBlock()

void ParaEngine::BMaxParser::CalculateBoneWeightForBlock ( BMaxFrameNode *  pBoneNode,
BMaxNode *  node,
bool  bMustBeSameColor = true 
)
protected
Parameters
bMustBeSameColorif true we will only add bone if color is the same as the bone.

§ CreateGetRefModel()

CParaXModel * ParaEngine::BMaxParser::CreateGetRefModel ( const std::string &  sFilename)
protected

filename is relative to current world directory.

§ FindRootBoneIndex()

int ParaEngine::BMaxParser::FindRootBoneIndex ( )
protected

find the first root bone index.

In most cases it is 0. the first bone without parent is the root bone

§ GetNameAppearanceCount()

int ParaEngine::BMaxParser::GetNameAppearanceCount ( const std::string &  name,
bool  bAdd = true 
)
protected

how many times that a given name has appeared.

Member Data Documentation

§ m_nHelperBlockId

int ParaEngine::BMaxParser::m_nHelperBlockId
protected

the block id used to extend AABB.


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