зеркало из https://github.com/microsoft/cocos2d-x.git
fast_tmx migrate to primitive command
This commit is contained in:
Родитель
f7ad98b15b
Коммит
56551e6787
|
@ -176,8 +176,9 @@ void TMXLayer::draw(Renderer *renderer, const Mat4& transform, uint32_t flags)
|
|||
if(iter.second->getCount() > 0)
|
||||
{
|
||||
auto& cmd = _renderCommands[index++];
|
||||
cmd.init(iter.first);
|
||||
cmd.func = CC_CALLBACK_0(TMXLayer::onDraw, this, iter.second);
|
||||
//cmd.init(iter.first);
|
||||
//cmd.func = CC_CALLBACK_0(TMXLayer::onDraw, this, iter.second);
|
||||
cmd.init(iter.first, _texture->getName(), getGLProgramState(), BlendFunc::ALPHA_NON_PREMULTIPLIED, iter.second, _modelViewTransform);
|
||||
renderer->addCommand(&cmd);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -247,7 +247,7 @@ protected:
|
|||
std::vector<int> _indices;
|
||||
std::map<int/*vertexZ*/, int/*offset to _indices by quads*/> _indicesVertexZOffsets;
|
||||
std::unordered_map<int/*vertexZ*/, int/*number to quads*/> _indicesVertexZNumber;
|
||||
std::vector<CustomCommand> _renderCommands;
|
||||
std::vector<PrimitiveCommand> _renderCommands;
|
||||
bool _dirty;
|
||||
|
||||
VertexBuffer* _vertexBuffer;
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "renderer/CCBatchCommand.h"
|
||||
#include "renderer/CCCustomCommand.h"
|
||||
#include "renderer/CCGroupCommand.h"
|
||||
#include "renderer/CCPrimitiveCommand.h"
|
||||
#include "renderer/CCGLProgramCache.h"
|
||||
#include "renderer/ccGLStateCache.h"
|
||||
#include "renderer/CCMeshCommand.h"
|
||||
|
@ -321,6 +322,12 @@ void Renderer::visitRenderQueue(const RenderQueue& queue)
|
|||
auto cmd = static_cast<BatchCommand*>(command);
|
||||
cmd->execute();
|
||||
}
|
||||
else if(RenderCommand::Type::PRIMITIVE_COMMAND == commandType)
|
||||
{
|
||||
flush();
|
||||
auto cmd = static_cast<PrimitiveCommand*>(command);
|
||||
cmd->execute();
|
||||
}
|
||||
else if (RenderCommand::Type::MESH_COMMAND == commandType)
|
||||
{
|
||||
flush2D();
|
||||
|
|
|
@ -152,9 +152,17 @@ GLint VertexData::getGLSemanticBinding(VertexSemantic semantic)
|
|||
|
||||
void VertexData::use()
|
||||
{
|
||||
uint32_t flags;
|
||||
for(auto& element : _vertexStreams)
|
||||
{
|
||||
glEnableVertexAttribArray((GLint)element.second._stream._semantic);
|
||||
flags = flags | (1 << element.second._stream._semantic);
|
||||
}
|
||||
|
||||
GL::enableVertexAttribs(flags);
|
||||
|
||||
for(auto& element : _vertexStreams)
|
||||
{
|
||||
//glEnableVertexAttribArray((GLint)element.second._stream._semantic);
|
||||
glBindBuffer(GL_ARRAY_BUFFER, element.second._buffer->getVBO());
|
||||
glVertexAttribPointer(GLint(element.second._stream._semantic),element.second._stream._size,
|
||||
element.second._stream._type,element.second._stream._normalize, element.second._buffer->getSizePerVertex(), (GLvoid*)element.second._stream._offset);
|
||||
|
|
Загрузка…
Ссылка в новой задаче