Browse Source

Didn't even compile...

Thomas Buck 10 years ago
parent
commit
dc66df2716
3 changed files with 13 additions and 10 deletions
  1. 1
    1
      include/Mesh.h
  2. 2
    0
      include/Room.h
  3. 10
    9
      src/loader/LoaderTR2.cpp

+ 1
- 1
include/Mesh.h View File

21
     struct rectangle_t {
21
     struct rectangle_t {
22
         struct vertex_t a, b, c, d;
22
         struct vertex_t a, b, c, d;
23
         uint16_t texture;
23
         uint16_t texture;
24
-    }
24
+    };
25
 
25
 
26
     Mesh();
26
     Mesh();
27
     ~Mesh();
27
     ~Mesh();

+ 2
- 0
include/Room.h View File

35
     int getAdjoiningRoom(float x, float y, float z,
35
     int getAdjoiningRoom(float x, float y, float z,
36
                          float x2, float y2, float z2);
36
                          float x2, float y2, float z2);
37
 
37
 
38
+    Mesh& getMesh() { return mesh; }
39
+
38
     unsigned int getNumXSectors();
40
     unsigned int getNumXSectors();
39
     unsigned int getNumZSectors();
41
     unsigned int getNumZSectors();
40
     void getPos(float p[3]);
42
     void getPos(float p[3]);

+ 10
- 9
src/loader/LoaderTR2.cpp View File

12
 #include "global.h"
12
 #include "global.h"
13
 #include "Log.h"
13
 #include "Log.h"
14
 #include "Mesh.h"
14
 #include "Mesh.h"
15
+#include "Room.h"
15
 #include "TextureManager.h"
16
 #include "TextureManager.h"
16
 #include "utils/pixel.h"
17
 #include "utils/pixel.h"
17
 #include "loader/LoaderTR2.h"
18
 #include "loader/LoaderTR2.h"
103
         uint32_t dataToFollow = file.readU32();
104
         uint32_t dataToFollow = file.readU32();
104
 
105
 
105
 
106
 
106
-        std::vector<struct vertex> vertices;
107
+        std::vector<struct vertex_t> vertices;
107
 
108
 
108
         uint16_t numVertices = file.readU16();
109
         uint16_t numVertices = file.readU16();
109
         for (unsigned int v = 0; v < numVertices; v++) {
110
         for (unsigned int v = 0; v < numVertices; v++) {
110
-            struct vertex v;
111
+            struct vertex_t vert;
111
             // Vertex coordinates, relative to x/zOffset
112
             // Vertex coordinates, relative to x/zOffset
112
-            v.x = file.read16();
113
-            v.y = file.read16();
114
-            v.z = file.read16();
113
+            vert.x = file.read16();
114
+            vert.y = file.read16();
115
+            vert.z = file.read16();
115
 
116
 
116
-            v.light1 = file.read16();
117
+            vert.light1 = file.read16();
117
 
118
 
118
             // Set of flags for special rendering effects
119
             // Set of flags for special rendering effects
119
             // 0x8000 - Something to do with water surface?
120
             // 0x8000 - Something to do with water surface?
120
             // 0x4000 - Underwater lighting modulation/movement if seen from above
121
             // 0x4000 - Underwater lighting modulation/movement if seen from above
121
             // 0x2000 - Water/Quicksand surface movement
122
             // 0x2000 - Water/Quicksand surface movement
122
             // 0x0010 - Normal?
123
             // 0x0010 - Normal?
123
-            v.attributes = file.readU16();
124
+            vert.attributes = file.readU16();
124
 
125
 
125
-            v.light2 = file.read16(); // Almost always equal to light1
126
+            vert.light2 = file.read16(); // Almost always equal to light1
126
 
127
 
127
-            vertices.push_back(v);
128
+            vertices.push_back(vert);
128
         }
129
         }
129
 
130
 
130
         Room* room = new Room();
131
         Room* room = new Room();

Loading…
Cancel
Save