00001 #pragma once 00002 00003 #include "Shader.h" 00004 #include "dynamicgeometrybuffer.h" 00005 00006 class Shader_Unreal : public Shader 00007 { 00008 private: 00009 static DynamicGeometryBuffer *dynamicGeometryBuffer; 00010 static ID3D10EffectPool *pool; 00011 static ID3D10RenderTargetView *unrealRTV; 00012 static ID3D10DepthStencilView *unrealDSV; 00013 static ID3D10ShaderResourceView* unrealSRV; 00014 00015 struct _variables 00016 { 00017 ID3D10EffectMatrixVariable* projection; 00018 ID3D10EffectShaderResourceVariable* diffuseTexture; 00019 ID3D10EffectScalarVariable* viewportHeight; 00020 ID3D10EffectScalarVariable* viewportWidth; 00021 }; 00022 00023 public: 00024 enum BUFFERS{BUFFER_MULTIPASS,BUFFER_HUD}; 00025 00026 static _variables variables; 00027 00028 Shader_Unreal(ID3D10Device *device); 00029 virtual ~Shader_Unreal(); 00030 bool compile(const D3D10_SHADER_MACRO *macros, DWORD shaderFlags); 00031 bool compileUnrealShader(const wchar_t* filename,const D3D10_SHADER_MACRO *macros, DWORD shaderFlags,const D3D10_INPUT_ELEMENT_DESC *elementDesc, int numElements); 00032 bool createRenderTargetViews(ID3D10RenderTargetView *backbuffer, const DXGI_SWAP_CHAIN_DESC &swapChainDesc,int multiSampleCount); 00033 void releaseRenderTargetViews(); 00034 void Shader_Unreal::setProjection(float aspect, float XoverZ, float zNear) const; 00035 void Shader_Unreal::setViewportSize(float x, float y) const; 00036 virtual void Shader_Unreal::setTexture(int pass,ID3D10ShaderResourceView *texture) const; 00037 void Shader_Unreal::clear(Vec4& clearColor) const; 00038 void Shader_Unreal::clearDepth() const; 00039 void switchBuffers(enum BUFFERS buffer); 00040 };