Gizmo3D

gzEnvironment.h

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File         : gzEnvironment.h
00003 // Module       : 
00004 // Description  : Class definition of the gzEnvironment classes
00005 // Author       : Anders Modén      
00006 // Product      : Gizmo3D 2.1.1
00007 //      
00008 // Copyright © 2003- Saab Training Systems AB, Sweden
00009 //          
00010 // NOTE:    Gizmo3D is a high performance 3D Scene Graph and effect visualisation 
00011 //          C++ toolkit for Linux, Mac OS X, Windows (Win32) and IRIX® for  
00012 //          usage in Game or VisSim development.
00013 //
00014 //
00015 // Revision History...                          
00016 //                                  
00017 // Who  Date    Description                     
00018 //                                  
00019 // AMO  990312  Created file    
00020 //
00021 //******************************************************************************
00022 #ifndef __GZ_ENVIRONMENT_H__
00023 #define __GZ_ENVIRONMENT_H__
00024 
00033 #include "gzGroup.h"
00034 #include "gzLight.h"
00035 #include "gzClipPlane.h"
00036 
00037 enum gzFogMode
00038 {
00039     GZ_FOG_MODE_EXP     =GZ_EXP,
00040     GZ_FOG_MODE_EXP2    =GZ_EXP2,
00041     GZ_FOG_MODE_LINEAR  =GZ_LINEAR
00042 };
00043 
00044 //******************************************************************************
00045 // Class    : gzFogInfo
00046 //                                  
00047 // Purpose  : Hold information about the fog.
00048 //                                  
00049 // Notes    : - 
00050 //                                  
00051 // Revision History...                          
00052 //                                  
00053 // Who  Date    Description                     
00054 //                                  
00055 // AMO  990312  Created 
00056 //                                  
00057 //******************************************************************************
00058 class gzFogInfo
00059 {
00060 public:
00062     GZ_GRAPH_EXPORT gzFogInfo();
00063 
00064 private:
00065 
00066     gzVoid activate(gzContext *context);
00067 
00068     static gzVoid deactivate(gzContext *context);
00069 
00070     friend class gzEnvironment;
00071 
00072     gzBool      enabled;
00073     gzFogMode   mode;
00074     gzRGBA      color;
00075     gzFloat     density;
00076     gzFloat     start;
00077     gzFloat     end;
00078 };
00079 
00080 //******************************************************************************
00081 // Class    : gzEnvironment
00082 //                                  
00083 // Purpose  : An environment that hold lights, clipplanes etc.
00084 //                                  
00085 // Notes    : - 
00086 //                                  
00087 // Revision History...                          
00088 //                                  
00089 // Who  Date    Description                     
00090 //                                  
00091 // AMO  990312  Created 
00092 //                                  
00093 //******************************************************************************
00095 
00097 class gzEnvironment : public gzGroup    
00098 {
00099 public:
00101 
00104     GZ_GRAPH_EXPORT gzEnvironment(const gzString & name=GZ_EMPTY_STRING):gzGroup(name){};
00105 
00107     GZ_GRAPH_EXPORT virtual ~gzEnvironment(){};
00108 
00109     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00110 
00111     // ---------- Clone interface ---------------------------------------
00113     GZ_GRAPH_EXPORT virtual gzReference* clone() const;
00114 
00115     // ---------- Action Interface --------------------------------------
00117     GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00118 
00120     GZ_GRAPH_EXPORT virtual gzVoid postTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00121 
00122     // ---------- Light Management interface ----------------------------
00123 
00124     GZ_GRAPH_EXPORT static gzVoid resetLightStateIndex(gzContext *context );
00125     GZ_GRAPH_EXPORT static gzVoid invalidateActiveLightState(gzContext *context );
00126     GZ_GRAPH_EXPORT static gzVoid activateLightStateIndex(gzContext *context ,gzULong index);
00127     GZ_GRAPH_EXPORT static gzVoid setMainLightState(gzContext *context);
00128 
00130 
00135     GZ_GRAPH_EXPORT gzVoid  addLight( gzLight *light);
00136     
00138 
00141     GZ_GRAPH_EXPORT gzVoid  removeLight( gzLight *light);
00142     
00144     GZ_GRAPH_EXPORT gzULong getNumberOfLights();
00145 
00147 
00150     GZ_GRAPH_EXPORT gzLight *getLight(gzULong lightIndex);
00151 
00152 
00153     // ---------- Clip Management interface ----------------------------
00154 
00155     GZ_GRAPH_EXPORT static gzVoid resetClipStateIndex(gzContext *context );
00156     GZ_GRAPH_EXPORT static gzVoid activateClipStateIndex(gzContext *context , gzULong index);
00157 
00159 
00162     GZ_GRAPH_EXPORT gzVoid addClipPlane(gzClip *clip);
00163 
00165 
00168     GZ_GRAPH_EXPORT gzVoid removeClipPlane(gzClip *clip);
00169 
00171     GZ_GRAPH_EXPORT gzULong getNumberOfClipPlanes();
00172 
00174 
00177     GZ_GRAPH_EXPORT gzClip *getClipPlane(gzULong clipIndex);
00178 
00179     // ---------- Fog interface ----------------------------------------
00180 
00181     GZ_GRAPH_EXPORT static gzVoid resetFogStateIndex(gzContext *context);
00182     GZ_GRAPH_EXPORT static gzVoid activateFogStateIndex(gzContext *context , gzULong index);
00183 
00185 
00190     GZ_GRAPH_EXPORT gzVoid useFog( gzBool enable );
00191 
00193 
00198     GZ_GRAPH_EXPORT gzVoid setFogMode( gzFogMode mode );
00199 
00201     GZ_GRAPH_EXPORT gzVoid setFogColor( const gzRGBA &color );
00202 
00204     GZ_GRAPH_EXPORT gzVoid setFogDensity( gzFloat density );
00205 
00207     GZ_GRAPH_EXPORT gzVoid setFogStart( gzFloat start );
00208 
00210     GZ_GRAPH_EXPORT gzVoid setFogEnd( gzFloat end );
00211 
00212 
00213     // ---------- generic environment, immediate activation ------------
00214 
00216     GZ_GRAPH_EXPORT static gzVoid setLightModel(gzContext *context);
00217     
00219     GZ_GRAPH_EXPORT static gzVoid setTwoSideLighting(gzContext *context , gzBool on);
00220     GZ_GRAPH_EXPORT static gzVoid setLocalViewer(gzContext *context,gzBool on);
00221 
00223     GZ_GRAPH_EXPORT static gzVoid setGlobalAmbientColor(gzContext *context , gzFloat red=0.2f , gzFloat green=0.2f, gzFloat blue=0.2f , gzFloat alpha=1.0f );
00224 
00225 private:
00226 
00227     gzLightState        m_lightState;
00228 
00229     gzClipState         m_clipState;
00230 
00231     gzFogInfo           m_fogInfo;
00232 };
00233 
00234 // Declare smart pointer type
00235 GZ_DECLARE_REFPTR(gzEnvironment);
00236 
00237 #endif
00238 

Documentation for Gizmo3D generated at Wed Feb 20 11:54:04 2008 by   Saab Training Systems AB, ¸ (c) 2003-and beyond