added texture to shapes

This commit is contained in:
Lauchmelder 2021-12-24 23:34:01 +01:00
parent 38a49c504a
commit 9ff485588e
8 changed files with 70 additions and 30 deletions

View file

@ -132,22 +132,25 @@ void Application::Init(int width, int height, const std::string& title)
pitch = camera.GetAngles().x;
yaw = camera.GetAngles().y;
Shape* shape = new Cube();
lol::Image img("assets/puh.jpg");
texture = std::make_shared<lol::Texture>(img);
Shape* shape = new Cube(texture);
shape->Move(glm::vec3(0.0f, -2.0f, 0.0f));
shape->Rotate(glm::vec3(1.0f, 1.0f, 1.0f), 60);
shapes.push_back(shape);
shape = new Cube();
shape = new Cube(texture);
shape->Move(glm::vec3(0.0f, 2.0f, 0.0f));
shape->Rotate(glm::vec3(0.5f, 1.0f, 1.2f), 60);
shapes.push_back(shape);
shape = new Pyramid();
shape = new Pyramid(texture);
shape->Move(glm::vec3(0.0f, 0.0f, 3.0f));
shape->Rotate(glm::vec3(1.0f, 0.0f, 0.0f), -90);
shapes.push_back(shape);
shape = new Pyramid();
shape = new Pyramid(texture);
shape->Move(glm::vec3(0.0f, 0.0f, -3.0f));
shape->Rotate(glm::vec3(1.0f, 0.3f, 1.2f), 120);
shapes.push_back(shape);
@ -201,6 +204,11 @@ void Application::Launch()
ImGui::SliderFloat("Pitch", &pitch, 1.0f, 179.0f);
}
if (ImGui::CollapsingHeader("Texture"))
{
ImGui::Image((void*)texture->GetID(), ImVec2(67 * 3, 72 * 3));
}
ImGui::End();
ImGui::Render();