Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix last users node render issue #2283

Merged
merged 1 commit into from Mar 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
14 changes: 11 additions & 3 deletions cocos/renderer/scene/assembler/TiledMapAssembler.cpp
Expand Up @@ -55,9 +55,17 @@ void TiledMapAssembler::handle(NodeProxy *node, ModelBatcher* batcher, Scene* sc
_batcher = batcher;

Assembler::handle(node, batcher, scene);

// Last tiles data may be empty, but has user node, so render it by manual.
auto lastNodesIndex = getIACount();
auto it = _nodesMap.find(lastNodesIndex);
if (it != _nodesMap.end())
{
renderNodes(lastNodesIndex);
}
}

void TiledMapAssembler::beforeFillBuffers(std::size_t index)
void TiledMapAssembler::renderNodes(std::size_t index)
{
static cocos2d::Mat4 tempWorldMat;
const auto& worldMat = _node->getWorldMatrix();
Expand All @@ -84,9 +92,9 @@ void TiledMapAssembler::beforeFillBuffers(std::size_t index)
_batcher->changeCommitState(ModelBatcher::Common);
}

void TiledMapAssembler::fillBuffers(NodeProxy* node, ModelBatcher* batcher, std::size_t index)
void TiledMapAssembler::beforeFillBuffers(std::size_t index)
{
Assembler::fillBuffers(node, batcher, index);
renderNodes(index);
}

RENDERER_END
3 changes: 2 additions & 1 deletion cocos/renderer/scene/assembler/TiledMapAssembler.hpp
Expand Up @@ -37,9 +37,10 @@ class TiledMapAssembler : public Assembler {
virtual ~TiledMapAssembler();
virtual void handle(NodeProxy *node, ModelBatcher* batcher, Scene* scene) override;
virtual void beforeFillBuffers(std::size_t index) override;
virtual void fillBuffers(NodeProxy *node, ModelBatcher* batcher, std::size_t index) override;
void updateNodes(std::size_t iaIndex, const std::vector<std::string>& nodes);
void clearNodes(std::size_t iaIndex);
private:
void renderNodes(std::size_t index);
private:
std::map<std::size_t, std::vector<std::string>> _nodesMap;
NodeProxy* _node = nullptr;
Expand Down