MercuryDisplaySoftwareC.h

Go to the documentation of this file.
00001 #ifndef _MERCURY_DISPLAY_SOFTWARE_C
00002 #define _MERCURY_DISPLAY_SOFTWARE_C
00003 
00004 #include "MercuryWindow.h"
00005 
00006 #if defined (WIN32)
00007 #include "Win32Window.h"
00008 #endif
00009 
00010 #include "MercuryDisplay.h"
00011 
00012 class MercuryDisplaySoftwareC : public MercuryDisplay
00013 {
00014 public:
00015     MercuryDisplaySoftwareC();
00016     virtual bool BeginFrame() { return true; } //unessiary
00017     virtual bool EndFrame();// { return true; } //unessiary
00018 //  virtual void Init();
00019     virtual bool MakeWindow(const char* title, int width, int height, int bits, bool fullscreenflag);
00020     virtual void RendererInfo() { } //unessiary
00021 
00022     virtual void DrawParticleField(const MercuryParticleField* field) { } //disabled
00023     virtual void DrawMesh(const MercuryMesh& mesh);
00024     virtual void DrawMeshVBO(const MercuryMesh& mesh) {};
00025     virtual void DrawSprite(const MercuryMesh& sprite) {};
00026     virtual void GenerateVBO(MercuryMesh& mesh) {};
00027     virtual void DestroyVBO(MercuryMesh& mesh) {};
00028 
00029     virtual void SetMaterial(const MercuryMaterial* material);
00030     virtual void ClearZBuffer();
00031     virtual void ClearFrameBuffer(){};
00032     virtual void BeginRenderToDynamicTexture (MercuryTexture* texture){};
00033     virtual void EndRenderToDynamicTexture (){};
00034     virtual void BeginRenderToDynamicCubeTexture (MercuryTexture *texture, unsigned int face){};
00035     virtual void EndRenderToDynamicCubeTexture   (){};
00036 
00037 
00038     virtual void DeleteTextures(int n, unsigned int* textureNames);
00039     virtual void UpdateTextureData(MercuryTexture* texture, unsigned int& ID);
00040     virtual void CreateCache(MercuryTexture* texture, unsigned int& ID);
00041     virtual void CreateCache(RawImageData* data, unsigned int& ID);
00042 
00043     virtual void EnablePixelshader () { } //disabled
00044     virtual void DisablePixelshader () { } //disabled
00045 
00046     virtual void EnableAllLighting() { } //disabled
00047     virtual void DisableAllLighting() { } //disabled
00048 
00049     virtual void EnableDepthTest() { bDepthTest = true; }
00050     virtual void DisableDepthTest() { bDepthTest = false; }
00051 
00052     virtual void EnableTextures(MercuryMaterial* material);
00053     virtual void ToggleTextureUse(bool toggle) {};
00054     virtual void EnableShaders(MercuryMaterial* material) {}
00055 
00056     virtual void ErrorCheck() { } //unesssiary
00057     virtual void EnableLights() { } //disabled
00058     virtual void ProcessStaticLights() { } //disabled
00059     virtual void DisableLights() { } //disabled
00060     virtual void ReadFrameBuffer(RawImageData& image);
00061 
00062     virtual void SendMatrixData(const MercuryMatrix& m);
00063     virtual void SendProjectionMatrixData() {};
00064 
00065     virtual void ToggleZBufferWrite(bool toggle) { m_zBufferWrite = toggle; };
00066     virtual void ToggleColorMask(bool toggle) {};
00067     virtual void ToggleStencilBufferWrite(bool toggle) {};
00068     virtual void StencilOp(STENCILOPS fail, STENCILOPS zfail, STENCILOPS zpass) {};
00069     virtual void CullBackface(bool toggle) {};
00070     virtual void StencilFunc(TFUNCT func, int ref, unsigned int zref) {};
00071 
00072     virtual void DisableOldLights() {};
00073 
00074     virtual void RenderTranslucentObject() {};
00075     virtual void DefineClippingPlanes(const MVector<MQuaternion>& planes) {};
00076 
00077     virtual void RenderText(const MercuryText& text) {};
00078 protected:
00079 
00080     struct InternalTexture
00081     {
00082         bool m_isInUse;
00083         bool m_isMaterial;
00084         int m_width;
00085         int m_height;
00086         unsigned char * m_data;
00087         ColorBytes m_type;
00088         MercuryMatrix m_TexMat;
00089     };
00090 
00091     MVector< InternalTexture > m_InternalTextures;
00092     InternalTexture * m_pCurTexture;
00093     const MercuryTexture* m_pCurMercuryTexture;
00094     MercuryMaterial m_pCurMaterial;
00095 
00096 
00097     //Internal drawing
00098     struct InternalPoint
00099     {
00100         float x,y,z,w;
00101         float u,v;
00102     };
00103 
00104     MercuryMatrix mFinal;
00105 
00106     virtual void InternalPipelinePoint( const MercuryPoint &pIn, InternalPoint &pOut );
00107     virtual void InternalDrawPoly( const InternalPoint * points, int verts = 3, int mode = 0 );
00108 
00109     bool bDepthTest;
00110     static int m_width;
00111     static int m_height;
00112     static int m_bypp;
00113     static bool m_zBufferWrite;
00114     static unsigned char * m_cBuffer;
00115     static unsigned int * m_zBuffer;
00116 
00117 private:
00118     virtual void ProcessLightsInternal( const MercuryLight* light[3], unsigned int index ) {};
00119 };
00120 
00121 #endif
00122 
00123 /* 
00124  * Copyright (c) 2006, Charles Lohr
00125  * All rights reserved.
00126  *
00127  * Redistribution and use in source and binary forms, with or
00128  * without modification, are permitted provided that the following
00129  * conditions are met:
00130  *  -   Redistributions of source code must retain the above
00131  *      copyright notice, this list of conditions and the following disclaimer.
00132  *  -   Redistributions in binary form must reproduce the above copyright
00133  *      notice, this list of conditions and the following disclaimer in
00134  *      the documentation and/or other materials provided with the distribution.
00135  *  -   Neither the name of the Mercury Engine nor the names of its
00136  *      contributors may be used to endorse or promote products derived from
00137  *      this software without specific prior written permission.
00138  *
00139  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00140  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00141  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00142  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
00143  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00144  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00145  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00146  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00147  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
00148  * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00149  */

Hosted by SourceForge.net Logo