mirror of https://github.com/AxioDL/metaforce.git
CScanDisplay::CDataDot imps
This commit is contained in:
parent
52eb054935
commit
3c9120eb4c
|
@ -0,0 +1,74 @@
|
|||
#include "CScanDisplay.hpp"
|
||||
#include "zeus/CTransform.hpp"
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
void CScanDisplay::CDataDot::Update(float dt)
|
||||
{
|
||||
if (x20_ > 0.f)
|
||||
{
|
||||
float diff = x20_ - dt;
|
||||
if (diff < 0.f)
|
||||
x20_ = 0.f;
|
||||
else
|
||||
x20_ = diff;
|
||||
float d = x20_ / x1c_;
|
||||
xc_ = (x14_ * (x4_ * d)) + (1.f - x1c_ > 0.f ? d : 0.f);
|
||||
}
|
||||
|
||||
if (x24_ > x28_)
|
||||
{
|
||||
float tmp = -((2.0f * x24_) - dt);
|
||||
x24_ = (tmp >= x28_ ? x28_ : tmp);
|
||||
}
|
||||
else if (x24_ < x28_)
|
||||
{
|
||||
float tmp = (2.0 * x24_) + x28_;
|
||||
x24_ = (tmp >= x28_ ? x28_ : tmp);
|
||||
}
|
||||
}
|
||||
|
||||
void CScanDisplay::CDataDot::Draw(const zeus::CColor& col, float f1) const
|
||||
{
|
||||
if (x24_ == 0.f)
|
||||
return;
|
||||
|
||||
if (x0_ == EDotState::One)
|
||||
{
|
||||
zeus::CTransform xf = zeus::CTransform::Translate(xc_.x, 0.f, xc_.y);
|
||||
#if 0
|
||||
g_Renderer->SetModelMatrix(xf);
|
||||
CGraphics::StreamBegin(ERglPrimitive::TriangleStrip);
|
||||
zeus::Comp8 r, g, b, a;
|
||||
col.toRGBA8(r, g, b, a);
|
||||
CGraphics::StreamColor({col.r, col.g, col.b, x24_ * float(a)});
|
||||
CGraphics::StreamTexCoord(0.f, 1.f);
|
||||
CGraphics::StreamVertex(zeus::CVector3f{-f1, 0, f1});
|
||||
CGraphics::StreamTexCoord(0.f, 0.f);
|
||||
CGraphics::StreamVertex(zeus::CVector3f{-f1, 0, -f1});
|
||||
CGraphics::StreamTexCoord(1.f, 1.f);
|
||||
CGraphics::StreamVertex(zeus::CVector3f{f1, 0, f1});
|
||||
CGraphics::StreamTexCoord(1.f, 0.f);
|
||||
CGraphics::StreamVertex(zeus::CVector3f{f1, 0, -f1});
|
||||
CGraphics::StreamEnd();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void CScanDisplay::CDataDot::StartTransitionTo(const zeus::CVector2f& vec, float f1)
|
||||
{
|
||||
x20_ = f1;
|
||||
x1c_ = f1;
|
||||
x4_ = xc_;
|
||||
x14_ = vec;
|
||||
}
|
||||
|
||||
void CScanDisplay::CDataDot::SetDestPosition(const zeus::CVector2f& pos)
|
||||
{
|
||||
if (x20_ <= 0.f)
|
||||
xc_ = pos;
|
||||
else
|
||||
x14_ = pos;
|
||||
}
|
||||
}
|
|
@ -19,7 +19,8 @@ public:
|
|||
public:
|
||||
enum class EDotState
|
||||
{
|
||||
Zero
|
||||
Zero,
|
||||
One
|
||||
};
|
||||
private:
|
||||
EDotState x0_ = EDotState::Zero;
|
||||
|
@ -35,7 +36,7 @@ public:
|
|||
void Update(float);
|
||||
void Draw(const zeus::CColor&, float) const;
|
||||
float GetTransitionFactor() const;
|
||||
void StartTransitionTo(const zeus::CVector2f&, float, float);
|
||||
void StartTransitionTo(const zeus::CVector2f&, float);
|
||||
void SetDestPosition(const zeus::CVector2f&);
|
||||
void SetDesiredAlpha(float);
|
||||
void SetDotState(EDotState);
|
||||
|
|
Loading…
Reference in New Issue