Main Page Modules Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

# deRender_priv.hpp

Go to the documentation of this file.

    00001 ///////////////////////////////////////////////////////////////////////////////
    00002 /// @file deRender_priv.hpp
    00003 ///
    00004 /// @brief specialization of IdeRender
    00005 ///
    00006 /// @author Assassin
    00007 ///
    00008 /// This file is the intellectual property of Novus Delta, LLC.. Usage of the
    00009 /// contents of this file is subject to the Destiny3D Member License which
    00010 /// can be found at http://www.destiny3d.com.  Any other usage is prohibited.
    00011 ///
    00012 /// This file is distributed "AS IS" without warranty of any kind.  Novus
    00013 /// Delta, LLC. does not guarantee the fitness of the contents of this file
    00014 /// for any particular purpose.
    00015 ///
    00016 /// Copyright (C) 2001-2003 Novus Delta, LLC. All Rights Reserved.
    00017 ///
    00018 /// <hr>
    00019 ///                                 Change History
    00020 /// <hr>
    00021 ///
    00022 /// @date Feb 2002
    00023 /// @author Assassin
    00024 /// @remarks Initial Creation
    00025 ///
    00026 ///////////////////////////////////////////////////////////////////////////////
    00027
    00028 #ifndef DERENDER_PRIV_HPP
    00029 #define DERENDER_PRIV_HPP
    00030
    00031 #include "deBST.hpp"
    00032 #include "deRender.hpp"
    00033 #include "deString.hpp"
    00034 #include "deStack.hpp"
    00035 #include "deWorld.hpp"
    00036
    00037 #define DESTINY3D_FREEWARE
    00038 #define DESTINY3D_WATERMARK
    00039 #define MAX_LIGHTS_PER_PASS (8)
    00040
    00041 extern long RenderProfileID;
    00042
    00043 class IdeSceneGraph;
    00044
    00045 class deRender : public IdeRender
    00046 {
    00047 public:
    00048     deRender(void);
    00049     ~deRender(void);
    00050
    00051     friend IdeRender* IdeRender_GetPtr();
    00052     friend deBoolean IdeRender_Initialize();
    00053     friend void IdeRender_Destroy();
    00054     friend void IdeRender_DestroyDriverLinkages();
    00055
    00056     deBoolean SetRenderFlag(IdeRender::RenderFlag_t Flag);
    00057
    00058     deBoolean SetStencilState(  IdeDriver * pDriver, StencilType_t Stencil, DWORD Ref, DWORD X = 0,
    00059                                 IdeDriver::RenderCmpFunc Comparison = IdeDriver::COMPARE_ALWAYS,
    00060                                 IdeDriver::RenderState StencilTest = IdeDriver::RENDER_STENCILPASS,
    00061                                 DWORD StencilMask = 0xff, DWORD WriteMask = 0xff);
    00062
    00063     // Renders the current world with the position and viewport of a camera
    00064     // Specify BeginFrame=DE_TRUE for the first camera being rendered
    00065     // Specify EndFrame=DE_TRUE for the last camera being rendered
    00066     // If you only have one camera, both must be true
    00067     deBoolean Render(IdeCamera * cam, deDouble DeltaTime, deBoolean UseSG, deBoolean ClearColorBuffer, deBoolean BeginFrame, deBoolean EndFrame);
    00068     deBoolean RenderTexture(IdeBitmap * Target, IdeCamera * cam, deDouble DeltaTime);
    00069     deBoolean BeginFrame(HWND WindowHandle, deBoolean ClearColorBuffer);
    00070     deBoolean EndFrame(HWND WindowHandle, deDouble DeltaTime);
    00071
    00072     void RenderPrepBuffer(deRenderObject & obj);
    00073     IdeDriver * CurrentPassDriver();
    00074     void RenderPrepBatch(long Level, IdePortal * Portal, deRect & Viewport, deTransformInfo * PortalPos, deTransformInfo * Concat);
    00075     deDouble GetTimeStep();
    00076
    00077     void SetDriverPath(const char * RelativePath);
    00078     IdeDriverLoad* GetDriverLoad();
    00079     // Attaches to an hWnd and forces a driver to be created for it
    00080     IdeDriver * AttachToWindow(HWND hWnd, char * DriverName = "Direct3D8");
    00081     deBoolean DetachFromWindow(HWND hWnd);
    00082     void UpdateWindow(HWND hWnd);
    00083     void UpdateDisplay();
    00084
    00085     deBoolean LoadDriver(HWND hWnd, IdeDriver::deDisplay * Display, char * DriverName);
    00086     deBoolean GetResolution(IdeDriver * pDriver, long Adapter, long EntryNum, long * Width, long * Height, long * RefreshRate);
    00087     deBoolean QueryFormat(IdeDriver * pDriver, IdeDriver::deDisplay * Display, deBoolean PreferStencil);
    00088
    00089     void SetBGColor(deARGB color);
    00090     void SetMaxTPortalDepth(long Depth);
    00091     void SetMaxLights(long MaxHWLights, long MaxTexLights);
    00092     deBoolean ClearBackground(HWND hWnd, deARGB color = 0x00000000, deBoolean ClearZ = DE_TRUE);
    00093     void EnableTexturing(deBoolean Enabled);
    00094
    00095     deBoolean Use2DCollection(HWND hWnd, Ide2DCollection * Collection);
    00096     Ide2DCollection * Get2DCollection(HWND hWnd);
    00097
    00098     void SetStatStruct(deRenderStats * StatStruct);
    00099
    00100     deBoolean Screenshot(HWND hWnd, const char* filename, long ScreenSizes);
    00101
    00102     long GetFrameNum();
    00103
    00104 private:
    00105     // internal functions
    00106     deBoolean RenderWaterMark(IdeDriver* pDriver);
    00107     static void DestroyDriverLinkages();
    00108     IdeDriver * GetDriver(HWND hWnd);
    00109     deBoolean InitDriver(IdeDriver * driver, HWND hWnd, IdeDriver::deDisplay * display, deBoolean ResetOnly);
    00110     void SetInFrame(HWND hWnd, deBoolean InFrame);
    00111     deBoolean IsInFrame(HWND hWnd, deBoolean ErrorVal);
    00112     IdeDriver* SetupRenderTarget(IdeBitmap * Target, IdeCamera * cam);
    00113     deBoolean SetSubViewport(IdeDriver * pDriver, IdeCamera * cam, deRect SubRect);
    00114     deBoolean SetScissorRect(IdeDriver* pDriver, deRect ScissorRect);
    00115     deBoolean RenderGeometry(IdeDriver * pDriver, IdeSceneGraph * SG, IdeCamera * c, deDouble DeltaTime, deBoolean ClearColorBuffer, deBoolean BeginFrame, deBoolean EndFrame);
    00116     deBoolean CheckColorFormat(IdeDriver::BPP Bpp);
    00117     deBoolean CheckDepthFormat(IdeDriver::ZPP Zpp, deBoolean Windowed);
    00118
    00119     typedef deTBST <deRenderObject, 3> t_ObjectTree;
    00120     struct deRenderBatch
    00121     {
    00122         t_ObjectTree ObjectTree;
    00123         IdePortal * TPortal;
    00124         deRect Viewport;
    00125         long PortalLevel;
    00126         deTransform Position;
    00127         deTransform Concat;
    00128     };
    00129
    00130     struct deRenderPassInfo
    00131     {
    00132         IdeDriver*      pDriver;
    00133         deRenderBatch*  pBatch;
    00134         IdeCamera*      pCam;
    00135
    00136         deBoolean       DepthWrite;
    00137         deBoolean       ColorWrite;
    00138     };
    00139
    00140     struct DriverInfo
    00141     {
    00142         IdeDriver*          pDriver;
    00143         deString            Name;
    00144         HWND                DriverWindow;
    00145         Ide2DCollection*    _2D;
    00146         u32                 FullWidth;
    00147         u32                 FullHeight;
    00148         deBoolean           SettingMode;
    00149         deBoolean           InFrame;
    00150         deBoolean           DisplaySet;
    00151 //      deRenderFuncs       RenderFuncs;
    00152     };
    00153
    00154     struct deLightEntry_t
    00155     {
    00156         const deRenderObject*       Geometry;
    00157         const IdeRenderLight*       Light;
    00158         deBoolean                   TexLight;
    00159     };
    00160     struct LightArray_t
    00161     {
    00162         deRenderObject* pRenderObject;
    00163         char Active[MAX_LIGHTS_PER_PASS];
    00164     };
    00165
    00166     deBoolean RenderBatch(deRenderPassInfo* pInfo);
    00167
    00168     IdeRenderTexture*   m_WaterMarkTex;
    00169     IdeVertexBuffer*    m_WaterMarkVB;
    00170
    00171     static deRenderStats s_RenderStats;
    00172     static deRender *           s_deRenderSingleton;
    00173     static IdeDriverLoad *      s_DriverLoad;
    00174     static IdeRenderTexture *   s_BlankTex;
    00175     static IdeRenderMaterial *  s_BlankMat;
    00176
    00177     static deTArray <DriverInfo>        m_DriverList;
    00178 //  deTBST <deRenderObject, 2>          m_ValidObjects;
    00179     deTList <deRenderBatch>             m_RenderBatches;
    00180
    00181     deTStack<IdeDriver*>m_CurrentPassDriver;
    00182     deDouble            m_CurrentTimeStep;
    00183     deBoolean           m_TexturesEnabled;
    00184     deBoolean           m_RenderMeshOverFill;
    00185     deBoolean           m_RenderSolidWireframe;
    00186     long                m_FillState;
    00187     long                m_CullState;
    00188     deARGB              m_BGColor;
    00189     deRenderStats*      m_RenderStats;
    00190     deString            m_DriverPath;
    00191     long                m_FrameNum;
    00192     long                m_TPortalDepth;
    00193     long                m_MaxHWLights;
    00194     long                m_MaxTexLights;
    00195     long                m_LightsEncountered;
    00196     IdeRenderLight*     m_LightsPerPass[MAX_LIGHTS_PER_PASS];
    00197     IdeRenderTexture*   m_PassTexture;
    00198 #if !defined(DESTINY3D_FREEWARE)
    00199     deBoolean           m_EnableWaterMark;
    00200     deBoolean           m_EnableWaterMarkFade;
    00201 #endif
    00202 };
    00203
    00204
    00205 #endif