Remove dead code in COpenGL3MaterialBaseCB

This commit is contained in:
sfan5 2024-09-10 21:02:22 +02:00
parent cc26b5384c
commit 6f275e2ba0
3 changed files with 22 additions and 43 deletions

View File

@ -11,7 +11,6 @@ attribute vec2 inTexCoord0;
uniform mat4 uWVPMatrix; uniform mat4 uWVPMatrix;
uniform mat4 uWVMatrix; uniform mat4 uWVMatrix;
uniform mat4 uNMatrix;
uniform mat4 uTMatrix0; uniform mat4 uTMatrix0;
uniform float uThickness; uniform float uThickness;

View File

@ -4,6 +4,7 @@
// For conditions of distribution and use, see copyright notice in Irrlicht.h // For conditions of distribution and use, see copyright notice in Irrlicht.h
#include "FixedPipelineRenderer.h" #include "FixedPipelineRenderer.h"
#include "os.h"
#include "IVideoDriver.h" #include "IVideoDriver.h"
@ -15,23 +16,20 @@ namespace video
// Base callback // Base callback
COpenGL3MaterialBaseCB::COpenGL3MaterialBaseCB() : COpenGL3MaterialBaseCB::COpenGL3MaterialBaseCB() :
FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-1), NMatrixID(-1), FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-1),
FogEnableID(-1), FogTypeID(-1), FogColorID(-1), FogStartID(-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)), FogEndID(-1), FogDensityID(-1), ThicknessID(-1), Thickness(1.f), FogEnable(false)
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)
{ {
} }
void COpenGL3MaterialBaseCB::OnSetMaterial(const SMaterial &material) void COpenGL3MaterialBaseCB::OnSetMaterial(const SMaterial &material)
{ {
LightEnable = material.Lighting; #ifdef _DEBUG
MaterialAmbient = SColorf(material.AmbientColor); if (material.Lighting)
MaterialDiffuse = SColorf(material.DiffuseColor); os::Printer::log("Lighted material not supported in unified driver.", ELL_INFORMATION);
MaterialEmissive = SColorf(material.EmissiveColor); #endif
MaterialSpecular = SColorf(material.SpecularColor);
MaterialShininess = material.Shininess;
FogEnable = material.FogEnable ? 1 : 0; FogEnable = material.FogEnable;
Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f; Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f;
} }
@ -43,7 +41,6 @@ void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices *services,
if (FirstUpdateBase) { if (FirstUpdateBase) {
WVPMatrixID = services->getVertexShaderConstantID("uWVPMatrix"); WVPMatrixID = services->getVertexShaderConstantID("uWVPMatrix");
WVMatrixID = services->getVertexShaderConstantID("uWVMatrix"); WVMatrixID = services->getVertexShaderConstantID("uWVMatrix");
NMatrixID = services->getVertexShaderConstantID("uNMatrix");
FogEnableID = services->getVertexShaderConstantID("uFogEnable"); FogEnableID = services->getVertexShaderConstantID("uFogEnable");
FogTypeID = services->getVertexShaderConstantID("uFogType"); FogTypeID = services->getVertexShaderConstantID("uFogType");
@ -56,31 +53,29 @@ void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices *services,
FirstUpdateBase = false; FirstUpdateBase = false;
} }
const core::matrix4 W = driver->getTransform(ETS_WORLD); const core::matrix4 &W = driver->getTransform(ETS_WORLD);
const core::matrix4 V = driver->getTransform(ETS_VIEW); const core::matrix4 &V = driver->getTransform(ETS_VIEW);
const core::matrix4 P = driver->getTransform(ETS_PROJECTION); const core::matrix4 &P = driver->getTransform(ETS_PROJECTION);
core::matrix4 Matrix = P * V * W; core::matrix4 Matrix = V * W;
services->setPixelShaderConstant(WVPMatrixID, Matrix.pointer(), 16);
Matrix = V * W;
services->setPixelShaderConstant(WVMatrixID, Matrix.pointer(), 16); services->setPixelShaderConstant(WVMatrixID, Matrix.pointer(), 16);
Matrix.makeInverse(); Matrix = P * Matrix;
services->setPixelShaderConstant(NMatrixID, Matrix.getTransposed().pointer(), 16); services->setPixelShaderConstant(WVPMatrixID, Matrix.pointer(), 16);
services->setPixelShaderConstant(FogEnableID, &FogEnable, 1); s32 TempEnable = FogEnable ? 1 : 0;
services->setPixelShaderConstant(FogEnableID, &TempEnable, 1);
if (FogEnable) { if (FogEnable) {
SColor TempColor(0); SColor TempColor(0);
E_FOG_TYPE TempType = EFT_FOG_LINEAR; E_FOG_TYPE TempType = EFT_FOG_LINEAR;
bool TempPerFragment = false; f32 FogStart, FogEnd, FogDensity;
bool TempRange = false; bool unused = false;
driver->getFog(TempColor, TempType, FogStart, FogEnd, FogDensity, TempPerFragment, TempRange); driver->getFog(TempColor, TempType, FogStart, FogEnd, FogDensity, unused, unused);
FogType = (s32)TempType; s32 FogType = (s32)TempType;
FogColor = SColorf(TempColor); SColorf FogColor(TempColor);
services->setPixelShaderConstant(FogTypeID, &FogType, 1); services->setPixelShaderConstant(FogTypeID, &FogType, 1);
services->setPixelShaderConstant(FogColorID, reinterpret_cast<f32 *>(&FogColor), 4); services->setPixelShaderConstant(FogColorID, reinterpret_cast<f32 *>(&FogColor), 4);

View File

@ -26,7 +26,6 @@ protected:
s32 WVPMatrixID; s32 WVPMatrixID;
s32 WVMatrixID; s32 WVMatrixID;
s32 NMatrixID;
s32 FogEnableID; s32 FogEnableID;
s32 FogTypeID; s32 FogTypeID;
@ -37,22 +36,8 @@ protected:
s32 ThicknessID; s32 ThicknessID;
bool LightEnable;
SColorf GlobalAmbient;
SColorf MaterialAmbient;
SColorf MaterialDiffuse;
SColorf MaterialEmissive;
SColorf MaterialSpecular;
f32 MaterialShininess;
s32 FogEnable;
s32 FogType;
SColorf FogColor;
f32 FogStart;
f32 FogEnd;
f32 FogDensity;
f32 Thickness; f32 Thickness;
bool FogEnable;
}; };
class COpenGL3MaterialSolidCB : public COpenGL3MaterialBaseCB class COpenGL3MaterialSolidCB : public COpenGL3MaterialBaseCB