소스 검색

Renamed OpenGLMesh to Mesh.

Documented OpenRaider, removed unused stuff.
Thomas Buck 10 년 전
부모
커밋
c0dcf2d54a
10개의 변경된 파일337개의 추가작업 그리고 681개의 파일을 삭제
  1. 4
    0
      ChangeLog
  2. 1
    1
      Makefile
  3. 3
    3
      include/Matrix.h
  4. 14
    16
      include/Mesh.h
  5. 152
    396
      include/OpenRaider.h
  6. 38
    53
      include/Render.h
  7. 74
    140
      src/Matrix.cpp
  8. 43
    43
      src/Mesh.cpp
  9. 5
    26
      src/OpenRaider.cpp
  10. 3
    3
      src/Render.cpp

+ 4
- 0
ChangeLog 파일 보기

@@ -5,6 +5,10 @@
5 5
 
6 6
  OpenRaider (0.1.2) xythobuz <xythobuz@xythobuz.de>
7 7
 
8
+	[ 20140209 ]
9
+	* Renamed OpenGLMesh to Mesh
10
+	* Removed unused flags, enums, ...
11
+
8 12
 	[ 20140202 ]
9 13
 	* Fixed more cppcheck warnings
10 14
 	* Removed unnecessary defines (USING_xxx)

+ 1
- 1
Makefile 파일 보기

@@ -180,8 +180,8 @@ OBJS = \
180 180
 	$(BUILDDIR)/GLString.o \
181 181
 	$(BUILDDIR)/MatMath.o \
182 182
 	$(BUILDDIR)/Matrix.o \
183
+	$(BUILDDIR)/Mesh.o \
183 184
 	$(BUILDDIR)/Network.o \
184
-	$(BUILDDIR)/OpenGLMesh.o \
185 185
 	$(BUILDDIR)/OpenRaider.o \
186 186
 	$(BUILDDIR)/Particle.o \
187 187
 	$(BUILDDIR)/Quaternion.o \

+ 3
- 3
include/Matrix.h 파일 보기

@@ -83,7 +83,7 @@ public:
83 83
      * \param b second matrix
84 84
      * \returns resultant matrix
85 85
      */
86
-    Matrix multiply(const Matrix &a, const Matrix &b);
86
+    static Matrix multiply(const Matrix &a, const Matrix &b);
87 87
 
88 88
     /*!
89 89
      * \brief Multiplies v vector and this matrix
@@ -192,7 +192,7 @@ private:
192 192
      * \param source source
193 193
      * \param dest destination
194 194
      */
195
-    void copy(matrix_t source, matrix_t dest);
195
+    static void copy(matrix_t source, matrix_t dest);
196 196
 
197 197
     /*!
198 198
      * \brief Multiplies matrices a and b. Neither a or b is also the result.
@@ -200,7 +200,7 @@ private:
200 200
      * \param b second matrix
201 201
      * \param result wil be set to resultant matrix value
202 202
      */
203
-    void multiply(const matrix_t a, const matrix_t b, matrix_t result);
203
+    static void multiply(const matrix_t a, const matrix_t b, matrix_t result);
204 204
 };
205 205
 
206 206
 #endif

include/OpenGLMesh.h → include/Mesh.h 파일 보기

@@ -1,5 +1,5 @@
1 1
 /*!
2
- * \file include/OpenGLMesh.h
2
+ * \file include/Mesh.h
3 3
  * \brief OpenGL Mesh
4 4
  *
5 5
  * \author Mongoose
@@ -15,21 +15,19 @@
15 15
 /*!
16 16
  * \brief OpenGL Mesh
17 17
  */
18
-class OpenGLMesh {
18
+class Mesh {
19 19
 public:
20 20
 
21 21
     typedef enum {
22
-        OpenGLMeshModeSolid          = 0,
23
-        OpenGLMeshModeWireframe      = 1,
24
-        OpenGLMeshModeTexture        = 2,
25
-        OpenGLMeshModeMultiTexture   = 3
26
-    } OpenGLMeshMode;
22
+        MeshModeSolid,
23
+        MeshModeWireframe,
24
+        MeshModeTexture,
25
+        MeshModeMultiTexture
26
+    } MeshMode;
27 27
 
28 28
     typedef enum {
29
-        fOpenGLMesh_Transparent      = 1,
30
-        fOpenGLMesh_BumpMap          = 2,
31
-        fOpenGLMesh_UseVertexArray   = 4
32
-    } OpenGLMeshFlags;
29
+        fMesh_UseVertexArray = (1 << 0)
30
+    } MeshFlags;
33 31
 
34 32
     typedef struct tris_s {
35 33
         int texture;
@@ -82,14 +80,14 @@ public:
82 80
     } rect_t;
83 81
 
84 82
     /*!
85
-     * \brief Constructs an object of OpenGLMesh
83
+     * \brief Constructs an object of Mesh
86 84
      */
87
-    OpenGLMesh();
85
+    Mesh();
88 86
 
89 87
     /*!
90
-     * \brief Deconstructs an object of OpenGLMesh
88
+     * \brief Deconstructs an object of Mesh
91 89
      */
92
-    ~OpenGLMesh();
90
+    ~Mesh();
93 91
 
94 92
     void drawAlpha();
95 93
 
@@ -140,7 +138,7 @@ public:
140 138
 
141 139
     unsigned int mFlags;
142 140
 
143
-    OpenGLMeshMode mMode;
141
+    MeshMode mMode;
144 142
 
145 143
     unsigned int mNumVertices;
146 144
     vec3_t *mVertices; //!< XYZ

+ 152
- 396
include/OpenRaider.h 파일 보기

@@ -1,32 +1,13 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file include/OpenRaider.h
3
+ * \brief Main Game Singleton
3 4
  *
4
- * Project : OpenRaider
5
- * Author  : Mongoose
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : OpenRaider
9
- * License : No use w/o permission (C) 2001 Mongoose
10
- * Comments: This is the main class for OpenRaider
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History ------------------------------------------------
17
- *
18
- * 2002.08.24:
19
- * Mongoose - Finally made into Singleton
20
- *
21
- * 2001.05.21:
22
- * Mongoose - Created
23
- ================================================================*/
24
-
5
+ * \author Mongoose
6
+ */
25 7
 
26 8
 #ifndef _OPENRAIDER_H_
27 9
 #define _OPENRAIDER_H_
28 10
 
29
-
30 11
 #include <List.h>
31 12
 #include <Map.h>
32 13
 #include <Vector.h>
@@ -38,434 +19,209 @@
38 19
 #include <Network.h>
39 20
 #include <World.h>
40 21
 
41
-
42
-typedef enum
43
-{
44
-    OpenRaiderKey_console = 1, // Reserved 0 event for console in System
45
-    OpenRaiderKey_attack,
46
-    OpenRaiderKey_forward,
47
-    OpenRaiderKey_left,
48
-    OpenRaiderKey_right,
49
-    OpenRaiderKey_backward,
50
-    OpenRaiderKey_jump,
51
-    OpenRaiderKey_tiltUp,
52
-    OpenRaiderKey_tiltDown,
53
-    OpenRaiderKey_panLeft,
54
-    OpenRaiderKey_panRight,
55
-    OpenRaiderKey_crouch
56
-
22
+/*!
23
+ * \brief OpenRaider key events.
24
+ *
25
+ * 0 event reserved for console in System.
26
+ */
27
+typedef enum {
28
+    OpenRaiderKey_console = 1, //!< Toggle console
29
+    OpenRaiderKey_attack,      //!< Attack
30
+    OpenRaiderKey_forward,     //!< Move forward
31
+    OpenRaiderKey_left,        //!< Move left
32
+    OpenRaiderKey_right,       //!< Move right
33
+    OpenRaiderKey_backward,    //!< Move backward
34
+    OpenRaiderKey_jump,        //!< Jump
35
+    OpenRaiderKey_tiltUp,      //!< Tilt camera up
36
+    OpenRaiderKey_tiltDown,    //!< Tilt camera down
37
+    OpenRaiderKey_panLeft,     //!< Pan camera left
38
+    OpenRaiderKey_panRight,    //!< Pan camera right
39
+    OpenRaiderKey_crouch       //!< Crouch
57 40
 } OpenRaider_KeyEvent;
58 41
 
59
-
60
-typedef enum
61
-{
62
-    OpenRaider_ShowFPS      =   1,
63
-    OpenRaider_DebugMap     =   2,
64
-    OpenRaider_DebugModel   =   4,
65
-    OpenRaider_EnableSound  =   8,
66
-    OpenRaider_DumpTexture  =  16,
67
-    OpenRaider_FullScreen   =  32,
68
-    OpenRaider_Loading      =  64,
69
-    OpenRaider_GameRunning  = 128
70
-
71
-} OpenRaiderFlags;
72
-
73
-typedef enum
74
-{
75
-    OpenRaiderSound_Ambient = 1
76
-
77
-} OpenRaider_SoundEventType;
78
-
79
-
80
-class OpenRaider : public SDLSystem
81
-{
82
- public:
83
-
84
-    ////////////////////////////////////////////////////////////
85
-    // Constructors ( Singleton )
86
-    ////////////////////////////////////////////////////////////
87
-
42
+typedef enum {
43
+    OpenRaider_ShowFPS     = (1 << 0),
44
+    OpenRaider_DebugMap    = (1 << 1),
45
+    OpenRaider_DebugModel  = (1 << 2),
46
+    OpenRaider_EnableSound = (1 << 3),
47
+    OpenRaider_DumpTexture = (1 << 4),
48
+    OpenRaider_FullScreen  = (1 << 5),
49
+    OpenRaider_Loading     = (1 << 6)
50
+} OpenRaider_Flags;
51
+
52
+/*!
53
+ * \brief Main Game Singleton
54
+ */
55
+class OpenRaider : public SDLSystem {
56
+public:
57
+
58
+    /*!
59
+     * \brief Constructs or returns the OpenRaider Singleton
60
+     * \returns OpenRaider Singleton
61
+     */
88 62
     static OpenRaider *Instance();
89
-    /*------------------------------------------------------
90
-     * Pre  :
91
-     * Post : Constructs the object of OpenRaider or
92
-     *        returns pointer to it if previously allocated
93
-     *
94
-     *-- History ------------------------------------------
95
-     *
96
-     * 2001.08.24:
97
-     * Mongoose - Created
98
-     ------------------------------------------------------*/
99 63
 
64
+    /*!
65
+     * \brief Deconstructs an object of OpenRaider
66
+     */
100 67
     ~OpenRaider();
101
-    /*------------------------------------------------------
102
-     * Pre  : OpenRaider object is allocated
103
-     * Post : Deconstructs an object of OpenRaider
104
-     *
105
-     *-- History ------------------------------------------
106
-     *
107
-     * 2001.05.21:
108
-     * Mongoose - Created
109
-     ------------------------------------------------------*/
110
-
111
-
112
-    ////////////////////////////////////////////////////////////
113
-    // Public Accessors
114
-    ////////////////////////////////////////////////////////////
115
-
116
-
117
-    ////////////////////////////////////////////////////////////
118
-    // Public Mutators
119
-    ////////////////////////////////////////////////////////////
120 68
 
69
+    /*!
70
+     * \brief Initialize the Game
71
+     */
121 72
     void start();
122
-    /*------------------------------------------------------
123
-     * Pre  :
124
-     * Post : Init the Game
125
-     *
126
-     *-- History ------------------------------------------
127
-     *
128
-     * 2001.05.21:
129
-     * Mongoose - Created
130
-     ------------------------------------------------------*/
131 73
 
74
+    /*!
75
+     * \brief Mouse motion input
76
+     * \param x relative x motion
77
+     * \param y relative y motion
78
+     */
132 79
     void handleMouseMotionEvent(float x, float y);
133
-    /*------------------------------------------------------
134
-     * Pre  :
135
-     * Post : Mouse motion input used
136
-     *
137
-     *-- History ------------------------------------------
138
-     *
139
-     * 2001.06.04:
140
-     * Mongoose - Created
141
-     ------------------------------------------------------*/
142 80
 
81
+    /*!
82
+     * \brief Receives `Event` bound to `Cmd` from `Key` press
83
+     * \param key valid keyboard code
84
+     */
143 85
     void handleBoundKeyPressEvent(unsigned int key);
144
-    /*------------------------------------------------------
145
-     * Pre  : <Key> is a valid keyboard code
146
-     *
147
-     * Post : Recieves <Event> bound to <Cmd> from <Key> press
148
-     *
149
-     *-- History ------------------------------------------
150
-     *
151
-     * 2003.06.03:
152
-     * Mongoose - Created
153
-     ------------------------------------------------------*/
154 86
 
87
+    /*!
88
+     * \brief Receives `Event` bound to `Cmd` from `Key` release
89
+     * \param key valid keyboard code
90
+     */
155 91
     void handleBoundKeyReleaseEvent(unsigned int key);
156
-    /*------------------------------------------------------
157
-     * Pre  : <Key> is a valid keyboard code
158
-     *
159
-     * Post : Recieves <Event> bound to <Cmd> from <Key> release
160
-     *
161
-     *-- History ------------------------------------------
162
-     *
163
-     * 2003.06.03:
164
-     * Mongoose - Created
165
-     ------------------------------------------------------*/
166
-
167
-     void handleCommand(char *command, unsigned int mode);
168
-    /*------------------------------------------------------
169
-     * Pre  : <Command> is valid keyword optionally followed
170
-     *        by ' ' (space) seperated and argument(s)
171
-     *
172
-     *        <Mode> is the current type or resource mode
173
-     *
174
-     * Post : Executes valid command based on keyword
175
-     *
176
-     *-- History ------------------------------------------
177
-     *
178
-     * 2002.03.23:
179
-     * Mongoose - Created
180
-     ------------------------------------------------------*/
181
-
182
-     void handleConsoleKeyPressEvent(unsigned int key, unsigned int mod);
183
-    /*------------------------------------------------------
184
-     * Pre  : <Key> is a valid keyboard code
185
-     *
186
-     * Post : Recieves <Key> code from text input in console mode
187
-     *
188
-     *-- History ------------------------------------------
189
-     *
190
-     * 2003.06.03:
191
-     * Mongoose - Created
192
-     ------------------------------------------------------*/
193 92
 
93
+    /*!
94
+     * \brief Executes valid command based on keyword
95
+     * \param command valid keyword optionally followed by space separated arguments
96
+     * \param mode current type or resource mode
97
+     */
98
+    void handleCommand(char *command, unsigned int mode);
99
+
100
+    /*!
101
+     * \brief Receives `Key` code from text input in console mode
102
+     * \param key valid keyboard code
103
+     * \param mod valid modifier code
104
+     */
105
+    void handleConsoleKeyPressEvent(unsigned int key, unsigned int mod);
106
+
107
+    /*!
108
+     * \brief Executes command associated with key press, if any
109
+     * \param key valid keyboard code
110
+     * \param mod valid modifier code
111
+     */
194 112
     void handleKeyPressEvent(unsigned int key, unsigned int mod);
113
+
114
+    /*!
115
+     * \brief Executes command associated with key release, if any
116
+     * \param key valid keyboard code
117
+     * \param mod valid modifier code
118
+     */
195 119
     void handleKeyReleaseEvent(unsigned int key, unsigned int mod);
196
-    /*------------------------------------------------------
197
-     * Pre  : key and mod are valid key command
198
-     * Post : executes command acc with key, if any
199
-     *
200
-     *-- History ------------------------------------------
201
-     *
202
-     * 2001.05.27:
203
-     * Mongoose - Created
204
-     ------------------------------------------------------*/
205 120
 
206 121
     void initGL();
207
-    /*------------------------------------------------------
208
-     * Pre  :
209
-     * Post :
210
-     *
211
-     *-- History ------------------------------------------
212
-     *
213
-     * 2002.08.13:
214
-     * Mongoose - Created
215
-     ------------------------------------------------------*/
216 122
 
123
+    /*!
124
+     * \brief Pass a time frame and render a new frame
125
+     */
217 126
     void gameFrame();
218
-    /*------------------------------------------------------
219
-     * Pre  :
220
-     * Post : One game physics/time frame passes
221
-     *        Also renders one frame per call
222
-     *
223
-     *-- History ------------------------------------------
224
-     *
225
-     * 2001.05.21:
226
-     * Mongoose - Created
227
-     ------------------------------------------------------*/
228 127
 
128
+    /*!
129
+     * \brief Outputs message in game console
130
+     * \param dump_stdout if true, also print to stdout
131
+     * \param format printf() style format string
132
+     */
229 133
     void print(bool dump_stdout, const char *format, ...);
230
-    /*------------------------------------------------------
231
-     * Pre  : Use like printf
232
-     *
233
-     * Post : Outputs message in game console
234
-     *
235
-     *        If dump_stdout is true, print to stdout also
236
-     *
237
-     *-- History ------------------------------------------
238
-     *
239
-     * 2002.08.13:
240
-     * Mongoose - Created
241
-     ------------------------------------------------------*/
242 134
 
135
+protected:
243 136
 
244
- protected:
245
-
246
-    ////////////////////////////////////////////////////////////
247
-    // Constructors ( Singleton )
248
-    ////////////////////////////////////////////////////////////
249
-
137
+    /*!
138
+     * \brief Constructs an object of OpenRaider
139
+     */
250 140
     OpenRaider();
251
-    /*------------------------------------------------------
252
-     * Pre  :
253
-     * Post : Constructs an object of OpenRaider
254
-     *
255
-     *-- History ------------------------------------------
256
-     *
257
-     * 2001.05.21:
258
-     * Mongoose - Created
259
-     ------------------------------------------------------*/
260
-
261
-
262
- private:
263
-
264
-    ////////////////////////////////////////////////////////////
265
-    // Private Accessors
266
-    ////////////////////////////////////////////////////////////
267 141
 
268
-
269
-    ////////////////////////////////////////////////////////////
270
-    // Private Mutators
271
-    ////////////////////////////////////////////////////////////
142
+private:
272 143
 
273 144
     void consoleCommand(char *cmd);
274
-    /*------------------------------------------------------
275
-     * Pre  :
276
-     * Post :
277
-     *
278
-     *-- History ------------------------------------------
279
-     *
280
-     * ????.??.??:
281
-     * Mongoose - Created
282
-     ------------------------------------------------------*/
283 145
 
284 146
     void soundEvent(int type, int id, vec3_t pos, vec3_t angles);
285
-    /*------------------------------------------------------
286
-     * Pre  :
287
-     * Post :
288
-     *
289
-     *-- History ------------------------------------------
290
-     *
291
-     * 2002.06.16:
292
-     * Mongoose - Created
293
-     ------------------------------------------------------*/
294
-
295
-//  void entityEvent(entity_t &e, RaiderEvent event);
296
-    /*------------------------------------------------------
297
-     * Pre  :
298
-     * Post :
299
-     *
300
-     *-- History ------------------------------------------
301
-     *
302
-     * 2002.06.16:
303
-     * Mongoose - Created
304
-     ------------------------------------------------------*/
147
+
148
+    //void entityEvent(entity_t &e, RaiderEvent event);
305 149
 
306 150
     void processPakSounds();
307
-    /*------------------------------------------------------
308
-     * Pre  :
309
-     * Post :
310
-     *
311
-     *-- History ------------------------------------------
312
-     *
313
-     * 2001.06.04:
314
-     * Mongoose - Created
315
-     ------------------------------------------------------*/
316 151
 
317
-    void initSound();
318
-    /*------------------------------------------------------
319
-     * Pre  : Sound system has been init
320
-     * Post : Loads and positions level sounds and music
152
+    /*!
153
+     * \brief Loads and positions level sounds and music.
321 154
      *
322
-     *-- History ------------------------------------------
323
-     *
324
-     * 2001.06.04:
325
-     * Mongoose - Created
326
-     ------------------------------------------------------*/
155
+     * Sound system has to be initialized.
156
+     */
157
+    void initSound();
327 158
 
159
+    /*!
160
+     * \brief Generates textures or mipmaps for fonts, splash,
161
+     * external particles.
162
+     */
328 163
     void initTextures();
329
-    /*------------------------------------------------------
330
-     * Pre  :
331
-     * Post : Generates all textures or mipmaps
332
-     *        needed for fonts, splash, ext particles
333
-     *
334
-     *-- History ------------------------------------------
335
-     *
336
-     * 2001.05.28:
337
-     * Mongoose - Created
338
-     ------------------------------------------------------*/
339 164
 
165
+    /*!
166
+     * \brief Generates tombraider textures or mipmaps for sprites,
167
+     * rooms and models.
168
+     */
340 169
     void processTextures();
341
-    /*------------------------------------------------------
342
-     * Pre  :
343
-     * Post : Generates tombraider textures or mipmaps
344
-     *        needed for sprites, rooms, and models
345
-     *
346
-     *-- History ------------------------------------------
347
-     *
348
-     * 2001.05.28:
349
-     * Mongoose - Created
350
-     ------------------------------------------------------*/
351 170
 
171
+    /*!
172
+     * \brief Generates render sprite sequences
173
+     */
352 174
     void processSprites();
353
-    /*------------------------------------------------------
354
-     * Pre  :
355
-     * Post : Generates render sprite sequences
356
-     *
357
-     *-- History ------------------------------------------
358
-     *
359
-     * 2001.06.06:
360
-     * Mongoose - All new functionality
361
-     *
362
-     * 2001.05.28:
363
-     * Mongoose - Created
364
-     ------------------------------------------------------*/
365 175
 
366 176
     void processMoveables();
367
-    /*------------------------------------------------------
368
-     * Pre  :
369
-     * Post :
370
-     *
371
-     *-- History ------------------------------------------
372
-     *
373
-     * 2001.06.08:
374
-     * Mongoose - Created
375
-     ------------------------------------------------------*/
376 177
 
377 178
     void processMoveable(int index, int i, int *ent, List <skeletal_model_t *> &cache2, List <unsigned int> &cache, int object_id);
378
-    /*------------------------------------------------------
379
-     * Pre  :
380
-     * Post :
381
-     *
382
-     *-- History ------------------------------------------
383
-     *
384
-     * 2002.04.06:
385
-     * Mongoose - Created
386
-     ------------------------------------------------------*/
387 179
 
180
+    /*!
181
+     * \brief Generates render mesh and any textures needed
182
+     * for the specified model.
183
+     * \param index valid model index
184
+     */
388 185
     void processModel(int index);
389
-    /*------------------------------------------------------
390
-     * Pre  : valid model index
391
-     * Post : Generates render mesh and any textures
392
-     *        needed for model[index]
393
-     *
394
-     *-- History ------------------------------------------
395
-     *
396
-     * 2001.05.26:
397
-     * Mongoose - Created
398
-     ------------------------------------------------------*/
399 186
 
187
+    /*!
188
+     * \brief Generates render mesh and any textures needed
189
+     * for the specified room
190
+     * \param index valid room index
191
+     */
400 192
     void processRoom(int index);
401
-    /*------------------------------------------------------
402
-     * Pre  : valid room index
403
-     * Post : Generates render mesh and any textures
404
-     *        needed for room[index]
405
-     *
406
-     *-- History ------------------------------------------
407
-     *
408
-     * 2001.05.21:
409
-     * Mongoose - Created
410
-     ------------------------------------------------------*/
411 193
 
194
+    /*!
195
+     * \brief Loads validated level pak from diskfile using maplist
196
+     * \param filename level pak file name
197
+     */
412 198
     void loadLevel(char *filename);
413
-    /*------------------------------------------------------
414
-     * Pre  :
415
-     * Post : Loads validated level pak from diskfile
416
-     *        using maplist
417
-     *
418
-     *-- History ------------------------------------------
419
-     *
420
-     * 2001.05.21:
421
-     * Mongoose - Created
422
-     ------------------------------------------------------*/
423
-
424
-
425
-    static OpenRaider *mInstance; /* Singleton use */
426
-
427
-    TombRaider m_tombraider;      /* Tombraider data support */
428
-
429
-    Sound mSound;                 /* 3d Audio support */
430
-
431
-    Render m_render;              /* Rendering support */
432 199
 
433
-    Camera m_camera;              /* Client camera support */
200
+    static OpenRaider *mInstance; //!< Singleton use
201
+    TombRaider m_tombraider;      //!< Tombraider data support
202
+    Sound mSound;                 //!< 3d Audio support
203
+    Render m_render;              //!< Rendering support
204
+    Camera m_camera;              //!< Client camera support
205
+    GLString *mText;              //!< Hook to textbox like output
434 206
 
435
-    GLString *mText;              /* Hook to textbox like output */
436
-
437
-    int mNoClipping;              /* 0 - Clipping, 1 - No Clipping,
438
-                                               2 - No Clipping w/o gravity */
439
-
440
-    // RC vars //////////////////
441
-
442
-    unsigned int mMode[8];          /* Translate System's mode ids to OR's */
443
-
444
-    unsigned int m_flags;           /* Set options by flags */
445
-
446
-    int m_testSFX;                      /* Used for mixed channel sound tests */
447
-
448
-    float m_mouseX, m_mouseY;       /* XY axis rotation deltas */
449
-
450
-    unsigned int m_texOffset;       /* Offset of TombRaider textures in list */
207
+    // RC vars
451 208
 
209
+    unsigned int mMode[8];            //!< Translate System's mode ids to OR's
210
+    unsigned int m_flags;             //!< Set options by flags
211
+    int m_testSFX;                    //!< Used for mixed channel sound tests
212
+    float m_mouseX, m_mouseY;         //!< XY axis rotation deltas
213
+    unsigned int m_texOffset;         //!< Offset of TombRaider textures in list
452 214
     unsigned int mLevelTextureOffset;
453 215
 
454
-    // Game vars //////////////
455
-
456
-    Vector <char *> mMusicList;  /* List of game level music */
457
-
458
-    Vector <char *> mMapList;    /* List of game maps */
459
-
460
-    char m_mapName[32];          /* Current map filename */
461
-
462
-    char *m_pakDir;              /* Current pak directory */
463
-
464
-    char *m_audioDir;            /* Current audio directory */
465
-
466
-    char *m_homeDir;             /* Current home directory */
216
+    // Game vars
467 217
 
468
-    Vector<entity_t *> mClients; /* Player entity/clients */
218
+    Vector <char *> mMusicList;  //!< List of game level music
219
+    Vector <char *> mMapList;    //!< List of game maps
220
+    char m_mapName[32];          //!< Current map filename
221
+    char *m_pakDir;              //!< Current pak directory
222
+    char *m_audioDir;            //!< Current audio directory
223
+    char *m_homeDir;             //!< Current home directory
224
+    Vector<entity_t *> mClients; //!< Player entity/clients
469 225
 };
470 226
 
471 227
 #endif

+ 38
- 53
include/Render.h 파일 보기

@@ -30,7 +30,7 @@
30 30
 #include <Light.h>
31 31
 #include <World.h>
32 32
 #include <SkeletalModel.h>
33
-#include <OpenGLMesh.h>
33
+#include <Mesh.h>
34 34
 #include <Texture.h>
35 35
 #include <Camera.h>
36 36
 #include <GLString.h>
@@ -40,40 +40,29 @@
40 40
 #endif
41 41
 
42 42
 
43
-class RenderRoom
44
-{
43
+class RenderRoom {
45 44
 public:
46
-    RenderRoom()
47
-    {
45
+    RenderRoom() {
48 46
         room = 0x0;
49 47
         dist = 0.0f;
50 48
         center[0] = center[1] = center[2] = 0.0f;
51 49
     }
52 50
 
53
-    ~RenderRoom()
54
-    {
51
+    ~RenderRoom() {
55 52
         //! \fixme Hangs when erasing - might be shared pointers somewhere
56 53
         //lights.erase();
57 54
     }
58 55
 
59
-    void computeCenter()
60
-    {
56
+    void computeCenter() {
61 57
         if (room)
62
-        {
63 58
             helMidpoint3v(room->bbox_min, room->bbox_max, center);
64
-        }
65 59
     }
66 60
 
67
-    vec_t dist;              /* Distance to near plane, move to room?  */
68
-
69
-    vec3_t center;           /* Center of bbox, move to room? */
70
-
71
-    room_mesh_t *room;       /* Physical room stored in World,
72
-                                         Very dangerous as allocated and used */
73
-
74
-    Vector<Light *> lights;  /* List of lights in this room */
75
-
76
-    OpenGLMesh mesh;         /* OpenGL mesh that represents this room */
61
+    vec_t dist;             //!< Distance to near plane, move to room?
62
+    vec3_t center;          //!< Center of bbox, move to room?
63
+    room_mesh_t *room;      //!< Physical room stored in World, very dangerous as allocated and used
64
+    Vector<Light *> lights; //!< List of lights in this room
65
+    Mesh mesh;              //!< OpenGL mesh that represents this room
77 66
 };
78 67
 
79 68
 
@@ -81,42 +70,38 @@ class Render
81 70
 {
82 71
  public:
83 72
 
84
-    typedef enum
85
-   {
86
-        modeDisabled    = 0,
87
-        modeLoadScreen  = 1,
88
-        modeVertexLight = 2,
89
-        modeSolid       = 3,
90
-        modeWireframe   = 4,
91
-        modeTexture     = 5
73
+    typedef enum {
74
+        modeDisabled,
75
+        modeLoadScreen,
76
+        modeVertexLight,
77
+        modeSolid,
78
+        modeWireframe,
79
+        modeTexture
92 80
     } RenderMode;
93 81
 
94
-    typedef enum
95
-   {
96
-        fParticles      = 1,
97
-        fPortals            = 2,
98
-        fRoomAlpha      = 4,
99
-        fViewModel    = 8,
100
-        fSprites      = 16,
101
-        fRoomModels   = 32,
102
-        fEntityModels = 64,
103
-        fFog          = 128,
104
-        fUsePortals   = 256,
105
-        fFastCard     = 1024,
106
-        fGL_Lights    = 2048,
107
-        fOneRoom      = 4096,
108
-        fRenderPonytail = 8192,
109
-        fMultiTexture = 16384,
110
-        fUpdateRoomListPerFrame = 32768,
111
-        fAnimateAllModels = 65536,
112
-        fAllRooms      =  131072
82
+    typedef enum {
83
+        fParticles              = (1 << 0),
84
+        fPortals                = (1 << 1),
85
+        fRoomAlpha              = (1 << 2),
86
+        fViewModel              = (1 << 3),
87
+        fSprites                = (1 << 4),
88
+        fRoomModels             = (1 << 5),
89
+        fEntityModels           = (1 << 6),
90
+        fFog                    = (1 << 7),
91
+        fUsePortals             = (1 << 8),
92
+        fFastCard               = (1 << 9),
93
+        fGL_Lights              = (1 << 10),
94
+        fOneRoom                = (1 << 11),
95
+        fRenderPonytail         = (1 << 12),
96
+        fMultiTexture           = (1 << 13),
97
+        fUpdateRoomListPerFrame = (1 << 14),
98
+        fAnimateAllModels       = (1 << 15),
99
+        fAllRooms               = (1 << 16)
113 100
     } RenderFlags;
114 101
 
115
-    typedef enum
116
-    {
117
-        roomMesh = 1,
118
-        skeletalMesh = 2
119
-
102
+    typedef enum {
103
+        roomMesh,
104
+        skeletalMesh
120 105
     } RenderMeshType;
121 106
 
122 107
     ////////////////////////////////////////////////////////////

+ 74
- 140
src/Matrix.cpp 파일 보기

@@ -10,31 +10,24 @@
10 10
 
11 11
 #include <Matrix.h>
12 12
 
13
-Matrix::Matrix()
14
-{
13
+Matrix::Matrix() {
15 14
     setIdentity();
16 15
 }
17 16
 
18
-Matrix::Matrix(matrix_t m)
19
-{
17
+Matrix::Matrix(matrix_t m) {
20 18
     setMatrix(m);
21 19
 }
22 20
 
23
-Matrix::Matrix(Quaternion &q)
24
-{
21
+Matrix::Matrix(Quaternion &q) {
25 22
     matrix_t m;
26
-
27
-
28 23
     q.getMatrix(m);
29 24
     setMatrix(m);
30 25
 }
31 26
 
32
-Matrix::~Matrix()
33
-{
27
+Matrix::~Matrix() {
34 28
 }
35 29
 
36
-bool Matrix::getInvert(matrix_t out)
37
-{
30
+bool Matrix::getInvert(matrix_t out) {
38 31
     matrix_t m;
39 32
 
40 33
 #ifdef COLUMN_ORDER
@@ -57,20 +50,20 @@ bool Matrix::getInvert(matrix_t out)
57 50
     r0 = wtmp[0], r1 = wtmp[1], r2 = wtmp[2], r3 = wtmp[3];
58 51
 
59 52
     r0[0] = MAT(m,0,0), r0[1] = MAT(m,0,1),
60
-        r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3),
61
-        r0[4] = 1.0f, r0[5] = r0[6] = r0[7] = 0.0f,
53
+    r0[2] = MAT(m,0,2), r0[3] = MAT(m,0,3),
54
+    r0[4] = 1.0f, r0[5] = r0[6] = r0[7] = 0.0f,
62 55
 
63
-        r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1),
64
-        r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3),
65
-        r1[5] = 1.0f, r1[4] = r1[6] = r1[7] = 0.0f,
56
+    r1[0] = MAT(m,1,0), r1[1] = MAT(m,1,1),
57
+    r1[2] = MAT(m,1,2), r1[3] = MAT(m,1,3),
58
+    r1[5] = 1.0f, r1[4] = r1[6] = r1[7] = 0.0f,
66 59
 
67
-        r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1),
68
-        r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3),
69
-        r2[6] = 1.0f, r2[4] = r2[5] = r2[7] = 0.0f,
60
+    r2[0] = MAT(m,2,0), r2[1] = MAT(m,2,1),
61
+    r2[2] = MAT(m,2,2), r2[3] = MAT(m,2,3),
62
+    r2[6] = 1.0f, r2[4] = r2[5] = r2[7] = 0.0f,
70 63
 
71
-        r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1),
72
-        r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3),
73
-        r3[7] = 1.0f, r3[4] = r3[5] = r3[6] = 0.0f;
64
+    r3[0] = MAT(m,3,0), r3[1] = MAT(m,3,1),
65
+    r3[2] = MAT(m,3,2), r3[3] = MAT(m,3,3),
66
+    r3[7] = 1.0f, r3[4] = r3[5] = r3[6] = 0.0f;
74 67
 
75 68
     /* choose pivot - or die */
76 69
     if (fabs(r3[0])>fabs(r2[0])) SWAP_ROWS(r3, r2);
@@ -113,8 +106,8 @@ bool Matrix::getInvert(matrix_t out)
113 106
     /* eliminate third variable */
114 107
     m3 = r3[2]/r2[2];
115 108
     r3[3] -= m3 * r2[3], r3[4] -= m3 * r2[4],
116
-        r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6],
117
-        r3[7] -= m3 * r2[7];
109
+    r3[5] -= m3 * r2[5], r3[6] -= m3 * r2[6],
110
+    r3[7] -= m3 * r2[7];
118 111
 
119 112
     /* last check */
120 113
     if (0.0f == r3[3]) return false;
@@ -125,26 +118,26 @@ bool Matrix::getInvert(matrix_t out)
125 118
     m2 = r2[3];                 /* now back substitute row 2 */
126 119
     s  = 1.0f/r2[2];
127 120
     r2[4] = s * (r2[4] - r3[4] * m2), r2[5] = s * (r2[5] - r3[5] * m2),
128
-        r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
121
+    r2[6] = s * (r2[6] - r3[6] * m2), r2[7] = s * (r2[7] - r3[7] * m2);
129 122
     m1 = r1[3];
130 123
     r1[4] -= r3[4] * m1, r1[5] -= r3[5] * m1,
131
-        r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1;
124
+    r1[6] -= r3[6] * m1, r1[7] -= r3[7] * m1;
132 125
     m0 = r0[3];
133 126
     r0[4] -= r3[4] * m0, r0[5] -= r3[5] * m0,
134
-        r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
127
+    r0[6] -= r3[6] * m0, r0[7] -= r3[7] * m0;
135 128
 
136 129
     m1 = r1[2];                 /* now back substitute row 1 */
137 130
     s  = 1.0f/r1[1];
138 131
     r1[4] = s * (r1[4] - r2[4] * m1), r1[5] = s * (r1[5] - r2[5] * m1),
139
-        r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
132
+    r1[6] = s * (r1[6] - r2[6] * m1), r1[7] = s * (r1[7] - r2[7] * m1);
140 133
     m0 = r0[2];
141 134
     r0[4] -= r2[4] * m0, r0[5] -= r2[5] * m0,
142
-        r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
135
+    r0[6] -= r2[6] * m0, r0[7] -= r2[7] * m0;
143 136
 
144 137
     m0 = r0[1];                 /* now back substitute row 0 */
145 138
     s  = 1.0f/r0[0];
146 139
     r0[4] = s * (r0[4] - r1[4] * m0), r0[5] = s * (r0[5] - r1[5] * m0),
147
-        r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
140
+    r0[6] = s * (r0[6] - r1[6] * m0), r0[7] = s * (r0[7] - r1[7] * m0);
148 141
 
149 142
     MAT(out,0,0) = r0[4];
150 143
     MAT(out,0,1) = r0[5], MAT(out,0,2) = r0[6];
@@ -161,52 +154,42 @@ bool Matrix::getInvert(matrix_t out)
161 154
 #undef SWAP_ROWS
162 155
 }
163 156
 
164
-void Matrix::getMatrix(matrix_t mat)
165
-{
157
+void Matrix::getMatrix(matrix_t mat) {
166 158
     copy(mMatrix, mat);
167 159
 }
168 160
 
169
-void Matrix::getTransposeMatrix(matrix_t m)
170
-{
161
+void Matrix::getTransposeMatrix(matrix_t m) {
171 162
     m[ 0]= mMatrix[0]; m[ 1]= mMatrix[4]; m[ 2]= mMatrix[ 8]; m[ 3]=mMatrix[12];
172 163
     m[ 4]= mMatrix[1]; m[ 5]= mMatrix[5]; m[ 6]= mMatrix[ 9]; m[ 7]=mMatrix[13];
173 164
     m[ 8]= mMatrix[2]; m[ 9]= mMatrix[6]; m[10]= mMatrix[10]; m[11]=mMatrix[14];
174 165
     m[12]= mMatrix[3]; m[13]= mMatrix[7]; m[14]= mMatrix[11]; m[15]=mMatrix[15];
175 166
 }
176 167
 
177
-Matrix Matrix::multiply(const Matrix &a, const Matrix &b)
178
-{
168
+Matrix Matrix::multiply(const Matrix &a, const Matrix &b) {
179 169
     Matrix c;
180
-
181 170
     multiply(a.mMatrix, b.mMatrix, c.mMatrix);
182
-
183 171
     return c;
184 172
 }
185 173
 
186
-Matrix Matrix::operator *(const Matrix &a)
187
-{
174
+Matrix Matrix::operator *(const Matrix &a) {
188 175
     return multiply(a, *this);
189 176
 }
190 177
 
191
-Vector3d Matrix::operator *(Vector3d v)
192
-{
178
+Vector3d Matrix::operator *(Vector3d v) {
193 179
     vec_t x = v.mVec[0], y = v.mVec[1], z = v.mVec[2];
194 180
 
195 181
 #ifdef COLUMN_ORDER
196
-    // Column order
197 182
     return Vector3d(mMatrix[0]*x + mMatrix[4]*y + mMatrix[ 8]*z + mMatrix[12],
198 183
             mMatrix[1]*x + mMatrix[5]*y + mMatrix[ 9]*z + mMatrix[13],
199 184
             mMatrix[2]*x + mMatrix[6]*y + mMatrix[10]*z + mMatrix[14]);
200 185
 #else
201
-    // Row order
202 186
     return Vector3d(mMatrix[0]*x + mMatrix[1]*y + mMatrix[ 2]*z + mMatrix[ 3],
203 187
             mMatrix[4]*x + mMatrix[5]*y + mMatrix[ 6]*z + mMatrix[ 7],
204 188
             mMatrix[8]*x + mMatrix[9]*y + mMatrix[10]*z + mMatrix[11]);
205 189
 #endif
206 190
 }
207 191
 
208
-void Matrix::multiply3v(vec3_t v, vec3_t result)
209
-{
192
+void Matrix::multiply3v(vec3_t v, vec3_t result) {
210 193
     vec_t x = v[0], y = v[1], z = v[2];
211 194
 
212 195
     result[0] = mMatrix[0]*x + mMatrix[1]*y + mMatrix[ 2]*z + mMatrix[ 3];
@@ -214,8 +197,7 @@ void Matrix::multiply3v(vec3_t v, vec3_t result)
214 197
     result[2] = mMatrix[8]*x + mMatrix[9]*y + mMatrix[10]*z + mMatrix[11];
215 198
 }
216 199
 
217
-void Matrix::multiply4v(vec4_t v, vec4_t result)
218
-{
200
+void Matrix::multiply4v(vec4_t v, vec4_t result) {
219 201
     vec_t x = v[0], y = v[1], z = v[2], w = v[3];
220 202
 
221 203
     result[0] = mMatrix[ 0]*x + mMatrix[ 1]*y + mMatrix[ 2]*z + mMatrix[ 3]*w;
@@ -224,16 +206,14 @@ void Matrix::multiply4v(vec4_t v, vec4_t result)
224 206
     result[3] = mMatrix[12]*x + mMatrix[13]*y + mMatrix[14]*z + mMatrix[15]*w;
225 207
 }
226 208
 
227
-void Matrix::print()
228
-{
229
-#ifdef COLUMN_ORDER
209
+void Matrix::print() {
230 210
     printf("{\n%f %f %f %f\n%f %f %f %f\n%f %f %f %f\n%f %f %f %f\n}\n",
211
+#ifdef COLUMN_ORDER
231 212
             mMatrix[0], mMatrix[4], mMatrix[ 8], mMatrix[12],
232 213
             mMatrix[1], mMatrix[5], mMatrix[ 9], mMatrix[13],
233 214
             mMatrix[2], mMatrix[6], mMatrix[10], mMatrix[14],
234 215
             mMatrix[3], mMatrix[7], mMatrix[11], mMatrix[15]);
235 216
 #else
236
-    printf("{\n%f %f %f %f\n%f %f %f %f\n%f %f %f %f\n%f %f %f %f\n}\n",
237 217
             mMatrix[ 0], mMatrix[ 1], mMatrix[ 2], mMatrix[ 3],
238 218
             mMatrix[ 4], mMatrix[ 5], mMatrix[ 6], mMatrix[ 7],
239 219
             mMatrix[ 8], mMatrix[ 9], mMatrix[10], mMatrix[11],
@@ -241,9 +221,8 @@ void Matrix::print()
241 221
 #endif
242 222
 }
243 223
 
244
-bool Matrix::isIdentity()
245
-{
246
-    // Hhhmm... floating point using direct comparisions
224
+bool Matrix::isIdentity() {
225
+    // Hhhmm... floating point using direct comparisons
247 226
     /*
248 227
     if (mMatrix[ 0] == 1 && mMatrix[ 1] == 0 && mMatrix[ 2] == 0 &&
249 228
             mMatrix[ 3] == 0 &&    mMatrix[ 4] == 0 && mMatrix[ 5] == 1 &&
@@ -264,74 +243,66 @@ bool Matrix::isIdentity()
264 243
     return false;
265 244
 }
266 245
 
267
-void Matrix::setMatrix(matrix_t mat)
268
-{
246
+void Matrix::setMatrix(matrix_t mat) {
269 247
     copy(mat, mMatrix);
270 248
 }
271 249
 
272
-void Matrix::setIdentity()
273
-{
250
+void Matrix::setIdentity() {
274 251
     mMatrix[ 0] = 1; mMatrix[ 1] = 0; mMatrix[ 2] = 0; mMatrix[ 3] = 0;
275 252
     mMatrix[ 4] = 0; mMatrix[ 5] = 1; mMatrix[ 6] = 0; mMatrix[ 7] = 0;
276 253
     mMatrix[ 8] = 0; mMatrix[ 9] = 0; mMatrix[10] = 1; mMatrix[11] = 0;
277 254
     mMatrix[12] = 0; mMatrix[13] = 0; mMatrix[14] = 0; mMatrix[15] = 1;
278 255
 }
279 256
 
280
-void Matrix::scale(const vec_t *xyz)
281
-{
257
+void Matrix::scale(const vec_t *xyz) {
282 258
     scale(xyz[0], xyz[1], xyz[2]);
283 259
 }
284 260
 
285
-void Matrix::scale(vec_t sx, vec_t sy, vec_t sz)
286
-{
261
+void Matrix::scale(vec_t sx, vec_t sy, vec_t sz) {
287 262
     matrix_t smatrix;
288 263
     matrix_t tmp;
289 264
 
290
-    smatrix[ 0] = sx;smatrix[ 1] = 0; smatrix[ 2] = 0; smatrix[ 3] = 0;
291
-    smatrix[ 4] = 0; smatrix[ 5] = sy;smatrix[ 6] = 0; smatrix[ 7] = 0;
292
-    smatrix[ 8] = 0; smatrix[ 9] = 0; smatrix[10] = sz;smatrix[11] = 0;
293
-    smatrix[12] = 0; smatrix[13] = 0; smatrix[14] = 0; smatrix[15] = 1;
265
+    smatrix[ 0] = sx; smatrix[ 1] = 0;  smatrix[ 2] = 0;  smatrix[ 3] = 0;
266
+    smatrix[ 4] = 0;  smatrix[ 5] = sy; smatrix[ 6] = 0;  smatrix[ 7] = 0;
267
+    smatrix[ 8] = 0;  smatrix[ 9] = 0;  smatrix[10] = sz; smatrix[11] = 0;
268
+    smatrix[12] = 0;  smatrix[13] = 0;  smatrix[14] = 0;  smatrix[15] = 1;
294 269
 
295 270
     copy(mMatrix, tmp);
296 271
     multiply(tmp, smatrix, mMatrix);
297 272
 }
298 273
 
299
-void Matrix::rotate(const vec_t *xyz)
300
-{
274
+void Matrix::rotate(const vec_t *xyz) {
301 275
     rotate(xyz[0], xyz[1], xyz[2]);
302 276
 }
303 277
 
304
-void Matrix::rotate(vec_t ax, vec_t ay, vec_t az)
305
-{
278
+void Matrix::rotate(vec_t ax, vec_t ay, vec_t az) {
306 279
     matrix_t xmat, ymat, zmat, tmp, tmp2;
307 280
 
308
-    xmat[ 0]=1;        xmat[ 1]=0;        xmat[ 2]=0;        xmat[ 3]=0;
309
-    xmat[ 4]=0;        xmat[ 5]=cosf(ax);  xmat[ 6]=sinf(ax);  xmat[ 7]=0;
310
-    xmat[ 8]=0;        xmat[ 9]=-sinf(ax); xmat[10]=cosf(ax);  xmat[11]=0;
311
-    xmat[12]=0;        xmat[13]=0;        xmat[14]=0;        xmat[15]=1;
281
+    xmat[ 0]=1;         xmat[ 1]=0;         xmat[ 2]=0;         xmat[ 3]=0;
282
+    xmat[ 4]=0;         xmat[ 5]=cosf(ax);  xmat[ 6]=sinf(ax);  xmat[ 7]=0;
283
+    xmat[ 8]=0;         xmat[ 9]=-sinf(ax); xmat[10]=cosf(ax);  xmat[11]=0;
284
+    xmat[12]=0;         xmat[13]=0;         xmat[14]=0;         xmat[15]=1;
312 285
 
313
-    ymat[ 0]=cosf(ay);  ymat[ 1]=0;        ymat[ 2]=-sinf(ay); ymat[ 3]=0;
314
-    ymat[ 4]=0;        ymat[ 5]=1;        ymat[ 6]=0;        ymat[ 7]=0;
315
-    ymat[ 8]=sinf(ay);  ymat[ 9]=0;        ymat[10]=cosf(ay);  ymat[11]=0;
316
-    ymat[12]=0;        ymat[13]=0;        ymat[14]=0;        ymat[15]=1;
286
+    ymat[ 0]=cosf(ay);  ymat[ 1]=0;         ymat[ 2]=-sinf(ay); ymat[ 3]=0;
287
+    ymat[ 4]=0;         ymat[ 5]=1;         ymat[ 6]=0;         ymat[ 7]=0;
288
+    ymat[ 8]=sinf(ay);  ymat[ 9]=0;         ymat[10]=cosf(ay);  ymat[11]=0;
289
+    ymat[12]=0;         ymat[13]=0;         ymat[14]=0;         ymat[15]=1;
317 290
 
318
-    zmat[ 0]=cosf(az);  zmat[ 1]=sinf(az);  zmat[ 2]=0;        zmat[ 3]=0;
319
-    zmat[ 4]=-sinf(az); zmat[ 5]=cosf(az);  zmat[ 6]=0;        zmat[ 7]=0;
320
-    zmat[ 8]=0;        zmat[ 9]=0;        zmat[10]=1;        zmat[11]=0;
321
-    zmat[12]=0;        zmat[13]=0;        zmat[14]=0;        zmat[15]=1;
291
+    zmat[ 0]=cosf(az);  zmat[ 1]=sinf(az);  zmat[ 2]=0;         zmat[ 3]=0;
292
+    zmat[ 4]=-sinf(az); zmat[ 5]=cosf(az);  zmat[ 6]=0;         zmat[ 7]=0;
293
+    zmat[ 8]=0;         zmat[ 9]=0;         zmat[10]=1;         zmat[11]=0;
294
+    zmat[12]=0;         zmat[13]=0;         zmat[14]=0;         zmat[15]=1;
322 295
 
323 296
     multiply(mMatrix, ymat, tmp);
324 297
     multiply(tmp, xmat, tmp2);
325 298
     multiply(tmp2, zmat, mMatrix);
326 299
 }
327 300
 
328
-void Matrix::translate(const vec_t *xyz)
329
-{
301
+void Matrix::translate(const vec_t *xyz) {
330 302
     translate(xyz[0], xyz[1], xyz[2]);
331 303
 }
332 304
 
333
-void Matrix::translate(vec_t tx, vec_t ty, vec_t tz)
334
-{
305
+void Matrix::translate(vec_t tx, vec_t ty, vec_t tz) {
335 306
     matrix_t tmat, tmp;
336 307
 
337 308
     tmat[ 0]=1;  tmat[ 1]=0;  tmat[ 2]=0;  tmat[ 3]=0;
@@ -343,69 +314,34 @@ void Matrix::translate(vec_t tx, vec_t ty, vec_t tz)
343 314
     multiply(tmp, tmat, mMatrix);
344 315
 }
345 316
 
346
-void Matrix::copy(matrix_t source, matrix_t dest)
347
-{
348
-#ifdef FASTER_MATRIX
349
-    memcpy(dest, source, sizeof(matrix_t));
350
-#else
351
-    dest[ 0] = source[ 0];
352
-    dest[ 1] = source[ 1];
353
-    dest[ 2] = source[ 2];
354
-    dest[ 3] = source[ 3];
355
-
356
-    dest[ 4] = source[ 4];
357
-    dest[ 5] = source[ 5];
358
-    dest[ 6] = source[ 6];
359
-    dest[ 7] = source[ 7];
360
-
361
-    dest[ 8] = source[8];
362
-    dest[ 9] = source[9];
363
-    dest[10] = source[10];
364
-    dest[11] = source[11];
365
-
366
-    dest[12] = source[12];
367
-    dest[13] = source[13];
368
-    dest[14] = source[14];
369
-    dest[15] = source[15];
370
-#endif
317
+void Matrix::copy(matrix_t source, matrix_t dest) {
318
+    for (int i = 0; i < 16; i++)
319
+        dest[i] = source[i];
371 320
 }
372 321
 
373
-void Matrix::multiply(const matrix_t a, const matrix_t b, matrix_t result)
374
-{
322
+void Matrix::multiply(const matrix_t a, const matrix_t b, matrix_t result) {
375 323
     /* Generated code for matrix mult
376 324
      * Code used:
377 325
 
378 326
     // char order is argument
379 327
     int i, j, k;
380
-    if (order == 'r')
381
-    {
328
+    if (order == 'r') {
382 329
         printf("// Row order\n");
383
-    }
384
-    else
385
-    {
330
+    } else {
386 331
         printf("// Column order\n");
387 332
     }
388
-    for (i = 0; i < 4; ++i)
389
-    {
390
-        for (j = 0; j < 4; ++j)
391
-        {
392
-            if (order == 'r')
393
-            {
333
+    for (i = 0; i < 4; ++i) {
334
+        for (j = 0; j < 4; ++j) {
335
+            if (order == 'r') {
394 336
                 printf("result[%2i] = ", j+i*4);
395
-            }
396
-            else
397
-            {
337
+            } else {
398 338
                 printf("result[%2i] = ", j+i*4);
399 339
             }
400
-            for (k = 0; k < 4; ++k)
401
-            {
402
-                if (order == 'r')
403
-                {
340
+            for (k = 0; k < 4; ++k) {
341
+                if (order == 'r') {
404 342
                     printf("a[%2i] * b[%2i]%s",
405 343
                     k+i*4, j+k*4, (k == 3) ? ";\n" : " + ");
406
-                }
407
-                else
408
-                {
344
+                } else {
409 345
                     printf("a[%2i] * b[%2i]%s",
410 346
                     i+k*4, k+j*4, (k == 3) ? ";\n" : " + ");
411 347
                 }
@@ -417,10 +353,8 @@ void Matrix::multiply(const matrix_t a, const matrix_t b, matrix_t result)
417 353
     }
418 354
     printf("\n");
419 355
     printf("// Transpose\n");
420
-    for(i = 0; i < 4; ++i)
421
-    {
422
-        for (j = 0; j < 4; ++j)
423
-        {
356
+    for(i = 0; i < 4; ++i) {
357
+        for (j = 0; j < 4; ++j) {
424 358
             printf("a[%2i] = b[%2i]%s",
425 359
             j+i*4, i+j*4, (j == 3) ? ";\n" : "; ");
426 360
         }

src/OpenGLMesh.cpp → src/Mesh.cpp 파일 보기

@@ -1,5 +1,5 @@
1 1
 /*!
2
- * \file src/OpenGLMesh.cpp
2
+ * \file src/Mesh.cpp
3 3
  * \brief OpenGL Mesh
4 4
  *
5 5
  * \author Mongoose
@@ -11,14 +11,14 @@
11 11
 #include <GL/gl.h>
12 12
 #endif
13 13
 
14
-#include <OpenGLMesh.h>
14
+#include <Mesh.h>
15 15
 
16 16
 
17 17
 ////////////////////////////////////////////////////////////
18 18
 // Constructors
19 19
 ////////////////////////////////////////////////////////////
20 20
 
21
-OpenGLMesh::OpenGLMesh()
21
+Mesh::Mesh()
22 22
 {
23 23
     mNumVertices = 0;
24 24
     mVertices = 0x0;
@@ -46,11 +46,11 @@ OpenGLMesh::OpenGLMesh()
46 46
     mTriangleTexCoordArray = 0x0;
47 47
 
48 48
     mFlags = 0;
49
-    mMode = OpenGLMeshModeTexture;
49
+    mMode = MeshModeTexture;
50 50
 }
51 51
 
52 52
 
53
-OpenGLMesh::~OpenGLMesh()
53
+Mesh::~Mesh()
54 54
 {
55 55
     unsigned int i;
56 56
 
@@ -151,7 +151,7 @@ OpenGLMesh::~OpenGLMesh()
151 151
 // Public Accessors
152 152
 ////////////////////////////////////////////////////////////
153 153
 
154
-void OpenGLMesh::drawAlpha()
154
+void Mesh::drawAlpha()
155 155
 {
156 156
     unsigned int i, j, k, index;
157 157
 
@@ -161,17 +161,17 @@ void OpenGLMesh::drawAlpha()
161 161
     {
162 162
         switch (mMode)
163 163
         {
164
-            case OpenGLMeshModeWireframe:
164
+            case MeshModeWireframe:
165 165
                 glColor3f(0.0, 0.0, 1.0);
166 166
                 glBindTexture(GL_TEXTURE_2D, 0);
167 167
                 break;
168
-            case OpenGLMeshModeSolid:
168
+            case MeshModeSolid:
169 169
                 // Bind WHITE texture for solid colors
170 170
                 glBindTexture(GL_TEXTURE_2D, 0);
171 171
                 break;
172 172
             default:
173
-            case OpenGLMeshModeTexture:
174
-            case OpenGLMeshModeMultiTexture:
173
+            case MeshModeTexture:
174
+            case MeshModeMultiTexture:
175 175
                 // Bind texture id for textures
176 176
                 glBindTexture(GL_TEXTURE_2D, mQuads[i].texture+1);
177 177
         }
@@ -198,17 +198,17 @@ void OpenGLMesh::drawAlpha()
198 198
     {
199 199
         switch (mMode)
200 200
         {
201
-            case OpenGLMeshModeWireframe:
201
+            case MeshModeWireframe:
202 202
                 glColor3f(0.0, 1.0, 0.0);
203 203
                 glBindTexture(GL_TEXTURE_2D, 0);
204 204
                 break;
205
-            case OpenGLMeshModeSolid:
205
+            case MeshModeSolid:
206 206
                 // Bind WHITE texture for solid colors
207 207
                 glBindTexture(GL_TEXTURE_2D, 0);
208 208
                 break;
209 209
             default:
210
-            case OpenGLMeshModeTexture:
211
-            case OpenGLMeshModeMultiTexture:
210
+            case MeshModeTexture:
211
+            case MeshModeMultiTexture:
212 212
                 // Bind texture id for textures
213 213
                 glBindTexture(GL_TEXTURE_2D, mTris[i].texture+1);
214 214
         }
@@ -232,12 +232,12 @@ void OpenGLMesh::drawAlpha()
232 232
 }
233 233
 
234 234
 
235
-void OpenGLMesh::drawSolid()
235
+void Mesh::drawSolid()
236 236
 {
237 237
     unsigned int i, j, k, index;
238 238
 
239 239
 
240
-    if (mFlags & fOpenGLMesh_UseVertexArray)
240
+    if (mFlags & fMesh_UseVertexArray)
241 241
     {
242 242
         //glEnableClientState(GL_VERTEX_ARRAY);
243 243
         //glVertexPointer(3, GL_FLOAT, 0, mVertexArray);
@@ -278,15 +278,15 @@ void OpenGLMesh::drawSolid()
278 278
     {
279 279
         switch (mMode)
280 280
         {
281
-            case OpenGLMeshModeSolid:
281
+            case MeshModeSolid:
282 282
                 glColor3f(0.0, 0.0, 0.0);
283 283
                 break;
284
-            case OpenGLMeshModeWireframe:
284
+            case MeshModeWireframe:
285 285
                 // Bind WHITE texture for solid colors
286 286
                 glBindTexture(GL_TEXTURE_2D, 0);
287 287
                 break;
288 288
 #ifdef MULTITEXTURE
289
-            case OpenGLMeshModeMultiTexture:
289
+            case MeshModeMultiTexture:
290 290
                 glActiveTextureARB(GL_TEXTURE0_ARB);
291 291
                 glEnable(GL_TEXTURE_2D);
292 292
                 glBindTexture(GL_TEXTURE_2D, mQuads[i].texture+1);
@@ -296,10 +296,10 @@ void OpenGLMesh::drawSolid()
296 296
                 glBindTexture(GL_TEXTURE_2D, mQuads[i].bumpmap+1);
297 297
                 break;
298 298
 #else
299
-            case OpenGLMeshModeMultiTexture:
299
+            case MeshModeMultiTexture:
300 300
 #endif
301 301
             default:
302
-            case OpenGLMeshModeTexture:
302
+            case MeshModeTexture:
303 303
                 // Bind texture id for textures
304 304
                 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
305 305
                 glBindTexture(GL_TEXTURE_2D, mQuads[i].texture+1);
@@ -316,7 +316,7 @@ void OpenGLMesh::drawSolid()
316 316
                 glColor4fv(mColors[index]);
317 317
 
318 318
 #ifdef MULTITEXTURE
319
-                if (mMode == OpenGLMeshModeMultiTexture)
319
+                if (mMode == MeshModeMultiTexture)
320 320
                 {
321 321
                     glMultiTexCoord2fvARB(GL_TEXTURE0_ARB,
322 322
                             mQuads[i].texcoors[j*4+k]);
@@ -339,15 +339,15 @@ void OpenGLMesh::drawSolid()
339 339
     {
340 340
         switch (mMode)
341 341
         {
342
-            case OpenGLMeshModeSolid:
342
+            case MeshModeSolid:
343 343
                 glColor3f(1.0, 0.0, 0.0);
344 344
                 break;
345
-            case OpenGLMeshModeWireframe:
345
+            case MeshModeWireframe:
346 346
                 // Bind WHITE texture for solid colors
347 347
                 glBindTexture(GL_TEXTURE_2D, 0);
348 348
                 break;
349 349
 #ifdef MULTITEXTURE
350
-            case OpenGLMeshModeMultiTexture:
350
+            case MeshModeMultiTexture:
351 351
                 glActiveTextureARB(GL_TEXTURE0_ARB);
352 352
                 glEnable(GL_TEXTURE_2D);
353 353
                 glBindTexture(GL_TEXTURE_2D, mTris[i].texture+1);
@@ -357,10 +357,10 @@ void OpenGLMesh::drawSolid()
357 357
                 glBindTexture(GL_TEXTURE_2D, mTris[i].bumpmap+1);
358 358
                 break;
359 359
 #else
360
-            case OpenGLMeshModeMultiTexture:
360
+            case MeshModeMultiTexture:
361 361
 #endif
362 362
             default:
363
-            case OpenGLMeshModeTexture:
363
+            case MeshModeTexture:
364 364
                 // Bind texture id for textures
365 365
                 glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
366 366
                 glBindTexture(GL_TEXTURE_2D, mTris[i].texture+1);
@@ -375,7 +375,7 @@ void OpenGLMesh::drawSolid()
375 375
                 index = mTris[i].triangles[j*3+k];
376 376
 
377 377
 #ifdef MULTITEXTURE
378
-                if (mMode == OpenGLMeshModeMultiTexture)
378
+                if (mMode == MeshModeMultiTexture)
379 379
                 {
380 380
                     glMultiTexCoord2fvARB(GL_TEXTURE0_ARB,
381 381
                             mTris[i].texcoors[j*3+k]);
@@ -395,7 +395,7 @@ void OpenGLMesh::drawSolid()
395 395
     }
396 396
 
397 397
 #ifdef MULTITEXTURE
398
-    if (mMode == OpenGLMeshModeMultiTexture)
398
+    if (mMode == MeshModeMultiTexture)
399 399
     {
400 400
         glDisable(GL_TEXTURE_2D);
401 401
         glActiveTextureARB(GL_TEXTURE0_ARB);
@@ -408,7 +408,7 @@ void OpenGLMesh::drawSolid()
408 408
 // Public Mutators
409 409
 ////////////////////////////////////////////////////////////
410 410
 
411
-void OpenGLMesh::allocateColors(unsigned int n)
411
+void Mesh::allocateColors(unsigned int n)
412 412
 {
413 413
     if (mColors)
414 414
     {
@@ -426,7 +426,7 @@ void OpenGLMesh::allocateColors(unsigned int n)
426 426
 }
427 427
 
428 428
 
429
-void OpenGLMesh::allocateNormals(unsigned int n)
429
+void Mesh::allocateNormals(unsigned int n)
430 430
 {
431 431
     if (mNormals)
432 432
     {
@@ -444,7 +444,7 @@ void OpenGLMesh::allocateNormals(unsigned int n)
444 444
 }
445 445
 
446 446
 
447
-void OpenGLMesh::allocateRectangles(unsigned int n)
447
+void Mesh::allocateRectangles(unsigned int n)
448 448
 {
449 449
     if (mQuads)
450 450
     {
@@ -462,7 +462,7 @@ void OpenGLMesh::allocateRectangles(unsigned int n)
462 462
 }
463 463
 
464 464
 
465
-void OpenGLMesh::allocateTriangles(unsigned int n)
465
+void Mesh::allocateTriangles(unsigned int n)
466 466
 {
467 467
     if (mTris)
468 468
     {
@@ -480,7 +480,7 @@ void OpenGLMesh::allocateTriangles(unsigned int n)
480 480
 }
481 481
 
482 482
 
483
-void OpenGLMesh::allocateVertices(unsigned int n)
483
+void Mesh::allocateVertices(unsigned int n)
484 484
 {
485 485
     if (mVertices)
486 486
     {
@@ -498,7 +498,7 @@ void OpenGLMesh::allocateVertices(unsigned int n)
498 498
 }
499 499
 
500 500
 
501
-void OpenGLMesh::bufferColorArray(unsigned int colorCount, vec_t *colors)
501
+void Mesh::bufferColorArray(unsigned int colorCount, vec_t *colors)
502 502
 {
503 503
     if (mColors)
504 504
     {
@@ -516,7 +516,7 @@ void OpenGLMesh::bufferColorArray(unsigned int colorCount, vec_t *colors)
516 516
 }
517 517
 
518 518
 
519
-void OpenGLMesh::bufferNormalArray(unsigned int normalCount, vec_t *normals)
519
+void Mesh::bufferNormalArray(unsigned int normalCount, vec_t *normals)
520 520
 {
521 521
     if (mNormals)
522 522
     {
@@ -534,7 +534,7 @@ void OpenGLMesh::bufferNormalArray(unsigned int normalCount, vec_t *normals)
534 534
 }
535 535
 
536 536
 
537
-void OpenGLMesh::bufferTriangles(unsigned int count,
537
+void Mesh::bufferTriangles(unsigned int count,
538 538
         unsigned int *indices, vec_t *texCoords,
539 539
         int *textures, unsigned int *flags)
540 540
 {
@@ -549,7 +549,7 @@ void OpenGLMesh::bufferTriangles(unsigned int count,
549 549
 }
550 550
 
551 551
 
552
-void OpenGLMesh::bufferVertexArray(unsigned int vertexCount, vec_t *vertices)
552
+void Mesh::bufferVertexArray(unsigned int vertexCount, vec_t *vertices)
553 553
 {
554 554
     if (mVertices)
555 555
     {
@@ -564,11 +564,11 @@ void OpenGLMesh::bufferVertexArray(unsigned int vertexCount, vec_t *vertices)
564 564
 
565 565
     mNumVertices = vertexCount;
566 566
     mVertexArray = vertices;
567
-    mFlags |= fOpenGLMesh_UseVertexArray;
567
+    mFlags |= fMesh_UseVertexArray;
568 568
 }
569 569
 
570 570
 
571
-void OpenGLMesh::setColor(unsigned int index,
571
+void Mesh::setColor(unsigned int index,
572 572
         float r, float g, float b, float a)
573 573
 {
574 574
     if (index > mNumColors)
@@ -583,7 +583,7 @@ void OpenGLMesh::setColor(unsigned int index,
583 583
 }
584 584
 
585 585
 
586
-void OpenGLMesh::setColor(unsigned int index, float rgba[4])
586
+void Mesh::setColor(unsigned int index, float rgba[4])
587 587
 {
588 588
     if (index > mNumColors)
589 589
     {
@@ -597,7 +597,7 @@ void OpenGLMesh::setColor(unsigned int index, float rgba[4])
597 597
 }
598 598
 
599 599
 
600
-void OpenGLMesh::setNormal(unsigned int index, float i, float j, float k)
600
+void Mesh::setNormal(unsigned int index, float i, float j, float k)
601 601
 {
602 602
     if (index > mNumNormals)
603 603
     {
@@ -610,7 +610,7 @@ void OpenGLMesh::setNormal(unsigned int index, float i, float j, float k)
610 610
 }
611 611
 
612 612
 
613
-void OpenGLMesh::setVertex(unsigned int index, float x, float y, float z)
613
+void Mesh::setVertex(unsigned int index, float x, float y, float z)
614 614
 {
615 615
     if (index > mNumVertices)
616 616
     {

+ 5
- 26
src/OpenRaider.cpp 파일 보기

@@ -1,23 +1,9 @@
1
-/* -*- Mode: C++; tab-width: 3; indent-tabs-mode: t; c-basic-offset: 3 -*- */
2
-/*================================================================
1
+/*!
2
+ * \file include/OpenRaider.h
3
+ * \brief Main Game Singleton
3 4
  *
4
- * Project : OpenRaider
5
- * Author  : Mongoose
6
- * Website : http://www.westga.edu/~stu7440/
7
- * Email   : stu7440@westga.edu
8
- * Object  : OpenRaider
9
- * License : No use w/o permission (C) 2001 Mongoose
10
- * Comments: This is the main class for OpenRaider
11
- *
12
- *
13
- *           This file was generated using Mongoose's C++
14
- *           template generator script.  <stu7440@westga.edu>
15
- *
16
- *-- History -------------------------------------------------
17
- *
18
- * 2001.05.21:
19
- * Mongoose - Created
20
- =================================================================*/
5
+ * \author Mongoose
6
+ */
21 7
 
22 8
 #include <stdlib.h>
23 9
 #include <string.h>
@@ -121,7 +107,6 @@ OpenRaider::OpenRaider() : SDLSystem()
121 107
     m_texOffset = 0;
122 108
     mLevelTextureOffset = 0;
123 109
     m_testSFX = -1;
124
-    mNoClipping = 0;
125 110
 
126 111
     mText = NULL;
127 112
     m_flags = 0;
@@ -2902,8 +2887,6 @@ void OpenRaider::consoleCommand(char *cmd)
2902 2887
     }
2903 2888
     else if (rc_command("fly", cmd))
2904 2889
     {
2905
-        mNoClipping = worldMoveType_fly;
2906
-
2907 2890
         if (LARA)
2908 2891
         {
2909 2892
             LARA->moveType = worldMoveType_fly;
@@ -2913,8 +2896,6 @@ void OpenRaider::consoleCommand(char *cmd)
2913 2896
     }
2914 2897
     else if (rc_command("walk", cmd))
2915 2898
     {
2916
-        mNoClipping = worldMoveType_walk;
2917
-
2918 2899
         if (LARA)
2919 2900
         {
2920 2901
             LARA->moveType = worldMoveType_walk;
@@ -2924,8 +2905,6 @@ void OpenRaider::consoleCommand(char *cmd)
2924 2905
     }
2925 2906
     else if (rc_command("ghost", cmd))
2926 2907
     {
2927
-        mNoClipping = worldMoveType_noClipping;
2928
-
2929 2908
         if (LARA)
2930 2909
         {
2931 2910
             LARA->moveType = worldMoveType_noClipping;

+ 3
- 3
src/Render.cpp 파일 보기

@@ -1802,13 +1802,13 @@ void Render::drawRoom(RenderRoom *rRoom, bool draw_alpha)
1802 1802
     switch (mMode)
1803 1803
     {
1804 1804
         case modeWireframe:
1805
-            rRoom->mesh.mMode = OpenGLMesh::OpenGLMeshModeWireframe;
1805
+            rRoom->mesh.mMode = Mesh::MeshModeWireframe;
1806 1806
             break;
1807 1807
         case modeSolid:
1808
-            rRoom->mesh.mMode = OpenGLMesh::OpenGLMeshModeSolid;
1808
+            rRoom->mesh.mMode = Mesh::MeshModeSolid;
1809 1809
             break;
1810 1810
         default:
1811
-            rRoom->mesh.mMode = OpenGLMesh::OpenGLMeshModeTexture;
1811
+            rRoom->mesh.mMode = Mesh::MeshModeTexture;
1812 1812
             break;
1813 1813
     }
1814 1814
 

Loading…
취소
저장