GraphicalObject.h

00001 #ifndef GRAPHICAL_OBJECT_
00002 #define GRAPHICAL_OBJECT_
00003 
00004 #include <stdio.h>
00005 #include <windows.h>
00006 #include <GL/gl.h>
00007 #include <GL/glu.h>
00008 #include <GL/glut.h>
00009 
00010 #include "Camera.h"
00011 #include "RawObject.h"
00012 
00013 #define C_OUTSIDE                                       -1
00014 #define C_PARTIAL                                       0
00015 #define C_INSIDE                                        1
00016 
00017 #define C_NONE                                          0
00018 #define C_SPHERE                                        1
00019 #define C_BOUNDING_BOX                          2
00020 #define C_MIXED                                         3
00021 
00034 class GraphicalObject
00035 {
00036 
00037 //--------------------------------------------------------------------------------------------------------
00038 //                                                                      GENERAL
00039 //--------------------------------------------------------------------------------------------------------
00040 public:
00046         GraphicalObject (RawObject * raw_object);
00047 
00051         ~GraphicalObject ();
00052 
00066         virtual void Draw (int time, Camera * camera, Camera * monitor, bool show_bounding_volume, int culling_mode, bool level_of_detail) = NULL;
00067 
00071         PositionPath * position;
00072 
00080         void CalculateRelativePositions ();
00081 
00088         void ApplyTransformation (const Position & position, bool rotation);
00089 
00096         void UndoTransformation (const Position & position, bool rotation);
00097 
00101         virtual void PrintToConsole () = NULL;
00102 
00103 
00104 protected:
00108         typedef struct ChildListElem
00109         {
00110                 ChildListElem * next;           
00111                 GraphicalObject * object;       
00112         }ChildList;
00113 
00115         ChildList * first_child;
00116 
00118         RawObject * raw_object;
00119 
00120 private:
00124         GraphicalObject ();
00125 
00126 
00127 //--------------------------------------------------------------------------------------------------------
00128 //                                                                      CULLING RELATED
00129 //--------------------------------------------------------------------------------------------------------
00130 public:
00132         double bounding_radius;
00133 
00135         BoundingBox bounding_box;
00136 
00143         void UpdateBoundingRadius (bool recurse);
00144 
00155         void UpdateBoundingBox (bool recurse);
00156 
00157 protected:
00167         int CullObject (Camera * camera, Camera * monitor, int culling_mode, bool show_volume);
00168 
00173         virtual void ComputeBoundingRadius () = NULL;
00174 
00179         virtual void ComputeBoundingBox () = NULL;
00180 
00181 private:
00183         BoxCorners      box_corners;
00184 
00186         int last_outside;
00187 
00191         void UpdateBoxCorners ();
00192 
00200         int SphereCulling (Camera * camera, Camera * monitor);
00201 
00208         int SphereCulling2 (Camera * camera);
00209 
00217         int BoxCulling (Camera * camera, Camera * monitor);
00218 
00225         int BoxCulling2 (Camera * camera);
00226 
00233         void DrawBoundingSphere (int culling_result);
00234 
00241         void DrawBoundingBox (int culling_result);
00242 };
00243 
00244 #endif

Generated on Sun Jul 2 13:20:39 2006 for Demo by  doxygen 1.4.6-NO