GL3: Remove dead code

--HG--
branch : opengl3
hg/feature/opengl3
kaetemi 11 years ago
parent 12cb0ac306
commit c270ec5a58

@ -602,13 +602,15 @@ namespace NL3D
ss << "fragColor = texop" << (IDRV_MAT_MAXTEXTURES - 1) << ";" << std::endl;
if (desc->fogEnabled())
addFog();
//if (desc->fogEnabled())
// addFog();
addAlphaTest();
// ss << "fragColor = fragColor + vec4(0.0, 0.25, 0.0, 0.0);" << std::endl;
// ss << "fragColor.b = diffuse.b;" << std::endl;
ss << "}" << std::endl;
}
@ -706,6 +708,24 @@ namespace NL3D
ss << "vec4 texop" << stage << ";" << std::endl;
// RGB
switch (material->_TexEnvs[stage].Env.OpRGB)
{
case CMaterial::InterpolateConstant:
ss << "float texop" << stage << "rgbAs = constant" << stage << ".a;" << std::endl;
break;
case CMaterial::InterpolatePrevious:
if (stage > 0)
{
ss << "float texop" << stage << "rgbAs = texop" << stage << ".a;" << std::endl;
break;
}
case CMaterial::InterpolateDiffuse:
ss << "float texop" << stage << "rgbAs = diffuse.a;" << std::endl;
break;
case CMaterial::InterpolateTexture:
ss << "float texop" << stage << "rgbAs = texel" << stage << ".a;" << std::endl;
break;
}
ss << "texop" << stage << ".rgb = ";
switch (material->_TexEnvs[stage].Env.OpRGB)
{
@ -725,7 +745,7 @@ namespace NL3D
case CMaterial::InterpolateDiffuse:
case CMaterial::InterpolatePrevious:
case CMaterial::InterpolateTexture:
ss << "texop" << stage << "arg0.rgb * vec3(0.5, 0.5, 0.5)"; // TODO !!!!
ss << "texop" << stage << "arg0.rgb * texop" << stage << "rgbAs + texop" << stage << "arg1.rgb * (1.0 - texop" << stage << "rgbAs)";
break;
case CMaterial::Mad:
ss << "texop" << stage << "arg0.rgb * texop" << stage << "arg1.rgb + texop" << stage << "arg2.rgb";
@ -734,6 +754,24 @@ namespace NL3D
ss << ";" << std::endl;
// Alpha
switch (material->_TexEnvs[stage].Env.OpAlpha)
{
case CMaterial::InterpolateConstant:
ss << "float texop" << stage << "alphaAs = constant" << stage << ".a;" << std::endl;
break;
case CMaterial::InterpolatePrevious:
if (stage > 0)
{
ss << "float texop" << stage << "alphaAs = texop" << stage << ".a;" << std::endl;
break;
}
case CMaterial::InterpolateDiffuse:
ss << "float texop" << stage << "alphaAs = diffuse.a;" << std::endl;
break;
case CMaterial::InterpolateTexture:
ss << "float texop" << stage << "alphaAs = texel" << stage << ".a;" << std::endl;
break;
}
ss << "texop" << stage << ".a = ";
switch (material->_TexEnvs[stage].Env.OpAlpha)
{
@ -753,7 +791,7 @@ namespace NL3D
case CMaterial::InterpolateDiffuse:
case CMaterial::InterpolatePrevious:
case CMaterial::InterpolateTexture:
ss << "texop" << stage << "arg0.a * 0.5"; // TODO !!!!
ss << "texop" << stage << "arg0.a * texop" << stage << "rgbAs + texop" << stage << "arg1.a * (1.0 - texop" << stage << "rgbAs)";
break;
case CMaterial::Mad:
ss << "texop" << stage << "arg0.a * texop" << stage << "arg1.a + texop" << stage << "arg2.a";
@ -861,6 +899,8 @@ namespace NL3D
addAlphaTest();
// ss << "fragColor.r = 0.5;" << std::endl;
ss << "}" << std::endl;
ss << std::endl;
}

@ -452,13 +452,13 @@ bool CDriverGL3::setupMaterial(CMaterial& mat)
enableLightingVP(mat.getFlags() & IDRV_MAT_LIGHTING);
if (mat.getFlags()&IDRV_MAT_LIGHTING)
{
_DriverGLStates.setEmissive(pShader->PackedEmissive, pShader->Emissive);
/*_DriverGLStates.setEmissive(pShader->PackedEmissive, pShader->Emissive);
_DriverGLStates.setAmbient(pShader->PackedAmbient, pShader->Ambient);
_DriverGLStates.setDiffuse(pShader->PackedDiffuse, pShader->Diffuse);
_DriverGLStates.setSpecular(pShader->PackedSpecular, pShader->Specular);
_DriverGLStates.setShininess(mat.getShininess());
_DriverGLStates.setVertexColorLighted(mat.isLightedVertexColor ());
_DriverGLStates.setVertexColorLighted(mat.isLightedVertexColor ());*/
// FIXME GL3 VERTEX COLOR VP
}
else
{
@ -466,7 +466,8 @@ bool CDriverGL3::setupMaterial(CMaterial& mat)
// CRGBA col= mat.getColor();
// glColor4ub(col.R, col.G, col.B, col.A);
_DriverGLStates.setVertexColorLighted(false);
// _DriverGLStates.setVertexColorLighted(false);
// FIXME GL3 VERTEX COLOR VP
}
// Fog Part.
@ -790,11 +791,12 @@ sint CDriverGL3::beginLightMapMultiPass ()
setupLightMapDynamicLighting(true);
// reset Ambient and specular lighting
static uint32 packedColorBlack= CRGBA(0,0,0,255).getPacked();
static GLfloat glcolBlack[4]= {0,0,0,1};
// static uint32 packedColorBlack= CRGBA(0,0,0,255).getPacked();
// static GLfloat glcolBlack[4]= {0,0,0,1};
// lightmap get no specular/ambient. Emissive and Diffuse are setuped in setupLightMapPass()
_DriverGLStates.setAmbient(packedColorBlack, glcolBlack);
_DriverGLStates.setSpecular(packedColorBlack, glcolBlack);
// _DriverGLStates.setAmbient(packedColorBlack, glcolBlack);
// _DriverGLStates.setSpecular(packedColorBlack, glcolBlack);
// FIXME GL3 LIGHTMAP
// Manage too if no lightmaps.
return std::max (_NLightMapPass, (uint)1);
@ -829,7 +831,8 @@ void CDriverGL3::setupLightMapPass(uint pass)
// Since Lighting is disabled, as well as colorArray, must setup alpha.
// setup color to 0 => blackness. in emissive cause texture can still be lighted by dynamic light
_DriverGLStates.setEmissive(packedColorBlack, glcolBlack);
// _DriverGLStates.setEmissive(packedColorBlack, glcolBlack);
// FIXME GL3 LIGHTMAP
// Setup gen tex off
_DriverGLStates.activeTexture(0);
@ -877,10 +880,11 @@ void CDriverGL3::setupLightMapPass(uint pass)
b= std::min(b, (uint32)255);
// this color will be added to the first lightmap (with help of emissive)
CRGBA col((uint8)r,(uint8)g,(uint8)b,255);
GLfloat glcol[4];
convColor(col, glcol);
_DriverGLStates.setEmissive(col.getPacked(), glcol);
// CRGBA col((uint8)r,(uint8)g,(uint8)b,255);
// GLfloat glcol[4];
// convColor(col, glcol);
// _DriverGLStates.setEmissive(col.getPacked(), glcol);
// FIXME GL3 LIGHTMAP
}
// setup all stages.
@ -1025,14 +1029,18 @@ void CDriverGL3::setupLightMapPass(uint pass)
if (pass==0)
{
// If the lightmap is in x2 mode, then must divide effect of the dynamic light too
if (mat._LightMapsMulx2)
_DriverGLStates.setDiffuse(packedColorGrey, glcolGrey);
else
_DriverGLStates.setDiffuse(packedColorWhite, glcolWhite);
// if (mat._LightMapsMulx2)
// _DriverGLStates.setDiffuse(packedColorGrey, glcolGrey);
// else
// _DriverGLStates.setDiffuse(packedColorWhite, glcolWhite);
// FIXME GL3 LIGHTMAP
}
// no need to reset for pass after 1, since same than prec pass (black)!
else if (pass==1)
_DriverGLStates.setDiffuse(packedColorBlack, glcolBlack);
{
// _DriverGLStates.setDiffuse(packedColorBlack, glcolBlack);
// FIXME GL3 LIGHTMAP
}
}
// ***************************************************************************

@ -105,19 +105,6 @@ void CDriverGLStates3::forceDefaults(uint nbStages)
glStencilOp(_CurStencilOpFail, _CurStencilOpZFail, _CurStencilOpZPass);
glStencilMask(_CurStencilWriteMask);
// Materials.
uint32 packedOne = (CRGBA(255, 255, 255, 255)).getPacked();
uint32 packedZero = (CRGBA(0, 0, 0, 255)).getPacked();
_CurEmissive = packedZero;
_CurAmbient = packedOne;
_CurDiffuse = packedOne;
_CurSpecular = packedZero;
_CurShininess = 1;
// Lighted vertex color
_VertexColorLighted = false;
glDisable(GL_COLOR_MATERIAL);
// setup GLStates.
static const GLfloat one[4] = { 1, 1, 1, 1 };
static const GLfloat zero[4] = { 0, 0, 0, 1 };
@ -369,68 +356,6 @@ void CDriverGLStates3::stencilMask(GLuint mask)
}
}
// ***************************************************************************
void CDriverGLStates3::setEmissive(uint32 packedColor, const GLfloat color[4])
{
H_AUTO_OGL(CDriverGLStates3_setEmissive)
#ifndef NL3D_GLSTATE_DISABLE_CACHE
if (packedColor!=_CurEmissive)
#endif
{
_CurEmissive= packedColor;
}
}
// ***************************************************************************
void CDriverGLStates3::setAmbient(uint32 packedColor, const GLfloat color[4])
{
H_AUTO_OGL(CDriverGLStates3_setAmbient)
#ifndef NL3D_GLSTATE_DISABLE_CACHE
if (packedColor!=_CurAmbient)
#endif
{
_CurAmbient= packedColor;
}
}
// ***************************************************************************
void CDriverGLStates3::setDiffuse(uint32 packedColor, const GLfloat color[4])
{
H_AUTO_OGL(CDriverGLStates3_setDiffuse)
#ifndef NL3D_GLSTATE_DISABLE_CACHE
if (packedColor!=_CurDiffuse)
#endif
{
_CurDiffuse= packedColor;
}
}
// ***************************************************************************
void CDriverGLStates3::setSpecular(uint32 packedColor, const GLfloat color[4])
{
H_AUTO_OGL(CDriverGLStates3_setSpecular)
#ifndef NL3D_GLSTATE_DISABLE_CACHE
if (packedColor!=_CurSpecular)
#endif
{
_CurSpecular= packedColor;
}
}
// ***************************************************************************
void CDriverGLStates3::setShininess(float shin)
{
H_AUTO_OGL(CDriverGLStates3_setShininess)
#ifndef NL3D_GLSTATE_DISABLE_CACHE
if (shin != _CurShininess)
#endif
{
_CurShininess= shin;
}
}
// ***************************************************************************
static void convColor(CRGBA col, GLfloat glcol[4])
{
@ -442,19 +367,6 @@ static void convColor(CRGBA col, GLfloat glcol[4])
glcol[3]= col.A*OO255;
}
// ***************************************************************************
void CDriverGLStates3::setVertexColorLighted(bool enable)
{
H_AUTO_OGL(CDriverGLStates3_setVertexColorLighted)
#ifndef NL3D_GLSTATE_DISABLE_CACHE
if (enable != _VertexColorLighted)
#endif
{
_VertexColorLighted= enable;
}
}
// ***************************************************************************
void CDriverGLStates3::updateDepthRange()
{

@ -107,12 +107,6 @@ public:
/// \name Material setting.
/// Each f() get an uint32 for fast comparison, and OpenGL colors.
// @{
void setEmissive(uint32 packedColor, const GLfloat color[4]);
void setAmbient(uint32 packedColor, const GLfloat color[4]);
void setDiffuse(uint32 packedColor, const GLfloat color[4]);
void setSpecular(uint32 packedColor, const GLfloat color[4]);
void setShininess(float shin);
void setVertexColorLighted(bool enable);
void setDepthRange (float znear, float zfar);
void getDepthRange(float &znear, float &zfar) const { znear = _DepthRangeNear; zfar = _DepthRangeFar; }
/** Set z-bias
@ -175,13 +169,6 @@ private:
GLuint _CurStencilWriteMask;
float _CurAlphaTestThreshold;
uint32 _CurEmissive;
uint32 _CurAmbient;
uint32 _CurDiffuse;
uint32 _CurSpecular;
float _CurShininess;
bool _VertexColorLighted;
uint _CurrentActiveTexture;
TTextureMode _TextureMode[8];

Loading…
Cancel
Save