Gizmo3D

gzLod.h

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File         : gzLod.h
00003 // Module       : 
00004 // Description  : Class definition of the gzLod class
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  990516  Created file 
00020 // AMO  011004  Added access to LOD levels array    
00021 //
00022 //******************************************************************************
00023 #ifndef __GZ_LOD_H__
00024 #define __GZ_LOD_H__
00025 
00032 #include "gzGroup.h"
00033 #include "gzNodeAction.h"
00034 
00035 
00036 class gzLodLevel
00037 {
00038 public:
00040     gzLodLevel():m_near_distance(0),m_far_distance(GZ_REAL_MAX),m_near_fade_distance(0),m_far_fade_distance(0),m_enabled(TRUE),m_lodEnableMask(0),m_lodDisableMask(0){};
00041 
00042     //Destructor
00043     virtual ~gzLodLevel(){};
00044 
00045     gzReal      m_near_distance;
00046     gzReal      m_far_distance;
00047     gzReal      m_near_fade_distance;
00048     gzReal      m_far_fade_distance;
00049     gzULong     m_lodEnableMask;
00050     gzULong     m_lodDisableMask;
00051     gzBool      m_enabled:1;
00052 };
00053 
00054 //******************************************************************************
00055 // Class    : gzLod
00056 //                                  
00057 // Purpose  : -
00058 //                                  
00059 // Notes    : - 
00060 //                                  
00061 // Revision History...                          
00062 //                                  
00063 // Who  Date    Description                     
00064 //                                  
00065 // AMO  990516  Created 
00066 //                                  
00067 //******************************************************************************
00068 class gzLod : public gzGroup
00069 {
00070 public:
00072 
00075     GZ_GRAPH_EXPORT gzLod(const gzString & name=GZ_EMPTY_STRING);
00076 
00078     GZ_GRAPH_EXPORT virtual ~gzLod(){};
00079 
00080     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00081 
00082 
00083     // ---------- Clone interface ---------------------------------------
00085     GZ_GRAPH_EXPORT virtual gzReference* clone() const;
00086 
00087     // ---------- gzLod commands ----------------------------------------
00088 
00090 
00105     GZ_GRAPH_EXPORT gzVoid setLOD(gzULong index , gzBool enable , gzReal near_dist = 0 , gzReal far_dist = 1, gzReal near_fade=0 , gzReal far_fade=-1);
00106     GZ_GRAPH_EXPORT gzVoid getLOD(gzULong index , gzBool *enable=NULL , gzReal *near_dist=NULL , gzReal *far_dist=NULL , gzReal *near_fade=NULL , gzReal *far_fade=NULL) const;
00107 
00109     GZ_GRAPH_EXPORT gzVoid setFadeDistance(gzULong index , gzReal near_fade,gzReal far_fade=-1);
00110 
00112     GZ_GRAPH_EXPORT gzVoid  useForceLodEnableMask(gzULong index , gzULong lodMask);
00113     GZ_GRAPH_EXPORT gzULong useForceLodEnableMask(gzULong index) const;
00114 
00115     GZ_GRAPH_EXPORT gzVoid  useForceLodDisableMask(gzULong index , gzULong lodMask);
00116     GZ_GRAPH_EXPORT gzULong useForceLodDisableMask(gzULong index) const;
00117 
00119 
00124     GZ_GRAPH_EXPORT gzVoid setCenter(const gzVec3 &center);
00125 
00127     GZ_GRAPH_EXPORT const gzVec3& getCenter() const;
00128 
00130 
00135     GZ_GRAPH_EXPORT gzVoid setCenter(gzReal x , gzReal y , gzReal z);
00136 
00138 
00141     GZ_GRAPH_EXPORT gzVoid useLevels(gzBool on);
00142 
00144     GZ_GRAPH_EXPORT gzBool useLevels() const;
00145 
00147     GZ_GRAPH_EXPORT gzDynamicArray<gzLodLevel> & getLevels();
00148 
00149     GZ_GRAPH_EXPORT static gzVoid setLodFactor( gzContext *context , gzFloat factor );
00150 
00152     GZ_GRAPH_EXPORT static gzVoid setGenericFadeDistance( gzContext *context , gzReal fade );
00153 
00155     GZ_GRAPH_EXPORT static gzVoid setForceLodMask( gzContext *context , gzULong lodMask);
00156 
00157     // ----------- gzGroup interface ------------------------------------
00158 
00159     GZ_GRAPH_EXPORT virtual gzBool  isChildOrderDependant();
00160 
00161     // ---------- Action Interface --------------------------------------
00162     GZ_GRAPH_EXPORT virtual gzBool isTraversable( gzTraverseAction *action , gzNode *node , gzULong index, gzContext *context);
00163     GZ_GRAPH_EXPORT virtual gzVoid preTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00164     GZ_GRAPH_EXPORT virtual gzVoid postTraverseAction( gzTraverseAction *actionclass , gzContext *context);
00165 
00166     // ---------- Debug Inteface ----------------------------------------
00168 
00171     GZ_GRAPH_EXPORT virtual gzVoid debugOutput(gzString base , gzString anchor , gzDebugFlags features);
00172 
00173 private:
00174     
00175     mutable gzDynamicArray<gzLodLevel>  m_levels;
00176     gzVec3                              m_center;
00177 
00178     gzRefPointer<gzState>       m_transparencyState;
00179 
00180     gzUByte                     m_useLevels:1;
00181     gzUByte                     m_useFading:1;
00182 };
00183 
00184 // Declare smart pointer type
00185 GZ_DECLARE_REFPTR(gzLod);
00186 
00187 
00188 class gzLodForceAction : public gzNodeAction 
00189 {
00190 public:
00191 
00192     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00193 
00194     GZ_GRAPH_EXPORT gzLodForceAction(const gzString & name=GZ_EMPTY_STRING);
00195 
00196     GZ_GRAPH_EXPORT virtual ~gzLodForceAction(){};
00197 
00198     GZ_GRAPH_EXPORT virtual gzVoid onAction(gzNodeActionEvent action , gzContext *context , gzNodeActionProvider *trigger ,gzTraverseAction *actionclass ,gzVoid *userdata);
00199 
00200     GZ_GRAPH_EXPORT gzVoid  setForceLodMask(gzULong mask);
00201 
00202     //---------------- Generic action interface ----------------------------------
00203 
00204     GZ_GRAPH_EXPORT virtual gzVoid attach(gzNode *node);
00205     GZ_GRAPH_EXPORT virtual gzVoid deattach(gzNode *node);
00206 
00207 private:
00208 
00209     gzULong m_forceLodMask;
00210 
00211 };
00212 
00213 #endif

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