2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2017-03-20 05:09:53 +00:00
|
|
|
|
2019-09-23 19:00:23 +00:00
|
|
|
#include <optional>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/CToken.hpp"
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CColor.hpp>
|
2017-03-20 05:09:53 +00:00
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce {
|
2017-03-20 05:09:53 +00:00
|
|
|
class CActor;
|
|
|
|
class CStateManager;
|
2019-09-23 19:00:23 +00:00
|
|
|
class CTexture;
|
2017-03-20 05:09:53 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CVisorFlare {
|
2017-03-20 05:09:53 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
enum class EBlendMode {
|
2022-05-24 05:44:20 +00:00
|
|
|
Additive = 0,
|
|
|
|
Blend = 1,
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
|
|
|
class CFlareDef {
|
2022-05-24 05:44:20 +00:00
|
|
|
mutable TToken<CTexture> x0_tex;
|
|
|
|
float x8_pos;
|
|
|
|
float xc_scale;
|
2018-12-08 05:30:43 +00:00
|
|
|
zeus::CColor x10_color;
|
|
|
|
|
|
|
|
public:
|
2021-06-07 19:29:18 +00:00
|
|
|
CFlareDef() = default;
|
|
|
|
CFlareDef(const CFlareDef&) = default;
|
2022-05-24 05:44:20 +00:00
|
|
|
CFlareDef(const TToken<CTexture>& tex, float pos, float scale, const zeus::CColor& color)
|
|
|
|
: x0_tex(tex), x8_pos(pos), xc_scale(scale), x10_color(color) {
|
2018-12-08 05:30:43 +00:00
|
|
|
x0_tex.Lock();
|
|
|
|
}
|
|
|
|
|
2022-05-24 05:44:20 +00:00
|
|
|
TToken<CTexture>& GetTexture() const { return x0_tex; }
|
2019-08-14 10:04:11 +00:00
|
|
|
zeus::CColor GetColor() const { return x10_color; }
|
2022-05-24 05:44:20 +00:00
|
|
|
float GetPosition() const { return x8_pos; }
|
|
|
|
float GetScale() const { return xc_scale; }
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
|
|
|
|
2017-03-20 05:09:53 +00:00
|
|
|
private:
|
2018-12-08 05:30:43 +00:00
|
|
|
EBlendMode x0_blendMode;
|
|
|
|
std::vector<CFlareDef> x4_flareDefs;
|
|
|
|
bool x14_b1;
|
|
|
|
float x18_f1;
|
|
|
|
float x1c_f2;
|
|
|
|
float x20_f3;
|
|
|
|
float x24_ = 0.f;
|
|
|
|
float x28_ = 0.f;
|
|
|
|
u32 x2c_w1;
|
|
|
|
u32 x30_w2;
|
|
|
|
|
2022-05-24 05:44:20 +00:00
|
|
|
void SetupRenderState(const CStateManager& mgr) const;
|
|
|
|
void ResetTevSwapMode(const CStateManager& mgr) const;
|
|
|
|
void DrawDirect(const zeus::CColor& color, float f1, float f2) const;
|
|
|
|
void DrawStreamed(const zeus::CColor& color, float f1, float f2) const;
|
|
|
|
|
2017-03-20 05:09:53 +00:00
|
|
|
public:
|
2020-03-26 04:28:31 +00:00
|
|
|
CVisorFlare(EBlendMode blendMode, bool, float, float, float, u32, u32, std::vector<CFlareDef> flares);
|
2018-12-08 05:30:43 +00:00
|
|
|
void Update(float dt, const zeus::CVector3f& pos, const CActor* act, CStateManager& mgr);
|
|
|
|
void Render(const zeus::CVector3f& pos, const CStateManager& mgr) const;
|
2019-06-12 02:05:17 +00:00
|
|
|
static std::optional<CFlareDef> LoadFlareDef(CInputStream& in);
|
2017-03-20 05:09:53 +00:00
|
|
|
};
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce
|