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

Mesh: contains ref to index buffer, GLProgramState, texture, skin, blend function, aabb and so on. More...

#include <CCMesh.h>

Inheritance diagram for Mesh:
Ref

Public Types

typedef std::vector< unsigned
short > 
IndexArray
 

Public Member Functions

GLuint getVertexBuffer () const
 get vertex buffer More...
 
bool hasVertexAttrib (int attrib) const
 has vertex attribute? More...
 
ssize_t getMeshVertexAttribCount () const
 get mesh vertex attribute count More...
 
const MeshVertexAttribgetMeshVertexAttribute (int idx)
 get MeshVertexAttribute by index More...
 
int getVertexSizeInBytes () const
 get per vertex size in bytes More...
 
void setTexture (const std::string &texPath)
 texture getter and setter More...
 
void setTexture (Texture2D *tex)
 
Texture2DgetTexture () const
 
void setVisible (bool visible)
 visible getter and setter More...
 
bool isVisible () const
 
MeshSkingetSkin () const
 skin getter More...
 
MeshIndexDatagetMeshIndexData () const
 mesh index data getter More...
 
GLProgramStategetGLProgramState () const
 get GLProgramState More...
 
const std::string & getName () const
 name getter More...
 
void setBlendFunc (const BlendFunc &blendFunc)
 
const BlendFuncgetBlendFunc () const
 
GLenum getPrimitiveType () const
 get primitive type More...
 
ssize_t getIndexCount () const
 get index count More...
 
GLenum getIndexFormat () const
 get index format More...
 
GLuint getIndexBuffer () const
 get index buffer More...
 
const AABBgetAABB () const
 get AABB More...
 
virtual ~Mesh ()
 
GLProgramgetDefaultGLProgram (bool textured)
 
void setGLProgramState (GLProgramState *glProgramState)
 
MeshCommandgetMeshCommand ()
 
void setSkin (MeshSkin *skin)
 skin setter More...
 
void setMeshIndexData (MeshIndexData *indexdata)
 Mesh index data setter. More...
 
void setName (const std::string &name)
 name setter More...
 
void calcuateAABB ()
 
void bindMeshCommand ()
 
- Public Member Functions inherited from Ref
void retain ()
 Retains the ownership. More...
 
void release ()
 Releases the ownership immediately. More...
 
Refautorelease ()
 Releases the ownership sometime soon automatically. More...
 
unsigned int getReferenceCount () const
 Returns the Ref's current reference count. More...
 
virtual ~Ref ()
 NA NA More...
 

Static Public Member Functions

static Meshcreate (const std::vector< float > &positions, const std::vector< float > &normals, const std::vector< float > &texs, const IndexArray &indices)
 create mesh from positions, normals, and so on, sigle SubMesh More...
 
static Meshcreate (const std::vector< float > &vertices, int perVertexSizeInFloat, const IndexArray &indices, int numIndex, const std::vector< MeshVertexAttrib > &attribs, int attribCount)
 create mesh with vertex attributes More...
 
static Meshcreate (const std::vector< float > &vertices, int perVertexSizeInFloat, const IndexArray &indices, const std::vector< MeshVertexAttrib > &attribs)
 
static Meshcreate (const std::string &name, MeshIndexData *indexData, MeshSkin *skin=nullptr)
 create mesh More...
 

Public Attributes

CC_CONSTRUCTOR_ACCESS __pad0__: Mesh()
 

Protected Attributes

Texture2D_texture
 
MeshSkin_skin
 
bool _visible
 
bool _isTransparent
 
std::string _name
 
MeshIndexData_meshIndexData
 
GLProgramState_glProgramState
 
MeshCommand _meshCommand
 
BlendFunc _blend
 
AABB _aabb
 
std::function< void()> _visibleChanged
 
- Protected Attributes inherited from Ref
unsigned int _referenceCount
 count of references More...
 

Friends

class Sprite3D
 

Additional Inherited Members

- Protected Member Functions inherited from Ref
 Ref ()
 Constructor. More...
 

Detailed Description

Mesh: contains ref to index buffer, GLProgramState, texture, skin, blend function, aabb and so on.

Member Typedef Documentation

typedef std::vector<unsigned short> IndexArray

Constructor & Destructor Documentation

virtual ~Mesh ( )
virtual

Member Function Documentation

void bindMeshCommand ( )
void calcuateAABB ( )
static Mesh* create ( const std::vector< float > &  positions,
const std::vector< float > &  normals,
const std::vector< float > &  texs,
const IndexArray indices 
)
static

create mesh from positions, normals, and so on, sigle SubMesh

static Mesh* create ( const std::vector< float > &  vertices,
int  perVertexSizeInFloat,
const IndexArray indices,
int  numIndex,
const std::vector< MeshVertexAttrib > &  attribs,
int  attribCount 
)
inlinestatic

create mesh with vertex attributes

static Mesh* create ( const std::vector< float > &  vertices,
int  perVertexSizeInFloat,
const IndexArray indices,
const std::vector< MeshVertexAttrib > &  attribs 
)
static
static Mesh* create ( const std::string &  name,
MeshIndexData indexData,
MeshSkin skin = nullptr 
)
static

create mesh

const AABB& getAABB ( ) const
inline

get AABB

const BlendFunc& getBlendFunc ( ) const
GLProgram* getDefaultGLProgram ( bool  textured)
GLProgramState* getGLProgramState ( ) const
inline
GLuint getIndexBuffer ( ) const

get index buffer

ssize_t getIndexCount ( ) const

get index count

GLenum getIndexFormat ( ) const

get index format

MeshCommand& getMeshCommand ( )
inline
MeshIndexData* getMeshIndexData ( ) const
inline

mesh index data getter

ssize_t getMeshVertexAttribCount ( ) const

get mesh vertex attribute count

const MeshVertexAttrib& getMeshVertexAttribute ( int  idx)

get MeshVertexAttribute by index

const std::string& getName ( ) const
inline

name getter

GLenum getPrimitiveType ( ) const

get primitive type

MeshSkin* getSkin ( ) const
inline

skin getter

Texture2D* getTexture ( ) const
inline
GLuint getVertexBuffer ( ) const

get vertex buffer

int getVertexSizeInBytes ( ) const

get per vertex size in bytes

bool hasVertexAttrib ( int  attrib) const

has vertex attribute?

bool isVisible ( ) const
inline
void setBlendFunc ( const BlendFunc blendFunc)
void setGLProgramState ( GLProgramState glProgramState)
void setMeshIndexData ( MeshIndexData indexdata)

Mesh index data setter.

void setName ( const std::string &  name)
inline

name setter

void setSkin ( MeshSkin skin)

skin setter

void setTexture ( const std::string &  texPath)

texture getter and setter

void setTexture ( Texture2D tex)
void setVisible ( bool  visible)

visible getter and setter

Friends And Related Function Documentation

friend class Sprite3D
friend

Member Data Documentation

AABB _aabb
protected
BlendFunc _blend
protected
GLProgramState* _glProgramState
protected
bool _isTransparent
protected
MeshCommand _meshCommand
protected
MeshIndexData* _meshIndexData
protected
std::string _name
protected
MeshSkin* _skin
protected
Texture2D* _texture
protected
bool _visible
protected
std::function<void()> _visibleChanged
protected

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