Move git root from Client/ to src/ to track all source code: - Client: Game client source (moved to Client/Client/) - Server: Game server source - GameTools: Development tools - CryptoSource: Encryption utilities - database: Database scripts - Script: Game scripts - rylCoder_16.02.2008_src: Legacy coder tools - GMFont, Game: Additional resources 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
77 lines
2.4 KiB
C++
77 lines
2.4 KiB
C++
// WBWaterNormalTexGenVShader.cpp: implementation of the WBWaterNormalTexGenVShader class.
|
|
//
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
#include "./WBWaterNormalTexGenVShader.h"
|
|
//#include "WBGraphicLayer.h"
|
|
#include "ShaderConstants.h"
|
|
//#include "WBRenderState.h"
|
|
#include "SceneManager.h"
|
|
//////////////////////////////////////////////////////////////////////
|
|
// Construction/Destruction
|
|
//////////////////////////////////////////////////////////////////////
|
|
|
|
WBWaterNormalTexGenVShader::WBWaterNormalTexGenVShader()
|
|
{
|
|
DWORD vertexshaderdeclaration[]=
|
|
{
|
|
D3DVSD_STREAM(0),
|
|
(D3DVSD_REG(0, D3DVSDT_FLOAT3)), // vertex position
|
|
(D3DVSD_REG(1, D3DVSDT_FLOAT2)),
|
|
D3DVSD_END()
|
|
};
|
|
|
|
|
|
char path[256];
|
|
GetCurrentDirectory(256,path);
|
|
sprintf(path,"%s\\Shaders\\WaterGen.vsh",path);
|
|
CreateVertexShader(path,vertexshaderdeclaration);
|
|
m_vecConst1 = D3DXVECTOR4( 0.0f, 0.5f, 1.0f, 2.0f );
|
|
|
|
}
|
|
|
|
WBWaterNormalTexGenVShader::~WBWaterNormalTexGenVShader()
|
|
{
|
|
|
|
}
|
|
|
|
void WBWaterNormalTexGenVShader::Apply() {
|
|
CSceneManager::GetDevice()->SetVertexShader(m_dwVertexShader);
|
|
// SetupVertexShaderConstants();
|
|
|
|
}
|
|
|
|
void WBWaterNormalTexGenVShader::SetZeroOffset(D3DXVECTOR4 vecOffset[4]) {
|
|
CSceneManager::GetDevice()->SetVertexShaderConstant(CV_T0_OFFSET,&(vecOffset[0].x),4);
|
|
}
|
|
void WBWaterNormalTexGenVShader::SetupVertexShaderConstants() {
|
|
|
|
|
|
|
|
/*
|
|
CSceneManager::GetDevice()->SetVertexShaderConstant(CV_ZERO, D3DXVECTOR4(0.0f, 0.0f, 0.0f, 0.0f), 1);
|
|
CSceneManager::GetDevice()->SetVertexShaderConstant(CV_ONE, D3DXVECTOR4(1.0f, 1.0f, 1.0f, 1.0f), 1);
|
|
CSceneManager::GetDevice()->SetVertexShaderConstant(CV_HALF, D3DXVECTOR4(0.5f, 0.5f, 0.5f, 0.5f), 1);
|
|
CSceneManager::GetDevice()->SetVertexShaderConstant( CV_CONSTS_1, &m_vecConst1, 1 );
|
|
|
|
D3DXVECTOR4 vecOffset(0.0f, 1.0f, 0.0f, 0.0f);
|
|
CSceneManager::GetDevice()->SetVertexShaderConstant( CV_ONOFF_1, &vecOffset, 1);
|
|
|
|
|
|
// Matrix Set
|
|
D3DXMATRIX matWorld = WBRenderState::GetWorldTransform();
|
|
D3DXMATRIX matView = WBRenderState::GetViewTransform();
|
|
D3DXMATRIX matProject = WBRenderState::GetProjectTransform();
|
|
D3DXMATRIX matTemp;
|
|
|
|
D3DXMATRIX matWorldViewProj;
|
|
|
|
|
|
D3DXMatrixMultiply(&matTemp, &matWorld, &matView);
|
|
D3DXMatrixMultiply(&matWorldViewProj, &matTemp, &matProject);
|
|
|
|
// Projection to clip space
|
|
D3DXMatrixTranspose(&matWorldViewProj, &matWorldViewProj);
|
|
CSceneManager::GetDevice()->SetVertexShaderConstant(CV_WORLDVIEWPROJ_0, &matWorldViewProj(0, 0), 4);
|
|
*/
|
|
} |