cocos2d-x  3.3
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Bundle3D Class Reference

Defines a bundle file that contains a collection of assets. More...

#include <CCBundle3D.h>

Public Member Functions

virtual void clear ()
 
virtual bool load (const std::string &path)
 load a file. More...
 
virtual bool loadSkinData (const std::string &id, SkinData *skindata)
 load skin data from bundle More...
 
virtual bool loadAnimationData (const std::string &id, Animation3DData *animationdata)
 load material data from bundle More...
 
virtual bool loadMeshDatas (MeshDatas &meshdatas)
 
virtual bool loadNodes (NodeDatas &nodedatas)
 
virtual bool loadMaterials (MaterialDatas &materialdatas)
 

Static Public Member Functions

static void setBundleInstance (Bundle3D *bundleInstance)
 you can define yourself bundle and set it, use default bundle otherwise More...
 
static Bundle3DgetInstance ()
 
static void destroyInstance ()
 
static bool loadObj (MeshDatas &meshdatas, MaterialDatas &materialdatas, NodeDatas &nodedatas, const std::string &fullPath, const char *mtl_basepath=nullptr)
 
static AABB calculateAABB (const std::vector< float > &vertex, int stride, const std::vector< unsigned short > &index)
 

Protected Member Functions

bool loadJson (const std::string &path)
 
bool loadBinary (const std::string &path)
 
bool loadMeshDatasJson (MeshDatas &meshdatas)
 
bool loadMeshDataJson_0_1 (MeshDatas &meshdatas)
 
bool loadMeshDataJson_0_2 (MeshDatas &meshdatas)
 
bool loadMeshDatasBinary (MeshDatas &meshdatas)
 
bool loadMeshDatasBinary_0_1 (MeshDatas &meshdatas)
 
bool loadMeshDatasBinary_0_2 (MeshDatas &meshdatas)
 
bool loadMaterialsJson (MaterialDatas &materialdatas)
 
bool loadMaterialDataJson_0_1 (MaterialDatas &materialdatas)
 
bool loadMaterialDataJson_0_2 (MaterialDatas &materialdatas)
 
bool loadMaterialsBinary (MaterialDatas &materialdatas)
 
bool loadMaterialsBinary_0_1 (MaterialDatas &materialdatas)
 
bool loadMaterialsBinary_0_2 (MaterialDatas &materialdatas)
 
bool loadMeshDataJson (MeshData *meshdata)
 
bool loadMeshDataJson_0_1 (MeshData *meshdata)
 
bool loadMeshDataJson_0_2 (MeshData *meshdata)
 
bool loadSkinDataJson (SkinData *skindata)
 
bool loadSkinDataBinary (SkinData *skindata)
 
bool loadMaterialDataJson (MaterialData *materialdata)
 
bool loadMaterialDataJson_0_1 (MaterialData *materialdata)
 
bool loadMaterialDataJson_0_2 (MaterialData *materialdata)
 
bool loadAnimationDataJson (const std::string &id, Animation3DData *animationdata)
 
bool loadAnimationDataBinary (const std::string &id, Animation3DData *animationdata)
 
bool loadNodesJson (NodeDatas &nodedatas)
 load nodes of json More...
 
NodeDataparseNodesRecursivelyJson (const rapidjson::Value &jvalue)
 
bool loadNodesBinary (NodeDatas &nodedatas)
 load nodes of binary More...
 
NodeDataparseNodesRecursivelyBinary (bool &skeleton)
 
GLenum parseGLType (const std::string &str)
 get define data type More...
 
NTextureData::Usage parseGLTextureType (const std::string &str)
 get define data type More...
 
unsigned int parseGLProgramAttribute (const std::string &str)
 get vertex attribute type More...
 
void getModelRelativePath (const std::string &path)
 
ReferenceseekToFirstType (unsigned int type, const std::string &id="")
 
virtual ~Bundle3D ()
 

Protected Attributes

CC_CONSTRUCTOR_ACCESS __pad0__: Bundle3D()
 
std::string _modelPath
 
std::string _path
 
std::string _version
 
char * _jsonBuffer
 
rapidjson::Document _jsonReader
 
Data_binaryBuffer
 
BundleReader _binaryReader
 
unsigned int _referenceCount
 
Reference_references
 
bool _isBinary
 

Static Protected Attributes

static Bundle3D_instance
 

Detailed Description

Defines a bundle file that contains a collection of assets.

Mesh, Material, MeshSkin, Animation There are two types of bundle files, c3t and c3b. c3t text file c3b binary file

Constructor & Destructor Documentation

virtual ~Bundle3D ( )
protectedvirtual

Member Function Documentation

static AABB calculateAABB ( const std::vector< float > &  vertex,
int  stride,
const std::vector< unsigned short > &  index 
)
static
virtual void clear ( )
virtual
static void destroyInstance ( )
static
static Bundle3D* getInstance ( )
static
void getModelRelativePath ( const std::string &  path)
protected
virtual bool load ( const std::string &  path)
virtual

load a file.

You must load a file first, then call loadMeshData, loadSkinData, and so on

Parameters
pathFile to be loaded
Returns
result of load
virtual bool loadAnimationData ( const std::string &  id,
Animation3DData animationdata 
)
virtual

load material data from bundle

Parameters
idThe ID of the animation, load the first animation in the bundle if it is empty
bool loadAnimationDataBinary ( const std::string &  id,
Animation3DData animationdata 
)
protected
bool loadAnimationDataJson ( const std::string &  id,
Animation3DData animationdata 
)
protected
bool loadBinary ( const std::string &  path)
protected
bool loadJson ( const std::string &  path)
protected
bool loadMaterialDataJson ( MaterialData materialdata)
inlineprotected
bool loadMaterialDataJson_0_1 ( MaterialDatas materialdatas)
protected
bool loadMaterialDataJson_0_1 ( MaterialData materialdata)
inlineprotected
bool loadMaterialDataJson_0_2 ( MaterialDatas materialdatas)
protected
bool loadMaterialDataJson_0_2 ( MaterialData materialdata)
inlineprotected
virtual bool loadMaterials ( MaterialDatas materialdatas)
virtual
bool loadMaterialsBinary ( MaterialDatas materialdatas)
protected
bool loadMaterialsBinary_0_1 ( MaterialDatas materialdatas)
protected
bool loadMaterialsBinary_0_2 ( MaterialDatas materialdatas)
protected
bool loadMaterialsJson ( MaterialDatas materialdatas)
protected
bool loadMeshDataJson ( MeshData meshdata)
inlineprotected
bool loadMeshDataJson_0_1 ( MeshDatas meshdatas)
protected
bool loadMeshDataJson_0_1 ( MeshData meshdata)
inlineprotected
bool loadMeshDataJson_0_2 ( MeshDatas meshdatas)
protected
bool loadMeshDataJson_0_2 ( MeshData meshdata)
inlineprotected
virtual bool loadMeshDatas ( MeshDatas meshdatas)
virtual
bool loadMeshDatasBinary ( MeshDatas meshdatas)
protected
bool loadMeshDatasBinary_0_1 ( MeshDatas meshdatas)
protected
bool loadMeshDatasBinary_0_2 ( MeshDatas meshdatas)
protected
bool loadMeshDatasJson ( MeshDatas meshdatas)
protected
virtual bool loadNodes ( NodeDatas nodedatas)
virtual
bool loadNodesBinary ( NodeDatas nodedatas)
protected

load nodes of binary

bool loadNodesJson ( NodeDatas nodedatas)
protected

load nodes of json

static bool loadObj ( MeshDatas meshdatas,
MaterialDatas materialdatas,
NodeDatas nodedatas,
const std::string &  fullPath,
const char *  mtl_basepath = nullptr 
)
static
virtual bool loadSkinData ( const std::string &  id,
SkinData skindata 
)
virtual

load skin data from bundle

Parameters
idThe ID of the skin, load the first Skin in the bundle if it is empty
bool loadSkinDataBinary ( SkinData skindata)
protected
bool loadSkinDataJson ( SkinData skindata)
protected
unsigned int parseGLProgramAttribute ( const std::string &  str)
protected

get vertex attribute type

Parameters
strThe type in string
NTextureData::Usage parseGLTextureType ( const std::string &  str)
protected

get define data type

Parameters
strThe type in string
GLenum parseGLType ( const std::string &  str)
protected

get define data type

Parameters
strThe type in string
NodeData* parseNodesRecursivelyBinary ( bool &  skeleton)
protected
NodeData* parseNodesRecursivelyJson ( const rapidjson::Value &  jvalue)
protected
Reference* seekToFirstType ( unsigned int  type,
const std::string &  id = "" 
)
protected
static void setBundleInstance ( Bundle3D bundleInstance)
static

you can define yourself bundle and set it, use default bundle otherwise

Member Data Documentation

CC_CONSTRUCTOR_ACCESS __pad0__
protected
Data* _binaryBuffer
protected
BundleReader _binaryReader
protected
Bundle3D* _instance
staticprotected
bool _isBinary
protected
char* _jsonBuffer
protected
rapidjson::Document _jsonReader
protected
std::string _modelPath
protected
std::string _path
protected
unsigned int _referenceCount
protected
Reference* _references
protected
std::string _version
protected

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