Merge pull request #940 from BeamNG/add_opengl_support

Add/Activate OpenGL render.
This commit is contained in:
LuisAntonRebollo 2014-11-30 02:48:13 +01:00
commit 98e3651db5
55 changed files with 2958 additions and 803 deletions

View file

@ -384,6 +384,7 @@ void ParallaxFeatGLSL::setTexData( Material::StageData &stageDat,
GFXTextureObject *tex = stageDat.getTex( MFT_NormalMap );
if ( tex )
{
passData.mSamplerNames[ texIndex ] = "bumpMap";
passData.mTexType[ texIndex ] = Material::Bump;
passData.mTexSlot[ texIndex++ ].texObject = tex;
}

View file

@ -1073,7 +1073,10 @@ void OverlayTexFeatGLSL::setTexData( Material::StageData &stageDat,
{
GFXTextureObject *tex = stageDat.getTex( MFT_OverlayMap );
if ( tex )
{
passData.mSamplerNames[ texIndex ] = "overlayMap";
passData.mTexSlot[ texIndex++ ].texObject = tex;
}
}
@ -2383,7 +2386,7 @@ void GlowMaskGLSL::processPix( Vector<ShaderComponent*> &componentList,
// code above that doesn't contribute to the alpha mask.
Var *color = (Var*)LangElement::find( "col" );
if ( color )
output = new GenOp( " @.rgb = 0;\r\n", color );
output = new GenOp( " @.rgb = vec3(0);\r\n", color );
}
@ -2395,7 +2398,7 @@ void RenderTargetZeroGLSL::processPix( Vector<ShaderComponent*> &componentList,
{
// Do not actually assign zero, but instead a number so close to zero it may as well be zero.
// This will prevent a divide by zero causing an FP special on float render targets
output = new GenOp( " @;\r\n", assignColor( new GenOp( "0.00001" ), Material::None, NULL, mOutputTargetMask ) );
output = new GenOp( " @;\r\n", assignColor( new GenOp( "vec4(0.00001)" ), Material::None, NULL, mOutputTargetMask ) );
}

View file

@ -22,7 +22,7 @@
#include "core/strings/stringFunctions.h"
#include "core/util/str.h"
#include "gfx/gfxDevice.h"
#include "langElement.h"
//**************************************************************************
@ -158,6 +158,9 @@ void Var::print( Stream &stream )
if( structName[0] != '\0' )
{
stream.write( dStrlen((char*)structName), structName );
if(GFX->getAdapterType() == OpenGL)
stream.write( 1, "_" );
else
stream.write( 1, "." );
}