mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-01-19 20:24:49 +00:00
Remove unnecesary code for handle OpenGL.
This commit is contained in:
parent
c354f59b72
commit
f101fbe820
|
|
@ -353,9 +353,7 @@ void GuiColorPickerCtrl::onRender(Point2I offset, const RectI& updateRect)
|
|||
Point2I resolution = getRoot()->getExtent();
|
||||
|
||||
U32 buf_x = offset.x + mSelectorPos.x + 1;
|
||||
U32 buf_y = ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
|
||||
if(GFX->getAdapterType() != OpenGL)
|
||||
buf_y = resolution.y - buf_y;
|
||||
U32 buf_y = resolution.y - ( extent.y - ( offset.y + mSelectorPos.y + 1 ) );
|
||||
|
||||
GFXTexHandle bb( resolution.x,
|
||||
resolution.y,
|
||||
|
|
|
|||
|
|
@ -312,14 +312,8 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
{
|
||||
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> lightSpotDirs( 3, sizeof( Point4F ) );
|
||||
#endif
|
||||
static AlignedArray<Point4F> lightColors( 4, sizeof( Point4F ) );
|
||||
static Point4F lightInvRadiusSq;
|
||||
static Point4F lightSpotAngle;
|
||||
|
|
@ -329,6 +323,7 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
// Need to clear the buffers so that we don't leak
|
||||
// lights from previous passes or have NaNs.
|
||||
dMemset( lightPositions.getBuffer(), 0, lightPositions.getBufferSize() );
|
||||
dMemset( lightSpotDirs.getBuffer(), 0, lightSpotDirs.getBufferSize() );
|
||||
dMemset( lightColors.getBuffer(), 0, lightColors.getBufferSize() );
|
||||
lightInvRadiusSq = Point4F::Zero;
|
||||
lightSpotAngle.set( -1.0f, -1.0f, -1.0f, -1.0f );
|
||||
|
|
@ -342,12 +337,6 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
if ( !light )
|
||||
break;
|
||||
|
||||
#if defined( TORQUE_OS_MAC ) || defined( TORQUE_OS_LINUX )
|
||||
|
||||
lightPositions[i] = light->getPosition();
|
||||
|
||||
#else
|
||||
|
||||
// The light positions and spot directions are
|
||||
// in SoA order to make optimal use of the GPU.
|
||||
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] );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Prescale the light color by the brightness to
|
||||
// avoid doing this in the shader.
|
||||
lightColors[i] = Point4F(light->getColor()) * light->getBrightness();
|
||||
|
|
@ -381,13 +368,11 @@ void LightManager::_update4LightConsts( const SceneData &sgData,
|
|||
shaderConsts->setSafe( lightDiffuseSC, lightColors );
|
||||
shaderConsts->setSafe( lightInvRadiusSqSC, lightInvRadiusSq );
|
||||
|
||||
#if !defined( TORQUE_OS_MAC ) && !defined( TORQUE_OS_LINUX )
|
||||
|
||||
shaderConsts->setSafe( lightSpotDirSC, lightSpotDirs );
|
||||
shaderConsts->setSafe( lightSpotAngleSC, lightSpotAngle );
|
||||
shaderConsts->setSafe( lightSpotFalloffSC, lightSpotFalloff );
|
||||
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
// 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
|
||||
// zbuffer, so we don't have to by default.
|
||||
// The prepass can't write to the backbuffer's zbuffer in OpenGL.
|
||||
if ( MATMGR->getPrePassEnabled() &&
|
||||
!GFX->getAdapterType() == OpenGL &&
|
||||
!mFeatures.hasFeature(MFT_ForwardShading))
|
||||
result.setZReadWrite( result.zEnable, false );
|
||||
|
||||
|
|
|
|||
|
|
@ -528,10 +528,7 @@ bool TerrainCellMaterial::_createPass( Vector<MaterialInfo*> *materials,
|
|||
|
||||
// We write to the zbuffer if this is a prepass
|
||||
// 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() ||
|
||||
GFX->getAdapterType() == OpenGL ||
|
||||
prePassMat ||
|
||||
reflectMat );
|
||||
|
||||
|
|
|
|||
|
|
@ -207,17 +207,15 @@ void TerrainBlock::_updateBaseTexture(bool writeToCache)
|
|||
F32 copyOffsetX = 2.0f * GFX->getFillConventionOffset() / (F32)destSize.x;
|
||||
F32 copyOffsetY = 2.0f * GFX->getFillConventionOffset() / (F32)destSize.y;
|
||||
|
||||
const bool needsYFlip = GFX->getAdapterType() == OpenGL;
|
||||
|
||||
GFXVertexPT points[4];
|
||||
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].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].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].texCoord = Point2F( 1.0, needsYFlip ? 0.0f : 1.0f );
|
||||
points[3].texCoord = Point2F( 1.0, 1.0f );
|
||||
|
||||
vb.set( GFX, 4, GFXBufferTypeVolatile );
|
||||
GFXVertexPT *ptr = vb.lock();
|
||||
|
|
|
|||
Loading…
Reference in a new issue