From e9fba90fa21e27f141467786f1b120eb41f9ab7c Mon Sep 17 00:00:00 2001 From: sherl Date: Sun, 19 Jan 2025 10:10:22 +0100 Subject: [PATCH 1/3] =?UTF-8?q?poprawienie=20deklaracji=20i=20FPSCounter.c?= =?UTF-8?q?pp,=20aby=20program=20m=C3=B3g=C5=82=20si=C4=99=20skompilowa?= =?UTF-8?q?=C4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- FPSCounter.cpp | 1 - main.cpp | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/FPSCounter.cpp b/FPSCounter.cpp index 3c9baa7..98bc060 100644 --- a/FPSCounter.cpp +++ b/FPSCounter.cpp @@ -1,4 +1,3 @@ -#pragma once #include #include diff --git a/main.cpp b/main.cpp index c2abc90..d25195a 100644 --- a/main.cpp +++ b/main.cpp @@ -414,7 +414,7 @@ static unsigned char* LoadBitmapFile(char* filename, BITMAPINFOHEADER* bitmapInf return bitmapImage; } -static void SetDCPixelFormat(HDC hDC) { +void SetDCPixelFormat(HDC hDC) { int nPixelFormat; static PIXELFORMATDESCRIPTOR pfd = { From b805164ad4765884966f7d1509eb7a69f5b1a4eb Mon Sep 17 00:00:00 2001 From: sherl Date: Sun, 19 Jan 2025 11:07:35 +0100 Subject: [PATCH 2/3] =?UTF-8?q?zwi=C4=99kszenie=20tarcia,=20zmniejszenie?= =?UTF-8?q?=20reflektywno=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) From 49fee6ded8aa1489c89da94629cfcfa027f9ecda Mon Sep 17 00:00:00 2001 From: sherl Date: Sun, 19 Jan 2025 17:36:48 +0100 Subject: [PATCH 3/3] =?UTF-8?q?zmniejsz=20pr=C4=99dko=C5=9B=C4=87=20obrotu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.cpp b/main.cpp index af88935..ae6b251 100644 --- a/main.cpp +++ b/main.cpp @@ -128,7 +128,7 @@ const float acceleration = 0.2f; const float rotationAcceleration = 0.075f; // Przyspieszenie obrotu const float rotationFriction = 0.1f; // Współczynnik tarcia obrotu -const float maxRotationSpeed = 1.0f; // Maksymalna prędkość obrotu +const float maxRotationSpeed = 0.7f; // Maksymalna prędkość obrotu // Struktura do reprezentacji płotu struct Plot {