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; }
00017 virtual bool EndFrame();
00018
00019 virtual bool MakeWindow(const char* title, int width, int height, int bits, bool fullscreenflag);
00020 virtual void RendererInfo() { }
00021
00022 virtual void DrawParticleField(const MercuryParticleField* field) { }
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 () { }
00044 virtual void DisablePixelshader () { }
00045
00046 virtual void EnableAllLighting() { }
00047 virtual void DisableAllLighting() { }
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() { }
00057 virtual void EnableLights() { }
00058 virtual void ProcessStaticLights() { }
00059 virtual void DisableLights() { }
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
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
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149