2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-04 02:32:57 +00:00
|
|
|
|
|
|
|
#include "hecl/Runtime.hpp"
|
2019-05-08 03:50:21 +00:00
|
|
|
#include "hecl/Backend.hpp"
|
2019-06-12 02:05:17 +00:00
|
|
|
#include <optional>
|
2016-04-04 02:32:57 +00:00
|
|
|
#include "zeus/CVector3f.hpp"
|
|
|
|
#include "zeus/CColor.hpp"
|
2016-08-08 04:48:18 +00:00
|
|
|
#include "Graphics/CGraphics.hpp"
|
2019-05-08 03:50:21 +00:00
|
|
|
#include "DataSpec/DNAMP1/CMDLMaterials.hpp"
|
2018-10-14 20:16:21 +00:00
|
|
|
#include <array>
|
2016-04-04 02:32:57 +00:00
|
|
|
|
2017-08-08 06:03:57 +00:00
|
|
|
#define URDE_MAX_LIGHTS 8
|
2016-04-04 02:32:57 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
|
|
|
|
|
|
|
enum EExtendedShader : uint8_t {
|
|
|
|
Flat,
|
|
|
|
Lighting,
|
|
|
|
Thermal,
|
|
|
|
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 08:34:09 +00:00
|
|
|
ForcedAdditiveNoZWriteDepthGreater,
|
2019-02-24 07:15:54 +00:00
|
|
|
ThermalCold,
|
2019-02-25 08:14:59 +00:00
|
|
|
LightingAlphaWrite,
|
2019-06-01 03:41:01 +00:00
|
|
|
LightingCubeReflection,
|
|
|
|
LightingCubeReflectionWorldShadow,
|
2018-12-08 05:30:43 +00:00
|
|
|
MAX
|
2017-03-10 20:52:53 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CModelShaders {
|
|
|
|
friend class CModel;
|
|
|
|
|
2016-04-04 02:32:57 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
struct Light {
|
|
|
|
zeus::CVector3f pos;
|
|
|
|
zeus::CVector3f dir;
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skClear;
|
2018-12-08 05:30:43 +00:00
|
|
|
float linAtt[4] = {1.f, 0.f, 0.f};
|
|
|
|
float angAtt[4] = {1.f, 0.f, 0.f};
|
|
|
|
};
|
|
|
|
|
|
|
|
struct LightingUniform {
|
|
|
|
Light lights[URDE_MAX_LIGHTS];
|
|
|
|
zeus::CColor ambient;
|
|
|
|
zeus::CColor colorRegs[3];
|
|
|
|
zeus::CColor mulColor;
|
2019-02-08 07:56:54 +00:00
|
|
|
zeus::CColor addColor;
|
2018-12-08 05:30:43 +00:00
|
|
|
CGraphics::CFogState fog;
|
|
|
|
|
|
|
|
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;
|
|
|
|
CGraphics::CFogState fog;
|
|
|
|
};
|
|
|
|
|
|
|
|
static void Initialize();
|
|
|
|
static void Shutdown();
|
|
|
|
|
|
|
|
using ShaderPipelinesData = std::array<boo::ObjToken<boo::IShaderPipeline>, EExtendedShader::MAX>;
|
|
|
|
using ShaderPipelines = std::shared_ptr<ShaderPipelinesData>;
|
|
|
|
|
2019-05-08 03:50:21 +00:00
|
|
|
using Material = DataSpec::DNAMP1::HMDLMaterialSet::Material;
|
|
|
|
static ShaderPipelines BuildExtendedShader(const hecl::Backend::ShaderTag& tag, const Material& material);
|
2016-04-04 02:32:57 +00:00
|
|
|
|
2018-10-07 02:59:17 +00:00
|
|
|
private:
|
2018-12-08 05:30:43 +00:00
|
|
|
static std::unordered_map<uint64_t, ShaderPipelines> g_ShaderPipelines;
|
2016-04-04 02:32:57 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|