Browse Source

Removed unused code

Thomas Buck 10 years ago
parent
commit
85535e169d
8 changed files with 9 additions and 60 deletions
  1. 2
    2
      README.md
  2. 0
    16
      include/Render.h
  3. 2
    2
      include/utils/math.h
  4. 2
    4
      include/utils/tga.h
  5. 0
    6
      src/OpenRaider.cpp
  6. 0
    4
      src/Render.cpp
  7. 2
    26
      src/utils/math.cpp
  8. 1
    0
      src/utils/tga.cpp

+ 2
- 2
README.md View File

11
 ## Configuration
11
 ## Configuration
12
 
12
 
13
 OpenRaider needs some configuration files, and level data and assets from custom levels or the Tomb Raider games.
13
 OpenRaider needs some configuration files, and level data and assets from custom levels or the Tomb Raider games.
14
-These are stored in `~/.OpenRaider`. Running the included `setup.sh` will create/copy the necessary files and directories.
14
+These are stored in `~/.OpenRaider`. Running `make setup` will create/copy the necessary files and directories.
15
 
15
 
16
 You still need to add level files in `~/.OpenRaider/paks/` and add them to `~/.OpenRaider/OpenRaider.init`.
16
 You still need to add level files in `~/.OpenRaider/paks/` and add them to `~/.OpenRaider/OpenRaider.init`.
17
 Dust off your old Tomb Raider CDs or grab some [custom levels](http://www.aspidetr.com/levels/yvel-woods-v1-5/) from the interwebs.
17
 Dust off your old Tomb Raider CDs or grab some [custom levels](http://www.aspidetr.com/levels/yvel-woods-v1-5/) from the interwebs.
79
 ### Configuration file
79
 ### Configuration file
80
 
80
 
81
 OpenRaider will try to load `~/.OpenRaider/OpenRaider.init` or, if it doesn't exist, `OpenRaider.init` from the current directory.
81
 OpenRaider will try to load `~/.OpenRaider/OpenRaider.init` or, if it doesn't exist, `OpenRaider.init` from the current directory.
82
-Running `make setup` or the `cmake/setup.sh` script will create a minimal configuration in your home directory.
82
+Running `make setup` will create a minimal configuration in your home directory.
83
 
83
 
84
 The configuration file format is very simple:
84
 The configuration file format is very simple:
85
 * Anything following a `#` up to the next `\n` will be ignored.
85
 * Anything following a `#` up to the next `\n` will be ignored.

+ 0
- 16
include/Render.h View File

37
         typeDirectional = 3  //!< Directional light
37
         typeDirectional = 3  //!< Directional light
38
     } LightType;
38
     } LightType;
39
 
39
 
40
-    // These aren't used anywhere? -- xythobuz
41
-    //float mAmbient[4]; //! Ambient color
42
-    //float mDiffuse[4]; //! Diffuse color
43
-    //float mSpecular[4]; //! Specular color
44
-
45
     vec4_t mPos; //! Light position in 3 space
40
     vec4_t mPos; //! Light position in 3 space
46
     vec3_t mDir; //! Light direction
41
     vec3_t mDir; //! Light direction
47
     float mAtt;
42
     float mAtt;
62
     RenderRoom() {
57
     RenderRoom() {
63
         room = 0x0;
58
         room = 0x0;
64
         dist = 0.0f;
59
         dist = 0.0f;
65
-        center[0] = center[1] = center[2] = 0.0f;
66
     }
60
     }
67
 
61
 
68
     /*!
62
     /*!
73
         //lights.erase();
67
         //lights.erase();
74
     }
68
     }
75
 
69
 
76
-    /*!
77
-     * \brief Computes central point of room.
78
-     * Result is stored in center member variable.
79
-     */
80
-    void computeCenter() {
81
-        if (room)
82
-            helMidpoint3v(room->bbox_min, room->bbox_max, center);
83
-    }
84
-
85
     vec_t dist;             //!< Distance to near plane, move to room?
70
     vec_t dist;             //!< Distance to near plane, move to room?
86
-    vec3_t center;          //!< Center of bbox, move to room?
87
     Vector<Light *> lights; //!< List of lights in this room
71
     Vector<Light *> lights; //!< List of lights in this room
88
     Mesh mesh;              //!< OpenGL mesh that represents this room
72
     Mesh mesh;              //!< OpenGL mesh that represents this room
89
 
73
 

+ 2
- 2
include/utils/math.h View File

8
 
8
 
9
 #include <math.h>
9
 #include <math.h>
10
 
10
 
11
-#ifndef _MATMATH_H
12
-#define _MATMATH_H
11
+#ifndef _UTILS_MATH_H
12
+#define _UTILS_MATH_H
13
 
13
 
14
 #define HEL_PI           ((float)M_PI) //!< pi
14
 #define HEL_PI           ((float)M_PI) //!< pi
15
 #define HEL_2_PI         (HEL_PI * 2.0f) //!< pi*2
15
 #define HEL_2_PI         (HEL_PI * 2.0f) //!< pi*2

+ 2
- 4
include/utils/tga.h View File

5
  * \author Mongoose
5
  * \author Mongoose
6
  * \author xythobuz
6
  * \author xythobuz
7
  */
7
  */
8
-#ifndef _TGA_H
9
-#define _TGA_H
10
-
11
-#include <stdio.h>
8
+#ifndef _UTILS_TGA_H
9
+#define _UTILS_TGA_H
12
 
10
 
13
 /*!
11
 /*!
14
  * \brief Possible TGA image types
12
  * \brief Possible TGA image types

+ 0
- 6
src/OpenRaider.cpp View File

2259
     room_mesh_t *r_mesh = NULL;
2259
     room_mesh_t *r_mesh = NULL;
2260
     RenderRoom *rRoom = NULL;
2260
     RenderRoom *rRoom = NULL;
2261
 #ifdef MATRIX_TRANSFORMS
2261
 #ifdef MATRIX_TRANSFORMS
2262
-    //matrix_t transform;
2263
     Matrix transform;
2262
     Matrix transform;
2264
 #endif
2263
 #endif
2265
 
2264
 
2293
 
2292
 
2294
     // Mongoose 2002.04.03, Setup 3d transform
2293
     // Mongoose 2002.04.03, Setup 3d transform
2295
 #ifdef MATRIX_TRANSFORMS
2294
 #ifdef MATRIX_TRANSFORMS
2296
-    //mtkMatrixIdentity(transform);
2297
-    //mtkMatrixTranslate(transform,
2298
-    //                       r_mesh->pos[0], r_mesh->pos[1], r_mesh->pos[2]);
2299
     transform.setIdentity();
2295
     transform.setIdentity();
2300
     transform.translate(r_mesh->pos);
2296
     transform.translate(r_mesh->pos);
2301
-#else
2302
 #endif
2297
 #endif
2303
 
2298
 
2304
     // Setup portals
2299
     // Setup portals
2328
 
2323
 
2329
             // Relative coors in vis portals
2324
             // Relative coors in vis portals
2330
 #ifdef MATRIX_TRANSFORMS
2325
 #ifdef MATRIX_TRANSFORMS
2331
-            //mtkMatrixTransform(transform, portal->vertices[j]);
2332
             transform.multiply3v(portal->vertices[j], portal->vertices[j]);
2326
             transform.multiply3v(portal->vertices[j], portal->vertices[j]);
2333
 #else
2327
 #else
2334
             portal->vertices[j][0] += r_mesh->pos[0];
2328
             portal->vertices[j][0] += r_mesh->pos[0];

+ 0
- 4
src/Render.cpp View File

807
             v[1] = u[1] + (9000.0f * sinf(LARA->angles[2]));
807
             v[1] = u[1] + (9000.0f * sinf(LARA->angles[2]));
808
             v[2] = u[2] + (9000.0f * cosf(LARA->angles[1]));
808
             v[2] = u[2] + (9000.0f * cosf(LARA->angles[1]));
809
 
809
 
810
-            //mtkVectorSubtract(u, v, t);
811
-            //mtkVectorSubtract(u, curPos, s);
812
-            //printf("* %f rad\n", LARA->angles[1]);
813
-
814
             // Test tracing of aim
810
             // Test tracing of aim
815
             renderTrace(0, u, v); // v = target
811
             renderTrace(0, u, v); // v = target
816
         }
812
         }

+ 2
- 26
src/utils/math.cpp View File

16
 
16
 
17
 bool equalEpsilon(vec_t a, vec_t b) {
17
 bool equalEpsilon(vec_t a, vec_t b) {
18
     vec_t epsilon = FLT_EPSILON;
18
     vec_t epsilon = FLT_EPSILON;
19
-    if (fabs(a - b) <= (((fabs(b) > fabs(a)) ? fabs(b) : fabs(a)) * epsilon))
19
+    if (fabs(a - b) <= (fmax(fabs(a), fabs(b)) * epsilon))
20
         return true;
20
         return true;
21
     return false;
21
     return false;
22
 }
22
 }
41
     pB = Vector3d(p2);
41
     pB = Vector3d(p2);
42
 
42
 
43
     // Find normal
43
     // Find normal
44
-    //mtkVectorSubtract(polygon[1], polygon[0], a);
45
     a = Vector3d(polygon[1]) - Vector3d(polygon[0]);
44
     a = Vector3d(polygon[1]) - Vector3d(polygon[0]);
46
-    //mtkVectorSubtract(polygon[2], polygon[0], b);
47
     b = Vector3d(polygon[2]) - Vector3d(polygon[0]);
45
     b = Vector3d(polygon[2]) - Vector3d(polygon[0]);
48
     normal = Vector3d::cross(a, b);
46
     normal = Vector3d::cross(a, b);
49
-    //mtkVectorCrossProduct(a, b, normal);
50
     normal.normalize();
47
     normal.normalize();
51
-    //mtkVectorNormalize(normal, normal);
52
 
48
 
53
     // find D
49
     // find D
54
     //d = (normal[0] * polygon[0][0] -
50
     //d = (normal[0] * polygon[0][0] -
59
             normal.mVec[2] * polygon[0][2]);
55
             normal.mVec[2] * polygon[0][2]);
60
 
56
 
61
     // line segment parallel to plane?
57
     // line segment parallel to plane?
62
-    //mtkVectorSubtract(p2, p1, a); // cache p2 - p1 => a
63
     a = pB - pA;
58
     a = pB - pA;
64
 
59
 
65
     //denominator = (normal[0] * a[0] +
60
     //denominator = (normal[0] * a[0] +
88
 
83
 
89
 
84
 
90
     // See if the intercept is bound by polygon by winding number
85
     // See if the intercept is bound by polygon by winding number
91
-#ifdef WINDING_NUMBERS_TRIANGLE
92
-    mtkVectorSubtract(polygon[0], intersect, a);
93
-    mtkVectorNormalize(a, a);
94
-    mtkVectorSubtract(polygon[1], intersect, b);
95
-    mtkVectorNormalize(b, b);
96
-    mtkVectorSubtract(polygon[2], intersect, c);
97
-    mtkVectorNormalize(c, c);
98
-
99
-    t0 = mtkVectorDotProduct(a, b);
100
-    t1 = mtkVectorDotProduct(b, c);
101
-    t2 = mtkVectorDotProduct(c, a);
102
-
103
-    total = HEL_RAD_TO_DEG(acos(t0) + acos(t1) + acos(t2));
104
-
105
-    if (total - 360 < 0.0)
106
-        return 0;
107
-#else // assume convex polygons here for sure
108
-    //mtkVectorSubtract(intersect, polygon[0], a);
109
-    //theta = mtkVectorDotProduct(a, normal);
86
+    // assume convex polygons here for sure
110
     double theta = Vector3d::dot(b - Vector3d(polygon[0]), normal); // b = intersect
87
     double theta = Vector3d::dot(b - Vector3d(polygon[0]), normal); // b = intersect
111
 
88
 
112
     if (theta >= 90.0) // Yeah I know
89
     if (theta >= 90.0) // Yeah I know
113
         return 0;
90
         return 0;
114
-#endif
115
 
91
 
116
     return 1;
92
     return 1;
117
 }
93
 }

+ 1
- 0
src/utils/tga.cpp View File

8
  * \author xythobuz
8
  * \author xythobuz
9
  */
9
  */
10
 
10
 
11
+#include <stdio.h>
11
 #include <string.h>
12
 #include <string.h>
12
 #include <stdarg.h>
13
 #include <stdarg.h>
13
 
14
 

Loading…
Cancel
Save