Remove Geforce FX render paths

pull/110/head
Hleb Valoshka 2018-09-25 22:39:52 +03:00
parent 0849e2658a
commit b4ab67be02
5 changed files with 4 additions and 184 deletions

View File

@ -90,7 +90,6 @@ bool GLContext::setRenderPath(GLRenderPath path)
break;
case GLPath_DOT3_ARBVP:
case GLPath_ARBFP_ARBVP:
case GLPath_NV30:
case GLPath_GLSL:
vertexPath = VPath_ARB;
break;
@ -182,8 +181,11 @@ VertexProcessor* GLContext::getVertexProcessor() const
FragmentProcessor* GLContext::getFragmentProcessor() const
{
if (renderPath == GLPath_NV30 /* || renderPath == GLPath_ARGFP_ARBVP */ )
/*
if (renderPath == GLPath_ARGFP_ARBVP)
return fragmentProc;
else
return nullptr;
*/
return nullptr;
}

View File

@ -27,14 +27,12 @@ class GLContext
GLPath_Multitexture = 1,
GLPath_DOT3_ARBVP = 3,
GLPath_ARBFP_ARBVP = 6,
GLPath_NV30 = 7,
GLPath_GLSL = 8,
};
enum VertexPath
{
VPath_Basic = 0,
VPath_NV = 1,
VPath_ARB = 2,
};

View File

@ -5361,177 +5361,6 @@ static void renderSphere_DOT3_VP(const RenderInfo& ri,
}
// Render a planet sphere using both fragment and vertex programs
static void renderSphere_FP_VP(const RenderInfo& ri,
const Frustum& frustum,
const GLContext& context)
{
Texture* textures[4];
VertexProcessor* vproc = context.getVertexProcessor();
FragmentProcessor* fproc = context.getFragmentProcessor();
assert(vproc != nullptr && fproc != nullptr);
if (ri.baseTex == nullptr)
{
glDisable(GL_TEXTURE_2D);
}
else
{
glEnable(GL_TEXTURE_2D);
ri.baseTex->bind();
}
// Compute the half angle vector required for specular lighting
Vector3f halfAngle_obj = ri.eyeDir_obj + ri.sunDir_obj;
if (halfAngle_obj.norm() != 0.0f)
halfAngle_obj.normalize();
// Set up the fog parameters if the haze density is non-zero
float hazeDensity = ri.hazeColor.alpha();
if (hazeDensity > 0.0f)
{
glEnable(GL_FOG);
float fogColor[4] = { 0.0f, 0.0f, 0.0f, 1.0f };
fogColor[0] = ri.hazeColor.red();
fogColor[1] = ri.hazeColor.green();
fogColor[2] = ri.hazeColor.blue();
glFogfv(GL_FOG_COLOR, fogColor);
glFogi(GL_FOG_MODE, GL_LINEAR);
glFogf(GL_FOG_START, 0.0);
glFogf(GL_FOG_END, 1.0f / hazeDensity);
}
vproc->enable();
vproc->parameter(vp::EyePosition, ri.eyePos_obj);
vproc->parameter(vp::LightDirection0, ri.sunDir_obj);
vproc->parameter(vp::DiffuseColor0, ri.sunColor * ri.color);
vproc->parameter(vp::SpecularExponent, 0.0f, 1.0f, 0.5f, ri.specularPower);
vproc->parameter(vp::SpecularColor0, ri.sunColor * ri.specularColor);
vproc->parameter(vp::AmbientColor, ri.ambientColor * ri.color);
vproc->parameter(vp::HazeColor, ri.hazeColor);
if (ri.bumpTex != nullptr)
{
fproc->enable();
if (hazeDensity > 0.0f)
vproc->use(vp::diffuseBumpHaze);
else
vproc->use(vp::diffuseBump);
fproc->use(fp::texDiffuseBump);
g_lodSphere->render(context,
LODSphereMesh::Normals | LODSphereMesh::Tangents |
LODSphereMesh::TexCoords0 | LODSphereMesh::VertexProgParams,
frustum, ri.pixWidth,
ri.baseTex, ri.bumpTex);
fproc->disable();
// Render a specular pass
if (ri.specularColor != Color::Black)
{
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
glEnable(GL_COLOR_SUM_EXT);
vproc->use(vp::specular);
// Disable ambient and diffuse
vproc->parameter(vp::AmbientColor, Color::Black);
vproc->parameter(vp::DiffuseColor0, Color::Black);
SetupCombinersGlossMap(ri.glossTex != nullptr ? GL_TEXTURE0_ARB : 0);
textures[0] = ri.glossTex != nullptr ? ri.glossTex : ri.baseTex;
g_lodSphere->render(context,
LODSphereMesh::Normals | LODSphereMesh::TexCoords0,
frustum, ri.pixWidth,
textures, 1);
// re-enable diffuse
vproc->parameter(vp::DiffuseColor0, ri.sunColor * ri.color);
DisableCombiners();
glDisable(GL_COLOR_SUM_EXT);
glDisable(GL_BLEND);
}
}
else if (ri.specularColor != Color::Black)
{
fproc->enable();
if (ri.glossTex == nullptr)
{
vproc->use(vp::perFragmentSpecularAlpha);
fproc->use(fp::texSpecularAlpha);
}
else
{
vproc->use(vp::perFragmentSpecular);
fproc->use(fp::texSpecular);
}
fproc->parameter(fp::DiffuseColor, ri.sunColor * ri.color);
fproc->parameter(fp::SunDirection, ri.sunDir_obj);
fproc->parameter(fp::SpecularColor, ri.specularColor);
fproc->parameter(fp::SpecularExponent, ri.specularPower, 0.0f, 0.0f, 0.0f);
fproc->parameter(fp::AmbientColor, ri.ambientColor);
unsigned int attributes = LODSphereMesh::Normals |
LODSphereMesh::TexCoords0 |
LODSphereMesh::VertexProgParams;
g_lodSphere->render(context,
attributes, frustum, ri.pixWidth,
ri.baseTex, ri.glossTex);
fproc->disable();
}
else
{
fproc->enable();
if (hazeDensity > 0.0f)
vproc->use(vp::diffuseHaze);
else
vproc->use(vp::diffuse);
fproc->use(fp::texDiffuse);
g_lodSphere->render(context,
LODSphereMesh::Normals | LODSphereMesh::TexCoords0 |
LODSphereMesh::VertexProgParams,
frustum, ri.pixWidth,
ri.baseTex);
fproc->disable();
}
if (hazeDensity > 0.0f)
glDisable(GL_FOG);
if (ri.nightTex != nullptr)
{
ri.nightTex->bind();
vproc->use(vp::nightLights);
setupNightTextureCombine();
glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);
g_lodSphere->render(context,
LODSphereMesh::Normals | LODSphereMesh::TexCoords0,
frustum, ri.pixWidth,
ri.nightTex);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
}
if (ri.overlayTex != nullptr)
{
ri.overlayTex->bind();
vproc->use(vp::diffuse);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
g_lodSphere->render(context,
LODSphereMesh::Normals | LODSphereMesh::TexCoords0,
frustum, ri.pixWidth,
ri.overlayTex);
glBlendFunc(GL_ONE, GL_ONE);
}
vproc->disable();
}
static void renderShadowedGeometryDefault(Geometry* geometry,
const RenderInfo& ri,
const Frustum& frustum,
@ -6759,10 +6588,6 @@ void Renderer::renderObject(const Vector3f& pos,
obj.orientation, viewFrustum, *context);
break;
case GLContext::GLPath_NV30:
renderSphere_FP_VP(ri, viewFrustum, *context);
break;
case GLContext::GLPath_DOT3_ARBVP:
renderSphere_DOT3_VP(ri, ls, viewFrustum, *context);
break;

View File

@ -1451,9 +1451,6 @@ void CelestiaCore::charEntered(const char *c_p, int modifiers)
case GLContext::GLPath_ARBFP_ARBVP:
flash(_("Render path: OpenGL 1.5 vertex/fragment program"));
break;
case GLContext::GLPath_NV30:
flash(_("Render path: NVIDIA GeForce FX"));
break;
case GLContext::GLPath_GLSL:
flash(_("Render path: OpenGL 2.0"));
break;

View File

@ -164,8 +164,6 @@ PreferencesDialog::PreferencesDialog(QWidget* parent, CelestiaCore* core) :
ui.renderPathBox->addItem(_("OpenGL vertex program"), GLContext::GLPath_DOT3_ARBVP);
if (glContext->renderPathSupported(GLContext::GLPath_ARBFP_ARBVP))
ui.renderPathBox->addItem(_("OpenGL 1.5 vertex/fragment program"), GLContext::GLPath_ARBFP_ARBVP);
if (glContext->renderPathSupported(GLContext::GLPath_NV30))
ui.renderPathBox->addItem(_("NVIDIA GeForce FX"), GLContext::GLPath_NV30);
if (glContext->renderPathSupported(GLContext::GLPath_GLSL))
ui.renderPathBox->addItem(_("OpenGL 2.0"), GLContext::GLPath_GLSL);