Platform_Win32_3D.h
Go to the documentation of this file.00001 00010 #ifndef __Platform_Win32_3D_H__ 00011 #define __Platform_Win32_3D_H__ 00012 00013 // Includes 00014 #include "Platform_3D.h" 00015 #include "Array.h" 00016 00017 // Forward declares 00018 class Platform_Win32_OS; 00019 class Platform_Win32_3D_Technology; 00020 class Platform_3D_VertexBuffer; 00021 class Platform_3D_IndexBuffer; 00022 class Platform_3D_Texture; 00023 class Image; 00024 class Platform_Win32_3D_IndexBuffer; 00025 class Platform_Win32_3D_VertexBuffer; 00026 class Platform_Win32_3D_Texture; 00027 00028 // Platform_Win32_3D 00029 class Platform_Win32_3D:public Platform_3D 00030 { 00031 00032 public: 00033 Platform_Win32_3D(Platform_Win32_OS* os); 00034 00035 ~Platform_Win32_3D(); 00036 00037 virtual void BeginScene( 00038 unsigned int color, 00039 float z, 00040 unsigned int stencil 00041 ); 00042 00043 virtual void EndScene(); 00044 00045 virtual Platform_3D_VertexBuffer* CreateVertexBuffer( 00046 int vertexFormat, 00047 int vertexCount, 00048 bool dynamic 00049 ); 00050 00051 virtual Platform_3D_IndexBuffer* CreateIndexBuffer( 00052 int indexCount, 00053 bool dynamic 00054 ); 00055 00056 virtual Platform_3D_Texture* CreateTexture( 00057 const Asset& asset 00058 ); 00059 00060 virtual Platform_3D_Texture* CreateTexture( 00061 const Image& image 00062 ); 00063 00064 virtual void Render( 00065 int startVertex, 00066 int vertexCount, 00067 int startIndex, 00068 int indexCount 00069 ); 00070 00071 virtual void Render( 00072 int startVertex, 00073 int vertexCount 00074 ); 00075 00076 virtual void SetWorldMatrix( 00077 const float worldMatrix[16] 00078 ); 00079 00080 virtual void SetViewMatrix( 00081 const float viewMatrix[16] 00082 ); 00083 00084 virtual void SetProjectionMatrix( 00085 const float projectionMatrix[16] 00086 ); 00087 00088 virtual int GetLightCount(); 00089 00090 virtual void EnableDirectionalLight( 00091 int lightIndex, 00092 float colorR, 00093 float colorG, 00094 float colorB, 00095 float directionX, 00096 float directionY, 00097 float directionZ 00098 ); 00099 00100 virtual void DisableLight( 00101 int lightIndex 00102 ); 00103 00104 virtual void SetAmbientLight( 00105 unsigned int color 00106 ); 00107 00108 virtual void EnableLighting( 00109 bool enabled 00110 ); 00111 00112 virtual void EnableZRead( 00113 bool enabled 00114 ); 00115 00116 virtual void EnableZWrite( 00117 bool enabled 00118 ); 00119 00120 virtual void SetFullscreen(bool fullscreen); 00121 00122 virtual bool GetFullscreen(); 00123 00124 virtual void SetSize(int width, int height); 00125 00126 virtual int GetWidth(); 00127 00128 virtual int GetHeight(); 00129 00130 void OnWmSize(int width, int height); 00131 00132 void OnMinimize(); 00133 00134 void OnLoseFocus(); 00135 00136 void OnGainFocus(); 00137 00138 void OnRestore(); 00139 00140 void VertexBufferBound(Platform_Win32_3D_VertexBuffer* vertexBuffer); 00141 void IndexBufferBound(Platform_Win32_3D_IndexBuffer* indexBuffer); 00142 void TextureBound(int stage, Platform_Win32_3D_Texture* texture); 00143 00144 void VertexBufferDeleted(Platform_Win32_3D_VertexBuffer* vertexBuffer); 00145 void IndexBufferDeleted(Platform_Win32_3D_IndexBuffer* indexBuffer); 00146 void TextureDeleted(Platform_Win32_3D_Texture* texture); 00147 private: 00148 void SetWindowSize(); 00149 00150 enum Technology 00151 { 00152 Technology_D3D9, 00153 Technology_Undefined, 00154 }; 00155 00156 void SetTechnology( 00157 Technology technology 00158 ); 00159 00160 void DowngradeTechnology(); 00161 00162 bool IsRunningOnWine(); 00163 00164 private: 00165 struct HWND__* windowHandle_; 00166 Technology technology_; 00167 Platform_Win32_3D_Technology* technologyInstance_; 00168 bool fullscreen_; 00169 int windowedX_; 00170 int windowedY_; 00171 int windowedWidth_; 00172 int windowedHeight_; 00173 int fullscreenWidth_; 00174 int fullscreenHeight_; 00175 int disableOnWmSize_; 00176 bool showfps_; 00177 bool ignoreNextOnWmSize_; 00178 00179 Platform_Win32_3D_VertexBuffer* lastBoundVertexBuffer_; 00180 Platform_Win32_3D_IndexBuffer* lastBoundIndexBuffer_; 00181 Platform_Win32_3D_Texture* lastBoundTextures_[8]; 00182 Array<Platform_Win32_3D_VertexBuffer*> vertexBuffers_; 00183 Array<Platform_Win32_3D_IndexBuffer*> indexBuffers_; 00184 Array<Platform_Win32_3D_Texture*> textures_; 00185 }; 00186 00187 00188 #endif /* __Platform_Win32_3D_H__ */
Reproduction/republishing of any material on this site without permission is strictly prohibited.
