tgEngine.h
Go to the documentation of this file.
00001 
00010 #ifndef TG_ENGINE
00011 #define TG_ENGINE
00012 
00013 #include <blort/TomGine/headers.h>
00014 
00015 #include <blort/GLWindow/GLWindow.h>
00016 #include <blort/TomGine/tgCamera.h>
00017 #include <blort/TomGine/tgLighting.h>
00018 #include <blort/TomGine/tgRenderModel.h>
00019 #include <blort/TomGine/tgPose.h>
00020 #include <blort/TomGine/tgTimer.h>
00021 #include <blort/TomGine/tgVector3.h>
00022 #include <blort/TomGine/tgMathlib.h>
00023 
00024 namespace TomGine{
00025 
00027 class tgEngine
00028 {
00029 private:
00030         unsigned m_width;
00031         unsigned m_height;
00032         float m_far;
00033         float m_near;
00034         
00035         float m_input_rotation_speed;
00036         float m_input_translation_speed;
00037         float m_input_zoom_speed;
00038         
00039         blortGLWindow::GLWindow* m_window;
00040         tgTexture* m_background_image;
00041         
00042         tgCamera                m_cam[6];
00043         tgCamera                m_camera;
00044         tgCamera                m_cam_ortho;
00045 
00046         tgLighting              m_lighting;
00047         tgLight                 m_light0;
00048         tgTimer                 m_timer;
00049         tgVector3               m_cor;                  
00050         
00051         int m_mouse_pos[2];
00052         bool p_pressed;
00053         
00054         float m_frametime;
00055         bool m_bfc;
00056         bool m_button_left, m_button_middle, m_button_right;
00057         bool m_wireframe;
00058         bool m_smoothshading;
00059         bool m_show_background_image;
00060         bool m_flip_background_image;
00061         
00062 //      FTTextureFont* m_font_tf;
00063         tgFont m_font;
00064         
00065         void DrawBackgroundImage();
00066         
00067 public:
00075         tgEngine(       unsigned width=640,
00076                                 unsigned height=480,
00077                                 float far=10.0f,
00078                                 float near=0.01f,
00079                                 const char* name="TomGine",
00080                                 bool bfc=false);
00081                                 
00082         ~tgEngine();
00083         
00085         void Welcome();
00086         
00090         bool Update();
00091         bool Update(float &fTime);
00092         bool Update(std::vector<blortGLWindow::Event> &eventlist);
00093         bool Update(float &fTime, std::vector<blortGLWindow::Event> &eventlist);
00094         
00095         
00097         bool InputControl(blortGLWindow::Event &event);
00098         
00100         void DrawCoordinates();
00101         
00103         void SetCamera(tgCamera cam);
00104         void UpdateCameraViews(tgCamera cam);
00105         
00107         void SetCenterOfRotation(float x, float y, float z);
00108         
00110         void Activate3D();
00111 
00113         void Activate2D();
00114         
00116         void Swap();
00117         
00118         void LoadBackgroundImage(unsigned char* image_data, int width, int height, GLenum format=GL_RGB, bool flip=false);
00119         void UnloadBackgroundImage();
00120         
00122         vec3 GetCameraPosition(){ tgVector3 tgv = m_camera.GetPos(); return vec3(tgv.x, tgv.y, tgv.z); }
00123 
00125         void GetCamera0(tgCamera &cam){ cam = m_camera; }
00126         
00128         bool GetWireframeMode(){ return m_wireframe; }
00129         
00130         void PrintText3D(std::string text, vec3 pos, int size=16);
00131         void PrintText2D(std::string text, vec2 pos, int size=16);
00132         
00134         void SetInputRotationSpeed(float v){ m_input_rotation_speed = v; }
00135         void SetInputTranslationSpeed(float v){ m_input_translation_speed = v; }
00136         void SetInputZoomSpeed(float v){ m_input_zoom_speed = v; }
00137         void SetSpeeds(float rotation, float translation, float zoom){ 
00138                 m_input_rotation_speed  = rotation;
00139                 m_input_translation_speed = translation;
00140                 m_input_zoom_speed = zoom;
00141         }
00142                 
00143         tgVector3 Get3DPointFrom2D(int x, int y);
00144         bool GetNewPoint(vec3& v);
00145 
00146 };
00147 
00148 } // namespace TomGine
00149 
00150 #endif


blort
Author(s): Thomas Mörwald , Michael Zillich , Andreas Richtsfeld , Johann Prankl , Markus Vincze , Bence Magyar
autogenerated on Wed Aug 26 2015 15:24:12