Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
VertexStreamAttribute Class Reference

VertexStreamAttribute is used to specify the vertex attribute for drawing, which is correspondent to glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr). More...

Public Member Functions

 VertexStreamAttribute ()
 Constructor.
 
 VertexStreamAttribute (int offset, int semantic, int type, int size)
 Constructor The offset of the attribute. More...
 
 VertexStreamAttribute ( var offset, var semantic, var type, var size)
 Constructor The offset of the attribute. More...
 
 VertexStreamAttribute ( local offset, local semantic, local type, local size)
 Constructor The offset of the attribute. More...
 
 VertexStreamAttribute (int offset, int semantic, int type, int size, bool normalize)
 Constructor The offset of the attribute. More...
 

Public Attributes

bool _normalize
 Whether the attribute should be normalized or not.
 
int _offset
 The offset of the attribute in the buffer.
 
int _semantic
 Describe that the attribute usage, could be Position, Color etc.
 
int _type
 Describe the type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc.
 
int _size
 Describe how many elements of type in the attribute.
 

Detailed Description

VertexStreamAttribute is used to specify the vertex attribute for drawing, which is correspondent to glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr).

_semantic -> index _size -> size _type -> type _normalize -> normalized _offset is used to compute the start offset in a interleaved array, take a V3F_C4B_T2F array, offset of vertex will be 0, offset of color would be 0 + sizeof(float) * 3 = 12, offset of texture coord would be 12 + sizeof(char) * 4 = 16.

Constructor & Destructor Documentation

VertexStreamAttribute ( int  offset,
int  semantic,
int  type,
int  size 
)
inline

Constructor The offset of the attribute.

The semantic (Position, Texcoord, Color etc) of attribute. The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. Describe how many elements of type in the attribute.

var VertexStreamAttribute ( var  offset,
var  semantic,
var  type,
var  size 
)
inline

Constructor The offset of the attribute.

The semantic (Position, Texcoord, Color etc) of attribute. The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. Describe how many elements of type in the attribute.

local VertexStreamAttribute ( local  offset,
local  semantic,
local  type,
local  size 
)
inline

Constructor The offset of the attribute.

The semantic (Position, Texcoord, Color etc) of attribute. The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. Describe how many elements of type in the attribute.

VertexStreamAttribute ( int  offset,
int  semantic,
int  type,
int  size,
bool  normalize 
)
inline

Constructor The offset of the attribute.

The semantic (Position, Texcoord, Color etc) of attribute. The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. Describe how many elements of type in the attribute. If true, the data will be normalized by deviding 255.

var VertexStreamAttribute ( var  offset,
var  semantic,
var  type,
var  size,
var  normalize 
)
inline

Constructor The offset of the attribute.

The semantic (Position, Texcoord, Color etc) of attribute. The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. Describe how many elements of type in the attribute. If true, the data will be normalized by deviding 255.

local VertexStreamAttribute ( local  offset,
local  semantic,
local  type,
local  size,
local  normalize 
)
inline

Constructor The offset of the attribute.

The semantic (Position, Texcoord, Color etc) of attribute. The type of attribute, could be GL_FLOAT, GL_UNSIGNED_BYTE etc. Describe how many elements of type in the attribute. If true, the data will be normalized by deviding 255.


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