port: EffectLib + EterBase/Utils platform bodies (1:1 40250)
EffectLib's 18 units are copied verbatim (Type.h: drop a comment backslash that clang splices into the next enum line). The remaining Utils stubs get the 40250 bodies, so .msf fly data resolve relative .mse attachments, and CPythonResource registers mde/mdatr as 40250 does. login_flow spawns level_up.mse and sees its particle draws. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
03de3f314a
commit
b69116992c
@@ -1,144 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EffectData.h (40250 EffectLib/EffectData.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EffectData.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CEffectData::CEffectData()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEffectData::~CEffectData()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectData::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectData::LoadScript(const char *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectData::LoadSoundScriptData(const char *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetParticleCount() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetParticlePointer(DWORD) -> CParticleSystemData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CParticleSystemData *>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetMeshCount() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetMeshPointer(DWORD) -> CEffectMeshScript *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CEffectMeshScript *>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetLightCount() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetLightPointer(DWORD) -> CLightData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CLightData *>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetSoundInstanceVector() -> NSound::TSoundInstanceVector *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<NSound::TSoundInstanceVector *>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetBoundingSphereRadius() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetBoundingSpherePosition() -> D3DXVECTOR3
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<D3DXVECTOR3>();
|
||||
}
|
||||
|
||||
auto CEffectData::GetFileName() const -> const char *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const char *>();
|
||||
}
|
||||
|
||||
auto CEffectData::__ClearParticleDataVector() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectData::__ClearLightDataVector() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectData::__ClearMeshDataVector() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectData::AllocParticle() -> CParticleSystemData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CParticleSystemData *>();
|
||||
}
|
||||
|
||||
auto CEffectData::AllocMesh() -> CEffectMeshScript *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CEffectMeshScript *>();
|
||||
}
|
||||
|
||||
auto CEffectData::AllocLight() -> CLightData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CLightData *>();
|
||||
}
|
||||
|
||||
auto CEffectData::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectData::New() -> CEffectData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CEffectData *>();
|
||||
}
|
||||
|
||||
auto CEffectData::Delete(CEffectData *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CEffectData::ms_kPool) CEffectData::ms_kPool{};
|
||||
@@ -1,44 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EffectElementBase.h (40250 EffectLib/EffectElementBase.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EffectElementBase.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CEffectElementBase::CEffectElementBase()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEffectElementBase::~CEffectElementBase()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBase::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBase::isData() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectElementBase::LoadScript(CTextFileLoader &) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectElementBase::GetPosition(float, D3DXVECTOR3 &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBase::GetStartTime() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
@@ -1,63 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EffectElementBaseInstance.h (40250 EffectLib/EffectElementBaseInstance.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EffectElementBaseInstance.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CEffectElementBaseInstance::CEffectElementBaseInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEffectElementBaseInstance::~CEffectElementBaseInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::SetDataPointer(CEffectElementBase *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::SetLocalMatrixPointer(const D3DXMATRIX *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::Update(float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::Render() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::isActive() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::SetActive() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectElementBaseInstance::SetDeactive() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -1,125 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EffectInstance.h (40250 EffectLib/EffectInstance.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EffectInstance.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
auto CEffectInstance::GetBoundingSphere(D3DXVECTOR3 &, float &) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectInstance::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::New() -> CEffectInstance *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CEffectInstance *>();
|
||||
}
|
||||
|
||||
auto CEffectInstance::Delete(CEffectInstance *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::ResetRenderingEffectCount() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::GetRenderingEffectCount() -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
CEffectInstance::CEffectInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEffectInstance::~CEffectInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::LessRenderOrder(CEffectInstance *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectInstance::SetEffectDataPointer(CEffectData *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::isAlive() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectInstance::SetActive() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::SetDeactive() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::SetGlobalMatrix(const D3DXMATRIX &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::UpdateSound() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::OnUpdate() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::OnRender() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::__Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::__SetParticleData(CParticleSystemData *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::__SetMeshData(CEffectMeshScript *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectInstance::__SetLightData(CLightData *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CEffectInstance::ms_kPool) CEffectInstance::ms_kPool{};
|
||||
|
||||
decltype(CEffectInstance::ms_iRenderingEffectCount) CEffectInstance::ms_iRenderingEffectCount{};
|
||||
@@ -1,189 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EffectManager.h (40250 EffectLib/EffectManager.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EffectManager.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CEffectManager::CEffectManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEffectManager::~CEffectManager()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::UpdateSound() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::Update() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::Render() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::GetInfo(std::string *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::IsAliveEffect(DWORD) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectManager::RegisterEffect(const char *, bool, bool) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectManager::RegisterEffect2(const char *, DWORD *, bool) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectManager::DeleteAllInstances() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::CreateEffect(DWORD, const D3DXVECTOR3 &, const D3DXVECTOR3 &) -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CEffectManager::CreateEffect(const char *, const D3DXVECTOR3 &, const D3DXVECTOR3 &) -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CEffectManager::CreateEffectInstance(DWORD, DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::SelectEffectInstance(DWORD) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectManager::DestroyEffectInstance(DWORD) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectManager::DeactiveEffectInstance(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::SetEffectTextures(DWORD, std::vector<std::string>) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::SetEffectInstancePosition(const D3DXVECTOR3 &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::SetEffectInstanceRotation(const D3DXVECTOR3 &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::SetEffectInstanceGlobalMatrix(const D3DXMATRIX &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::ShowEffect() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::HideEffect() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::GetRandomEffect() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CEffectManager::GetEmptyIndex() -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CEffectManager::GetEffectData(DWORD, CEffectData **) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectManager::GetEffectData(DWORD, const CEffectData **) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectManager::CreateUnsafeEffectInstance(DWORD, CEffectInstance **) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::DestroyUnsafeEffectInstance(CEffectInstance *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectManager::GetRenderingEffectCount() -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CEffectManager::__Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::__DestroyEffectInstanceMap() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::__DestroyEffectCacheMap() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectManager::__DestroyEffectDataMap() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -1,269 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EffectMesh.h (40250 EffectLib/EffectMesh.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EffectMesh.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
auto CEffectMesh::SEffectMeshData::New() -> SEffectMeshData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<SEffectMeshData *>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::SEffectMeshData::Delete(SEffectMeshData *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMesh::SEffectMeshData::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CEffectMesh::SEffectMeshData::ms_kPool) CEffectMesh::SEffectMeshData::ms_kPool{};
|
||||
|
||||
auto CEffectMesh::Type() -> TType
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<TType>();
|
||||
}
|
||||
|
||||
CEffectMesh::CEffectMesh(const char * c_szFileName) : CResource(c_szFileName) // initializers as in 40250
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEffectMesh::~CEffectMesh()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMesh::GetFrameCount() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::GetMeshCount() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::GetMeshDataPointer(DWORD) -> TEffectMeshData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<TEffectMeshData *>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::GetTextureVectorPointer(DWORD) -> std::vector<CGraphicImage *> *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<std::vector<CGraphicImage *> *>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::GetTextureVectorReference(DWORD) -> std::vector<CGraphicImage *> &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<std::vector<CGraphicImage *> &>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::GetMeshElementPointer(DWORD, TEffectMeshData **) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::OnLoad(int, const void *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::OnClear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMesh::OnIsEmpty() const -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::OnIsType(TType) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::__LoadData_Ver001(int, const BYTE *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMesh::__LoadData_Ver002(int, const BYTE *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
CEffectMeshScript::CEffectMeshScript()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEffectMeshScript::~CEffectMeshScript()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetMeshFileName() -> const char *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const char *>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::ReserveMeshData(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::CheckMeshIndex(DWORD) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetMeshDataPointer(DWORD, TMeshData **) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetMeshDataCount() -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetBillboardType(DWORD) -> int
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<int>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::isBlendingEnable(DWORD) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetBlendingSrcType(DWORD) -> BYTE
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BYTE>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetBlendingDestType(DWORD) -> BYTE
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BYTE>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::isTextureAlphaEnable(DWORD) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetColorOperationType(DWORD, BYTE *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetColorFactor(DWORD, D3DXCOLOR *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetTimeTableAlphaPointer(DWORD, TTimeEventTableFloat **) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::isMeshAnimationLoop() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetMeshAnimationLoopCount() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetMeshAnimationFrameDelay() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::isTextureAnimationLoop(DWORD) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetTextureAnimationFrameDelay(DWORD) -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::GetTextureAnimationStartFrame(DWORD) -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::OnClear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::OnIsData() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::OnLoadScript(CTextFileLoader &) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::New() -> CEffectMeshScript *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CEffectMeshScript *>();
|
||||
}
|
||||
|
||||
auto CEffectMeshScript::Delete(CEffectMeshScript *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CEffectMeshScript::ms_kPool) CEffectMeshScript::ms_kPool{};
|
||||
@@ -1,66 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EffectMeshInstance.h (40250 EffectLib/EffectMeshInstance.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EffectMeshInstance.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CEffectMeshInstance::CEffectMeshInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEffectMeshInstance::~CEffectMeshInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshInstance::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshInstance::New() -> CEffectMeshInstance *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CEffectMeshInstance *>();
|
||||
}
|
||||
|
||||
auto CEffectMeshInstance::Delete(CEffectMeshInstance *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CEffectMeshInstance::ms_kPool) CEffectMeshInstance::ms_kPool{};
|
||||
|
||||
auto CEffectMeshInstance::OnSetDataPointer(CEffectElementBase *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshInstance::OnInitialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshInstance::OnDestroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshInstance::OnUpdate(float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CEffectMeshInstance::OnRender() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEffectMeshInstance::isActive() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EffectUpdateDecorator.h (40250 EffectLib/EffectUpdateDecorator.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EffectUpdateDecorator.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
auto NEffectUpdateDecorator::CAirResistanceDecorator::__Excute(const CDecoratorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto NEffectUpdateDecorator::CAirResistanceDecorator::__Clone(CParticleInstance *, CParticleInstance *) -> CBaseDecorator *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CBaseDecorator *>();
|
||||
}
|
||||
|
||||
auto NEffectUpdateDecorator::CGravityDecorator::__Excute(const CDecoratorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto NEffectUpdateDecorator::CGravityDecorator::__Clone(CParticleInstance *, CParticleInstance *) -> CBaseDecorator *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CBaseDecorator *>();
|
||||
}
|
||||
|
||||
auto NEffectUpdateDecorator::CRotationDecorator::__Excute(const CDecoratorData &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto NEffectUpdateDecorator::CRotationDecorator::__Clone(CParticleInstance *, CParticleInstance *) -> CBaseDecorator *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CBaseDecorator *>();
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
// Platform skeleton for EffectLib/EmitterProperty.h (40250 EffectLib/EmitterProperty.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/EmitterProperty.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CEmitterProperty::CEmitterProperty()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CEmitterProperty::~CEmitterProperty()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmitterShape() -> BYTE
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BYTE>();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmitterAdvancedType() -> BYTE
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BYTE>();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::isEmitFromEdge() -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmittingSize(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmittingAngularVelocity(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmittingDirectionX(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmittingDirectionY(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmittingDirectionZ(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmittingVelocity(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetEmissionCountPerSecond(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetParticleLifeTime(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetParticleSizeX(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CEmitterProperty::GetParticleSizeY(float, float *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
// Platform skeleton for EffectLib/FrameController.h (40250 EffectLib/FrameController.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/FrameController.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CFrameController::CFrameController()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CFrameController::~CFrameController()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::Update(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::SetCurrentFrame(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::GetCurrentFrame() -> BYTE
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BYTE>();
|
||||
}
|
||||
|
||||
auto CFrameController::SetMaxFrame(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::SetFrameTime(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::SetStartFrame(DWORD) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::SetLoopFlag(BOOL) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::SetLoopCount(int) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::SetActive(BOOL) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CFrameController::isActive(DWORD) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
// Platform skeleton for EffectLib/ParticleInstance.h (40250 EffectLib/ParticleInstance.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/ParticleInstance.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CParticleInstance::CParticleInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CParticleInstance::~CParticleInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleInstance::GetRadiusApproximation() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CParticleInstance::Update(float, float) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CParticleInstance::New() -> CParticleInstance *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CParticleInstance *>();
|
||||
}
|
||||
|
||||
auto CParticleInstance::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleInstance::Transform(const D3DXMATRIX *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleInstance::Transform(const D3DXMATRIX *, const float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleInstance::GetParticleMeshPointer() -> TPTVertex *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<TPTVertex *>();
|
||||
}
|
||||
|
||||
auto CParticleInstance::DeleteThis() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleInstance::Destroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleInstance::__Initialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CParticleInstance::ms_kPool) CParticleInstance::ms_kPool{};
|
||||
@@ -1,38 +0,0 @@
|
||||
// Platform skeleton for EffectLib/ParticleProperty.h (40250 EffectLib/ParticleProperty.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/ParticleProperty.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CParticleProperty::CParticleProperty()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CParticleProperty::~CParticleProperty()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleProperty::Clear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleProperty::InsertTexture(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleProperty::SetTexture(const char *) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CParticleProperty::operator=(const CParticleProperty &) -> CParticleProperty &
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CParticleProperty &>();
|
||||
}
|
||||
@@ -1,73 +0,0 @@
|
||||
// Platform skeleton for EffectLib/ParticleSystemData.h (40250 EffectLib/ParticleSystemData.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/ParticleSystemData.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CParticleSystemData::~CParticleSystemData()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CParticleSystemData::CParticleSystemData()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::GetEmitterPropertyPointer() -> CEmitterProperty *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CEmitterProperty *>();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::GetParticlePropertyPointer() -> CParticleProperty *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CParticleProperty *>();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::ChangeTexture(const char *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::BuildDecorator(CParticleInstance *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::OnLoadScript(CTextFileLoader &) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::OnClear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::OnIsData() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::New() -> CParticleSystemData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CParticleSystemData *>();
|
||||
}
|
||||
|
||||
auto CParticleSystemData::Delete(CParticleSystemData *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CParticleSystemData::ms_kPool) CParticleSystemData::ms_kPool{};
|
||||
@@ -1,71 +0,0 @@
|
||||
// Platform skeleton for EffectLib/ParticleSystemInstance.h (40250 EffectLib/ParticleSystemInstance.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/ParticleSystemInstance.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
auto CParticleSystemInstance::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::New() -> CParticleSystemInstance *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CParticleSystemInstance *>();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::Delete(CParticleSystemInstance *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CParticleSystemInstance::ms_kPool) CParticleSystemInstance::ms_kPool{};
|
||||
|
||||
CParticleSystemInstance::CParticleSystemInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CParticleSystemInstance::~CParticleSystemInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::OnSetDataPointer(CEffectElementBase *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::CreateParticles(float) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::GetEmissionCount() -> DWORD
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<DWORD>();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::OnInitialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::OnDestroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::OnUpdate(float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CParticleSystemInstance::OnRender() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
// Platform skeleton for EffectLib/SimpleLightData.h (40250 EffectLib/SimpleLightData.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/SimpleLightData.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CLightData::CLightData()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CLightData::~CLightData()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightData::GetRange(float, float &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightData::GetDuration() -> float
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<float>();
|
||||
}
|
||||
|
||||
auto CLightData::InitializeLight(D3DLIGHT8 &) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightData::OnClear() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightData::OnIsData() -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CLightData::OnLoadScript(CTextFileLoader &) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
|
||||
auto CLightData::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightData::New() -> CLightData *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CLightData *>();
|
||||
}
|
||||
|
||||
auto CLightData::Delete(CLightData *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CLightData::ms_kPool) CLightData::ms_kPool{};
|
||||
@@ -1,60 +0,0 @@
|
||||
// Platform skeleton for EffectLib/SimpleLightInstance.h (40250 EffectLib/SimpleLightInstance.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/SimpleLightInstance.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
CLightInstance::CLightInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
CLightInstance::~CLightInstance()
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightInstance::OnSetDataPointer(CEffectElementBase *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightInstance::OnInitialize() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightInstance::OnDestroy() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightInstance::OnUpdate(float) -> bool
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
}
|
||||
|
||||
auto CLightInstance::OnRender() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightInstance::DestroySystem() -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
auto CLightInstance::New() -> CLightInstance *
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<CLightInstance *>();
|
||||
}
|
||||
|
||||
auto CLightInstance::Delete(CLightInstance *) -> void
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
}
|
||||
|
||||
decltype(CLightInstance::ms_kPool) CLightInstance::ms_kPool{};
|
||||
@@ -1,12 +0,0 @@
|
||||
// Platform skeleton for EffectLib/Type.h (40250 EffectLib/Type.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation.
|
||||
#include "EffectLib/StdAfx.h"
|
||||
#include "EffectLib/Type.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
|
||||
auto GetTokenTimeEventFloat(CTextFileLoader &, const char *, TTimeEventTableFloat *) -> BOOL
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<BOOL>();
|
||||
}
|
||||
@@ -1,73 +1,276 @@
|
||||
// Platform skeleton for EterBase/Utils.h (40250 EterBase/Utils.cpp), generated by platform_stub.py.
|
||||
// Every MT_PLATFORM_STUB() body is unimplemented: replace it with the platform implementation. Implemented
|
||||
// bodies are the 40250 code (batch 2D: the path helpers EterPack uses); stl_lowers lives in EterBase/Stl.cpp.
|
||||
// Platform implementation of EterBase/Utils.h (40250 EterBase/Utils.cpp). The pure string/path helpers are the
|
||||
// 40250 bodies verbatim (PORT-PLAN §3); Win32 calls are swapped for POSIX ones where marked PORT.
|
||||
// stl_lowers lives in EterBase/Stl.cpp.
|
||||
#include "EterBase/StdAfx.h"
|
||||
#include "EterBase/Utils.h"
|
||||
#include "EterBase/Stl.h"
|
||||
|
||||
#include "../PlatformStub.h"
|
||||
#include <assert.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
auto CreateTempFileName(const char *) -> const char *
|
||||
#include <algorithm>
|
||||
#include <filesystem>
|
||||
|
||||
// PORT: GetTempPath/GetTempFileName -> $TMPDIR + mkstemp (same "<prefix>XXXX" unique-file contract).
|
||||
const char * CreateTempFileName(const char * c_pszPrefix)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const char *>();
|
||||
static char szTempName[MAX_PATH + 1];
|
||||
|
||||
const char * tmp = getenv("TMPDIR");
|
||||
snprintf(szTempName, sizeof(szTempName), "%s/%sXXXXXX", tmp && *tmp ? tmp : "/tmp", c_pszPrefix ? c_pszPrefix : "etb");
|
||||
int fd = mkstemp(szTempName);
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
|
||||
return (szTempName);
|
||||
}
|
||||
|
||||
auto GetFilePathNameExtension(const char *, int, std::string *, std::string *, std::string *) -> void
|
||||
void GetFilePathNameExtension(const char * c_szFile, int len, std::string * pstPath, std::string * pstName, std::string * pstExt)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
assert(pstPath != NULL);
|
||||
assert(pstName != NULL);
|
||||
assert(pstExt != NULL);
|
||||
|
||||
int ext = len;
|
||||
int pos = len;
|
||||
|
||||
while (pos > 0)
|
||||
{
|
||||
--pos;
|
||||
char c = c_szFile[pos];
|
||||
|
||||
if (ext == len && c == '.')
|
||||
{
|
||||
ext = pos;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '/' || c == '\\')
|
||||
break;
|
||||
}
|
||||
|
||||
while (pos > 0)
|
||||
{
|
||||
--pos;
|
||||
char c = c_szFile[pos];
|
||||
|
||||
if (c == '/' || c == '\\')
|
||||
break;
|
||||
}
|
||||
|
||||
if (pos)
|
||||
{
|
||||
++pos;
|
||||
pstPath->append(c_szFile, pos);
|
||||
}
|
||||
|
||||
if (ext > pos)
|
||||
pstName->append(c_szFile + pos, ext - pos);
|
||||
|
||||
++ext;
|
||||
|
||||
if (len > ext)
|
||||
pstExt->append(c_szFile + ext, len - ext);
|
||||
}
|
||||
|
||||
auto GetFileExtension(const char *, int, std::string *) -> void
|
||||
void GetFileExtension(const char* c_szFile, int len, std::string* pstExt)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
int ext = len;
|
||||
int pos = len;
|
||||
while (pos > 0)
|
||||
{
|
||||
--pos;
|
||||
char c=c_szFile[pos];
|
||||
if (ext==len && c=='.')
|
||||
{
|
||||
ext=pos;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c=='/') break;
|
||||
else if (c=='\\') break;
|
||||
}
|
||||
|
||||
++ext;
|
||||
if (len>ext)
|
||||
pstExt->append(c_szFile+ext, len-ext);
|
||||
}
|
||||
|
||||
auto GetFileNameParts(const char *, int, char *, char *, char *) -> void
|
||||
void GetFileNameParts(const char* c_szFile, int len, char* pszPath, char* pszName, char* pszExt)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
assert(pszPath!=NULL);
|
||||
assert(pszName!=NULL);
|
||||
assert(pszExt!=NULL);
|
||||
|
||||
int ext=len;
|
||||
int pos=len;
|
||||
while (pos>0)
|
||||
{
|
||||
--pos;
|
||||
char c=c_szFile[pos];
|
||||
if (ext==len && c=='.')
|
||||
{
|
||||
ext=pos;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c=='/') break;
|
||||
else if (c=='\\') break;
|
||||
}
|
||||
|
||||
while (pos>0)
|
||||
{
|
||||
--pos;
|
||||
char c=c_szFile[pos];
|
||||
|
||||
if (c=='/') break;
|
||||
else if (c=='\\') break;
|
||||
}
|
||||
|
||||
if (pos)
|
||||
{
|
||||
++pos;
|
||||
for (int i = 0; i < pos; ++i)
|
||||
{
|
||||
pszPath[i] = c_szFile[i];
|
||||
}
|
||||
pszPath[pos] = '\0';
|
||||
}
|
||||
|
||||
if (ext>pos)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = pos; i < ext; ++i)
|
||||
{
|
||||
pszName[count++] = c_szFile[i];
|
||||
}
|
||||
pszName[count] = '\0';
|
||||
}
|
||||
|
||||
++ext;
|
||||
if (len > ext)
|
||||
{
|
||||
int count = 0;
|
||||
for (int i = ext; i < len; ++i)
|
||||
{
|
||||
pszExt[count++] = c_szFile[i];
|
||||
}
|
||||
pszExt[count] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
auto GetOldIndexingName(char *, int) -> void
|
||||
// PORT: _ecvt(Index, 256, &dec, &sign) truncated at dec is the unsigned decimal digits of Index.
|
||||
void GetOldIndexingName(char * szName, int Index)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
char Temp[512];
|
||||
|
||||
snprintf(Temp, sizeof(Temp), "%u", Index < 0 ? 0u - (unsigned) Index : (unsigned) Index);
|
||||
|
||||
strcat(szName, Temp);
|
||||
}
|
||||
|
||||
auto GetIndexingName(char *, DWORD) -> void
|
||||
void GetIndexingName(char * szName, DWORD Index)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
sprintf(szName + strlen(szName), "%u", Index);
|
||||
}
|
||||
|
||||
auto GetOnlyFileName(const char *, std::string &) -> void
|
||||
void GetOnlyFileName(const char * sz_Name, std::string & strFileName)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
strFileName = "";
|
||||
|
||||
int i;
|
||||
for (i=strlen(sz_Name)-1; i>=0; --i)
|
||||
{
|
||||
if ('\\' == sz_Name[i] || '/' == sz_Name[i])
|
||||
{
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == -1)
|
||||
i = 0;
|
||||
|
||||
for (size_t j = i; j < strlen(sz_Name); ++j)
|
||||
{
|
||||
strFileName += sz_Name[j];
|
||||
}
|
||||
|
||||
strFileName += "\0";
|
||||
}
|
||||
|
||||
auto GetOnlyPathName(const char *, std::string &) -> void
|
||||
void GetOnlyPathName(const char * sz_Name, std::string & OnlyPathName)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
int i;
|
||||
for (i = strlen(sz_Name) - 1; i >= 0; --i)
|
||||
{
|
||||
if ('\\' == sz_Name[i] || '/' == sz_Name[i])
|
||||
{
|
||||
++i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == -1)
|
||||
i = 0;
|
||||
|
||||
OnlyPathName.reserve(strlen(sz_Name));
|
||||
OnlyPathName = "";
|
||||
|
||||
for (int j=0; j<i; ++j)
|
||||
{
|
||||
OnlyPathName += sz_Name[j];
|
||||
}
|
||||
OnlyPathName += "\0";
|
||||
}
|
||||
|
||||
auto GetOnlyPathName(const char *) -> const char *
|
||||
const char * GetOnlyPathName(const char * c_szName)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const char *>();
|
||||
static std::string strPathName;
|
||||
GetOnlyPathName(c_szName, strPathName);
|
||||
|
||||
return strPathName.c_str();
|
||||
}
|
||||
|
||||
auto GetLocalFileName(const char *, const char *, std::string *) -> bool
|
||||
bool GetLocalFileName(const char * c_szGlobalPath, const char * c_szFullPathFileName, std::string * pstrLocalFileName)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
std::string strLocalFileName;
|
||||
|
||||
std::string strGlobalPath;
|
||||
std::string strFullPathFileName;
|
||||
StringPath(c_szGlobalPath, strGlobalPath);
|
||||
StringPath(c_szFullPathFileName, strFullPathFileName);
|
||||
|
||||
if (strGlobalPath.length() >= strFullPathFileName.length())
|
||||
return false;
|
||||
|
||||
DWORD length = std::min(strGlobalPath.length(), strFullPathFileName.length()); // PORT: min -> std::min
|
||||
for (DWORD dwPos = 0; dwPos < length; ++dwPos)
|
||||
{
|
||||
if (strGlobalPath[dwPos] != strFullPathFileName[dwPos])
|
||||
return false;
|
||||
}
|
||||
|
||||
*pstrLocalFileName = &c_szFullPathFileName[length];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
auto GetExceptionPathName(const char *, std::string &) -> void
|
||||
void GetExceptionPathName(const char * sz_Name, std::string & OnlyFileName)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
GetOnlyFileName(sz_Name, OnlyFileName);
|
||||
}
|
||||
|
||||
auto GetWorkingFolder(std::string &) -> void
|
||||
void GetWorkingFolder(std::string & strFileName)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
char buf[128+1];
|
||||
if (!getcwd(buf, 128)) // PORT: _getcwd -> getcwd
|
||||
buf[0] = '\0';
|
||||
strcat(buf, "/");
|
||||
strFileName = buf;
|
||||
}
|
||||
|
||||
void StringLowers(char * String)
|
||||
@@ -125,21 +328,64 @@ void StringPath(const char * c_szSrc, std::string & rString)
|
||||
}
|
||||
}
|
||||
|
||||
auto PrintAsciiData(const void *, int) -> void
|
||||
#define ishprint(x) ((((x) & 0xE0) > 0x90) || isprint(x))
|
||||
|
||||
void PrintAsciiData(const void* void_data, int bytes)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
int i, j, k;
|
||||
const unsigned char* p;
|
||||
const unsigned char* data;
|
||||
|
||||
data = (const unsigned char*) void_data;
|
||||
|
||||
fprintf(stdout, "------------------------------------------------------------------\n");
|
||||
j = bytes;
|
||||
while (1)
|
||||
{
|
||||
k = j >= 16 ? 16 : j;
|
||||
|
||||
p = data;
|
||||
for (i = 0; i < 16; ++i)
|
||||
{
|
||||
if (i >= k)
|
||||
fprintf(stdout, " ");
|
||||
else
|
||||
fprintf(stdout, "%02x ", *p);
|
||||
p++;
|
||||
}
|
||||
|
||||
fprintf(stdout, "| ");
|
||||
|
||||
p = data;
|
||||
for (i = 0; i < k; ++i)
|
||||
{
|
||||
if (i >= k)
|
||||
fprintf(stdout, " ");
|
||||
else
|
||||
fprintf(stdout, "%c", ishprint(*p) ? *p : '.');
|
||||
p++;
|
||||
}
|
||||
|
||||
fprintf(stdout, "\n");
|
||||
|
||||
j -= 16;
|
||||
data += 16;
|
||||
|
||||
if (j <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stdout, "------------------------------------------------------------------\n");
|
||||
}
|
||||
|
||||
auto IsFile(const char *) -> bool
|
||||
bool IsFile(const char* filename)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
return access(filename, 0) == 0 ? true : false; // PORT: _access -> access
|
||||
}
|
||||
|
||||
auto IsGlobalFileName(const char *) -> bool
|
||||
bool IsGlobalFileName(const char * c_szFileName)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
return strchr(c_szFileName, ':') != NULL;
|
||||
}
|
||||
|
||||
auto MIN(int a, int b) -> int
|
||||
@@ -178,40 +424,193 @@ auto fMINMAX(float min, float value, float max) -> float
|
||||
return (max < tv) ? max : tv;
|
||||
}
|
||||
|
||||
auto MyCreateDirectory(const char *) -> void
|
||||
void MyCreateDirectory(const char* path)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
if (!path || !*path)
|
||||
return;
|
||||
|
||||
char * dir;
|
||||
const char * p;
|
||||
|
||||
if (strlen(path) >= 3)
|
||||
{
|
||||
if (*(path + 1) == ':') // C:, D: drive prefix
|
||||
path += 3;
|
||||
}
|
||||
|
||||
p = path;
|
||||
|
||||
int len = strlen(path) + 1;
|
||||
dir = new char[len];
|
||||
|
||||
while (*p)
|
||||
{
|
||||
if (*p == '/' || *p == '\\')
|
||||
{
|
||||
memset(dir, 0, len);
|
||||
strncpy(dir, path, p - path);
|
||||
mkdir(dir, 0755); // PORT: CreateDirectory(dir, NULL) -> mkdir
|
||||
}
|
||||
|
||||
++p;
|
||||
}
|
||||
|
||||
delete [] dir;
|
||||
}
|
||||
|
||||
auto RemoveAllDirectory(const char *) -> void
|
||||
// PORT: CDirRemover (CDir walk + DeleteFile/RemoveDirectory) -> std::filesystem::remove_all.
|
||||
void RemoveAllDirectory(const char * c_szDirectoryName)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
std::error_code ec;
|
||||
std::filesystem::remove_all(c_szDirectoryName, ec);
|
||||
}
|
||||
|
||||
auto SplitLine(const char *, const char *, std::vector<std::string> *) -> bool
|
||||
bool SplitLine(const char * c_szLine, const char * c_szDelimeter, std::vector<std::string> * pkVec_strToken)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<bool>();
|
||||
pkVec_strToken->reserve(10);
|
||||
pkVec_strToken->clear();
|
||||
|
||||
std::string strLine = c_szLine;
|
||||
|
||||
DWORD basePos = 0;
|
||||
|
||||
do
|
||||
{
|
||||
int beginPos = strLine.find_first_not_of(c_szDelimeter, basePos);
|
||||
if (beginPos < 0)
|
||||
return false;
|
||||
|
||||
int endPos;
|
||||
|
||||
if (strLine[beginPos] == '"')
|
||||
{
|
||||
++beginPos;
|
||||
endPos = strLine.find_first_of("\"", beginPos);
|
||||
|
||||
if (endPos < 0)
|
||||
return false;
|
||||
|
||||
basePos = endPos + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
endPos = strLine.find_first_of(c_szDelimeter, beginPos);
|
||||
basePos = endPos;
|
||||
}
|
||||
|
||||
pkVec_strToken->push_back(strLine.substr(beginPos, endPos - beginPos));
|
||||
} while (basePos < strLine.length());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
auto _getf(const char *, ...) -> const char *
|
||||
const char * _getf(const char* c_szFormat, ...)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<const char *>();
|
||||
static char szBuf[256];
|
||||
|
||||
va_list args;
|
||||
va_start(args, c_szFormat);
|
||||
vsnprintf(szBuf, sizeof(szBuf), c_szFormat, args); // PORT: _vsnprintf -> vsnprintf
|
||||
va_end(args);
|
||||
|
||||
return szBuf;
|
||||
}
|
||||
|
||||
auto CommandLineToArgv(PCHAR, int *) -> PCHAR *
|
||||
PCHAR* CommandLineToArgv( PCHAR CmdLine, int* _argc )
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
return mt_platform_stub_return<PCHAR *>();
|
||||
PCHAR* argv;
|
||||
PCHAR _argv;
|
||||
ULONG len;
|
||||
ULONG argc;
|
||||
CHAR a;
|
||||
ULONG i, j;
|
||||
|
||||
BOOL in_QM; // PORT: BOOLEAN/PUCHAR -> BOOL/unsigned char * (not in the platform windows.h)
|
||||
BOOL in_TEXT;
|
||||
BOOL in_SPACE;
|
||||
|
||||
len = strlen(CmdLine);
|
||||
i = ((len+2)/2)*sizeof(PVOID) + sizeof(PVOID);
|
||||
|
||||
argv = (PCHAR*)malloc( // PORT: GlobalAlloc(GMEM_FIXED, ...) -> malloc
|
||||
i + (len+2)*sizeof(CHAR));
|
||||
|
||||
_argv = (PCHAR)(((unsigned char *)argv)+i);
|
||||
|
||||
argc = 0;
|
||||
argv[argc] = _argv;
|
||||
in_QM = FALSE;
|
||||
in_TEXT = FALSE;
|
||||
in_SPACE = TRUE;
|
||||
i = 0;
|
||||
j = 0;
|
||||
|
||||
while( (a = CmdLine[i]) ) {
|
||||
if(in_QM) {
|
||||
if(a == '\"') {
|
||||
in_QM = FALSE;
|
||||
} else {
|
||||
_argv[j] = a;
|
||||
j++;
|
||||
}
|
||||
} else {
|
||||
switch(a) {
|
||||
case '\"':
|
||||
in_QM = TRUE;
|
||||
in_TEXT = TRUE;
|
||||
if(in_SPACE) {
|
||||
argv[argc] = _argv+j;
|
||||
argc++;
|
||||
}
|
||||
in_SPACE = FALSE;
|
||||
break;
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\n':
|
||||
case '\r':
|
||||
if(in_TEXT) {
|
||||
_argv[j] = '\0';
|
||||
j++;
|
||||
}
|
||||
in_TEXT = FALSE;
|
||||
in_SPACE = TRUE;
|
||||
break;
|
||||
default:
|
||||
in_TEXT = TRUE;
|
||||
if(in_SPACE) {
|
||||
argv[argc] = _argv+j;
|
||||
argc++;
|
||||
}
|
||||
_argv[j] = a;
|
||||
j++;
|
||||
in_SPACE = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
_argv[j] = '\0';
|
||||
argv[argc] = NULL;
|
||||
|
||||
(*_argc) = argc;
|
||||
return argv;
|
||||
}
|
||||
|
||||
auto StringExceptCharacter(std::string *, const char *) -> void
|
||||
void StringExceptCharacter(std::string * pstrString, const char * c_szCharacter)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
int icurPos = 0;
|
||||
int iNextPos = 0;
|
||||
|
||||
while((iNextPos = pstrString->find_first_of(c_szCharacter, icurPos)) >= 0)
|
||||
{
|
||||
std::string strFront = pstrString->substr(icurPos, iNextPos - icurPos);
|
||||
std::string strBack = pstrString->substr(iNextPos+1, pstrString->length() - iNextPos - 1);
|
||||
*pstrString = strFront + strBack;
|
||||
}
|
||||
}
|
||||
|
||||
auto GetExcutedFileName(std::string &) -> void
|
||||
// PORT: GetModuleFileName(NULL, ...) -> the platform has no executable-path query; report the working folder.
|
||||
void GetExcutedFileName(std::string & r_str)
|
||||
{
|
||||
MT_PLATFORM_STUB();
|
||||
GetWorkingFolder(r_str);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
#include "EterLib/GrpImage.h"
|
||||
#include "EterLib/GrpSubImage.h"
|
||||
#include "EterLib/GrpText.h"
|
||||
#include "EterLib/AttributeData.h"
|
||||
#include "EterGrnLib/Thing.h"
|
||||
#include "EffectLib/EffectMesh.h"
|
||||
|
||||
namespace {
|
||||
CResource* NewUIImage(const char* name) { return new CGraphicImage(name); }
|
||||
@@ -11,6 +13,8 @@ CResource* NewUISubImage(const char* name) { return new CGraphicSubImage(name);
|
||||
// 40250 UserInterface/PythonApplication.cpp NewText: a "<face>:<size>[i].fnt" name is a CGraphicText.
|
||||
CResource* NewText(const char* name) { return new CGraphicText(name); }
|
||||
CResource* NewThing(const char* name) { return new CGraphicThing(name); }
|
||||
CResource* NewEffectMesh(const char* name) { return new CEffectMesh(name); }
|
||||
CResource* NewAttributeData(const char* name) { return new CAttributeData(name); }
|
||||
}
|
||||
|
||||
CPythonResource::CPythonResource() {
|
||||
@@ -19,6 +23,8 @@ CPythonResource::CPythonResource() {
|
||||
m_resManager.RegisterResourceNewFunctionPointer("sub", NewUISubImage);
|
||||
m_resManager.RegisterResourceNewFunctionPointer("fnt", NewText);
|
||||
m_resManager.RegisterResourceNewFunctionPointer("gr2", NewThing);
|
||||
m_resManager.RegisterResourceNewFunctionPointer("mde", NewEffectMesh);
|
||||
m_resManager.RegisterResourceNewFunctionPointer("mdatr", NewAttributeData);
|
||||
}
|
||||
CPythonResource::~CPythonResource() { m_resManager.DestroyDeletingList(); }
|
||||
void CPythonResource::Destroy() { m_resManager.DestroyDeletingList(); m_resManager.Destroy(); }
|
||||
|
||||
@@ -122,8 +122,7 @@ bool CPythonApplication::Create(PyObject*, const char*, int, int, int)
|
||||
return false;
|
||||
}
|
||||
|
||||
// 40250 m_pyItem.Create() (PythonApplication.cpp:1253): registers dropitem.mse with CEffectManager,
|
||||
// still a platform stub.
|
||||
// 40250 m_pyItem.Create() (PythonApplication.cpp:1253): registers dropitem.mse with CEffectManager.
|
||||
CPythonItem::Instance().Create();
|
||||
|
||||
// 40250 PythonApplication.cpp:1260, after DefaultFont_Startup and the IME.
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
#include "StdAfx.h"
|
||||
#include "EffectData.h"
|
||||
|
||||
CDynamicPool<CEffectData> CEffectData::ms_kPool;
|
||||
|
||||
CEffectData* CEffectData::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CEffectData::Delete(CEffectData* pkData)
|
||||
{
|
||||
pkData->Clear();
|
||||
ms_kPool.Free(pkData);
|
||||
}
|
||||
|
||||
void CEffectData::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
|
||||
CParticleSystemData::DestroySystem();
|
||||
CEffectMeshScript::DestroySystem();
|
||||
CLightData::DestroySystem();
|
||||
}
|
||||
|
||||
bool CEffectData::LoadScript(const char * c_szFileName)
|
||||
{
|
||||
m_strFileName = c_szFileName;
|
||||
CFileNameHelper::StringPath(m_strFileName);
|
||||
|
||||
CTextFileLoader TextFileLoader;
|
||||
if (!TextFileLoader.Load(c_szFileName))
|
||||
return false;
|
||||
|
||||
TextFileLoader.SetTop();
|
||||
|
||||
if (!TextFileLoader.GetTokenFloat("boundingsphereradius", &m_fBoundingSphereRadius))
|
||||
{
|
||||
m_fBoundingSphereRadius = 0.0f;
|
||||
}
|
||||
|
||||
if (!TextFileLoader.GetTokenVector3("boundingsphereposition", &m_v3BoundingSpherePosition))
|
||||
{
|
||||
m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f;
|
||||
}
|
||||
|
||||
for (DWORD i = 0; i < TextFileLoader.GetChildNodeCount(); ++i)
|
||||
{
|
||||
if (!TextFileLoader.SetChildNode(i))
|
||||
continue;
|
||||
|
||||
std::string strName;
|
||||
|
||||
if (!TextFileLoader.GetCurrentNodeName(&strName))
|
||||
continue;
|
||||
|
||||
if (0 == strName.compare("mesh"))
|
||||
{
|
||||
CEffectMeshScript * pMesh = AllocMesh();
|
||||
pMesh->Clear();
|
||||
pMesh->LoadScript(TextFileLoader);
|
||||
}
|
||||
else if (0 == strName.compare("particle"))
|
||||
{
|
||||
CParticleSystemData * pParticleSystemData = AllocParticle();
|
||||
pParticleSystemData->Clear();
|
||||
pParticleSystemData->LoadScript(TextFileLoader);
|
||||
}
|
||||
else if (0 == strName.compare("light"))
|
||||
{
|
||||
CLightData * pLightData = AllocLight();
|
||||
pLightData->Clear();
|
||||
pLightData->LoadScript(TextFileLoader);
|
||||
}
|
||||
|
||||
TextFileLoader.SetParentNode();
|
||||
}
|
||||
|
||||
// Load Sound
|
||||
std::string strPathHeader = "d:/ymir work/";
|
||||
std::string strNoExtensionName = CFileNameHelper::NoExtension(m_strFileName);
|
||||
int iPos = strNoExtensionName.find(strPathHeader.c_str());
|
||||
if (iPos >= 0)
|
||||
if (strNoExtensionName.size() > strPathHeader.size())
|
||||
{
|
||||
std::string strSoundFileName;
|
||||
strSoundFileName = "sound/";
|
||||
strSoundFileName += &strNoExtensionName[strPathHeader.size()];
|
||||
strSoundFileName += ".mss";
|
||||
|
||||
LoadSoundScriptData(strSoundFileName.c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEffectData::LoadSoundScriptData(const char * c_szFileName)
|
||||
{
|
||||
NSound::TSoundDataVector SoundDataVector;
|
||||
|
||||
if (NSound::LoadSoundInformationPiece(c_szFileName, SoundDataVector))
|
||||
{
|
||||
NSound::DataToInstance(SoundDataVector, &m_SoundInstanceVector);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CParticleSystemData * CEffectData::AllocParticle()
|
||||
{
|
||||
CParticleSystemData * pParticle = CParticleSystemData::New();
|
||||
m_ParticleVector.push_back(pParticle);
|
||||
return pParticle;
|
||||
}
|
||||
|
||||
CEffectMeshScript * CEffectData::AllocMesh()
|
||||
{
|
||||
CEffectMeshScript * pMesh = CEffectMeshScript::New();
|
||||
m_MeshVector.push_back(pMesh);
|
||||
return pMesh;
|
||||
}
|
||||
|
||||
CLightData * CEffectData::AllocLight()
|
||||
{
|
||||
CLightData * pLight = CLightData::New();
|
||||
m_LightVector.push_back(pLight);
|
||||
return pLight;
|
||||
}
|
||||
|
||||
DWORD CEffectData::GetLightCount()
|
||||
{
|
||||
return m_LightVector.size();
|
||||
}
|
||||
|
||||
CLightData * CEffectData::GetLightPointer(DWORD dwPosition)
|
||||
{
|
||||
assert(dwPosition < m_LightVector.size());
|
||||
return m_LightVector[dwPosition];
|
||||
}
|
||||
|
||||
DWORD CEffectData::GetParticleCount()
|
||||
{
|
||||
return m_ParticleVector.size();
|
||||
}
|
||||
CParticleSystemData * CEffectData::GetParticlePointer(DWORD dwPosition)
|
||||
{
|
||||
if(dwPosition < m_ParticleVector.size())
|
||||
return m_ParticleVector[dwPosition];
|
||||
else
|
||||
{
|
||||
assert(false);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
DWORD CEffectData::GetMeshCount()
|
||||
{
|
||||
return m_MeshVector.size();
|
||||
}
|
||||
CEffectMeshScript * CEffectData::GetMeshPointer(DWORD dwPosition)
|
||||
{
|
||||
assert(dwPosition < m_MeshVector.size());
|
||||
return m_MeshVector[dwPosition];
|
||||
}
|
||||
|
||||
NSound::TSoundInstanceVector * CEffectData::GetSoundInstanceVector()
|
||||
{
|
||||
return &m_SoundInstanceVector;
|
||||
}
|
||||
|
||||
float CEffectData::GetBoundingSphereRadius()
|
||||
{
|
||||
return m_fBoundingSphereRadius;
|
||||
}
|
||||
|
||||
D3DXVECTOR3 CEffectData::GetBoundingSpherePosition()
|
||||
{
|
||||
return m_v3BoundingSpherePosition;
|
||||
}
|
||||
|
||||
const char * CEffectData::GetFileName() const
|
||||
{
|
||||
return m_strFileName.c_str();
|
||||
}
|
||||
|
||||
void CEffectData::__ClearParticleDataVector()
|
||||
{
|
||||
std::for_each(m_ParticleVector.begin(), m_ParticleVector.end(), CParticleSystemData::Delete);
|
||||
m_ParticleVector.clear();
|
||||
}
|
||||
|
||||
void CEffectData::__ClearLightDataVector()
|
||||
{
|
||||
std::for_each(m_LightVector.begin(), m_LightVector.end(), CLightData::Delete);
|
||||
m_LightVector.clear();
|
||||
}
|
||||
|
||||
void CEffectData::__ClearMeshDataVector()
|
||||
{
|
||||
std::for_each(m_MeshVector.begin(), m_MeshVector.end(), CEffectMeshScript::Delete);
|
||||
m_MeshVector.clear();
|
||||
}
|
||||
|
||||
void CEffectData::Clear()
|
||||
{
|
||||
m_fBoundingSphereRadius = 0.0f;
|
||||
m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f;
|
||||
__ClearParticleDataVector();
|
||||
__ClearLightDataVector();
|
||||
__ClearMeshDataVector();
|
||||
}
|
||||
|
||||
CEffectData::CEffectData()
|
||||
{
|
||||
m_fBoundingSphereRadius = 0.0f;
|
||||
m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f;
|
||||
}
|
||||
CEffectData::~CEffectData()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
#include "StdAfx.h"
|
||||
#include "EffectElementBase.h"
|
||||
|
||||
|
||||
void CEffectElementBase::GetPosition(float fTime, D3DXVECTOR3 & rPosition)
|
||||
{
|
||||
if (m_TimeEventTablePosition.empty())
|
||||
{
|
||||
rPosition = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
|
||||
return;
|
||||
}
|
||||
if (m_TimeEventTablePosition.size()==1)
|
||||
{
|
||||
rPosition = m_TimeEventTablePosition[0].m_vecPosition;
|
||||
return;
|
||||
}
|
||||
if (m_TimeEventTablePosition.front().m_fTime > fTime)
|
||||
{
|
||||
rPosition = m_TimeEventTablePosition.front().m_vecPosition;
|
||||
return;
|
||||
}
|
||||
if (m_TimeEventTablePosition.back().m_fTime < fTime)
|
||||
{
|
||||
rPosition = m_TimeEventTablePosition.back().m_vecPosition;
|
||||
return;
|
||||
}
|
||||
|
||||
typedef TTimeEventTablePosition::iterator iterator;
|
||||
iterator result = std::lower_bound( m_TimeEventTablePosition.begin(), m_TimeEventTablePosition.end(), fTime );
|
||||
|
||||
TEffectPosition & rEffectPosition = *result;
|
||||
iterator rPrev = result;
|
||||
if (m_TimeEventTablePosition.begin() != result)
|
||||
{
|
||||
rPrev = result-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rPosition = result->m_vecPosition;
|
||||
return;
|
||||
}
|
||||
TEffectPosition & rPrevEffectPosition = *rPrev;
|
||||
int iMovingType = rPrevEffectPosition.m_iMovingType;
|
||||
|
||||
if (MOVING_TYPE_DIRECT == iMovingType)
|
||||
{
|
||||
float Head = fabs(rEffectPosition.m_fTime - fTime) / fabs(rEffectPosition.m_fTime - rPrevEffectPosition.m_fTime);
|
||||
float Tail = 1.0f - fabs(rEffectPosition.m_fTime - fTime) / fabs(rEffectPosition.m_fTime - rPrevEffectPosition.m_fTime);
|
||||
rPosition = (rPrevEffectPosition.m_vecPosition*Head) + (rEffectPosition.m_vecPosition*Tail);
|
||||
}
|
||||
else if (MOVING_TYPE_BEZIER_CURVE == iMovingType)
|
||||
{
|
||||
float ft = (fTime - rPrevEffectPosition.m_fTime) / (rEffectPosition.m_fTime - rPrevEffectPosition.m_fTime);
|
||||
|
||||
rPosition = rPrevEffectPosition.m_vecPosition * (1.0f - ft) * (1.0f - ft) +
|
||||
(rPrevEffectPosition.m_vecPosition + rPrevEffectPosition.m_vecControlPoint) * (1.0f - ft) * ft * 2 +
|
||||
rEffectPosition.m_vecPosition * ft * ft;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
bool CEffectElementBase::isVisible(float fTime)
|
||||
{
|
||||
for (DWORD i = 0; i < m_TimeEventTableVisible.size(); ++i)
|
||||
{
|
||||
float fPointTime = m_TimeEventTableVisible[i];
|
||||
|
||||
if (fTime < fPointTime)
|
||||
{
|
||||
if (1 == i % 2)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return 1 == (m_TimeEventTableVisible.size() % 2);
|
||||
}
|
||||
|
||||
void CEffectElementBase::GetAlpha(float fTime, float * pAlpha)
|
||||
{
|
||||
GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventAlpha, pAlpha);
|
||||
}
|
||||
|
||||
void CEffectElementBase::GetScale(float fTime, float * pScale)
|
||||
{
|
||||
GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventScale, pScale);
|
||||
}
|
||||
*/
|
||||
|
||||
bool CEffectElementBase::isData()
|
||||
{
|
||||
return OnIsData();
|
||||
}
|
||||
|
||||
void CEffectElementBase::Clear()
|
||||
{
|
||||
m_fStartTime = 0.0f;
|
||||
|
||||
OnClear();
|
||||
}
|
||||
|
||||
BOOL CEffectElementBase::LoadScript(CTextFileLoader & rTextFileLoader)
|
||||
{
|
||||
CTokenVector * pTokenVector;
|
||||
if (!rTextFileLoader.GetTokenFloat("starttime",&m_fStartTime))
|
||||
{
|
||||
m_fStartTime = 0.0f;
|
||||
}
|
||||
if (rTextFileLoader.GetTokenVector("timeeventposition", &pTokenVector))
|
||||
{
|
||||
m_TimeEventTablePosition.clear();
|
||||
|
||||
DWORD dwIndex = 0;
|
||||
for (DWORD i = 0; i < pTokenVector->size(); ++dwIndex)
|
||||
{
|
||||
TEffectPosition EffectPosition;
|
||||
EffectPosition.m_fTime = atof(pTokenVector->at(i++).c_str());
|
||||
if (pTokenVector->at(i)=="MOVING_TYPE_BEZIER_CURVE")
|
||||
{
|
||||
i++;
|
||||
|
||||
EffectPosition.m_iMovingType = MOVING_TYPE_BEZIER_CURVE;
|
||||
|
||||
EffectPosition.m_vecPosition.x = atof(pTokenVector->at(i++).c_str());
|
||||
EffectPosition.m_vecPosition.y = atof(pTokenVector->at(i++).c_str());
|
||||
EffectPosition.m_vecPosition.z = atof(pTokenVector->at(i++).c_str());
|
||||
|
||||
EffectPosition.m_vecControlPoint.x = atof(pTokenVector->at(i++).c_str());
|
||||
EffectPosition.m_vecControlPoint.y = atof(pTokenVector->at(i++).c_str());
|
||||
EffectPosition.m_vecControlPoint.z = atof(pTokenVector->at(i++).c_str());
|
||||
}
|
||||
else if (pTokenVector->at(i) == "MOVING_TYPE_DIRECT")
|
||||
{
|
||||
i++;
|
||||
|
||||
EffectPosition.m_iMovingType = MOVING_TYPE_DIRECT;
|
||||
|
||||
EffectPosition.m_vecPosition.x = atof(pTokenVector->at(i++).c_str());
|
||||
EffectPosition.m_vecPosition.y = atof(pTokenVector->at(i++).c_str());
|
||||
EffectPosition.m_vecPosition.z = atof(pTokenVector->at(i++).c_str());
|
||||
|
||||
EffectPosition.m_vecControlPoint = D3DXVECTOR3(0.0f,0.0f,0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_TimeEventTablePosition.push_back(EffectPosition);
|
||||
}
|
||||
}
|
||||
|
||||
return OnLoadScript(rTextFileLoader);
|
||||
}
|
||||
|
||||
float CEffectElementBase::GetStartTime()
|
||||
{
|
||||
return m_fStartTime;
|
||||
}
|
||||
|
||||
CEffectElementBase::CEffectElementBase()
|
||||
{
|
||||
m_fStartTime = 0.0f;
|
||||
}
|
||||
CEffectElementBase::~CEffectElementBase()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
#include "StdAfx.h"
|
||||
#include "EffectElementBaseInstance.h"
|
||||
|
||||
bool CEffectElementBaseInstance::Update(float fElapsedTime)
|
||||
{
|
||||
if (m_bStart)
|
||||
{
|
||||
m_fElapsedTime = fElapsedTime;
|
||||
m_fLocalTime += fElapsedTime;
|
||||
|
||||
return OnUpdate(fElapsedTime);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_fRemainingTime -= fElapsedTime;
|
||||
if (m_fRemainingTime<=0.0f)
|
||||
m_bStart = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectElementBaseInstance::Render()
|
||||
{
|
||||
if (!m_bStart)
|
||||
return;
|
||||
|
||||
assert(mc_pmatLocal);
|
||||
|
||||
OnRender();
|
||||
}
|
||||
|
||||
void CEffectElementBaseInstance::SetLocalMatrixPointer(const D3DXMATRIX * c_pMatrix)
|
||||
{
|
||||
mc_pmatLocal = c_pMatrix;
|
||||
}
|
||||
|
||||
void CEffectElementBaseInstance::SetDataPointer(CEffectElementBase * pElement)
|
||||
{
|
||||
m_pBase = pElement;
|
||||
|
||||
m_dwStartTime = CTimer::Instance().GetCurrentMillisecond();
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//add by ipkn, start time management
|
||||
|
||||
m_fRemainingTime = pElement->GetStartTime();
|
||||
if (m_fRemainingTime<=0.0f)
|
||||
m_bStart = true;
|
||||
else
|
||||
m_bStart = false;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
OnSetDataPointer(pElement);
|
||||
}
|
||||
|
||||
bool CEffectElementBaseInstance::isActive()
|
||||
{
|
||||
return m_isActive;
|
||||
}
|
||||
void CEffectElementBaseInstance::SetActive()
|
||||
{
|
||||
m_isActive = true;
|
||||
}
|
||||
void CEffectElementBaseInstance::SetDeactive()
|
||||
{
|
||||
m_isActive = false;
|
||||
}
|
||||
|
||||
void CEffectElementBaseInstance::Initialize()
|
||||
{
|
||||
mc_pmatLocal = NULL;
|
||||
|
||||
m_isActive = true;
|
||||
|
||||
m_fLocalTime = 0.0f;
|
||||
m_dwStartTime = 0;
|
||||
m_fElapsedTime = 0.0f;
|
||||
|
||||
m_bStart = false;
|
||||
m_fRemainingTime = 0.0f;
|
||||
|
||||
OnInitialize();
|
||||
}
|
||||
|
||||
void CEffectElementBaseInstance::Destroy()
|
||||
{
|
||||
OnDestroy();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CEffectElementBaseInstance::CEffectElementBaseInstance()
|
||||
{
|
||||
}
|
||||
CEffectElementBaseInstance::~CEffectElementBaseInstance()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,288 @@
|
||||
#include "StdAfx.h"
|
||||
#include "EffectInstance.h"
|
||||
#include "ParticleSystemInstance.h"
|
||||
#include "SimpleLightInstance.h"
|
||||
|
||||
#include "../EterBase/Stl.h"
|
||||
#include "../EterLib/StateManager.h"
|
||||
#include "../MilesLib/SoundManager.h"
|
||||
|
||||
CDynamicPool<CEffectInstance> CEffectInstance::ms_kPool;
|
||||
int CEffectInstance::ms_iRenderingEffectCount = 0;
|
||||
|
||||
bool CEffectInstance::LessRenderOrder(CEffectInstance* pkEftInst)
|
||||
{
|
||||
return (m_pkEftData<pkEftInst->m_pkEftData);
|
||||
}
|
||||
|
||||
void CEffectInstance::ResetRenderingEffectCount()
|
||||
{
|
||||
ms_iRenderingEffectCount = 0;
|
||||
}
|
||||
|
||||
int CEffectInstance::GetRenderingEffectCount()
|
||||
{
|
||||
return ms_iRenderingEffectCount;
|
||||
}
|
||||
|
||||
CEffectInstance* CEffectInstance::New()
|
||||
{
|
||||
CEffectInstance* pkEftInst=ms_kPool.Alloc();
|
||||
return pkEftInst;
|
||||
}
|
||||
|
||||
void CEffectInstance::Delete(CEffectInstance* pkEftInst)
|
||||
{
|
||||
pkEftInst->Clear();
|
||||
ms_kPool.Free(pkEftInst);
|
||||
}
|
||||
|
||||
void CEffectInstance::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
|
||||
CParticleSystemInstance::DestroySystem();
|
||||
CEffectMeshInstance::DestroySystem();
|
||||
CLightInstance::DestroySystem();
|
||||
}
|
||||
|
||||
void CEffectInstance::UpdateSound()
|
||||
{
|
||||
if (m_pSoundInstanceVector)
|
||||
{
|
||||
CSoundManager& rkSndMgr=CSoundManager::Instance();
|
||||
rkSndMgr.UpdateSoundInstance(m_matGlobal._41, m_matGlobal._42, m_matGlobal._43, m_dwFrame, m_pSoundInstanceVector);
|
||||
// NOTE : 매트릭스에서 위치를 직접 얻어온다 - [levites]
|
||||
}
|
||||
++m_dwFrame;
|
||||
}
|
||||
|
||||
struct FEffectUpdator
|
||||
{
|
||||
BOOL isAlive;
|
||||
float fElapsedTime;
|
||||
FEffectUpdator(float fElapsedTime)
|
||||
: isAlive(FALSE), fElapsedTime(fElapsedTime)
|
||||
{
|
||||
}
|
||||
void operator () (CEffectElementBaseInstance * pInstance)
|
||||
{
|
||||
if (pInstance->Update(fElapsedTime))
|
||||
isAlive = TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
void CEffectInstance::OnUpdate()
|
||||
{
|
||||
Transform();
|
||||
|
||||
#ifdef WORLD_EDITOR
|
||||
FEffectUpdator f(CTimer::Instance().GetElapsedSecond());
|
||||
#else
|
||||
FEffectUpdator f(CTimer::Instance().GetCurrentSecond()-m_fLastTime);
|
||||
#endif
|
||||
f = std::for_each(m_ParticleInstanceVector.begin(), m_ParticleInstanceVector.end(),f);
|
||||
f = std::for_each(m_MeshInstanceVector.begin(), m_MeshInstanceVector.end(),f);
|
||||
f = std::for_each(m_LightInstanceVector.begin(), m_LightInstanceVector.end(),f);
|
||||
m_isAlive = f.isAlive;
|
||||
|
||||
m_fLastTime = CTimer::Instance().GetCurrentSecond();
|
||||
}
|
||||
|
||||
void CEffectInstance::OnRender()
|
||||
{
|
||||
STATEMANAGER.SaveTextureStageState(0, D3DTSS_MINFILTER, D3DTEXF_NONE);
|
||||
STATEMANAGER.SaveTextureStageState(0, D3DTSS_MAGFILTER, D3DTEXF_NONE);
|
||||
STATEMANAGER.SaveRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||
STATEMANAGER.SaveRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
|
||||
STATEMANAGER.SaveRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
|
||||
STATEMANAGER.SaveRenderState(D3DRS_ALPHATESTENABLE, FALSE);
|
||||
STATEMANAGER.SaveRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
|
||||
STATEMANAGER.SaveRenderState(D3DRS_ZWRITEENABLE, FALSE);
|
||||
/////
|
||||
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLORARG2, D3DTA_TEXTURE);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, D3DTOP_MODULATE);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG1, D3DTA_TFACTOR);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAARG2, D3DTA_TEXTURE);
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);
|
||||
STATEMANAGER.SetVertexShader(D3DFVF_XYZ|D3DFVF_TEX1);
|
||||
std::for_each(m_ParticleInstanceVector.begin(),m_ParticleInstanceVector.end(),std::mem_fn(&CEffectElementBaseInstance::Render));
|
||||
std::for_each(m_MeshInstanceVector.begin(),m_MeshInstanceVector.end(),std::mem_fn(&CEffectElementBaseInstance::Render));
|
||||
|
||||
/////
|
||||
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_MINFILTER);
|
||||
STATEMANAGER.RestoreTextureStageState(0, D3DTSS_MAGFILTER);
|
||||
STATEMANAGER.RestoreRenderState(D3DRS_ALPHABLENDENABLE);
|
||||
STATEMANAGER.RestoreRenderState(D3DRS_SRCBLEND);
|
||||
STATEMANAGER.RestoreRenderState(D3DRS_DESTBLEND);
|
||||
STATEMANAGER.RestoreRenderState(D3DRS_ALPHATESTENABLE);
|
||||
STATEMANAGER.RestoreRenderState(D3DRS_CULLMODE);
|
||||
STATEMANAGER.RestoreRenderState(D3DRS_ZWRITEENABLE);
|
||||
|
||||
++ms_iRenderingEffectCount;
|
||||
}
|
||||
|
||||
void CEffectInstance::SetGlobalMatrix(const D3DXMATRIX & c_rmatGlobal)
|
||||
{
|
||||
m_matGlobal = c_rmatGlobal;
|
||||
}
|
||||
|
||||
BOOL CEffectInstance::isAlive()
|
||||
{
|
||||
return m_isAlive;
|
||||
}
|
||||
|
||||
void CEffectInstance::SetActive()
|
||||
{
|
||||
std::for_each(
|
||||
m_ParticleInstanceVector.begin(),
|
||||
m_ParticleInstanceVector.end(),
|
||||
std::mem_fn(&CEffectElementBaseInstance::SetActive));
|
||||
std::for_each(
|
||||
m_MeshInstanceVector.begin(),
|
||||
m_MeshInstanceVector.end(),
|
||||
std::mem_fn(&CEffectElementBaseInstance::SetActive));
|
||||
std::for_each(
|
||||
m_LightInstanceVector.begin(),
|
||||
m_LightInstanceVector.end(),
|
||||
std::mem_fn(&CEffectElementBaseInstance::SetActive));
|
||||
}
|
||||
|
||||
void CEffectInstance::SetDeactive()
|
||||
{
|
||||
std::for_each(
|
||||
m_ParticleInstanceVector.begin(),
|
||||
m_ParticleInstanceVector.end(),
|
||||
std::mem_fn(&CEffectElementBaseInstance::SetDeactive));
|
||||
std::for_each(
|
||||
m_MeshInstanceVector.begin(),
|
||||
m_MeshInstanceVector.end(),
|
||||
std::mem_fn(&CEffectElementBaseInstance::SetDeactive));
|
||||
std::for_each(
|
||||
m_LightInstanceVector.begin(),
|
||||
m_LightInstanceVector.end(),
|
||||
std::mem_fn(&CEffectElementBaseInstance::SetDeactive));
|
||||
}
|
||||
|
||||
void CEffectInstance::__SetParticleData(CParticleSystemData * pData)
|
||||
{
|
||||
CParticleSystemInstance * pInstance = CParticleSystemInstance::New();
|
||||
pInstance->SetDataPointer(pData);
|
||||
pInstance->SetLocalMatrixPointer(&m_matGlobal);
|
||||
|
||||
m_ParticleInstanceVector.push_back(pInstance);
|
||||
}
|
||||
void CEffectInstance::__SetMeshData(CEffectMeshScript * pMesh)
|
||||
{
|
||||
CEffectMeshInstance * pMeshInstance = CEffectMeshInstance::New();
|
||||
pMeshInstance->SetDataPointer(pMesh);
|
||||
pMeshInstance->SetLocalMatrixPointer(&m_matGlobal);
|
||||
|
||||
m_MeshInstanceVector.push_back(pMeshInstance);
|
||||
}
|
||||
|
||||
void CEffectInstance::__SetLightData(CLightData* pData)
|
||||
{
|
||||
CLightInstance * pInstance = CLightInstance::New();
|
||||
pInstance->SetDataPointer(pData);
|
||||
pInstance->SetLocalMatrixPointer(&m_matGlobal);
|
||||
|
||||
m_LightInstanceVector.push_back(pInstance);
|
||||
}
|
||||
|
||||
void CEffectInstance::SetEffectDataPointer(CEffectData * pEffectData)
|
||||
{
|
||||
m_isAlive=true;
|
||||
|
||||
m_pkEftData=pEffectData;
|
||||
|
||||
m_fLastTime = CTimer::Instance().GetCurrentSecond();
|
||||
m_fBoundingSphereRadius = pEffectData->GetBoundingSphereRadius();
|
||||
m_v3BoundingSpherePosition = pEffectData->GetBoundingSpherePosition();
|
||||
|
||||
if (m_fBoundingSphereRadius > 0.0f)
|
||||
CGraphicObjectInstance::RegisterBoundingSphere();
|
||||
|
||||
DWORD i;
|
||||
|
||||
for (i = 0; i < pEffectData->GetParticleCount(); ++i)
|
||||
{
|
||||
CParticleSystemData * pParticle = pEffectData->GetParticlePointer(i);
|
||||
|
||||
__SetParticleData(pParticle);
|
||||
}
|
||||
|
||||
for (i = 0; i < pEffectData->GetMeshCount(); ++i)
|
||||
{
|
||||
CEffectMeshScript * pMesh = pEffectData->GetMeshPointer(i);
|
||||
|
||||
__SetMeshData(pMesh);
|
||||
}
|
||||
|
||||
for (i = 0; i < pEffectData->GetLightCount(); ++i)
|
||||
{
|
||||
CLightData * pLight = pEffectData->GetLightPointer(i);
|
||||
|
||||
__SetLightData(pLight);
|
||||
}
|
||||
|
||||
m_pSoundInstanceVector = pEffectData->GetSoundInstanceVector();
|
||||
}
|
||||
|
||||
bool CEffectInstance::GetBoundingSphere(D3DXVECTOR3 & v3Center, float & fRadius)
|
||||
{
|
||||
v3Center.x = m_matGlobal._41 + m_v3BoundingSpherePosition.x;
|
||||
v3Center.y = m_matGlobal._42 + m_v3BoundingSpherePosition.y;
|
||||
v3Center.z = m_matGlobal._43 + m_v3BoundingSpherePosition.z;
|
||||
fRadius = m_fBoundingSphereRadius;
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEffectInstance::Clear()
|
||||
{
|
||||
if (!m_ParticleInstanceVector.empty())
|
||||
{
|
||||
std::for_each(m_ParticleInstanceVector.begin(), m_ParticleInstanceVector.end(), CParticleSystemInstance::Delete);
|
||||
m_ParticleInstanceVector.clear();
|
||||
}
|
||||
|
||||
if (!m_MeshInstanceVector.empty())
|
||||
{
|
||||
std::for_each(m_MeshInstanceVector.begin(), m_MeshInstanceVector.end(), CEffectMeshInstance::Delete);
|
||||
m_MeshInstanceVector.clear();
|
||||
}
|
||||
|
||||
if (!m_LightInstanceVector.empty())
|
||||
{
|
||||
std::for_each(m_LightInstanceVector.begin(), m_LightInstanceVector.end(), CLightInstance::Delete);
|
||||
m_LightInstanceVector.clear();
|
||||
}
|
||||
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
void CEffectInstance::__Initialize()
|
||||
{
|
||||
m_isAlive = FALSE;
|
||||
m_dwFrame = 0;
|
||||
m_pSoundInstanceVector = NULL;
|
||||
m_fBoundingSphereRadius = 0.0f;
|
||||
m_v3BoundingSpherePosition.x = m_v3BoundingSpherePosition.y = m_v3BoundingSpherePosition.z = 0.0f;
|
||||
|
||||
m_pkEftData=NULL;
|
||||
|
||||
D3DXMatrixIdentity(&m_matGlobal);
|
||||
}
|
||||
|
||||
CEffectInstance::CEffectInstance()
|
||||
{
|
||||
__Initialize();
|
||||
}
|
||||
CEffectInstance::~CEffectInstance()
|
||||
{
|
||||
assert(m_ParticleInstanceVector.empty());
|
||||
assert(m_MeshInstanceVector.empty());
|
||||
assert(m_LightInstanceVector.empty());
|
||||
}
|
||||
@@ -0,0 +1,468 @@
|
||||
#include "StdAfx.h"
|
||||
#include "../EterBase/Random.h"
|
||||
#include "../EterLib/StateManager.h"
|
||||
#include "EffectManager.h"
|
||||
|
||||
|
||||
|
||||
void CEffectManager::GetInfo(std::string* pstInfo)
|
||||
{
|
||||
char szInfo[256];
|
||||
|
||||
sprintf(szInfo, "Effect: Inst - ED %d, EI %d Pool - PSI %d, MI %d, LI %d, PI %d, EI %d, ED %d, PSD %d, EM %d, LD %d",
|
||||
m_kEftDataMap.size(),
|
||||
m_kEftInstMap.size(),
|
||||
CParticleSystemInstance::ms_kPool.GetCapacity(),
|
||||
CEffectMeshInstance::ms_kPool.GetCapacity(),
|
||||
CLightInstance::ms_kPool.GetCapacity(),
|
||||
CParticleInstance::ms_kPool.GetCapacity(),
|
||||
//CRayParticleInstance::ms_kPool.GetCapacity(),
|
||||
CEffectInstance::ms_kPool.GetCapacity(),
|
||||
CEffectData::ms_kPool.GetCapacity(),
|
||||
CParticleSystemData::ms_kPool.GetCapacity(),
|
||||
CEffectMeshScript::ms_kPool.GetCapacity(),
|
||||
CLightData::ms_kPool.GetCapacity()
|
||||
);
|
||||
pstInfo->append(szInfo);
|
||||
}
|
||||
|
||||
void CEffectManager::UpdateSound()
|
||||
{
|
||||
for (TEffectInstanceMap::iterator itor = m_kEftInstMap.begin(); itor != m_kEftInstMap.end(); ++itor)
|
||||
{
|
||||
CEffectInstance * pEffectInstance = itor->second;
|
||||
|
||||
pEffectInstance->UpdateSound();
|
||||
}
|
||||
}
|
||||
|
||||
bool CEffectManager::IsAliveEffect(DWORD dwInstanceIndex)
|
||||
{
|
||||
TEffectInstanceMap::iterator f = m_kEftInstMap.find(dwInstanceIndex);
|
||||
if (m_kEftInstMap.end()==f)
|
||||
return false;
|
||||
|
||||
return f->second->isAlive() ? true : false;
|
||||
}
|
||||
|
||||
void CEffectManager::Update()
|
||||
{
|
||||
|
||||
// 2004. 3. 1. myevan. 이펙트 모니터링 하는 코드
|
||||
/*
|
||||
if (GetAsyncKeyState(VK_F9))
|
||||
{
|
||||
Tracenf("CEffectManager::m_EffectInstancePool %d", m_EffectInstancePool.GetCapacity());
|
||||
Tracenf("CEffectManager::m_EffectDataPool %d", m_EffectDataPool.GetCapacity());
|
||||
Tracenf("CEffectInstance::ms_LightInstancePool %d", CEffectInstance::ms_LightInstancePool.GetCapacity());
|
||||
Tracenf("CEffectInstance::ms_MeshInstancePool %d", CEffectInstance::ms_MeshInstancePool.GetCapacity());
|
||||
Tracenf("CEffectInstance::ms_ParticleSystemInstancePool %d", CEffectInstance::ms_ParticleSystemInstancePool.GetCapacity());
|
||||
Tracenf("CParticleInstance::ms_ParticleInstancePool %d", CParticleInstance::ms_kPool.GetCapacity());
|
||||
Tracenf("CRayParticleInstance::ms_RayParticleInstancePool %d", CRayParticleInstance::ms_kPool.GetCapacity());
|
||||
Tracen("---------------------------------------------");
|
||||
}
|
||||
*/
|
||||
|
||||
for (TEffectInstanceMap::iterator itor = m_kEftInstMap.begin(); itor != m_kEftInstMap.end();)
|
||||
{
|
||||
CEffectInstance * pEffectInstance = itor->second;
|
||||
|
||||
pEffectInstance->Update(/*fElapsedTime*/);
|
||||
|
||||
if (!pEffectInstance->isAlive())
|
||||
{
|
||||
itor = m_kEftInstMap.erase(itor);
|
||||
|
||||
CEffectInstance::Delete(pEffectInstance);
|
||||
}
|
||||
else
|
||||
{
|
||||
++itor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
struct CEffectManager_LessEffectInstancePtrRenderOrder
|
||||
{
|
||||
bool operator() (CEffectInstance* pkLeft, CEffectInstance* pkRight)
|
||||
{
|
||||
return pkLeft->LessRenderOrder(pkRight);
|
||||
}
|
||||
};
|
||||
|
||||
struct CEffectManager_FEffectInstanceRender
|
||||
{
|
||||
inline void operator () (CEffectInstance * pkEftInst)
|
||||
{
|
||||
pkEftInst->Render();
|
||||
}
|
||||
};
|
||||
|
||||
void CEffectManager::Render()
|
||||
{
|
||||
STATEMANAGER.SetTexture(0, NULL);
|
||||
STATEMANAGER.SetTexture(1, NULL);
|
||||
|
||||
if (m_isDisableSortRendering)
|
||||
{
|
||||
for (TEffectInstanceMap::iterator itor = m_kEftInstMap.begin(); itor != m_kEftInstMap.end();)
|
||||
{
|
||||
CEffectInstance * pEffectInstance = itor->second;
|
||||
pEffectInstance->Render();
|
||||
++itor;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
static std::vector<CEffectInstance*> s_kVct_pkEftInstSort;
|
||||
s_kVct_pkEftInstSort.clear();
|
||||
|
||||
TEffectInstanceMap& rkMap_pkEftInstSrc=m_kEftInstMap;
|
||||
TEffectInstanceMap::iterator i;
|
||||
for (i=rkMap_pkEftInstSrc.begin(); i!=rkMap_pkEftInstSrc.end(); ++i)
|
||||
s_kVct_pkEftInstSort.push_back(i->second);
|
||||
|
||||
std::sort(s_kVct_pkEftInstSort.begin(), s_kVct_pkEftInstSort.end(), CEffectManager_LessEffectInstancePtrRenderOrder());
|
||||
std::for_each(s_kVct_pkEftInstSort.begin(), s_kVct_pkEftInstSort.end(), CEffectManager_FEffectInstanceRender());
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CEffectManager::RegisterEffect(const char * c_szFileName,bool isExistDelete,bool isNeedCache)
|
||||
{
|
||||
std::string strFileName;
|
||||
StringPath(c_szFileName, strFileName);
|
||||
DWORD dwCRC = GetCaseCRC32(strFileName.c_str(), strFileName.length());
|
||||
|
||||
TEffectDataMap::iterator itor = m_kEftDataMap.find(dwCRC);
|
||||
if (m_kEftDataMap.end() != itor)
|
||||
{
|
||||
if (isExistDelete)
|
||||
{
|
||||
CEffectData* pkEftData=itor->second;
|
||||
CEffectData::Delete(pkEftData);
|
||||
m_kEftDataMap.erase(itor);
|
||||
}
|
||||
else
|
||||
{
|
||||
//TraceError("CEffectManager::RegisterEffect - m_kEftDataMap.find [%s] Already Exist", c_szFileName);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
CEffectData * pkEftData = CEffectData::New();
|
||||
|
||||
if (!pkEftData->LoadScript(c_szFileName))
|
||||
{
|
||||
TraceError("CEffectManager::RegisterEffect - LoadScript(%s) Error", c_szFileName);
|
||||
CEffectData::Delete(pkEftData);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
m_kEftDataMap.insert(TEffectDataMap::value_type(dwCRC, pkEftData));
|
||||
|
||||
if (isNeedCache)
|
||||
{
|
||||
if (m_kEftCacheMap.find(dwCRC)==m_kEftCacheMap.end())
|
||||
{
|
||||
CEffectInstance* pkNewEftInst=CEffectInstance::New();
|
||||
pkNewEftInst->SetEffectDataPointer(pkEftData);
|
||||
m_kEftCacheMap.insert(TEffectInstanceMap::value_type(dwCRC, pkNewEftInst));
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
// CEffectData 를 포인터형으로 리턴하게 하고..
|
||||
// CEffectData에서 CRC를 얻을수 있게 한다
|
||||
BOOL CEffectManager::RegisterEffect2(const char * c_szFileName, DWORD* pdwRetCRC, bool isNeedCache)
|
||||
{
|
||||
std::string strFileName;
|
||||
StringPath(c_szFileName, strFileName);
|
||||
DWORD dwCRC = GetCaseCRC32(strFileName.c_str(), strFileName.length());
|
||||
*pdwRetCRC=dwCRC;
|
||||
|
||||
return RegisterEffect(c_szFileName,false,isNeedCache);
|
||||
}
|
||||
|
||||
int CEffectManager::CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation)
|
||||
{
|
||||
DWORD dwID = GetCaseCRC32(c_szFileName, strlen(c_szFileName));
|
||||
return CreateEffect(dwID, c_rv3Position, c_rv3Rotation);
|
||||
}
|
||||
|
||||
int CEffectManager::CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation)
|
||||
{
|
||||
int iInstanceIndex = GetEmptyIndex();
|
||||
|
||||
CreateEffectInstance(iInstanceIndex, dwID);
|
||||
SelectEffectInstance(iInstanceIndex);
|
||||
D3DXMATRIX mat;
|
||||
D3DXMatrixRotationYawPitchRoll(&mat,D3DXToRadian(c_rv3Rotation.x),D3DXToRadian(c_rv3Rotation.y),D3DXToRadian(c_rv3Rotation.z));
|
||||
mat._41 = c_rv3Position.x;
|
||||
mat._42 = c_rv3Position.y;
|
||||
mat._43 = c_rv3Position.z;
|
||||
SetEffectInstanceGlobalMatrix(mat);
|
||||
|
||||
return iInstanceIndex;
|
||||
}
|
||||
|
||||
void CEffectManager::CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID)
|
||||
{
|
||||
if (!dwID)
|
||||
return;
|
||||
|
||||
CEffectData * pEffect;
|
||||
if (!GetEffectData(dwID, &pEffect))
|
||||
{
|
||||
Tracef("CEffectManager::CreateEffectInstance - NO DATA :%d\n", dwID);
|
||||
return;
|
||||
}
|
||||
|
||||
CEffectInstance * pEffectInstance = CEffectInstance::New();
|
||||
pEffectInstance->SetEffectDataPointer(pEffect);
|
||||
|
||||
m_kEftInstMap.insert(TEffectInstanceMap::value_type(dwInstanceIndex, pEffectInstance));
|
||||
}
|
||||
|
||||
bool CEffectManager::DestroyEffectInstance(DWORD dwInstanceIndex)
|
||||
{
|
||||
TEffectInstanceMap::iterator itor = m_kEftInstMap.find(dwInstanceIndex);
|
||||
|
||||
if (itor == m_kEftInstMap.end())
|
||||
return false;
|
||||
|
||||
CEffectInstance * pEffectInstance = itor->second;
|
||||
|
||||
m_kEftInstMap.erase(itor);
|
||||
|
||||
CEffectInstance::Delete(pEffectInstance);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEffectManager::DeactiveEffectInstance(DWORD dwInstanceIndex)
|
||||
{
|
||||
TEffectInstanceMap::iterator itor = m_kEftInstMap.find(dwInstanceIndex);
|
||||
|
||||
if (itor == m_kEftInstMap.end())
|
||||
return;
|
||||
|
||||
CEffectInstance * pEffectInstance = itor->second;
|
||||
pEffectInstance->SetDeactive();
|
||||
}
|
||||
|
||||
void CEffectManager::CreateUnsafeEffectInstance(DWORD dwEffectDataID, CEffectInstance ** ppEffectInstance)
|
||||
{
|
||||
CEffectData * pEffect;
|
||||
if (!GetEffectData(dwEffectDataID, &pEffect))
|
||||
{
|
||||
Tracef("CEffectManager::CreateEffectInstance - NO DATA :%d\n", dwEffectDataID);
|
||||
return;
|
||||
}
|
||||
|
||||
CEffectInstance* pkEftInstNew=CEffectInstance::New();
|
||||
pkEftInstNew->SetEffectDataPointer(pEffect);
|
||||
|
||||
*ppEffectInstance = pkEftInstNew;
|
||||
}
|
||||
|
||||
bool CEffectManager::DestroyUnsafeEffectInstance(CEffectInstance * pEffectInstance)
|
||||
{
|
||||
if (!pEffectInstance)
|
||||
return false;
|
||||
|
||||
CEffectInstance::Delete(pEffectInstance);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CEffectManager::SelectEffectInstance(DWORD dwInstanceIndex)
|
||||
{
|
||||
TEffectInstanceMap::iterator itor = m_kEftInstMap.find(dwInstanceIndex);
|
||||
|
||||
m_pSelectedEffectInstance = NULL;
|
||||
|
||||
if (m_kEftInstMap.end() == itor)
|
||||
return FALSE;
|
||||
|
||||
m_pSelectedEffectInstance = itor->second;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CEffectManager::SetEffectTextures(DWORD dwID, std::vector<std::string> textures)
|
||||
{
|
||||
CEffectData * pEffectData;
|
||||
if (!GetEffectData(dwID, &pEffectData))
|
||||
{
|
||||
Tracef("CEffectManager::CreateEffectInstance - NO DATA :%d\n", dwID);
|
||||
return;
|
||||
}
|
||||
|
||||
for(DWORD i = 0; i < textures.size(); i++)
|
||||
{
|
||||
CParticleSystemData * pParticle = pEffectData->GetParticlePointer(i);
|
||||
pParticle->ChangeTexture(textures.at(i).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectManager::SetEffectInstancePosition(const D3DXVECTOR3 & c_rv3Position)
|
||||
{
|
||||
if (!m_pSelectedEffectInstance)
|
||||
{
|
||||
// assert(!"Instance to use is not yet set!");
|
||||
return;
|
||||
}
|
||||
|
||||
m_pSelectedEffectInstance->SetPosition(c_rv3Position);
|
||||
}
|
||||
|
||||
void CEffectManager::SetEffectInstanceRotation(const D3DXVECTOR3 & c_rv3Rotation)
|
||||
{
|
||||
if (!m_pSelectedEffectInstance)
|
||||
{
|
||||
// assert(!"Instance to use is not yet set!");
|
||||
return;
|
||||
}
|
||||
|
||||
m_pSelectedEffectInstance->SetRotation(c_rv3Rotation.x,c_rv3Rotation.y,c_rv3Rotation.z);
|
||||
}
|
||||
|
||||
void CEffectManager::SetEffectInstanceGlobalMatrix(const D3DXMATRIX & c_rmatGlobal)
|
||||
{
|
||||
if (!m_pSelectedEffectInstance)
|
||||
return;
|
||||
|
||||
m_pSelectedEffectInstance->SetGlobalMatrix(c_rmatGlobal);
|
||||
}
|
||||
|
||||
void CEffectManager::ShowEffect()
|
||||
{
|
||||
if (!m_pSelectedEffectInstance)
|
||||
return;
|
||||
|
||||
m_pSelectedEffectInstance->Show();
|
||||
}
|
||||
|
||||
void CEffectManager::HideEffect()
|
||||
{
|
||||
if (!m_pSelectedEffectInstance)
|
||||
return;
|
||||
|
||||
m_pSelectedEffectInstance->Hide();
|
||||
}
|
||||
|
||||
bool CEffectManager::GetEffectData(DWORD dwID, CEffectData ** ppEffect)
|
||||
{
|
||||
TEffectDataMap::iterator itor = m_kEftDataMap.find(dwID);
|
||||
|
||||
if (itor == m_kEftDataMap.end())
|
||||
return false;
|
||||
|
||||
*ppEffect = itor->second;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEffectManager::GetEffectData(DWORD dwID, const CEffectData ** c_ppEffect)
|
||||
{
|
||||
TEffectDataMap::iterator itor = m_kEftDataMap.find(dwID);
|
||||
|
||||
if (itor == m_kEftDataMap.end())
|
||||
return false;
|
||||
|
||||
*c_ppEffect = itor->second;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
DWORD CEffectManager::GetRandomEffect()
|
||||
{
|
||||
int iIndex = random() % m_kEftDataMap.size();
|
||||
|
||||
TEffectDataMap::iterator itor = m_kEftDataMap.begin();
|
||||
for (int i = 0; i < iIndex; ++i, ++itor);
|
||||
|
||||
return itor->first;
|
||||
}
|
||||
|
||||
int CEffectManager::GetEmptyIndex()
|
||||
{
|
||||
static int iMaxIndex=1;
|
||||
|
||||
if (iMaxIndex>2100000000)
|
||||
iMaxIndex = 1;
|
||||
|
||||
int iNextIndex = iMaxIndex++;
|
||||
while(m_kEftInstMap.find(iNextIndex) != m_kEftInstMap.end())
|
||||
iNextIndex++;
|
||||
|
||||
return iNextIndex;
|
||||
}
|
||||
|
||||
void CEffectManager::DeleteAllInstances()
|
||||
{
|
||||
__DestroyEffectInstanceMap();
|
||||
}
|
||||
|
||||
void CEffectManager::__DestroyEffectInstanceMap()
|
||||
{
|
||||
for (TEffectInstanceMap::iterator i = m_kEftInstMap.begin(); i != m_kEftInstMap.end(); ++i)
|
||||
{
|
||||
CEffectInstance * pkEftInst = i->second;
|
||||
CEffectInstance::Delete(pkEftInst);
|
||||
}
|
||||
|
||||
m_kEftInstMap.clear();
|
||||
}
|
||||
|
||||
void CEffectManager::__DestroyEffectCacheMap()
|
||||
{
|
||||
for (TEffectInstanceMap::iterator i = m_kEftCacheMap.begin(); i != m_kEftCacheMap.end(); ++i)
|
||||
{
|
||||
CEffectInstance * pkEftInst = i->second;
|
||||
CEffectInstance::Delete(pkEftInst);
|
||||
}
|
||||
|
||||
m_kEftCacheMap.clear();
|
||||
}
|
||||
|
||||
void CEffectManager::__DestroyEffectDataMap()
|
||||
{
|
||||
for (TEffectDataMap::iterator i = m_kEftDataMap.begin(); i != m_kEftDataMap.end(); ++i)
|
||||
{
|
||||
CEffectData * pData = i->second;
|
||||
CEffectData::Delete(pData);
|
||||
}
|
||||
|
||||
m_kEftDataMap.clear();
|
||||
}
|
||||
|
||||
void CEffectManager::Destroy()
|
||||
{
|
||||
__DestroyEffectInstanceMap();
|
||||
__DestroyEffectCacheMap();
|
||||
__DestroyEffectDataMap();
|
||||
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
void CEffectManager::__Initialize()
|
||||
{
|
||||
m_pSelectedEffectInstance = NULL;
|
||||
m_isDisableSortRendering = false;
|
||||
}
|
||||
|
||||
CEffectManager::CEffectManager()
|
||||
{
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
CEffectManager::~CEffectManager()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
// just for map effect
|
||||
|
||||
@@ -0,0 +1,699 @@
|
||||
#include "StdAfx.h"
|
||||
#include "../EterLib/StateManager.h"
|
||||
#include "../EterLib/ResourceManager.h"
|
||||
#include "../EterPack/EterPackManager.h"
|
||||
#include "EffectMesh.h"
|
||||
|
||||
CDynamicPool<CEffectMesh::SEffectMeshData> CEffectMesh::SEffectMeshData::ms_kPool;
|
||||
|
||||
CEffectMesh::SEffectMeshData* CEffectMesh::SEffectMeshData::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CEffectMesh::SEffectMeshData::Delete(SEffectMeshData* pkData)
|
||||
{
|
||||
pkData->EffectFrameDataVector.clear();
|
||||
pkData->pImageVector.clear();
|
||||
|
||||
ms_kPool.Free(pkData);
|
||||
}
|
||||
|
||||
void CEffectMesh::SEffectMeshData::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
|
||||
DWORD CEffectMesh::GetFrameCount()
|
||||
{
|
||||
return m_iFrameCount;
|
||||
}
|
||||
|
||||
DWORD CEffectMesh::GetMeshCount()
|
||||
{
|
||||
return m_pEffectMeshDataVector.size();
|
||||
}
|
||||
|
||||
CEffectMesh::TEffectMeshData * CEffectMesh::GetMeshDataPointer(DWORD dwMeshIndex)
|
||||
{
|
||||
assert(dwMeshIndex < m_pEffectMeshDataVector.size());
|
||||
return m_pEffectMeshDataVector[dwMeshIndex];
|
||||
}
|
||||
|
||||
std::vector<CGraphicImage*>* CEffectMesh::GetTextureVectorPointer(DWORD dwMeshIndex)
|
||||
{
|
||||
if (dwMeshIndex>=m_pEffectMeshDataVector.size())
|
||||
return NULL;
|
||||
|
||||
return &m_pEffectMeshDataVector[dwMeshIndex]->pImageVector;
|
||||
}
|
||||
|
||||
std::vector<CGraphicImage*> & CEffectMesh::GetTextureVectorReference(DWORD dwMeshIndex)
|
||||
{
|
||||
return m_pEffectMeshDataVector[dwMeshIndex]->pImageVector;
|
||||
}
|
||||
|
||||
CEffectMesh::TType CEffectMesh::Type()
|
||||
{
|
||||
static TType s_type = StringToType("CEffectMesh");
|
||||
return s_type;
|
||||
}
|
||||
|
||||
bool CEffectMesh::OnIsType(TType type)
|
||||
{
|
||||
if (CEffectMesh::Type() == type)
|
||||
return true;
|
||||
|
||||
return CResource::OnIsType(type);
|
||||
}
|
||||
|
||||
bool CEffectMesh::OnLoad(int iSize, const void * c_pvBuf)
|
||||
{
|
||||
if (!c_pvBuf)
|
||||
return false;
|
||||
|
||||
const BYTE * c_pbBuf = static_cast<const BYTE *> (c_pvBuf);
|
||||
|
||||
char szHeader[10+1];
|
||||
memcpy(szHeader, c_pbBuf, 10+1);
|
||||
c_pbBuf += 10+1;
|
||||
|
||||
if (0 == strcmp("EffectData", szHeader))
|
||||
{
|
||||
if (!__LoadData_Ver001(iSize, c_pbBuf))
|
||||
return false;
|
||||
}
|
||||
else if (0 == strcmp("MDEData002", szHeader))
|
||||
{
|
||||
if (!__LoadData_Ver002(iSize, c_pbBuf))
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_isData = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CEffectMesh::__LoadData_Ver002(int iSize, const BYTE * c_pbBuf)
|
||||
{
|
||||
std::vector<D3DXVECTOR3> v3VertexVector;
|
||||
std::vector<int> iIndexVector;
|
||||
std::vector<D3DXVECTOR2> v3TextureVertexVector;
|
||||
std::vector<int> iTextureIndexVector;
|
||||
|
||||
m_iGeomCount = *(int *)c_pbBuf;
|
||||
c_pbBuf += 4;
|
||||
m_iFrameCount = *(int *)c_pbBuf;
|
||||
c_pbBuf += 4;
|
||||
|
||||
m_pEffectMeshDataVector.clear();
|
||||
m_pEffectMeshDataVector.resize(m_iGeomCount);
|
||||
|
||||
for (short n = 0; n < m_iGeomCount; ++n)
|
||||
{
|
||||
SEffectMeshData * pMeshData = SEffectMeshData::New();
|
||||
|
||||
memcpy(pMeshData->szObjectName, c_pbBuf, 32);
|
||||
c_pbBuf += 32;
|
||||
memcpy(pMeshData->szDiffuseMapFileName, c_pbBuf, 128);
|
||||
c_pbBuf += 128;
|
||||
|
||||
pMeshData->EffectFrameDataVector.clear();
|
||||
pMeshData->EffectFrameDataVector.resize(m_iFrameCount);
|
||||
|
||||
for(int i = 0; i < m_iFrameCount; ++i)
|
||||
{
|
||||
TEffectFrameData & rFrameData = pMeshData->EffectFrameDataVector[i];
|
||||
|
||||
memcpy(&rFrameData.byChangedFrame, c_pbBuf, sizeof(BYTE));
|
||||
c_pbBuf += sizeof(BYTE);
|
||||
|
||||
memcpy(&rFrameData.fVisibility, c_pbBuf, sizeof(float));
|
||||
c_pbBuf += sizeof(float);
|
||||
|
||||
memcpy(&rFrameData.dwVertexCount, c_pbBuf, sizeof(DWORD));
|
||||
c_pbBuf += sizeof(DWORD);
|
||||
|
||||
memcpy(&rFrameData.dwIndexCount, c_pbBuf, sizeof(DWORD));
|
||||
c_pbBuf += sizeof(DWORD);
|
||||
|
||||
memcpy(&rFrameData.dwTextureVertexCount, c_pbBuf, sizeof(DWORD));
|
||||
c_pbBuf += sizeof(DWORD);
|
||||
|
||||
v3VertexVector.clear();
|
||||
v3VertexVector.resize(rFrameData.dwVertexCount);
|
||||
iIndexVector.clear();
|
||||
iIndexVector.resize(rFrameData.dwIndexCount);
|
||||
v3TextureVertexVector.clear();
|
||||
v3TextureVertexVector.resize(rFrameData.dwTextureVertexCount);
|
||||
iTextureIndexVector.clear();
|
||||
iTextureIndexVector.resize(rFrameData.dwIndexCount);
|
||||
|
||||
memcpy(&v3VertexVector[0], c_pbBuf, rFrameData.dwVertexCount*sizeof(D3DXVECTOR3));
|
||||
c_pbBuf += rFrameData.dwVertexCount*sizeof(D3DXVECTOR3);
|
||||
memcpy(&iIndexVector[0], c_pbBuf, rFrameData.dwIndexCount*sizeof(int));
|
||||
c_pbBuf += rFrameData.dwIndexCount*sizeof(int);
|
||||
memcpy(&v3TextureVertexVector[0], c_pbBuf, rFrameData.dwTextureVertexCount*sizeof(D3DXVECTOR2));
|
||||
c_pbBuf += rFrameData.dwTextureVertexCount*sizeof(D3DXVECTOR2);
|
||||
memcpy(&iTextureIndexVector[0], c_pbBuf, rFrameData.dwIndexCount*sizeof(int));
|
||||
c_pbBuf += rFrameData.dwIndexCount*sizeof(int);
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
rFrameData.PDTVertexVector.clear();
|
||||
rFrameData.PDTVertexVector.resize(rFrameData.dwIndexCount);
|
||||
for (DWORD j = 0; j < rFrameData.dwIndexCount; ++j)
|
||||
{
|
||||
TPTVertex & rVertex = rFrameData.PDTVertexVector[j];
|
||||
|
||||
DWORD dwIndex = iIndexVector[j];
|
||||
DWORD dwTextureIndex = iTextureIndexVector[j];
|
||||
|
||||
assert(dwIndex < v3VertexVector.size());
|
||||
assert(dwTextureIndex < v3TextureVertexVector.size());
|
||||
|
||||
rVertex.position = v3VertexVector[dwIndex];
|
||||
rVertex.texCoord = v3TextureVertexVector[dwTextureIndex];
|
||||
rVertex.texCoord.y *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
pMeshData->pImageVector.clear();
|
||||
|
||||
std::string strExtension;
|
||||
GetFileExtension(pMeshData->szDiffuseMapFileName, strlen(pMeshData->szDiffuseMapFileName), &strExtension);
|
||||
stl_lowers(strExtension);
|
||||
|
||||
if (0 == strExtension.compare("ifl"))
|
||||
{
|
||||
LPCVOID pMotionData;
|
||||
CMappedFile File;
|
||||
|
||||
if (CEterPackManager::Instance().Get(File, pMeshData->szDiffuseMapFileName, &pMotionData))
|
||||
{
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
std::vector<std::string> stTokenVector;
|
||||
|
||||
textFileLoader.Bind(File.Size(), pMotionData);
|
||||
|
||||
std::string strPathName;
|
||||
GetOnlyPathName(pMeshData->szDiffuseMapFileName, strPathName);
|
||||
|
||||
std::string strTextureFileName;
|
||||
for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)
|
||||
{
|
||||
const std::string & c_rstrFileName = textFileLoader.GetLineString(i);
|
||||
|
||||
if (c_rstrFileName.empty())
|
||||
continue;
|
||||
|
||||
strTextureFileName = strPathName;
|
||||
strTextureFileName += c_rstrFileName;
|
||||
|
||||
CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(strTextureFileName.c_str());
|
||||
|
||||
pMeshData->pImageVector.push_back(pImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(pMeshData->szDiffuseMapFileName);
|
||||
|
||||
pMeshData->pImageVector.push_back(pImage);
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
m_pEffectMeshDataVector[n] = pMeshData;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CEffectMesh::__LoadData_Ver001(int iSize, const BYTE * c_pbBuf)
|
||||
{
|
||||
std::vector<D3DXVECTOR3> v3VertexVector;
|
||||
std::vector<int> iIndexVector;
|
||||
std::vector<D3DXVECTOR2> v3TextureVertexVector;
|
||||
std::vector<int> iTextureIndexVector;
|
||||
|
||||
m_iGeomCount = *(int *)c_pbBuf;
|
||||
c_pbBuf += 4;
|
||||
m_iFrameCount = *(int *)c_pbBuf;
|
||||
c_pbBuf += 4;
|
||||
|
||||
m_pEffectMeshDataVector.clear();
|
||||
m_pEffectMeshDataVector.resize(m_iGeomCount);
|
||||
|
||||
for (short n = 0; n < m_iGeomCount; ++n)
|
||||
{
|
||||
SEffectMeshData * pMeshData = SEffectMeshData::New();
|
||||
|
||||
memcpy(pMeshData->szObjectName, c_pbBuf, 32);
|
||||
c_pbBuf += 32;
|
||||
memcpy(pMeshData->szDiffuseMapFileName, c_pbBuf, 128);
|
||||
c_pbBuf += 128;
|
||||
|
||||
//
|
||||
|
||||
DWORD dwVertexCount;
|
||||
DWORD dwIndexCount;
|
||||
DWORD dwTextureVertexCount;
|
||||
|
||||
memcpy(&dwVertexCount, c_pbBuf, sizeof(DWORD));
|
||||
c_pbBuf += sizeof(DWORD);
|
||||
|
||||
memcpy(&dwIndexCount, c_pbBuf, sizeof(DWORD));
|
||||
c_pbBuf += sizeof(DWORD);
|
||||
|
||||
memcpy(&dwTextureVertexCount, c_pbBuf, sizeof(DWORD));
|
||||
c_pbBuf += sizeof(DWORD);
|
||||
|
||||
pMeshData->EffectFrameDataVector.clear();
|
||||
pMeshData->EffectFrameDataVector.resize(m_iFrameCount);
|
||||
|
||||
for(int i = 0; i < m_iFrameCount; ++i)
|
||||
{
|
||||
TEffectFrameData & rFrameData = pMeshData->EffectFrameDataVector[i];
|
||||
|
||||
rFrameData.dwVertexCount = dwVertexCount;
|
||||
rFrameData.dwIndexCount = dwIndexCount;
|
||||
rFrameData.dwTextureVertexCount = dwTextureVertexCount;
|
||||
|
||||
v3VertexVector.clear();
|
||||
v3VertexVector.resize(rFrameData.dwVertexCount);
|
||||
iIndexVector.clear();
|
||||
iIndexVector.resize(rFrameData.dwIndexCount);
|
||||
v3TextureVertexVector.clear();
|
||||
v3TextureVertexVector.resize(rFrameData.dwTextureVertexCount);
|
||||
iTextureIndexVector.clear();
|
||||
iTextureIndexVector.resize(rFrameData.dwIndexCount);
|
||||
|
||||
memcpy(&rFrameData.fVisibility, c_pbBuf, sizeof(float));
|
||||
c_pbBuf += sizeof(float);
|
||||
memcpy(&v3VertexVector[0], c_pbBuf, rFrameData.dwVertexCount*sizeof(D3DXVECTOR3));
|
||||
c_pbBuf += rFrameData.dwVertexCount*sizeof(D3DXVECTOR3);
|
||||
memcpy(&iIndexVector[0], c_pbBuf, rFrameData.dwIndexCount*sizeof(int));
|
||||
c_pbBuf += rFrameData.dwIndexCount*sizeof(int);
|
||||
memcpy(&v3TextureVertexVector[0], c_pbBuf, rFrameData.dwTextureVertexCount*sizeof(D3DXVECTOR2));
|
||||
c_pbBuf += rFrameData.dwTextureVertexCount*sizeof(D3DXVECTOR2);
|
||||
memcpy(&iTextureIndexVector[0], c_pbBuf, rFrameData.dwIndexCount*sizeof(int));
|
||||
c_pbBuf += rFrameData.dwIndexCount*sizeof(int);
|
||||
|
||||
///////////////////////////////
|
||||
|
||||
rFrameData.PDTVertexVector.clear();
|
||||
rFrameData.PDTVertexVector.resize(rFrameData.dwIndexCount);
|
||||
for (DWORD j = 0; j < rFrameData.dwIndexCount; ++j)
|
||||
{
|
||||
TPTVertex & rVertex = rFrameData.PDTVertexVector[j];
|
||||
|
||||
DWORD dwIndex = iIndexVector[j];
|
||||
DWORD dwTextureIndex = iTextureIndexVector[j];
|
||||
|
||||
assert(dwIndex < v3VertexVector.size());
|
||||
assert(dwTextureIndex < v3TextureVertexVector.size());
|
||||
|
||||
rVertex.position = v3VertexVector[dwIndex];
|
||||
rVertex.texCoord = v3TextureVertexVector[dwTextureIndex];
|
||||
rVertex.texCoord.y *= -1;
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
pMeshData->pImageVector.clear();
|
||||
|
||||
std::string strExtension;
|
||||
GetFileExtension(pMeshData->szDiffuseMapFileName, strlen(pMeshData->szDiffuseMapFileName), &strExtension);
|
||||
stl_lowers(strExtension);
|
||||
|
||||
if (0 == strExtension.compare("ifl"))
|
||||
{
|
||||
LPCVOID pMotionData;
|
||||
CMappedFile File;
|
||||
|
||||
if (CEterPackManager::Instance().Get(File, pMeshData->szDiffuseMapFileName, &pMotionData))
|
||||
{
|
||||
CMemoryTextFileLoader textFileLoader;
|
||||
std::vector<std::string> stTokenVector;
|
||||
|
||||
textFileLoader.Bind(File.Size(), pMotionData);
|
||||
|
||||
std::string strPathName;
|
||||
GetOnlyPathName(pMeshData->szDiffuseMapFileName, strPathName);
|
||||
|
||||
std::string strTextureFileName;
|
||||
for (DWORD i = 0; i < textFileLoader.GetLineCount(); ++i)
|
||||
{
|
||||
const std::string & c_rstrFileName = textFileLoader.GetLineString(i);
|
||||
|
||||
if (c_rstrFileName.empty())
|
||||
continue;
|
||||
|
||||
strTextureFileName = strPathName;
|
||||
strTextureFileName += c_rstrFileName;
|
||||
|
||||
CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(strTextureFileName.c_str());
|
||||
|
||||
pMeshData->pImageVector.push_back(pImage);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(pMeshData->szDiffuseMapFileName);
|
||||
|
||||
pMeshData->pImageVector.push_back(pImage);
|
||||
}
|
||||
|
||||
////////////////////////////////////
|
||||
|
||||
m_pEffectMeshDataVector[n] = pMeshData;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CEffectMesh::GetMeshElementPointer(DWORD dwMeshIndex, TEffectMeshData ** ppMeshData)
|
||||
{
|
||||
if (dwMeshIndex >= m_pEffectMeshDataVector.size())
|
||||
return FALSE;
|
||||
|
||||
*ppMeshData = m_pEffectMeshDataVector[dwMeshIndex];
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CEffectMesh::OnClear()
|
||||
{
|
||||
if (!m_isData)
|
||||
return;
|
||||
|
||||
for (DWORD i = 0; i < m_pEffectMeshDataVector.size(); ++i)
|
||||
{
|
||||
m_pEffectMeshDataVector[i]->pImageVector.clear();
|
||||
m_pEffectMeshDataVector[i]->EffectFrameDataVector.clear();
|
||||
|
||||
SEffectMeshData::Delete(m_pEffectMeshDataVector[i]);
|
||||
}
|
||||
m_pEffectMeshDataVector.clear();
|
||||
|
||||
m_isData = false;
|
||||
}
|
||||
|
||||
bool CEffectMesh::OnIsEmpty() const
|
||||
{
|
||||
return !m_isData;
|
||||
}
|
||||
|
||||
CEffectMesh::CEffectMesh(const char * c_szFileName) : CResource(c_szFileName)
|
||||
{
|
||||
m_iGeomCount = 0;
|
||||
m_iFrameCount = 0;
|
||||
m_isData = false;
|
||||
}
|
||||
|
||||
CEffectMesh::~CEffectMesh()
|
||||
{
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
CDynamicPool<CEffectMeshScript> CEffectMeshScript::ms_kPool;
|
||||
|
||||
void CEffectMeshScript::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
CEffectMeshScript* CEffectMeshScript::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CEffectMeshScript::Delete(CEffectMeshScript* pkData)
|
||||
{
|
||||
pkData->Clear();
|
||||
ms_kPool.Free(pkData);
|
||||
}
|
||||
|
||||
void CEffectMeshScript::ReserveMeshData(DWORD dwMeshCount)
|
||||
{
|
||||
if (m_MeshDataVector.size() == dwMeshCount)
|
||||
return;
|
||||
|
||||
m_MeshDataVector.clear();
|
||||
m_MeshDataVector.resize(dwMeshCount);
|
||||
|
||||
for (DWORD i = 0; i < m_MeshDataVector.size(); ++i)
|
||||
{
|
||||
TMeshData & rMeshData = m_MeshDataVector[i];
|
||||
|
||||
rMeshData.byBillboardType = MESH_BILLBOARD_TYPE_NONE;
|
||||
rMeshData.bBlendingEnable = TRUE;
|
||||
rMeshData.byBlendingSrcType = D3DBLEND_SRCCOLOR;
|
||||
rMeshData.byBlendingDestType = D3DBLEND_ONE;
|
||||
rMeshData.bTextureAlphaEnable = FALSE;
|
||||
|
||||
rMeshData.byColorOperationType = D3DTOP_MODULATE;
|
||||
rMeshData.ColorFactor = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
|
||||
rMeshData.bTextureAnimationLoopEnable = true;
|
||||
rMeshData.fTextureAnimationFrameDelay = 0.02f;
|
||||
rMeshData.dwTextureAnimationStartFrame = 0;
|
||||
}
|
||||
}
|
||||
|
||||
const char * CEffectMeshScript::GetMeshFileName()
|
||||
{
|
||||
return m_strMeshFileName.c_str();
|
||||
}
|
||||
|
||||
bool CEffectMeshScript::CheckMeshIndex(DWORD dwMeshIndex)
|
||||
{
|
||||
if (dwMeshIndex >= m_MeshDataVector.size())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CEffectMeshScript::GetMeshDataPointer(DWORD dwMeshIndex, TMeshData ** ppMeshData)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return false;
|
||||
|
||||
*ppMeshData = &m_MeshDataVector[dwMeshIndex];
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
int CEffectMeshScript::GetMeshDataCount()
|
||||
{
|
||||
return m_MeshDataVector.size();
|
||||
}
|
||||
|
||||
int CEffectMeshScript::GetBillboardType(DWORD dwMeshIndex)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return 0;
|
||||
|
||||
return m_MeshDataVector[dwMeshIndex].byBillboardType;
|
||||
}
|
||||
BOOL CEffectMeshScript::isBlendingEnable(DWORD dwMeshIndex)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return FALSE;
|
||||
|
||||
return m_MeshDataVector[dwMeshIndex].bBlendingEnable;
|
||||
}
|
||||
BYTE CEffectMeshScript::GetBlendingSrcType(DWORD dwMeshIndex)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return false;
|
||||
|
||||
return m_MeshDataVector[dwMeshIndex].byBlendingSrcType;
|
||||
}
|
||||
BYTE CEffectMeshScript::GetBlendingDestType(DWORD dwMeshIndex)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return false;
|
||||
|
||||
return m_MeshDataVector[dwMeshIndex].byBlendingDestType;
|
||||
}
|
||||
BOOL CEffectMeshScript::isTextureAlphaEnable(DWORD dwMeshIndex)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return false;
|
||||
|
||||
return m_MeshDataVector[dwMeshIndex].bTextureAlphaEnable;
|
||||
}
|
||||
|
||||
BOOL CEffectMeshScript::GetColorOperationType(DWORD dwMeshIndex, BYTE * pbyType)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return FALSE;
|
||||
|
||||
*pbyType = m_MeshDataVector[dwMeshIndex].byColorOperationType;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
BOOL CEffectMeshScript::GetColorFactor(DWORD dwMeshIndex, D3DXCOLOR * pColor)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return FALSE;
|
||||
|
||||
*pColor = m_MeshDataVector[dwMeshIndex].ColorFactor;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL CEffectMeshScript::GetTimeTableAlphaPointer(DWORD dwMeshIndex, TTimeEventTableFloat ** pTimeEventAlpha)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return FALSE;
|
||||
|
||||
*pTimeEventAlpha = &m_MeshDataVector[dwMeshIndex].TimeEventAlpha;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL CEffectMeshScript::isMeshAnimationLoop()
|
||||
{
|
||||
return m_isMeshAnimationLoop;
|
||||
}
|
||||
int CEffectMeshScript::GetMeshAnimationLoopCount()
|
||||
{
|
||||
return m_iMeshAnimationLoopCount;
|
||||
}
|
||||
float CEffectMeshScript::GetMeshAnimationFrameDelay()
|
||||
{
|
||||
return m_fMeshAnimationFrameDelay;
|
||||
}
|
||||
|
||||
BOOL CEffectMeshScript::isTextureAnimationLoop(DWORD dwMeshIndex)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return 0.0f;
|
||||
|
||||
return m_MeshDataVector[dwMeshIndex].bTextureAnimationLoopEnable;
|
||||
}
|
||||
float CEffectMeshScript::GetTextureAnimationFrameDelay(DWORD dwMeshIndex)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return 0.0f;
|
||||
|
||||
return m_MeshDataVector[dwMeshIndex].fTextureAnimationFrameDelay;
|
||||
}
|
||||
|
||||
DWORD CEffectMeshScript::GetTextureAnimationStartFrame(DWORD dwMeshIndex)
|
||||
{
|
||||
if (!CheckMeshIndex(dwMeshIndex))
|
||||
return 0;
|
||||
|
||||
return m_MeshDataVector[dwMeshIndex].dwTextureAnimationStartFrame;
|
||||
}
|
||||
|
||||
BOOL CEffectMeshScript::OnLoadScript(CTextFileLoader & rTextFileLoader)
|
||||
{
|
||||
if (rTextFileLoader.GetTokenString("meshfilename", &m_strMeshFileName))
|
||||
{
|
||||
if (!IsGlobalFileName(m_strMeshFileName.c_str()))
|
||||
{
|
||||
m_strMeshFileName = GetOnlyPathName(rTextFileLoader.GetFileName()) + m_strMeshFileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!rTextFileLoader.GetTokenInteger("meshanimationloopenable", &m_isMeshAnimationLoop))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenInteger("meshanimationloopcount", &m_iMeshAnimationLoopCount))
|
||||
{
|
||||
m_iMeshAnimationLoopCount = 0;
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenFloat("meshanimationframedelay", &m_fMeshAnimationFrameDelay))
|
||||
return FALSE;
|
||||
|
||||
DWORD dwMeshElementCount;
|
||||
if (!rTextFileLoader.GetTokenDoubleWord("meshelementcount", &dwMeshElementCount))
|
||||
return FALSE;
|
||||
|
||||
m_MeshDataVector.clear();
|
||||
m_MeshDataVector.resize(dwMeshElementCount);
|
||||
for (DWORD i = 0; i < m_MeshDataVector.size(); ++i)
|
||||
{
|
||||
CTextFileLoader::CGotoChild GotoChild(&rTextFileLoader, i);
|
||||
|
||||
TMeshData & rMeshData = m_MeshDataVector[i];
|
||||
|
||||
if (!rTextFileLoader.GetTokenByte("billboardtype", &rMeshData.byBillboardType))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenBoolean("blendingenable", &rMeshData.bBlendingEnable))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenByte("blendingsrctype", &rMeshData.byBlendingSrcType))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenByte("blendingdesttype", &rMeshData.byBlendingDestType))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenBoolean("textureanimationloopenable", &rMeshData.bTextureAnimationLoopEnable))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenFloat("textureanimationframedelay", &rMeshData.fTextureAnimationFrameDelay))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenDoubleWord("textureanimationstartframe", &rMeshData.dwTextureAnimationStartFrame))
|
||||
{
|
||||
rMeshData.dwTextureAnimationStartFrame = 0;
|
||||
}
|
||||
|
||||
if (!rTextFileLoader.GetTokenByte("coloroperationtype", &rMeshData.byColorOperationType))
|
||||
{
|
||||
rMeshData.byColorOperationType = D3DTOP_MODULATE;
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenColor("colorfactor", &rMeshData.ColorFactor))
|
||||
{
|
||||
rMeshData.ColorFactor = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
}
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventalpha", &rMeshData.TimeEventAlpha))
|
||||
{
|
||||
rMeshData.TimeEventAlpha.clear();
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool CEffectMeshScript::OnIsData()
|
||||
{
|
||||
if (0 == m_strMeshFileName.length())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEffectMeshScript::OnClear()
|
||||
{
|
||||
m_isMeshAnimationLoop = false;
|
||||
m_iMeshAnimationLoopCount = 0;
|
||||
m_fMeshAnimationFrameDelay = 0.02f;
|
||||
|
||||
m_MeshDataVector.clear();
|
||||
m_strMeshFileName = "";
|
||||
}
|
||||
|
||||
CEffectMeshScript::CEffectMeshScript()
|
||||
{
|
||||
}
|
||||
CEffectMeshScript::~CEffectMeshScript()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,271 @@
|
||||
#include "StdAfx.h"
|
||||
#include "../EterLib/StateManager.h"
|
||||
#include "../EterLib/ResourceManager.h"
|
||||
#include "EffectMeshInstance.h"
|
||||
#include "../EterLib/GrpMath.h"
|
||||
|
||||
CDynamicPool<CEffectMeshInstance> CEffectMeshInstance::ms_kPool;
|
||||
|
||||
void CEffectMeshInstance::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
CEffectMeshInstance* CEffectMeshInstance::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CEffectMeshInstance::Delete(CEffectMeshInstance* pkMeshInstance)
|
||||
{
|
||||
pkMeshInstance->Destroy();
|
||||
ms_kPool.Free(pkMeshInstance);
|
||||
}
|
||||
|
||||
BOOL CEffectMeshInstance::isActive()
|
||||
{
|
||||
if (!CEffectElementBaseInstance::isActive())
|
||||
return FALSE;
|
||||
|
||||
if (!m_MeshFrameController.isActive())
|
||||
return FALSE;
|
||||
|
||||
for (DWORD j = 0; j < m_TextureInstanceVector.size(); ++j)
|
||||
{
|
||||
int iCurrentFrame = m_MeshFrameController.GetCurrentFrame();
|
||||
if (m_TextureInstanceVector[j].TextureFrameController.isActive(iCurrentFrame))
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
bool CEffectMeshInstance::OnUpdate(float fElapsedTime)
|
||||
{
|
||||
if (!isActive())
|
||||
return false;
|
||||
|
||||
if (m_MeshFrameController.isActive())
|
||||
m_MeshFrameController.Update(fElapsedTime);
|
||||
|
||||
for (DWORD j = 0; j < m_TextureInstanceVector.size(); ++j)
|
||||
{
|
||||
int iCurrentFrame = m_MeshFrameController.GetCurrentFrame();
|
||||
if (m_TextureInstanceVector[j].TextureFrameController.isActive(iCurrentFrame))
|
||||
m_TextureInstanceVector[j].TextureFrameController.Update(fElapsedTime);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEffectMeshInstance::OnRender()
|
||||
{
|
||||
if (!isActive())
|
||||
return;
|
||||
|
||||
CEffectMesh * pEffectMesh = m_roMesh.GetPointer();
|
||||
|
||||
for (DWORD i = 0; i < pEffectMesh->GetMeshCount(); ++i)
|
||||
{
|
||||
assert(i < m_TextureInstanceVector.size());
|
||||
|
||||
CFrameController & rTextureFrameController = m_TextureInstanceVector[i].TextureFrameController;
|
||||
if (!rTextureFrameController.isActive(m_MeshFrameController.GetCurrentFrame()))
|
||||
continue;
|
||||
|
||||
int iBillboardType = m_pMeshScript->GetBillboardType(i);
|
||||
|
||||
D3DXMATRIX m_matWorld;
|
||||
D3DXMatrixIdentity(&m_matWorld);
|
||||
|
||||
switch(iBillboardType)
|
||||
{
|
||||
case MESH_BILLBOARD_TYPE_ALL:
|
||||
{
|
||||
D3DXMATRIX matTemp;
|
||||
D3DXMatrixRotationX(&matTemp, 90.0f);
|
||||
D3DXMatrixInverse(&m_matWorld, NULL, &CScreen::GetViewMatrix());
|
||||
|
||||
m_matWorld = matTemp * m_matWorld;
|
||||
}
|
||||
break;
|
||||
|
||||
case MESH_BILLBOARD_TYPE_Y:
|
||||
{
|
||||
D3DXMATRIX matTemp;
|
||||
D3DXMatrixIdentity(&matTemp);
|
||||
|
||||
D3DXMatrixInverse(&matTemp, NULL, &CScreen::GetViewMatrix());
|
||||
m_matWorld._11 = matTemp._11;
|
||||
m_matWorld._12 = matTemp._12;
|
||||
m_matWorld._21 = matTemp._21;
|
||||
m_matWorld._22 = matTemp._22;
|
||||
}
|
||||
break;
|
||||
|
||||
case MESH_BILLBOARD_TYPE_MOVE:
|
||||
{
|
||||
D3DXVECTOR3 Position;
|
||||
m_pMeshScript->GetPosition(m_fLocalTime, Position);
|
||||
D3DXVECTOR3 LastPosition;
|
||||
m_pMeshScript->GetPosition(m_fLocalTime-CTimer::Instance().GetElapsedSecond(), LastPosition);
|
||||
Position -= LastPosition;
|
||||
if (D3DXVec3LengthSq(&Position)>0.001f)
|
||||
{
|
||||
D3DXVec3Normalize(&Position,&Position);
|
||||
D3DXQUATERNION q = SafeRotationNormalizedArc(D3DXVECTOR3(0.0f,-1.0f,0.0f),Position);
|
||||
D3DXMatrixRotationQuaternion(&m_matWorld,&q);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (!m_pMeshScript->isBlendingEnable(i))
|
||||
{
|
||||
STATEMANAGER.SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
int iBlendingSrcType = m_pMeshScript->GetBlendingSrcType(i);
|
||||
int iBlendingDestType = m_pMeshScript->GetBlendingDestType(i);
|
||||
STATEMANAGER.SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
|
||||
STATEMANAGER.SetRenderState(D3DRS_SRCBLEND, iBlendingSrcType);
|
||||
STATEMANAGER.SetRenderState(D3DRS_DESTBLEND, iBlendingDestType);
|
||||
}
|
||||
|
||||
D3DXVECTOR3 Position;
|
||||
m_pMeshScript->GetPosition(m_fLocalTime, Position);
|
||||
m_matWorld._41 = Position.x;
|
||||
m_matWorld._42 = Position.y;
|
||||
m_matWorld._43 = Position.z;
|
||||
m_matWorld = m_matWorld * *mc_pmatLocal;
|
||||
STATEMANAGER.SetTransform(D3DTS_WORLD, &m_matWorld);
|
||||
|
||||
BYTE byType;
|
||||
D3DXCOLOR Color(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
if (m_pMeshScript->GetColorOperationType(i, &byType))
|
||||
STATEMANAGER.SetTextureStageState(0, D3DTSS_COLOROP, byType);
|
||||
m_pMeshScript->GetColorFactor(i, &Color);
|
||||
|
||||
TTimeEventTableFloat * TableAlpha;
|
||||
|
||||
float fAlpha = 1.0f;
|
||||
if (m_pMeshScript->GetTimeTableAlphaPointer(i, &TableAlpha) && !TableAlpha->empty())
|
||||
GetTimeEventBlendValue(m_fLocalTime,*TableAlpha, &fAlpha);
|
||||
|
||||
// Render //
|
||||
CEffectMesh::TEffectMeshData * pMeshData = pEffectMesh->GetMeshDataPointer(i);
|
||||
|
||||
assert(m_MeshFrameController.GetCurrentFrame() < pMeshData->EffectFrameDataVector.size());
|
||||
CEffectMesh::TEffectFrameData & rFrameData = pMeshData->EffectFrameDataVector[m_MeshFrameController.GetCurrentFrame()];
|
||||
|
||||
DWORD dwcurTextureFrame = rTextureFrameController.GetCurrentFrame();
|
||||
if (dwcurTextureFrame < m_TextureInstanceVector[i].TextureInstanceVector.size())
|
||||
{
|
||||
CGraphicImageInstance * pImageInstance = m_TextureInstanceVector[i].TextureInstanceVector[dwcurTextureFrame];
|
||||
STATEMANAGER.SetTexture(0, pImageInstance->GetTexturePointer()->GetD3DTexture());
|
||||
}
|
||||
|
||||
Color.a = fAlpha * rFrameData.fVisibility;
|
||||
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, DWORD(Color));
|
||||
STATEMANAGER.SetVertexShader(D3DFVF_XYZ | D3DFVF_TEX1);
|
||||
STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLELIST,
|
||||
rFrameData.dwIndexCount/3,
|
||||
&rFrameData.PDTVertexVector[0],
|
||||
sizeof(TPTVertex));
|
||||
// Render //
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectMeshInstance::OnSetDataPointer(CEffectElementBase * pElement)
|
||||
{
|
||||
CEffectMeshScript * pMesh = (CEffectMeshScript *)pElement;
|
||||
m_pMeshScript = pMesh;
|
||||
|
||||
const char * c_szMeshFileName = pMesh->GetMeshFileName();
|
||||
|
||||
m_pEffectMesh = (CEffectMesh *) CResourceManager::Instance().GetResourcePointer(c_szMeshFileName);
|
||||
|
||||
if (!m_pEffectMesh)
|
||||
return;
|
||||
|
||||
m_roMesh.SetPointer(m_pEffectMesh);
|
||||
|
||||
m_MeshFrameController.Clear();
|
||||
m_MeshFrameController.SetMaxFrame(m_roMesh.GetPointer()->GetFrameCount());
|
||||
m_MeshFrameController.SetFrameTime(pMesh->GetMeshAnimationFrameDelay());
|
||||
m_MeshFrameController.SetLoopFlag(pMesh->isMeshAnimationLoop());
|
||||
m_MeshFrameController.SetLoopCount(pMesh->GetMeshAnimationLoopCount());
|
||||
m_MeshFrameController.SetStartFrame(0);
|
||||
|
||||
m_TextureInstanceVector.clear();
|
||||
m_TextureInstanceVector.resize(m_pEffectMesh->GetMeshCount());
|
||||
for (DWORD j = 0; j < m_TextureInstanceVector.size(); ++j)
|
||||
{
|
||||
CEffectMeshScript::TMeshData * pMeshData;
|
||||
if (!m_pMeshScript->GetMeshDataPointer(j, &pMeshData))
|
||||
continue;
|
||||
|
||||
CEffectMesh* pkEftMesh=m_roMesh.GetPointer();
|
||||
|
||||
if (!pkEftMesh)
|
||||
continue;
|
||||
|
||||
std::vector<CGraphicImage*>* pTextureVector = pkEftMesh->GetTextureVectorPointer(j);
|
||||
if (!pTextureVector)
|
||||
continue;
|
||||
|
||||
std::vector<CGraphicImage*>& rTextureVector = *pTextureVector;
|
||||
|
||||
CFrameController & rFrameController = m_TextureInstanceVector[j].TextureFrameController;
|
||||
rFrameController.Clear();
|
||||
rFrameController.SetMaxFrame(rTextureVector.size());
|
||||
rFrameController.SetFrameTime(pMeshData->fTextureAnimationFrameDelay);
|
||||
rFrameController.SetLoopFlag(pMeshData->bTextureAnimationLoopEnable);
|
||||
rFrameController.SetStartFrame(pMeshData->dwTextureAnimationStartFrame);
|
||||
|
||||
std::vector<CGraphicImageInstance*> & rImageInstanceVector = m_TextureInstanceVector[j].TextureInstanceVector;
|
||||
rImageInstanceVector.clear();
|
||||
rImageInstanceVector.reserve(rTextureVector.size());
|
||||
for (std::vector<CGraphicImage*>::iterator itor = rTextureVector.begin(); itor != rTextureVector.end(); ++itor)
|
||||
{
|
||||
CGraphicImage * pImage = *itor;
|
||||
CGraphicImageInstance * pImageInstance = CGraphicImageInstance::ms_kPool.Alloc();
|
||||
pImageInstance->SetImagePointer(pImage);
|
||||
rImageInstanceVector.push_back(pImageInstance);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CEffectMeshInstance_DeleteImageInstance(CGraphicImageInstance * pkInstance)
|
||||
{
|
||||
CGraphicImageInstance::ms_kPool.Free(pkInstance);
|
||||
}
|
||||
|
||||
void CEffectMeshInstance_DeleteTextureInstance(CEffectMeshInstance::TTextureInstance & rkInstance)
|
||||
{
|
||||
std::vector<CGraphicImageInstance*> & rVector = rkInstance.TextureInstanceVector;
|
||||
for_each(rVector.begin(), rVector.end(), CEffectMeshInstance_DeleteImageInstance);
|
||||
rVector.clear();
|
||||
}
|
||||
|
||||
void CEffectMeshInstance::OnInitialize()
|
||||
{
|
||||
}
|
||||
|
||||
void CEffectMeshInstance::OnDestroy()
|
||||
{
|
||||
for_each(m_TextureInstanceVector.begin(), m_TextureInstanceVector.end(), CEffectMeshInstance_DeleteTextureInstance);
|
||||
m_TextureInstanceVector.clear();
|
||||
m_roMesh.SetPointer(NULL);
|
||||
}
|
||||
|
||||
CEffectMeshInstance::CEffectMeshInstance()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CEffectMeshInstance::~CEffectMeshInstance()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
#include "StdAfx.h"
|
||||
#include "EffectUpdateDecorator.h"
|
||||
#include "ParticleInstance.h"
|
||||
namespace NEffectUpdateDecorator
|
||||
{
|
||||
|
||||
CBaseDecorator* CAirResistanceDecorator::__Clone(CParticleInstance* pfi, CParticleInstance* pi)
|
||||
{
|
||||
pi->m_fAirResistance = pfi->m_fAirResistance;
|
||||
return new CAirResistanceDecorator;
|
||||
}
|
||||
|
||||
void CAirResistanceDecorator::__Excute(const CDecoratorData & d)
|
||||
{
|
||||
d.pInstance->m_v3Velocity *= 1.0f-d.pInstance->m_fAirResistance;
|
||||
}
|
||||
CBaseDecorator* CGravityDecorator::__Clone(CParticleInstance* pfi, CParticleInstance* pi)
|
||||
{
|
||||
pi->m_fGravity = pfi->m_fGravity;
|
||||
return new CGravityDecorator;
|
||||
}
|
||||
|
||||
void CGravityDecorator::__Excute(const CDecoratorData& d)
|
||||
{
|
||||
d.pInstance->m_v3Velocity.z -= d.pInstance->m_fGravity * d.fElapsedTime;
|
||||
}
|
||||
|
||||
CBaseDecorator* CRotationDecorator::__Clone(CParticleInstance* pfi, CParticleInstance* pi)
|
||||
{
|
||||
pi->m_fRotationSpeed = pfi->m_fRotationSpeed;
|
||||
return new CRotationDecorator;
|
||||
}
|
||||
|
||||
void CRotationDecorator::__Excute(const CDecoratorData& d)
|
||||
{
|
||||
d.pInstance->m_fRotation += d.pInstance->m_fRotationSpeed * d.fElapsedTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,102 @@
|
||||
#include "StdAfx.h"
|
||||
#include "EmitterProperty.h"
|
||||
|
||||
BYTE CEmitterProperty::GetEmitterShape()
|
||||
{
|
||||
return m_byEmitterShape;
|
||||
}
|
||||
BYTE CEmitterProperty::GetEmitterAdvancedType()
|
||||
{
|
||||
return m_byEmitterAdvancedType;
|
||||
}
|
||||
BOOL CEmitterProperty::isEmitFromEdge()
|
||||
{
|
||||
return m_bEmitFromEdgeFlag;
|
||||
}
|
||||
|
||||
void CEmitterProperty::GetEmittingSize(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventEmittingSize, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventEmittingSize, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetEmittingAngularVelocity(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventEmittingAngularVelocity, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventEmittingAngularVelocity, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetEmittingDirectionX(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventEmittingDirectionX, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionX, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetEmittingDirectionY(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventEmittingDirectionY, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionY, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetEmittingDirectionZ(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventEmittingDirectionZ, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventEmittingDirectionZ, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetEmittingVelocity(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventEmittingVelocity, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventEmittingVelocity, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetEmissionCountPerSecond(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventEmissionCountPerSecond, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventEmissionCountPerSecond, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetParticleLifeTime(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventLifeTime, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventLifeTime, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetParticleSizeX(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventSizeX, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventSizeX, pfValue);
|
||||
}
|
||||
void CEmitterProperty::GetParticleSizeY(float fTime, float * pfValue)
|
||||
{
|
||||
//GetTimeEventBlendValue<TTimeEventTableFloat, float>(fTime, m_TimeEventSizeY, pfValue);
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventSizeY, pfValue);
|
||||
}
|
||||
|
||||
void CEmitterProperty::Clear()
|
||||
{
|
||||
m_dwMaxEmissionCount = 0;
|
||||
|
||||
m_fCycleLength = 0.0f;
|
||||
m_bCycleLoopFlag = FALSE;
|
||||
m_iLoopCount = 0;
|
||||
|
||||
m_byEmitterShape = EMITTER_SHAPE_POINT;
|
||||
m_byEmitterAdvancedType = EMITTER_ADVANCED_TYPE_FREE;
|
||||
m_bEmitFromEdgeFlag = FALSE;
|
||||
m_v3EmittingSize = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
|
||||
m_fEmittingRadius = 0.0f;
|
||||
|
||||
m_v3EmittingDirection = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
m_TimeEventEmittingSize.clear();
|
||||
m_TimeEventEmittingDirectionX.clear();
|
||||
m_TimeEventEmittingDirectionY.clear();
|
||||
m_TimeEventEmittingDirectionZ.clear();
|
||||
m_TimeEventEmittingVelocity.clear();
|
||||
m_TimeEventEmissionCountPerSecond.clear();
|
||||
m_TimeEventLifeTime.clear();
|
||||
m_TimeEventSizeX.clear();
|
||||
m_TimeEventSizeY.clear();
|
||||
m_TimeEventEmittingAngularVelocity.clear();
|
||||
}
|
||||
|
||||
CEmitterProperty::CEmitterProperty()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
CEmitterProperty::~CEmitterProperty()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
#include "StdAfx.h"
|
||||
#include "FrameController.h"
|
||||
|
||||
void CFrameController::Update(float fElapsedTime)
|
||||
{
|
||||
m_fLastFrameTime -= fElapsedTime;
|
||||
|
||||
for (int i = 0; i < 20; ++i)
|
||||
{
|
||||
if (m_fLastFrameTime < 0.0f)
|
||||
{
|
||||
m_fLastFrameTime += m_fFrameTime;
|
||||
++m_dwcurFrame;
|
||||
|
||||
if (m_dwcurFrame >= m_dwMaxFrame)
|
||||
{
|
||||
if (m_isLoop && --m_iLoopCount!=0)
|
||||
{
|
||||
if (m_iLoopCount<0)
|
||||
m_iLoopCount = 0;
|
||||
m_dwcurFrame = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_iLoopCount = 1;
|
||||
m_dwcurFrame = 0;
|
||||
m_isActive = FALSE;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CFrameController::SetCurrentFrame(DWORD dwFrame)
|
||||
{
|
||||
m_dwcurFrame = dwFrame;
|
||||
}
|
||||
|
||||
BYTE CFrameController::GetCurrentFrame()
|
||||
{
|
||||
return m_dwcurFrame;
|
||||
}
|
||||
|
||||
void CFrameController::SetMaxFrame(DWORD dwMaxFrame)
|
||||
{
|
||||
m_dwMaxFrame = dwMaxFrame;
|
||||
}
|
||||
void CFrameController::SetFrameTime(float fTime)
|
||||
{
|
||||
m_fFrameTime = fTime;
|
||||
m_fLastFrameTime = fTime;
|
||||
}
|
||||
void CFrameController::SetStartFrame(DWORD dwStartFrame)
|
||||
{
|
||||
m_dwStartFrame = dwStartFrame;
|
||||
}
|
||||
|
||||
void CFrameController::SetLoopFlag(BOOL bFlag)
|
||||
{
|
||||
m_isLoop = bFlag;
|
||||
}
|
||||
|
||||
void CFrameController::SetLoopCount(int iLoopCount)
|
||||
{
|
||||
m_iLoopCount = iLoopCount;
|
||||
}
|
||||
|
||||
void CFrameController::SetActive(BOOL bFlag)
|
||||
{
|
||||
m_isActive = bFlag;
|
||||
}
|
||||
|
||||
BOOL CFrameController::isActive(DWORD dwMainFrame)
|
||||
{
|
||||
if (dwMainFrame < m_dwStartFrame)
|
||||
return FALSE;
|
||||
|
||||
return m_isActive;
|
||||
}
|
||||
|
||||
void CFrameController::Clear()
|
||||
{
|
||||
m_isActive = TRUE;
|
||||
m_dwcurFrame = 0;
|
||||
m_fLastFrameTime = 0.0f;
|
||||
}
|
||||
|
||||
CFrameController::CFrameController()
|
||||
{
|
||||
m_isActive = TRUE;
|
||||
m_dwcurFrame = 0;
|
||||
m_fLastFrameTime = 0.0f;
|
||||
|
||||
m_isLoop = FALSE;
|
||||
m_dwMaxFrame = 0;
|
||||
m_fFrameTime = 0.0f;
|
||||
m_dwStartFrame = 0;
|
||||
}
|
||||
CFrameController::~CFrameController()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,516 @@
|
||||
#include "StdAfx.h"
|
||||
#include "ParticleInstance.h"
|
||||
#include "ParticleProperty.h"
|
||||
|
||||
#include "../EterBase/Random.h"
|
||||
#include "../EterLib/Camera.h"
|
||||
#include "../EterLib/StateManager.h"
|
||||
|
||||
CDynamicPool<CParticleInstance> CParticleInstance::ms_kPool;
|
||||
|
||||
using namespace NEffectUpdateDecorator;
|
||||
|
||||
void CParticleInstance::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
CParticleInstance* CParticleInstance::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CParticleInstance::DeleteThis()
|
||||
{
|
||||
Destroy();
|
||||
|
||||
ms_kPool.Free(this);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//CDynamicPool<CRayParticleInstance> CRayParticleInstance::ms_kPool;
|
||||
|
||||
/*void CRayParticleInstance::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
CRayParticleInstance* CRayParticleInstance::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CRayParticleInstance::DeleteThis()
|
||||
{
|
||||
#ifdef RAY_TO_AFTERIMAGE
|
||||
m_PositionList.clear();
|
||||
#else
|
||||
m_bStart = false;
|
||||
#endif
|
||||
ms_kPool.Free(this);
|
||||
}
|
||||
*/
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
float CParticleInstance::GetRadiusApproximation()
|
||||
{
|
||||
return m_v2HalfSize.y*m_v2Scale.y + m_v2HalfSize.x*m_v2Scale.x;
|
||||
}
|
||||
/*
|
||||
D3DXVECTOR3 CBaseParticleInstance::GetCenterApproximation()
|
||||
{
|
||||
return D3DXVECTOR3(
|
||||
m_v3Position.x + mc_pmatLocal._41,
|
||||
m_v3Position.y + mc_pmatLocal._42,
|
||||
m_v3Position.z + mc_pmatLocal._43
|
||||
);
|
||||
}*/
|
||||
|
||||
|
||||
BOOL CParticleInstance::Update(float fElapsedTime, float fAngle)
|
||||
{
|
||||
m_fLastLifeTime -= fElapsedTime;
|
||||
if (m_fLastLifeTime < 0.0f)
|
||||
return FALSE;
|
||||
|
||||
float fLifePercentage = (m_fLifeTime - m_fLastLifeTime) / m_fLifeTime;
|
||||
|
||||
m_pDecorator->Excute(CDecoratorData(fLifePercentage,fElapsedTime,this));
|
||||
|
||||
m_v3LastPosition = m_v3Position;
|
||||
m_v3Position += m_v3Velocity * fElapsedTime;
|
||||
|
||||
if (fAngle)
|
||||
{
|
||||
if (m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
float fCos, fSin;
|
||||
fAngle = D3DXToRadian(fAngle);
|
||||
fCos = cos(fAngle);
|
||||
fSin = sin(fAngle);
|
||||
|
||||
float rx = m_v3Position.x - m_v3StartPosition.x;
|
||||
float ry = m_v3Position.y - m_v3StartPosition.y;
|
||||
|
||||
m_v3Position.x = fCos * rx + fSin * ry + m_v3StartPosition.x;
|
||||
m_v3Position.y = - fSin * rx + fCos * ry + m_v3StartPosition.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
D3DXQUATERNION q,qc;
|
||||
D3DXQuaternionRotationAxis(&q,&m_pParticleProperty->m_v3ZAxis,D3DXToRadian(fAngle));
|
||||
D3DXQuaternionConjugate(&qc,&q);
|
||||
|
||||
D3DXQUATERNION qr(
|
||||
m_v3Position.x-m_v3StartPosition.x,
|
||||
m_v3Position.y-m_v3StartPosition.y,
|
||||
m_v3Position.z-m_v3StartPosition.z,
|
||||
0.0f);
|
||||
D3DXQuaternionMultiply(&qr,&q,&qr);
|
||||
D3DXQuaternionMultiply(&qr,&qr,&qc);
|
||||
|
||||
m_v3Position.x = qr.x;
|
||||
m_v3Position.y = qr.y;
|
||||
m_v3Position.z = qr.z;
|
||||
|
||||
m_v3Position += m_v3StartPosition;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal)
|
||||
{
|
||||
#ifdef WORLD_EDITOR
|
||||
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color);
|
||||
#else
|
||||
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_dcColor);
|
||||
#endif
|
||||
|
||||
/////
|
||||
|
||||
D3DXVECTOR3 v3Up;
|
||||
D3DXVECTOR3 v3Cross;
|
||||
|
||||
if (!m_pParticleProperty->m_bStretchFlag)
|
||||
{
|
||||
CCamera * pCurrentCamera = CCameraManager::Instance().GetCurrentCamera();
|
||||
const D3DXVECTOR3 & c_rv3Up = pCurrentCamera->GetUp();
|
||||
const D3DXVECTOR3 & c_rv3Cross = pCurrentCamera->GetCross();
|
||||
|
||||
D3DXVECTOR3 v3Rotation;
|
||||
|
||||
switch(m_pParticleProperty->m_byBillboardType) {
|
||||
case BILLBOARD_TYPE_LIE:
|
||||
{
|
||||
float fCos = cosf(D3DXToRadian(m_fRotation)), fSin = sinf(D3DXToRadian(m_fRotation));
|
||||
v3Up.x = fCos;
|
||||
v3Up.y = -fSin;
|
||||
v3Up.z = 0;
|
||||
v3Cross.x = fSin;
|
||||
v3Cross.y = fCos;
|
||||
v3Cross.z = 0;
|
||||
}
|
||||
break;
|
||||
case BILLBOARD_TYPE_2FACE:
|
||||
case BILLBOARD_TYPE_3FACE:
|
||||
// using setting with y, and local rotation at render
|
||||
case BILLBOARD_TYPE_Y:
|
||||
{
|
||||
v3Up = D3DXVECTOR3(0.0f,0.0f,1.0f);
|
||||
//v3Up = D3DXVECTOR3(cosf(D3DXToRadian(m_fRotation)),0.0f,-sinf(D3DXToRadian(m_fRotation)));
|
||||
const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView();
|
||||
if (v3Up.x * c_rv3View.y - v3Up.y * c_rv3View.x<0)
|
||||
v3Up*=-1;
|
||||
auto d3dd = D3DXVECTOR3(c_rv3View.x, c_rv3View.y, 0);
|
||||
D3DXVec3Cross(&v3Cross, &v3Up, &d3dd);
|
||||
D3DXVec3Normalize(&v3Cross, &v3Cross);
|
||||
|
||||
if (m_fRotation)
|
||||
{
|
||||
float fCos = -sinf(D3DXToRadian(m_fRotation)); // + 90
|
||||
float fSin = cosf(D3DXToRadian(m_fRotation));
|
||||
|
||||
D3DXVECTOR3 v3Temp = v3Up * fCos - v3Cross * fSin;
|
||||
v3Cross = v3Cross * fCos + v3Up * fSin;
|
||||
v3Up = v3Temp;
|
||||
}
|
||||
|
||||
//D3DXVECTOR3 v3Rotation;
|
||||
//D3DXVec3Cross(&v3Rotation, &v3Up, &v3Cross);
|
||||
|
||||
}
|
||||
break;
|
||||
case BILLBOARD_TYPE_ALL:
|
||||
default:
|
||||
{
|
||||
// NOTE : Rotation Routine. Camera의 Up Vector와 Cross Vector 자체를 View Vector 기준으로
|
||||
// Rotation 시킨다.
|
||||
// FIXME : 반드시 최적화 할 것!
|
||||
if (m_fRotation==0.0f)
|
||||
{
|
||||
v3Up = -c_rv3Cross;
|
||||
v3Cross = c_rv3Up;
|
||||
}
|
||||
else
|
||||
{
|
||||
const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView();
|
||||
D3DXQUATERNION q,qc;
|
||||
D3DXQuaternionRotationAxis(&q, &c_rv3View, D3DXToRadian(m_fRotation));
|
||||
D3DXQuaternionConjugate(&qc, &q);
|
||||
|
||||
{
|
||||
D3DXQUATERNION qr(-c_rv3Cross.x, -c_rv3Cross.y, -c_rv3Cross.z, 0);
|
||||
D3DXQuaternionMultiply(&qr,&qc,&qr);
|
||||
D3DXQuaternionMultiply(&qr,&qr,&q);
|
||||
v3Up.x = qr.x;
|
||||
v3Up.y = qr.y;
|
||||
v3Up.z = qr.z;
|
||||
}
|
||||
{
|
||||
D3DXQUATERNION qr(c_rv3Up.x, c_rv3Up.y, c_rv3Up.z, 0);
|
||||
D3DXQuaternionMultiply(&qr,&qc,&qr);
|
||||
D3DXQuaternionMultiply(&qr,&qr,&q);
|
||||
v3Cross.x = qr.x;
|
||||
v3Cross.y = qr.y;
|
||||
v3Cross.z = qr.z;
|
||||
}
|
||||
|
||||
}
|
||||
//D3DXMATRIX matRotation;
|
||||
|
||||
//D3DXMatrixRotationAxis(&matRotation, &c_rv3View, D3DXToRadian(m_fRotation));
|
||||
|
||||
//D3DXVec3TransformCoord(&v3Up, &(-c_rv3Cross), &matRotation);
|
||||
//D3DXVec3TransformCoord(&v3Cross, &c_rv3Up, &matRotation);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
v3Up = m_v3Position - m_v3LastPosition;
|
||||
|
||||
if (c_matLocal)
|
||||
{
|
||||
//if (!m_pParticleProperty->m_bAttachFlag)
|
||||
D3DXVec3TransformNormal(&v3Up, &v3Up, c_matLocal);
|
||||
}
|
||||
|
||||
// NOTE: 속도가 길이에 주는 영향 : log(velocity)만큼 늘어난다.
|
||||
float length = D3DXVec3Length(&v3Up);
|
||||
if (length == 0.0f)
|
||||
{
|
||||
v3Up = D3DXVECTOR3(0.0f,0.0f,1.0f);
|
||||
}
|
||||
else
|
||||
v3Up *=(1+log(1+length))/length;
|
||||
|
||||
CCamera * pCurrentCamera = CCameraManager::Instance().GetCurrentCamera();
|
||||
const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView();
|
||||
D3DXVec3Cross(&v3Cross, &v3Up, &c_rv3View);
|
||||
D3DXVec3Normalize(&v3Cross, &v3Cross);
|
||||
|
||||
}
|
||||
|
||||
v3Cross = -(m_v2HalfSize.x*m_v2Scale.x) * v3Cross;
|
||||
v3Up = (m_v2HalfSize.y*m_v2Scale.y) * v3Up;
|
||||
|
||||
if (c_matLocal && m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
D3DXVECTOR3 v3Position;
|
||||
D3DXVec3TransformCoord(&v3Position, &m_v3Position, c_matLocal);
|
||||
m_ParticleMesh[0].position = v3Position - v3Up + v3Cross;
|
||||
m_ParticleMesh[1].position = v3Position - v3Up - v3Cross;
|
||||
m_ParticleMesh[2].position = v3Position + v3Up + v3Cross;
|
||||
m_ParticleMesh[3].position = v3Position + v3Up - v3Cross;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ParticleMesh[0].position = m_v3Position - v3Up + v3Cross;
|
||||
m_ParticleMesh[1].position = m_v3Position - v3Up - v3Cross;
|
||||
m_ParticleMesh[2].position = m_v3Position + v3Up + v3Cross;
|
||||
m_ParticleMesh[3].position = m_v3Position + v3Up - v3Cross;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal, const float c_fZRotation)
|
||||
{
|
||||
#ifdef WORLD_EDITOR
|
||||
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, m_Color);
|
||||
#else
|
||||
STATEMANAGER.SetRenderState(D3DRS_TEXTUREFACTOR, (DWORD)m_dcColor);
|
||||
#endif
|
||||
|
||||
/////
|
||||
|
||||
D3DXVECTOR3 v3Up;
|
||||
D3DXVECTOR3 v3Cross;
|
||||
|
||||
if (!m_pParticleProperty->m_bStretchFlag)
|
||||
{
|
||||
CCamera * pCurrentCamera = CCameraManager::Instance().GetCurrentCamera();
|
||||
const D3DXVECTOR3 & c_rv3Up = pCurrentCamera->GetUp();
|
||||
const D3DXVECTOR3 & c_rv3Cross = pCurrentCamera->GetCross();
|
||||
|
||||
D3DXVECTOR3 v3Rotation;
|
||||
|
||||
switch(m_pParticleProperty->m_byBillboardType) {
|
||||
case BILLBOARD_TYPE_LIE:
|
||||
{
|
||||
float fCos = cosf(D3DXToRadian(m_fRotation)), fSin = sinf(D3DXToRadian(m_fRotation));
|
||||
v3Up.x = fCos;
|
||||
v3Up.y = -fSin;
|
||||
v3Up.z = 0;
|
||||
|
||||
v3Cross.x = fSin;
|
||||
v3Cross.y = fCos;
|
||||
v3Cross.z = 0;
|
||||
}
|
||||
break;
|
||||
case BILLBOARD_TYPE_2FACE:
|
||||
case BILLBOARD_TYPE_3FACE:
|
||||
// using setting with y, and local rotation at render
|
||||
case BILLBOARD_TYPE_Y:
|
||||
{
|
||||
v3Up = D3DXVECTOR3(0.0f,0.0f,1.0f);
|
||||
//v3Up = D3DXVECTOR3(cosf(D3DXToRadian(m_fRotation)),0.0f,-sinf(D3DXToRadian(m_fRotation)));
|
||||
const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView();
|
||||
if (v3Up.x * c_rv3View.y - v3Up.y * c_rv3View.x<0)
|
||||
v3Up*=-1;
|
||||
auto d3dd = D3DXVECTOR3(c_rv3View.x, c_rv3View.y, 0);
|
||||
D3DXVec3Cross(&v3Cross, &v3Up, &d3dd);
|
||||
D3DXVec3Normalize(&v3Cross, &v3Cross);
|
||||
|
||||
if (m_fRotation)
|
||||
{
|
||||
float fCos = -sinf(D3DXToRadian(m_fRotation)); // + 90
|
||||
float fSin = cosf(D3DXToRadian(m_fRotation));
|
||||
|
||||
D3DXVECTOR3 v3Temp = v3Up * fCos - v3Cross * fSin;
|
||||
v3Cross = v3Cross * fCos + v3Up * fSin;
|
||||
v3Up = v3Temp;
|
||||
}
|
||||
|
||||
//D3DXVECTOR3 v3Rotation;
|
||||
//D3DXVec3Cross(&v3Rotation, &v3Up, &v3Cross);
|
||||
|
||||
}
|
||||
break;
|
||||
case BILLBOARD_TYPE_ALL:
|
||||
default:
|
||||
{
|
||||
// NOTE : Rotation Routine. Camera의 Up Vector와 Cross Vector 자체를 View Vector 기준으로
|
||||
// Rotation 시킨다.
|
||||
// FIXME : 반드시 최적화 할 것!
|
||||
if (m_fRotation==0.0f)
|
||||
{
|
||||
v3Up = -c_rv3Cross;
|
||||
v3Cross = c_rv3Up;
|
||||
}
|
||||
else
|
||||
{
|
||||
const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView();
|
||||
D3DXMATRIX matRotation;
|
||||
|
||||
D3DXMatrixRotationAxis(&matRotation, &c_rv3View, D3DXToRadian(m_fRotation));
|
||||
auto d3dd = (-c_rv3Cross);
|
||||
D3DXVec3TransformCoord(&v3Up, &d3dd, &matRotation);
|
||||
D3DXVec3TransformCoord(&v3Cross, &c_rv3Up, &matRotation);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
v3Up = m_v3Position - m_v3LastPosition;
|
||||
|
||||
if (c_matLocal)
|
||||
{
|
||||
//if (!m_pParticleProperty->m_bAttachFlag)
|
||||
D3DXVec3TransformNormal(&v3Up, &v3Up, c_matLocal);
|
||||
}
|
||||
|
||||
// NOTE: 속도가 길이에 주는 영향 : log(velocity)만큼 늘어난다.
|
||||
float length = D3DXVec3Length(&v3Up);
|
||||
if (length == 0.0f)
|
||||
{
|
||||
v3Up = D3DXVECTOR3(0.0f,0.0f,1.0f);
|
||||
}
|
||||
else
|
||||
v3Up *=(1+log(1+length))/length;
|
||||
//D3DXVec3Normalize(&v3Up,&v3Up);
|
||||
//v3Up *= 1+log(1+length);
|
||||
|
||||
CCamera * pCurrentCamera = CCameraManager::Instance().GetCurrentCamera();
|
||||
const D3DXVECTOR3 & c_rv3View = pCurrentCamera->GetView();
|
||||
D3DXVec3Cross(&v3Cross, &v3Up, &c_rv3View);
|
||||
D3DXVec3Normalize(&v3Cross, &v3Cross);
|
||||
|
||||
}
|
||||
|
||||
if (c_fZRotation)
|
||||
{
|
||||
float x, y;
|
||||
float fCos = cosf(c_fZRotation);
|
||||
float fSin = sinf(c_fZRotation);
|
||||
|
||||
x = v3Up.x;
|
||||
y = v3Up.y;
|
||||
v3Up.x = x * fCos - y * fSin;
|
||||
v3Up.y = y * fCos + x * fSin;
|
||||
|
||||
x = v3Cross.x;
|
||||
y = v3Cross.y;
|
||||
v3Cross.x = x * fCos - y * fSin;
|
||||
v3Cross.y = y * fCos + x * fSin;
|
||||
}
|
||||
|
||||
v3Cross = -(m_v2HalfSize.x*m_v2Scale.x) * v3Cross;
|
||||
v3Up = (m_v2HalfSize.y*m_v2Scale.y) * v3Up;
|
||||
|
||||
if (c_matLocal && m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
D3DXVECTOR3 v3Position;
|
||||
D3DXVec3TransformCoord(&v3Position, &m_v3Position, c_matLocal);
|
||||
m_ParticleMesh[0].position = v3Position - v3Up + v3Cross;
|
||||
m_ParticleMesh[1].position = v3Position - v3Up - v3Cross;
|
||||
m_ParticleMesh[2].position = v3Position + v3Up + v3Cross;
|
||||
m_ParticleMesh[3].position = v3Position + v3Up - v3Cross;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_ParticleMesh[0].position = m_v3Position - v3Up + v3Cross;
|
||||
m_ParticleMesh[1].position = m_v3Position - v3Up - v3Cross;
|
||||
m_ParticleMesh[2].position = m_v3Position + v3Up + v3Cross;
|
||||
m_ParticleMesh[3].position = m_v3Position + v3Up - v3Cross;
|
||||
}
|
||||
}
|
||||
|
||||
void CParticleInstance::Destroy()
|
||||
{
|
||||
if (m_pDecorator)
|
||||
m_pDecorator->DeleteThis();
|
||||
|
||||
__Initialize();
|
||||
|
||||
}
|
||||
|
||||
void CParticleInstance::__Initialize()
|
||||
{
|
||||
//*
|
||||
m_pDecorator=NULL;
|
||||
|
||||
m_v3Position = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
|
||||
m_v3LastPosition = m_v3Position;
|
||||
m_v3Velocity = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
|
||||
|
||||
m_v2Scale = D3DXVECTOR2(1.0f, 1.0f);
|
||||
#ifdef WORLD_EDITOR
|
||||
m_Color = D3DXCOLOR(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
#else
|
||||
m_dcColor.m_dwColor = 0xffffffff;
|
||||
#endif
|
||||
|
||||
m_byFrameIndex = 0;
|
||||
m_ParticleMesh[0].texCoord = D3DXVECTOR2(0.0f, 1.0f);
|
||||
m_ParticleMesh[1].texCoord = D3DXVECTOR2(0.0f, 0.0f);
|
||||
m_ParticleMesh[2].texCoord = D3DXVECTOR2(1.0f, 1.0f);
|
||||
m_ParticleMesh[3].texCoord = D3DXVECTOR2(1.0f, 0.0f);
|
||||
}
|
||||
|
||||
CParticleInstance::CParticleInstance()
|
||||
{
|
||||
__Initialize();
|
||||
}
|
||||
|
||||
CParticleInstance::~CParticleInstance()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
|
||||
/*CRayParticleInstance::CRayParticleInstance()
|
||||
{
|
||||
#ifdef RAY_TO_AFTERIMAGE
|
||||
int i;
|
||||
for(i=0;i<RAY_VERTEX_COUNT*2;i+=2)
|
||||
{
|
||||
m_ParticleMesh[i].texCoord = D3DXVECTOR2(i+0.0f, 1.0f);
|
||||
m_ParticleMesh[i+1].texCoord = D3DXVECTOR2(i+1.0f, 0.0f);
|
||||
}
|
||||
#else
|
||||
m_ParticleMesh[0].texCoord = D3DXVECTOR2(0.0f, 1.0f);
|
||||
m_ParticleMesh[1].texCoord = D3DXVECTOR2(0.0f, 0.0f);
|
||||
m_ParticleMesh[2].texCoord = D3DXVECTOR2(0.5f, 1.0f);
|
||||
m_ParticleMesh[3].texCoord = D3DXVECTOR2(0.5f, 0.0f);
|
||||
m_ParticleMesh[4].texCoord = D3DXVECTOR2(1.0f, 1.0f);
|
||||
m_ParticleMesh[5].texCoord = D3DXVECTOR2(1.0f, 0.0f);
|
||||
|
||||
m_bStart = false;
|
||||
#endif
|
||||
}
|
||||
|
||||
CRayParticleInstance::~CRayParticleInstance()
|
||||
{
|
||||
}*/
|
||||
|
||||
|
||||
TPTVertex * CParticleInstance::GetParticleMeshPointer()
|
||||
{
|
||||
return m_ParticleMesh;
|
||||
}
|
||||
|
||||
/*TPTVertex * CRayParticleInstance::GetParticleMeshPointer()
|
||||
{
|
||||
return m_ParticleMesh;
|
||||
}
|
||||
|
||||
void CRayParticleInstance::Transform(const D3DXMATRIX * c_matLocal, const float c_fZRotation)
|
||||
{
|
||||
assert(false && "NOT_REACHED");
|
||||
}*/
|
||||
@@ -0,0 +1,121 @@
|
||||
#include "StdAfx.h"
|
||||
#include "ParticleProperty.h"
|
||||
#include "../EterLib/ResourceManager.h"
|
||||
|
||||
void CParticleProperty::InsertTexture(const char * c_szFileName)
|
||||
{
|
||||
CGraphicImage * pImage = (CGraphicImage *)CResourceManager::Instance().GetResourcePointer(c_szFileName);
|
||||
|
||||
m_ImageVector.push_back(pImage);
|
||||
#ifdef WORLD_EDITOR
|
||||
m_TextureNameVector.push_back(c_szFileName);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool CParticleProperty::SetTexture(const char * c_szFileName)
|
||||
{
|
||||
if (m_ImageVector.size() > 1)
|
||||
{
|
||||
assert(false);
|
||||
return false;
|
||||
}
|
||||
m_ImageVector.clear();
|
||||
#ifdef WORLD_EDITOR
|
||||
m_TextureNameVector.clear();
|
||||
#endif
|
||||
InsertTexture(c_szFileName);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CParticleProperty::Clear()
|
||||
{
|
||||
m_byRotationType = 0;
|
||||
m_fRotationSpeed = 0.0f;
|
||||
m_wRotationRandomStartingBegin = 0;
|
||||
m_wRotationRandomStartingEnd = 0;
|
||||
|
||||
m_bAttachFlag = FALSE;
|
||||
m_bStretchFlag = FALSE;
|
||||
|
||||
m_bySrcBlendType = D3DBLEND_SRCALPHA;
|
||||
m_byDestBlendType = D3DBLEND_ONE;
|
||||
m_byColorOperationType = D3DTOP_MODULATE;
|
||||
|
||||
m_byBillboardType = BILLBOARD_TYPE_NONE;
|
||||
|
||||
m_byTexAniType = TEXTURE_ANIMATION_TYPE_NONE;
|
||||
m_fTexAniDelay = 0.05f;
|
||||
m_bTexAniRandomStartFrameFlag = FALSE;
|
||||
|
||||
//m_fGravity = 0.0f;
|
||||
//m_fAirResistance = 0.0f;
|
||||
|
||||
m_TimeEventGravity.clear();
|
||||
m_TimeEventAirResistance.clear();
|
||||
|
||||
m_TimeEventScaleX.clear();
|
||||
m_TimeEventScaleY.clear();
|
||||
//m_TimeEventScaleXY.clear();
|
||||
#ifdef WORLD_EDITOR
|
||||
m_TimeEventColorRed.clear();
|
||||
m_TimeEventColorGreen.clear();
|
||||
m_TimeEventColorBlue.clear();
|
||||
m_TimeEventAlpha.clear();
|
||||
m_TextureNameVector.clear();
|
||||
#else
|
||||
m_TimeEventColor.clear();
|
||||
#endif
|
||||
m_TimeEventRotation.clear();
|
||||
|
||||
m_ImageVector.clear();
|
||||
}
|
||||
|
||||
CParticleProperty::CParticleProperty()
|
||||
{
|
||||
}
|
||||
CParticleProperty::~CParticleProperty()
|
||||
{
|
||||
}
|
||||
|
||||
CParticleProperty & CParticleProperty::operator = ( const CParticleProperty& c_ParticleProperty )
|
||||
{
|
||||
m_byTexAniType = c_ParticleProperty.m_byTexAniType;
|
||||
m_fTexAniDelay = c_ParticleProperty.m_fTexAniDelay;
|
||||
m_bTexAniRandomStartFrameFlag = c_ParticleProperty.m_bTexAniRandomStartFrameFlag;
|
||||
|
||||
m_bySrcBlendType = c_ParticleProperty.m_bySrcBlendType;
|
||||
m_byDestBlendType = c_ParticleProperty.m_byDestBlendType;
|
||||
m_byColorOperationType = c_ParticleProperty.m_byColorOperationType;
|
||||
|
||||
m_byBillboardType = c_ParticleProperty.m_byBillboardType;
|
||||
|
||||
m_byRotationType = c_ParticleProperty.m_byRotationType;
|
||||
m_fRotationSpeed = c_ParticleProperty.m_fRotationSpeed;
|
||||
m_wRotationRandomStartingBegin = c_ParticleProperty.m_wRotationRandomStartingBegin;
|
||||
m_wRotationRandomStartingEnd = c_ParticleProperty.m_wRotationRandomStartingEnd;
|
||||
|
||||
m_bAttachFlag = c_ParticleProperty.m_bAttachFlag;
|
||||
m_bStretchFlag = c_ParticleProperty.m_bStretchFlag;
|
||||
|
||||
m_TimeEventGravity = c_ParticleProperty.m_TimeEventGravity;
|
||||
m_TimeEventAirResistance = c_ParticleProperty.m_TimeEventAirResistance;
|
||||
|
||||
m_TimeEventScaleX = c_ParticleProperty.m_TimeEventScaleX;
|
||||
m_TimeEventScaleY = c_ParticleProperty.m_TimeEventScaleY;
|
||||
|
||||
#ifdef WORLD_EDITOR
|
||||
m_TimeEventColorRed = c_ParticleProperty.m_TimeEventColorRed;
|
||||
m_TimeEventColorGreen = c_ParticleProperty.m_TimeEventColorGreen;
|
||||
m_TimeEventColorBlue = c_ParticleProperty.m_TimeEventColorBlue;
|
||||
m_TimeEventAlpha = c_ParticleProperty.m_TimeEventAlpha;
|
||||
|
||||
m_TextureNameVector = c_ParticleProperty.m_TextureNameVector;
|
||||
#else
|
||||
m_TimeEventColor = c_ParticleProperty.m_TimeEventColor;
|
||||
#endif
|
||||
m_TimeEventRotation = c_ParticleProperty.m_TimeEventRotation;
|
||||
|
||||
m_ImageVector = c_ParticleProperty.m_ImageVector;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
#include "StdAfx.h"
|
||||
#include "ParticleSystemData.h"
|
||||
#include "EffectUpdateDecorator.h"
|
||||
#include "ParticleInstance.h"
|
||||
|
||||
CDynamicPool<CParticleSystemData> CParticleSystemData::ms_kPool;
|
||||
|
||||
void CParticleSystemData::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
CParticleSystemData* CParticleSystemData::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CParticleSystemData::Delete(CParticleSystemData* pkData)
|
||||
{
|
||||
pkData->Clear();
|
||||
ms_kPool.Free(pkData);
|
||||
}
|
||||
|
||||
CEmitterProperty * CParticleSystemData::GetEmitterPropertyPointer()
|
||||
{
|
||||
return &m_EmitterProperty;
|
||||
}
|
||||
CParticleProperty * CParticleSystemData::GetParticlePropertyPointer()
|
||||
{
|
||||
return &m_ParticleProperty;
|
||||
}
|
||||
|
||||
BOOL CParticleSystemData::OnLoadScript(CTextFileLoader & rTextFileLoader)
|
||||
{
|
||||
{
|
||||
CTextFileLoader::CGotoChild GotoChild(&rTextFileLoader, "emitterproperty");
|
||||
|
||||
if (!rTextFileLoader.GetTokenDoubleWord("maxemissioncount", &m_EmitterProperty.m_dwMaxEmissionCount))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenFloat("cyclelength", &m_EmitterProperty.m_fCycleLength))
|
||||
{
|
||||
m_EmitterProperty.m_fCycleLength = 0.05f;
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenBoolean("cycleloopenable", &m_EmitterProperty.m_bCycleLoopFlag))
|
||||
{
|
||||
m_EmitterProperty.m_bCycleLoopFlag = FALSE;
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenInteger("loopcount",&m_EmitterProperty.m_iLoopCount))
|
||||
{
|
||||
m_EmitterProperty.m_iLoopCount = 0;
|
||||
}
|
||||
|
||||
if (!rTextFileLoader.GetTokenByte("emittershape", &m_EmitterProperty.m_byEmitterShape))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenByte("emitteradvancedtype", &m_EmitterProperty.m_byEmitterAdvancedType))
|
||||
{
|
||||
m_EmitterProperty.m_byEmitterShape = CEmitterProperty::EMITTER_ADVANCED_TYPE_FREE;
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenPosition("emittingsize", &m_EmitterProperty.m_v3EmittingSize))
|
||||
{
|
||||
m_EmitterProperty.m_v3EmittingSize = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenFloat("emittingradius", &m_EmitterProperty.m_fEmittingRadius))
|
||||
{
|
||||
m_EmitterProperty.m_fEmittingRadius = 0.0f;
|
||||
}
|
||||
|
||||
if (!rTextFileLoader.GetTokenBoolean("emitteremitfromedgeflag", &m_EmitterProperty.m_bEmitFromEdgeFlag))
|
||||
{
|
||||
m_EmitterProperty.m_bEmitFromEdgeFlag = FALSE;
|
||||
}
|
||||
|
||||
if (!rTextFileLoader.GetTokenPosition("emittingdirection", &m_EmitterProperty.m_v3EmittingDirection))
|
||||
{
|
||||
m_EmitterProperty.m_v3EmittingDirection = D3DXVECTOR3(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingsize", &m_EmitterProperty.m_TimeEventEmittingSize))
|
||||
{
|
||||
m_EmitterProperty.m_TimeEventEmittingSize.clear();
|
||||
TTimeEventTypeFloat TimeEventFloat;
|
||||
TimeEventFloat.m_fTime = 0.0f;
|
||||
TimeEventFloat.m_Value = 0.0f;
|
||||
m_EmitterProperty.m_TimeEventEmittingSize.push_back(TimeEventFloat);
|
||||
}
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingangularvelocity", &m_EmitterProperty.m_TimeEventEmittingAngularVelocity))
|
||||
{
|
||||
m_EmitterProperty.m_TimeEventEmittingAngularVelocity.clear();
|
||||
TTimeEventTypeFloat TimeEventFloat;
|
||||
TimeEventFloat.m_fTime = 0.0f;
|
||||
TimeEventFloat.m_Value = 0.0f;
|
||||
m_EmitterProperty.m_TimeEventEmittingAngularVelocity.push_back(TimeEventFloat);
|
||||
}
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingdirectionx", &m_EmitterProperty.m_TimeEventEmittingDirectionX))
|
||||
{
|
||||
m_EmitterProperty.m_TimeEventEmittingDirectionX.clear();
|
||||
TTimeEventTypeFloat TimeEventFloat;
|
||||
TimeEventFloat.m_fTime = 0.0f;
|
||||
TimeEventFloat.m_Value = 0.0f;
|
||||
m_EmitterProperty.m_TimeEventEmittingDirectionX.push_back(TimeEventFloat);
|
||||
}
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingdirectiony", &m_EmitterProperty.m_TimeEventEmittingDirectionY))
|
||||
{
|
||||
m_EmitterProperty.m_TimeEventEmittingDirectionY.clear();
|
||||
TTimeEventTypeFloat TimeEventFloat;
|
||||
TimeEventFloat.m_fTime = 0.0f;
|
||||
TimeEventFloat.m_Value = 0.0f;
|
||||
m_EmitterProperty.m_TimeEventEmittingDirectionY.push_back(TimeEventFloat);
|
||||
}
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingdirectionz", &m_EmitterProperty.m_TimeEventEmittingDirectionZ))
|
||||
{
|
||||
m_EmitterProperty.m_TimeEventEmittingDirectionZ.clear();
|
||||
TTimeEventTypeFloat TimeEventFloat;
|
||||
TimeEventFloat.m_fTime = 0.0f;
|
||||
TimeEventFloat.m_Value = 0.0f;
|
||||
m_EmitterProperty.m_TimeEventEmittingDirectionZ.push_back(TimeEventFloat);
|
||||
}
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemittingvelocity", &m_EmitterProperty.m_TimeEventEmittingVelocity))
|
||||
{
|
||||
m_EmitterProperty.m_TimeEventEmittingVelocity.clear();
|
||||
TTimeEventTypeFloat TimeEventFloat;
|
||||
TimeEventFloat.m_fTime = 0.0f;
|
||||
TimeEventFloat.m_Value = 0.0f;
|
||||
m_EmitterProperty.m_TimeEventEmittingVelocity.push_back(TimeEventFloat);
|
||||
}
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventemissioncountpersecond", &m_EmitterProperty.m_TimeEventEmissionCountPerSecond))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventlifetime", &m_EmitterProperty.m_TimeEventLifeTime))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventsizex", &m_EmitterProperty.m_TimeEventSizeX))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventsizey", &m_EmitterProperty.m_TimeEventSizeY))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
{
|
||||
CTextFileLoader::CGotoChild GotoChild(&rTextFileLoader, "particleproperty");
|
||||
|
||||
if (!rTextFileLoader.GetTokenByte("srcblendtype", &m_ParticleProperty.m_bySrcBlendType))
|
||||
{
|
||||
m_ParticleProperty.m_bySrcBlendType = D3DBLEND_SRCALPHA;
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenByte("destblendtype", &m_ParticleProperty.m_byDestBlendType))
|
||||
{
|
||||
m_ParticleProperty.m_byDestBlendType = D3DBLEND_ONE;
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenByte("coloroperationtype", &m_ParticleProperty.m_byColorOperationType))
|
||||
{
|
||||
m_ParticleProperty.m_byColorOperationType = D3DTOP_MODULATE;
|
||||
}
|
||||
|
||||
if (!rTextFileLoader.GetTokenByte("billboardtype", &m_ParticleProperty.m_byBillboardType))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenByte("rotationtype", &m_ParticleProperty.m_byRotationType))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenFloat("rotationspeed", &m_ParticleProperty.m_fRotationSpeed))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenWord("rotationrandomstartingbegin", &m_ParticleProperty.m_wRotationRandomStartingBegin))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenWord("rotationrandomstartingend", &m_ParticleProperty.m_wRotationRandomStartingEnd))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenBoolean("attachenable", &m_ParticleProperty.m_bAttachFlag))
|
||||
{
|
||||
m_ParticleProperty.m_bAttachFlag = FALSE;
|
||||
}
|
||||
if (!rTextFileLoader.GetTokenBoolean("stretchenable", &m_ParticleProperty.m_bStretchFlag))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenByte("texanitype", &m_ParticleProperty.m_byTexAniType))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenFloat("texanidelay", &m_ParticleProperty.m_fTexAniDelay))
|
||||
return FALSE;
|
||||
if (!rTextFileLoader.GetTokenBoolean("texanirandomstartframeenable", &m_ParticleProperty.m_bTexAniRandomStartFrameFlag))
|
||||
return FALSE;
|
||||
|
||||
float fGravity;
|
||||
|
||||
if (rTextFileLoader.GetTokenFloat("gravity", &fGravity))
|
||||
{
|
||||
TTimeEventTypeFloat f;
|
||||
f.m_fTime = 0.0f;
|
||||
f.m_Value = fGravity;
|
||||
m_ParticleProperty.m_TimeEventGravity.push_back(f);
|
||||
}
|
||||
else if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventgravity", &m_ParticleProperty.m_TimeEventGravity))
|
||||
{
|
||||
m_ParticleProperty.m_TimeEventGravity.clear();
|
||||
}
|
||||
|
||||
float fAirResistance;
|
||||
if (rTextFileLoader.GetTokenFloat("airresistance", &fAirResistance))
|
||||
{
|
||||
TTimeEventTypeFloat f;
|
||||
f.m_fTime = 0.0f;
|
||||
f.m_Value = fAirResistance;
|
||||
m_ParticleProperty.m_TimeEventAirResistance.push_back(f);
|
||||
}
|
||||
else if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventairresistance", &m_ParticleProperty.m_TimeEventAirResistance))
|
||||
{
|
||||
m_ParticleProperty.m_TimeEventAirResistance.clear();
|
||||
}
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventscalex", &m_ParticleProperty.m_TimeEventScaleX))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventscaley", &m_ParticleProperty.m_TimeEventScaleY))
|
||||
return FALSE;
|
||||
|
||||
#ifdef WORLD_EDITOR
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorred", &m_ParticleProperty.m_TimeEventColorRed))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorgreen", &m_ParticleProperty.m_TimeEventColorGreen))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorblue", &m_ParticleProperty.m_TimeEventColorBlue))
|
||||
return FALSE;
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventalpha", &m_ParticleProperty.m_TimeEventAlpha))
|
||||
return FALSE;
|
||||
#else
|
||||
TTimeEventTableFloat TimeEventR;
|
||||
TTimeEventTableFloat TimeEventB;
|
||||
TTimeEventTableFloat TimeEventG;
|
||||
TTimeEventTableFloat TimeEventA;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorred", &TimeEventR))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorgreen", &TimeEventG))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventcolorblue", &TimeEventB))
|
||||
return FALSE;
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventalpha", &TimeEventA))
|
||||
return FALSE;
|
||||
|
||||
m_ParticleProperty.m_TimeEventColor.clear();
|
||||
{
|
||||
std::set<float> times;
|
||||
int i;
|
||||
for(i=0;i<TimeEventR.size();i++)
|
||||
times.insert(TimeEventR[i].m_fTime);
|
||||
for(i=0;i<TimeEventG.size();i++)
|
||||
times.insert(TimeEventG[i].m_fTime);
|
||||
for(i=0;i<TimeEventB.size();i++)
|
||||
times.insert(TimeEventB[i].m_fTime);
|
||||
for(i=0;i<TimeEventA.size();i++)
|
||||
times.insert(TimeEventA[i].m_fTime);
|
||||
std::set<float>::iterator it;
|
||||
for(it = times.begin(); it != times.end(); ++it)
|
||||
{
|
||||
float fTime = *it;
|
||||
float fR, fG, fB, fA;
|
||||
GetTimeEventBlendValue<float>(fTime, TimeEventR, &fR);
|
||||
GetTimeEventBlendValue<float>(fTime, TimeEventG, &fG);
|
||||
GetTimeEventBlendValue<float>(fTime, TimeEventB, &fB);
|
||||
GetTimeEventBlendValue<float>(fTime, TimeEventA, &fA);
|
||||
TTimeEventTypeColor t;
|
||||
t.m_fTime = fTime;
|
||||
D3DXCOLOR c;
|
||||
c.r = fR;
|
||||
c.g = fG;
|
||||
c.b = fB;
|
||||
c.a = fA;
|
||||
t.m_Value.m_dwColor = /*(DWORD)*/ (DWORD)c;
|
||||
m_ParticleProperty.m_TimeEventColor.push_back(t);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventrotation", &m_ParticleProperty.m_TimeEventRotation))
|
||||
return FALSE;
|
||||
|
||||
CTokenVector * pTextureVector;
|
||||
|
||||
if (!rTextFileLoader.GetTokenVector("texturefiles", &pTextureVector))
|
||||
return FALSE;
|
||||
|
||||
for (DWORD i = 0; i < pTextureVector->size(); ++i)
|
||||
{
|
||||
std::string strTextureFileName = pTextureVector->at(i).c_str();
|
||||
|
||||
if (!IsGlobalFileName(strTextureFileName.c_str()))
|
||||
strTextureFileName = GetOnlyPathName(rTextFileLoader.GetFileName()) + strTextureFileName;
|
||||
|
||||
m_ParticleProperty.InsertTexture(strTextureFileName.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CParticleSystemData::ChangeTexture(const char * c_szFileName)
|
||||
{
|
||||
m_ParticleProperty.SetTexture(c_szFileName);
|
||||
}
|
||||
|
||||
void CParticleSystemData::OnClear()
|
||||
{
|
||||
m_EmitterProperty.Clear();
|
||||
m_ParticleProperty.Clear();
|
||||
}
|
||||
|
||||
bool CParticleSystemData::OnIsData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
void CParticleSystemData::BuildDecorator(CParticleInstance * pInstance)
|
||||
{
|
||||
using namespace NEffectUpdateDecorator;
|
||||
|
||||
pInstance->m_pDecorator = new CNullDecorator;
|
||||
|
||||
//////
|
||||
|
||||
if (m_ParticleProperty.m_TimeEventAirResistance.size()>1)
|
||||
{
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(new CAirResistanceDecorator);
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(
|
||||
new CAirResistanceValueDecorator(m_ParticleProperty.m_TimeEventAirResistance, &pInstance->m_fAirResistance)
|
||||
);
|
||||
}
|
||||
else if (m_ParticleProperty.m_TimeEventAirResistance.size()==1)
|
||||
{
|
||||
pInstance->m_fAirResistance = m_ParticleProperty.m_TimeEventAirResistance[0].m_Value;
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(new CAirResistanceDecorator);
|
||||
}
|
||||
|
||||
if (m_ParticleProperty.m_TimeEventGravity.size() > 1)
|
||||
{
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(new CGravityDecorator);
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(
|
||||
new CGravityValueDecorator(m_ParticleProperty.m_TimeEventGravity, &pInstance->m_fGravity)
|
||||
);
|
||||
}
|
||||
else if (m_ParticleProperty.m_TimeEventGravity.size() == 1)
|
||||
{
|
||||
pInstance->m_fGravity = m_ParticleProperty.m_TimeEventGravity[0].m_Value;
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(new CGravityDecorator);
|
||||
}
|
||||
#ifdef WORLD_EDITOR
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(
|
||||
new CColorValueDecorator(m_ParticleProperty.m_TimeEventColorRed, &pInstance->m_Color.r));
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(
|
||||
new CColorValueDecorator(m_ParticleProperty.m_TimeEventColorGreen, &pInstance->m_Color.g));
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(
|
||||
new CColorValueDecorator(m_ParticleProperty.m_TimeEventColorBlue, &pInstance->m_Color.b));
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(
|
||||
new CColorValueDecorator(m_ParticleProperty.m_TimeEventAlpha, &pInstance->m_Color.a));
|
||||
#else
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(
|
||||
new CColorAllDecorator(m_ParticleProperty.m_TimeEventColor, &pInstance->m_dcColor));
|
||||
#endif
|
||||
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(
|
||||
new CScaleValueDecorator(m_ParticleProperty.m_TimeEventScaleX, &pInstance->m_v2Scale.x));
|
||||
pInstance->m_pDecorator = pInstance->m_pDecorator->AddChainFront(
|
||||
new CScaleValueDecorator(m_ParticleProperty.m_TimeEventScaleY, &pInstance->m_v2Scale.y));
|
||||
|
||||
if (m_ParticleProperty.GetTextureAnimationFrameCount()>1 &&m_ParticleProperty.GetTextureAnimationFrameDelay()>1e-6)
|
||||
{
|
||||
switch (pInstance->m_byTextureAnimationType)
|
||||
{
|
||||
case CParticleProperty::TEXTURE_ANIMATION_TYPE_CW:
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(
|
||||
new CTextureAnimationCWDecorator(m_ParticleProperty.GetTextureAnimationFrameDelay(), m_ParticleProperty.GetTextureAnimationFrameCount(), &pInstance->m_byFrameIndex));
|
||||
break;
|
||||
case CParticleProperty::TEXTURE_ANIMATION_TYPE_CCW:
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(
|
||||
new CTextureAnimationCCWDecorator(m_ParticleProperty.GetTextureAnimationFrameDelay(), m_ParticleProperty.GetTextureAnimationFrameCount(), &pInstance->m_byFrameIndex));
|
||||
break;
|
||||
case CParticleProperty::TEXTURE_ANIMATION_TYPE_RANDOM_FRAME:
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(
|
||||
new CTextureAnimationRandomDecorator(m_ParticleProperty.GetTextureAnimationFrameDelay(), m_ParticleProperty.GetTextureAnimationFrameCount(), &pInstance->m_byFrameIndex));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
BYTE byRotationType = m_ParticleProperty.m_byRotationType;
|
||||
|
||||
if (m_ParticleProperty.m_fRotationSpeed==0.0f && byRotationType!=CParticleProperty::ROTATION_TYPE_TIME_EVENT)
|
||||
{
|
||||
byRotationType = CParticleProperty::ROTATION_TYPE_NONE;
|
||||
}
|
||||
else if (byRotationType==CParticleProperty::ROTATION_TYPE_RANDOM_DIRECTION)
|
||||
{
|
||||
byRotationType = (random()&1)?CParticleProperty::ROTATION_TYPE_CW:CParticleProperty::ROTATION_TYPE_CCW;
|
||||
}
|
||||
|
||||
switch(byRotationType)
|
||||
{
|
||||
case CParticleProperty::ROTATION_TYPE_TIME_EVENT:
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(
|
||||
new CRotationDecorator());
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(
|
||||
new CRotationSpeedValueDecorator(m_ParticleProperty.m_TimeEventRotation,&pInstance->m_fRotationSpeed));
|
||||
break;
|
||||
|
||||
case CParticleProperty::ROTATION_TYPE_CW:
|
||||
pInstance->m_fRotationSpeed = m_ParticleProperty.m_fRotationSpeed;
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(
|
||||
new CRotationDecorator());
|
||||
break;
|
||||
|
||||
case CParticleProperty::ROTATION_TYPE_CCW:
|
||||
pInstance->m_fRotationSpeed = - m_ParticleProperty.m_fRotationSpeed;
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(
|
||||
new CRotationDecorator());
|
||||
break;
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
pInstance->m_pDecorator=pInstance->m_pDecorator->AddChainFront(new CHeaderDecorator);
|
||||
}
|
||||
|
||||
CParticleSystemData::CParticleSystemData()
|
||||
{
|
||||
}
|
||||
CParticleSystemData::~CParticleSystemData()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,528 @@
|
||||
#include "StdAfx.h"
|
||||
#include "../EterBase/Random.h"
|
||||
#include "../EterLib/StateManager.h"
|
||||
#include "ParticleSystemData.h"
|
||||
#include "ParticleSystemInstance.h"
|
||||
#include "ParticleInstance.h"
|
||||
|
||||
CDynamicPool<CParticleSystemInstance> CParticleSystemInstance::ms_kPool;
|
||||
|
||||
using namespace NEffectUpdateDecorator;
|
||||
|
||||
void CParticleSystemInstance::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
|
||||
CParticleInstance::DestroySystem();
|
||||
//CRayParticleInstance::DestroySystem();
|
||||
}
|
||||
|
||||
CParticleSystemInstance* CParticleSystemInstance::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CParticleSystemInstance::Delete(CParticleSystemInstance* pkPSInst)
|
||||
{
|
||||
pkPSInst->Destroy();
|
||||
ms_kPool.Free(pkPSInst);
|
||||
}
|
||||
|
||||
|
||||
|
||||
DWORD CParticleSystemInstance::GetEmissionCount()
|
||||
{
|
||||
return m_dwCurrentEmissionCount;
|
||||
}
|
||||
|
||||
void CParticleSystemInstance::CreateParticles(float fElapsedTime)
|
||||
{
|
||||
float fEmissionCount;
|
||||
m_pEmitterProperty->GetEmissionCountPerSecond(m_fLocalTime, &fEmissionCount);
|
||||
|
||||
float fCreatingValue = fEmissionCount * (fElapsedTime / 1.0f) + m_fEmissionResidue;
|
||||
int iCreatingCount = int(fCreatingValue);
|
||||
m_fEmissionResidue = fCreatingValue - iCreatingCount;
|
||||
|
||||
int icurEmissionCount = GetEmissionCount();
|
||||
int iMaxEmissionCount = int(m_pEmitterProperty->GetMaxEmissionCount());
|
||||
int iNextEmissionCount = int(icurEmissionCount + iCreatingCount);
|
||||
iCreatingCount -= max(0, iNextEmissionCount - iMaxEmissionCount);
|
||||
|
||||
float fLifeTime = 0.0f;
|
||||
float fEmittingSize = 0.0f;
|
||||
D3DXVECTOR3 _v3TimePosition;
|
||||
D3DXVECTOR3 _v3Velocity;
|
||||
float fVelocity = 0.0f;
|
||||
D3DXVECTOR2 v2HalfSize;
|
||||
float fLieRotation = 0;
|
||||
if (iCreatingCount)
|
||||
{
|
||||
m_pEmitterProperty->GetParticleLifeTime(m_fLocalTime, &fLifeTime);
|
||||
if (fLifeTime==0.0f)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
m_pEmitterProperty->GetEmittingSize(m_fLocalTime, &fEmittingSize);
|
||||
|
||||
m_pData->GetPosition(m_fLocalTime, _v3TimePosition);
|
||||
|
||||
m_pEmitterProperty->GetEmittingDirectionX(m_fLocalTime, &_v3Velocity.x);
|
||||
m_pEmitterProperty->GetEmittingDirectionY(m_fLocalTime, &_v3Velocity.y);
|
||||
m_pEmitterProperty->GetEmittingDirectionZ(m_fLocalTime, &_v3Velocity.z);
|
||||
|
||||
m_pEmitterProperty->GetEmittingVelocity(m_fLocalTime, &fVelocity);
|
||||
|
||||
m_pEmitterProperty->GetParticleSizeX(m_fLocalTime, &v2HalfSize.x);
|
||||
m_pEmitterProperty->GetParticleSizeY(m_fLocalTime, &v2HalfSize.y);
|
||||
|
||||
if (BILLBOARD_TYPE_LIE == m_pParticleProperty->m_byBillboardType && mc_pmatLocal)
|
||||
{
|
||||
float fsx = mc_pmatLocal->_32;
|
||||
float fcx = sqrtf(1.0f - fsx * fsx);
|
||||
|
||||
if (fcx >= 0.00001f)
|
||||
fLieRotation = D3DXToDegree(atan2f(-mc_pmatLocal->_12, mc_pmatLocal->_22));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
CParticleInstance * pFirstInstance = 0;
|
||||
|
||||
for (int i = 0; i < iCreatingCount; ++i)
|
||||
{
|
||||
CParticleInstance * pInstance;
|
||||
|
||||
pInstance = CParticleInstance::New();
|
||||
pInstance->m_pParticleProperty = m_pParticleProperty;
|
||||
pInstance->m_pEmitterProperty = m_pEmitterProperty;
|
||||
|
||||
// LifeTime
|
||||
pInstance->m_fLifeTime = fLifeTime;
|
||||
pInstance->m_fLastLifeTime = fLifeTime;
|
||||
|
||||
// Position
|
||||
switch (m_pEmitterProperty->GetEmitterShape())
|
||||
{
|
||||
case CEmitterProperty::EMITTER_SHAPE_POINT:
|
||||
pInstance->m_v3Position.x = 0.0f;
|
||||
pInstance->m_v3Position.y = 0.0f;
|
||||
pInstance->m_v3Position.z = 0.0f;
|
||||
break;
|
||||
|
||||
case CEmitterProperty::EMITTER_SHAPE_ELLIPSE:
|
||||
pInstance->m_v3Position.x = frandom(-500.0f, 500.0f);
|
||||
pInstance->m_v3Position.y = frandom(-500.0f, 500.0f);
|
||||
pInstance->m_v3Position.z = 0.0f;
|
||||
D3DXVec3Normalize(&pInstance->m_v3Position, &pInstance->m_v3Position);
|
||||
|
||||
if (m_pEmitterProperty->isEmitFromEdge())
|
||||
{
|
||||
pInstance->m_v3Position *= (m_pEmitterProperty->m_fEmittingRadius + fEmittingSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
pInstance->m_v3Position *= (frandom(0.0f, m_pEmitterProperty->m_fEmittingRadius) + fEmittingSize);
|
||||
}
|
||||
break;
|
||||
|
||||
case CEmitterProperty::EMITTER_SHAPE_SQUARE:
|
||||
pInstance->m_v3Position.x = (frandom(-m_pEmitterProperty->m_v3EmittingSize.x/2.0f, m_pEmitterProperty->m_v3EmittingSize.x/2.0f) + fEmittingSize);
|
||||
pInstance->m_v3Position.y = (frandom(-m_pEmitterProperty->m_v3EmittingSize.y/2.0f, m_pEmitterProperty->m_v3EmittingSize.y/2.0f) + fEmittingSize);
|
||||
pInstance->m_v3Position.z = (frandom(-m_pEmitterProperty->m_v3EmittingSize.z/2.0f, m_pEmitterProperty->m_v3EmittingSize.z/2.0f) + fEmittingSize);
|
||||
break;
|
||||
|
||||
case CEmitterProperty::EMITTER_SHAPE_SPHERE:
|
||||
pInstance->m_v3Position.x = frandom(-500.0f, 500.0f);
|
||||
pInstance->m_v3Position.y = frandom(-500.0f, 500.0f);
|
||||
pInstance->m_v3Position.z = frandom(-500.0f, 500.0f);
|
||||
D3DXVec3Normalize(&pInstance->m_v3Position, &pInstance->m_v3Position);
|
||||
|
||||
if (m_pEmitterProperty->isEmitFromEdge())
|
||||
{
|
||||
pInstance->m_v3Position *= (m_pEmitterProperty->m_fEmittingRadius + fEmittingSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
pInstance->m_v3Position *= (frandom(0.0f, m_pEmitterProperty->m_fEmittingRadius) + fEmittingSize);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// Position
|
||||
D3DXVECTOR3 v3TimePosition=_v3TimePosition;
|
||||
|
||||
pInstance->m_v3Position += v3TimePosition;
|
||||
|
||||
if (mc_pmatLocal && !m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
D3DXVec3TransformCoord(&pInstance->m_v3Position,&pInstance->m_v3Position,mc_pmatLocal);
|
||||
D3DXVec3TransformCoord(&v3TimePosition, &v3TimePosition, mc_pmatLocal);
|
||||
}
|
||||
pInstance->m_v3StartPosition = v3TimePosition;
|
||||
// NOTE : Update를 호출하지 않고 Rendering 되기 때문에 length가 0이 되는 문제가 있다.
|
||||
// Velocity를 구한 후 그만큼 빼준 값으로 초기화 해주도록 바꿨음 - [levites]
|
||||
//pInstance->m_v3LastPosition = pInstance->m_v3Position;
|
||||
|
||||
// Direction & Velocity
|
||||
pInstance->m_v3Velocity.x = 0.0f;
|
||||
pInstance->m_v3Velocity.y = 0.0f;
|
||||
pInstance->m_v3Velocity.z = 0.0f;
|
||||
|
||||
if (CEmitterProperty::EMITTER_ADVANCED_TYPE_INNER == m_pEmitterProperty->GetEmitterAdvancedType())
|
||||
{
|
||||
auto d3dd = (pInstance->m_v3Position - v3TimePosition);
|
||||
D3DXVec3Normalize(&pInstance->m_v3Velocity, &d3dd);
|
||||
pInstance->m_v3Velocity *= -100.0f;
|
||||
}
|
||||
else if (CEmitterProperty::EMITTER_ADVANCED_TYPE_OUTER == m_pEmitterProperty->GetEmitterAdvancedType())
|
||||
{
|
||||
if (m_pEmitterProperty->GetEmitterShape() == CEmitterProperty::EMITTER_SHAPE_POINT)
|
||||
{
|
||||
pInstance->m_v3Velocity.x = frandom(-100.0f, 100.0f);
|
||||
pInstance->m_v3Velocity.y = frandom(-100.0f, 100.0f);
|
||||
pInstance->m_v3Velocity.z = frandom(-100.0f, 100.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto d3dd = (pInstance->m_v3Position - v3TimePosition);
|
||||
D3DXVec3Normalize(&pInstance->m_v3Velocity, &d3dd);
|
||||
pInstance->m_v3Velocity *= 100.0f;
|
||||
}
|
||||
}
|
||||
|
||||
D3DXVECTOR3 v3Velocity = _v3Velocity;
|
||||
if (mc_pmatLocal && !m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
D3DXVec3TransformNormal(&v3Velocity, &v3Velocity, mc_pmatLocal);
|
||||
}
|
||||
|
||||
pInstance->m_v3Velocity += v3Velocity;
|
||||
if (m_pEmitterProperty->m_v3EmittingDirection.x > 0.0f)
|
||||
pInstance->m_v3Velocity.x += frandom(-m_pEmitterProperty->m_v3EmittingDirection.x/2.0f, m_pEmitterProperty->m_v3EmittingDirection.x/2.0f) * 1000.0f;
|
||||
if (m_pEmitterProperty->m_v3EmittingDirection.y > 0.0f)
|
||||
pInstance->m_v3Velocity.y += frandom(-m_pEmitterProperty->m_v3EmittingDirection.y/2.0f, m_pEmitterProperty->m_v3EmittingDirection.y/2.0f) * 1000.0f;
|
||||
if (m_pEmitterProperty->m_v3EmittingDirection.z > 0.0f)
|
||||
pInstance->m_v3Velocity.z += frandom(-m_pEmitterProperty->m_v3EmittingDirection.z/2.0f, m_pEmitterProperty->m_v3EmittingDirection.z/2.0f) * 1000.0f;
|
||||
|
||||
pInstance->m_v3Velocity *= fVelocity;
|
||||
|
||||
// Size
|
||||
pInstance->m_v2HalfSize = v2HalfSize;
|
||||
|
||||
// Rotation
|
||||
pInstance->m_fRotation = m_pParticleProperty->m_wRotationRandomStartingBegin;
|
||||
pInstance->m_fRotation = frandom(m_pParticleProperty->m_wRotationRandomStartingBegin,m_pParticleProperty->m_wRotationRandomStartingEnd);
|
||||
// Rotation - Lie 일 경우 LocalMatrix 의 Rotation 값을 Random 에 적용한다.
|
||||
// 매번 할 필요는 없을듯. 어느 정도의 최적화가 필요. - [levites]
|
||||
if (BILLBOARD_TYPE_LIE == m_pParticleProperty->m_byBillboardType && mc_pmatLocal)
|
||||
{
|
||||
pInstance->m_fRotation += fLieRotation;
|
||||
}
|
||||
|
||||
// Texture Animation
|
||||
pInstance->m_byFrameIndex = 0;
|
||||
pInstance->m_byTextureAnimationType = m_pParticleProperty->GetTextureAnimationType();
|
||||
|
||||
if (m_pParticleProperty->GetTextureAnimationFrameCount() > 1)
|
||||
{
|
||||
if (CParticleProperty::TEXTURE_ANIMATION_TYPE_RANDOM_DIRECTION == m_pParticleProperty->GetTextureAnimationType())
|
||||
{
|
||||
if (random() & 1)
|
||||
{
|
||||
pInstance->m_byFrameIndex = 0;
|
||||
pInstance->m_byTextureAnimationType = CParticleProperty::TEXTURE_ANIMATION_TYPE_CW;
|
||||
}
|
||||
else
|
||||
{
|
||||
pInstance->m_byFrameIndex = m_pParticleProperty->GetTextureAnimationFrameCount() - 1;
|
||||
pInstance->m_byTextureAnimationType = CParticleProperty::TEXTURE_ANIMATION_TYPE_CCW;
|
||||
}
|
||||
}
|
||||
if (m_pParticleProperty->m_bTexAniRandomStartFrameFlag)
|
||||
{
|
||||
pInstance->m_byFrameIndex = random_range(0,m_pParticleProperty->GetTextureAnimationFrameCount()-1);
|
||||
}
|
||||
}
|
||||
|
||||
// Simple Update
|
||||
{
|
||||
pInstance->m_v3LastPosition = pInstance->m_v3Position - (pInstance->m_v3Velocity * fElapsedTime);
|
||||
pInstance->m_v2Scale.x = m_pParticleProperty->m_TimeEventScaleX.front().m_Value;
|
||||
pInstance->m_v2Scale.y= m_pParticleProperty->m_TimeEventScaleY.front().m_Value;
|
||||
//pInstance->m_v2Scale = m_pParticleProperty->m_TimeEventScaleXY.front().m_Value;
|
||||
#ifdef WORLD_EDITOR
|
||||
pInstance->m_Color.r = m_pParticleProperty->m_TimeEventColorRed.front().m_Value;
|
||||
pInstance->m_Color.g = m_pParticleProperty->m_TimeEventColorGreen.front().m_Value;
|
||||
pInstance->m_Color.b = m_pParticleProperty->m_TimeEventColorBlue.front().m_Value;
|
||||
pInstance->m_Color.a = m_pParticleProperty->m_TimeEventAlpha.front().m_Value;
|
||||
#else
|
||||
pInstance->m_dcColor = m_pParticleProperty->m_TimeEventColor.front().m_Value;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!pFirstInstance)
|
||||
{
|
||||
m_pData->BuildDecorator(pInstance);
|
||||
pFirstInstance = pInstance;
|
||||
}
|
||||
else
|
||||
{
|
||||
pInstance->m_pDecorator = pFirstInstance->m_pDecorator->Clone(pFirstInstance,pInstance);
|
||||
}
|
||||
|
||||
m_ParticleInstanceListVector[pInstance->m_byFrameIndex].push_back(pInstance);
|
||||
m_dwCurrentEmissionCount++;
|
||||
}
|
||||
}
|
||||
|
||||
bool CParticleSystemInstance::OnUpdate(float fElapsedTime)
|
||||
{
|
||||
bool bMakeParticle = true;
|
||||
|
||||
/////
|
||||
|
||||
if (m_fLocalTime >= m_pEmitterProperty->GetCycleLength())
|
||||
{
|
||||
if (m_pEmitterProperty->isCycleLoop() && --m_iLoopCount!=0)
|
||||
{
|
||||
if (m_iLoopCount<0)
|
||||
m_iLoopCount = 0;
|
||||
m_fLocalTime = m_fLocalTime - m_pEmitterProperty->GetCycleLength();
|
||||
}
|
||||
else
|
||||
{
|
||||
bMakeParticle = false;
|
||||
m_iLoopCount=1;
|
||||
if (GetEmissionCount()==0)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/////
|
||||
|
||||
int dwFrameIndex;
|
||||
int dwFrameCount = m_pParticleProperty->GetTextureAnimationFrameCount();
|
||||
|
||||
float fAngularVelocity;
|
||||
m_pEmitterProperty->GetEmittingAngularVelocity(m_fLocalTime,&fAngularVelocity);
|
||||
|
||||
if (fAngularVelocity && !m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
auto d3dd = D3DXVECTOR3(0.0f, 0.0f, 1.0f);
|
||||
D3DXVec3TransformNormal(&m_pParticleProperty->m_v3ZAxis,&d3dd,mc_pmatLocal);
|
||||
}
|
||||
|
||||
for (dwFrameIndex = 0; dwFrameIndex < dwFrameCount; dwFrameIndex++)
|
||||
{
|
||||
TParticleInstanceList::iterator itor = m_ParticleInstanceListVector[dwFrameIndex].begin();
|
||||
for (; itor != m_ParticleInstanceListVector[dwFrameIndex].end();)
|
||||
{
|
||||
CParticleInstance * pInstance = *itor;
|
||||
|
||||
if (!pInstance->Update(fElapsedTime,fAngularVelocity))
|
||||
{
|
||||
pInstance->DeleteThis();
|
||||
|
||||
itor = m_ParticleInstanceListVector[dwFrameIndex].erase(itor);
|
||||
m_dwCurrentEmissionCount--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pInstance->m_byFrameIndex != dwFrameIndex)
|
||||
{
|
||||
m_ParticleInstanceListVector[dwFrameCount+pInstance->m_byFrameIndex].push_back(*itor);
|
||||
itor = m_ParticleInstanceListVector[dwFrameIndex].erase(itor);
|
||||
}
|
||||
else
|
||||
++itor;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isActive() && bMakeParticle)
|
||||
CreateParticles(fElapsedTime);
|
||||
|
||||
for (dwFrameIndex = 0; dwFrameIndex < dwFrameCount; ++dwFrameIndex)
|
||||
{
|
||||
m_ParticleInstanceListVector[dwFrameIndex].splice(m_ParticleInstanceListVector[dwFrameIndex].end(),m_ParticleInstanceListVector[dwFrameIndex+dwFrameCount]);
|
||||
m_ParticleInstanceListVector[dwFrameIndex+dwFrameCount].clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
namespace NParticleRenderer
|
||||
{
|
||||
struct TwoSideRenderer
|
||||
{
|
||||
const D3DXMATRIX * pmat;
|
||||
TwoSideRenderer(const D3DXMATRIX * pmat=NULL)
|
||||
: pmat(pmat)
|
||||
{
|
||||
}
|
||||
|
||||
inline void operator () (CParticleInstance * pInstance)
|
||||
{
|
||||
pInstance->Transform(pmat,D3DXToRadian(-30.0f));
|
||||
STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex));
|
||||
|
||||
pInstance->Transform(pmat,D3DXToRadian(+30.0f));
|
||||
STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex));
|
||||
}
|
||||
};
|
||||
|
||||
struct ThreeSideRenderer
|
||||
{
|
||||
const D3DXMATRIX * pmat;
|
||||
ThreeSideRenderer(const D3DXMATRIX * pmat=NULL)
|
||||
: pmat(pmat)
|
||||
{
|
||||
}
|
||||
|
||||
inline void operator () (CParticleInstance * pInstance)
|
||||
{
|
||||
pInstance->Transform(pmat);
|
||||
STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex));
|
||||
pInstance->Transform(pmat,D3DXToRadian(-60.0f));
|
||||
STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex));
|
||||
pInstance->Transform(pmat,D3DXToRadian(+60.0f));
|
||||
STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex));
|
||||
}
|
||||
};
|
||||
|
||||
struct NormalRenderer
|
||||
{
|
||||
inline void operator () (CParticleInstance * pInstance)
|
||||
{
|
||||
pInstance->Transform();
|
||||
STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex));
|
||||
}
|
||||
};
|
||||
struct AttachRenderer
|
||||
{
|
||||
const D3DXMATRIX* pmat;
|
||||
AttachRenderer(const D3DXMATRIX * pmat)
|
||||
: pmat(pmat)
|
||||
{
|
||||
}
|
||||
|
||||
inline void operator () (CParticleInstance * pInstance)
|
||||
{
|
||||
pInstance->Transform(pmat);
|
||||
STATEMANAGER.DrawPrimitiveUP(D3DPT_TRIANGLESTRIP, 2, pInstance->GetParticleMeshPointer(), sizeof(TPTVertex));
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
void CParticleSystemInstance::OnRender()
|
||||
{
|
||||
CScreen::Identity();
|
||||
STATEMANAGER.SetRenderState(D3DRS_SRCBLEND, m_pParticleProperty->m_bySrcBlendType);
|
||||
STATEMANAGER.SetRenderState(D3DRS_DESTBLEND, m_pParticleProperty->m_byDestBlendType);
|
||||
STATEMANAGER.SetTextureStageState(0,D3DTSS_COLOROP,m_pParticleProperty->m_byColorOperationType);
|
||||
if (m_pParticleProperty->m_byBillboardType < BILLBOARD_TYPE_2FACE)
|
||||
{
|
||||
if (!m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
auto obj = NParticleRenderer::NormalRenderer();
|
||||
ForEachParticleRendering(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto obj = NParticleRenderer::AttachRenderer(mc_pmatLocal);
|
||||
ForEachParticleRendering(obj);
|
||||
}
|
||||
}
|
||||
else if (m_pParticleProperty->m_byBillboardType == BILLBOARD_TYPE_2FACE)
|
||||
{
|
||||
if (!m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
auto obj = NParticleRenderer::TwoSideRenderer();
|
||||
ForEachParticleRendering(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto obj = NParticleRenderer::TwoSideRenderer(mc_pmatLocal);
|
||||
ForEachParticleRendering(obj);
|
||||
}
|
||||
}
|
||||
else if (m_pParticleProperty->m_byBillboardType == BILLBOARD_TYPE_3FACE)
|
||||
{
|
||||
if (!m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
auto obj = NParticleRenderer::ThreeSideRenderer();
|
||||
ForEachParticleRendering(obj);
|
||||
}
|
||||
else
|
||||
{
|
||||
auto obj = NParticleRenderer::ThreeSideRenderer(mc_pmatLocal);
|
||||
ForEachParticleRendering(obj);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CParticleSystemInstance::OnSetDataPointer(CEffectElementBase * pElement)
|
||||
{
|
||||
m_pData = (CParticleSystemData *)pElement;
|
||||
|
||||
m_dwCurrentEmissionCount = 0;
|
||||
m_pParticleProperty = m_pData->GetParticlePropertyPointer();
|
||||
m_pEmitterProperty = m_pData->GetEmitterPropertyPointer();
|
||||
m_iLoopCount = m_pEmitterProperty->GetLoopCount();
|
||||
m_ParticleInstanceListVector.resize(m_pParticleProperty->GetTextureAnimationFrameCount()*2+2);
|
||||
|
||||
/////
|
||||
|
||||
assert(m_kVct_pkImgInst.empty());
|
||||
m_kVct_pkImgInst.reserve(m_pParticleProperty->m_ImageVector.size());
|
||||
for (DWORD i = 0; i < m_pParticleProperty->m_ImageVector.size(); ++i)
|
||||
{
|
||||
CGraphicImage * pImage = m_pParticleProperty->m_ImageVector[i];
|
||||
|
||||
CGraphicImageInstance* pkImgInstNew = CGraphicImageInstance::New();
|
||||
pkImgInstNew->SetImagePointer(pImage);
|
||||
m_kVct_pkImgInst.push_back(pkImgInstNew);
|
||||
}
|
||||
}
|
||||
|
||||
void CParticleSystemInstance::OnInitialize()
|
||||
{
|
||||
m_dwCurrentEmissionCount = 0;
|
||||
m_iLoopCount = 0;
|
||||
m_fEmissionResidue = 0.0f;
|
||||
}
|
||||
|
||||
void CParticleSystemInstance::OnDestroy()
|
||||
{
|
||||
// 2004. 3. 1. myevan. 파티클 제거 루틴
|
||||
TParticleInstanceListVector::iterator i;
|
||||
for(i = m_ParticleInstanceListVector.begin(); i!=m_ParticleInstanceListVector.end(); ++i)
|
||||
{
|
||||
TParticleInstanceList& rkLst_kParticleInst=*i;
|
||||
|
||||
TParticleInstanceList::iterator j;
|
||||
for(j = rkLst_kParticleInst.begin(); j!=rkLst_kParticleInst.end(); ++j)
|
||||
{
|
||||
CParticleInstance* pkParticleInst=*j;
|
||||
pkParticleInst->DeleteThis();
|
||||
}
|
||||
|
||||
rkLst_kParticleInst.clear();
|
||||
}
|
||||
m_ParticleInstanceListVector.clear();
|
||||
|
||||
std::for_each(m_kVct_pkImgInst.begin(), m_kVct_pkImgInst.end(), CGraphicImageInstance::Delete);
|
||||
m_kVct_pkImgInst.clear();
|
||||
}
|
||||
|
||||
CParticleSystemInstance::CParticleSystemInstance()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CParticleSystemInstance::~CParticleSystemInstance()
|
||||
{
|
||||
assert(m_ParticleInstanceListVector.empty());
|
||||
assert(m_kVct_pkImgInst.empty());
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
#include "StdAfx.h"
|
||||
#include "SimpleLightData.h"
|
||||
|
||||
CDynamicPool<CLightData> CLightData::ms_kPool;
|
||||
|
||||
void CLightData::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
CLightData* CLightData::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CLightData::Delete(CLightData* pkData)
|
||||
{
|
||||
pkData->Clear();
|
||||
ms_kPool.Free(pkData);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CLightData::OnClear()
|
||||
{
|
||||
m_fMaxRange = 300.0f;
|
||||
|
||||
m_TimeEventTableRange.clear();
|
||||
|
||||
m_cAmbient.r = 0.5f;
|
||||
m_cAmbient.g = 0.5f;
|
||||
m_cAmbient.b = 0.5f;
|
||||
m_cAmbient.a = 1.0f;
|
||||
m_cDiffuse.r = 0.0f;
|
||||
m_cDiffuse.g = 0.0f;
|
||||
m_cDiffuse.b = 0.0f;
|
||||
m_cDiffuse.a = 1.0f;
|
||||
|
||||
m_fDuration = 1.0f;
|
||||
|
||||
m_fAttenuation0 = 0.0f;
|
||||
m_fAttenuation1 = 0.1f;
|
||||
m_fAttenuation2 = 0.0f;
|
||||
|
||||
m_bLoopFlag = false;
|
||||
m_iLoopCount = 0;
|
||||
}
|
||||
void CLightData::GetRange(float fTime, float& rRange)
|
||||
{
|
||||
if (m_TimeEventTableRange.empty())
|
||||
{
|
||||
rRange = 1.0f * m_fMaxRange;
|
||||
if (rRange<0.0f)
|
||||
rRange = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
GetTimeEventBlendValue(fTime, m_TimeEventTableRange, &rRange);
|
||||
rRange *= m_fMaxRange;
|
||||
if (rRange<0.0f)
|
||||
rRange = 0.0f;
|
||||
return;
|
||||
/*
|
||||
float vecLastRange = m_TimeEventTableRange[0].m_Value;
|
||||
|
||||
for (DWORD dwIndex = 0; dwIndex < m_TimeEventTableRange.size(); ++dwIndex)
|
||||
{
|
||||
if(fTime < m_TimeEventTableRange[dwIndex].m_fTime)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (dwIndex >= m_TimeEventTableRange.size())
|
||||
{
|
||||
rRange = m_TimeEventTableRange[m_TimeEventTableRange.size()-1].m_Value * m_fMaxRange;
|
||||
if (rRange<0.0f)
|
||||
rRange = 0.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
TTimeEventTypeFloat & rEffectRange = m_TimeEventTableRange[dwIndex];
|
||||
TTimeEventTypeFloat & rPrevEffectRange = m_TimeEventTableRange[dwIndex-1];
|
||||
|
||||
float Head = fabs(rEffectRange.m_fTime - fTime) / fabs(rEffectRange.m_fTime - rPrevEffectRange.m_fTime);
|
||||
float Tail = 1.0f - fabs(rEffectRange.m_fTime - fTime) / fabs(rEffectRange.m_fTime - rPrevEffectRange.m_fTime);
|
||||
rRange = ((rPrevEffectRange.m_Value*Head) + (rEffectRange.m_Value*Tail) )*m_fMaxRange;
|
||||
if (rRange<0.0f)
|
||||
rRange = 0.0f;
|
||||
*/
|
||||
}
|
||||
|
||||
bool CLightData::OnIsData()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
BOOL CLightData::OnLoadScript(CTextFileLoader & rTextFileLoader)
|
||||
{
|
||||
if (!rTextFileLoader.GetTokenFloat("duration",&m_fDuration))
|
||||
m_fDuration = 1.0f;
|
||||
|
||||
if (!rTextFileLoader.GetTokenBoolean("loopflag",&m_bLoopFlag))
|
||||
m_bLoopFlag = false;
|
||||
|
||||
if (!rTextFileLoader.GetTokenInteger("loopcount",&m_iLoopCount))
|
||||
m_iLoopCount = 0;
|
||||
|
||||
if (!rTextFileLoader.GetTokenColor("ambientcolor",&m_cAmbient))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenColor("diffusecolor",&m_cDiffuse))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenFloat("maxrange",&m_fMaxRange))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenFloat("attenuation0",&m_fAttenuation0))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenFloat("attenuation1",&m_fAttenuation1))
|
||||
return FALSE;
|
||||
|
||||
if (!rTextFileLoader.GetTokenFloat("attenuation2",&m_fAttenuation2))
|
||||
return FALSE;
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader,"timeeventrange",&m_TimeEventTableRange))
|
||||
{
|
||||
m_TimeEventTableRange.clear();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CLightData::CLightData()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
CLightData::~CLightData()
|
||||
{
|
||||
}
|
||||
|
||||
float CLightData::GetDuration()
|
||||
{
|
||||
return m_fDuration;
|
||||
}
|
||||
void CLightData::InitializeLight(D3DLIGHT8& light)
|
||||
{
|
||||
light.Type = D3DLIGHT_POINT;
|
||||
|
||||
light.Ambient = m_cAmbient;
|
||||
light.Diffuse = m_cDiffuse;
|
||||
light.Attenuation0 = m_fAttenuation0;
|
||||
light.Attenuation1 = m_fAttenuation1;
|
||||
light.Attenuation2 = m_fAttenuation2;
|
||||
|
||||
|
||||
D3DXVECTOR3 position;
|
||||
GetPosition( 0.0f, position);
|
||||
light.Position = position;
|
||||
|
||||
GetRange(0.0f, light.Range);
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
#include "StdAfx.h"
|
||||
#include "../EterLib/GrpLightManager.h"
|
||||
|
||||
#include "SimpleLightInstance.h"
|
||||
|
||||
CDynamicPool<CLightInstance> CLightInstance::ms_kPool;
|
||||
|
||||
void CLightInstance::DestroySystem()
|
||||
{
|
||||
ms_kPool.Destroy();
|
||||
}
|
||||
|
||||
CLightInstance* CLightInstance::New()
|
||||
{
|
||||
return ms_kPool.Alloc();
|
||||
}
|
||||
|
||||
void CLightInstance::Delete(CLightInstance* pkData)
|
||||
{
|
||||
pkData->Destroy();
|
||||
ms_kPool.Free(pkData);
|
||||
}
|
||||
|
||||
void CLightInstance::OnSetDataPointer(CEffectElementBase * pElement)
|
||||
{
|
||||
Destroy();
|
||||
|
||||
m_pData = ((CLightData*)pElement);
|
||||
|
||||
m_iLoopCount = m_pData->GetLoopCount();
|
||||
|
||||
D3DLIGHT8 Light;
|
||||
m_pData->InitializeLight(Light);
|
||||
CLightManager::Instance().RegisterLight(LIGHT_TYPE_DYNAMIC, &m_LightID, Light);
|
||||
}
|
||||
|
||||
bool CLightInstance::OnUpdate(float fElapsedTime)
|
||||
{
|
||||
if (!isActive())
|
||||
{
|
||||
Destroy();
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_fLocalTime >= m_pData->GetDuration())
|
||||
{
|
||||
if (m_pData->isLoop() && --m_iLoopCount!=0)
|
||||
{
|
||||
if (m_iLoopCount<0)
|
||||
m_iLoopCount = 0;
|
||||
m_fLocalTime -= m_pData->GetDuration();
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy();
|
||||
m_iLoopCount = 1;
|
||||
return false;
|
||||
}
|
||||
/*
|
||||
if (!m_pData->isLoop())
|
||||
{
|
||||
OnClear();
|
||||
return false;
|
||||
}
|
||||
m_fLocalTime -= m_pData->GetDuration();
|
||||
*/
|
||||
}
|
||||
|
||||
CLight * pLight = CLightManager::Instance().GetLight(m_LightID);
|
||||
|
||||
if (pLight)
|
||||
{
|
||||
pLight->SetAmbientColor(m_pData->m_cAmbient.r, m_pData->m_cAmbient.g, m_pData->m_cAmbient.b, m_pData->m_cAmbient.a);
|
||||
pLight->SetDiffuseColor(m_pData->m_cDiffuse.r, m_pData->m_cDiffuse.g, m_pData->m_cDiffuse.b, m_pData->m_cDiffuse.a);
|
||||
|
||||
/*if (m_pData->m_TimeEventTableRange.size()
|
||||
&& m_fLocalTime>=m_pData->GetDuration()*m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_fTime)
|
||||
{
|
||||
while(m_dwRangeIndex<m_pData->m_TimeEventTableRange.size()
|
||||
&& m_fLocalTime>=m_pData->GetDuration()*m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_fTime)
|
||||
m_dwRangeIndex++;
|
||||
float fLastTime;
|
||||
float fLastRange=m_pData->m_TimeEventTableRange[m_pData->m_TimeEventTableRange.size()-1].m_Value;
|
||||
if (m_dwRangeIndex == m_pData->m_TimeEventTableRange.size())
|
||||
fLastTime = 1.0f;
|
||||
else
|
||||
{
|
||||
fLastTime = m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_fTime;
|
||||
fLastRange = m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_Value;
|
||||
}
|
||||
m_dwRangeIndex--;
|
||||
pLight->BlendRange(fLastRange*m_pData->m_fMaxRange,
|
||||
(fLastTime-m_pData->m_TimeEventTableRange[m_dwRangeIndex].m_fTime)*m_pData->GetDuration());
|
||||
m_dwRangeIndex++;
|
||||
}*/
|
||||
|
||||
float fRange;
|
||||
m_pData->GetRange(m_fLocalTime, fRange);
|
||||
pLight->SetRange(fRange);
|
||||
|
||||
D3DXVECTOR3 pos;
|
||||
m_pData->GetPosition(m_fLocalTime,pos);
|
||||
D3DXVec3TransformCoord(&pos,&pos,mc_pmatLocal);
|
||||
pLight->SetPosition(pos.x,pos.y,pos.z);
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CLightInstance::OnRender()
|
||||
{
|
||||
//OnUpdate(0);
|
||||
}
|
||||
|
||||
void CLightInstance::OnInitialize()
|
||||
{
|
||||
m_LightID = 0;
|
||||
m_dwRangeIndex = 0;
|
||||
}
|
||||
|
||||
void CLightInstance::OnDestroy()
|
||||
{
|
||||
if (m_LightID)
|
||||
{
|
||||
CLightManager::Instance().DeleteLight(m_LightID);
|
||||
}
|
||||
}
|
||||
|
||||
CLightInstance::CLightInstance()
|
||||
{
|
||||
Initialize();
|
||||
}
|
||||
|
||||
CLightInstance::~CLightInstance()
|
||||
{
|
||||
Destroy();
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
#include "StdAfx.h"
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#include "StdAfx.h"
|
||||
#include "Type.h"
|
||||
|
||||
BOOL GetTokenTimeEventFloat(CTextFileLoader & rTextFileLoader, const char * c_szKey, TTimeEventTableFloat * pTimeEventTableFloat)
|
||||
{
|
||||
CTokenVector * pTokenVector;
|
||||
if (!rTextFileLoader.GetTokenVector(c_szKey, &pTokenVector))
|
||||
return FALSE;
|
||||
|
||||
pTimeEventTableFloat->clear();
|
||||
pTimeEventTableFloat->resize(pTokenVector->size() / 2);
|
||||
|
||||
DWORD dwIndex = 0;
|
||||
for (DWORD i = 0; i < pTokenVector->size(); i+=2, ++dwIndex)
|
||||
{
|
||||
pTimeEventTableFloat->at(dwIndex).m_fTime = atof(pTokenVector->at(i).c_str());
|
||||
pTimeEventTableFloat->at(dwIndex).m_Value = atof(pTokenVector->at(i+1).c_str());
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void InsertItemTimeEventFloat(TTimeEventTableFloat * pTable, float fTime, float fValue)
|
||||
{
|
||||
TTimeEventTableFloat::iterator itor = pTable->begin();
|
||||
for (; itor != pTable->end(); ++itor)
|
||||
{
|
||||
TTimeEventTypeFloat & rTimeEvent = *itor;
|
||||
if (rTimeEvent.m_fTime > fTime)
|
||||
break;
|
||||
}
|
||||
|
||||
TTimeEventTypeFloat TimeEvent;
|
||||
TimeEvent.m_fTime = fTime;
|
||||
TimeEvent.m_Value = fValue;
|
||||
|
||||
pTable->insert(itor, TimeEvent);
|
||||
}
|
||||
@@ -73,7 +73,7 @@ enum EBillBoardType
|
||||
|
||||
BILLBOARD_TYPE_LIE, // 바닥에 누은 형상
|
||||
|
||||
BILLBOARD_TYPE_2FACE, // / and \
|
||||
BILLBOARD_TYPE_2FACE, // / and \ face // PORT: text after the backslash; clang reads "\ <newline>" as a line splice and drops BILLBOARD_TYPE_3FACE
|
||||
BILLBOARD_TYPE_3FACE, // / and \ and -
|
||||
|
||||
//BILLBOARD_TYPE_RAY, // 잔상
|
||||
|
||||
Reference in New Issue
Block a user