From b805164ad4765884966f7d1509eb7a69f5b1a4eb Mon Sep 17 00:00:00 2001 From: sherl Date: Sun, 19 Jan 2025 11:07:35 +0100 Subject: [PATCH] =?UTF-8?q?zwi=C4=99kszenie=20tarcia,=20zmniejszenie=20ref?= =?UTF-8?q?lektywno=C5=9Bci=20obiekt=C3=B3w?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/main.cpp b/main.cpp index d25195a..af88935 100644 --- a/main.cpp +++ b/main.cpp @@ -121,7 +121,7 @@ float velocity = 0.0f; // Aktualna prędkość łazika float rotationVelocity = 0.0f; // Prędkość obrotu łazika -const float friction = 0.01f; // Współczynnik tarcia (μ) +const float friction = 0.1f; // Współczynnik tarcia (μ) const float maxSpeed = 5.0f; // Maksymalna prędkość łazika const float acceleration = 0.2f; @@ -859,7 +859,8 @@ static void SetupRC() { // All materials hereafter have full specular reflectivity // with a high shine - glMaterialfv(GL_FRONT, GL_SPECULAR, specref); + GLfloat specref2[] = {0.2f, 0.2f, 0.2f, 0.2f}; + glMaterialfv(GL_FRONT, GL_SPECULAR, specref2); glMateriali(GL_FRONT, GL_SHININESS, 128); // White background @@ -919,22 +920,23 @@ void static RenderScene(void) { // Przywrócenie macierzy widoku gluLookAt( - Foward - 50.0f * sin((Rotation + 180.0f) * GL_PI / 180.0f), // Pozycja kamery + Foward - 50.0f * sin((Rotation + 180.0f) * GL_PI / 180.0f), // Pozycja kamery CameraHeight/4, // Wysokość kamery - Sides - 50.0f * cos((Rotation + 180.0f) * GL_PI / 180.0f), // Kamera wzdłuż osi X i Z - Foward, 0.0f, Sides, // Punkt patrzenia (łazik) - 0.0f, 1.0f, 0.0f // Wektor "góry" + Sides - 50.0f * cos((Rotation + 180.0f) * GL_PI / 180.0f), // Kamera wzdłuż osi X i Z + Foward, 0.0f, Sides, // Punkt patrzenia (łazik) + 0.0f, 1.0f, 0.0f // Wektor "góry" ); // Rysowanie mapy glPushMatrix(); glColor3f(0.0, 1.0, 0.0); // Zielony kolor + mapa.draw(); platforma(50.0f, 0.0f, 45.0f, 600.0f, 650.0f); glPopMatrix(); // Rysowanie łazika glPushMatrix(); - glTranslatef(Foward, 0.0f, Sides); // Translacja łazika + glTranslatef(Foward, 0.0f, Sides); // Translacja łazika glRotatef(Rotation, 0.0f, 1.0f, 0.0f); // Obrót łazika glColor3f(1.0, 0.0, 0.0); // Czerwony kolor dla łazika @@ -944,10 +946,10 @@ void static RenderScene(void) { glPopMatrix(); // Rysowanie innych obiektów - plot(-550.0f, 3.0f, 50.0f, 1310.0f, 4.0f, 0); - plot(50.0f, 3.0f, -600.0f, 1200.0f, 4.0f, 1); - plot(650.0f, 3.0f, 50.0f, 1310.0f, 4.0f, 0); - plot(50.0f, 3.0f, 695.0f, 1200.0f, 4.0f, 1); + plot(-550.0f, 3.0f, 50.0f, 1310.0f, 4.0f, 0); // 0 - pionowo + plot( 50.0f, 3.0f, -600.0f, 1200.0f, 4.0f, 1); // 1 - poziomo + plot( 650.0f, 3.0f, 50.0f, 1310.0f, 4.0f, 0); + plot( 50.0f, 3.0f, 695.0f, 1200.0f, 4.0f, 1); stodola(10.0f, 0.0f, 2.0f, 40.0f); // Zamiana buforów (double buffering)