? debug_output.patch
Index: collision.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/world/collision.cc,v
retrieving revision 1.11
diff -u -p -r1.11 collision.cc
--- collision.cc	3 Oct 2008 17:16:24 -0000	1.11
+++ collision.cc	5 Oct 2008 16:12:00 -0000
@@ -150,7 +150,7 @@ void collision::check_triangle (const tr
             }
         }
         
-        // if we haven’t found a collision already we’ll have to sweep sphere against 
+        // if we haven't found a collision already we'll have to sweep sphere against 
         // points and edges of the triangle. 
         // Note: A collision inside the triangle (the check above) will always happen 
         // before a vertex or edge collision! This is why we can skip the swept test 
@@ -180,7 +180,7 @@ void collision::check_triangle (const tr
                 }
             }
 
-            // check agains edges:
+            // check against edges:
             for (int i = 0; i < 3; i++)
             {
                 const vector3<float> edge = eTriangle.get_edge (i);
@@ -217,11 +217,11 @@ void collision::check_triangle (const tr
         // set result 
         if (foundCollison) 
         { 
-            // distance to collision: ’t’ is time of collision 
+            // distance to collision: 't' is time of collision 
             float distToCollision = t * Velocity.length ();
             
             // Does this triangle qualify for the closest hit? 
-            // It does if it’s the first hit or the closest 
+            // It does if it's the first hit or the closest 
             if (CollisionFound == false || distToCollision < NearestDistance) 
             { 
                 // Collision information nessesary for sliding 
@@ -229,6 +229,8 @@ void collision::check_triangle (const tr
                 IntersectionPoint = collisionPoint;
                 CollisionFound = true;
                 
+                printf ("    col [%.3f, %.3f, %.3f] dist %.5f\n", collisionPoint.x() * Radius.x(), collisionPoint.y() * Radius.y(), collisionPoint.z() * Radius.z(), distToCollision);
+                        
                 // debugging
 #if DEBUG_COLLISION
                 if (Triangle) delete Triangle; 
Index: moving.cc
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/world/moving.cc,v
retrieving revision 1.20
diff -u -p -r1.20 moving.cc
--- moving.cc	5 Oct 2008 09:22:03 -0000	1.20
+++ moving.cc	5 Oct 2008 16:12:01 -0000
@@ -122,9 +122,9 @@ bool moving::collide_with_objects (colli
         min.y() + placeable::width() + (Velocity.y () > 0 ? static_cast<s_int32>(ceil (Velocity.y())) : 0),
         min.z() + placeable::height() + (Velocity.z () > 0 ? static_cast<s_int32>(ceil (Velocity.z())) : 0));
 
-#if DEBUG_COLLISION
+// #if DEBUG_COLLISION
     printf ("   area [%i, %i, %i] - [%i, %i, %i]\n", min.x(), min.y(), min.z(), max.x(), max.y(), max.z());
-#endif
+// #endif
 
     // get all objects in our path
     std::list<chunk_info> objects = Mymap.objects_in_bbox (min, max);
@@ -138,9 +138,9 @@ bool moving::collide_with_objects (colli
             // get the model's current shape, ...
             const placeable_shape * shape = (*model)->current_shape ();
 
-#if DEBUG_COLLISION
-            printf ("  shape [%i, %i, %i] - [%i, %i, %i]\n", i->Min.x(), i->Min.y(), i->Min.z(), shape->length(), shape->width(), shape->height());
-#endif
+// #if DEBUG_COLLISION
+            printf ("  shape [%i, %i, %i] - [%i, %i, %i]\n", i->Min.x() + shape->x(), i->Min.y() + shape->y(), i->Min.z() + shape->z(), i->Min.x() + shape->x() + shape->length(), i->Min.y() + shape->y() + shape->width(), i->Min.z() + shape->z() + shape->height());
+// #endif
             
             // ... and check if collision occurs
             shape->collide (collisionData, i->Min);
@@ -232,15 +232,17 @@ vector3<float> moving::execute_move (col
 // calculate new position
 void moving::update_position ()
 {
-    static float gravity = -4.905;
+    static float gravity = -4.905f;
     
     // calculate radius of ellipsoid
-    const vector3<float> eRadius (placeable::length() / 2.0, width() / 2.0, height() / 2.0);
+    const vector3<float> eRadius (placeable::length() / 2.0f, width() / 2.0f, height() / 2.0f);
     
     // calculate position (= center of ellipse --> + 1) and velocity in eSpace 
     vector3<float> eSpacePosition (Position.x() / eRadius.x() + 1, Position.y() / eRadius.y(), Position.z() / eRadius.z() + 1);
     vector3<float> eSpaceVelocity (Velocity.x() / eRadius.x(), Velocity.y() / eRadius.y(), Velocity.z() / eRadius.z());
     
+    printf ("    pos [%.3f, %.3f, %.3f]\n", eSpacePosition.x() * eRadius.x(), eSpacePosition.y() * eRadius.y(), eSpacePosition.z() * eRadius.z());
+    
     collision collisionData (eSpacePosition, eSpaceVelocity, eRadius);
     vector3<float> finalPosition = execute_move (&collisionData);         
         
@@ -287,6 +289,8 @@ void moving::update_position ()
     }
 #endif
 
+    printf ("    pos [%.3f, %.3f, %.3f]\n", finalPosition.x() * eRadius.x(), finalPosition.y() * eRadius.y(), finalPosition.z() * eRadius.z());    
+
     // apply gravity effect
     eSpaceVelocity = vector3<float> (0.0f, 0.0f, gravity / eRadius.z());
     collisionData.update_movement (finalPosition, eSpaceVelocity);
Index: render_info.h
===================================================================
RCS file: /cvsroot/adonthell/adonthell/src/world/render_info.h,v
retrieving revision 1.2
diff -u -p -r1.2 render_info.h
--- render_info.h	5 Oct 2008 09:22:03 -0000	1.2
+++ render_info.h	5 Oct 2008 16:12:01 -0000
@@ -1,3 +1,32 @@
+/*
+ $Id$
+ 
+ Copyright (C) 2008 Kai Sterker <kaisterker@linuxgames.com>
+ Part of the Adonthell Project http://adonthell.linuxgames.com
+ 
+ Adonthell is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+ 
+ Adonthell is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ GNU General Public License for more details.
+ 
+ You should have received a copy of the GNU General Public License
+ along with Adonthell; if not, write to the Free Software 
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+/**
+ * @file   world/render_info.h
+ * @author Kai Sterker <kaisterker@linuxgames.com>
+ * 
+ * @brief  Declares the render info class.
+ * 
+ */
+
 #ifndef WORLD_RENDERINFO_H
 #define WORLD_RENDERINFO_H
 
