metaforce/Runtime/Particle/CParticleElectric.cpp

219 lines
5.3 KiB
C++
Raw Normal View History

#include "CParticleElectric.hpp"
2016-03-06 02:55:09 +00:00
#include "CElectricDescription.hpp"
2016-02-26 05:38:11 +00:00
#include "CGenDescription.hpp"
#include "CSwooshDescription.hpp"
2016-03-06 02:55:09 +00:00
#include "CParticleSwoosh.hpp"
#include "CElementGen.hpp"
2016-03-04 23:04:53 +00:00
#include "Graphics/CModel.hpp"
#include "Graphics/CGraphics.hpp"
2016-03-04 23:04:53 +00:00
namespace urde
{
void CParticleElectric::RenderSwooshes()
{
}
2016-03-06 02:55:09 +00:00
CParticleElectric::CParticleElectric(const TToken<CElectricDescription>& token)
: x1c_elecDesc(token)
2016-02-13 05:49:59 +00:00
{
2016-07-28 06:37:50 +00:00
x450_24 = true;
2016-03-06 02:55:09 +00:00
/* x438_28_x450_28 = true; demo */
x450_29 = true; // are 28 and 29 the same between retail and demo?
CElectricDescription* desc = x1c_elecDesc.GetObj();
if (desc->x10_SSEG)
desc->x10_SSEG->GetValue(x28_currentFrame, x150_SSEG);
else
{
x150_SSEG++;
x154_SCNT = 1;
}
if (desc->xc_SCNT)
desc->xc_SCNT->GetValue(x28_currentFrame, x154_SCNT);
std::max(0, std::min(x154_SCNT, 32));
if (desc->x0_LIFE)
desc->x0_LIFE->GetValue(x28_currentFrame, x2c_LIFE);
else
x2c_LIFE = 0x7FFFFF;
2016-03-07 08:07:55 +00:00
2016-03-06 02:55:09 +00:00
if (desc->x40_SSWH.m_found)
{
2016-07-28 06:37:50 +00:00
x450_27_HaveSSWH = true;
2016-03-07 08:07:55 +00:00
for (int i = 0 ; i < x154_SCNT ; i++)
x1e0_lineManagers[i].SSWH.reset(new CParticleSwoosh(desc->x40_SSWH.m_token, x150_SSEG));
2016-03-06 02:55:09 +00:00
}
if (desc->x50_GPSM.m_found)
{
2016-07-28 06:37:50 +00:00
x450_25_HaveGPSM = true;
2016-03-07 08:07:55 +00:00
for (int i = 0 ; i < x154_SCNT ; i++)
x1e0_lineManagers[i].GPSM.reset(new CElementGen(desc->x50_GPSM.m_token,
CElementGen::EModelOrientationType::Normal,
CElementGen::EOptionalSystemFlags::One));
2016-03-06 02:55:09 +00:00
}
if (desc->x60_EPSM.m_found)
{
2016-07-28 06:37:50 +00:00
x450_26_HaveEPSM = true;
2016-03-07 08:07:55 +00:00
for (int i = 0 ; i < x154_SCNT ; i++)
x1e0_lineManagers[i].EPSM.reset(new CElementGen(desc->x60_EPSM.m_token,
CElementGen::EModelOrientationType::Normal,
CElementGen::EOptionalSystemFlags::One));
2016-03-06 02:55:09 +00:00
}
2016-02-13 05:49:59 +00:00
}
void CParticleElectric::SetupLineGXMaterial()
{
}
2016-02-26 03:31:00 +00:00
void CParticleElectric::RenderLines()
{
CGraphics::DisableAllLights();
CGraphics::SetDepthWriteMode(true, ERglEnum::LEqual, false);
CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::One, ERglLogicOp::Clear);
2016-03-04 23:04:53 +00:00
zeus::CTransform viewXfrm = CGraphics::g_ViewMatrix;
zeus::CTransform localScale;
localScale.Scale(xec_localScale);
2016-03-04 23:04:53 +00:00
zeus::CTransform globalScale;
2016-02-26 03:31:00 +00:00
globalScale.Scale(xe0_globalScale);
2016-03-04 23:04:53 +00:00
zeus::CTransform localTranslation;
localTranslation.Translate(x38_translation);
2016-03-04 23:04:53 +00:00
zeus::CTransform globalTranslation;
globalTranslation.Translate(xa4_globalTranslation);
CGraphics::SetModelMatrix(xb0_globalOrientation * globalTranslation * localTranslation * x44_orientation * globalScale);
CGraphics::SetCullMode(ERglCullMode::None);
SetupLineGXMaterial();
/* Iterate line managers */
CGraphics::SetCullMode(ERglCullMode::Front);
//CGraphics::SetLineWidth(1.f, ERglTexOffset);
CGraphics::SetViewPointMatrix(viewXfrm);
2016-02-26 03:31:00 +00:00
}
2016-02-13 05:49:59 +00:00
void CParticleElectric::Update(double)
{
}
void CParticleElectric::Render()
{
}
2016-03-04 23:04:53 +00:00
void CParticleElectric::SetOrientation(const zeus::CTransform& orientation)
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
x44_orientation = orientation;
2016-07-28 06:37:50 +00:00
x450_28 = true;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
void CParticleElectric::SetTranslation(const zeus::CVector3f& translation)
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
x38_translation = translation;
2016-07-28 06:37:50 +00:00
x450_28 = true;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
void CParticleElectric::SetGlobalOrientation(const zeus::CTransform& orientation)
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
xb0_globalOrientation = orientation;
2016-07-28 06:37:50 +00:00
x450_28 = true;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
void CParticleElectric::SetGlobalTranslation(const zeus::CVector3f& translation)
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
xa4_globalTranslation = translation;
2016-07-28 06:37:50 +00:00
x450_28 = true;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
void CParticleElectric::SetGlobalScale(const zeus::CVector3f& scale)
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
xe0_globalScale = scale;
2016-07-28 06:37:50 +00:00
x450_28 = true;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
void CParticleElectric::SetLocalScale(const zeus::CVector3f& scale)
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
xec_localScale = scale;
2016-07-28 06:37:50 +00:00
x450_28 = true;
if (x450_26_HaveEPSM)
2016-02-26 03:31:00 +00:00
{
}
2016-02-13 05:49:59 +00:00
}
void CParticleElectric::SetParticleEmission(bool)
{
}
2016-03-04 23:04:53 +00:00
void CParticleElectric::SetModulationColor(const zeus::CColor& color)
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
x1b8_moduColor = color;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
const zeus::CTransform& CParticleElectric::GetOrientation() const
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
return x44_orientation;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
const zeus::CVector3f& CParticleElectric::GetTranslation() const
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
return x38_translation;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
const zeus::CTransform& CParticleElectric::GetGlobalOrientation() const
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
return xb0_globalOrientation;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
const zeus::CVector3f& CParticleElectric::GetGlobalTranslation() const
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
return xa4_globalTranslation;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
const zeus::CVector3f& CParticleElectric::GetGlobalScale() const
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
return xe0_globalScale;
2016-02-13 05:49:59 +00:00
}
2016-03-04 23:04:53 +00:00
const zeus::CColor& CParticleElectric::GetModulationColor() const
2016-02-13 05:49:59 +00:00
{
2016-02-26 03:31:00 +00:00
return x1b8_moduColor;
2016-02-13 05:49:59 +00:00
}
bool CParticleElectric::IsSystemDeletable() const
{
2016-02-17 03:42:27 +00:00
return false;
2016-02-13 05:49:59 +00:00
}
2017-01-21 06:03:37 +00:00
rstl::optional_object<zeus::CAABox> CParticleElectric::GetBounds() const
2016-02-13 05:49:59 +00:00
{
2017-01-21 06:03:37 +00:00
return {};
2016-02-13 05:49:59 +00:00
}
u32 CParticleElectric::GetParticleCount() const
{
2016-02-17 03:42:27 +00:00
return 0;
2016-02-13 05:49:59 +00:00
}
bool CParticleElectric::SystemHasLight() const
{
2016-02-17 03:42:27 +00:00
return false;
2016-02-13 05:49:59 +00:00
}
CLight CParticleElectric::GetLight() const
{
2016-03-16 20:49:35 +00:00
return CLight(zeus::CVector3f::skZero, zeus::CVector3f::skZero,
zeus::CColor::skBlack, 0.f, 1.f, 0.f, 0.f, 1.f, 0.f);
2016-02-13 05:49:59 +00:00
}
bool CParticleElectric::GetParticleEmission() const
{
2016-02-17 03:42:27 +00:00
return false;
2016-02-13 05:49:59 +00:00
}
void CParticleElectric::DestroyParticles()
{
}
}