Thomas Buck 10 лет назад
Родитель
Сommit
4ba21cd02a
7 измененных файлов: 30 добавлений и 53 удалений
  1. 0
    2
      src/Console.cpp
  2. 0
    2
      src/Emitter.cpp
  3. 0
    2
      src/Game.cpp
  4. 0
    2
      src/Menu.cpp
  5. 28
    30
      src/Render.cpp
  6. 2
    13
      src/Texture.cpp
  7. 0
    2
      src/Window.cpp

+ 0
- 2
src/Console.cpp Просмотреть файл

@@ -7,10 +7,8 @@
7 7
 
8 8
 #ifdef __APPLE__
9 9
 #include <OpenGL/gl.h>
10
-#include <OpenGL/glu.h>
11 10
 #else
12 11
 #include <GL/gl.h>
13
-#include <GL/glu.h>
14 12
 #endif
15 13
 
16 14
 #include "config.h"

+ 0
- 2
src/Emitter.cpp Просмотреть файл

@@ -11,10 +11,8 @@
11 11
 
12 12
 #ifdef __APPLE__
13 13
 #include <OpenGL/gl.h>
14
-#include <OpenGL/glu.h>
15 14
 #else
16 15
 #include <GL/gl.h>
17
-#include <GL/glu.h>
18 16
 #endif
19 17
 
20 18
 #include "Emitter.h"

+ 0
- 2
src/Game.cpp Просмотреть файл

@@ -7,10 +7,8 @@
7 7
 
8 8
 #ifdef __APPLE__
9 9
 #include <OpenGL/gl.h>
10
-#include <OpenGL/glu.h>
11 10
 #else
12 11
 #include <GL/gl.h>
13
-#include <GL/glu.h>
14 12
 #endif
15 13
 
16 14
 #include <algorithm>

+ 0
- 2
src/Menu.cpp Просмотреть файл

@@ -7,10 +7,8 @@
7 7
 
8 8
 #ifdef __APPLE__
9 9
 #include <OpenGL/gl.h>
10
-#include <OpenGL/glu.h>
11 10
 #else
12 11
 #include <GL/gl.h>
13
-#include <GL/glu.h>
14 12
 #endif
15 13
 
16 14
 #include "config.h"

+ 28
- 30
src/Render.cpp Просмотреть файл

@@ -10,10 +10,8 @@
10 10
 
11 11
 #ifdef __APPLE__
12 12
 #include <OpenGL/gl.h>
13
-#include <OpenGL/glu.h>
14 13
 #else
15 14
 #include <GL/gl.h>
16
-#include <GL/glu.h>
17 15
 #endif
18 16
 
19 17
 #include <stdlib.h>
@@ -439,43 +437,44 @@ void Render::setMode(int n)
439 437
 
440 438
 // Replaced the deprecated gluLookAt with slightly modified code from here:
441 439
 // http://www.khronos.org/message_boards/showthread.php/4991
442
-void CrossProd(float x1, float y1, float z1, float x2, float y2, float z2, float res[3])
443
-{
444
-    res[0] = y1*z2 - y2*z1;
445
-    res[1] = x2*z1 - x1*z2;
446
-    res[2] = x1*y2 - x2*y1;
447
-}
448
-void deprecated_gluLookAt(float eyeX, float eyeY, float eyeZ, float lookAtX, float lookAtY, float lookAtZ, float upX, float upY, float upZ)
449
-{
440
+void gluLookAt(float eyeX, float eyeY, float eyeZ,
441
+                            float lookAtX, float lookAtY, float lookAtZ,
442
+                            float upX, float upY, float upZ) {
450 443
     float f[3];
444
+
451 445
     // calculating the viewing vector
452 446
     f[0] = lookAtX - eyeX;
453 447
     f[1] = lookAtY - eyeY;
454 448
     f[2] = lookAtZ - eyeZ;
455 449
     float fMag, upMag;
456
-    fMag = sqrtf(f[0]*f[0] + f[1]*f[1] + f[2]*f[2]);
457
-    upMag = sqrtf(upX*upX + upY*upY + upZ*upZ);
450
+    fMag = sqrtf(f[0] * f[0] + f[1] * f[1] + f[2] * f[2]);
451
+    upMag = sqrtf(upX * upX + upY * upY + upZ * upZ);
452
+
458 453
     // normalizing the viewing vector
459
-    f[0] = f[0]/fMag;
460
-    f[1] = f[1]/fMag;
461
-    f[2] = f[2]/fMag;
462
-    // normalising the up vector. no need for this here if you have your
463
-    // up vector already normalised, which is mostly the case.
464
-    upX = upX/upMag;
465
-    upY = upY/upMag;
466
-    upZ = upZ/upMag;
467
-    float s[3], u[3];
468
-    CrossProd(f[0], f[1], f[2], upX, upY, upZ, s);
469
-    CrossProd(s[0], s[1], s[2], f[0], f[1], f[2], u);
470
-    float M[]=
471
-    {
454
+    f[0] = f[0] / fMag;
455
+    f[1] = f[1] / fMag;
456
+    f[2] = f[2] / fMag;
457
+
458
+    float s[3] = {
459
+        f[1] * upZ - upY * f[2],
460
+        upX * f[2] - f[0] * upZ,
461
+        f[0] * upY - upX * f[1]
462
+    };
463
+
464
+    float u[3] = {
465
+        s[1] * f[2] - f[1] * s[2],
466
+        f[0] * s[2] - s[0] * f[2],
467
+        s[0] * f[1] - f[0] * s[1]
468
+    };
469
+
470
+    float m[16] = {
472 471
         s[0], u[0], -f[0], 0,
473 472
         s[1], u[1], -f[1], 0,
474 473
         s[2], u[2], -f[2], 0,
475
-        0, 0, 0, 1
474
+           0,    0,     0, 1
476 475
     };
477
-    glMultMatrixf(M);
478
-    glTranslatef (-eyeX, -eyeY, -eyeZ);
476
+    glMultMatrixf(m);
477
+    glTranslatef(-eyeX, -eyeY, -eyeZ);
479 478
 }
480 479
 
481 480
 void Render::Display()
@@ -566,9 +565,8 @@ void Render::Display()
566 565
     gOpenRaider->mGame->mCamera->getPosition(camPos);
567 566
     gOpenRaider->mGame->mCamera->getTarget(atPos);
568 567
     // Mongoose 2002.08.13, Quick fix to render OpenRaider upside down
569
-    // gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0, -1.0, 0.0);
570 568
 
571
-    deprecated_gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0f, -1.0f, 0.0f);
569
+    gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0f, -1.0f, 0.0f);
572 570
 
573 571
     // Update view volume for vising
574 572
     updateViewVolume();

+ 2
- 13
src/Texture.cpp Просмотреть файл

@@ -14,10 +14,8 @@
14 14
 
15 15
 #ifdef __APPLE__
16 16
 #include <OpenGL/gl.h>
17
-#include <OpenGL/glu.h>
18 17
 #else
19 18
 #include <GL/gl.h>
20
-#include <GL/glu.h>
21 19
 #endif
22 20
 
23 21
 #include "utils/tga.h"
@@ -189,14 +187,6 @@ void convertARGB32bppToRGBA32bpp(unsigned char *image,
189 187
     }
190 188
 }
191 189
 
192
-// http://mmmovania.blogspot.de/2011/01/opengl-30-and-above-deprecated-func-and.html
193
-// http://www.g-truc.net/post-0256.html
194
-GLint deprecated_gluBuild2DMipmaps(GLenum target, GLint internalFormat, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *data) {
195
-    glTexParameteri(target, GL_GENERATE_MIPMAP, GL_TRUE);
196
-    glTexImage2D(target, 0, internalFormat, width, height, 0, format, type, data);
197
-    return 0;
198
-}
199
-
200 190
 int Texture::loadBufferSlot(unsigned char *image,
201 191
         unsigned int width, unsigned int height,
202 192
         ColorMode mode, unsigned int bpp,
@@ -267,9 +257,8 @@ int Texture::loadBufferSlot(unsigned char *image,
267 257
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
268 258
                 GL_LINEAR_MIPMAP_LINEAR);
269 259
 
270
-        //gluBuild2DMipmaps(GL_TEXTURE_2D, bytes, width, height, glcMode, GL_UNSIGNED_BYTE, image);
271
-        // gluBuild2DMipmaps is deprecated. Replacement by xythobuz
272
-        deprecated_gluBuild2DMipmaps(GL_TEXTURE_2D, bytes, width, height, glcMode, GL_UNSIGNED_BYTE, image);
260
+        glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE);
261
+        glTexImage2D(GL_TEXTURE_2D, 0, bytes, width, height, 0, glcMode, GL_UNSIGNED_BYTE, image);
273 262
     } else {
274 263
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
275 264
 

+ 0
- 2
src/Window.cpp Просмотреть файл

@@ -12,10 +12,8 @@
12 12
 
13 13
 #ifdef __APPLE__
14 14
 #include <OpenGL/gl.h>
15
-#include <OpenGL/glu.h>
16 15
 #else
17 16
 #include <GL/gl.h>
18
-#include <GL/glu.h>
19 17
 #endif
20 18
 
21 19
 #include "math/math.h"

Загрузка…
Отмена
Сохранить