mirror of
https://github.com/minetest/minetest.git
synced 2024-11-19 22:23:46 +01:00
Remove dead code in COpenGL3MaterialBaseCB
This commit is contained in:
parent
cc26b5384c
commit
6f275e2ba0
@ -11,7 +11,6 @@ attribute vec2 inTexCoord0;
|
||||
|
||||
uniform mat4 uWVPMatrix;
|
||||
uniform mat4 uWVMatrix;
|
||||
uniform mat4 uNMatrix;
|
||||
uniform mat4 uTMatrix0;
|
||||
|
||||
uniform float uThickness;
|
||||
|
@ -4,6 +4,7 @@
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "FixedPipelineRenderer.h"
|
||||
#include "os.h"
|
||||
|
||||
#include "IVideoDriver.h"
|
||||
|
||||
@ -15,23 +16,20 @@ namespace video
|
||||
// Base callback
|
||||
|
||||
COpenGL3MaterialBaseCB::COpenGL3MaterialBaseCB() :
|
||||
FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-1), NMatrixID(-1),
|
||||
FirstUpdateBase(true), WVPMatrixID(-1), WVMatrixID(-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)
|
||||
FogEndID(-1), FogDensityID(-1), ThicknessID(-1), Thickness(1.f), FogEnable(false)
|
||||
{
|
||||
}
|
||||
|
||||
void COpenGL3MaterialBaseCB::OnSetMaterial(const SMaterial &material)
|
||||
{
|
||||
LightEnable = material.Lighting;
|
||||
MaterialAmbient = SColorf(material.AmbientColor);
|
||||
MaterialDiffuse = SColorf(material.DiffuseColor);
|
||||
MaterialEmissive = SColorf(material.EmissiveColor);
|
||||
MaterialSpecular = SColorf(material.SpecularColor);
|
||||
MaterialShininess = material.Shininess;
|
||||
#ifdef _DEBUG
|
||||
if (material.Lighting)
|
||||
os::Printer::log("Lighted material not supported in unified driver.", ELL_INFORMATION);
|
||||
#endif
|
||||
|
||||
FogEnable = material.FogEnable ? 1 : 0;
|
||||
FogEnable = material.FogEnable;
|
||||
|
||||
Thickness = (material.Thickness > 0.f) ? material.Thickness : 1.f;
|
||||
}
|
||||
@ -43,7 +41,6 @@ void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices *services,
|
||||
if (FirstUpdateBase) {
|
||||
WVPMatrixID = services->getVertexShaderConstantID("uWVPMatrix");
|
||||
WVMatrixID = services->getVertexShaderConstantID("uWVMatrix");
|
||||
NMatrixID = services->getVertexShaderConstantID("uNMatrix");
|
||||
|
||||
FogEnableID = services->getVertexShaderConstantID("uFogEnable");
|
||||
FogTypeID = services->getVertexShaderConstantID("uFogType");
|
||||
@ -56,31 +53,29 @@ void COpenGL3MaterialBaseCB::OnSetConstants(IMaterialRendererServices *services,
|
||||
FirstUpdateBase = false;
|
||||
}
|
||||
|
||||
const core::matrix4 W = driver->getTransform(ETS_WORLD);
|
||||
const core::matrix4 V = driver->getTransform(ETS_VIEW);
|
||||
const core::matrix4 P = driver->getTransform(ETS_PROJECTION);
|
||||
const core::matrix4 &W = driver->getTransform(ETS_WORLD);
|
||||
const core::matrix4 &V = driver->getTransform(ETS_VIEW);
|
||||
const core::matrix4 &P = driver->getTransform(ETS_PROJECTION);
|
||||
|
||||
core::matrix4 Matrix = P * V * W;
|
||||
services->setPixelShaderConstant(WVPMatrixID, Matrix.pointer(), 16);
|
||||
|
||||
Matrix = V * W;
|
||||
core::matrix4 Matrix = V * W;
|
||||
services->setPixelShaderConstant(WVMatrixID, Matrix.pointer(), 16);
|
||||
|
||||
Matrix.makeInverse();
|
||||
services->setPixelShaderConstant(NMatrixID, Matrix.getTransposed().pointer(), 16);
|
||||
Matrix = P * Matrix;
|
||||
services->setPixelShaderConstant(WVPMatrixID, Matrix.pointer(), 16);
|
||||
|
||||
services->setPixelShaderConstant(FogEnableID, &FogEnable, 1);
|
||||
s32 TempEnable = FogEnable ? 1 : 0;
|
||||
services->setPixelShaderConstant(FogEnableID, &TempEnable, 1);
|
||||
|
||||
if (FogEnable) {
|
||||
SColor TempColor(0);
|
||||
E_FOG_TYPE TempType = EFT_FOG_LINEAR;
|
||||
bool TempPerFragment = false;
|
||||
bool TempRange = false;
|
||||
f32 FogStart, FogEnd, FogDensity;
|
||||
bool unused = false;
|
||||
|
||||
driver->getFog(TempColor, TempType, FogStart, FogEnd, FogDensity, TempPerFragment, TempRange);
|
||||
driver->getFog(TempColor, TempType, FogStart, FogEnd, FogDensity, unused, unused);
|
||||
|
||||
FogType = (s32)TempType;
|
||||
FogColor = SColorf(TempColor);
|
||||
s32 FogType = (s32)TempType;
|
||||
SColorf FogColor(TempColor);
|
||||
|
||||
services->setPixelShaderConstant(FogTypeID, &FogType, 1);
|
||||
services->setPixelShaderConstant(FogColorID, reinterpret_cast<f32 *>(&FogColor), 4);
|
||||
|
@ -26,7 +26,6 @@ protected:
|
||||
|
||||
s32 WVPMatrixID;
|
||||
s32 WVMatrixID;
|
||||
s32 NMatrixID;
|
||||
|
||||
s32 FogEnableID;
|
||||
s32 FogTypeID;
|
||||
@ -37,22 +36,8 @@ protected:
|
||||
|
||||
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;
|
||||
bool FogEnable;
|
||||
};
|
||||
|
||||
class COpenGL3MaterialSolidCB : public COpenGL3MaterialBaseCB
|
||||
|
Loading…
Reference in New Issue
Block a user