mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 16:44:36 +00:00
Merge pull request #929 from BeamNG/remove_old_opengl_code
Remove unnecesary code for handle OpenGL.
This commit is contained in:
commit
2f8d18c0c0
5 changed files with 7 additions and 31 deletions
|
|
@ -353,9 +353,7 @@ void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
|
||||||
Point2I resolution = getRoot()->getExtent();
|
Point2I resolution = getRoot()->getExtent();
|
||||||
|
|
||||||
U32 buf_x = offset.x + mSelectorPos.x + 1;
|
U32 buf_x = offset.x + mSelectorPos.x + 1;
|
||||||
U32 buf_y = ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
|
U32 buf_y = resolution.y - ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
|
||||||
if(GFX->getAdapterType() != OpenGL)
|
|
||||||
buf_y = resolution.y - buf_y;
|
|
||||||
|
|
||||||
GFXTexHandle bb( resolution.x,
|
GFXTexHandle bb( resolution.x,
|
||||||
resolution.y,
|
resolution.y,
|
||||||
|
|
|
||||||
|
|
@ -312,14 +312,8 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
{
|
{
|
||||||
PROFILE_SCOPE( LightManager_Update4LightConsts_setLights );
|
PROFILE_SCOPE( LightManager_Update4LightConsts_setLights );
|
||||||
|
|
||||||
// NOTE: We haven't ported the lighting shaders on OSX
|
|
||||||
// to the optimized HLSL versions.
|
|
||||||
#if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX )
|
|
||||||
static AlignedArray<Point3F> lightPositions( 4, sizeof( Point4F ) );
|
|
||||||
#else
|
|
||||||
static AlignedArray<Point4F> lightPositions( 3, sizeof( Point4F ) );
|
static AlignedArray<Point4F> lightPositions( 3, sizeof( Point4F ) );
|
||||||
static AlignedArray<Point4F> lightSpotDirs( 3, sizeof( Point4F ) );
|
static AlignedArray<Point4F> lightSpotDirs( 3, sizeof( Point4F ) );
|
||||||
#endif
|
|
||||||
static AlignedArray<Point4F> lightColors( 4, sizeof( Point4F ) );
|
static AlignedArray<Point4F> lightColors( 4, sizeof( Point4F ) );
|
||||||
static Point4F lightInvRadiusSq;
|
static Point4F lightInvRadiusSq;
|
||||||
static Point4F lightSpotAngle;
|
static Point4F lightSpotAngle;
|
||||||
|
|
@ -329,6 +323,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
// Need to clear the buffers so that we don't leak
|
// Need to clear the buffers so that we don't leak
|
||||||
// lights from previous passes or have NaNs.
|
// lights from previous passes or have NaNs.
|
||||||
dMemset( lightPositions.getBuffer(), 0, lightPositions.getBufferSize() );
|
dMemset( lightPositions.getBuffer(), 0, lightPositions.getBufferSize() );
|
||||||
|
dMemset( lightSpotDirs.getBuffer(), 0, lightSpotDirs.getBufferSize() );
|
||||||
dMemset( lightColors.getBuffer(), 0, lightColors.getBufferSize() );
|
dMemset( lightColors.getBuffer(), 0, lightColors.getBufferSize() );
|
||||||
lightInvRadiusSq = Point4F::Zero;
|
lightInvRadiusSq = Point4F::Zero;
|
||||||
lightSpotAngle.set( -1.0f, -1.0f, -1.0f, -1.0f );
|
lightSpotAngle.set( -1.0f, -1.0f, -1.0f, -1.0f );
|
||||||
|
|
@ -342,12 +337,6 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
if ( !light )
|
if ( !light )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
#if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX )
|
|
||||||
|
|
||||||
lightPositions[i] = light->getPosition();
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
// The light positions and spot directions are
|
// The light positions and spot directions are
|
||||||
// in SoA order to make optimal use of the GPU.
|
// in SoA order to make optimal use of the GPU.
|
||||||
const Point3F &lightPos = light->getPosition();
|
const Point3F &lightPos = light->getPosition();
|
||||||
|
|
@ -366,8 +355,6 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] );
|
lightSpotFalloff[i] = 1.0f / getMax( F32_MIN, mCos( mDegToRad( light->getInnerConeAngle() / 2.0f ) ) - lightSpotAngle[i] );
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Prescale the light color by the brightness to
|
// Prescale the light color by the brightness to
|
||||||
// avoid doing this in the shader.
|
// avoid doing this in the shader.
|
||||||
lightColors[i] = Point4F(light->getColor()) * light->getBrightness();
|
lightColors[i] = Point4F(light->getColor()) * light->getBrightness();
|
||||||
|
|
@ -381,13 +368,11 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
||||||
shaderConsts->setSafe( lightDiffuseSC, lightColors );
|
shaderConsts->setSafe( lightDiffuseSC, lightColors );
|
||||||
shaderConsts->setSafe( lightInvRadiusSqSC, lightInvRadiusSq );
|
shaderConsts->setSafe( lightInvRadiusSqSC, lightInvRadiusSq );
|
||||||
|
|
||||||
#if !defined( TORQUE_OS_MAC ) && !defined( TORQUE_OS_LINUX )
|
|
||||||
|
|
||||||
shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs );
|
shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs );
|
||||||
shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle );
|
shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle );
|
||||||
shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff );
|
shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff );
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Setup the ambient lighting from the first
|
// Setup the ambient lighting from the first
|
||||||
|
|
|
||||||
|
|
@ -289,9 +289,7 @@ void ProcessedMaterial::_initPassStateBlock( RenderPassData *rpd, GFXStateBlockD
|
||||||
|
|
||||||
// The prepass will take care of writing to the
|
// The prepass will take care of writing to the
|
||||||
// zbuffer, so we don't have to by default.
|
// zbuffer, so we don't have to by default.
|
||||||
// The prepass can't write to the backbuffer's zbuffer in OpenGL.
|
|
||||||
if ( MATMGR->getPrePassEnabled() &&
|
if ( MATMGR->getPrePassEnabled() &&
|
||||||
!GFX->getAdapterType() == OpenGL &&
|
|
||||||
!mFeatures.hasFeature(MFT_ForwardShading))
|
!mFeatures.hasFeature(MFT_ForwardShading))
|
||||||
result.setZReadWrite( result.zEnable, false );
|
result.setZReadWrite( result.zEnable, false );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -542,10 +542,7 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
||||||
|
|
||||||
// We write to the zbuffer if this is a prepass
|
// We write to the zbuffer if this is a prepass
|
||||||
// material or if the prepass is disabled.
|
// material or if the prepass is disabled.
|
||||||
// We also write the zbuffer if we're using OpenGL, because in OpenGL the prepass
|
|
||||||
// cannot share the same zbuffer as the backbuffer.
|
|
||||||
desc.setZReadWrite( true, !MATMGR->getPrePassEnabled() ||
|
desc.setZReadWrite( true, !MATMGR->getPrePassEnabled() ||
|
||||||
GFX->getAdapterType() == OpenGL ||
|
|
||||||
prePassMat ||
|
prePassMat ||
|
||||||
reflectMat );
|
reflectMat );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -207,17 +207,15 @@ void TerrainBlock::_updateBaseTexture(bool writeToCache)
|
||||||
F32 copyOffsetX = 2.0f * GFX->getFillConventionOffset() / (F32)destSize.x;
|
F32 copyOffsetX = 2.0f * GFX->getFillConventionOffset() / (F32)destSize.x;
|
||||||
F32 copyOffsetY = 2.0f * GFX->getFillConventionOffset() / (F32)destSize.y;
|
F32 copyOffsetY = 2.0f * GFX->getFillConventionOffset() / (F32)destSize.y;
|
||||||
|
|
||||||
const bool needsYFlip = GFX->getAdapterType() == OpenGL;
|
|
||||||
|
|
||||||
GFXVertexPT points[4];
|
GFXVertexPT points[4];
|
||||||
points[0].point = Point3F( -1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0 );
|
points[0].point = Point3F( -1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0 );
|
||||||
points[0].texCoord = Point2F( 0.0, needsYFlip ? 0.0f : 1.0f );
|
points[0].texCoord = Point2F( 0.0, 1.0f );
|
||||||
points[1].point = Point3F( -1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0 );
|
points[1].point = Point3F( -1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0 );
|
||||||
points[1].texCoord = Point2F( 0.0, needsYFlip ? 1.0f : 0.0f );
|
points[1].texCoord = Point2F( 0.0, 0.0f );
|
||||||
points[2].point = Point3F( 1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0 );
|
points[2].point = Point3F( 1.0 - copyOffsetX, 1.0 + copyOffsetY, 0.0 );
|
||||||
points[2].texCoord = Point2F( 1.0, needsYFlip ? 1.0f : 0.0f );
|
points[2].texCoord = Point2F( 1.0, 0.0f );
|
||||||
points[3].point = Point3F( 1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0 );
|
points[3].point = Point3F( 1.0 - copyOffsetX, -1.0 + copyOffsetY, 0.0 );
|
||||||
points[3].texCoord = Point2F( 1.0, needsYFlip ? 0.0f : 1.0f );
|
points[3].texCoord = Point2F( 1.0, 1.0f );
|
||||||
|
|
||||||
vb.set( GFX, 4, GFXBufferTypeVolatile );
|
vb.set( GFX, 4, GFXBufferTypeVolatile );
|
||||||
GFXVertexPT *ptr = vb.lock();
|
GFXVertexPT *ptr = vb.lock();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue