Skip to content

Commit

Permalink
Fix animated models previews don't work
Browse files Browse the repository at this point in the history
  • Loading branch information
enginmanap committed Jan 8, 2025
1 parent fe382f1 commit bbeeccc
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/Editor/Editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,7 @@ void Editor::createObjectTreeRecursive(PhysicalRenderable *physicalRenderable, u

void Editor::renderSelectedObject(Model* model) const {
backgroundRenderStage->activate(true);
model->convertToRenderList(0, 0).render(world->graphicsWrapper, graphicsProgram);
model->convertToRenderList(0, 0).render(world->graphicsWrapper, graphicsProgram, true);
world->renderPipeline->reActivateLastStage();
}

8 changes: 6 additions & 2 deletions src/Occlusion/RenderList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ void RenderList::removeModelFromAll(uint32_t modelId) {
}
}

void RenderList::render(GraphicsInterface *graphicsWrapper, const std::shared_ptr<GraphicsProgram> &renderProgram) const {
void RenderList::render(GraphicsInterface *graphicsWrapper, const std::shared_ptr<GraphicsProgram> &renderProgram, bool forceNotAnimated) const {
int diffuseMapAttachPoint = 1;
int ambientMapAttachPoint = 2;
int specularMapAttachPoint = 3;
Expand Down Expand Up @@ -93,7 +93,11 @@ void RenderList::render(GraphicsInterface *graphicsWrapper, const std::shared_pt
std::cerr << "Empty meshInfo" << std::endl;
continue;
}
renderProgram->setUniform("isAnimated", renderListIterator.get().isAnimated);
if (forceNotAnimated) {
renderProgram->setUniform("isAnimated", false);
} else {
renderProgram->setUniform("isAnimated", renderListIterator.get().isAnimated);
}

graphicsWrapper->setModelIndexesUBO(renderListIterator.get().indices);
graphicsWrapper->renderInstanced(renderProgram->getID(), renderListIterator.getMesh()->getVao(), renderListIterator.getMesh()->getEbo(), renderListIterator.getMesh()->getTriangleCount()[renderListIterator.get().lod] * 3, renderListIterator.getMesh()->getOffsets()[renderListIterator.get().lod], renderListIterator.get().indices.size());
Expand Down
2 changes: 1 addition & 1 deletion src/Occlusion/RenderList.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ class RenderList {
}


void render(GraphicsInterface* graphicsWrapper, const std::shared_ptr<GraphicsProgram> &renderProgram) const;
void render(GraphicsInterface* graphicsWrapper, const std::shared_ptr<GraphicsProgram> &renderProgram, bool forceNotAnimated = false) const;

void cleanUpEmptyRenderLists();

Expand Down

0 comments on commit bbeeccc

Please sign in to comment.