mirror of https://github.com/axmolengine/axmol.git
commit
afaea360fd
|
@ -1693,10 +1693,14 @@ const Mat4& Node::getNodeToParentTransform() const
|
|||
// If skew is needed, apply skew and then anchor point
|
||||
if (needsSkewMatrix)
|
||||
{
|
||||
Mat4 skewMatrix(1, (float)tanf(CC_DEGREES_TO_RADIANS(_skewY)), 0, 0,
|
||||
(float)tanf(CC_DEGREES_TO_RADIANS(_skewX)), 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1);
|
||||
float skewMatArray[16] =
|
||||
{
|
||||
1, (float)tanf(CC_DEGREES_TO_RADIANS(_skewY)), 0, 0,
|
||||
(float)tanf(CC_DEGREES_TO_RADIANS(_skewX)), 1, 0, 0,
|
||||
0, 0, 1, 0,
|
||||
0, 0, 0, 1
|
||||
};
|
||||
Mat4 skewMatrix(skewMatArray);
|
||||
|
||||
_transform = _transform * skewMatrix;
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ bool Primitive::init(VertexData* verts, IndexBuffer* indices, int type)
|
|||
|
||||
void Primitive::draw()
|
||||
{
|
||||
if(_verts && _indices)
|
||||
if(_verts)
|
||||
{
|
||||
_verts->use();
|
||||
if(_indices!= nullptr)
|
||||
|
@ -98,7 +98,7 @@ void Primitive::draw()
|
|||
}
|
||||
else
|
||||
{
|
||||
glDrawArrays((GLenum)_type, _count, _start);
|
||||
glDrawArrays((GLenum)_type, _start, _count);
|
||||
}
|
||||
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
|
||||
|
|
|
@ -625,9 +625,9 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start)
|
|||
// glBufferData(GL_ARRAY_BUFFER, sizeof(quads_[0]) * (n-start), &quads_[start], GL_DYNAMIC_DRAW);
|
||||
|
||||
// option 3: orphaning + glMapBuffer
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * (numberOfQuads-start), nullptr, GL_DYNAMIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(_quads[0]) * _capacity, nullptr, GL_DYNAMIC_DRAW);
|
||||
void *buf = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
|
||||
memcpy(buf, _quads, sizeof(_quads[0])* (numberOfQuads-start));
|
||||
memcpy(buf, _quads, sizeof(_quads[0])* _totalQuads);
|
||||
glUnmapBuffer(GL_ARRAY_BUFFER);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||
|
@ -661,7 +661,7 @@ void TextureAtlas::drawNumberOfQuads(ssize_t numberOfQuads, ssize_t start)
|
|||
// XXX: update is done in draw... perhaps it should be done in a timer
|
||||
if (_dirty)
|
||||
{
|
||||
glBufferSubData(GL_ARRAY_BUFFER, sizeof(_quads[0])*start, sizeof(_quads[0]) * numberOfQuads , &_quads[start] );
|
||||
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(_quads[0]) * _totalQuads , &_quads[0] );
|
||||
_dirty = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue