forked from metin2/client
Solution refactoring and restructuring, removed Boost dependency, removed unused tools
This commit is contained in:
221
src/EffectLib/EffectData.cpp
Normal file
221
src/EffectLib/EffectData.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
69
src/EffectLib/EffectData.h
Normal file
69
src/EffectLib/EffectData.h
Normal file
@ -0,0 +1,69 @@
|
||||
#pragma once
|
||||
|
||||
#include "../milesLib/Type.h"
|
||||
|
||||
#include "ParticleSystemData.h"
|
||||
#include "EffectMesh.h"
|
||||
#include "SimpleLightData.h"
|
||||
|
||||
class CEffectData
|
||||
{
|
||||
public:
|
||||
typedef std::vector<CParticleSystemData*> TParticleVector;
|
||||
typedef std::vector<CEffectMeshScript*> TMeshVector;
|
||||
typedef std::vector<CLightData*> TLightVector;
|
||||
|
||||
public:
|
||||
CEffectData();
|
||||
virtual ~CEffectData();
|
||||
|
||||
void Clear();
|
||||
bool LoadScript(const char * c_szFileName);
|
||||
bool LoadSoundScriptData(const char * c_szFileName);
|
||||
|
||||
DWORD GetParticleCount();
|
||||
CParticleSystemData * GetParticlePointer(DWORD dwPosition);
|
||||
|
||||
DWORD GetMeshCount();
|
||||
CEffectMeshScript * GetMeshPointer(DWORD dwPosition);
|
||||
|
||||
DWORD GetLightCount();
|
||||
CLightData * GetLightPointer(DWORD dwPosition);
|
||||
|
||||
NSound::TSoundInstanceVector * GetSoundInstanceVector();
|
||||
|
||||
float GetBoundingSphereRadius();
|
||||
D3DXVECTOR3 GetBoundingSpherePosition();
|
||||
|
||||
const char * GetFileName() const;
|
||||
|
||||
protected:
|
||||
void __ClearParticleDataVector();
|
||||
void __ClearLightDataVector();
|
||||
void __ClearMeshDataVector();
|
||||
|
||||
// FIXME : <20><> <20>κ<EFBFBD><CEBA><EFBFBD> <20>״<EFBFBD><D7B4><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>ʴ´<CAB4>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD>̵<EFBFBD><CCB5> ã<>Ƴ<EFBFBD><C6B3><EFBFBD> <20><>ġ<EFBFBD><C4A1>.
|
||||
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> (Ưȭ<C6AF><C8AD>) <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̽<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ٲ<EFBFBD><D9B2><EFBFBD><EFBFBD><EFBFBD> <20>Ѵٴ<D1B4> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ϴ<EFBFBD>. - [levites]
|
||||
virtual CParticleSystemData * AllocParticle();
|
||||
virtual CEffectMeshScript * AllocMesh();
|
||||
virtual CLightData * AllocLight();
|
||||
|
||||
protected:
|
||||
TParticleVector m_ParticleVector;
|
||||
TMeshVector m_MeshVector;
|
||||
TLightVector m_LightVector;
|
||||
NSound::TSoundInstanceVector m_SoundInstanceVector;
|
||||
|
||||
float m_fBoundingSphereRadius;
|
||||
D3DXVECTOR3 m_v3BoundingSpherePosition;
|
||||
|
||||
std::string m_strFileName;
|
||||
|
||||
public:
|
||||
static void DestroySystem();
|
||||
|
||||
static CEffectData* New();
|
||||
static void Delete(CEffectData* pkData);
|
||||
|
||||
static CDynamicPool<CEffectData> ms_kPool;
|
||||
};
|
168
src/EffectLib/EffectElementBase.cpp
Normal file
168
src/EffectLib/EffectElementBase.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
37
src/EffectLib/EffectElementBase.h
Normal file
37
src/EffectLib/EffectElementBase.h
Normal file
@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include "Type.h"
|
||||
|
||||
class CEffectElementBase
|
||||
{
|
||||
public:
|
||||
CEffectElementBase();
|
||||
virtual ~CEffectElementBase();
|
||||
|
||||
void Clear();
|
||||
bool isData();
|
||||
|
||||
BOOL LoadScript(CTextFileLoader & rTextFileLoader);
|
||||
|
||||
void GetPosition(float fTime, D3DXVECTOR3 & rPosition);
|
||||
float GetStartTime();
|
||||
/*
|
||||
bool isVisible(float fTime);
|
||||
void GetAlpha(float fTime, float * pAlpha);
|
||||
void GetScale(float fTime, float * pScale);
|
||||
*/
|
||||
|
||||
protected:
|
||||
virtual void OnClear() = 0;
|
||||
virtual bool OnIsData() = 0;
|
||||
virtual BOOL OnLoadScript(CTextFileLoader & rTextFileLoader) = 0;
|
||||
|
||||
protected:
|
||||
float m_fStartTime;
|
||||
TTimeEventTablePosition m_TimeEventTablePosition;
|
||||
/*
|
||||
TTimeEventTable m_TimeEventTableVisible;
|
||||
TTimeEventTableFloat m_TimeEventAlpha;
|
||||
TTimeEventTableFloat m_TimeEventScale;
|
||||
*/
|
||||
};
|
97
src/EffectLib/EffectElementBaseInstance.cpp
Normal file
97
src/EffectLib/EffectElementBaseInstance.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
46
src/EffectLib/EffectElementBaseInstance.h
Normal file
46
src/EffectLib/EffectElementBaseInstance.h
Normal file
@ -0,0 +1,46 @@
|
||||
#pragma once
|
||||
|
||||
#include "EffectElementBase.h"
|
||||
|
||||
class CEffectElementBaseInstance
|
||||
{
|
||||
public:
|
||||
CEffectElementBaseInstance();
|
||||
virtual ~CEffectElementBaseInstance();
|
||||
|
||||
void SetDataPointer(CEffectElementBase * pElement);
|
||||
|
||||
void Initialize();
|
||||
void Destroy();
|
||||
|
||||
void SetLocalMatrixPointer(const D3DXMATRIX * c_pMatrix);
|
||||
bool Update(float fElapsedTime);
|
||||
void Render();
|
||||
|
||||
bool isActive();
|
||||
void SetActive();
|
||||
void SetDeactive();
|
||||
|
||||
protected:
|
||||
virtual void OnSetDataPointer(CEffectElementBase * pElement) = 0;
|
||||
|
||||
virtual void OnInitialize() = 0;
|
||||
virtual void OnDestroy() = 0;
|
||||
|
||||
virtual bool OnUpdate(float fElapsedTime) = 0;
|
||||
virtual void OnRender() = 0;
|
||||
|
||||
protected:
|
||||
const D3DXMATRIX * mc_pmatLocal;
|
||||
|
||||
bool m_isActive;
|
||||
|
||||
float m_fLocalTime;
|
||||
DWORD m_dwStartTime;
|
||||
float m_fElapsedTime;
|
||||
float m_fRemainingTime;
|
||||
bool m_bStart;
|
||||
|
||||
private:
|
||||
CEffectElementBase * m_pBase;
|
||||
};
|
288
src/EffectLib/EffectInstance.cpp
Normal file
288
src/EffectLib/EffectInstance.cpp
Normal file
@ -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 : <20><>Ʈ<EFBFBD><C6AE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><>ġ<EFBFBD><C4A1> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>´<EFBFBD> - [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::void_mem_fun(&CEffectElementBaseInstance::Render));
|
||||
std::for_each(m_MeshInstanceVector.begin(),m_MeshInstanceVector.end(),std::void_mem_fun(&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::void_mem_fun(&CEffectElementBaseInstance::SetActive));
|
||||
std::for_each(
|
||||
m_MeshInstanceVector.begin(),
|
||||
m_MeshInstanceVector.end(),
|
||||
std::void_mem_fun(&CEffectElementBaseInstance::SetActive));
|
||||
std::for_each(
|
||||
m_LightInstanceVector.begin(),
|
||||
m_LightInstanceVector.end(),
|
||||
std::void_mem_fun(&CEffectElementBaseInstance::SetActive));
|
||||
}
|
||||
|
||||
void CEffectInstance::SetDeactive()
|
||||
{
|
||||
std::for_each(
|
||||
m_ParticleInstanceVector.begin(),
|
||||
m_ParticleInstanceVector.end(),
|
||||
std::void_mem_fun(&CEffectElementBaseInstance::SetDeactive));
|
||||
std::for_each(
|
||||
m_MeshInstanceVector.begin(),
|
||||
m_MeshInstanceVector.end(),
|
||||
std::void_mem_fun(&CEffectElementBaseInstance::SetDeactive));
|
||||
std::for_each(
|
||||
m_LightInstanceVector.begin(),
|
||||
m_LightInstanceVector.end(),
|
||||
std::void_mem_fun(&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());
|
||||
}
|
90
src/EffectLib/EffectInstance.h
Normal file
90
src/EffectLib/EffectInstance.h
Normal file
@ -0,0 +1,90 @@
|
||||
#pragma once
|
||||
|
||||
#include "../eterlib/GrpObjectInstance.h"
|
||||
#include "../eterlib/Pool.h"
|
||||
#include "../mileslib/Type.h"
|
||||
|
||||
#include "EffectElementBaseInstance.h"
|
||||
#include "EffectData.h"
|
||||
#include "EffectMeshInstance.h"
|
||||
#include "ParticleSystemInstance.h"
|
||||
#include "SimpleLightInstance.h"
|
||||
|
||||
class CEffectInstance : public CGraphicObjectInstance
|
||||
{
|
||||
public:
|
||||
typedef std::vector<CEffectElementBaseInstance*> TEffectElementInstanceVector;
|
||||
|
||||
enum
|
||||
{
|
||||
ID = EFFECT_OBJECT
|
||||
};
|
||||
int GetType() const
|
||||
{
|
||||
return CEffectInstance::ID;
|
||||
}
|
||||
|
||||
bool GetBoundingSphere(D3DXVECTOR3 & v3Center, float & fRadius);
|
||||
|
||||
static void DestroySystem();
|
||||
|
||||
static CEffectInstance* New();
|
||||
static void Delete(CEffectInstance* pkEftInst);
|
||||
|
||||
static void ResetRenderingEffectCount();
|
||||
static int GetRenderingEffectCount();
|
||||
|
||||
public:
|
||||
CEffectInstance();
|
||||
virtual ~CEffectInstance();
|
||||
|
||||
bool LessRenderOrder(CEffectInstance* pkEftInst);
|
||||
|
||||
void SetEffectDataPointer(CEffectData * pEffectData);
|
||||
|
||||
void Clear();
|
||||
BOOL isAlive();
|
||||
void SetActive();
|
||||
void SetDeactive();
|
||||
void SetGlobalMatrix(const D3DXMATRIX & c_rmatGlobal);
|
||||
void UpdateSound();
|
||||
void OnUpdate();
|
||||
void OnRender();
|
||||
void OnBlendRender() {} // Not used
|
||||
void OnRenderToShadowMap() {} // Not used
|
||||
void OnRenderShadow() {} // Not used
|
||||
void OnRenderPCBlocker() {} // Not used
|
||||
|
||||
protected:
|
||||
void __Initialize();
|
||||
|
||||
void __SetParticleData(CParticleSystemData * pData);
|
||||
void __SetMeshData(CEffectMeshScript * pMesh);
|
||||
void __SetLightData(CLightData * pData);
|
||||
|
||||
virtual void OnUpdateCollisionData(const CStaticCollisionDataVector * pscdVector) {} // Not used
|
||||
virtual void OnUpdateHeighInstance(CAttributeInstance * pAttributeInstance) {}
|
||||
virtual bool OnGetObjectHeight(float fX, float fY, float * pfHeight) { return false; }
|
||||
|
||||
protected:
|
||||
BOOL m_isAlive;
|
||||
DWORD m_dwFrame;
|
||||
D3DXMATRIX m_matGlobal;
|
||||
|
||||
CEffectData * m_pkEftData;
|
||||
|
||||
std::vector<CParticleSystemInstance*> m_ParticleInstanceVector;
|
||||
std::vector<CEffectMeshInstance*> m_MeshInstanceVector;
|
||||
std::vector<CLightInstance*> m_LightInstanceVector;
|
||||
|
||||
NSound::TSoundInstanceVector * m_pSoundInstanceVector;
|
||||
|
||||
float m_fBoundingSphereRadius;
|
||||
D3DXVECTOR3 m_v3BoundingSpherePosition;
|
||||
|
||||
float m_fLastTime;
|
||||
|
||||
public:
|
||||
static CDynamicPool<CEffectInstance> ms_kPool;
|
||||
static int ms_iRenderingEffectCount;
|
||||
};
|
568
src/EffectLib/EffectLib.vcxproj
Normal file
568
src/EffectLib/EffectLib.vcxproj
Normal file
@ -0,0 +1,568 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Distribute|Win32">
|
||||
<Configuration>Distribute</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="MfcDebug|Win32">
|
||||
<Configuration>MfcDebug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="MfcRelease|Win32">
|
||||
<Configuration>MfcRelease</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="VTune|Win32">
|
||||
<Configuration>VTune</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<VCProjectVersion>17.0</VCProjectVersion>
|
||||
<ProjectName>EffectLib</ProjectName>
|
||||
<ProjectGuid>{790B152D-6582-467F-B767-8603C5A9E613}</ProjectGuid>
|
||||
<RootNamespace>EffectLib</RootNamespace>
|
||||
<SccProjectName>SAK</SccProjectName>
|
||||
<SccAuxPath>SAK</SccAuxPath>
|
||||
<SccLocalPath>SAK</SccLocalPath>
|
||||
<SccProvider>SAK</SccProvider>
|
||||
<Keyword>MFCProj</Keyword>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'" Label="Configuration">
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>17.0.32203.90</_ProjectFileVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">
|
||||
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">
|
||||
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">
|
||||
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">
|
||||
<OutDir>$(SolutionDir)build\$(Configuration)\</OutDir>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
<VcpkgConfiguration>$(Configuration)</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/Gs /Gs %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>.;../../extern/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\VTune/EffectLib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerOutput>All</AssemblerOutput>
|
||||
<AssemblerListingLocation>.\VTune/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\VTune/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\VTune/</ProgramDataBaseFileName>
|
||||
<BrowseInformation />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>.\VTune\EffectLib.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>.;../../extern/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;WORLD_EDITOR;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\EffectLib___Win32_MfcDebug/EffectLib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\EffectLib___Win32_MfcDebug/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\EffectLib___Win32_MfcDebug/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\EffectLib___Win32_MfcDebug/</ProgramDataBaseFileName>
|
||||
<BrowseInformation />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>.\EffectLib___Win32_MfcDebug\EffectLib.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\Release/EffectLib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Release/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
|
||||
<BrowseInformation />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/EffectLib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Debug/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
|
||||
<BrowseInformation />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)extern\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\Distribute/EffectLib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerOutput>All</AssemblerOutput>
|
||||
<AssemblerListingLocation>.\Distribute/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Distribute/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Distribute/</ProgramDataBaseFileName>
|
||||
<BrowseInformation />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
<CompileAs>Default</CompileAs>
|
||||
<MultiProcessorCompilation>true</MultiProcessorCompilation>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>.;../../extern/include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\EffectLib___Win32_MfcRelease/EffectLib.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerOutput>All</AssemblerOutput>
|
||||
<AssemblerListingLocation>.\EffectLib___Win32_MfcRelease/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\EffectLib___Win32_MfcRelease/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\EffectLib___Win32_MfcRelease/</ProgramDataBaseFileName>
|
||||
<BrowseInformation />
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0412</Culture>
|
||||
</ResourceCompile>
|
||||
<Lib>
|
||||
<OutputFile>.\EffectLib___Win32_MfcRelease\EffectLib.lib</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
</Lib>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EffectData.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectElementBase.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectElementBaseInstance.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectInstance.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectManager.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectMesh.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectMeshInstance.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectUpdateDecorator.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EmitterProperty.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FrameController.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ParticleInstance.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ParticleProperty.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ParticleSystemData.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ParticleSystemInstance.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimpleLightData.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimpleLightInstance.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">Create</PrecompiledHeader>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Create</PrecompiledHeader>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">Create</PrecompiledHeader>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Type.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Distribute|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">Disabled</Optimization>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='MfcDebug|Win32'">true</BrowseInformation>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='MfcRelease|Win32'">MaxSpeed</Optimization>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<FavorSizeOrSpeed Condition="'$(Configuration)|$(Platform)'=='VTune|Win32'">Size</FavorSizeOrSpeed>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EffectData.h" />
|
||||
<ClInclude Include="EffectElementBase.h" />
|
||||
<ClInclude Include="EffectElementBaseInstance.h" />
|
||||
<ClInclude Include="EffectInstance.h" />
|
||||
<ClInclude Include="EffectManager.h" />
|
||||
<ClInclude Include="EffectMesh.h" />
|
||||
<ClInclude Include="EffectMeshInstance.h" />
|
||||
<ClInclude Include="EffectUpdateDecorator.h" />
|
||||
<ClInclude Include="EmitterProperty.h" />
|
||||
<ClInclude Include="FrameController.h" />
|
||||
<ClInclude Include="ParticleInstance.h" />
|
||||
<ClInclude Include="ParticleProperty.h" />
|
||||
<ClInclude Include="ParticleSystemData.h" />
|
||||
<ClInclude Include="ParticleSystemInstance.h" />
|
||||
<ClInclude Include="SimpleLightData.h" />
|
||||
<ClInclude Include="SimpleLightInstance.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
<ClInclude Include="Type.h" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
125
src/EffectLib/EffectLib.vcxproj.filters
Normal file
125
src/EffectLib/EffectLib.vcxproj.filters
Normal file
@ -0,0 +1,125 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{34b0c1d5-11b0-4f40-91de-38bbe725d755}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{74681033-a4dd-4ff0-9104-15edeb2496a0}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="EffectData.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectElementBase.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectElementBaseInstance.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectInstance.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectManager.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectMesh.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectMeshInstance.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EffectUpdateDecorator.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="EmitterProperty.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="FrameController.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ParticleInstance.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ParticleProperty.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ParticleSystemData.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="ParticleSystemInstance.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimpleLightData.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="SimpleLightInstance.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Type.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="EffectData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EffectElementBase.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EffectElementBaseInstance.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EffectInstance.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EffectManager.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EffectMesh.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EffectMeshInstance.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EffectUpdateDecorator.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="EmitterProperty.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="FrameController.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ParticleInstance.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ParticleProperty.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ParticleSystemData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="ParticleSystemInstance.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SimpleLightData.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="SimpleLightInstance.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Type.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
468
src/EffectLib/EffectManager.cpp
Normal file
468
src/EffectLib/EffectManager.cpp
Normal file
@ -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. <20><><EFBFBD><EFBFBD>Ʈ <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ϴ<EFBFBD> <20>ڵ<EFBFBD>
|
||||
/*
|
||||
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 <20><> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>ϰ<EFBFBD> <20>ϰ<EFBFBD>..
|
||||
// CEffectData<74><61><EFBFBD><EFBFBD> CRC<52><43> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ְ<EFBFBD> <20>Ѵ<EFBFBD>
|
||||
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
|
||||
|
86
src/EffectLib/EffectManager.h
Normal file
86
src/EffectLib/EffectManager.h
Normal file
@ -0,0 +1,86 @@
|
||||
#pragma once
|
||||
|
||||
#include "EffectInstance.h"
|
||||
|
||||
class CEffectManager : public CScreen, public CSingleton<CEffectManager>
|
||||
{
|
||||
public:
|
||||
enum EEffectType
|
||||
{
|
||||
EFFECT_TYPE_NONE = 0,
|
||||
EFFECT_TYPE_PARTICLE = 1,
|
||||
EFFECT_TYPE_ANIMATION_TEXTURE = 2,
|
||||
EFFECT_TYPE_MESH = 3,
|
||||
EFFECT_TYPE_SIMPLE_LIGHT = 4,
|
||||
|
||||
EFFECT_TYPE_MAX_NUM = 4,
|
||||
};
|
||||
|
||||
typedef std::map<DWORD, CEffectData*> TEffectDataMap;
|
||||
typedef std::map<DWORD, CEffectInstance*> TEffectInstanceMap;
|
||||
|
||||
public:
|
||||
CEffectManager();
|
||||
virtual ~CEffectManager();
|
||||
|
||||
void Destroy();
|
||||
|
||||
void UpdateSound();
|
||||
void Update();
|
||||
void Render();
|
||||
|
||||
void GetInfo(std::string* pstInfo);
|
||||
|
||||
bool IsAliveEffect(DWORD dwInstanceIndex);
|
||||
|
||||
// Register
|
||||
BOOL RegisterEffect(const char * c_szFileName,bool isExistDelete=false,bool isNeedCache=false);
|
||||
BOOL RegisterEffect2(const char * c_szFileName, DWORD* pdwRetCRC, bool isNeedCache=false);
|
||||
|
||||
void DeleteAllInstances();
|
||||
|
||||
// Usage
|
||||
int CreateEffect(DWORD dwID, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation);
|
||||
int CreateEffect(const char * c_szFileName, const D3DXVECTOR3 & c_rv3Position, const D3DXVECTOR3 & c_rv3Rotation);
|
||||
|
||||
void CreateEffectInstance(DWORD dwInstanceIndex, DWORD dwID);
|
||||
BOOL SelectEffectInstance(DWORD dwInstanceIndex);
|
||||
bool DestroyEffectInstance(DWORD dwInstanceIndex);
|
||||
void DeactiveEffectInstance(DWORD dwInstanceIndex);
|
||||
|
||||
void SetEffectTextures(DWORD dwID, std::vector<std::string> textures);
|
||||
void SetEffectInstancePosition(const D3DXVECTOR3 & c_rv3Position);
|
||||
void SetEffectInstanceRotation(const D3DXVECTOR3 & c_rv3Rotation);
|
||||
void SetEffectInstanceGlobalMatrix(const D3DXMATRIX & c_rmatGlobal);
|
||||
|
||||
void ShowEffect();
|
||||
void HideEffect();
|
||||
|
||||
// Temporary function
|
||||
DWORD GetRandomEffect();
|
||||
int GetEmptyIndex();
|
||||
bool GetEffectData(DWORD dwID, CEffectData ** ppEffect);
|
||||
bool GetEffectData(DWORD dwID, const CEffectData ** c_ppEffect);
|
||||
|
||||
// Area<65><61> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> Effect<63><74> <20>Լ<EFBFBD>... EffectInstance<63><65> Pointer<65><72> <20><>ȯ<EFBFBD>Ѵ<EFBFBD>.
|
||||
// EffectManager <20><><EFBFBD><EFBFBD> EffectInstanceMap<61><70> <20>̿<EFBFBD><CCBF><EFBFBD><EFBFBD><EFBFBD> <20>ʴ´<CAB4>.
|
||||
void CreateUnsafeEffectInstance(DWORD dwEffectDataID, CEffectInstance ** ppEffectInstance);
|
||||
bool DestroyUnsafeEffectInstance(CEffectInstance * pEffectInstance);
|
||||
|
||||
int GetRenderingEffectCount();
|
||||
|
||||
protected:
|
||||
void __Initialize();
|
||||
|
||||
void __DestroyEffectInstanceMap();
|
||||
void __DestroyEffectCacheMap();
|
||||
void __DestroyEffectDataMap();
|
||||
|
||||
protected:
|
||||
bool m_isDisableSortRendering;
|
||||
TEffectDataMap m_kEftDataMap;
|
||||
TEffectInstanceMap m_kEftInstMap;
|
||||
TEffectInstanceMap m_kEftCacheMap;
|
||||
|
||||
CEffectInstance * m_pSelectedEffectInstance;
|
||||
};
|
699
src/EffectLib/EffectMesh.cpp
Normal file
699
src/EffectLib/EffectMesh.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
157
src/EffectLib/EffectMesh.h
Normal file
157
src/EffectLib/EffectMesh.h
Normal file
@ -0,0 +1,157 @@
|
||||
#pragma once
|
||||
|
||||
#include <d3dx8.h>
|
||||
|
||||
#include "../eterlib/GrpScreen.h"
|
||||
#include "../eterlib/Resource.h"
|
||||
#include "../eterlib/GrpImageInstance.h"
|
||||
#include "../eterLib/TextFileLoader.h"
|
||||
|
||||
#include "Type.h"
|
||||
#include "EffectElementBase.h"
|
||||
|
||||
class CEffectMesh : public CResource
|
||||
{
|
||||
public:
|
||||
typedef struct SEffectFrameData
|
||||
{
|
||||
BYTE byChangedFrame;
|
||||
float fVisibility;
|
||||
DWORD dwVertexCount;
|
||||
DWORD dwTextureVertexCount;
|
||||
DWORD dwIndexCount;
|
||||
std::vector<TPTVertex> PDTVertexVector;
|
||||
} TEffectFrameData;
|
||||
|
||||
typedef struct SEffectMeshData
|
||||
{
|
||||
char szObjectName[32];
|
||||
char szDiffuseMapFileName[128];
|
||||
|
||||
std::vector<TEffectFrameData> EffectFrameDataVector;
|
||||
std::vector<CGraphicImage*> pImageVector;
|
||||
|
||||
static SEffectMeshData* New();
|
||||
static void Delete(SEffectMeshData* pkData);
|
||||
|
||||
static void DestroySystem();
|
||||
|
||||
static CDynamicPool<SEffectMeshData> ms_kPool;
|
||||
} TEffectMeshData;
|
||||
|
||||
// About Resource Code
|
||||
public:
|
||||
typedef CRef<CEffectMesh> TRef;
|
||||
|
||||
public:
|
||||
static TType Type();
|
||||
|
||||
public:
|
||||
CEffectMesh(const char * c_szFileName);
|
||||
virtual ~CEffectMesh();
|
||||
|
||||
DWORD GetFrameCount();
|
||||
DWORD GetMeshCount();
|
||||
TEffectMeshData * GetMeshDataPointer(DWORD dwMeshIndex);
|
||||
|
||||
std::vector<CGraphicImage*>* GetTextureVectorPointer(DWORD dwMeshIndex);
|
||||
std::vector<CGraphicImage*>& GetTextureVectorReference(DWORD dwMeshIndex);
|
||||
|
||||
// Exceptional function for tool
|
||||
BOOL GetMeshElementPointer(DWORD dwMeshIndex, TEffectMeshData ** ppMeshData);
|
||||
|
||||
protected:
|
||||
bool OnLoad(int iSize, const void * c_pvBuf);
|
||||
|
||||
void OnClear();
|
||||
bool OnIsEmpty() const;
|
||||
bool OnIsType(TType type);
|
||||
|
||||
BOOL __LoadData_Ver001(int iSize, const BYTE * c_pbBuf);
|
||||
BOOL __LoadData_Ver002(int iSize, const BYTE * c_pbBuf);
|
||||
|
||||
protected:
|
||||
int m_iGeomCount;
|
||||
int m_iFrameCount;
|
||||
std::vector<TEffectMeshData *> m_pEffectMeshDataVector;
|
||||
|
||||
bool m_isData;
|
||||
};
|
||||
|
||||
class CEffectMeshScript : public CEffectElementBase
|
||||
{
|
||||
public:
|
||||
typedef struct SMeshData
|
||||
{
|
||||
BYTE byBillboardType;
|
||||
|
||||
BOOL bBlendingEnable;
|
||||
BYTE byBlendingSrcType;
|
||||
BYTE byBlendingDestType;
|
||||
BOOL bTextureAlphaEnable;
|
||||
|
||||
BYTE byColorOperationType;
|
||||
D3DXCOLOR ColorFactor;
|
||||
|
||||
BOOL bTextureAnimationLoopEnable;
|
||||
float fTextureAnimationFrameDelay;
|
||||
|
||||
DWORD dwTextureAnimationStartFrame;
|
||||
|
||||
TTimeEventTableFloat TimeEventAlpha;
|
||||
|
||||
SMeshData()
|
||||
{
|
||||
TimeEventAlpha.clear();
|
||||
}
|
||||
} TMeshData;
|
||||
typedef std::vector<TMeshData> TMeshDataVector;
|
||||
|
||||
public:
|
||||
CEffectMeshScript();
|
||||
virtual ~CEffectMeshScript();
|
||||
|
||||
const char * GetMeshFileName();
|
||||
|
||||
void ReserveMeshData(DWORD dwMeshCount);
|
||||
bool CheckMeshIndex(DWORD dwMeshIndex);
|
||||
bool GetMeshDataPointer(DWORD dwMeshIndex, TMeshData ** ppMeshData);
|
||||
int GetMeshDataCount();
|
||||
|
||||
int GetBillboardType(DWORD dwMeshIndex);
|
||||
BOOL isBlendingEnable(DWORD dwMeshIndex);
|
||||
BYTE GetBlendingSrcType(DWORD dwMeshIndex);
|
||||
BYTE GetBlendingDestType(DWORD dwMeshIndex);
|
||||
BOOL isTextureAlphaEnable(DWORD dwMeshIndex);
|
||||
BOOL GetColorOperationType(DWORD dwMeshIndex, BYTE * pbyType);
|
||||
BOOL GetColorFactor(DWORD dwMeshIndex, D3DXCOLOR * pColor);
|
||||
BOOL GetTimeTableAlphaPointer(DWORD dwMeshIndex, TTimeEventTableFloat ** pTimeEventAlpha);
|
||||
|
||||
BOOL isMeshAnimationLoop();
|
||||
BOOL GetMeshAnimationLoopCount();
|
||||
float GetMeshAnimationFrameDelay();
|
||||
BOOL isTextureAnimationLoop(DWORD dwMeshIndex);
|
||||
float GetTextureAnimationFrameDelay(DWORD dwMeshIndex);
|
||||
DWORD GetTextureAnimationStartFrame(DWORD dwMeshIndex);
|
||||
|
||||
protected:
|
||||
void OnClear();
|
||||
bool OnIsData();
|
||||
BOOL OnLoadScript(CTextFileLoader & rTextFileLoader);
|
||||
|
||||
protected:
|
||||
BOOL m_isMeshAnimationLoop;
|
||||
int m_iMeshAnimationLoopCount;
|
||||
float m_fMeshAnimationFrameDelay;
|
||||
TMeshDataVector m_MeshDataVector;
|
||||
|
||||
std::string m_strMeshFileName;
|
||||
|
||||
public:
|
||||
static void DestroySystem();
|
||||
|
||||
static CEffectMeshScript* New();
|
||||
static void Delete(CEffectMeshScript* pkData);
|
||||
|
||||
static CDynamicPool<CEffectMeshScript> ms_kPool;
|
||||
};
|
271
src/EffectLib/EffectMeshInstance.cpp
Normal file
271
src/EffectLib/EffectMeshInstance.cpp
Normal file
@ -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();
|
||||
}
|
50
src/EffectLib/EffectMeshInstance.h
Normal file
50
src/EffectLib/EffectMeshInstance.h
Normal file
@ -0,0 +1,50 @@
|
||||
#pragma once
|
||||
|
||||
#include "../eterlib/GrpScreen.h"
|
||||
#include "../eterlib/GrpImageInstance.h"
|
||||
#include "EffectElementBaseInstance.h"
|
||||
#include "FrameController.h"
|
||||
#include "EffectMesh.h"
|
||||
|
||||
class CEffectMeshInstance : public CEffectElementBaseInstance
|
||||
{
|
||||
public:
|
||||
// NOTE : Mesh <20><><EFBFBD><EFBFBD> <20>ؽ<EFBFBD><D8BD><EFBFBD> <20><><EFBFBD><EFBFBD>Ÿ<EFBFBD><C5B8> <20>ν<EFBFBD><CEBD>Ͻ<EFBFBD><CFBD>̴<EFBFBD>.
|
||||
typedef struct STextureInstance
|
||||
{
|
||||
CFrameController TextureFrameController;
|
||||
std::vector<CGraphicImageInstance*> TextureInstanceVector;
|
||||
} TTextureInstance;
|
||||
|
||||
public:
|
||||
CEffectMeshInstance();
|
||||
virtual ~CEffectMeshInstance();
|
||||
|
||||
public:
|
||||
static void DestroySystem();
|
||||
|
||||
static CEffectMeshInstance* New();
|
||||
static void Delete(CEffectMeshInstance* pkMeshInstance);
|
||||
|
||||
static CDynamicPool<CEffectMeshInstance> ms_kPool;
|
||||
|
||||
protected:
|
||||
void OnSetDataPointer(CEffectElementBase * pElement);
|
||||
|
||||
void OnInitialize();
|
||||
void OnDestroy();
|
||||
|
||||
bool OnUpdate(float fElapsedTime);
|
||||
void OnRender();
|
||||
|
||||
BOOL isActive();
|
||||
|
||||
protected:
|
||||
CEffectMeshScript * m_pMeshScript;
|
||||
CEffectMesh * m_pEffectMesh;
|
||||
|
||||
CFrameController m_MeshFrameController;
|
||||
std::vector<TTextureInstance> m_TextureInstanceVector;
|
||||
|
||||
CEffectMesh::TRef m_roMesh;
|
||||
};
|
39
src/EffectLib/EffectUpdateDecorator.cpp
Normal file
39
src/EffectLib/EffectUpdateDecorator.cpp
Normal file
@ -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;
|
||||
}
|
||||
|
||||
}
|
282
src/EffectLib/EffectUpdateDecorator.h
Normal file
282
src/EffectLib/EffectUpdateDecorator.h
Normal file
@ -0,0 +1,282 @@
|
||||
#pragma once
|
||||
|
||||
#include "Type.h"
|
||||
#include "../eterbase/Random.h"
|
||||
#include "../eterlib/Pool.h"
|
||||
class CParticleInstance;
|
||||
|
||||
namespace NEffectUpdateDecorator
|
||||
{
|
||||
class CDecoratorData
|
||||
{
|
||||
public:
|
||||
float fTime;
|
||||
float fElapsedTime;
|
||||
CParticleInstance * pInstance;
|
||||
CDecoratorData(float fTime, float fElapsedTime, CParticleInstance * pInstance)
|
||||
: fTime(fTime), fElapsedTime(fElapsedTime), pInstance(pInstance)
|
||||
{}
|
||||
};
|
||||
class CBaseDecorator
|
||||
{
|
||||
friend class CParticleSystemData;
|
||||
public:
|
||||
CBaseDecorator() :m_NextDecorator(0), m_PrevDecorator(0) {}
|
||||
virtual ~CBaseDecorator(){}
|
||||
|
||||
void Excute(const CDecoratorData & d)
|
||||
{
|
||||
CBaseDecorator* pd = this;
|
||||
while(pd)
|
||||
{
|
||||
CBaseDecorator* pNextDecorator = pd->m_NextDecorator;
|
||||
pd->__Excute(d);
|
||||
pd = pNextDecorator;
|
||||
}
|
||||
}
|
||||
CBaseDecorator * AddChainFront(CBaseDecorator * pd)
|
||||
{
|
||||
pd->m_NextDecorator = this;
|
||||
m_PrevDecorator = pd;
|
||||
return pd;
|
||||
}
|
||||
void DeleteThis()
|
||||
{
|
||||
//return;
|
||||
if (m_NextDecorator)
|
||||
m_NextDecorator->DeleteThis();
|
||||
delete this;
|
||||
}
|
||||
CBaseDecorator * Clone(CParticleInstance* pFirstInstance, CParticleInstance* pInstance)
|
||||
{
|
||||
CBaseDecorator * pNewDecorator = __Clone(pFirstInstance, pInstance);
|
||||
CBaseDecorator * pSrc = this;
|
||||
CBaseDecorator * pDest = pNewDecorator;
|
||||
while (pSrc->m_NextDecorator)
|
||||
{
|
||||
pDest->m_NextDecorator = pSrc->m_NextDecorator->__Clone(pFirstInstance, pInstance);
|
||||
pDest->m_NextDecorator->m_PrevDecorator = pDest;
|
||||
|
||||
pSrc = pSrc->m_NextDecorator;
|
||||
pDest = pDest->m_NextDecorator;
|
||||
}
|
||||
return pNewDecorator;
|
||||
}
|
||||
protected:
|
||||
virtual void __Excute(const CDecoratorData & d) = 0;
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance* pFirstInstance, CParticleInstance* pInstance) = 0;
|
||||
void RemoveMe()
|
||||
{
|
||||
m_PrevDecorator->m_NextDecorator = m_NextDecorator;
|
||||
m_NextDecorator->m_PrevDecorator=m_PrevDecorator;
|
||||
delete this;
|
||||
}
|
||||
CBaseDecorator * m_NextDecorator;
|
||||
CBaseDecorator * m_PrevDecorator;
|
||||
};
|
||||
|
||||
class CHeaderDecorator : public CBaseDecorator, public CPooledObject<CHeaderDecorator>
|
||||
{
|
||||
public:
|
||||
CHeaderDecorator() {}
|
||||
virtual ~CHeaderDecorator() {}
|
||||
protected:
|
||||
virtual void __Excute(const CDecoratorData&) {}
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance*, CParticleInstance*) { return new CHeaderDecorator; }
|
||||
};
|
||||
|
||||
class CNullDecorator : public CBaseDecorator, public CPooledObject<CNullDecorator>
|
||||
{
|
||||
public:
|
||||
CNullDecorator(){}
|
||||
virtual ~CNullDecorator(){}
|
||||
|
||||
protected:
|
||||
virtual void __Excute(const CDecoratorData & d) {}
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance*, CParticleInstance* ) { return new CNullDecorator; }
|
||||
};
|
||||
|
||||
template <class T> class CTimeEventDecorator : public CBaseDecorator, public CPooledObject<CTimeEventDecorator<T> >
|
||||
{
|
||||
public:
|
||||
typedef CTimeEvent<T> TTimeEventType;
|
||||
typedef std::vector<TTimeEventType> TTimeEventContainerType;
|
||||
CTimeEventDecorator(const TTimeEventContainerType& TimeEventContainer, T * pValue = 0)
|
||||
: it_start(TimeEventContainer.begin()),
|
||||
it_cur(TimeEventContainer.begin()),
|
||||
it_next(TimeEventContainer.begin()),
|
||||
it_end(TimeEventContainer.end()),
|
||||
pData(pValue)
|
||||
{
|
||||
if (it_start == it_end)
|
||||
*pValue = T();
|
||||
else
|
||||
++it_next;
|
||||
}
|
||||
virtual ~CTimeEventDecorator() {}
|
||||
|
||||
void SetData( T * pValue ) { pData = pValue; }
|
||||
|
||||
protected:
|
||||
//CTimeEventDecorator(CTimeEventDecorator<T>& ted, CParticleInstance * pFirstInstance, CParticleInstance * pInstance);
|
||||
CTimeEventDecorator(CTimeEventDecorator<T>& ted, CParticleInstance* pFirstInstance, CParticleInstance* pInstance)
|
||||
: it_start(ted.it_start),
|
||||
it_end(ted.it_end),
|
||||
it_cur(ted.it_cur),
|
||||
it_next(ted.it_next),
|
||||
pData((T*)( (unsigned char*)ted.pData - (DWORD)pFirstInstance + (DWORD)pInstance))
|
||||
{
|
||||
if (it_start == it_end)
|
||||
*pData = T();
|
||||
}
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance* pFirstInstance, CParticleInstance* pInstance) { return new CTimeEventDecorator(*this, pFirstInstance, pInstance); }
|
||||
virtual void __Excute(const CDecoratorData & d)
|
||||
{
|
||||
if (it_start==it_end)
|
||||
{
|
||||
RemoveMe();
|
||||
}
|
||||
else if (it_cur->m_fTime>d.fTime)
|
||||
{
|
||||
*pData = it_cur->m_Value;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (it_next!=it_end && it_next->m_fTime<=d.fTime)
|
||||
++it_cur, ++it_next;
|
||||
if (it_next == it_end)
|
||||
{
|
||||
// setting value
|
||||
*pData = it_cur->m_Value;
|
||||
|
||||
RemoveMe();
|
||||
}
|
||||
else
|
||||
{
|
||||
float length = it_next->m_fTime - it_cur->m_fTime;
|
||||
//*pData = it_cur->m_Value + (it_next->m_Value - it_cur->m_Value)*(d.fTime-it_cur->m_fTime)/length;
|
||||
*pData = it_cur->m_Value*(1-(d.fTime-it_cur->m_fTime)/length) ;
|
||||
*pData += it_next->m_Value * ((d.fTime-it_cur->m_fTime)/length);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typename TTimeEventContainerType::const_iterator it_start;
|
||||
typename TTimeEventContainerType::const_iterator it_end;
|
||||
typename TTimeEventContainerType::const_iterator it_cur;
|
||||
typename TTimeEventContainerType::const_iterator it_next;
|
||||
T * pData;
|
||||
};
|
||||
|
||||
typedef CTimeEventDecorator<float> CScaleValueDecorator;
|
||||
typedef CTimeEventDecorator<float> CColorValueDecorator;
|
||||
typedef CTimeEventDecorator<DWORDCOLOR> CColorAllDecorator;
|
||||
typedef CTimeEventDecorator<float> CAirResistanceValueDecorator;
|
||||
typedef CTimeEventDecorator<float> CGravityValueDecorator;
|
||||
typedef CTimeEventDecorator<float> CRotationSpeedValueDecorator;
|
||||
|
||||
class CTextureAnimationCWDecorator : public CBaseDecorator, public CPooledObject<CTextureAnimationCWDecorator>
|
||||
{
|
||||
public:
|
||||
CTextureAnimationCWDecorator(float fFrameTime, DWORD n, BYTE * pIdx) :n(n),pIdx(pIdx),fFrameTime(fFrameTime),fLastFrameTime(fFrameTime){}
|
||||
virtual ~CTextureAnimationCWDecorator(){}
|
||||
protected:
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance* pfi, CParticleInstance* pi) { return new CTextureAnimationCWDecorator(fFrameTime,n,(BYTE*)((unsigned char*)pi+((BYTE*)pIdx-(BYTE*)pfi))); }
|
||||
virtual void __Excute(const CDecoratorData & d)
|
||||
{
|
||||
fLastFrameTime -= d.fElapsedTime;
|
||||
while (fLastFrameTime<0.0f)
|
||||
{
|
||||
fLastFrameTime += fFrameTime;
|
||||
if (++(*pIdx) >= n)
|
||||
*pIdx = 0;
|
||||
}
|
||||
}
|
||||
DWORD n;
|
||||
float fLastFrameTime;
|
||||
float fFrameTime;
|
||||
BYTE* pIdx;
|
||||
|
||||
};
|
||||
class CTextureAnimationCCWDecorator : public CBaseDecorator, public CPooledObject<CTextureAnimationCCWDecorator>
|
||||
{
|
||||
public:
|
||||
CTextureAnimationCCWDecorator(float fFrameTime, BYTE n, BYTE * pIdx) :n(n),pIdx(pIdx),fFrameTime(fFrameTime),fLastFrameTime(fFrameTime){}
|
||||
virtual ~CTextureAnimationCCWDecorator(){}
|
||||
protected:
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance* pfi, CParticleInstance* pi) { return new CTextureAnimationCCWDecorator(fFrameTime,n,(BYTE*)((unsigned char*)pi+((BYTE*)pIdx-(BYTE*)pfi))); }
|
||||
virtual void __Excute(const CDecoratorData & d)
|
||||
{
|
||||
fLastFrameTime -= d.fElapsedTime;
|
||||
while (fLastFrameTime<0.0f)
|
||||
{
|
||||
fLastFrameTime += fFrameTime;
|
||||
|
||||
if (--(*pIdx) >= n && n != 0) // Because variable is unsigned..
|
||||
*pIdx = BYTE(n - 1);
|
||||
}
|
||||
}
|
||||
BYTE n;
|
||||
float fLastFrameTime;
|
||||
float fFrameTime;
|
||||
BYTE* pIdx;
|
||||
|
||||
};
|
||||
class CTextureAnimationRandomDecorator : public CBaseDecorator, public CPooledObject<CTextureAnimationRandomDecorator>
|
||||
{
|
||||
public:
|
||||
CTextureAnimationRandomDecorator(float fFrameTime, BYTE n, BYTE * pIdx) :n(n),pIdx(pIdx),fFrameTime(fFrameTime),fLastFrameTime(fFrameTime){}
|
||||
virtual ~CTextureAnimationRandomDecorator(){}
|
||||
protected:
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance* pfi, CParticleInstance* pi) { return new CTextureAnimationRandomDecorator(fFrameTime,n,(BYTE*)((unsigned char*)pi+((BYTE*)pIdx-(BYTE*)pfi))); }
|
||||
virtual void __Excute(const CDecoratorData & d)
|
||||
{
|
||||
fLastFrameTime -= d.fElapsedTime;
|
||||
if (fLastFrameTime<0.0f && n!=0)
|
||||
{
|
||||
*pIdx = (BYTE)random_range(0,n-1);
|
||||
}
|
||||
while (fLastFrameTime<0.0f)
|
||||
fLastFrameTime += fFrameTime;
|
||||
}
|
||||
BYTE n;
|
||||
float fLastFrameTime;
|
||||
float fFrameTime;
|
||||
BYTE* pIdx;
|
||||
|
||||
};
|
||||
|
||||
class CAirResistanceDecorator : public CBaseDecorator, public CPooledObject<CAirResistanceDecorator>
|
||||
{
|
||||
public:
|
||||
CAirResistanceDecorator(){}
|
||||
virtual ~CAirResistanceDecorator(){}
|
||||
|
||||
protected:
|
||||
virtual void __Excute(const CDecoratorData & d);
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance* pfi, CParticleInstance* pi);
|
||||
};
|
||||
|
||||
class CGravityDecorator : public CBaseDecorator, public CPooledObject<CGravityDecorator>
|
||||
{
|
||||
public:
|
||||
CGravityDecorator(){}
|
||||
virtual ~CGravityDecorator(){}
|
||||
protected:
|
||||
virtual void __Excute(const CDecoratorData& d);
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance* pfi, CParticleInstance* pi);
|
||||
};
|
||||
|
||||
class CRotationDecorator : public CBaseDecorator, public CPooledObject<CRotationDecorator>
|
||||
{
|
||||
public:
|
||||
CRotationDecorator(){}
|
||||
virtual ~CRotationDecorator()
|
||||
{
|
||||
}
|
||||
protected:
|
||||
virtual void __Excute(const CDecoratorData& d);
|
||||
virtual CBaseDecorator* __Clone(CParticleInstance* pfi, CParticleInstance* pi) ;
|
||||
};
|
||||
|
||||
}
|
102
src/EffectLib/EmitterProperty.cpp
Normal file
102
src/EffectLib/EmitterProperty.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
95
src/EffectLib/EmitterProperty.h
Normal file
95
src/EffectLib/EmitterProperty.h
Normal file
@ -0,0 +1,95 @@
|
||||
#pragma once
|
||||
|
||||
#include "Type.h"
|
||||
|
||||
class CEmitterProperty
|
||||
{
|
||||
friend class CParticleSystemData;
|
||||
friend class CParticleSystemInstance;
|
||||
public:
|
||||
enum
|
||||
{
|
||||
EMITTER_SHAPE_POINT,
|
||||
EMITTER_SHAPE_ELLIPSE,
|
||||
EMITTER_SHAPE_SQUARE,
|
||||
EMITTER_SHAPE_SPHERE,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
EMITTER_ADVANCED_TYPE_FREE,
|
||||
EMITTER_ADVANCED_TYPE_OUTER,
|
||||
EMITTER_ADVANCED_TYPE_INNER,
|
||||
};
|
||||
|
||||
public:
|
||||
CEmitterProperty();
|
||||
virtual ~CEmitterProperty();
|
||||
|
||||
void Clear();
|
||||
|
||||
DWORD GetMaxEmissionCount()
|
||||
{
|
||||
return m_dwMaxEmissionCount;
|
||||
}
|
||||
|
||||
float GetCycleLength()
|
||||
{
|
||||
return m_fCycleLength;
|
||||
}
|
||||
|
||||
BOOL isCycleLoop()
|
||||
{
|
||||
return m_bCycleLoopFlag;
|
||||
}
|
||||
|
||||
int GetLoopCount()
|
||||
{
|
||||
return m_iLoopCount;
|
||||
}
|
||||
|
||||
|
||||
BYTE GetEmitterShape();
|
||||
BYTE GetEmitterAdvancedType();
|
||||
BOOL isEmitFromEdge();
|
||||
|
||||
void GetEmittingSize(float fTime, float * pfValue);
|
||||
void GetEmittingAngularVelocity(float fTime, float * pfValue);
|
||||
|
||||
void GetEmittingDirectionX(float fTime, float * pfValue);
|
||||
void GetEmittingDirectionY(float fTime, float * pfValue);
|
||||
void GetEmittingDirectionZ(float fTime, float * pfValue);
|
||||
void GetEmittingVelocity(float fTime, float * pfValue);
|
||||
void GetEmissionCountPerSecond(float fTime, float * pfValue);
|
||||
void GetParticleLifeTime(float fTime, float * pfValue);
|
||||
void GetParticleSizeX(float fTime, float * pfValue);
|
||||
void GetParticleSizeY(float fTime, float * pfValue);
|
||||
|
||||
/////
|
||||
|
||||
DWORD m_dwMaxEmissionCount;
|
||||
|
||||
float m_fCycleLength;
|
||||
BOOL m_bCycleLoopFlag;
|
||||
int m_iLoopCount;
|
||||
|
||||
BYTE m_byEmitterShape;
|
||||
BYTE m_byEmitterAdvancedType;
|
||||
BOOL m_bEmitFromEdgeFlag;
|
||||
D3DXVECTOR3 m_v3EmittingSize;
|
||||
float m_fEmittingRadius;
|
||||
|
||||
D3DXVECTOR3 m_v3EmittingDirection;
|
||||
|
||||
//TTimeEventTableFloat m_TimeEventEmittingRadius;
|
||||
TTimeEventTableFloat m_TimeEventEmittingSize;
|
||||
TTimeEventTableFloat m_TimeEventEmittingAngularVelocity;
|
||||
TTimeEventTableFloat m_TimeEventEmittingDirectionX;
|
||||
TTimeEventTableFloat m_TimeEventEmittingDirectionY;
|
||||
TTimeEventTableFloat m_TimeEventEmittingDirectionZ;
|
||||
TTimeEventTableFloat m_TimeEventEmittingVelocity;
|
||||
TTimeEventTableFloat m_TimeEventEmissionCountPerSecond;
|
||||
TTimeEventTableFloat m_TimeEventLifeTime;
|
||||
TTimeEventTableFloat m_TimeEventSizeX;
|
||||
TTimeEventTableFloat m_TimeEventSizeY;
|
||||
};
|
106
src/EffectLib/FrameController.cpp
Normal file
106
src/EffectLib/FrameController.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
38
src/EffectLib/FrameController.h
Normal file
38
src/EffectLib/FrameController.h
Normal file
@ -0,0 +1,38 @@
|
||||
#pragma once
|
||||
|
||||
class CFrameController
|
||||
{
|
||||
public:
|
||||
CFrameController();
|
||||
virtual ~CFrameController();
|
||||
|
||||
void Clear();
|
||||
|
||||
void Update(float fElapsedTime);
|
||||
|
||||
void SetCurrentFrame(DWORD dwFrame);
|
||||
BYTE GetCurrentFrame();
|
||||
|
||||
void SetMaxFrame(DWORD dwMaxFrame);
|
||||
void SetFrameTime(float fTime);
|
||||
void SetStartFrame(DWORD dwStartFrame);
|
||||
void SetLoopFlag(BOOL bFlag);
|
||||
void SetLoopCount(int iLoopCount);
|
||||
|
||||
void SetActive(BOOL bFlag);
|
||||
BOOL isActive(DWORD dwMainFrame = 0);
|
||||
|
||||
protected:
|
||||
// Dynamic
|
||||
BOOL m_isActive;
|
||||
DWORD m_dwcurFrame;
|
||||
float m_fLastFrameTime;
|
||||
|
||||
int m_iLoopCount;
|
||||
|
||||
// Static
|
||||
BOOL m_isLoop;
|
||||
DWORD m_dwMaxFrame;
|
||||
float m_fFrameTime;
|
||||
DWORD m_dwStartFrame;
|
||||
};
|
513
src/EffectLib/ParticleInstance.cpp
Normal file
513
src/EffectLib/ParticleInstance.cpp
Normal file
@ -0,0 +1,513 @@
|
||||
#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;
|
||||
D3DXVec3Cross(&v3Cross, &v3Up, &D3DXVECTOR3(c_rv3View.x,c_rv3View.y,0));
|
||||
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<72><61> Up Vector<6F><72> Cross Vector <20><>ü<EFBFBD><C3BC> View Vector <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Rotation <20><>Ų<EFBFBD><C5B2>.
|
||||
// FIXME : <20>ݵ<EFBFBD><DDB5><EFBFBD> <20><><EFBFBD><EFBFBD>ȭ <20><> <20><>!
|
||||
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: <20>ӵ<EFBFBD><D3B5><EFBFBD> <20><><EFBFBD>̿<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> : log(velocity)<29><>ŭ <20>þ<C3BE><EEB3AD>.
|
||||
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;
|
||||
D3DXVec3Cross(&v3Cross, &v3Up, &D3DXVECTOR3(c_rv3View.x,c_rv3View.y,0));
|
||||
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<72><61> Up Vector<6F><72> Cross Vector <20><>ü<EFBFBD><C3BC> View Vector <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
// Rotation <20><>Ų<EFBFBD><C5B2>.
|
||||
// FIXME : <20>ݵ<EFBFBD><DDB5><EFBFBD> <20><><EFBFBD><EFBFBD>ȭ <20><> <20><>!
|
||||
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));
|
||||
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: <20>ӵ<EFBFBD><D3B5><EFBFBD> <20><><EFBFBD>̿<EFBFBD> <20>ִ<EFBFBD> <20><><EFBFBD><EFBFBD> : log(velocity)<29><>ŭ <20>þ<C3BE><EEB3AD>.
|
||||
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");
|
||||
}*/
|
91
src/EffectLib/ParticleInstance.h
Normal file
91
src/EffectLib/ParticleInstance.h
Normal file
@ -0,0 +1,91 @@
|
||||
#pragma once
|
||||
|
||||
#include "../eterlib/GrpBase.h"
|
||||
#include "../eterLib/Pool.h"
|
||||
#include "EffectUpdateDecorator.h"
|
||||
class CParticleProperty;
|
||||
class CEmitterProperty;
|
||||
|
||||
class CParticleInstance
|
||||
{
|
||||
friend class CParticleSystemData;
|
||||
friend class CParticleSystemInstance;
|
||||
|
||||
friend class NEffectUpdateDecorator::CBaseDecorator;
|
||||
friend class NEffectUpdateDecorator::CAirResistanceDecorator;
|
||||
friend class NEffectUpdateDecorator::CGravityDecorator;
|
||||
friend class NEffectUpdateDecorator::CRotationDecorator;
|
||||
|
||||
public:
|
||||
CParticleInstance();
|
||||
~CParticleInstance();
|
||||
|
||||
float GetRadiusApproximation();
|
||||
|
||||
BOOL Update(float fElapsedTime, float fAngle);
|
||||
//virtual void Transform(const D3DXMATRIX * c_matLocal, const float c_fZRotation)=0;
|
||||
//virtual void Transform(const D3DXMATRIX * c_matLocal = NULL)=0;
|
||||
|
||||
//virtual TPTVertex * GetParticleMeshPointer() = 0;
|
||||
|
||||
//__forceinline float GetLifePercentage()
|
||||
//{
|
||||
// return m_fLifePercentage;
|
||||
//return (m_fLifeTime - m_fLastLifeTime) / m_fLifeTime;
|
||||
//}
|
||||
|
||||
//virtual void DeleteThis() = 0;
|
||||
|
||||
protected:
|
||||
//float m_fLifePercentage;
|
||||
D3DXVECTOR3 m_v3StartPosition;
|
||||
|
||||
D3DXVECTOR3 m_v3Position;
|
||||
D3DXVECTOR3 m_v3LastPosition;
|
||||
D3DXVECTOR3 m_v3Velocity;
|
||||
|
||||
D3DXVECTOR2 m_v2HalfSize;
|
||||
D3DXVECTOR2 m_v2Scale;
|
||||
|
||||
float m_fRotation;
|
||||
#ifdef WORLD_EDITOR
|
||||
D3DXCOLOR m_Color;
|
||||
#else
|
||||
DWORDCOLOR m_dcColor;
|
||||
#endif
|
||||
|
||||
BYTE m_byTextureAnimationType;
|
||||
float m_fLastFrameTime;
|
||||
BYTE m_byFrameIndex;
|
||||
|
||||
float m_fLifeTime;
|
||||
float m_fLastLifeTime;
|
||||
|
||||
CParticleProperty * m_pParticleProperty;
|
||||
CEmitterProperty * m_pEmitterProperty;
|
||||
|
||||
float m_fAirResistance;
|
||||
float m_fRotationSpeed;
|
||||
float m_fGravity;
|
||||
|
||||
NEffectUpdateDecorator::CBaseDecorator * m_pDecorator;
|
||||
public:
|
||||
static CParticleInstance* New();
|
||||
static void DestroySystem();
|
||||
|
||||
void Transform(const D3DXMATRIX * c_matLocal=NULL);
|
||||
void Transform(const D3DXMATRIX * c_matLocal, const float c_fZRotation);
|
||||
|
||||
TPTVertex * GetParticleMeshPointer();
|
||||
|
||||
void DeleteThis();
|
||||
|
||||
void Destroy();
|
||||
|
||||
protected:
|
||||
void __Initialize();
|
||||
TPTVertex m_ParticleMesh[4];
|
||||
public:
|
||||
static CDynamicPool<CParticleInstance> ms_kPool;
|
||||
|
||||
};
|
121
src/EffectLib/ParticleProperty.cpp
Normal file
121
src/EffectLib/ParticleProperty.cpp
Normal file
@ -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;
|
||||
}
|
96
src/EffectLib/ParticleProperty.h
Normal file
96
src/EffectLib/ParticleProperty.h
Normal file
@ -0,0 +1,96 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include "../eterlib/GrpImageInstance.h"
|
||||
|
||||
#include "Type.h"
|
||||
|
||||
class CParticleProperty
|
||||
{
|
||||
friend class CParticleSystemData;
|
||||
friend class CParticleSystemInstance;
|
||||
public:
|
||||
enum
|
||||
{
|
||||
ROTATION_TYPE_NONE,
|
||||
ROTATION_TYPE_TIME_EVENT,
|
||||
ROTATION_TYPE_CW,
|
||||
ROTATION_TYPE_CCW,
|
||||
ROTATION_TYPE_RANDOM_DIRECTION,
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
TEXTURE_ANIMATION_TYPE_NONE,
|
||||
TEXTURE_ANIMATION_TYPE_CW,
|
||||
TEXTURE_ANIMATION_TYPE_CCW,
|
||||
TEXTURE_ANIMATION_TYPE_RANDOM_FRAME,
|
||||
TEXTURE_ANIMATION_TYPE_RANDOM_DIRECTION,
|
||||
};
|
||||
|
||||
public:
|
||||
CParticleProperty();
|
||||
virtual ~CParticleProperty();
|
||||
|
||||
void Clear();
|
||||
|
||||
void InsertTexture(const char * c_szFileName);
|
||||
bool SetTexture(const char * c_szFileName);
|
||||
|
||||
__forceinline BYTE GetTextureAnimationType()
|
||||
{
|
||||
return m_byTexAniType;
|
||||
}
|
||||
|
||||
__forceinline DWORD GetTextureAnimationFrameCount()
|
||||
{
|
||||
return m_ImageVector.size();
|
||||
}
|
||||
|
||||
__forceinline float GetTextureAnimationFrameDelay()
|
||||
{
|
||||
return m_fTexAniDelay;
|
||||
}
|
||||
|
||||
|
||||
BYTE m_byTexAniType;
|
||||
float m_fTexAniDelay;
|
||||
BOOL m_bTexAniRandomStartFrameFlag;
|
||||
|
||||
BYTE m_bySrcBlendType;
|
||||
BYTE m_byDestBlendType;
|
||||
BYTE m_byColorOperationType;
|
||||
BYTE m_byBillboardType;
|
||||
|
||||
BYTE m_byRotationType;
|
||||
float m_fRotationSpeed;
|
||||
WORD m_wRotationRandomStartingBegin;
|
||||
WORD m_wRotationRandomStartingEnd;
|
||||
|
||||
BOOL m_bAttachFlag;
|
||||
BOOL m_bStretchFlag;
|
||||
|
||||
TTimeEventTableFloat m_TimeEventGravity;
|
||||
TTimeEventTableFloat m_TimeEventAirResistance;
|
||||
|
||||
TTimeEventTableFloat m_TimeEventScaleX;
|
||||
TTimeEventTableFloat m_TimeEventScaleY;
|
||||
#ifdef WORLD_EDITOR
|
||||
TTimeEventTableFloat m_TimeEventColorRed;
|
||||
TTimeEventTableFloat m_TimeEventColorGreen;
|
||||
TTimeEventTableFloat m_TimeEventColorBlue;
|
||||
TTimeEventTableFloat m_TimeEventAlpha;
|
||||
|
||||
std::vector<std::string> m_TextureNameVector;
|
||||
#else
|
||||
TTimeEventTableColor m_TimeEventColor;
|
||||
#endif
|
||||
TTimeEventTableFloat m_TimeEventRotation;
|
||||
|
||||
std::vector<CGraphicImage*> m_ImageVector;
|
||||
|
||||
CParticleProperty & operator = ( const CParticleProperty& c_ParticleProperty );
|
||||
|
||||
// pre-transformed variables
|
||||
D3DXVECTOR3 m_v3ZAxis;
|
||||
};
|
424
src/EffectLib/ParticleSystemData.cpp
Normal file
424
src/EffectLib/ParticleSystemData.cpp
Normal file
@ -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()
|
||||
{
|
||||
}
|
41
src/EffectLib/ParticleSystemData.h
Normal file
41
src/EffectLib/ParticleSystemData.h
Normal file
@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#include "../eterLib/TextFileLoader.h"
|
||||
|
||||
#include "EffectElementBase.h"
|
||||
#include "EmitterProperty.h"
|
||||
#include "ParticleProperty.h"
|
||||
//#include "ParticleInstance.h"
|
||||
|
||||
class CParticleInstance;
|
||||
|
||||
class CParticleSystemData : public CEffectElementBase
|
||||
{
|
||||
public:
|
||||
virtual ~CParticleSystemData();
|
||||
CParticleSystemData();
|
||||
|
||||
CEmitterProperty * GetEmitterPropertyPointer();
|
||||
CParticleProperty * GetParticlePropertyPointer();
|
||||
|
||||
void ChangeTexture(const char * c_szFileName);
|
||||
|
||||
void BuildDecorator(CParticleInstance * pInstance);
|
||||
protected:
|
||||
BOOL OnLoadScript(CTextFileLoader & rTextFileLoader);
|
||||
|
||||
void OnClear();
|
||||
bool OnIsData();
|
||||
|
||||
|
||||
CEmitterProperty m_EmitterProperty;
|
||||
CParticleProperty m_ParticleProperty;
|
||||
|
||||
public:
|
||||
static void DestroySystem();
|
||||
|
||||
static CParticleSystemData* New();
|
||||
static void Delete(CParticleSystemData* pkData);
|
||||
|
||||
static CDynamicPool<CParticleSystemData> ms_kPool;
|
||||
};
|
519
src/EffectLib/ParticleSystemInstance.cpp
Normal file
519
src/EffectLib/ParticleSystemInstance.cpp
Normal file
@ -0,0 +1,519 @@
|
||||
#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<74><65> ȣ<><C8A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʰ<EFBFBD> Rendering <20>DZ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> length<74><68> 0<><30> <20>Ǵ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ִ<EFBFBD>.
|
||||
// Velocity<74><79> <20><><EFBFBD><EFBFBD> <20><> <20><EFBFBD>ŭ <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ʱ<EFBFBD>ȭ <20><><EFBFBD>ֵ<EFBFBD><D6B5><EFBFBD> <20>ٲ<EFBFBD><D9B2><EFBFBD> - [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())
|
||||
{
|
||||
D3DXVec3Normalize(&pInstance->m_v3Velocity, &(pInstance->m_v3Position-v3TimePosition));
|
||||
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
|
||||
{
|
||||
D3DXVec3Normalize(&pInstance->m_v3Velocity, &(pInstance->m_v3Position-v3TimePosition));
|
||||
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 <20><> <20><><EFBFBD><EFBFBD> LocalMatrix <20><> Rotation <20><><EFBFBD><EFBFBD> Random <20><> <20><><EFBFBD><EFBFBD><EFBFBD>Ѵ<EFBFBD>.
|
||||
// <20>Ź<EFBFBD> <20><> <20>ʿ<EFBFBD><CABF><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>. <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>ȭ<EFBFBD><C8AD> <20>ʿ<EFBFBD>. - [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)
|
||||
{
|
||||
D3DXVec3TransformNormal(&m_pParticleProperty->m_v3ZAxis,&D3DXVECTOR3(0.0f,0.0f,1.0f),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)
|
||||
{
|
||||
ForEachParticleRendering(NParticleRenderer::NormalRenderer());
|
||||
}
|
||||
else
|
||||
{
|
||||
ForEachParticleRendering(NParticleRenderer::AttachRenderer(mc_pmatLocal));
|
||||
}
|
||||
}
|
||||
else if (m_pParticleProperty->m_byBillboardType == BILLBOARD_TYPE_2FACE)
|
||||
{
|
||||
if (!m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
ForEachParticleRendering(NParticleRenderer::TwoSideRenderer());
|
||||
}
|
||||
else
|
||||
{
|
||||
ForEachParticleRendering(NParticleRenderer::TwoSideRenderer(mc_pmatLocal));
|
||||
}
|
||||
}
|
||||
else if (m_pParticleProperty->m_byBillboardType == BILLBOARD_TYPE_3FACE)
|
||||
{
|
||||
if (!m_pParticleProperty->m_bAttachFlag)
|
||||
{
|
||||
ForEachParticleRendering(NParticleRenderer::ThreeSideRenderer());
|
||||
}
|
||||
else
|
||||
{
|
||||
ForEachParticleRendering(NParticleRenderer::ThreeSideRenderer(mc_pmatLocal));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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. <20><>ƼŬ <20><><EFBFBD><EFBFBD> <20><>ƾ
|
||||
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());
|
||||
}
|
85
src/EffectLib/ParticleSystemInstance.h
Normal file
85
src/EffectLib/ParticleSystemInstance.h
Normal file
@ -0,0 +1,85 @@
|
||||
#pragma once
|
||||
|
||||
#include "EffectElementBaseInstance.h"
|
||||
#include "ParticleInstance.h"
|
||||
#include "ParticleProperty.h"
|
||||
|
||||
#include "../eterlib/GrpScreen.h"
|
||||
#include "../eterlib/StateManager.h"
|
||||
#include "../eterLib/GrpImageInstance.h"
|
||||
#include "EmitterProperty.h"
|
||||
|
||||
class CParticleSystemInstance : public CEffectElementBaseInstance
|
||||
{
|
||||
public:
|
||||
static void DestroySystem();
|
||||
|
||||
static CParticleSystemInstance* New();
|
||||
static void Delete(CParticleSystemInstance* pkData);
|
||||
|
||||
static CDynamicPool<CParticleSystemInstance> ms_kPool;
|
||||
|
||||
public:
|
||||
template <typename T>
|
||||
inline void ForEachParticleRendering(T & FunObj)
|
||||
{
|
||||
DWORD dwFrameIndex;
|
||||
for(dwFrameIndex=0; dwFrameIndex<m_kVct_pkImgInst.size(); dwFrameIndex++)
|
||||
{
|
||||
STATEMANAGER.SetTexture(0, m_kVct_pkImgInst[dwFrameIndex]->GetTextureReference().GetD3DTexture());
|
||||
TParticleInstanceList::iterator itor = m_ParticleInstanceListVector[dwFrameIndex].begin();
|
||||
for (; itor != m_ParticleInstanceListVector[dwFrameIndex].end(); ++itor)
|
||||
{
|
||||
if (!InFrustum(*itor))
|
||||
return;
|
||||
FunObj(*itor);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CParticleSystemInstance();
|
||||
virtual ~CParticleSystemInstance();
|
||||
|
||||
void OnSetDataPointer(CEffectElementBase * pElement);
|
||||
|
||||
void CreateParticles(float fElapsedTime);
|
||||
|
||||
inline bool InFrustum(CParticleInstance * pInstance)
|
||||
{
|
||||
if (m_pParticleProperty->m_bAttachFlag)
|
||||
return CScreen::GetFrustum().ViewVolumeTest(Vector3d(
|
||||
pInstance->m_v3Position.x + mc_pmatLocal->_41,
|
||||
pInstance->m_v3Position.y + mc_pmatLocal->_42,
|
||||
pInstance->m_v3Position.z + mc_pmatLocal->_43
|
||||
),pInstance->GetRadiusApproximation())!=VS_OUTSIDE;
|
||||
else
|
||||
return CScreen::GetFrustum().ViewVolumeTest(Vector3d(pInstance->m_v3Position.x,pInstance->m_v3Position.y,pInstance->m_v3Position.z),pInstance->GetRadiusApproximation())!=VS_OUTSIDE;
|
||||
}
|
||||
|
||||
DWORD GetEmissionCount();
|
||||
|
||||
protected:
|
||||
void OnInitialize();
|
||||
void OnDestroy();
|
||||
|
||||
bool OnUpdate(float fElapsedTime);
|
||||
void OnRender();
|
||||
|
||||
protected:
|
||||
float m_fEmissionResidue;
|
||||
|
||||
DWORD m_dwCurrentEmissionCount;
|
||||
int m_iLoopCount;
|
||||
|
||||
typedef std::list<CParticleInstance*> TParticleInstanceList;
|
||||
typedef std::vector<TParticleInstanceList> TParticleInstanceListVector;
|
||||
TParticleInstanceListVector m_ParticleInstanceListVector;
|
||||
|
||||
typedef std::vector<CGraphicImageInstance*> TImageInstanceVector;
|
||||
TImageInstanceVector m_kVct_pkImgInst;
|
||||
|
||||
CParticleSystemData * m_pData;
|
||||
|
||||
CParticleProperty * m_pParticleProperty;
|
||||
CEmitterProperty * m_pEmitterProperty;
|
||||
};
|
164
src/EffectLib/SimpleLightData.cpp
Normal file
164
src/EffectLib/SimpleLightData.cpp
Normal file
@ -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);
|
||||
}
|
57
src/EffectLib/SimpleLightData.h
Normal file
57
src/EffectLib/SimpleLightData.h
Normal file
@ -0,0 +1,57 @@
|
||||
#pragma once
|
||||
|
||||
#include <d3dx8.h>
|
||||
|
||||
#include "../eterLib/TextFileLoader.h"
|
||||
|
||||
#include "Type.h"
|
||||
#include "EffectElementBase.h"
|
||||
|
||||
class CLightData : public CEffectElementBase
|
||||
{
|
||||
friend class CLightInstance;
|
||||
public:
|
||||
CLightData();
|
||||
virtual ~CLightData();
|
||||
|
||||
void GetRange(float fTime, float& rRange);
|
||||
float GetDuration();
|
||||
BOOL isLoop()
|
||||
{
|
||||
return m_bLoopFlag;
|
||||
}
|
||||
int GetLoopCount()
|
||||
{
|
||||
return m_iLoopCount;
|
||||
}
|
||||
void InitializeLight(D3DLIGHT8& light);
|
||||
|
||||
protected:
|
||||
void OnClear();
|
||||
bool OnIsData();
|
||||
|
||||
BOOL OnLoadScript(CTextFileLoader & rTextFileLoader);
|
||||
|
||||
protected:
|
||||
float m_fMaxRange;
|
||||
float m_fDuration;
|
||||
TTimeEventTableFloat m_TimeEventTableRange;
|
||||
|
||||
D3DXCOLOR m_cAmbient;
|
||||
D3DXCOLOR m_cDiffuse;
|
||||
|
||||
BOOL m_bLoopFlag;
|
||||
int m_iLoopCount;
|
||||
|
||||
float m_fAttenuation0;
|
||||
float m_fAttenuation1;
|
||||
float m_fAttenuation2;
|
||||
|
||||
public:
|
||||
static void DestroySystem();
|
||||
|
||||
static CLightData* New();
|
||||
static void Delete(CLightData* pkData);
|
||||
|
||||
static CDynamicPool<CLightData> ms_kPool;
|
||||
};
|
138
src/EffectLib/SimpleLightInstance.cpp
Normal file
138
src/EffectLib/SimpleLightInstance.cpp
Normal file
@ -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();
|
||||
}
|
39
src/EffectLib/SimpleLightInstance.h
Normal file
39
src/EffectLib/SimpleLightInstance.h
Normal file
@ -0,0 +1,39 @@
|
||||
#pragma once
|
||||
|
||||
#include "../eterLib/GrpScreen.h"
|
||||
|
||||
#include "EffectElementBaseInstance.h"
|
||||
#include "SimpleLightData.h"
|
||||
|
||||
class CLightInstance : public CEffectElementBaseInstance
|
||||
{
|
||||
public:
|
||||
friend class CLightData;
|
||||
|
||||
CLightInstance();
|
||||
virtual ~CLightInstance();
|
||||
|
||||
protected:
|
||||
|
||||
void OnSetDataPointer(CEffectElementBase * pElement);
|
||||
|
||||
void OnInitialize();
|
||||
void OnDestroy();
|
||||
|
||||
bool OnUpdate(float fElapsedTime);
|
||||
void OnRender();
|
||||
|
||||
DWORD m_LightID;
|
||||
CLightData * m_pData;
|
||||
DWORD m_dwRangeIndex;
|
||||
|
||||
DWORD m_iLoopCount;
|
||||
|
||||
public:
|
||||
static void DestroySystem();
|
||||
|
||||
static CLightInstance* New();
|
||||
static void Delete(CLightInstance* pkData);
|
||||
|
||||
static CDynamicPool<CLightInstance> ms_kPool;
|
||||
};
|
2
src/EffectLib/StdAfx.cpp
Normal file
2
src/EffectLib/StdAfx.cpp
Normal file
@ -0,0 +1,2 @@
|
||||
#include "StdAfx.h"
|
||||
|
40
src/EffectLib/StdAfx.h
Normal file
40
src/EffectLib/StdAfx.h
Normal file
@ -0,0 +1,40 @@
|
||||
#pragma once
|
||||
|
||||
//#include <crtdbg.h>
|
||||
|
||||
#include "../eterBase/StdAfx.h"
|
||||
|
||||
#include "../eterBase/Utils.h"
|
||||
#include "../eterBase/Timer.h"
|
||||
#include "../eterBase/CRC32.h"
|
||||
#include "../eterBase/Debug.h"
|
||||
|
||||
#include "../eterLib/StdAfx.h"
|
||||
#include "../eterLib/TextFileLoader.h"
|
||||
|
||||
#include "../milesLib/StdAfx.h"
|
||||
|
||||
/*
|
||||
#include "FrameController.h"
|
||||
|
||||
#include "EffectElementBase.h"
|
||||
#include "EffectElementBaseInstance.h"
|
||||
|
||||
#include "ParticleProperty.h"
|
||||
#include "ParticleInstance.h"
|
||||
#include "EmitterProperty.h"
|
||||
|
||||
#include "ParticleSystemData.h"
|
||||
#include "ParticleSystemInstance.h"
|
||||
|
||||
#include "EffectMesh.h"
|
||||
#include "EffectMeshInstance.h"
|
||||
|
||||
#include "SimpleLightData.h"
|
||||
#include "SimpleLightInstance.h"
|
||||
|
||||
#include "EffectData.h"
|
||||
#include "EffectInstance.h"
|
||||
|
||||
#include "EffectManager.h"
|
||||
*/
|
38
src/EffectLib/Type.cpp
Normal file
38
src/EffectLib/Type.cpp
Normal file
@ -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);
|
||||
}
|
283
src/EffectLib/Type.h
Normal file
283
src/EffectLib/Type.h
Normal file
@ -0,0 +1,283 @@
|
||||
#pragma once
|
||||
|
||||
#define Clamp(x, min, max) x = (x<min ? min : x<max ? x : max);
|
||||
#define GRAVITY D3DXVECTOR3(0.0f, 0.0f, -9.8f)
|
||||
|
||||
#define MAX_FRAME 20
|
||||
#define MAX_TEXTURE 20
|
||||
|
||||
typedef struct _FVF_POINT
|
||||
{
|
||||
float x, y, z;
|
||||
} FVF_POINT;
|
||||
|
||||
#ifndef D3DFVF_POINT
|
||||
#define D3DFVF_POINT (D3DFVF_XYZ)
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct _FVF_PT
|
||||
{
|
||||
float x, y, z;
|
||||
float tu, tv;
|
||||
} FVF_PT;
|
||||
|
||||
#ifndef D3DFVF_PT
|
||||
#define D3DFVF_PT (D3DFVF_XYZ|D3DFVF_TEX1)
|
||||
#endif
|
||||
|
||||
typedef struct _FVF_PDT
|
||||
{
|
||||
float x, y, z;
|
||||
DWORD color;
|
||||
float tu, tv;
|
||||
} FVF_PDT;
|
||||
|
||||
#ifndef D3DFVF_PDT
|
||||
#define D3DFVF_PDT (D3DFVF_XYZ|D3DFVF_DIFFUSE|D3DFVF_TEX1)
|
||||
#endif
|
||||
|
||||
inline FVF_PDT _FVF_PDT(float x, float y, float z, DWORD dif, float u, float v)
|
||||
{
|
||||
FVF_PDT result;
|
||||
result.x = x; result.y = y; result.z = z; result.color = dif; result.tu = u; result.tv = v;
|
||||
return result;
|
||||
}
|
||||
|
||||
enum EEffectType
|
||||
{
|
||||
EFFECT_TYPE_PARTICLE = 1,
|
||||
EFFECT_TYPE_ANIMATION_TEXTURE = 2,
|
||||
EFFECT_TYPE_MESH = 3,
|
||||
EFFECT_TYPE_SIMPLE_LIGHT = 4,
|
||||
};
|
||||
|
||||
|
||||
|
||||
enum EMeshBillBoardType
|
||||
{
|
||||
MESH_BILLBOARD_TYPE_NONE,
|
||||
|
||||
MESH_BILLBOARD_TYPE_ALL,
|
||||
MESH_BILLBOARD_TYPE_Y,
|
||||
|
||||
MESH_BILLBOARD_TYPE_MOVE
|
||||
};
|
||||
|
||||
enum EBillBoardType
|
||||
{
|
||||
BILLBOARD_TYPE_NONE,
|
||||
|
||||
BILLBOARD_TYPE_ALL,
|
||||
BILLBOARD_TYPE_Y,
|
||||
|
||||
BILLBOARD_TYPE_LIE, // <20>ٴڿ<D9B4> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD>
|
||||
|
||||
BILLBOARD_TYPE_2FACE, // / and \
|
||||
BILLBOARD_TYPE_3FACE, // / and \ and -
|
||||
|
||||
//BILLBOARD_TYPE_RAY, // <20>ܻ<EFBFBD>
|
||||
|
||||
};
|
||||
|
||||
enum EMovingType
|
||||
{
|
||||
MOVING_TYPE_DIRECT,
|
||||
MOVING_TYPE_BEZIER_CURVE,
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
typedef struct SEffectPosition
|
||||
{
|
||||
float m_fTime;
|
||||
|
||||
D3DXVECTOR3 m_vecPosition;
|
||||
|
||||
// For Bezier Curve
|
||||
int m_iMovingType;
|
||||
D3DXVECTOR3 m_vecControlPoint;
|
||||
|
||||
} TEffectPosition;
|
||||
|
||||
inline bool operator < (const SEffectPosition & lhs, const SEffectPosition & rhs)
|
||||
{
|
||||
return lhs.m_fTime < rhs.m_fTime;
|
||||
}
|
||||
inline bool operator < (const float & lhs, const SEffectPosition & rhs)
|
||||
{
|
||||
return lhs < rhs.m_fTime;
|
||||
}
|
||||
inline bool operator < (const SEffectPosition & lhs, const float & rhs)
|
||||
{
|
||||
return lhs.m_fTime < rhs;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
class CTimeEvent
|
||||
{
|
||||
public:
|
||||
CTimeEvent(){}
|
||||
~CTimeEvent(){}
|
||||
|
||||
float m_fTime;
|
||||
T m_Value;
|
||||
};
|
||||
#define AG_MASK 0xff00ff00
|
||||
#define RB_MASK 0x00ff00ff
|
||||
|
||||
struct DWORDCOLOR
|
||||
{
|
||||
DWORD m_dwColor;
|
||||
|
||||
DWORDCOLOR()
|
||||
{
|
||||
}
|
||||
DWORDCOLOR(const DWORDCOLOR& r)
|
||||
: m_dwColor(r.m_dwColor)
|
||||
{}
|
||||
|
||||
DWORDCOLOR& operator = (const DWORDCOLOR& r)
|
||||
{
|
||||
m_dwColor = r.m_dwColor;
|
||||
return *this;
|
||||
}
|
||||
|
||||
DWORDCOLOR& operator *= (float f)
|
||||
{
|
||||
DWORD idx = DWORD(f * 256);
|
||||
m_dwColor =
|
||||
(((DWORD)(((m_dwColor & AG_MASK)>>8) * idx)) & AG_MASK)
|
||||
+((DWORD)(((m_dwColor & RB_MASK) * idx)>>8) & RB_MASK);
|
||||
//m_dwColor =
|
||||
// ((DWORD)((m_dwColor & AG_MASK) * f) & AG_MASK)
|
||||
// +((DWORD)((m_dwColor & RB_MASK) * f) & RB_MASK);
|
||||
return *this;
|
||||
}
|
||||
DWORDCOLOR& operator += (const DWORDCOLOR& r)
|
||||
{
|
||||
m_dwColor += r.m_dwColor;
|
||||
return *this;
|
||||
}
|
||||
operator DWORD()
|
||||
{
|
||||
return m_dwColor;
|
||||
}
|
||||
};
|
||||
#undef AG_MASK
|
||||
#undef RB_MASK
|
||||
|
||||
inline DWORDCOLOR operator * (DWORDCOLOR dc, float f)
|
||||
{
|
||||
DWORDCOLOR tmp(dc);
|
||||
tmp *= f;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
inline DWORDCOLOR operator * (float f, DWORDCOLOR dc)
|
||||
{
|
||||
DWORDCOLOR tmp(dc);
|
||||
tmp *= f;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline bool operator < (const CTimeEvent<T> & lhs, const CTimeEvent<T> & rhs)
|
||||
{
|
||||
return lhs.m_fTime < rhs.m_fTime;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline bool operator < (const CTimeEvent<T> & lhs, const float & rhs)
|
||||
{
|
||||
return lhs.m_fTime < rhs;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
__forceinline bool operator < (const float & lhs, const CTimeEvent<T> & rhs)
|
||||
{
|
||||
return lhs < rhs.m_fTime;
|
||||
}
|
||||
|
||||
typedef CTimeEvent<char> TTimeEventTypeCharacter;
|
||||
typedef CTimeEvent<short> TTimeEventTypeShort;
|
||||
typedef CTimeEvent<float> TTimeEventTypeFloat;
|
||||
typedef CTimeEvent<WORD> TTimeEventTypeWord;
|
||||
typedef CTimeEvent<DWORD> TTimeEventTypeDoubleWord;
|
||||
typedef CTimeEvent<DWORDCOLOR> TTimeEventTypeColor;
|
||||
typedef CTimeEvent<D3DXVECTOR2> TTimeEventTypeVector2;
|
||||
typedef CTimeEvent<D3DXVECTOR3> TTimeEventTypeVector3;
|
||||
|
||||
typedef std::vector<float> TTimeEventTable;
|
||||
typedef std::vector<TEffectPosition> TTimeEventTablePosition;
|
||||
typedef std::vector<TTimeEventTypeCharacter> TTimeEventTableCharacter;
|
||||
typedef std::vector<TTimeEventTypeShort> TTimeEventTableShort;
|
||||
typedef std::vector<TTimeEventTypeFloat> TTimeEventTableFloat;
|
||||
typedef std::vector<TTimeEventTypeWord> TTimeEventTableWord;
|
||||
typedef std::vector<TTimeEventTypeDoubleWord> TTimeEventTableDoubleWord;
|
||||
typedef std::vector<TTimeEventTypeColor> TTimeEventTableColor;
|
||||
typedef std::vector<TTimeEventTypeVector2> TTimeEventTableVector2;
|
||||
typedef std::vector<TTimeEventTypeVector3> TTimeEventTableVector3;
|
||||
|
||||
|
||||
// NOTE : TimeEventValue <20>Լ<EFBFBD><D4BC><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20>Ѱ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD>ƾ<EFBFBD> <20>ϴ<EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>
|
||||
// <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ƴ<EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20>ۼ<EFBFBD> <20>߽<EFBFBD><DFBD>ϴ<EFBFBD>. - [levites]
|
||||
|
||||
template <typename T>
|
||||
__forceinline void GetTimeEventBlendValue(float fElapsedTime, std::vector<CTimeEvent<T> >& rVector, T * pReturnValue)
|
||||
{
|
||||
if (rVector.empty())
|
||||
{
|
||||
*pReturnValue = T();
|
||||
return;
|
||||
}
|
||||
|
||||
if(rVector.begin()+1==rVector.end())
|
||||
{
|
||||
*pReturnValue = rVector.front().m_Value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (fElapsedTime < rVector.front().m_fTime)
|
||||
{
|
||||
*pReturnValue = rVector.front().m_Value;
|
||||
return;
|
||||
}
|
||||
|
||||
if (fElapsedTime > rVector.back().m_fTime)
|
||||
{
|
||||
*pReturnValue = rVector.back().m_Value;
|
||||
return;
|
||||
}
|
||||
|
||||
typedef typename std::vector<CTimeEvent<T> >::iterator iterator;
|
||||
|
||||
std::pair<iterator, iterator> result = std::equal_range(rVector.begin(), rVector.end(), fElapsedTime);
|
||||
|
||||
if (result.first != result.second)
|
||||
*pReturnValue = result.first->m_Value;
|
||||
else
|
||||
{
|
||||
--result.first;
|
||||
float Head = (result.second->m_fTime - fElapsedTime) / (result.second->m_fTime - result.first->m_fTime);
|
||||
*pReturnValue = T((result.first->m_Value-result.second->m_Value)*Head+(result.second->m_Value));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
extern BOOL GetTokenTimeEventFloat(CTextFileLoader & rTextFileLoader, const char * c_szKey, TTimeEventTableFloat * pTimeEventTableFloat);
|
||||
//extern void InsertItemTimeEventFloat(TTimeEventTableFloat * pTable, float fTime, float fValue);
|
||||
|
||||
template <typename T>
|
||||
void InsertItemTimeEvent(std::vector<CTimeEvent<T> > * pTable, float fTime, T fValue)
|
||||
{
|
||||
typedef std::vector<CTimeEvent<T> >::iterator iterator;
|
||||
|
||||
iterator itor = std::lower_bound(pTable->begin(), pTable->end(), fTime);
|
||||
|
||||
CTimeEvent<T> TimeEvent;
|
||||
TimeEvent.m_fTime = fTime;
|
||||
TimeEvent.m_Value = fValue;
|
||||
|
||||
pTable->insert(itor, TimeEvent);
|
||||
}
|
Reference in New Issue
Block a user