mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 22:27:43 +00:00
Initial CFluidPlane implementation
This commit is contained in:
@@ -1,10 +1,58 @@
|
||||
#include "CModelShaders.hpp"
|
||||
#include "Graphics/CLight.hpp"
|
||||
|
||||
namespace urde
|
||||
{
|
||||
|
||||
std::experimental::optional<CModelShaders> CModelShaders::g_ModelShaders;
|
||||
|
||||
void CModelShaders::LightingUniform::ActivateLights(const std::vector<CLight>& lts)
|
||||
{
|
||||
ambient = zeus::CColor::skBlack;
|
||||
size_t curLight = 0;
|
||||
|
||||
for (const CLight& light : lts)
|
||||
{
|
||||
switch (light.GetType())
|
||||
{
|
||||
case ELightType::LocalAmbient:
|
||||
ambient += light.GetColor();
|
||||
break;
|
||||
case ELightType::Point:
|
||||
case ELightType::Spot:
|
||||
case ELightType::Custom:
|
||||
case ELightType::Directional:
|
||||
{
|
||||
if (curLight >= URDE_MAX_LIGHTS)
|
||||
continue;
|
||||
CModelShaders::Light& lightOut = lights[curLight++];
|
||||
lightOut.pos = CGraphics::g_CameraMatrix * light.GetPosition();
|
||||
lightOut.dir = CGraphics::g_CameraMatrix.basis * light.GetDirection();
|
||||
lightOut.dir.normalize();
|
||||
lightOut.color = light.GetColor();
|
||||
lightOut.linAtt[0] = light.GetAttenuationConstant();
|
||||
lightOut.linAtt[1] = light.GetAttenuationLinear();
|
||||
lightOut.linAtt[2] = light.GetAttenuationQuadratic();
|
||||
lightOut.angAtt[0] = light.GetAngleAttenuationConstant();
|
||||
lightOut.angAtt[1] = light.GetAngleAttenuationLinear();
|
||||
lightOut.angAtt[2] = light.GetAngleAttenuationQuadratic();
|
||||
|
||||
if (light.GetType() == ELightType::Directional)
|
||||
lightOut.pos = (-lightOut.dir) * 1048576.f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (; curLight<URDE_MAX_LIGHTS ; ++curLight)
|
||||
{
|
||||
CModelShaders::Light& lightOut = lights[curLight];
|
||||
lightOut.color = zeus::CColor::skClear;
|
||||
lightOut.linAtt[0] = 1.f;
|
||||
lightOut.angAtt[0] = 1.f;
|
||||
}
|
||||
}
|
||||
|
||||
hecl::Runtime::ShaderCacheExtensions
|
||||
CModelShaders::GetShaderExtensions(boo::IGraphicsDataFactory::Platform plat)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user