GL3: Cleanup dead code

--HG--
branch : opengl3
hg/feature/opengl3
kaetemi 11 years ago
parent 1a40e67fee
commit 62381dd219

@ -145,6 +145,46 @@ struct CProgramIndex
TexMatrix2, TexMatrix2,
TexMatrix3, TexMatrix3,
TexGen0ObjectPlaneS,
TexGen1ObjectPlaneS,
TexGen2ObjectPlaneS,
TexGen3ObjectPlaneS,
TexGen0ObjectPlaneT,
TexGen1ObjectPlaneT,
TexGen2ObjectPlaneT,
TexGen3ObjectPlaneT,
TexGen0ObjectPlaneP,
TexGen1ObjectPlaneP,
TexGen2ObjectPlaneP,
TexGen3ObjectPlaneP,
TexGen0ObjectPlaneQ,
TexGen1ObjectPlaneQ,
TexGen2ObjectPlaneQ,
TexGen3ObjectPlaneQ,
TexGen0EyePlaneS,
TexGen1EyePlaneS,
TexGen2EyePlaneS,
TexGen3EyePlaneS,
TexGen0EyePlaneT,
TexGen1EyePlaneT,
TexGen2EyePlaneT,
TexGen3EyePlaneT,
TexGen0EyePlaneP,
TexGen1EyePlaneP,
TexGen2EyePlaneP,
TexGen3EyePlaneP,
TexGen0EyePlaneQ,
TexGen1EyePlaneQ,
TexGen2EyePlaneQ,
TexGen3EyePlaneQ,
SelfIllumination, SelfIllumination,
Light0DirOrPos, Light0DirOrPos,

@ -391,6 +391,7 @@ public:
void enableLightingVP(bool enable); void enableLightingVP(bool enable);
void touchLightVP(int i); void touchLightVP(int i);
void touchVertexFormatVP(); void touchVertexFormatVP();
void setTexGenModeVP(uint stage, sint mode);
virtual void startSpecularBatch(); virtual void startSpecularBatch();
virtual void endSpecularBatch(); virtual void endSpecularBatch();

@ -128,32 +128,32 @@ void CDriverGL3::setTextureEnvFunction(uint stage, CMaterial& mat)
activateTexEnvColor(stage, env); activateTexEnvColor(stage, env);
// Activate texture generation mapping // Activate texture generation mapping
_DriverGLStates.activeTexture(stage); //_DriverGLStates.activeTexture(stage);
if (mat.getTexCoordGen (stage)) if (mat.getTexCoordGen(stage))
{ {
// set mode and enable. // set mode and enable.
CMaterial::TTexCoordGenMode mode= mat.getTexCoordGenMode(stage); CMaterial::TTexCoordGenMode mode= mat.getTexCoordGenMode(stage);
if (mode==CMaterial::TexCoordGenReflect) if (mode==CMaterial::TexCoordGenReflect)
{ {
// Cubic or normal ? // Cubic or normal ?
if (text->isTextureCube ()) if (text->isTextureCube())
_DriverGLStates.setTexGenMode (stage, GL_REFLECTION_MAP_ARB); setTexGenModeVP(stage, TexGenReflectionMap);
else else
_DriverGLStates.setTexGenMode (stage, GL_SPHERE_MAP); setTexGenModeVP(stage, TexGenSphereMap);
} }
else if (mode==CMaterial::TexCoordGenObjectSpace) else if (mode==CMaterial::TexCoordGenObjectSpace)
{ {
_DriverGLStates.setTexGenMode (stage, GL_OBJECT_LINEAR); setTexGenModeVP(stage, TexGenObjectLinear);
} }
else if (mode==CMaterial::TexCoordGenEyeSpace) else if (mode==CMaterial::TexCoordGenEyeSpace)
{ {
_DriverGLStates.setTexGenMode (stage, GL_EYE_LINEAR); setTexGenModeVP(stage, TexGenEyeLinear);
} }
} }
else else
{ {
// Disable. // Disable.
_DriverGLStates.setTexGenMode(stage, 0); setTexGenModeVP(stage, TexGenDisabled);
} }
} }
} }
@ -835,8 +835,7 @@ void CDriverGL3::setupLightMapPass(uint pass)
// FIXME GL3 LIGHTMAP // FIXME GL3 LIGHTMAP
// Setup gen tex off // Setup gen tex off
_DriverGLStates.activeTexture(0); setTexGenModeVP(0, TexGenDisabled);
_DriverGLStates.setTexGenMode(0, 0);
// And disable other stages. // And disable other stages.
for (uint stage = 1; stage < inlGetNumTextStages(); stage++) for (uint stage = 1; stage < inlGetNumTextStages(); stage++)
@ -932,8 +931,7 @@ void CDriverGL3::setupLightMapPass(uint pass)
activateTexEnvColor(stage, stdEnv); activateTexEnvColor(stage, stdEnv);
// Setup env for texture stage. // Setup env for texture stage.
_DriverGLStates.activeTexture(stage); setTexGenModeVP(stage, TexGenDisabled);
_DriverGLStates.setTexGenMode(stage, 0);
// setup TexEnvCombine4 (ignore alpha part). // setup TexEnvCombine4 (ignore alpha part).
if (_CurrentTexEnvSpecial[stage] != TexEnvSpecialLightMap) if (_CurrentTexEnvSpecial[stage] != TexEnvSpecialLightMap)
@ -961,8 +959,7 @@ void CDriverGL3::setupLightMapPass(uint pass)
activateTexEnvMode(stage, _LightMapLastStageEnv); activateTexEnvMode(stage, _LightMapLastStageEnv);
// Setup gen tex off // Setup gen tex off
_DriverGLStates.activeTexture(stage); setTexGenModeVP(stage, TexGenDisabled);
_DriverGLStates.setTexGenMode(stage, 0);
} }
} }
else else
@ -1087,8 +1084,7 @@ void CDriverGL3::setupSpecularBegin()
activateTexEnvMode(0, env); activateTexEnvMode(0, env);
// Disable texGen for stage 0 // Disable texGen for stage 0
_DriverGLStates.activeTexture(0); setTexGenModeVP(0, TexGenDisabled);
_DriverGLStates.setTexGenMode(0, 0);
// ---- Stage 1 Common Setup. // ---- Stage 1 Common Setup.
// NB don't setup the TexEnv here (stage1 setuped in setupSpecularPass() according to extensions) // NB don't setup the TexEnv here (stage1 setuped in setupSpecularPass() according to extensions)
@ -1105,8 +1101,7 @@ void CDriverGL3::setupSpecularEnd()
{ {
H_AUTO_OGL(CDriverGL3_setupSpecularEnd) H_AUTO_OGL(CDriverGL3_setupSpecularEnd)
// Disable Texture coord generation. // Disable Texture coord generation.
_DriverGLStates.activeTexture(1); setTexGenModeVP(1, TexGenDisabled);
_DriverGLStates.setTexGenMode(1, 0);
// Happiness !!! we have already enabled the stage 1 // Happiness !!! we have already enabled the stage 1
_UserTexMat[ 1 ].identity(); _UserTexMat[ 1 ].identity();

@ -25,12 +25,19 @@ namespace NL3D {
namespace NLDRIVERGL3 { namespace NLDRIVERGL3 {
#endif #endif
static sint TexGenDisabled = -1;
static sint TexGenReflectionMap = 0; // GL_REFLECTION_MAP_ARB
static sint TexGenSphereMap = 1; // GL_SPHERE_MAP
static sint TexGenObjectLinear = 2; // GL_OBJECT_LINEAR
static sint TexGenEyeLinear = 3; // GL_EYE_LINEAR
/// Builtin vertex program description /// Builtin vertex program description
struct CVPBuiltin struct CVPBuiltin
{ {
uint16 VertexFormat; uint16 VertexFormat;
bool Lighting; bool Lighting;
sint LightMode[NL_OPENGL3_MAX_LIGHT]; // -1 when disabled sint LightMode[NL_OPENGL3_MAX_LIGHT]; // -1 when disabled
sint TexGenMode[IDRV_MAT_MAXTEXTURES]; // -1 when disabled
bool Specular; // Reflection bool Specular; // Reflection
bool Fog; bool Fog;
// bool VertexColorLighted; // bool VertexColorLighted;

@ -103,20 +103,9 @@ void CDriverGLStates3::forceDefaults(uint nbStages)
// disable texturing. // disable texturing.
nglActiveTexture(GL_TEXTURE0 + stage); nglActiveTexture(GL_TEXTURE0 + stage);
glDisable(GL_TEXTURE_2D); glDisable(GL_TEXTURE_2D);
glDisable(GL_TEXTURE_CUBE_MAP); glDisable(GL_TEXTURE_CUBE_MAP);
_TextureMode[stage]= TextureDisabled;
// Tex gen init
_TexGenMode[stage] = 0;
glDisable(GL_TEXTURE_RECTANGLE); glDisable(GL_TEXTURE_RECTANGLE);
_TextureMode[stage]= TextureDisabled;
glDisable(GL_TEXTURE_GEN_S);
glDisable(GL_TEXTURE_GEN_T);
glDisable(GL_TEXTURE_GEN_R);
glDisable(GL_TEXTURE_GEN_Q);
} }
// ActiveTexture current texture to 0. // ActiveTexture current texture to 0.
@ -392,7 +381,7 @@ void CDriverGLStates3::setDepthRange(float znear, float zfar)
updateDepthRange(); updateDepthRange();
} }
} }
/*
// *************************************************************************** // ***************************************************************************
void CDriverGLStates3::setTexGenMode (uint stage, GLint mode) void CDriverGLStates3::setTexGenMode (uint stage, GLint mode)
{ {
@ -405,7 +394,7 @@ void CDriverGLStates3::setTexGenMode (uint stage, GLint mode)
_TexGenMode[stage] = mode; _TexGenMode[stage] = mode;
} }
} }
*/
// *************************************************************************** // ***************************************************************************
void CDriverGLStates3::resetTextureMode() void CDriverGLStates3::resetTextureMode()
{ {

@ -113,8 +113,6 @@ public:
* NB : this is done in window coordinate, not in world coordinate as with CMaterial * NB : this is done in window coordinate, not in world coordinate as with CMaterial
*/ */
void setZBias(float zbias); void setZBias(float zbias);
// NB: set 0 to reset TexGen.
void setTexGenMode (uint stage, GLint mode);
// @} // @}
@ -174,8 +172,6 @@ private:
bool _VertexAttribArrayEnabled[CVertexBuffer::NumValue]; bool _VertexAttribArrayEnabled[CVertexBuffer::NumValue];
GLint _TexGenMode[8];
uint _CurrARBVertexBuffer; uint _CurrARBVertexBuffer;
float _DepthRangeNear; float _DepthRangeNear;

@ -41,6 +41,9 @@ bool operator<(const CVPBuiltin &left, const CVPBuiltin &right)
for (sint i = 0; i < NL_OPENGL3_MAX_LIGHT; ++i) for (sint i = 0; i < NL_OPENGL3_MAX_LIGHT; ++i)
if (left.LightMode[i] != right.LightMode[i]) if (left.LightMode[i] != right.LightMode[i])
return left.LightMode[i] < right.LightMode[i]; return left.LightMode[i] < right.LightMode[i];
for (sint i = 0; i < IDRV_MAT_MAXTEXTURES; ++i)
if (left.TexGenMode[i] != right.TexGenMode[i])
return left.TexGenMode[i] < right.TexGenMode[i];
if (left.Specular != right.Specular) if (left.Specular != right.Specular)
return right.Specular; return right.Specular;
if (left.Fog != right.Fog) if (left.Fog != right.Fog)
@ -334,6 +337,16 @@ void CDriverGL3::touchVertexFormatVP()
} }
} }
void CDriverGL3::setTexGenModeVP(uint stage, sint mode)
{
H_AUTO_OGL(CDriverGL3_setTexGenModeVP)
if (m_VPBuiltinCurrent.TexGenMode[stage] != mode)
{
m_VPBuiltinCurrent.TexGenMode[stage] = mode;
m_VPBuiltinTouched = true;
}
}
#ifdef NL_STATIC #ifdef NL_STATIC
} // NLDRIVERGL3 } // NLDRIVERGL3
#endif #endif

@ -114,6 +114,46 @@ const char *CProgramIndex::Names[NUM_UNIFORMS] =
"texMatrix1", "texMatrix1",
"texMatrix2", "texMatrix2",
"texMatrix3", "texMatrix3",
"texGen0ObjectPlaneS",
"texGen1ObjectPlaneS",
"texGen2ObjectPlaneS",
"texGen3ObjectPlaneS",
"texGen0ObjectPlaneT",
"texGen1ObjectPlaneT",
"texGen2ObjectPlaneT",
"texGen3ObjectPlaneT",
"texGen0ObjectPlaneP",
"texGen1ObjectPlaneP",
"texGen2ObjectPlaneP",
"texGen3ObjectPlaneP",
"texGen0ObjectPlaneQ",
"texGen1ObjectPlaneQ",
"texGen2ObjectPlaneQ",
"texGen3ObjectPlaneQ",
"texGen0EyePlaneS",
"texGen1EyePlaneS",
"texGen2EyePlaneS",
"texGen3EyePlaneS",
"texGen0EyePlaneT",
"texGen1EyePlaneT",
"texGen2EyePlaneT",
"texGen3EyePlaneT",
"texGen0EyePlaneP",
"texGen1EyePlaneP",
"texGen2EyePlaneP",
"texGen3EyePlaneP",
"texGen0EyePlaneQ",
"texGen1EyePlaneQ",
"texGen2EyePlaneQ",
"texGen3EyePlaneQ",
"selfIllumination", "selfIllumination",

Loading…
Cancel
Save