world editor defines removed
This commit is contained in:
@@ -80,11 +80,7 @@ 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);
|
||||
|
||||
@@ -155,7 +155,7 @@ void CParticleInstance::UpdateColor(float time, float elapsedTime)
|
||||
if (m_pParticleProperty->m_TimeEventColor.empty())
|
||||
return;
|
||||
|
||||
m_dcColor = GetTimeEventBlendValue(time, m_pParticleProperty->m_TimeEventColor);
|
||||
m_Color = GetTimeEventBlendValue(time, m_pParticleProperty->m_TimeEventColor);
|
||||
}
|
||||
|
||||
void CParticleInstance::UpdateGravity(float time, float elapsedTime)
|
||||
@@ -179,13 +179,7 @@ void CParticleInstance::UpdateAirResistance(float time, float elapsedTime)
|
||||
|
||||
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;
|
||||
@@ -336,13 +330,7 @@ void CParticleInstance::Transform(const D3DXMATRIX * c_matLocal)
|
||||
|
||||
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;
|
||||
@@ -500,11 +488,7 @@ void CParticleInstance::__Initialize()
|
||||
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_rotationType = CParticleProperty::ROTATION_TYPE_NONE;
|
||||
|
||||
@@ -38,11 +38,7 @@ class CParticleInstance
|
||||
D3DXVECTOR2 m_v2Scale;
|
||||
|
||||
float m_fRotation;
|
||||
#ifdef WORLD_EDITOR
|
||||
D3DXCOLOR m_Color;
|
||||
#else
|
||||
DWORDCOLOR m_dcColor;
|
||||
#endif
|
||||
|
||||
BYTE m_byTextureAnimationType;
|
||||
float m_fLastFrameTime;
|
||||
|
||||
@@ -5,11 +5,7 @@
|
||||
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)
|
||||
@@ -20,9 +16,6 @@ bool CParticleProperty::SetTexture(const char * c_szFileName)
|
||||
return false;
|
||||
}
|
||||
m_ImageVector.clear();
|
||||
#ifdef WORLD_EDITOR
|
||||
m_TextureNameVector.clear();
|
||||
#endif
|
||||
InsertTexture(c_szFileName);
|
||||
return true;
|
||||
}
|
||||
@@ -56,15 +49,7 @@ void CParticleProperty::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();
|
||||
@@ -103,16 +88,7 @@ CParticleProperty & CParticleProperty::operator = ( const CParticleProperty& c_P
|
||||
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;
|
||||
|
||||
@@ -75,16 +75,7 @@ class CParticleProperty
|
||||
|
||||
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;
|
||||
|
||||
@@ -210,17 +210,6 @@ BOOL CParticleSystemData::OnLoadScript(CTextFileLoader & rTextFileLoader)
|
||||
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;
|
||||
@@ -257,16 +246,13 @@ BOOL CParticleSystemData::OnLoadScript(CTextFileLoader & rTextFileLoader)
|
||||
fA = GetTimeEventBlendValue(fTime, TimeEventA);
|
||||
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;
|
||||
t.m_Value.r = fR;
|
||||
t.m_Value.g = fG;
|
||||
t.m_Value.b = fB;
|
||||
t.m_Value.a = fA;
|
||||
m_ParticleProperty.m_TimeEventColor.push_back(t);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!GetTokenTimeEventFloat(rTextFileLoader, "timeeventrotation", &m_ParticleProperty.m_TimeEventRotation))
|
||||
return FALSE;
|
||||
|
||||
@@ -248,14 +248,7 @@ void CParticleSystemInstance::CreateParticles(float 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
|
||||
pInstance->m_Color = m_pParticleProperty->m_TimeEventColor.front().m_Value;
|
||||
}
|
||||
|
||||
m_ParticleInstanceListVector[pInstance->m_byFrameIndex].push_back(pInstance);
|
||||
|
||||
@@ -123,74 +123,12 @@ typedef struct SEffectPosition : public CTimeEvent<D3DXVECTOR3>
|
||||
D3DXVECTOR3 m_vecControlPoint;
|
||||
} TEffectPosition;
|
||||
|
||||
#define AG_MASK 0xff00ff00
|
||||
#define RB_MASK 0x00ff00ff
|
||||
|
||||
struct DWORDCOLOR
|
||||
{
|
||||
DWORD m_dwColor;
|
||||
|
||||
DWORDCOLOR()
|
||||
{
|
||||
}
|
||||
DWORDCOLOR(const DWORDCOLOR& r)
|
||||
: m_dwColor(r.m_dwColor)
|
||||
{
|
||||
}
|
||||
DWORDCOLOR(DWORD dwColor)
|
||||
: m_dwColor(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);
|
||||
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;
|
||||
}
|
||||
|
||||
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<D3DXCOLOR> TTimeEventTypeColor;
|
||||
typedef CTimeEvent<D3DXVECTOR2> TTimeEventTypeVector2;
|
||||
typedef CTimeEvent<D3DXVECTOR3> TTimeEventTypeVector3;
|
||||
|
||||
@@ -238,14 +176,6 @@ inline D3DXVECTOR3 BlendSingleValue(float time, const TEffectPosition& low, cons
|
||||
return D3DXVECTOR3();
|
||||
}
|
||||
|
||||
inline DWORDCOLOR BlendSingleValue(float time, const TTimeEventTypeColor& low, const TTimeEventTypeColor& high)
|
||||
{
|
||||
const float timeDiff = high.m_fTime - low.m_fTime;
|
||||
const float perc = (time - low.m_fTime) / timeDiff;
|
||||
|
||||
return low.m_Value * (1.0f - perc) + high.m_Value * perc;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
auto GetTimeEventBlendValue(float time,
|
||||
const std::vector<T>& vec) -> typename T::value_type
|
||||
|
||||
Reference in New Issue
Block a user