lekko poprawiona mapka, dodane nowe klasy do projektu w visual studio, oddzielny kolor dla mapki i łazika

This commit is contained in:
2024-12-08 16:00:25 +01:00
parent 2b51e31307
commit 633be80ec4
6 changed files with 65 additions and 54 deletions

View File

@@ -78,14 +78,14 @@ std::time_t monitormodehelper;
// Change viewing volume and viewport. Called when window is resized
void ChangeSize(GLsizei w, GLsizei h) {
GLfloat nRange = 100.0f;
GLfloat fAspect;
//GLfloat fAspect;
// Prevent a divide by zero
if (h == 0) h = 1;
lastWidth = w;
lastHeight = h;
fAspect = (GLfloat)w / (GLfloat)h;
//fAspect = (GLfloat)w / (GLfloat)h;
// Set Viewport to window dimensions
glViewport(0, 0, w, h);
@@ -93,9 +93,13 @@ void ChangeSize(GLsizei w, GLsizei h) {
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
// // Establish clipping volume (left, right, bottom, top, near, far)
// if (w <= h) glOrtho(-nRange, nRange, -nRange * h / w, nRange * h / w, -nRange, nRange);
// else glOrtho(-nRange * w / h, nRange * w / h, -nRange, nRange, -nRange, nRange);
// Establish clipping volume (left, right, bottom, top, near, far)
if (w <= h) glOrtho(-nRange, nRange, -nRange * h / w, nRange * h / w, -nRange, nRange);
else glOrtho(-nRange * w / h, nRange * w / h, -nRange, nRange, -nRange, nRange);
if (w <= h) glOrtho(-nRange, nRange, -nRange * h / w, nRange * h / w, -20 * nRange, 20 * nRange);
else glOrtho(-nRange * w / h, nRange * w / h, -nRange, nRange, -20 * nRange, 20 * nRange);
// Establish perspective:
/*
@@ -197,8 +201,8 @@ void SetDCPixelFormat(HDC hDC) {
SetPixelFormat(hDC, nPixelFormat, &pfd);
}
lazik user(0.0f, 0.0f, 0.0f, "res/models/lazik4.obj");
plane mapa(0.0f, 0.0f, 0.0f, "res/models/mapka.obj");
lazik user(10.0f, 0.0f, 0.0f, "res/models/lazik4.obj");
plane mapa(0.0f, 0.0f, 0.0f, "res/models/mapka.obj");
void SetupRC() {
// Light values and coordinates
@@ -322,8 +326,11 @@ void RenderScene(void) {
// // Set our "myTextureSampler" sampler to use Texture Unit 0
// glUniform1i(TextureID, 0);
glColor3f(1.0, 0.0, 0.0);
user.draw();
glColor3f(0.0, 1.0, 0.0);
mapa.draw();
glColor3f(0.0, 0.0, 0.0);
// Swap buffers
//glfwSwapBuffers(window);
@@ -647,7 +654,6 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case ' ': // 32
polygonmode = !polygonmode;
getTime;
if (polygonmode) timestampedCout("Uwaga! Tryb wireframe jest niewydajny i powinien sluzyc tylko do debugowania!");
break;