More fixed functionality pipeline disabled with conditional build.

--HG--
branch : gsoc2013-dfighter
hg/feature/gsoc2013-dfighter
dfighter1985 11 years ago
parent 997a231bff
commit 0ab6322955

@ -1014,6 +1014,7 @@ private:
{
static const float OO255= 1.0f/255;
_CurrentTexEnv[stage].ConstantColor= col;
#ifndef GLSL
// Setup the gl cte color.
_DriverGLStates.activeTextureARB(stage);
GLfloat glcol[4];
@ -1022,6 +1023,7 @@ private:
glcol[2]= col.B*OO255;
glcol[3]= col.A*OO255;
glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, glcol);
#endif
}
void forceActivateTexEnvColor(uint stage, const CMaterial::CTexEnv &env)
{

@ -69,6 +69,7 @@ void CDriverGL3::setLightInternal(uint8 num, const CLight& light)
// Copy the mode
_LightMode[num]=mode;
#ifndef GLSL
// Set the ambiant color
GLfloat colorGL[4];
CRGBA colorNeL=light.getAmbiant ();
@ -111,6 +112,8 @@ void CDriverGL3::setLightInternal(uint8 num, const CLight& light)
glLightf (lightNum, GL_LINEAR_ATTENUATION, light.getLinearAttenuation());
glLightf (lightNum, GL_QUADRATIC_ATTENUATION, light.getQuadraticAttenuation());
#endif
// Set the position
if ((mode==CLight::DirectionalLight)||(mode==CLight::SpotLight))
{
@ -129,20 +132,27 @@ void CDriverGL3::setLightInternal(uint8 num, const CLight& light)
// Get the exponent of the spot
float exponent=light.getExponent ();
#ifndef GLSL
// Set it
glLightf (lightNum, GL_SPOT_EXPONENT, exponent);
#endif
// Get the cutoff of the spot
float cutoff=180.f*(light.getCutoff ()/(float)NLMISC::Pi);
#ifndef GLSL
// Set it
glLightf (lightNum, GL_SPOT_CUTOFF, cutoff);
#endif
}
else
{
#ifndef GLSL
// Disable spot properties
glLighti (lightNum, GL_SPOT_CUTOFF, 180);
glLighti (lightNum, GL_SPOT_EXPONENT, 0);
#endif
}
// Flag this light as dirt.
@ -199,6 +209,8 @@ void CDriverGL3::enableLightInternal(uint8 num, bool enable)
void CDriverGL3::setAmbientColor (CRGBA color)
{
H_AUTO_OGL(CDriverGL3_setAmbientColor )
#ifndef GLSL
// Gl array
GLfloat array[4];
array[0]=(float)color.R/255.f;
@ -208,6 +220,8 @@ void CDriverGL3::setAmbientColor (CRGBA color)
// Set the color
glLightModelfv (GL_LIGHT_MODEL_AMBIENT, array);
#endif
}
@ -218,6 +232,8 @@ void CDriverGL3::cleanLightSetup ()
// Should be dirty
nlassert (_LightSetupDirty);
#ifndef GLSL
// First light
bool first=true;
@ -296,6 +312,8 @@ void CDriverGL3::cleanLightSetup ()
if (!first)
glPopMatrix ();
#endif
// Clean flag
_LightSetupDirty=false;
}

@ -828,6 +828,7 @@ void CDriverGL3::setupLightMapPass(uint pass)
// TexEnv is special.
_CurrentTexEnvSpecial[stage] = TexEnvSpecialLightMap;
#ifndef GLSL
{
// ATI EnvCombine3
// What we want to setup is Texture*Constant + Previous.
@ -845,6 +846,7 @@ void CDriverGL3::setupLightMapPass(uint pass)
glTexEnvi(GL_TEXTURE_ENV, GL_SOURCE1_RGB_EXT, GL_PREVIOUS_EXT );
glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB_EXT, GL_SRC_COLOR);
}
#endif
}
}
@ -982,7 +984,9 @@ void CDriverGL3::endLightMapMultiPass()
// If multi-pass, then must reset the fog color
if(_NLightMapPass>=2 && _FogEnabled)
{
#ifndef GLSL
glFogfv(GL_FOG_COLOR, _CurrentFogColor);
#endif
}
// nothing to do with blending/lighting, since always setuped in activeMaterial().
@ -992,11 +996,13 @@ void CDriverGL3::endLightMapMultiPass()
// Clean up all stage for Multiply x 2
if (_CurrentMaterial->_LightMapsMulx2)
{
#ifndef GLSL
for (uint32 i = 0; i < (_NLightMapPerPass+1); ++i)
{
_DriverGLStates.activeTextureARB(i);
glTexEnvi(GL_TEXTURE_ENV, GL_RGB_SCALE_EXT, 1);
}
#endif
}
}

@ -166,9 +166,11 @@ void CDriverGL3::doRefreshRenderSetup()
if( _ProjMatDirty )
{
#ifndef GLSL
glMatrixMode( GL_PROJECTION );
glLoadMatrixf( _GLProjMat.get() );
glMatrixMode( GL_MODELVIEW );
#endif
_ProjMatDirty = false;
}
@ -176,11 +178,13 @@ void CDriverGL3::doRefreshRenderSetup()
// Check if must update the modelViewMatrix
if( _ModelViewMatrixDirty )
{
#ifndef GLSL
// By default, the first model matrix is active
glLoadMatrixf( _ModelViewMatrix.get() );
// enable normalize if matrix has scale.
enableGlNormalize( _ModelViewMatrix.hasScalePart() || _ForceNormalize );
// clear.
#endif
_ModelViewMatrixDirty= false;
}
@ -190,6 +194,7 @@ void CDriverGL3::doRefreshRenderSetup()
void CDriverGL3::refreshTexMatrices()
{
#ifndef GLSL
glMatrixMode( GL_TEXTURE );
for( int i = 0; i < IDRV_MAT_MAXTEXTURES; i++ )
{
@ -201,6 +206,7 @@ void CDriverGL3::refreshTexMatrices()
}
}
glMatrixMode( GL_MODELVIEW );
#endif
}
#ifdef NL_STATIC

@ -299,10 +299,12 @@ void CDriverGLStates3::enableLight(uint num, uint enable)
// new state.
_CurLight[num]= enabled;
// Setup GLState.
#ifndef GLSL
if(_CurLight[num])
glEnable ((GLenum)(GL_LIGHT0+num));
else
glDisable ((GLenum)(GL_LIGHT0+num));
#endif
}
}
@ -424,7 +426,9 @@ void CDriverGLStates3::alphaFunc(float threshold)
// new state
_CurAlphaTestThreshold= threshold;
// setup function.
#ifndef GLSL
glAlphaFunc(GL_GREATER, _CurAlphaTestThreshold);
#endif
}
}
@ -492,7 +496,9 @@ void CDriverGLStates3::setEmissive(uint32 packedColor, const GLfloat color[4])
#endif
{
_CurEmissive= packedColor;
#ifndef GLSL
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, color);
#endif
}
}
@ -505,7 +511,9 @@ void CDriverGLStates3::setAmbient(uint32 packedColor, const GLfloat color[4])
#endif
{
_CurAmbient= packedColor;
#ifndef GLSL
glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color);
#endif
}
}
@ -518,7 +526,9 @@ void CDriverGLStates3::setDiffuse(uint32 packedColor, const GLfloat color[4])
#endif
{
_CurDiffuse= packedColor;
#ifndef GLSL
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color);
#endif
}
}
@ -531,7 +541,9 @@ void CDriverGLStates3::setSpecular(uint32 packedColor, const GLfloat color[4])
#endif
{
_CurSpecular= packedColor;
#ifndef GLSL
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, color);
#endif
}
}
@ -544,7 +556,9 @@ void CDriverGLStates3::setShininess(float shin)
#endif
{
_CurShininess= shin;
#ifndef GLSL
glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, shin);
#endif
}
}
@ -570,6 +584,8 @@ void CDriverGLStates3::setVertexColorLighted(bool enable)
{
_VertexColorLighted= enable;
#ifndef GLSL
if (_VertexColorLighted)
{
glEnable (GL_COLOR_MATERIAL);
@ -588,6 +604,8 @@ void CDriverGLStates3::setVertexColorLighted(bool enable)
convColor(diffCol, glColor);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, glColor);
}
#endif
}
}
@ -643,6 +661,8 @@ void CDriverGLStates3::setTexGenMode (uint stage, GLint mode)
{
_TexGenMode[stage] = mode;
#ifndef GLSL
if (!_TextureCubeMapSupported) return;
if(mode==0)
@ -680,6 +700,8 @@ void CDriverGLStates3::setTexGenMode (uint stage, GLint mode)
glEnable( GL_TEXTURE_GEN_T );
glEnable( GL_TEXTURE_GEN_R );
}
#endif
}
}
@ -688,6 +710,8 @@ void CDriverGLStates3::resetTextureMode()
{
H_AUTO_OGL(CDriverGLStates3_resetTextureMode);
#ifndef GLSL
glDisable(GL_TEXTURE_2D);
if (_TextureCubeMapSupported)
@ -700,6 +724,8 @@ void CDriverGLStates3::resetTextureMode()
glDisable(GL_TEXTURE_RECTANGLE_NV);
}
#endif
_TextureMode[_CurrentActiveTextureARB]= TextureDisabled;
}
@ -711,6 +737,9 @@ void CDriverGLStates3::setTextureMode(TTextureMode texMode)
TTextureMode oldTexMode = _TextureMode[_CurrentActiveTextureARB];
if(oldTexMode != texMode)
{
#ifndef GLSL
// Disable first old mode.
if (oldTexMode == Texture2D)
{
@ -767,6 +796,8 @@ void CDriverGLStates3::setTextureMode(TTextureMode texMode)
}
}
#endif
// new mode.
_TextureMode[_CurrentActiveTextureARB]= texMode;
}
@ -799,6 +830,8 @@ void CDriverGLStates3::forceActiveTextureARB(uint stage)
// ***************************************************************************
void CDriverGLStates3::enableVertexArray(bool enable)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGLStates3_enableVertexArray);
if(_VertexArrayEnabled != enable)
@ -810,10 +843,15 @@ void CDriverGLStates3::enableVertexArray(bool enable)
_VertexArrayEnabled= enable;
}
#endif
}
// ***************************************************************************
void CDriverGLStates3::enableNormalArray(bool enable)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGLStates3_enableNormalArray)
if(_NormalArrayEnabled != enable)
{
@ -825,10 +863,14 @@ void CDriverGLStates3::enableNormalArray(bool enable)
}
#endif
}
// ***************************************************************************
void CDriverGLStates3::enableWeightArray(bool enable)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGLStates3_enableWeightArray);
if(_WeightArrayEnabled != enable)
@ -840,10 +882,13 @@ void CDriverGLStates3::enableWeightArray(bool enable)
_WeightArrayEnabled= enable;
}
#endif
}
// ***************************************************************************
void CDriverGLStates3::enableColorArray(bool enable)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGLStates3_enableColorArray);
if(_ColorArrayEnabled != enable)
@ -856,12 +901,15 @@ void CDriverGLStates3::enableColorArray(bool enable)
}
#endif
}
// ***************************************************************************
void CDriverGLStates3::enableSecondaryColorArray(bool enable)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGLStates3_enableSecondaryColorArray);
if(_SecondaryColorArrayEnabled != enable)
@ -880,11 +928,14 @@ void CDriverGLStates3::enableSecondaryColorArray(bool enable)
nglSecondaryColor3ubEXT(0,0,0);
}
}
#endif
}
// ***************************************************************************
void CDriverGLStates3::clientActiveTextureARB(uint stage)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGLStates3_clientActiveTextureARB);
if( _CurrentClientActiveTextureARB != stage )
@ -892,11 +943,14 @@ void CDriverGLStates3::clientActiveTextureARB(uint stage)
nglClientActiveTextureARB(GL_TEXTURE0_ARB+stage);
_CurrentClientActiveTextureARB= stage;
}
#endif
}
// ***************************************************************************
void CDriverGLStates3::enableTexCoordArray(bool enable)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGLStates3_enableTexCoordArray);
if(_TexCoordArrayEnabled[_CurrentClientActiveTextureARB] != enable)
@ -909,11 +963,14 @@ void CDriverGLStates3::enableTexCoordArray(bool enable)
_TexCoordArrayEnabled[_CurrentClientActiveTextureARB]= enable;
}
#endif
}
// ***************************************************************************
void CDriverGLStates3::enableVertexAttribArray(uint glIndex, bool enable)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGLStates3_enableVertexAttribArray);
if(_VertexAttribArrayEnabled[glIndex] != enable)
@ -924,6 +981,7 @@ void CDriverGLStates3::enableVertexAttribArray(uint glIndex, bool enable)
glDisableClientState(glIndex+GL_VERTEX_ATTRIB_ARRAY0_NV);
_VertexAttribArrayEnabled[glIndex]= enable;
}
#endif
}
// ***************************************************************************
@ -956,11 +1014,13 @@ void CDriverGLStates3::enableFog(uint enable)
{
// new state.
_CurFog= enabled;
#ifndef GLSL
// Setup GLState.
if(_CurFog)
glEnable(GL_FOG);
else
glDisable(GL_FOG);
#endif
}
}

@ -1443,6 +1443,7 @@ void CDriverGL3::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv
// Disable Special tex env f().
_CurrentTexEnvSpecial[stage]= TexEnvSpecialDisabled;
#ifndef GLSL
// Setup the gl env mode.
_DriverGLStates.activeTextureARB(stage);
@ -1562,6 +1563,8 @@ void CDriverGL3::forceActivateTexEnvMode(uint stage, const CMaterial::CTexEnv
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
#endif
}
// ***************************************************************************

@ -804,6 +804,7 @@ const uint CDriverGL3::GLVertexAttribIndex[CVertexBuffer::NumValue]=
// ***************************************************************************
void CDriverGL3::setupGlArraysStd(CVertexBufferInfo &vb)
{
#ifndef GLSL
H_AUTO_OGL(CDriverGL3_setupGlArraysStd)
uint32 flags= vb.VertexFormat;
@ -860,6 +861,9 @@ void CDriverGL3::setupGlArraysStd(CVertexBufferInfo &vb)
// normal behavior: each texture has its own UV.
setupUVPtr(i, vb, vb.UVRouting[i]);
}
#endif
}
@ -870,6 +874,8 @@ void CDriverGL3::toggleGlArraysForARBVertexProgram()
// If change of setup type, must disable olds.
//=======================
#ifndef GLSL
// If last was a VertexProgram setup, and now it is a standard GL array setup.
if( _LastSetupGLArrayVertexProgram && !isVertexProgramEnabled () )
{
@ -929,6 +935,9 @@ void CDriverGL3::toggleGlArraysForARBVertexProgram()
// now, vertex program setup.
_LastSetupGLArrayVertexProgram= true;
}
#endif
}
// tells for each vertex argument if it must be normalized when it is an integral type
@ -1000,20 +1009,21 @@ void CDriverGL3::setupGlArrays(CVertexBufferInfo &vb)
{
H_AUTO_OGL(CDriverGL3_setupGlArrays)
{
#ifndef GLSL
toggleGlArraysForARBVertexProgram();
// Use a vertex program ?
if (!isVertexProgramEnabled ())
{
#ifndef GLSL
setupGlArraysStd(vb);
#endif
}
else
{
#endif
setupGlArraysForARBVertexProgram(vb);
#ifndef GLSL
}
}
#endif
}

Loading…
Cancel
Save