diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp index c70b71e4b..19f455852 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.cpp +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.cpp @@ -538,10 +538,14 @@ void EveSpaceObject2::UpdateSyncronous( const EveUpdateContext& updateContext ) // Particle Systems // Get the reference position Vector3d referencePosition( 0.0, 0.0, 0.0 ); - IEveReferencePointPtr refObject( BlueCastPtr( m_ballPosition ) ); - if( refObject ) + if( m_referencePointSource != m_ballPosition.p ) { - refObject->GetReferencePoint( &referencePosition, time ); + m_referencePointSource = m_ballPosition.p; + m_referencePoint = BlueCastPtr( m_ballPosition ); + } + if( m_referencePoint ) + { + m_referencePoint->GetReferencePoint( &referencePosition, time ); } if( m_previousPosition.x != UNINITIALIZED_POSITION ) @@ -2149,13 +2153,13 @@ void EveSpaceObject2::RefreshDamageLocatorMask( const LocatorStructureList* dama void EveSpaceObject2::UpdateDamageLocatorFilter() { - TRINITY_STATS_ZONE( __FUNCTION__ ); - if( m_damageFilterState == DamageFilterState::Idle ) { return; } + TRINITY_STATS_ZONE( __FUNCTION__ ); + if( !m_damageLocatorAutoFilterEnabled && !m_damageLocatorFilterRequested ) { m_damageLocatorEnabled.clear(); diff --git a/trinity/Eve/SpaceObject/EveSpaceObject2.h b/trinity/Eve/SpaceObject/EveSpaceObject2.h index a1ce39d09..7aee4999b 100644 --- a/trinity/Eve/SpaceObject/EveSpaceObject2.h +++ b/trinity/Eve/SpaceObject/EveSpaceObject2.h @@ -719,6 +719,8 @@ BLUE_CLASS( EveSpaceObject2 ) : // It would be really, really nice not to have to hold on to the ball twice // but we can't do it without writing another interface, or linking to destiny ITriVectorFunctionPtr m_ballPosition; + ITriVectorFunction* m_referencePointSource = nullptr; + IEveReferencePointPtr m_referencePoint; ITriQuaternionFunctionPtr m_ballRotation; ITriQuaternionFunctionPtr m_modelRotation; ITriVectorFunctionPtr m_modelTranslation; diff --git a/trinity/Tr2VolumetricsRenderer.cpp b/trinity/Tr2VolumetricsRenderer.cpp index 454ec2ee3..401e1ee9e 100644 --- a/trinity/Tr2VolumetricsRenderer.cpp +++ b/trinity/Tr2VolumetricsRenderer.cpp @@ -17,6 +17,22 @@ #include "include/TriMath.h" #include "Utilities/Vector4d.h" +namespace +{ +const BlueSharedString RtShadowTechniqueName = BlueSharedString( "RtShadow" ); +const BlueSharedString RtSceneParameterName = BlueSharedString( "RtShadowScene" ); +const BlueSharedString Noise3DTextureParameterName = BlueSharedString( "Noise3DTexture" ); +const BlueSharedString FroxelOutputParameterName = BlueSharedString( "RtFroxelOutputTexture" ); +const BlueSharedString ShadowsOptionName = BlueSharedString( "SHADOWS" ); +const BlueSharedString ShadowsEnabledOption = BlueSharedString( "SHADOWS_ENABLED" ); +const BlueSharedString ShadowsDisabledOption = BlueSharedString( "SHADOWS_DISABLED" ); +const BlueSharedString GodRayNoiseOptionName = BlueSharedString( "GOD_RAY_NOISE" ); +const BlueSharedString GodRayNoiseEnabledOption = BlueSharedString( "GOD_RAY_NOISE_ENABLED" ); +const BlueSharedString GodRayNoiseDisabledOption = BlueSharedString( "GOD_RAY_NOISE_DISABLED" ); +const BlueSharedString FogNoiseOptionName = BlueSharedString( "FOG_NOISE" ); +const BlueSharedString FogNoiseEnabledOption = BlueSharedString( "FOG_NOISE_ENABLED" ); +const BlueSharedString FogNoiseDisabledOption = BlueSharedString( "FOG_NOISE_DISABLED" ); +} Tr2VolumetricsRenderer::FogViewDependentResources::FogViewDependentResources( bool temporalFroxels ) : useTemporalFroxels( temporalFroxels ) @@ -692,7 +708,7 @@ Tr2GpuResourcePool::Texture Tr2VolumetricsRenderer::RenderFog( if( shadowType == SHADOWS_RAYTRACED ) { uint32_t techniqueIndex; - if( !resources.rtCalculateFroxels->GetShaderStateInterface()->GetTechniqueIndex( BlueSharedString( "RtShadow" ), techniqueIndex ) ) + if( !resources.rtCalculateFroxels->GetShaderStateInterface()->GetTechniqueIndex( RtShadowTechniqueName, techniqueIndex ) ) { CCP_LOGERR( "Failed to get technique index for raytraced froxel fog shadows!" ); return {}; @@ -700,7 +716,7 @@ Tr2GpuResourcePool::Texture Tr2VolumetricsRenderer::RenderFog( BlueSharedStringW rayGenName; BlueSharedStringW missName; - m_pipelineManager.AddLibrary( rayGenName, missName, resources.rtCalculateFroxels, BlueSharedString( "RtShadow" ) ); + m_pipelineManager.AddLibrary( rayGenName, missName, resources.rtCalculateFroxels, RtShadowTechniqueName ); Tr2RtPipelineStateAL pipelineState = m_pipelineManager.GetPipelineState( renderContext ); @@ -713,20 +729,20 @@ Tr2GpuResourcePool::Texture Tr2VolumetricsRenderer::RenderFog( Tr2RtLocalMaterialDescriptionAL material; material.SetConstants( Tr2Renderer::GetPerObjectVSStartRegister(), m_fogConstantBuffer ); - TRINITY_STATS_ZONE( "Create shader table" ); - m_shaderTableDesc.AddRayGenShader( rayGenName.c_str(), material ); - m_shaderTableDesc.AddMissShader( missName.c_str(), material ); - - Tr2RtShaderTableAL shadowShaderTable; - shadowShaderTable.Create( m_shaderTableDesc, pipelineState, renderContext.GetPrimaryRenderContext() ); + { + TRINITY_STATS_ZONE( "Create shader table" ); + m_shaderTableDesc.AddRayGenShader( rayGenName.c_str(), material ); + m_shaderTableDesc.AddMissShader( missName.c_str(), material ); + m_rtShadowShaderTable.Create( m_shaderTableDesc, pipelineState, renderContext.GetPrimaryRenderContext() ); + } - resources.rtCalculateFroxels->SetOption( BlueSharedString( "GOD_RAY_NOISE" ), BlueSharedString( m_froxelFogSettings.godRayNoiseIntensity.value > 0.0f ? "GOD_RAY_NOISE_ENABLED" : "GOD_RAY_NOISE_DISABLED" ) ); - resources.rtCalculateFroxels->SetOption( BlueSharedString( "FOG_NOISE" ), BlueSharedString( m_froxelFogSettings.fogNoiseIntensity.value > 0.0f ? "FOG_NOISE_ENABLED" : "FOG_NOISE_DISABLED" ) ); + resources.rtCalculateFroxels->SetOption( GodRayNoiseOptionName, m_froxelFogSettings.godRayNoiseIntensity.value > 0.0f ? GodRayNoiseEnabledOption : GodRayNoiseDisabledOption ); + resources.rtCalculateFroxels->SetOption( FogNoiseOptionName, m_froxelFogSettings.fogNoiseIntensity.value > 0.0f ? FogNoiseEnabledOption : FogNoiseDisabledOption ); - resources.rtCalculateFroxels->SetParameter( BlueSharedString( "Noise3DTexture" ), m_froxel3DNoise ); - resources.rtCalculateFroxels->SetParameter( BlueSharedString( "RtFroxelOutputTexture" ), fogFroxels ); + resources.rtCalculateFroxels->SetParameter( Noise3DTextureParameterName, m_froxel3DNoise ); + resources.rtCalculateFroxels->SetParameter( FroxelOutputParameterName, fogFroxels ); - resources.rtCalculateFroxels->SetParameter( BlueSharedString( "RtShadowScene" ), raytracingGeometry ); + resources.rtCalculateFroxels->SetParameter( RtSceneParameterName, raytracingGeometry ); renderContext.SetRtPipelineState( pipelineState, rayGenName.c_str() ); resources.rtCalculateFroxels->ApplyMaterialDataForRtState( techniqueIndex, renderContext ); renderContext.UseAccelerationStructure( raytracingGeometry->GetTLAS() ); @@ -736,17 +752,17 @@ Tr2GpuResourcePool::Texture Tr2VolumetricsRenderer::RenderFog( renderContext.UseResources( Tr2UseResourceDestination::COMPUTE, Tr2GpuUsage::SHADER_RESOURCE, raytracingGeometry->GetBindlessResources() ); } - renderContext.DispatchRays( pipelineState, shadowShaderTable, rayGenName.c_str(), width, height, depth ); + renderContext.DispatchRays( pipelineState, m_rtShadowShaderTable, rayGenName.c_str(), width, height, depth ); } else { //Otherwise, just use a plain compute shader. - resources.calculateFroxels->SetOption( BlueSharedString( "SHADOWS" ), BlueSharedString( shadowType == SHADOWS_CASCADED ? "SHADOWS_ENABLED" : "SHADOWS_DISABLED" ) ); - resources.calculateFroxels->SetOption( BlueSharedString( "GOD_RAY_NOISE" ), BlueSharedString( m_froxelFogSettings.godRayNoiseIntensity.value > 0.0f ? "GOD_RAY_NOISE_ENABLED" : "GOD_RAY_NOISE_DISABLED" ) ); - resources.calculateFroxels->SetOption( BlueSharedString( "FOG_NOISE" ), BlueSharedString( m_froxelFogSettings.fogNoiseIntensity.value > 0.0f ? "FOG_NOISE_ENABLED" : "FOG_NOISE_DISABLED" ) ); + resources.calculateFroxels->SetOption( ShadowsOptionName, shadowType == SHADOWS_CASCADED ? ShadowsEnabledOption : ShadowsDisabledOption ); + resources.calculateFroxels->SetOption( GodRayNoiseOptionName, m_froxelFogSettings.godRayNoiseIntensity.value > 0.0f ? GodRayNoiseEnabledOption : GodRayNoiseDisabledOption ); + resources.calculateFroxels->SetOption( FogNoiseOptionName, m_froxelFogSettings.fogNoiseIntensity.value > 0.0f ? FogNoiseEnabledOption : FogNoiseDisabledOption ); - resources.calculateFroxels->SetParameter( BlueSharedString( "Noise3DTexture" ), m_froxel3DNoise ); - resources.calculateFroxels->SetParameter( BlueSharedString( "RtFroxelOutputTexture" ), fogFroxels ); + resources.calculateFroxels->SetParameter( Noise3DTextureParameterName, m_froxel3DNoise ); + resources.calculateFroxels->SetParameter( FroxelOutputParameterName, fogFroxels ); Tr2Renderer::RunComputeShader( resources.calculateFroxels, wgX, wgY, wgZ, renderContext ); } diff --git a/trinity/Tr2VolumetricsRenderer.h b/trinity/Tr2VolumetricsRenderer.h index e78d0737b..23f5410a7 100644 --- a/trinity/Tr2VolumetricsRenderer.h +++ b/trinity/Tr2VolumetricsRenderer.h @@ -150,6 +150,7 @@ BLUE_CLASS( Tr2VolumetricsRenderer ) : Tr2RaytracingPipelineStateManager m_pipelineManager; Tr2RtShaderTableDescriptionAL m_shaderTableDesc; + Tr2RtShaderTableAL m_rtShadowShaderTable; private: struct FogViewDependentResources