Render position of the cube based on the transform component, fixed some compile issues with the previous commit
This commit is contained in:
		@ -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();
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user