Merge branch 'Kolizja-Pod-Klawiszem-K' of https://gitea.7o7.cx/sherl/grafikaKBT into Kolizja-Pod-Klawiszem-K

This commit is contained in:
Pc
2025-01-19 18:06:51 +01:00
2 changed files with 15 additions and 14 deletions

View File

@@ -1,4 +1,3 @@
#pragma once
#include <iostream> #include <iostream>
#include <chrono> #include <chrono>

View File

@@ -121,14 +121,14 @@ float velocity = 0.0f; // Aktualna prędkość łazika
float rotationVelocity = 0.0f; // Prędkość obrotu ł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 maxSpeed = 5.0f; // Maksymalna prędkość łazika
const float acceleration = 0.2f; const float acceleration = 0.2f;
const float rotationAcceleration = 0.075f; // Przyspieszenie obrotu const float rotationAcceleration = 0.075f; // Przyspieszenie obrotu
const float rotationFriction = 0.1f; // Współczynnik tarcia 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 // Struktura do reprezentacji płotu
struct Plot { struct Plot {
@@ -417,7 +417,7 @@ static unsigned char* LoadBitmapFile(char* filename, BITMAPINFOHEADER* bitmapInf
return bitmapImage; return bitmapImage;
} }
static void SetDCPixelFormat(HDC hDC) { void SetDCPixelFormat(HDC hDC) {
int nPixelFormat; int nPixelFormat;
static PIXELFORMATDESCRIPTOR pfd = { static PIXELFORMATDESCRIPTOR pfd = {
@@ -862,7 +862,8 @@ static void SetupRC() {
// All materials hereafter have full specular reflectivity // All materials hereafter have full specular reflectivity
// with a high shine // 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); glMateriali(GL_FRONT, GL_SHININESS, 128);
// White background // White background
@@ -932,6 +933,7 @@ void static RenderScene(void) {
// Rysowanie mapy // Rysowanie mapy
glPushMatrix(); glPushMatrix();
glColor3f(0.0, 1.0, 0.0); // Zielony kolor glColor3f(0.0, 1.0, 0.0); // Zielony kolor
mapa.draw();
platforma(50.0f, 0.0f, 45.0f, 600.0f, 650.0f); platforma(50.0f, 0.0f, 45.0f, 600.0f, 650.0f);
glPopMatrix(); glPopMatrix();
@@ -947,8 +949,8 @@ void static RenderScene(void) {
glPopMatrix(); glPopMatrix();
// Rysowanie innych obiektów // Rysowanie innych obiektów
plot(-550.0f, 3.0f, 50.0f, 1310.0f, 4.0f, 0); 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); 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( 650.0f, 3.0f, 50.0f, 1310.0f, 4.0f, 0);
plot( 50.0f, 3.0f, 695.0f, 1200.0f, 4.0f, 1); plot( 50.0f, 3.0f, 695.0f, 1200.0f, 4.0f, 1);
stodola(10.0f, 0.0f, 2.0f, 40.0f); stodola(10.0f, 0.0f, 2.0f, 40.0f);