Zadanie 3 Add sphere scale
This commit is contained in:
parent
ab3cfb1f31
commit
acb612da42
Binary file not shown.
@ -28,5 +28,5 @@ Size=256,127
|
||||
|
||||
[Window][Track Ball]
|
||||
Pos=60,180
|
||||
Size=247,125
|
||||
Size=325,209
|
||||
|
||||
|
@ -19,6 +19,7 @@ const int ballsAmount = 2;
|
||||
|
||||
const float initTimeStep = 0.001f;
|
||||
const float initCameraScale = 1.0f;
|
||||
const float initSphereScale = 0.05f;
|
||||
|
||||
bool shouldUpdate = true;
|
||||
bool shouldAlwaysUpdate = true;
|
||||
@ -26,6 +27,7 @@ float t = 0.0f;
|
||||
|
||||
float timeStep = initTimeStep;
|
||||
float cameraScale = initCameraScale;
|
||||
float sphereScale = initSphereScale;
|
||||
int currentTrackedBall = -1;
|
||||
|
||||
struct Ball {
|
||||
@ -51,6 +53,7 @@ void imGuiTrackBallFrame(){
|
||||
ImGui::Begin("Track Ball");
|
||||
|
||||
ImGui::SliderFloat("Camera scale", &cameraScale, 0.1f, 2.0f, "%.3f", 1.0f);
|
||||
ImGui::SliderFloat("Sphere scale", &sphereScale, 0.01f, 0.1f, "%.3f", 1.0f);
|
||||
|
||||
|
||||
if(ImGui::Button("Track red ball")){
|
||||
@ -261,7 +264,7 @@ void display() {
|
||||
// Rysowanie kul
|
||||
for (const auto &ball : balls) {
|
||||
glm::mat4 model = glm::translate(glm::mat4(1.0f), glm::vec3(ball.position.x, ball.position.y, 0.0f));
|
||||
model = glm::scale(model, glm::vec3(0.05f, 0.05f, 1.0f)); // Skala dla małych kul
|
||||
model = glm::scale(model, glm::vec3(sphereScale, sphereScale, 1.0f)); // Skala dla małych kul
|
||||
glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));
|
||||
glUniform3f(colorLoc, ball.color.r, ball.color.g, ball.color.b);
|
||||
drawSmallCircle(); // Rysujemy małe koło reprezentujące kulę
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user