// FullSceneVShader.cpp: implementation of the CFullSceneVShader class. // ////////////////////////////////////////////////////////////////////// #include "FullSceneVShader.h" #include "SceneManager.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// char GlareV[] = "vs.1.1\n" "def c0, 1.0, 0.0, 0.0, 0.0\n" "def c0, 0.0, 1.0, 0.0, 0.0\n" "def c0, 0.0, 0.0, 1.0, 0.0\n" "def c0, 0.0, 0.0, 0.0, 1.0\n" "mov oPos, v0\n" "add oT0, v3, c0\n" "add oT1, v3, c1\n" "add oT2, v3, c2\n" "add oT3, v3, c3\n"; CFullSceneVShader::CFullSceneVShader(char *strShaderName) { memset(m_strName,0,sizeof(char) * 256); strcpy(m_strName,strShaderName); if(strstr("Glare",strShaderName)) { DWORD FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX4 | // 4 sets of tex coords D3DFVF_TEXCOORDSIZE2(0) | // 2D coord for index 0 D3DFVF_TEXCOORDSIZE3(1) | // 3D coord for index 1 D3DFVF_TEXCOORDSIZE3(2) | // 3D coord for index 2 D3DFVF_TEXCOORDSIZE3(3); // 3D coord for index 3 // DWORD FVF = D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_TEX1; DWORD vertexshaderdeclaration[MAX_FVF_DECL_SIZE]; D3DXDeclaratorFromFVF(FVF,vertexshaderdeclaration); /* DWORD vertexshaderdeclaration[]= { D3DVSD_STREAM(0), (D3DVSD_REG(0, D3DVSDT_FLOAT4)), // vertex position RHW (D3DVSD_REG(1, D3DVSDT_FLOAT4)), // color (D3DVSD_REG(2, D3DVSDT_FLOAT4)), // spec (D3DVSD_REG(3, D3DVSDT_FLOAT2)), // Texcoord D3DVSD_END() }; */ CreateVertexShaderFromBuffer(GlareV,vertexshaderdeclaration); } } CFullSceneVShader::~CFullSceneVShader() { } void CFullSceneVShader::Apply() { CSceneManager::GetDevice()->SetVertexShader(m_dwVertexShader); SetupVertexShaderConstants(); } void CFullSceneVShader::SetupVertexShaderConstants() { if(strstr(m_strName,"Glare")) { /* CSceneManager::GetDevice()->SetVertexShaderConstant(0, &D3DXVECTOR4(m_fOffWidth,m_fOffHeight,0.0f,0.0f),1); CSceneManager::GetDevice()->SetVertexShaderConstant(1, &D3DXVECTOR4(m_fOffWidth,m_fOffHeight,0.0f,0.0f),1); CSceneManager::GetDevice()->SetVertexShaderConstant(2, &D3DXVECTOR4(m_fOffWidth,m_fOffHeight,0.0f,0.0f),1); CSceneManager::GetDevice()->SetVertexShaderConstant(3, &D3DXVECTOR4(m_fOffWidth,m_fOffHeight,0.0f,0.0f),1);*/ } }