Files
Client/GameTools/Zallad3D SceneClass/WBWaterPShader.cpp
LGram16 dd97ddec92 Restructure repository to include all source folders
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>
2025-11-29 20:17:20 +09:00

97 lines
3.5 KiB
C++

// WBWaterPShader.cpp: implementation of the WBWaterPShader class.
//
//////////////////////////////////////////////////////////////////////
#include "WBWaterPShader.h"
#include "SceneManager.h"
#include "WBEnvPlaneTex.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
WBWaterPShader::WBWaterPShader()
{
/* m_pBaseTexture = new WBTexture;*/
m_pEnvTexture = new CTexture;
CTexture::SetPath("c:\\MP-project\\Texture\\Shader\\");
// m_pNormalTexture = new WBTexture;
m_pEnvTexture->Load("sky_cube_mipmap1.dds");
// m_pEnvTexture->Load("terrain.dds");
CreatePixelShaderFromFile("c:/mp-project/Shaders/Water.psh");
}
WBWaterPShader::~WBWaterPShader()
{
/* if(m_pBaseTexture != NULL)
{
delete m_pBaseTexture;
m_pBaseTexture = NULL;
}*/
if(m_pEnvTexture != NULL)
{
delete m_pEnvTexture;
m_pEnvTexture = NULL;
}
/*
if(m_pNormalTexture != NULL)
{
delete m_pNormalTexture;
m_pNormalTexture = NULL;
}*/
}
void WBWaterPShader::Apply() {
CSceneManager::GetDevice()->SetTexture( 3, m_pEnvTexture->GetTexture() );
// CSceneManager::GetDevice()->SetTexture( 3, CSceneManager::m_pEnvPlaneTex->GetTexture() );
/*
CSceneManager::GetDevice()->SetTexture(0, m_pBaseTexture->GetTexture() );
CSceneManager::GetDevice()->SetTexture(1, m_pNormalTexture->GetTexture() );
CSceneManager::GetDevice()->SetTexture(2, m_pEnvTexture->GetTexture() );
*/
// Set Pixel Shader
CSceneManager::GetDevice()->SetPixelShader(m_dwPixelShader);
SetupPixelShaderConstants();
}
void WBWaterPShader::SetupPixelShaderConstants() {
/*CSceneManager::GetDevice()->SetTextureStageState(0,D3DTSS_MAGFILTER,D3DTEXF_LINEAR);
CSceneManager::GetDevice()->SetTextureStageState(0,D3DTSS_MINFILTER,D3DTEXF_LINEAR);
CSceneManager::GetDevice()->SetTextureStageState(0,D3DTSS_MIPFILTER,D3DTEXF_LINEAR);
CSceneManager::GetDevice()->SetTextureStageState(1,D3DTSS_MAGFILTER,D3DTEXF_LINEAR);
CSceneManager::GetDevice()->SetTextureStageState(1,D3DTSS_MINFILTER,D3DTEXF_LINEAR);
CSceneManager::GetDevice()->SetTextureStageState(1,D3DTSS_MIPFILTER,D3DTEXF_LINEAR);
CSceneManager::GetDevice()->SetTextureStageState(3,D3DTSS_MAGFILTER,D3DTEXF_LINEAR);
CSceneManager::GetDevice()->SetTextureStageState(3,D3DTSS_MINFILTER,D3DTEXF_LINEAR);
CSceneManager::GetDevice()->SetTextureStageState(3,D3DTSS_MIPFILTER,D3DTEXF_LINEAR);
// Base texture stage
CSceneManager::GetDevice()->SetTextureStageState(0, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP);
CSceneManager::GetDevice()->SetTextureStageState(0, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP);
CSceneManager::GetDevice()->SetRenderState( D3DRS_WRAP0, 0 );
// bump map texture stage
CSceneManager::GetDevice()->SetTextureStageState(1, D3DTSS_ADDRESSU, D3DTADDRESS_WRAP);
CSceneManager::GetDevice()->SetTextureStageState(1, D3DTSS_ADDRESSV, D3DTADDRESS_WRAP);
CSceneManager::GetDevice()->SetRenderState( D3DRS_WRAP1, 0 );
// Illumination texture
CSceneManager::GetDevice()->SetTextureStageState(2, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
CSceneManager::GetDevice()->SetTextureStageState(2, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
CSceneManager::GetDevice()->SetTextureStageState(2, D3DTSS_ADDRESSW, D3DTADDRESS_CLAMP);
CSceneManager::GetDevice()->SetRenderState( D3DRS_WRAP2, 0);
CSceneManager::GetDevice()->SetTextureStageState(3, D3DTSS_ADDRESSU, D3DTADDRESS_CLAMP);
CSceneManager::GetDevice()->SetTextureStageState(3, D3DTSS_ADDRESSV, D3DTADDRESS_CLAMP);
CSceneManager::GetDevice()->SetTextureStageState(3, D3DTSS_ADDRESSW, D3DTADDRESS_CLAMP);
*/
}