Render position of the cube based on the transform component, fixed some compile issues with the previous commit

This commit is contained in:
2022-10-23 14:36:23 +02:00
parent 99eb5282e5
commit adf2331ab1
8 changed files with 32 additions and 12 deletions

View File

@ -30,10 +30,29 @@ void Start() {
renderable = object->renderable;
render3DComponent.mesh = *renderable->mesh;
cube.GetComponent<BarinkEngine::TransformComponent>()
.transform = glm::rotate(glm::mat4(1.0f), 32.0f, glm::vec3(0.5f,1.0f,0.0f));
// Create a second cube
auto cube2 = scene.AddEntity((std::string&)"Cube2");
auto& cube2Render = cube2.AddComponent<BarinkEngine::Render3DComponent>();
cube2Render.mesh = *renderable->mesh;
cube2Render.color = glm::vec3(0.0f, 1.0f, 0.0f);
auto& cube2Trans = cube2.GetComponent<BarinkEngine::TransformComponent>();
cube2Trans.transform = glm::translate( glm::mat4(1.0f), glm::vec3(1.0f,0.0f, 5.0f));
renderer.Prepare(scene);
}
/*
* Runs every frame
* - Use to draw Immediate mode graphics (Not meant for HUD's )
@ -45,9 +64,9 @@ void ImmediateGraphicsDraw()
ImGui::Begin("Render edit");
auto a = cube.GetComponent<BarinkEngine::Render3DComponent>();
auto& a = cube.GetComponent<BarinkEngine::Render3DComponent>();
ImGui::DragFloat3("Color", &a->color[0], 0.01f, 0.0f, 1.0f);
ImGui::DragFloat3("Color", &a.color[0], 0.01f, 0.0f, 1.0f);
ImGui::End();