2017-07-16 06:13:37 +00:00
|
|
|
#include "CHUDBillboardEffect.hpp"
|
|
|
|
#include "TCastTo.hpp"
|
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "Camera/CGameCamera.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
|
|
|
u32 CHUDBillboardEffect::g_IndirectTexturedBillboardCount = 0;
|
|
|
|
u32 CHUDBillboardEffect::g_BillboardCount = 0;
|
|
|
|
|
|
|
|
CHUDBillboardEffect::CHUDBillboardEffect(const std::experimental::optional<TToken<CGenDescription>>& particle,
|
|
|
|
const std::experimental::optional<TToken<CElectricDescription>>& electric,
|
|
|
|
TUniqueId uid, bool active, const std::string& name, float f,
|
|
|
|
const zeus::CVector3f& v0, const zeus::CColor& color,
|
|
|
|
const zeus::CVector3f& v1, const zeus::CVector3f& v2)
|
|
|
|
: CEffect(uid, CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), active, name, zeus::CTransform::Identity())
|
|
|
|
{
|
|
|
|
xec_v2 = v2;
|
|
|
|
xec_v2.y += f;
|
|
|
|
xf8_ = v1 * v0;
|
|
|
|
x104_24_ = true;
|
|
|
|
x104_25_ = false;
|
|
|
|
x104_26_ = false;
|
|
|
|
x104_27_ = false;
|
|
|
|
|
|
|
|
if (particle)
|
|
|
|
{
|
2017-09-11 02:18:49 +00:00
|
|
|
xe8_generator = std::make_unique<CElementGen>(*particle);
|
2017-07-16 06:13:37 +00:00
|
|
|
if (static_cast<CElementGen&>(*xe8_generator).IsIndirectTextured())
|
|
|
|
++g_IndirectTexturedBillboardCount;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
xe8_generator = std::make_unique<CParticleElectric>(*electric);
|
|
|
|
}
|
|
|
|
++g_BillboardCount;
|
|
|
|
xe8_generator->SetModulationColor(color);
|
|
|
|
xe8_generator->SetLocalScale(xf8_);
|
|
|
|
}
|
|
|
|
|
|
|
|
CHUDBillboardEffect::~CHUDBillboardEffect()
|
|
|
|
{
|
|
|
|
--g_BillboardCount;
|
|
|
|
if (xe8_generator->Get4CharId() == FOURCC('PART'))
|
|
|
|
if (static_cast<CElementGen&>(*xe8_generator).IsIndirectTextured())
|
|
|
|
--g_IndirectTexturedBillboardCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CHUDBillboardEffect::Accept(IVisitor& visitor) { visitor.Visit(this); }
|
|
|
|
|
|
|
|
float CHUDBillboardEffect::GetNearClipDistance(CStateManager& mgr)
|
|
|
|
{
|
|
|
|
return mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetNearClipDistance() + 0.01f;
|
|
|
|
}
|
|
|
|
|
|
|
|
zeus::CVector3f CHUDBillboardEffect::GetScaleForPOV(CStateManager& mgr)
|
|
|
|
{
|
|
|
|
return {0.155f, 1.f, 0.155f};
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|