Blender V2.61 - r43446

BSP_GhostTest3D.h

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