DirectX8 to DirectX

This commit is contained in:
onurcan488
2026-02-16 20:59:18 +03:00
parent 3e604d5f10
commit f895a1a4a2
14 changed files with 43 additions and 45 deletions

View File

@@ -2,7 +2,7 @@
#include "ActorInstance.h" #include "ActorInstance.h"
#include "AreaTerrain.h" #include "AreaTerrain.h"
#include "RaceData.h" #include "RaceData.h"
#include "SpeedTreeLib/SpeedTreeForestDirectX8.h" #include "SpeedTreeLib/SpeedTreeForestDirectX.h"
#include "SpeedTreeLib/SpeedTreeWrapper.h" #include "SpeedTreeLib/SpeedTreeWrapper.h"
enum enum
@@ -813,7 +813,7 @@ void CActorInstance::__CreateTree(const char * c_szFileName)
{ {
__DestroyTree(); __DestroyTree();
CSpeedTreeForestDirectX8& rkForest=CSpeedTreeForestDirectX8::Instance(); CSpeedTreeForestDirectX& rkForest=CSpeedTreeForestDirectX::Instance();
m_pkTree=rkForest.CreateInstance(m_x, m_y, m_z, GetCaseCRC32(c_szFileName, strlen(c_szFileName)), c_szFileName); m_pkTree=rkForest.CreateInstance(m_x, m_y, m_z, GetCaseCRC32(c_szFileName, strlen(c_szFileName)), c_szFileName);
m_pkTree->SetPosition(m_x, m_y, m_z); m_pkTree->SetPosition(m_x, m_y, m_z);
m_pkTree->UpdateBoundingSphere(); m_pkTree->UpdateBoundingSphere();
@@ -825,7 +825,7 @@ void CActorInstance::__DestroyTree()
if (!m_pkTree) if (!m_pkTree)
return; return;
CSpeedTreeForestDirectX8::Instance().DeleteInstance(m_pkTree); CSpeedTreeForestDirectX::Instance().DeleteInstance(m_pkTree);
} }
void CActorInstance::__SetTreePosition(float fx, float fy, float fz) void CActorInstance::__SetTreePosition(float fx, float fy, float fz)

View File

@@ -3,7 +3,7 @@
#include "EterLib/ResourceManager.h" #include "EterLib/ResourceManager.h"
#include "EterLib/StateManager.h" #include "EterLib/StateManager.h"
#include "EffectLib/EffectManager.h" #include "EffectLib/EffectManager.h"
#include "SpeedTreeLib/SpeedTreeForestDirectX8.h" #include "SpeedTreeLib/SpeedTreeForestDirectX.h"
#include "EterBase/Timer.h" #include "EterBase/Timer.h"
#include "Area.h" #include "Area.h"
@@ -550,7 +550,7 @@ void CArea::__SetObjectInstance_SetTree(TObjectInstance * pObjectInstance, const
void CArea::TObjectInstance::SetTree(float x, float y, float z, DWORD dwTreeCRC, const char* c_szTreeName) void CArea::TObjectInstance::SetTree(float x, float y, float z, DWORD dwTreeCRC, const char* c_szTreeName)
{ {
CSpeedTreeForestDirectX8& rkForest=CSpeedTreeForestDirectX8::Instance(); CSpeedTreeForestDirectX& rkForest=CSpeedTreeForestDirectX::Instance();
pTree=rkForest.CreateInstance(x, y, z, dwTreeCRC, c_szTreeName); pTree=rkForest.CreateInstance(x, y, z, dwTreeCRC, c_szTreeName);
dwType = prt::PROPERTY_TYPE_TREE; dwType = prt::PROPERTY_TYPE_TREE;
} }
@@ -1106,7 +1106,7 @@ void CArea::__Clear_DestroyObjectInstance(TObjectInstance * pObjectInstance)
if (pObjectInstance->pTree) if (pObjectInstance->pTree)
{ {
pObjectInstance->pTree->Clear(); pObjectInstance->pTree->Clear();
CSpeedTreeForestDirectX8::Instance().DeleteInstance(pObjectInstance->pTree); CSpeedTreeForestDirectX::Instance().DeleteInstance(pObjectInstance->pTree);
pObjectInstance->pTree = NULL; pObjectInstance->pTree = NULL;
} }

View File

@@ -290,7 +290,7 @@ void CMapManager::BeginEnvironment()
// MR-14: -- END OF -- Fog update by Alaric // MR-14: -- END OF -- Fog update by Alaric
else else
{ {
CSpeedTreeForestDirectX8& rkForest=CSpeedTreeForestDirectX8::Instance(); CSpeedTreeForestDirectX& rkForest=CSpeedTreeForestDirectX::Instance();
rkForest.SetFog( rkForest.SetFog(
mc_pcurEnvironmentData->GetFogNearDistance(), mc_pcurEnvironmentData->GetFogNearDistance(),
mc_pcurEnvironmentData->GetFogFarDistance() mc_pcurEnvironmentData->GetFogFarDistance()

View File

@@ -107,7 +107,7 @@ class CMapManager : public CScreen, public IPhysicsWorld
// Map // Map
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
CMapOutdoor * m_pkMap; CMapOutdoor * m_pkMap;
CSpeedTreeForestDirectX8 m_Forest; CSpeedTreeForestDirectX m_Forest;
public: public:
// 2004.10.14.myevan.TEMP_CAreaLoaderThread // 2004.10.14.myevan.TEMP_CAreaLoaderThread

View File

@@ -209,7 +209,7 @@ bool CMapOutdoor::Destroy()
m_rkList_kGuildArea.clear(); m_rkList_kGuildArea.clear();
m_kPool_kMonsterAreaInfo.Destroy(); m_kPool_kMonsterAreaInfo.Destroy();
CSpeedTreeForestDirectX8::Instance().Clear(); CSpeedTreeForestDirectX::Instance().Clear();
return true; return true;
} }
@@ -239,7 +239,7 @@ void CMapOutdoor::OnBeginEnvironment()
if (!mc_pEnvironmentData) if (!mc_pEnvironmentData)
return; return;
CSpeedTreeForestDirectX8& rkForest=CSpeedTreeForestDirectX8::Instance(); CSpeedTreeForestDirectX& rkForest=CSpeedTreeForestDirectX::Instance();
rkForest.SetFog( rkForest.SetFog(
mc_pEnvironmentData->GetFogNearDistance(), mc_pEnvironmentData->GetFogNearDistance(),
mc_pEnvironmentData->GetFogFarDistance() mc_pEnvironmentData->GetFogFarDistance()
@@ -1251,7 +1251,7 @@ void CMapOutdoor::XMasTree_Destroy()
{ {
if (m_kXMas.m_pkTree) if (m_kXMas.m_pkTree)
{ {
CSpeedTreeForestDirectX8& rkForest=CSpeedTreeForestDirectX8::Instance(); CSpeedTreeForestDirectX& rkForest=CSpeedTreeForestDirectX::Instance();
m_kXMas.m_pkTree->Clear(); m_kXMas.m_pkTree->Clear();
rkForest.DeleteInstance(m_kXMas.m_pkTree); rkForest.DeleteInstance(m_kXMas.m_pkTree);
m_kXMas.m_pkTree=NULL; m_kXMas.m_pkTree=NULL;
@@ -1269,7 +1269,7 @@ void CMapOutdoor::__XMasTree_Create(float x, float y, float z, const char* c_szT
assert(NULL==m_kXMas.m_pkTree); assert(NULL==m_kXMas.m_pkTree);
assert(-1==m_kXMas.m_iEffectID); assert(-1==m_kXMas.m_iEffectID);
CSpeedTreeForestDirectX8& rkForest=CSpeedTreeForestDirectX8::Instance(); CSpeedTreeForestDirectX& rkForest=CSpeedTreeForestDirectX::Instance();
DWORD dwCRC32 = GetCaseCRC32(c_szTreeName, strlen(c_szTreeName)); DWORD dwCRC32 = GetCaseCRC32(c_szTreeName, strlen(c_szTreeName));
m_kXMas.m_pkTree=rkForest.CreateInstance(x, y, z, dwCRC32, c_szTreeName); m_kXMas.m_pkTree=rkForest.CreateInstance(x, y, z, dwCRC32, c_szTreeName);

View File

@@ -7,7 +7,7 @@
#include "PRTerrainLib/TerrainType.h" #include "PRTerrainLib/TerrainType.h"
#include "PRTerrainLib/TextureSet.h" #include "PRTerrainLib/TextureSet.h"
#include "SpeedTreeLib/SpeedTreeForestDirectX8.h" #include "SpeedTreeLib/SpeedTreeForestDirectX.h"
#include "MapBase.h" #include "MapBase.h"
#include "Area.h" #include "Area.h"

View File

@@ -33,7 +33,7 @@ bool CMapOutdoor::Load(float x, float y, float z)
m_lOldReadX = -1; m_lOldReadX = -1;
// TODO: SetRenderingDevice에서 Environment로 부터 라이트 속성을 넘겨줘야 스태틱 라이트가 제대로 작동한다. // TODO: SetRenderingDevice에서 Environment로 부터 라이트 속성을 넘겨줘야 스태틱 라이트가 제대로 작동한다.
CSpeedTreeForestDirectX8::Instance().SetRenderingDevice(ms_lpd3dDevice); CSpeedTreeForestDirectX::Instance().SetRenderingDevice(ms_lpd3dDevice);
Update(x, y, z); Update(x, y, z);

View File

@@ -238,7 +238,7 @@ void CMapOutdoor::RenderCloud()
void CMapOutdoor::RenderTree() void CMapOutdoor::RenderTree()
{ {
if (IsVisiblePart(PART_TREE)) if (IsVisiblePart(PART_TREE))
CSpeedTreeForestDirectX8::Instance().Render(); CSpeedTreeForestDirectX::Instance().Render();
} }
void CMapOutdoor::SetInverseViewAndDynamicShaodwMatrices() void CMapOutdoor::SetInverseViewAndDynamicShaodwMatrices()

View File

@@ -112,7 +112,7 @@ bool CMapOutdoor::Update(float fX, float fY, float fZ)
#ifdef __PERFORMANCE_CHECKER__ #ifdef __PERFORMANCE_CHECKER__
DWORD t3=ELTimer_GetMSec(); DWORD t3=ELTimer_GetMSec();
#endif #endif
CSpeedTreeForestDirectX8::Instance().UpdateSystem(CTimer::Instance().GetCurrentSecond()); CSpeedTreeForestDirectX::Instance().UpdateSystem(CTimer::Instance().GetCurrentSecond());
#ifdef __PERFORMANCE_CHECKER__ #ifdef __PERFORMANCE_CHECKER__
DWORD t4=ELTimer_GetMSec(); DWORD t4=ELTimer_GetMSec();
#endif #endif

View File

@@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// CSpeedTreeForestDirectX8 Class // CSpeedTreeForestDirectX Class
// //
// (c) 2003 IDV, Inc. // (c) 2003 IDV, Inc.
// //
@@ -38,29 +38,29 @@
#include "EterLib/StateManager.h" #include "EterLib/StateManager.h"
#include "EterLib/Camera.h" #include "EterLib/Camera.h"
#include "SpeedTreeForestDirectX8.h" #include "SpeedTreeForestDirectX.h"
#include "SpeedTreeConfig.h" #include "SpeedTreeConfig.h"
#include "VertexShaders.h" #include "VertexShaders.h"
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// CSpeedTreeForestDirectX8::CSpeedTreeForestDirectX8 // CSpeedTreeForestDirectX::CSpeedTreeForestDirectX
CSpeedTreeForestDirectX8::CSpeedTreeForestDirectX8() : m_dwBranchVertexShader(nullptr), m_pLeafVertexShaderDecl(nullptr), m_pLeafVertexShader(nullptr) CSpeedTreeForestDirectX::CSpeedTreeForestDirectX() : m_dwBranchVertexShader(nullptr), m_pLeafVertexShaderDecl(nullptr), m_pLeafVertexShader(nullptr)
{ {
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// CSpeedTreeForestDirectX8::~CSpeedTreeForestDirectX8 // CSpeedTreeForestDirectX::~CSpeedTreeForestDirectX
CSpeedTreeForestDirectX8::~CSpeedTreeForestDirectX8() CSpeedTreeForestDirectX::~CSpeedTreeForestDirectX()
{ {
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// CSpeedTreeForestDirectX8::InitVertexShaders // CSpeedTreeForestDirectX::InitVertexShaders
bool CSpeedTreeForestDirectX8::InitVertexShaders(void) bool CSpeedTreeForestDirectX::InitVertexShaders(void)
{ {
// load the vertex shaders // load the vertex shaders
if (!m_dwBranchVertexShader) if (!m_dwBranchVertexShader)
@@ -78,7 +78,7 @@ bool CSpeedTreeForestDirectX8::InitVertexShaders(void)
return false; return false;
} }
bool CSpeedTreeForestDirectX8::SetRenderingDevice(LPDIRECT3DDEVICE9 lpDevice) bool CSpeedTreeForestDirectX::SetRenderingDevice(LPDIRECT3DDEVICE9 lpDevice)
{ {
m_pDx = lpDevice; m_pDx = lpDevice;
@@ -108,14 +108,14 @@ bool CSpeedTreeForestDirectX8::SetRenderingDevice(LPDIRECT3DDEVICE9 lpDevice)
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// CSpeedTreeForestDirectX8::UploadWindMatrix // CSpeedTreeForestDirectX::UploadWindMatrix
void CSpeedTreeForestDirectX8::UploadWindMatrix(UINT uiLocation, const float* pMatrix) const void CSpeedTreeForestDirectX::UploadWindMatrix(UINT uiLocation, const float* pMatrix) const
{ {
STATEMANAGER.SetVertexShaderConstant(uiLocation, pMatrix, 4); STATEMANAGER.SetVertexShaderConstant(uiLocation, pMatrix, 4);
} }
void CSpeedTreeForestDirectX8::UpdateCompundMatrix(const D3DXVECTOR3& c_rEyeVec, const D3DXMATRIX& c_rmatView, const D3DXMATRIX& c_rmatProj) void CSpeedTreeForestDirectX::UpdateCompundMatrix(const D3DXVECTOR3& c_rEyeVec, const D3DXMATRIX& c_rmatView, const D3DXMATRIX& c_rmatProj)
{ {
// setup composite matrix for shader // setup composite matrix for shader
D3DXMATRIX matBlend; D3DXMATRIX matBlend;
@@ -135,9 +135,9 @@ void CSpeedTreeForestDirectX8::UpdateCompundMatrix(const D3DXVECTOR3& c_rEyeVec,
} }
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// CSpeedTreeForestDirectX8::Render // CSpeedTreeForestDirectX::Render
void CSpeedTreeForestDirectX8::Render(unsigned long ulRenderBitVector) void CSpeedTreeForestDirectX::Render(unsigned long ulRenderBitVector)
{ {
UpdateSystem(CTimer::Instance().GetCurrentSecond()); UpdateSystem(CTimer::Instance().GetCurrentSecond());

View File

@@ -40,12 +40,12 @@
#include "SpeedTreeMaterial.h" #include "SpeedTreeMaterial.h"
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// class CSpeedTreeForestDirectX8 declaration // class CSpeedTreeForestDirectX declaration
class CSpeedTreeForestDirectX8 : public CSpeedTreeForest, public CGraphicBase, public CSingleton<CSpeedTreeForestDirectX8> class CSpeedTreeForestDirectX : public CSpeedTreeForest, public CGraphicBase, public CSingleton<CSpeedTreeForestDirectX>
{ {
public: public:
CSpeedTreeForestDirectX8(); CSpeedTreeForestDirectX();
virtual ~CSpeedTreeForestDirectX8(); virtual ~CSpeedTreeForestDirectX();
void UploadWindMatrix(unsigned int uiLocation, const float* pMatrix) const; void UploadWindMatrix(unsigned int uiLocation, const float* pMatrix) const;
void UpdateCompundMatrix(const D3DXVECTOR3 & c_rEyeVec, const D3DXMATRIX & c_rmatView, const D3DXMATRIX& c_rmatProj); void UpdateCompundMatrix(const D3DXVECTOR3 & c_rEyeVec, const D3DXMATRIX & c_rmatView, const D3DXMATRIX& c_rmatProj);

View File

@@ -44,7 +44,7 @@
#include "EterLib/StateManager.h" #include "EterLib/StateManager.h"
#include "SpeedTreeConfig.h" #include "SpeedTreeConfig.h"
#include "SpeedTreeForestDirectX8.h" #include "SpeedTreeForestDirectX.h"
#include "SpeedTreeWrapper.h" #include "SpeedTreeWrapper.h"
#include "VertexShaders.h" #include "VertexShaders.h"
@@ -92,7 +92,7 @@ void CSpeedTreeWrapper::SetVertexShaders(LPDIRECT3DVERTEXDECLARATION9 pBranchVer
void CSpeedTreeWrapper::OnRenderPCBlocker() void CSpeedTreeWrapper::OnRenderPCBlocker()
{ {
if (!ms_dwBranchVertexShader || !ms_pLeafVertexShaderDecl || !ms_pLeafVertexShader) if (!ms_dwBranchVertexShader || !ms_pLeafVertexShaderDecl || !ms_pLeafVertexShader)
CSpeedTreeForestDirectX8::Instance().EnsureVertexShaders(); CSpeedTreeForestDirectX::Instance().EnsureVertexShaders();
if (ms_dwBranchVertexShader == 0) if (ms_dwBranchVertexShader == 0)
{ {
@@ -100,13 +100,12 @@ void CSpeedTreeWrapper::OnRenderPCBlocker()
//LogBox("Vertex Shader not assigned. You must call CSpeedTreeWrapper::SetVertexShader for this"); //LogBox("Vertex Shader not assigned. You must call CSpeedTreeWrapper::SetVertexShader for this");
} }
CSpeedTreeForestDirectX8::Instance().UpdateSystem(ELTimer_GetMSec() / 1000.0f); CSpeedTreeForestDirectX::Instance().UpdateSystem(ELTimer_GetMSec() / 1000.0f);
// �ϳ��� ������ �� ���� LOD ������� ����
m_pSpeedTree->SetLodLevel(1.0f); m_pSpeedTree->SetLodLevel(1.0f);
//Advance(); //Advance();
CSpeedTreeForestDirectX8::Instance().UpdateCompundMatrix(CCameraManager::Instance().GetCurrentCamera()->GetEye(), ms_matView, ms_matProj); CSpeedTreeForestDirectX::Instance().UpdateCompundMatrix(CCameraManager::Instance().GetCurrentCamera()->GetEye(), ms_matView, ms_matProj);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE); STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);
@@ -241,7 +240,7 @@ void CSpeedTreeWrapper::OnRenderPCBlocker()
void CSpeedTreeWrapper::OnRender() void CSpeedTreeWrapper::OnRender()
{ {
if (!ms_dwBranchVertexShader || !ms_pLeafVertexShaderDecl || !ms_pLeafVertexShader) if (!ms_dwBranchVertexShader || !ms_pLeafVertexShaderDecl || !ms_pLeafVertexShader)
CSpeedTreeForestDirectX8::Instance().EnsureVertexShaders(); CSpeedTreeForestDirectX::Instance().EnsureVertexShaders();
if (ms_dwBranchVertexShader == 0) if (ms_dwBranchVertexShader == 0)
{ {
@@ -249,13 +248,13 @@ void CSpeedTreeWrapper::OnRender()
//LogBox("Vertex Shader not assigned. You must call CSpeedTreeWrapper::SetVertexShader for this"); //LogBox("Vertex Shader not assigned. You must call CSpeedTreeWrapper::SetVertexShader for this");
} }
CSpeedTreeForestDirectX8::Instance().UpdateSystem(ELTimer_GetMSec() / 1000.0f); CSpeedTreeForestDirectX::Instance().UpdateSystem(ELTimer_GetMSec() / 1000.0f);
// �ϳ��� ������ �� ���� LOD ������� ���� // �ϳ��� ������ �� ���� LOD ������� ����
m_pSpeedTree->SetLodLevel(1.0f); m_pSpeedTree->SetLodLevel(1.0f);
//Advance(); //Advance();
CSpeedTreeForestDirectX8::Instance().UpdateCompundMatrix(CCameraManager::Instance().GetCurrentCamera()->GetEye(), ms_matView, ms_matProj); CSpeedTreeForestDirectX::Instance().UpdateCompundMatrix(CCameraManager::Instance().GetCurrentCamera()->GetEye(), ms_matView, ms_matProj);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE); STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TEXTURE);
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE); STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_DIFFUSE);

View File

@@ -5,4 +5,4 @@
//#include <crtdbg.h> //#include <crtdbg.h>
//#include "Forest.h" //#include "Forest.h"
#include "SpeedTreeForestDirectX8.h" #include "SpeedTreeForestDirectX.h"

View File

@@ -1127,8 +1127,7 @@ void CPythonApplication::Destroy()
m_grpDevice.Destroy(); m_grpDevice.Destroy();
// FIXME : ¸¸µé¾îÁ® ÀÖÁö ¾ÊÀ½ - [levites] //CSpeedTreeForestDirectX::Instance().Clear();
//CSpeedTreeForestDirectX8::Instance().Clear();
CAttributeInstance::DestroySystem(); CAttributeInstance::DestroySystem();
CTextFileLoader::DestroySystem(); CTextFileLoader::DestroySystem();