Page principale | Hiérarchie des classes | Liste par ordre alphabétique | Liste des composants | Liste des fichiers | Composants | Déclarations | Pages associées

controlEngine.h

Aller à la documentation de ce fichier.
00001 /* ***********************************************************************************
00002         Writer:         Sebastien Bloc
00003         Copyright:      2004
00004         eMail:          sebastien.bloc@free.fr
00005         URL:            http://mignonsoft.free.fr
00006 
00007         This program is free software; you can redistribute it and/or
00008         modify it under the terms of the GNU General Public License
00009         as published by the Free Software Foundation; either version 2
00010         of the License, or (at your option) any later version.
00011 
00012         This program is distributed in the hope that it will be useful,
00013         but WITHOUT ANY WARRANTY; without even the implied warranty of
00014         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015         GNU General Public License for more details.
00016         http://www.gnu.org/copyleft/gpl.html
00017 *********************************************************************************** */
00018 
00023 #ifndef INCLUDE_CONTROL_ENGINE_H
00024 #define INCLUDE_CONTROL_ENGINE_H
00025 
00026 #include "3d.h"
00027 
00028 #include "texture.h"
00029 #include "box.h"
00030 #include "fog.h"
00031 #include "light.h"
00032 #include "region.h"
00033 #include "polygonMode.h"
00034 
00035 #include "openGL_tools.h"
00036 #include "windowTools.h"
00037 #include "primitive.h"
00038 
00039 #include "control.h"
00040 #include "univers.h"
00041 #include "picking.h"
00042 
00043 #include "resource.h"
00044 
00045 #define DEFAULT_DOUBLE_CLICK    0.25    // timeout du DblClk pour les touches
00046 #define SEUIL_MIN_INERTIA               5
00047 #define SEUIL_MAX_INERTIA               15
00048 
00049 // config par default (sauvé dans la registry)
00050 #define DEFAULT_LIGHT_MOVE0             FALSE
00051 #define DEFAULT_LIGHT_MOVE1             FALSE
00052 #define DEFAULT_LIGHT_MOVE2             TRUE
00053 #define DEFAULT_LIGHT_ENABLE0   FALSE
00054 #define DEFAULT_LIGHT_ENABLE1   FALSE 
00055 #define DEFAULT_LIGHT_ENABLE2   TRUE
00056 #define DEFAULT_FOG_ENABLE              FALSE
00057 #define DEFAULT_FOG_START               4.5f
00058 #define DEFAULT_FOG_END                 6.0f
00059 #define DEFAULT_FOG_DENSITY             0.3f
00060 #define DEFAULT_FOG_MODE                fogLinear
00061 #define DEFAULT_ANTIALIASING    TRUE
00062 #define DEFAULT_VIEW_REPERE             FALSE
00063 #define DEFAULT_VIEW_LIGHT              FALSE
00064 #define DEFAULT_PICKING                 TRUE
00065 #define DEFAULT_DELTA                   FALSE
00066 #define DEFAULT_VIEW_BACKGROUND FALSE
00067 #define DEFAULT_VIEW_FPS                FALSE
00068 #define DEFAULT_INERTIA                 TRUE
00069 #define DEFAULT_VIEW_INERTIA    TRUE
00070 #define DEFAULT_FULLSCREEN              FALSE
00071 #define DEFAULT_TITLED                  TRUE
00072 #define DEFAULT_VIEW_REGION             FALSE
00073 #define DEFAULT_POLYGON_BACK    fill
00074 #define DEFAULT_POLYGON_FRONT   fill
00075 #define DEFAULT_XSIZE                   200
00076 #define DEFAULT_YSIZE                   200
00077 #define DEFAULT_TIMER_REFRESH   30
00078 #define DEFAULT_CPU_LIMIT               100
00079 
00081 
00082 typedef enum 
00083 { 
00084         ssRGB,ssDepth,ssBlending,ssLuminance
00085 } TypeScreenShot;
00086 
00087 LRESULT WINAPI ControlEngineProc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
00088 
00094 class ControlEngine 
00095 {
00096 public: // variable de class
00097         Region region;                          
00098         Primitive primitive;            
00099         Fog fog;                                        
00100         Light lights[4];                        
00101         BOOL enableTitle ;                      
00102         BOOL enableFullScreen ;         
00103         BOOL enableAntiAliasing;        
00104         BOOL enableCursor ;                     
00105         BOOL enableRepere;                      
00106         BOOL enableLightView;           
00107         BOOL enableFPS;                         
00108         BOOL enableInertia;                     
00109         BOOL enableViewInertia;         
00110         PolygonMode polygonMode;        
00111         Box3D boxLights[3];                     
00112         GLdouble aspect;                        
00113 
00114         // Handle       
00115         HWND hWnd;                                      
00116         HWND hWndSysTray;                       
00117         HWND hWndConfig;                        
00118         HDC      hDC;                                   
00119         HGLRC hGLRC;                            
00120         HINSTANCE hInst;                        
00121         MyString classNameRender;       
00122         MyString classNameSystray;      
00123         MyString titleName;                     
00124         int dxWin;                                      
00125         int dyWin;                                      
00126         int cpuLimit;                           
00127 
00128         // pour la gestion des region (cf.: CreatePolyPolygonRgn)
00129         GLdouble projMatrix[16];        
00130         GLdouble modelMatrix[16];       
00131         GLint   viewPort[4];            
00132         int     timerRefresh;                   
00133         #define deltaXwin viewPort[2]
00134         #define deltaYwin viewPort[3]
00135         Point3D<GLdouble> beginUnivers; 
00136         BOOL enablePicking;                     
00137         BOOL enableDelta;                       
00138         BOOL enableBackGround;          
00139         Point3D<double> rotate;         
00140         GLdouble translateZ;            
00141         BOOL lightsMove[4];                     
00142         Timer refreshTimer;                     
00143         Univers univers;                        
00144         StateKey key;                           
00145         Picking pickingCursor;          
00146         Picking pickingInertia;         
00147         int usingInertia;                       
00148         EventInertia eventInertia[3];
00149 
00150 public:
00151         ControlEngine();
00152         ~ControlEngine();
00153         void Init3D();
00154         void Start(HINSTANCE hInstance);
00155         void Stop();
00156         void Loop();
00157         void InitViewPort(int deltaX,int deltaY);
00158         void Setup(int deltaX, int deltaY);
00159         void MajScreenView();
00160         void DrawCursors();
00161         void DrawCursor(Point2D<int> pos,Color color,BOOL isDrawInertia);
00162         void Draw2DText(int x,int y,char *text,Color *color=NULL); // if !color ==> black
00163         BOOL DrawOrigineRepere();
00164         BOOL DrawFPS();
00165         float GiveFPS();
00166         void SetPerspective();
00167         void SetupLights();
00168         void SetupTextures();
00169         void SetTimerRefresh(int value); // 10 au plus rapide 60 ==> 15Frm/s 30 ==> 30Frm/s 40 ==> 21Frm/s
00170         void MajLights();
00171         void Draw();
00172         BOOL DrawBackGround();
00173         void DrawScene(BOOL isPicking);
00174         void DrawLight();
00175         void MoveUnivers(Point2D<int> pos);
00176         double ComputeRealZ(double logicZ);
00177 
00178         BOOL RegionAdd(double x,double y);
00179         void OnRefresh(Timer *timer);
00180         LRESULT Proc(HWND hDlg,UINT message,WPARAM wParam,LPARAM lParam);
00181 
00182         void ScreenShotDepth(TypeScreenShot type);
00183 };
00184 
00185 #endif

Généré le Thu Apr 8 18:52:12 2004 pour 3D Controls par doxygen 1.3.6