Blender  V2.59
BSP_GhostTest3D.h
Go to the documentation of this file.
00001 
00029 #ifndef BSP_GhostTest_h
00030 #define BSP_GhostTest_h
00031 
00032 #include "GHOST_IEventConsumer.h"
00033 #include "MT_Vector3.h"
00034 #include "BSP_TMesh.h"
00035 #include "BSP_MeshDrawer.h"
00036 
00037 #include <vector>
00038 
00039 class GHOST_IWindow;
00040 class GHOST_ISystem;
00041 
00042 
00043 class BSP_GhostTestApp3D :
00044 public GHOST_IEventConsumer
00045 {
00046 public :
00047         // Construct an instance of the application;
00048 
00049         BSP_GhostTestApp3D(
00050         );
00051 
00052         // initialize the applicaton
00053 
00054                 bool
00055         InitApp(
00056         );
00057 
00058         // Run the application untill internal return.
00059                 void
00060         Run(
00061         );
00062         
00063         ~BSP_GhostTestApp3D(
00064         );
00065 
00066                 void
00067         SetMesh(
00068                 MEM_SmartPtr<BSP_TMesh> mesh
00069         );
00070 
00071 private :
00072         
00073         struct BSP_RotationSetting {
00074                 MT_Scalar m_angle_x;
00075                 MT_Scalar m_angle_y;
00076                 int x_old;
00077                 int y_old;
00078                 bool m_moving;
00079         };
00080 
00081         struct BSP_TranslationSetting {
00082                 MT_Scalar m_t_x;
00083                 MT_Scalar m_t_y;
00084                 MT_Scalar m_t_z;
00085                 int x_old;
00086                 int y_old;
00087                 bool m_moving;
00088         };
00089 
00090         // Return the transform of object i
00091 
00092                 MT_Transform
00093         GetTransform(
00094                 int active_object
00095         );
00096 
00097         // Perform an operation between the first two objects in the
00098         // list
00099         
00100                 void
00101         Operate(
00102                 int type
00103         );
00104         
00105         // Swap mesh i and settings with the last mesh in list.
00106 
00107                 void
00108         Swap(
00109                 int i
00110         );
00111 
00112                 void
00113         DrawPolies(
00114         );
00115 
00116                 void
00117         UpdateFrame(
00118         );
00119         
00120                 MT_Vector3
00121         UnProject(
00122                 const MT_Vector3 & vec
00123         );
00124 
00125         // Create a frustum and projection matrix to
00126         // look at the bounding box 
00127 
00128                 void
00129         InitOpenGl(
00130                 const MT_Vector3 &min,
00131                 const MT_Vector3 &max
00132         );
00133 
00134 
00135         // inherited from GHOST_IEventConsumer
00136                 bool 
00137         processEvent(
00138                 GHOST_IEvent* event
00139         );
00140 
00141         GHOST_IWindow *m_window;
00142         GHOST_ISystem *m_system;
00143 
00144         bool m_finish_me_off;
00145 
00146         // List of current meshes.
00147         std::vector< MEM_SmartPtr<BSP_TMesh> > m_meshes;
00148 
00149         std::vector< BSP_RotationSetting> m_rotation_settings;
00150         std::vector< BSP_TranslationSetting> m_translation_settings;
00151         std::vector< MT_Scalar> m_scale_settings;
00152         std::vector< int> m_render_modes;
00153 
00154         int m_current_object;
00155 
00156 
00157 };
00158 
00159 #endif
00160