Gizmo3D

gzRenderBase.h

Go to the documentation of this file.
00001 //*****************************************************************************
00002 // File         : gzRenderBase.h
00003 // Module       : 
00004 // Description  : Class definition of the gzRenderBase class types
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  000903  Created file    
00020 //
00021 //******************************************************************************
00022 #ifndef __GZ_RENDER_BASE_H__
00023 #define __GZ_RENDER_BASE_H__
00024 
00030 #include "gzContext.h"
00031 #include "gzCamera.h"
00032 
00033 //******************************************************************************
00034 // Class    : gzRenderBase
00035 //                                  
00036 // Purpose  : Base class for rendering of a scene graph to a target
00037 //                                  
00038 // Notes    : - 
00039 //                                  
00040 // Revision History...                          
00041 //                                  
00042 // Who  Date    Description                     
00043 //                                  
00044 // AMO  990607  Created 
00045 //                                  
00046 //******************************************************************************
00047 class gzRenderBase : public gzObject
00048 {
00049 public:
00050 
00051     GZ_DECLARE_TYPE_INTERFACE_EXPORT(GZ_GRAPH_EXPORT);  // typed interface
00052 
00053     GZ_GRAPH_EXPORT gzRenderBase();
00054 
00055     GZ_GRAPH_EXPORT virtual ~gzRenderBase();
00056 
00057     GZ_GRAPH_EXPORT virtual gzVoid onPreRender(gzContext *context, gzULong size_x , gzULong size_y);
00058     GZ_GRAPH_EXPORT virtual gzVoid onPostRender(gzContext *context, gzULong size_x , gzULong size_y);
00059     GZ_GRAPH_EXPORT virtual gzVoid onInitContext(gzContext *context);
00060 
00061     GZ_GRAPH_EXPORT gzVoid      setBackground( gzFloat red , gzFloat green , gzFloat blue , gzFloat alpha=1.0f );
00062     GZ_GRAPH_EXPORT gzVec4      getBackground();
00063 
00064     GZ_GRAPH_EXPORT gzVoid      setClearDepth( gzFloat depth );
00065 
00066     GZ_GRAPH_EXPORT gzVoid      setDepthFunc( gzEnum func );
00067 
00068     GZ_GRAPH_EXPORT gzVoid      setContext( gzContext *context );
00069     GZ_GRAPH_EXPORT gzContext   *getContext() const;
00070 
00071     GZ_GRAPH_EXPORT gzVoid      setCamera( gzCamera *camera );
00072     GZ_GRAPH_EXPORT gzCamera    *getCamera() const;
00073 
00074     GZ_GRAPH_EXPORT virtual gzVoid render(gzContext *context, gzULong size_x,gzULong size_y,gzULong max_width);
00075 
00076     GZ_GRAPH_EXPORT gzDouble    getFrameRate();
00077 
00078     GZ_GRAPH_EXPORT gzVoid      setForcedRenderTime(const gzDouble &renderTime);
00079 
00081     GZ_GRAPH_EXPORT gzVoid      setViewportOffset(gzFloat x , gzFloat y);
00082 
00084     GZ_GRAPH_EXPORT gzVoid      setViewportScale(gzFloat sx , gzFloat sy);
00085 
00086     GZ_GRAPH_EXPORT gzVoid      useFinish(gzBool active=FALSE);
00087 
00088 protected:
00089 
00090     gzDouble    m_lastFrameTime;
00091     gzULong     m_frameCount;
00092     gzDouble    m_frameRate;
00093 
00094     gzFloat                 m_backColor_red;
00095     gzFloat                 m_backColor_green;
00096     gzFloat                 m_backColor_blue; 
00097     gzFloat                 m_backColor_alpha;
00098     gzFloat                 m_clearDepth;
00099 
00100     gzFloat                 m_refreshRate;
00101 
00102     gzEnum                  m_depthFunc;
00103 
00104     gzFloatXY               m_viewportOffset;
00105 
00106     gzFloatXY               m_viewportScale;
00107 
00108     gzRefPointer<gzContext> m_context;
00109 
00110     //---------------- graph members ----------------------------
00111 
00112     gzRefPointer<gzCamera>  m_camera;
00113 
00114 private:
00115 
00116     gzBool                  m_hasInitContext;
00117 
00118     gzBool                  m_useFinish;
00119 
00120     gzDouble                m_forceRenderTime;
00121 
00122 };
00123 
00124 
00125 //******************************************************************************
00126 // Class    : gzImageRenderInterface
00127 //                                  
00128 // Purpose  : Base interface for image rendering
00129 //                                  
00130 // Notes    : - 
00131 //                                  
00132 // Revision History...                          
00133 //                                  
00134 // Who  Date    Description                     
00135 //                                  
00136 // AMO  990607  Created 
00137 //                                  
00138 //******************************************************************************
00139 class gzImageRenderInterface : public gzRenderBase
00140 {
00141 public:
00142 
00143     GZ_GRAPH_EXPORT gzImageRenderInterface(){};
00144 
00145     GZ_GRAPH_EXPORT ~gzImageRenderInterface(){};
00146 
00147     //--------- some virtual convenience callbacks -------------
00148     
00149     GZ_GRAPH_EXPORT virtual gzVoid  refreshImage()=0;
00150 
00151     GZ_GRAPH_EXPORT virtual gzVoid  setImage(gzImage *image)=0;
00152 
00153     GZ_GRAPH_EXPORT virtual gzImage *getImage()=0;
00154 
00155     // ---------- Clone interface ---------------------------------------
00156     GZ_GRAPH_EXPORT virtual gzReference* clone() const=0;
00157 
00158     // ---------- Image rendering factory -------------------------------
00159 
00160     GZ_GRAPH_EXPORT static gzVoid   installFactory(gzImageRenderInterface *instance);
00161 
00162     GZ_GRAPH_EXPORT static gzVoid   unInstallFactory();
00163 
00164     GZ_GRAPH_EXPORT static gzBool   hasFactory();
00165 
00166     GZ_GRAPH_EXPORT static gzImageRenderInterface * getImageRender();
00167 
00168 private:
00169 
00170     static gzRefPointer<gzImageRenderInterface> s_factoryInstance;
00171 
00172 };
00173 
00174 
00175 #endif // __GZ_RENDER_BASE_H__

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