2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-04 02:32:57 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <array>
|
2019-09-29 00:30:53 +00:00
|
|
|
#include <cstdint>
|
|
|
|
#include <memory>
|
2019-09-28 02:53:03 +00:00
|
|
|
|
2019-05-08 03:50:21 +00:00
|
|
|
#include "DataSpec/DNAMP1/CMDLMaterials.hpp"
|
2019-09-28 02:53:03 +00:00
|
|
|
|
|
|
|
#include "Runtime/Graphics/CGraphics.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CColor.hpp>
|
|
|
|
#include <zeus/CVector3f.hpp>
|
|
|
|
#include <zeus/CVector4f.hpp>
|
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
|
|
|
|
2019-09-29 00:30:53 +00:00
|
|
|
namespace hecl::Backend {
|
|
|
|
class ShaderTag;
|
2020-09-29 00:14:09 +00:00
|
|
|
} // namespace hecl::Backend
|
2019-09-29 00:30:53 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2019-09-29 00:30:53 +00:00
|
|
|
class CLight;
|
2020-09-29 00:14:09 +00:00
|
|
|
struct CModelFlags;
|
|
|
|
struct CBooSurface;
|
2020-09-28 20:54:40 +00:00
|
|
|
class CBooModel;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2020-03-06 04:39:09 +00:00
|
|
|
enum class EExtendedShader : uint8_t {
|
2018-12-08 05:30:43 +00:00
|
|
|
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,
|
2020-09-27 16:59:56 +00:00
|
|
|
LightingAlphaWriteNoZTestNoZWrite,
|
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
|
|
|
};
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
enum class EShaderType : uint8_t {
|
|
|
|
DiffuseOnly,
|
|
|
|
Normal,
|
|
|
|
Dynamic,
|
|
|
|
DynamicAlpha,
|
|
|
|
DynamicCharacter
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class EPostType : uint8_t {
|
|
|
|
Normal,
|
|
|
|
ThermalHot,
|
|
|
|
ThermalCold,
|
|
|
|
Solid,
|
|
|
|
MBShadow,
|
|
|
|
Disintegrate
|
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CModelShaders {
|
|
|
|
friend class CModel;
|
2020-09-28 20:54:40 +00:00
|
|
|
hsh::binding m_dataBind;
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2016-04-04 02:32:57 +00:00
|
|
|
public:
|
2020-09-28 20:54:40 +00:00
|
|
|
template <uint32_t NCol, uint32_t NUv, uint32_t NWeight>
|
|
|
|
struct VertData {
|
|
|
|
hsh::float3 posIn;
|
|
|
|
hsh::float3 normIn;
|
|
|
|
std::array<hsh::float4, NCol> colIn;
|
|
|
|
std::array<hsh::float2, NUv> uvIn;
|
|
|
|
std::array<hsh::float4, NWeight> weightIn;
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
template <uint32_t NSkinSlots>
|
|
|
|
struct VertUniform {
|
|
|
|
std::array<hsh::float4x4, NSkinSlots> objs;
|
|
|
|
std::array<hsh::float4x4, NSkinSlots> objsInv;
|
|
|
|
hsh::float4x4 mv;
|
|
|
|
hsh::float4x4 mvInv;
|
|
|
|
hsh::float4x4 proj;
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
struct TCGMatrix {
|
|
|
|
hsh::float4x4 mtx;
|
|
|
|
hsh::float4x4 postMtx;
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
struct ReflectMtx {
|
|
|
|
hsh::float4x4 indMtx;
|
|
|
|
hsh::float4x4 reflectMtx;
|
|
|
|
float reflectAlpha;
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
struct Light {
|
|
|
|
alignas(16) hsh::float3 pos;
|
|
|
|
alignas(16) hsh::float3 dir;
|
|
|
|
alignas(16) hsh::float4 color;
|
|
|
|
alignas(16) hsh::float3 linAtt;
|
|
|
|
alignas(16) hsh::float3 angAtt;
|
2018-12-08 05:30:43 +00:00
|
|
|
};
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
struct FragmentUniform {
|
|
|
|
std::array<Light, URDE_MAX_LIGHTS> lights;
|
|
|
|
hsh::float4 ambient;
|
|
|
|
hsh::float4 lightmapMul;
|
|
|
|
hsh::float4 flagsColor;
|
2018-12-08 05:30:43 +00:00
|
|
|
CGraphics::CFogState fog;
|
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
void ActivateLights(const std::vector<CLight>& lts);
|
|
|
|
};
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2020-09-28 20:54:40 +00:00
|
|
|
hsh::binding& SetCurrent(const CModelFlags& modelFlags, const CBooSurface& surface, const CBooModel& model);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
2019-05-08 03:50:21 +00:00
|
|
|
using Material = DataSpec::DNAMP1::HMDLMaterialSet::Material;
|
2016-04-04 02:32:57 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|