Remove more dead code (#108)

This commit is contained in:
sfan5
2022-06-01 15:03:52 +02:00
committed by GitHub
parent 128cf1696c
commit aa095d9525
91 changed files with 8 additions and 14864 deletions

View File

@ -7,7 +7,6 @@
#ifdef _IRR_COMPILE_WITH_OGLES2_
#include "IVideoDriver.h"
#include "SLight.h"
namespace irr
{
@ -17,21 +16,11 @@ namespace video
// Base callback
COGLES2MaterialBaseCB::COGLES2MaterialBaseCB() :
FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-1), NMatrixID(-1), GlobalAmbientID(-1), MaterialAmbientID(-1), MaterialDiffuseID(-1), MaterialEmissiveID(-1), MaterialSpecularID(-1), MaterialShininessID(-1), LightCountID(-1), LightTypeID(-1),
LightPositionID(-1), LightDirectionID(-1), LightAttenuationID(-1), LightAmbientID(-1), LightDiffuseID(-1), LightSpecularID(-1), FogEnableID(-1), FogTypeID(-1), FogColorID(-1), FogStartID(-1),
FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-1), NMatrixID(-1), GlobalAmbientID(-1), MaterialAmbientID(-1), MaterialDiffuseID(-1), MaterialEmissiveID(-1), MaterialSpecularID(-1), MaterialShininessID(-1),
FogEnableID(-1), FogTypeID(-1), FogColorID(-1), FogStartID(-1),
FogEndID(-1), FogDensityID(-1), ThicknessID(-1), LightEnable(false), MaterialAmbient(SColorf(0.f, 0.f, 0.f)), MaterialDiffuse(SColorf(0.f, 0.f, 0.f)), MaterialEmissive(SColorf(0.f, 0.f, 0.f)), MaterialSpecular(SColorf(0.f, 0.f, 0.f)),
MaterialShininess(0.f), FogEnable(0), FogType(1), FogColor(SColorf(0.f, 0.f, 0.f, 1.f)), FogStart(0.f), FogEnd(0.f), FogDensity(0.f), Thickness(1.f)
{
for (u32 i = 0; i < 8; ++i)
{
LightType[i] = 0;
LightPosition[i] = core::vector3df(0.f, 0.f, 0.f);
LightDirection[i] = core::vector3df(0.f, 0.f, 0.f);
LightAttenuation[i] = core::vector3df(0.f, 0.f, 0.f);
LightAmbient[i] = SColorf(0.f, 0.f, 0.f);
LightDiffuse[i] = SColorf(0.f, 0.f, 0.f);
LightSpecular[i] = SColorf(0.f, 0.f, 0.f);
}
}
void COGLES2MaterialBaseCB::OnSetMaterial(const SMaterial& material)
@ -63,14 +52,6 @@ void COGLES2MaterialBaseCB::OnSetConstants(IMaterialRendererServices* services,
MaterialEmissiveID = services->getVertexShaderConstantID("uMaterialEmissive");
MaterialSpecularID = services->getVertexShaderConstantID("uMaterialSpecular");
MaterialShininessID = services->getVertexShaderConstantID("uMaterialShininess");
LightCountID = services->getVertexShaderConstantID("uLightCount");
LightTypeID = services->getVertexShaderConstantID("uLightType");
LightPositionID = services->getVertexShaderConstantID("uLightPosition");
LightDirectionID = services->getVertexShaderConstantID("uLightDirection");
LightAttenuationID = services->getVertexShaderConstantID("uLightAttenuation");
LightAmbientID = services->getVertexShaderConstantID("uLightAmbient");
LightDiffuseID = services->getVertexShaderConstantID("uLightDiffuse");
LightSpecularID = services->getVertexShaderConstantID("uLightSpecular");
FogEnableID = services->getVertexShaderConstantID("uFogEnable");
FogTypeID = services->getVertexShaderConstantID("uFogType");
FogColorID = services->getVertexShaderConstantID("uFogColor");
@ -95,60 +76,6 @@ void COGLES2MaterialBaseCB::OnSetConstants(IMaterialRendererServices* services,
Matrix.makeInverse();
services->setPixelShaderConstant(NMatrixID, Matrix.getTransposed().pointer(), 16);
s32 LightCount = LightEnable ? driver->getDynamicLightCount() : 0;
services->setPixelShaderConstant(LightCountID, &LightCount, 1);
if (LightCount > 0)
{
video::SColorf globalAmbient(driver->getAmbientLight());
services->setVertexShaderConstant(GlobalAmbientID, reinterpret_cast<f32*>(&globalAmbient), 4);
// TODO: this are all vertex shader constants, why are they all set as pixel shader constants? (it currently works so I'm scared to change it...)
services->setPixelShaderConstant(MaterialAmbientID, reinterpret_cast<f32*>(&MaterialAmbient), 4);
services->setPixelShaderConstant(MaterialDiffuseID, reinterpret_cast<f32*>(&MaterialDiffuse), 4);
services->setPixelShaderConstant(MaterialEmissiveID, reinterpret_cast<f32*>(&MaterialEmissive), 4);
services->setPixelShaderConstant(MaterialSpecularID, reinterpret_cast<f32*>(&MaterialSpecular), 4);
services->setPixelShaderConstant(MaterialShininessID, &MaterialShininess, 1);
Matrix = V;
for (s32 i = 0; i < LightCount; ++i)
{
SLight CurrentLight = driver->getDynamicLight(i);
Matrix.transformVect(CurrentLight.Position);
switch (CurrentLight.Type)
{
case ELT_DIRECTIONAL:
LightType[i] = 2;
break;
case ELT_SPOT:
LightType[i] = 1;
break;
default: // ELT_POINT
LightType[i] = 0;
break;
}
LightPosition[i] = CurrentLight.Position;
LightDirection[i] = CurrentLight.Direction;
LightAttenuation[i] = CurrentLight.Attenuation;
LightAmbient[i] = CurrentLight.AmbientColor;
LightDiffuse[i] = CurrentLight.DiffuseColor;
LightSpecular[i] = CurrentLight.SpecularColor;
}
const int MAX_SHADER_LIGHTS = 8; // must be the same as MAX_LIGHTS define in the shader
services->setPixelShaderConstant(LightTypeID, LightType, MAX_SHADER_LIGHTS);
services->setPixelShaderConstant(LightPositionID, reinterpret_cast<f32*>(LightPosition), 3*MAX_SHADER_LIGHTS);
services->setPixelShaderConstant(LightDirectionID, reinterpret_cast<f32*>(LightDirection), 3*MAX_SHADER_LIGHTS);
services->setPixelShaderConstant(LightAttenuationID, reinterpret_cast<f32*>(LightAttenuation), 3*MAX_SHADER_LIGHTS);
services->setPixelShaderConstant(LightAmbientID, reinterpret_cast<f32*>(LightAmbient), 4*MAX_SHADER_LIGHTS);
services->setPixelShaderConstant(LightDiffuseID, reinterpret_cast<f32*>(LightDiffuse), 4*MAX_SHADER_LIGHTS);
services->setPixelShaderConstant(LightSpecularID, reinterpret_cast<f32*>(LightSpecular), 4*MAX_SHADER_LIGHTS);
}
services->setPixelShaderConstant(FogEnableID, &FogEnable, 1);
if (FogEnable)