2018-10-06 20:42:33 -07:00
|
|
|
#pragma once
|
2016-04-03 19:32:57 -07:00
|
|
|
|
2019-09-27 19:53:03 -07:00
|
|
|
#include <array>
|
2019-09-28 17:30:53 -07:00
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
2019-09-27 19:53:03 -07:00
|
|
|
|
2022-01-31 16:06:54 -08:00
|
|
|
//#include "DataSpec/DNAMP1/CMDLMaterials.hpp"
|
2019-09-27 19:53:03 -07:00
|
|
|
|
|
|
|
#include "Runtime/Graphics/CGraphics.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CColor.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
|
|
|
#include <zeus/CVector4f.hpp>
|
2016-04-03 19:32:57 -07:00
|
|
|
|
2017-08-07 23:03:57 -07:00
|
|
|
#define URDE_MAX_LIGHTS 8
|
2016-04-03 19:32:57 -07:00
|
|
|
|
2019-09-28 17:30:53 -07:00
|
|
|
namespace hecl::Backend {
|
|
|
|
class ShaderTag;
|
|
|
|
}
|
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
namespace metaforce {
|
2019-09-28 17:30:53 -07:00
|
|
|
class CLight;
|
2018-12-07 21:30:43 -08:00
|
|
|
|
2020-03-05 20:39:09 -08:00
|
|
|
enum class EExtendedShader : uint8_t {
|
2018-12-07 21:30:43 -08:00
|
|
|
Flat,
|
|
|
|
Lighting,
|
2020-12-18 03:07:53 -08:00
|
|
|
ThermalModel,
|
|
|
|
ThermalModelNoZTestNoZWrite,
|
|
|
|
ThermalStatic,
|
|
|
|
ThermalStaticNoZWrite,
|
2018-12-07 21:30:43 -08:00
|
|
|
ForcedAlpha,
|
|
|
|
ForcedAdditive,
|
|
|
|
SolidColor,
|
|
|
|
SolidColorAdditive,
|
|
|
|
SolidColorFrontfaceCullLEqualAlphaOnly,
|
|
|
|
SolidColorFrontfaceCullAlwaysAlphaOnly, // No Z-write or test
|
|
|
|
SolidColorBackfaceCullLEqualAlphaOnly,
|
|
|
|
SolidColorBackfaceCullGreaterAlphaOnly, // No Z-write
|
|
|
|
MorphBallShadow,
|
|
|
|
WorldShadow,
|
|
|
|
ForcedAlphaNoCull,
|
|
|
|
ForcedAdditiveNoCull,
|
|
|
|
ForcedAlphaNoZWrite,
|
|
|
|
ForcedAdditiveNoZWrite,
|
|
|
|
ForcedAlphaNoCullNoZWrite,
|
|
|
|
ForcedAdditiveNoCullNoZWrite,
|
|
|
|
DepthGEqualNoZWrite,
|
|
|
|
Disintegrate,
|
2019-01-05 00:34:09 -08:00
|
|
|
ForcedAdditiveNoZWriteDepthGreater,
|
2019-02-23 23:15:54 -08:00
|
|
|
ThermalCold,
|
2020-09-27 09:59:56 -07:00
|
|
|
LightingAlphaWrite,
|
|
|
|
LightingAlphaWriteNoZTestNoZWrite,
|
2019-05-31 20:41:01 -07:00
|
|
|
LightingCubeReflection,
|
|
|
|
LightingCubeReflectionWorldShadow,
|
2018-12-07 21:30:43 -08:00
|
|
|
MAX
|
2017-03-10 12:52:53 -08:00
|
|
|
};
|
|
|
|
|
2018-12-07 21:30:43 -08:00
|
|
|
class CModelShaders {
|
|
|
|
friend class CModel;
|
|
|
|
|
2016-04-03 19:32:57 -07:00
|
|
|
public:
|
2018-12-07 21:30:43 -08:00
|
|
|
struct Light {
|
|
|
|
zeus::CVector3f pos;
|
|
|
|
zeus::CVector3f dir;
|
2019-02-23 23:15:54 -08:00
|
|
|
zeus::CColor color = zeus::skClear;
|
2019-09-28 19:22:12 -07:00
|
|
|
std::array<float, 4> linAtt{1.f, 0.f, 0.f};
|
|
|
|
std::array<float, 4> angAtt{1.f, 0.f, 0.f};
|
2018-12-07 21:30:43 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct LightingUniform {
|
2019-09-28 19:22:12 -07:00
|
|
|
std::array<Light, URDE_MAX_LIGHTS> lights;
|
2018-12-07 21:30:43 -08:00
|
|
|
zeus::CColor ambient;
|
2019-09-28 19:22:12 -07:00
|
|
|
std::array<zeus::CColor, 3> colorRegs;
|
2018-12-07 21:30:43 -08:00
|
|
|
zeus::CColor mulColor;
|
2019-02-07 23:56:54 -08:00
|
|
|
zeus::CColor addColor;
|
2022-02-15 21:21:24 -08:00
|
|
|
CFogState fog;
|
2018-12-07 21:30:43 -08:00
|
|
|
|
|
|
|
void ActivateLights(const std::vector<CLight>& lts);
|
|
|
|
};
|
|
|
|
|
|
|
|
struct ThermalUniform {
|
|
|
|
zeus::CColor mulColor;
|
|
|
|
zeus::CColor addColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct SolidUniform {
|
|
|
|
zeus::CColor solidColor;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct MBShadowUniform {
|
|
|
|
zeus::CVector4f shadowUp;
|
|
|
|
float shadowId;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct OneTextureUniform {
|
|
|
|
zeus::CColor addColor;
|
2022-02-15 21:21:24 -08:00
|
|
|
CFogState fog;
|
2018-12-07 21:30:43 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
static void Initialize();
|
|
|
|
static void Shutdown();
|
|
|
|
|
2022-01-31 16:06:54 -08:00
|
|
|
// using ShaderPipelinesData = std::array<boo::ObjToken<boo::IShaderPipeline>, size_t(EExtendedShader::MAX)>;
|
|
|
|
// using ShaderPipelines = std::shared_ptr<ShaderPipelinesData>;
|
2018-12-07 21:30:43 -08:00
|
|
|
|
2022-01-31 16:06:54 -08:00
|
|
|
// using Material = DataSpec::DNAMP1::HMDLMaterialSet::Material;
|
|
|
|
// static ShaderPipelines BuildExtendedShader(const hecl::Backend::ShaderTag& tag, const Material& material);
|
2016-04-03 19:32:57 -07:00
|
|
|
|
2018-10-06 19:59:17 -07:00
|
|
|
private:
|
2022-01-31 16:06:54 -08:00
|
|
|
// static std::unordered_map<uint64_t, ShaderPipelines> g_ShaderPipelines;
|
2016-04-03 19:32:57 -07:00
|
|
|
};
|
|
|
|
|
2021-04-10 01:42:06 -07:00
|
|
|
} // namespace metaforce
|