Quellcode durchsuchen

Fixed wrong entity rotation

Thomas Buck vor 10 Jahren
Ursprung
Commit
93e008178b
3 geänderte Dateien mit 11 neuen und 22 gelöschten Zeilen
  1. 2
    1
      ChangeLog.md
  2. 3
    4
      src/Entity.cpp
  3. 6
    17
      src/SkeletalModel.cpp

+ 2
- 1
ChangeLog.md Datei anzeigen

3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
3
 ## OpenRaider (0.1.3) xythobuz <xythobuz@xythobuz.de>
4
 
4
 
5
     [ 20140617 ]
5
     [ 20140617 ]
6
-    * Finally fixed SkeletalModel bug introduced a month ago
6
+    * Finally fixed SkeletalModel bugs introduced a month ago
7
+      (animations and rotations are *mostly* correct now)
7
     * Reimplemented *animate* command
8
     * Reimplemented *animate* command
8
 
9
 
9
     [ 20140615 ]
10
     [ 20140615 ]

+ 3
- 4
src/Entity.cpp Datei anzeigen

17
     tr2_moveable_t *moveable = tr.Moveable();
17
     tr2_moveable_t *moveable = tr.Moveable();
18
     tr2_item_t *item = tr.Item();
18
     tr2_item_t *item = tr.Item();
19
 
19
 
20
-    vec_t yaw = ((item[i].angle >> 14) & 0x03);
21
-    yaw *= 90;
22
-
23
     pos[0] = item[i].x;
20
     pos[0] = item[i].x;
24
     pos[1] = item[i].y;
21
     pos[1] = item[i].y;
25
     pos[2] = item[i].z;
22
     pos[2] = item[i].z;
26
     angles[0] = 0;
23
     angles[0] = 0;
27
-    angles[1] = yaw;
24
+    angles[1] = OR_DEG_TO_RAD(((item[i].angle >> 14) & 0x03) * 90.0f);
28
     angles[2] = 0;
25
     angles[2] = 0;
29
     objectId = moveable[index].object_id;
26
     objectId = moveable[index].object_id;
30
     moveType = MoveTypeWalk;
27
     moveType = MoveTypeWalk;
46
     glPushMatrix();
43
     glPushMatrix();
47
     glTranslatef(pos[0], pos[1], pos[2]);
44
     glTranslatef(pos[0], pos[1], pos[2]);
48
     glRotatef(OR_RAD_TO_DEG(angles[1]), 0, 1, 0);
45
     glRotatef(OR_RAD_TO_DEG(angles[1]), 0, 1, 0);
46
+    glRotatef(OR_RAD_TO_DEG(angles[0]), 1, 0, 0);
47
+    glRotatef(OR_RAD_TO_DEG(angles[2]), 0, 0, 1);
49
     getWorld().getSkeletalModel(skeletalModel).display(animationFrame, boneFrame);
48
     getWorld().getSkeletalModel(skeletalModel).display(animationFrame, boneFrame);
50
     glPopMatrix();
49
     glPopMatrix();
51
 
50
 

+ 6
- 17
src/SkeletalModel.cpp Datei anzeigen

280
         tag.getOffset(off);
280
         tag.getOffset(off);
281
 
281
 
282
         if (a == 0) {
282
         if (a == 0) {
283
-            if (!equalEpsilon(rot[1], 0.0f))
284
-                glRotatef(rot[1], 0, 1, 0);
285
-
286
-            if (!equalEpsilon(rot[0], 0.0f))
287
-                glRotatef(rot[0], 1, 0, 0);
288
-
289
-            if (!equalEpsilon(rot[2], 0.0f))
290
-                glRotatef(rot[2], 0, 0, 1);
283
+            glRotatef(rot[1], 0, 1, 0);
284
+            glRotatef(rot[0], 1, 0, 0);
285
+            glRotatef(rot[2], 0, 0, 1);
291
         } else {
286
         } else {
292
             if (tag.getFlag() & 0x01)
287
             if (tag.getFlag() & 0x01)
293
                 glPopMatrix();
288
                 glPopMatrix();
296
                 glPushMatrix();
291
                 glPushMatrix();
297
 
292
 
298
             glTranslatef(off[0], off[1], off[2]);
293
             glTranslatef(off[0], off[1], off[2]);
299
-
300
-            if (!equalEpsilon(rot[1], 0.0f))
301
-                glRotatef(rot[1], 0, 1, 0);
302
-
303
-            if (!equalEpsilon(rot[0], 0.0f))
304
-                glRotatef(rot[0], 1, 0, 0);
305
-
306
-            if (!equalEpsilon(rot[2], 0.0f))
307
-                glRotatef(rot[2], 0, 0, 1);
294
+            glRotatef(rot[1], 0, 1, 0);
295
+            glRotatef(rot[0], 1, 0, 0);
296
+            glRotatef(rot[2], 0, 0, 1);
308
         }
297
         }
309
 
298
 
310
         // Draw layered lara in TR4 (2 meshes per tag)
299
         // Draw layered lara in TR4 (2 meshes per tag)

Laden…
Abbrechen
Speichern