Browse Source

Game is singleton. Started initializing Render.

Modified Camera and Render.
Thomas Buck 11 years ago
parent
commit
23c9159d52
7 changed files with 102 additions and 192 deletions
  1. 15
    2
      include/Game.h
  2. 5
    5
      include/OpenRaider.h
  3. 0
    14
      include/Render.h
  4. 55
    7
      src/Game.cpp
  5. 12
    19
      src/OpenRaider.cpp
  6. 12
    142
      src/Render.cpp
  7. 3
    3
      src/Window.cpp

+ 15
- 2
include/Game.h View File

8
 #ifndef _GAME_H_
8
 #ifndef _GAME_H_
9
 #define _GAME_H_
9
 #define _GAME_H_
10
 
10
 
11
+#include "Camera.h"
11
 #include "global.h"
12
 #include "global.h"
13
+#include "Render.h"
12
 #include "TombRaider.h"
14
 #include "TombRaider.h"
13
 #include "World.h"
15
 #include "World.h"
14
 
16
 
18
 class Game {
20
 class Game {
19
 public:
21
 public:
20
 
22
 
21
-    // Throw exception with negative integer error code if fails
22
-    Game(const char *level);
23
+    Game();
23
 
24
 
24
     ~Game();
25
     ~Game();
25
 
26
 
27
+    int initialize();
28
+
29
+    int loadLevel(const char *level);
30
+
31
+    void destroy();
32
+
26
     void handleAction(ActionEvents action, bool isFinished);
33
     void handleAction(ActionEvents action, bool isFinished);
27
 
34
 
28
     void handleMouseMotion(int xrel, int yrel);
35
     void handleMouseMotion(int xrel, int yrel);
33
 
40
 
34
     World mWorld;
41
     World mWorld;
35
     entity_t *mLara;
42
     entity_t *mLara;
43
+    Render *mRender;
44
+    Camera *mCamera;
36
 
45
 
37
 private:
46
 private:
38
 
47
 
48
+    bool mLoaded;
39
     char *mName;
49
     char *mName;
40
     TombRaider mTombRaider;
50
     TombRaider mTombRaider;
41
 
51
 
52
+    unsigned int mTextureStart;
53
+    unsigned int mTextureLevelOffset;
54
+    unsigned int mTextureOffset;
42
 };
55
 };
43
 
56
 
44
 #endif
57
 #endif

+ 5
- 5
include/OpenRaider.h View File

67
     float mCameraRotationDeltaX;
67
     float mCameraRotationDeltaX;
68
     float mCameraRotationDeltaY;
68
     float mCameraRotationDeltaY;
69
 
69
 
70
+    char *mBaseDir;
71
+    char *mPakDir;
72
+    char *mAudioDir;
73
+    char *mDataDir;
74
+
70
 private:
75
 private:
71
 
76
 
72
     int command(const char *command, std::vector<char *> *args);
77
     int command(const char *command, std::vector<char *> *args);
88
     bool mInit;
93
     bool mInit;
89
     bool mRunning;
94
     bool mRunning;
90
 
95
 
91
-    char *mBaseDir;
92
-    char *mPakDir;
93
-    char *mAudioDir;
94
-    char *mDataDir;
95
-
96
     KeyboardButton keyBindings[ActionEventCount];
96
     KeyboardButton keyBindings[ActionEventCount];
97
 };
97
 };
98
 
98
 

+ 0
- 14
include/Render.h View File

144
     void addRoom(RenderRoom *rRoom);
144
     void addRoom(RenderRoom *rRoom);
145
 
145
 
146
     /*!
146
     /*!
147
-     * \brief Starts and sets up OpenGL target
148
-     * \param width width of window
149
-     * \param height height of window
150
-     */
151
-    void Init(int width, int height);
152
-
153
-    /*!
154
      * \brief Loads textures in a certain id slot
147
      * \brief Loads textures in a certain id slot
155
      * \param image Image to load
148
      * \param image Image to load
156
      * \param width width of image
149
      * \param width width of image
207
 
200
 
208
     void setMode(int n);
201
     void setMode(int n);
209
 
202
 
210
-    void Update(int width, int height);
211
-
212
     /*!
203
     /*!
213
      * \brief Renders a single game frame
204
      * \brief Renders a single game frame
214
      */
205
      */
218
 
209
 
219
     void ViewModel(entity_t *ent, int index);
210
     void ViewModel(entity_t *ent, int index);
220
 
211
 
221
-    void RegisterCamera(Camera *camera);
222
-
223
     void addSkeletalModel(SkeletalModel *mdl);
212
     void addSkeletalModel(SkeletalModel *mdl);
224
 
213
 
225
 private:
214
 private:
332
     void tmpRenderModelMesh(model_mesh_t *r_mesh, texture_tri_t *ttri);
321
     void tmpRenderModelMesh(model_mesh_t *r_mesh, texture_tri_t *ttri);
333
 
322
 
334
     Texture mTexture;                     //!< Texture subsystem
323
     Texture mTexture;                     //!< Texture subsystem
335
-    Camera *mCamera;                      //!< Camera subsystem
336
 
324
 
337
     std::vector<RenderRoom *> mRoomRenderList;
325
     std::vector<RenderRoom *> mRoomRenderList;
338
     std::vector<RenderRoom *> mRooms;
326
     std::vector<RenderRoom *> mRooms;
339
     std::vector<SkeletalModel *> mModels;
327
     std::vector<SkeletalModel *> mModels;
340
 
328
 
341
     unsigned int mFlags;                  //!< Rendering flags
329
     unsigned int mFlags;                  //!< Rendering flags
342
-    unsigned int mWidth;                  //!< Viewport width
343
-    unsigned int mHeight;                 //!< Viewport height
344
     unsigned int mMode;                   //!< Rendering mode
330
     unsigned int mMode;                   //!< Rendering mode
345
     unsigned int *mNumTexturesLoaded;
331
     unsigned int *mNumTexturesLoaded;
346
     unsigned int *mNextTextureId;
332
     unsigned int *mNextTextureId;

+ 55
- 7
src/Game.cpp View File

18
 #include "Game.h"
18
 #include "Game.h"
19
 #include "utils/strings.h"
19
 #include "utils/strings.h"
20
 
20
 
21
+Game::Game() {
22
+    mLoaded = false;
23
+    mName = NULL;
24
+    mLara = NULL;
25
+
26
+    mTextureStart = 0;
27
+    mTextureLevelOffset = 0;
28
+    mTextureOffset = 0;
29
+
30
+    mCamera = NULL;
31
+    mRender = NULL;
32
+}
33
+
34
+Game::~Game() {
35
+    destroy();
36
+
37
+    if (mRender)
38
+        delete mRender;
39
+
40
+    if (mCamera)
41
+        delete mCamera;
42
+}
43
+
44
+int Game::initialize() {
45
+    mCamera = new Camera();
46
+    // TODO setup Camera
47
+
48
+    mRender = new Render();
49
+    mRender->initTextures(gOpenRaider->mDataDir, &mTextureStart, &mTextureLevelOffset);
50
+
51
+    return 0;
52
+}
53
+
21
 void percentCallbackTrampoline(int percent, void *data) {
54
 void percentCallbackTrampoline(int percent, void *data) {
22
     Game *self = static_cast<Game *>(data);
55
     Game *self = static_cast<Game *>(data);
23
     self->percentCallback(percent);
56
     self->percentCallback(percent);
27
 
60
 
28
 }
61
 }
29
 
62
 
30
-// Throw exception with negative integer error code if fails
31
-Game::Game(const char *level) {
32
-    mLara = NULL;
63
+int Game::loadLevel(const char *level) {
64
+    destroy();
33
 
65
 
34
     mName = bufferString("%s", level);
66
     mName = bufferString("%s", level);
35
 
67
 
37
     gOpenRaider->mConsole->print("Loading %s", mName);
69
     gOpenRaider->mConsole->print("Loading %s", mName);
38
     int error = mTombRaider.Load(mName, percentCallbackTrampoline, this);
70
     int error = mTombRaider.Load(mName, percentCallbackTrampoline, this);
39
     if (error != 0) {
71
     if (error != 0) {
40
-        throw error;
72
+        return error;
41
     }
73
     }
42
 
74
 
43
     // If required, load the external sound effect file MAIN.SFX into TombRaider
75
     // If required, load the external sound effect file MAIN.SFX into TombRaider
58
         }
90
         }
59
         delete [] tmp;
91
         delete [] tmp;
60
     }
92
     }
93
+
94
+    mLoaded = true;
95
+    //mRender->setMode(Render::modeTexture);
96
+    // TODO enable Renderer
97
+    return 0;
61
 }
98
 }
62
 
99
 
63
-Game::~Game() {
100
+void Game::destroy() {
64
     if (mName)
101
     if (mName)
65
         delete [] mName;
102
         delete [] mName;
103
+
104
+    mLoaded = false;
105
+    mRender->setMode(Render::modeDisabled);
66
 }
106
 }
67
 
107
 
68
 void Game::handleAction(ActionEvents action, bool isFinished) {
108
 void Game::handleAction(ActionEvents action, bool isFinished) {
109
+    if (mLoaded) {
69
 
110
 
111
+    }
70
 }
112
 }
71
 
113
 
72
 void Game::handleMouseMotion(int xrel, int yrel) {
114
 void Game::handleMouseMotion(int xrel, int yrel) {
115
+    if (mLoaded) {
73
 
116
 
117
+    }
74
 }
118
 }
75
 
119
 
76
 void Game::display() {
120
 void Game::display() {
77
-    glClearColor(0.00f, 0.70f, 0.00f, 1.0f);
78
-    glClear(GL_COLOR_BUFFER_BIT);
121
+    if (mLoaded) {
122
+        //glClearColor(0.00f, 0.70f, 0.00f, 1.0f);
123
+        //glClear(GL_COLOR_BUFFER_BIT);
124
+
125
+        mRender->Display();
126
+    }
79
 }
127
 }
80
 
128
 

+ 12
- 19
src/OpenRaider.cpp View File

39
     mConsole = new Console();
39
     mConsole = new Console();
40
     mSound = new Sound();
40
     mSound = new Sound();
41
     mWindow = new WindowSDL();
41
     mWindow = new WindowSDL();
42
-    mGame = NULL;
42
+    mGame = new Game();
43
 
43
 
44
     for (int i = 0; i < ActionEventCount; i++)
44
     for (int i = 0; i < ActionEventCount; i++)
45
         keyBindings[i] = unknown;
45
         keyBindings[i] = unknown;
179
             return -4;
179
             return -4;
180
         }
180
         }
181
     } else if (strcmp(command, "load") == 0) {
181
     } else if (strcmp(command, "load") == 0) {
182
-        if (mGame)
183
-            delete mGame;
184
         char *tmp = bufferString("%s/%s", mPakDir, args->at(0));
182
         char *tmp = bufferString("%s/%s", mPakDir, args->at(0));
185
-        try {
186
-            mGame = new Game(tmp);
187
-            delete [] tmp;
188
-            return 0;
189
-        } catch (int error) {
190
-            delete [] tmp;
191
-            return error;
192
-        }
183
+        int error = mGame->loadLevel(tmp);
184
+        delete [] tmp;
185
+        return error;
193
     } else {
186
     } else {
194
         mConsole->print("Unknown command: %s ", command);
187
         mConsole->print("Unknown command: %s ", command);
195
         return -1;
188
         return -1;
605
     if (mSound->initialize() != 0)
598
     if (mSound->initialize() != 0)
606
         return -4;
599
         return -4;
607
 
600
 
601
+    // Initialize game engine
602
+    if (mGame->initialize() != 0)
603
+        return -5;
604
+
608
     mMenu->setVisible(true);
605
     mMenu->setVisible(true);
609
 
606
 
610
     mInit = true;
607
     mInit = true;
628
         glClear(GL_COLOR_BUFFER_BIT);
625
         glClear(GL_COLOR_BUFFER_BIT);
629
 
626
 
630
         // Draw game scene
627
         // Draw game scene
631
-        if (mGame)
632
-            mGame->display();
628
+        mGame->display();
633
 
629
 
634
         // Draw 2D overlays (console and menu)
630
         // Draw 2D overlays (console and menu)
635
         mWindow->glEnter2D();
631
         mWindow->glEnter2D();
662
         } else if (!mConsole->isVisible()) {
658
         } else if (!mConsole->isVisible()) {
663
             for (int i = forwardAction; i < ActionEventCount; i++) {
659
             for (int i = forwardAction; i < ActionEventCount; i++) {
664
                 if (keyBindings[i] == key) {
660
                 if (keyBindings[i] == key) {
665
-                    if (mGame)
666
-                        mGame->handleAction((ActionEvents)i, pressed);
661
+                    mGame->handleAction((ActionEvents)i, pressed);
667
                 }
662
                 }
668
             }
663
             }
669
         } else {
664
         } else {
686
     } else if (!mConsole->isVisible()) {
681
     } else if (!mConsole->isVisible()) {
687
         for (int i = forwardAction; i < ActionEventCount; i++) {
682
         for (int i = forwardAction; i < ActionEventCount; i++) {
688
             if (keyBindings[i] == button) {
683
             if (keyBindings[i] == button) {
689
-                if (mGame)
690
-                    mGame->handleAction((ActionEvents)i, !released);
684
+                mGame->handleAction((ActionEvents)i, !released);
691
             }
685
             }
692
         }
686
         }
693
     }
687
     }
695
 
689
 
696
 void OpenRaider::handleMouseMotion(int xrel, int yrel) {
690
 void OpenRaider::handleMouseMotion(int xrel, int yrel) {
697
     if ((!mConsole->isVisible()) && (!mMenu->isVisible())) {
691
     if ((!mConsole->isVisible()) && (!mMenu->isVisible())) {
698
-        if (mGame)
699
-            mGame->handleMouseMotion(xrel, yrel);
692
+        mGame->handleMouseMotion(xrel, yrel);
700
     }
693
     }
701
 }
694
 }
702
 
695
 

+ 12
- 142
src/Render.cpp View File

127
 #ifdef USING_EMITTER
127
 #ifdef USING_EMITTER
128
     mEmitter = 0x0;
128
     mEmitter = 0x0;
129
 #endif
129
 #endif
130
-    mCamera = 0x0;
131
     mSkyMesh = -1;
130
     mSkyMesh = -1;
132
     mSkyMeshRotation = false;
131
     mSkyMeshRotation = false;
133
     mMode = Render::modeDisabled;
132
     mMode = Render::modeDisabled;
138
 
137
 
139
     mNextTextureId = NULL;
138
     mNextTextureId = NULL;
140
     mNumTexturesLoaded = NULL;
139
     mNumTexturesLoaded = NULL;
141
-
142
-    mWidth = 640;
143
-    mHeight = 480;
144
 }
140
 }
145
 
141
 
146
 
142
 
156
 
152
 
157
 void Render::screenShot(char *filenameBase)
153
 void Render::screenShot(char *filenameBase)
158
 {
154
 {
159
-    mTexture.glScreenShot(filenameBase, mWidth, mHeight);
155
+    mTexture.glScreenShot(filenameBase, gOpenRaider->mWindow->mWidth, gOpenRaider->mWindow->mHeight);
160
 }
156
 }
161
 
157
 
162
 
158
 
213
         ++numTextures;
209
         ++numTextures;
214
     }
210
     }
215
 
211
 
216
-    snprintf(filename, 126, "%s%s", textureDir, "splash.tga");
212
+    snprintf(filename, 126, "%s/%s", textureDir, "splash.tga");
217
     filename[127] = 0;
213
     filename[127] = 0;
218
 
214
 
219
     if ((bg_id = mTexture.loadTGA(filename)) > -1)
215
     if ((bg_id = mTexture.loadTGA(filename)) > -1)
221
         ++numTextures;
217
         ++numTextures;
222
     }
218
     }
223
 
219
 
224
-    snprintf(filename, 126, "%s%s", textureDir, "snow.tga");
220
+    snprintf(filename, 126, "%s/%s", textureDir, "snow.tga");
225
     filename[127] = 0;
221
     filename[127] = 0;
226
 
222
 
227
     if ((snow1_id = mTexture.loadTGA(filename)) > -1)
223
     if ((snow1_id = mTexture.loadTGA(filename)) > -1)
229
         ++numTextures;
225
         ++numTextures;
230
     }
226
     }
231
 
227
 
232
-    snprintf(filename, 126, "%s%s", textureDir, "snow2.tga");
228
+    snprintf(filename, 126, "%s/%s", textureDir, "snow2.tga");
233
     filename[127] = 0;
229
     filename[127] = 0;
234
 
230
 
235
     if ((snow2_id = mTexture.loadTGA(filename)) > -1)
231
     if ((snow2_id = mTexture.loadTGA(filename)) > -1)
348
 }
344
 }
349
 
345
 
350
 
346
 
351
-void Render::Init(int width, int height)
352
-{
353
-    char *s;
354
-
355
-    mWidth = width;
356
-    mHeight = height;
357
-
358
-    // Print driver support information
359
-    printf("GL Vendor   : %s\n", glGetString(GL_VENDOR));
360
-    printf("GL Renderer : %s\n", glGetString(GL_RENDERER));
361
-    printf("GL Version  : %s\n", glGetString(GL_VERSION));
362
-    //printf("Extensions : %s\n\n\n", (char*)glGetString(GL_EXTENSIONS));
363
-
364
-    // Testing for goodies
365
-    // Mongoose 2001.12.31, Fixed string use to check for bad strings
366
-    s = (char*)glGetString(GL_EXTENSIONS);
367
-
368
-    if (s && s[0])
369
-    {
370
-        //printf("\tGL_ARB_multitexture       \t\t");
371
-
372
-        if (strstr(s, "GL_ARB_multitexture"))
373
-        {
374
-            mFlags |= Render::fMultiTexture;
375
-            //printf("YES\n");
376
-        }
377
-        /*
378
-        else
379
-        {
380
-            printf("NO\n");
381
-        }
382
-
383
-        printf("\tGL_EXT_texture_env_combine\t\t");
384
-
385
-        if (strstr(s, "GL_EXT_texture_env_combine"))
386
-        {
387
-            printf("YES\n");
388
-        }
389
-        else
390
-        {
391
-            printf("NO\n");
392
-        }
393
-        */
394
-    }
395
-
396
-    // Set up Z buffer
397
-    glEnable(GL_DEPTH_TEST);
398
-    glDepthFunc(GL_LESS);
399
-
400
-    // Set up culling
401
-    glEnable(GL_CULL_FACE);
402
-    glFrontFace(GL_CW);
403
-    //glFrontFace(GL_CCW);
404
-    //glCullFace(GL_FRONT);
405
-
406
-    // Set background to black
407
-    glClearColor(BLACK[0], BLACK[1], BLACK[2], BLACK[3]);
408
-
409
-    // Disable lighting
410
-    glDisable(GL_LIGHTING);
411
-
412
-    // Set up alpha blending
413
-    glEnable(GL_BLEND);
414
-    glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
415
-
416
-    //glEnable(GL_ALPHA_TEST); // Disable per pixel alpha blending
417
-    glAlphaFunc(GL_GREATER, 0);
418
-
419
-    glPointSize(5.0);
420
-
421
-    // Setup shading
422
-    glShadeModel(GL_SMOOTH);
423
-
424
-    glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
425
-    glHint(GL_FOG_HINT, GL_NICEST);
426
-    glEnable(GL_COLOR_MATERIAL);
427
-    glEnable(GL_DITHER);
428
-
429
-    // AA polygon edges
430
-    glEnable(GL_POLYGON_SMOOTH);
431
-    glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST);
432
-
433
-    glDisable(GL_LINE_SMOOTH);
434
-    glDisable(GL_POINT_SMOOTH);
435
-    glDisable(GL_AUTO_NORMAL);
436
-    glDisable(GL_LOGIC_OP);
437
-    glDisable(GL_TEXTURE_1D);
438
-    glDisable(GL_STENCIL_TEST);
439
-    glDisable(GL_FOG);
440
-
441
-    glDisable(GL_NORMALIZE);
442
-
443
-    glEnableClientState(GL_VERTEX_ARRAY);
444
-    glDisableClientState(GL_EDGE_FLAG_ARRAY);
445
-    glDisableClientState(GL_COLOR_ARRAY);
446
-    glDisableClientState(GL_NORMAL_ARRAY);
447
-
448
-    glPolygonMode(GL_FRONT, GL_FILL);
449
-
450
-    glMatrixMode(GL_MODELVIEW);
451
-}
452
-
453
-
454
 void setLighting(bool on)
347
 void setLighting(bool on)
455
 {
348
 {
456
     if (on)
349
     if (on)
548
 }
441
 }
549
 
442
 
550
 
443
 
551
-void Render::Update(int width, int height)
552
-{
553
-    mWidth = width;
554
-    mHeight = height;
555
-}
556
-
557
-
558
 int Render::getMode()
444
 int Render::getMode()
559
 {
445
 {
560
     return mMode;
446
     return mMode;
638
     gl_test_reset();
524
     gl_test_reset();
639
 #endif
525
 #endif
640
 
526
 
641
-    // Assertion: Rendering is disabled without texture or camera
642
-    if (!mCamera)
643
-    {
644
-        fprintf(stderr, "Render::Display> ERROR: No camera is registered\n");
645
-        return;
646
-    }
647
-
648
     switch (mMode)
527
     switch (mMode)
649
     {
528
     {
650
         case Render::modeDisabled:
529
         case Render::modeDisabled:
705
             camPos[2] = curPos[2] + (64.0f * cosf(yaw));
584
             camPos[2] = curPos[2] + (64.0f * cosf(yaw));
706
         }
585
         }
707
 
586
 
708
-        mCamera->setPosition(camPos);
587
+        gOpenRaider->mGame->mCamera->setPosition(camPos);
709
     }
588
     }
710
 
589
 
711
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
590
     glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
712
     glLoadIdentity();
591
     glLoadIdentity();
713
 
592
 
714
     // Setup view in OpenGL with camera
593
     // Setup view in OpenGL with camera
715
-    mCamera->update();
716
-    mCamera->getPosition(camPos);
717
-    mCamera->getTarget(atPos);
594
+    gOpenRaider->mGame->mCamera->update();
595
+    gOpenRaider->mGame->mCamera->getPosition(camPos);
596
+    gOpenRaider->mGame->mCamera->getTarget(atPos);
718
     // Mongoose 2002.08.13, Quick fix to render OpenRaider upside down
597
     // Mongoose 2002.08.13, Quick fix to render OpenRaider upside down
719
     // gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0, -1.0, 0.0);
598
     // gluLookAt(camPos[0], camPos[1], camPos[2], atPos[0], atPos[1], atPos[2], 0.0, -1.0, 0.0);
720
 
599
 
1107
         glPushMatrix();
986
         glPushMatrix();
1108
 
987
 
1109
 #ifdef USING_FPS_CAMERA
988
 #ifdef USING_FPS_CAMERA
1110
-        mCamera->getPosition(curPos);
989
+        gOpenRaider->mGame->mCamera->getPosition(curPos);
1111
         glTranslated(curPos[0], curPos[1], curPos[2]);
990
         glTranslated(curPos[0], curPos[1], curPos[2]);
1112
-        glRotated(mCamera->getYaw(), 0, 1, 0);
991
+        glRotated(gOpenRaider->mGame->mCamera->getYaw(), 0, 1, 0);
1113
         glTranslated(0, 500, 1200);
992
         glTranslated(0, 500, 1200);
1114
 #else
993
 #else
1115
         glTranslated(LARA->pos[0], LARA->pos[1], LARA->pos[2]);
994
         glTranslated(LARA->pos[0], LARA->pos[1], LARA->pos[2]);
1116
-        glRotated(mCamera->getYaw(), 0, 1, 0);
995
+        glRotated(gOpenRaider->mGame->mCamera->getYaw(), 0, 1, 0);
1117
 #endif
996
 #endif
1118
 
997
 
1119
         drawModel(static_cast<SkeletalModel *>(LARA->tmpHook));
998
         drawModel(static_cast<SkeletalModel *>(LARA->tmpHook));
1638
     glTranslated(sprite->pos[0], sprite->pos[1], sprite->pos[2]);
1517
     glTranslated(sprite->pos[0], sprite->pos[1], sprite->pos[2]);
1639
 
1518
 
1640
     // Sprites must always face camera, because they have no depth  =)
1519
     // Sprites must always face camera, because they have no depth  =)
1641
-    glRotated(mCamera->getYaw(), 0, 1, 0);
1520
+    glRotated(gOpenRaider->mGame->mCamera->getYaw(), 0, 1, 0);
1642
 
1521
 
1643
     switch (mMode)
1522
     switch (mMode)
1644
     {
1523
     {
1956
 }
1835
 }
1957
 
1836
 
1958
 
1837
 
1959
-void Render::RegisterCamera(Camera *camera)
1960
-{
1961
-    if (camera)
1962
-    {
1963
-        mCamera = camera;
1964
-    }
1965
-}
1966
-
1967
-
1968
 void Render::addSkeletalModel(SkeletalModel *mdl)
1838
 void Render::addSkeletalModel(SkeletalModel *mdl)
1969
 {
1839
 {
1970
     mModels.push_back(mdl);
1840
     mModels.push_back(mdl);

+ 3
- 3
src/Window.cpp View File

98
 }
98
 }
99
 
99
 
100
 void Window::resizeGL() {
100
 void Window::resizeGL() {
101
-    float fovY = 45.0f;
102
-    float clipNear = 4.0f;
103
-    float clipFar = 4000.0f;
101
+    float fovY = 40.0f; // 45.0f
102
+    float clipNear = 10.0f; // 4.0f
103
+    float clipFar = 600000.0f; // 4000.0f
104
 
104
 
105
     glViewport(0, 0, mWidth, mHeight);
105
     glViewport(0, 0, mWidth, mHeight);
106
     glMatrixMode(GL_PROJECTION);
106
     glMatrixMode(GL_PROJECTION);

Loading…
Cancel
Save