mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-14 04:46:09 +00:00
aurora: Code cleanup, more performant hashing
This commit is contained in:
@@ -10,54 +10,54 @@ namespace metaforce {
|
||||
|
||||
//std::unordered_map<uint64_t, CModelShaders::ShaderPipelines> CModelShaders::g_ShaderPipelines;
|
||||
|
||||
void CModelShaders::LightingUniform::ActivateLights(const std::vector<CLight>& lts) {
|
||||
ambient = zeus::skClear;
|
||||
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 >= lights.size()) {
|
||||
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 < lights.size(); ++curLight) {
|
||||
CModelShaders::Light& lightOut = lights[curLight];
|
||||
lightOut.pos = zeus::skZero3f;
|
||||
lightOut.dir = zeus::skDown;
|
||||
lightOut.color = zeus::skClear;
|
||||
lightOut.linAtt[0] = 1.f;
|
||||
lightOut.linAtt[1] = 0.f;
|
||||
lightOut.linAtt[2] = 0.f;
|
||||
lightOut.angAtt[0] = 1.f;
|
||||
lightOut.angAtt[1] = 0.f;
|
||||
lightOut.angAtt[2] = 0.f;
|
||||
}
|
||||
}
|
||||
//void CModelShaders::LightingUniform::ActivateLights(const std::vector<CLight>& lts) {
|
||||
// ambient = zeus::skClear;
|
||||
// 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 >= lights.size()) {
|
||||
// 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 < lights.size(); ++curLight) {
|
||||
// CModelShaders::Light& lightOut = lights[curLight];
|
||||
// lightOut.pos = zeus::skZero3f;
|
||||
// lightOut.dir = zeus::skDown;
|
||||
// lightOut.color = zeus::skClear;
|
||||
// lightOut.linAtt[0] = 1.f;
|
||||
// lightOut.linAtt[1] = 0.f;
|
||||
// lightOut.linAtt[2] = 0.f;
|
||||
// lightOut.angAtt[0] = 1.f;
|
||||
// lightOut.angAtt[1] = 0.f;
|
||||
// lightOut.angAtt[2] = 0.f;
|
||||
// }
|
||||
//}
|
||||
|
||||
//using TexCoordSource = hecl::Backend::TexCoordSource;
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user