Skip to content

Commit

Permalink
Fix model load issues, add unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksigron committed Jun 1, 2024
1 parent 7bc0f76 commit 71d52da
Show file tree
Hide file tree
Showing 11 changed files with 269 additions and 31 deletions.
2 changes: 1 addition & 1 deletion engine/src/Debug/DebugVectorRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ void DebugVectorRenderer::Render(kokko::render::CommandEncoder* encoder, World*
encoder->BindVertexArray(prim.vertexArrayId);

if (mesh.indexType != RenderIndexType::None)
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, 0, 0);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, prim.indexOffset, 0);
else
encoder->Draw(mesh.primitiveMode, 0, prim.count);
}
Expand Down
6 changes: 3 additions & 3 deletions engine/src/Graphics/EnvironmentSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ void EnvironmentSystem::Upload(render::CommandEncoder* encoder)
BindBufferRange(encoder, UniformBlockBinding::Viewport,
viewportUniformBufferId, viewportBlockStride * i, sizeof(ViewportUniformBlock));

encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, 0, 0);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, prim.indexOffset, 0);
}
}

Expand Down Expand Up @@ -467,7 +467,7 @@ void EnvironmentSystem::Upload(render::CommandEncoder* encoder)
BindBufferRange(encoder, UniformBlockBinding::Viewport,
viewportUniformBufferId, viewportBlockStride * i, sizeof(ViewportUniformBlock));

encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, 0, 0);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, prim.indexOffset, 0);
}
}

Expand Down Expand Up @@ -515,7 +515,7 @@ void EnvironmentSystem::Upload(render::CommandEncoder* encoder)
BindBufferRange(encoder, UniformBlockBinding::Viewport,
viewportUniformBufferId, viewportBlockStride * i, sizeof(ViewportUniformBlock));

encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, 0, 0);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, prim.indexOffset, 0);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/Graphics/GraphicsFeatureDeferredLighting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ void GraphicsFeatureDeferredLighting::Render(const RenderParameters& parameters)
auto& mesh = parameters.modelManager->GetModelMeshes(meshId)[0];
auto& prim = parameters.modelManager->GetModelPrimitives(meshId)[0];
encoder->BindVertexArray(prim.vertexArrayId);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, 0, 0);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, prim.indexOffset, 0);

return;
}
Expand Down
2 changes: 1 addition & 1 deletion engine/src/Graphics/GraphicsFeatureSkybox.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void GraphicsFeatureSkybox::Render(const RenderParameters& parameters)
auto& mesh = parameters.modelManager->GetModelMeshes(meshId)[0];
auto& prim = parameters.modelManager->GetModelPrimitives(meshId)[0];
encoder->BindVertexArray(prim.vertexArrayId);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, 0, 0);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, prim.indexOffset, 0);
}

}
2 changes: 1 addition & 1 deletion engine/src/Rendering/PostProcessRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ void PostProcessRenderer::RenderPasses(unsigned int count, const PostProcessRend
if (pass.textureCount > 0)
BindTextures(shader, pass.textureCount, pass.textureNameHashes, pass.textureIds, pass.samplerIds);

encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, 0, 0);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, prim.indexOffset, 0);
}
}

Expand Down
2 changes: 1 addition & 1 deletion engine/src/Rendering/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ void Renderer::Render(Window* window, const Optional<CameraParameters>& editorCa
{
auto& prim = primitives[primIdx];
encoder->BindVertexArray(prim.vertexArrayId);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, 0, 0);
encoder->DrawIndexed(mesh.primitiveMode, mesh.indexType, prim.count, prim.indexOffset, 0);
}

objectDrawsProcessed += 1;
Expand Down
Loading

0 comments on commit 71d52da

Please sign in to comment.