#pragma once #include #include #include #include "DataSpec/DNAMP1/CMDLMaterials.hpp" #include "Runtime/Graphics/CGraphics.hpp" #include #include #include #define URDE_MAX_LIGHTS 8 namespace hecl::Backend { class ShaderTag; } // namespace hecl::Backend namespace urde { class CLight; struct CModelFlags; struct CBooSurface; class CBooModel; enum class 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, ForcedAdditiveNoZWriteDepthGreater, ThermalCold, LightingAlphaWrite, LightingAlphaWriteNoZTestNoZWrite, LightingCubeReflection, LightingCubeReflectionWorldShadow, MAX }; enum class EShaderType : uint8_t { DiffuseOnly, Normal, Dynamic, DynamicAlpha, DynamicCharacter }; enum class EPostType : uint8_t { Normal, ThermalHot, ThermalCold, Solid, MBShadow, Disintegrate }; class CModelShaders { friend class CModel; hsh::binding m_dataBind; public: template struct VertData { hsh::float3 posIn; hsh::float3 normIn; std::array colIn; std::array uvIn; std::array weightIn; }; template struct VertUniform { std::array objs; std::array objsInv; hsh::float4x4 mv; hsh::float4x4 mvInv; hsh::float4x4 proj; }; struct TCGMatrix { hsh::float4x4 mtx; hsh::float4x4 postMtx; }; struct ReflectMtx { hsh::float4x4 indMtx; hsh::float4x4 reflectMtx; float reflectAlpha; }; 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; }; struct FragmentUniform { std::array lights; hsh::float4 ambient; hsh::float4 lightmapMul; hsh::float4 flagsColor; CGraphics::CFogState fog; void ActivateLights(const std::vector& lts); }; hsh::binding& SetCurrent(const CModelFlags& modelFlags, const CBooSurface& surface, const CBooModel& model); using Material = DataSpec::DNAMP1::HMDLMaterialSet::Material; }; } // namespace urde