00001 #ifndef _IGS_CONTROLLER_
00002 #define _IGS_CONTROLLER_
00003
00004 #include "IGS_ImageByte1.h"
00005 #include "IGS_ImageFloat1.h"
00006 #include "IGS_ImageFloat3.h"
00007 #include "math/segment.h"
00008 #include "math/vector4.h"
00009
00010 #ifndef AUX
00011 #define NOAUX
00012 #endif
00013
00014 enum enumGBufferTypes
00015 {
00016 G_PHOTOREALISTIC = 0,
00017 G_COLOR,
00018 G_DEPTH,
00019 G_NORMAL,
00020 G_NORMAL_WRT_CAMERA,
00021 G_UV,
00022 G_SILHOUETTE_ONLY,
00023 G_INVALID
00024 };
00025
00026 extern int gGlGuid;
00027
00028 class IGS_Controller
00029 {
00030 public:
00031 IGS_Controller();
00032 ~IGS_Controller();
00033 void BeginFrame() const;
00034 Segment ConvertMouseClick( const int x, const int y ) const;
00035 #ifndef NOAUX
00036 void CreateInitialWindow() const;
00037 #endif
00038 void DoLighting() const;
00039 void EndFrame() const;
00040 unsigned int FrameNumber() const;
00041 Vector4 GetCameraDirection() const;
00042 float GetSilhouetteEdgeWidth() const;
00043 enumGBufferTypes GetRenderStyle() const;
00044 double GetWindowXMax() const;
00045 double GetWindowXMin() const;
00046 double GetWindowYMax() const;
00047 double GetWindowYMin() const;
00048 void Process();
00049 void RegisterInitialWindow( HWND hwnd );
00050 void ScreenCapture();
00051 void SetCameraLookat( const Vector4& vector );
00052 void SetCameraPosition( const Vector4& vector );
00053 void SetClearColor( IGS_Color& color );
00054 void SetRenderSilhouettes( bool onOff );
00055 void SetRenderStyle( enumGBufferTypes style );
00056 void SetSilhouetteEdgeWidth( const float width );
00057 bool SettingLightingEnabled() const;
00058 bool SettingNormalsRelativeToCamera() const;
00059 bool SettingRenderNormals() const;
00060 bool SettingRenderNormalsAsColors() const;
00061 bool SettingRenderSilhouettes() const;
00062 void SetWindowResolution( const int xres, const int yres );
00063 void SetWindowRect
00064 (
00065 const double xMin,
00066 const double xMax,
00067 const double yMin,
00068 const double yMax,
00069 const double zMin = -100,
00070 const double zMax = 100
00071 );
00072
00073
00074 IGS_ImageFloat3 mGbufferColor;
00075 IGS_ImageFloat1 mGbufferDepth;
00076
00077
00078 protected:
00079 mutable unsigned int mFrameNumber;
00080 Vector4 mCameraEye;
00081 Vector4 mCameraTarget;
00082 Vector4 mCameraUp;
00083 unsigned char* mColorDefault;
00084
00085 #ifndef NOGL
00086 GLclampf mColorClear[ 4 ];
00087 GLbitfield mGlClearBits;
00088 #endif
00089 #ifdef WIN32
00090 mutable HDC mHdc;
00091 HGLRC mHglrc;
00092 HWND mHwnd;
00093 #endif
00094 bool mSettingAlphaBlendingOn;
00095 bool mSettingAnimationOn;
00096 bool m_SettingAntiAliasingOn;
00097 int mSettingDebugMessageLevel;
00098 bool mSettingDepthTestingOn;
00099 bool mSettingDoubleBufferingOn;
00100 bool mSettingLightingEnabled;
00101 bool mSettingNormalsRelativeToCamera;
00102 float m_SettingPointSize;
00103 bool mSettingRenderNormals;
00104 bool mSettingRenderNormalsAsColors;
00105 bool mSettingRenderSilhouettes;
00106 enumGBufferTypes mSettingRenderStyle;
00107 #ifndef NOGL
00108 GLenum mSettingShadingModel;
00109 #endif
00110 float mSettingSilhouetteEdgeWidth;
00111 bool mSettingTexturingOn;
00112 double m_SettingWindowXmin;
00113 double m_SettingWindowXmax;
00114 double m_SettingWindowYmin;
00115 double m_SettingWindowYmax;
00116 double m_SettingWindowZmin;
00117 double m_SettingWindowZmax;
00118 bool mStateScreenCaptureDone;
00119 int mWindowResolutionX;
00120 int mWindowResolutionY;
00121 };
00122
00123 #endif