diff --git a/managed/GameScripts/ScriptableRenderContextApiSurfaceProbe.cs b/managed/GameScripts/ScriptableRenderContextApiSurfaceProbe.cs index 19686c36..14421969 100644 --- a/managed/GameScripts/ScriptableRenderContextApiSurfaceProbe.cs +++ b/managed/GameScripts/ScriptableRenderContextApiSurfaceProbe.cs @@ -11,6 +11,12 @@ namespace Gameplay public bool HasPublicContextRecordOpaqueScenePhase; public bool HasPublicContextRecordBeforeOpaqueInjection; public bool HasPublicContextRecordShaderVectorFullscreenPass; + public bool HasPublicContextCameraData; + public bool HasPublicContextLightingData; + public bool HasPublicContextShadowData; + public bool HasPublicContextEnvironmentData; + public bool HasPublicContextFinalColorData; + public bool HasPublicContextStageColorData; public bool HasPublicCameraRequestContextHasDirectionalShadow; public bool HasPublicCameraRequestContextClearDirectionalShadow; public bool HasRendererRecordingContextType; @@ -41,6 +47,30 @@ namespace Gameplay contextType.GetMethod( "RecordShaderVectorFullscreenPass", PublicInstanceMethodFlags) != null; + HasPublicContextCameraData = + contextType.GetProperty( + "cameraData", + PublicInstanceMethodFlags) != null; + HasPublicContextLightingData = + contextType.GetProperty( + "lightingData", + PublicInstanceMethodFlags) != null; + HasPublicContextShadowData = + contextType.GetProperty( + "shadowData", + PublicInstanceMethodFlags) != null; + HasPublicContextEnvironmentData = + contextType.GetProperty( + "environmentData", + PublicInstanceMethodFlags) != null; + HasPublicContextFinalColorData = + contextType.GetProperty( + "finalColorData", + PublicInstanceMethodFlags) != null; + HasPublicContextStageColorData = + contextType.GetProperty( + "stageColorData", + PublicInstanceMethodFlags) != null; HasPublicCameraRequestContextHasDirectionalShadow = cameraRequestContextType.GetProperty( "hasDirectionalShadow", diff --git a/managed/XCEngine.ScriptCore/Rendering/Core/ScriptableRenderContext.cs b/managed/XCEngine.ScriptCore/Rendering/Core/ScriptableRenderContext.cs index b68c38cb..ae94b0b3 100644 --- a/managed/XCEngine.ScriptCore/Rendering/Core/ScriptableRenderContext.cs +++ b/managed/XCEngine.ScriptCore/Rendering/Core/ScriptableRenderContext.cs @@ -45,24 +45,24 @@ namespace XCEngine.Rendering (CameraFrameStage)InternalCalls.Rendering_ScriptableRenderContext_GetStage( m_nativeHandle); - public CameraData cameraData => + internal CameraData cameraData => m_cameraData ?? (m_cameraData = ResolveCameraData()); - public LightingData lightingData => + internal LightingData lightingData => m_lightingData ?? (m_lightingData = ResolveLightingData()); - public ShadowData shadowData => + internal ShadowData shadowData => m_shadowData ?? (m_shadowData = ResolveShadowData()); - public EnvironmentData environmentData => + internal EnvironmentData environmentData => m_environmentData ?? (m_environmentData = ResolveEnvironmentData()); - public FinalColorData finalColorData => + internal FinalColorData finalColorData => m_finalColorData ?? (m_finalColorData = ResolveFinalColorData()); - public StageColorData stageColorData => + internal StageColorData stageColorData => m_stageColorData ?? (m_stageColorData = ResolveStageColorData()); diff --git a/tests/scripting/test_mono_script_runtime.cpp b/tests/scripting/test_mono_script_runtime.cpp index 145200d4..a6dac4e7 100644 --- a/tests/scripting/test_mono_script_runtime.cpp +++ b/tests/scripting/test_mono_script_runtime.cpp @@ -1155,6 +1155,12 @@ TEST_F( bool hasPublicContextRecordOpaqueScenePhase = false; bool hasPublicContextRecordBeforeOpaqueInjection = false; bool hasPublicContextRecordShaderVectorFullscreenPass = false; + bool hasPublicContextCameraData = false; + bool hasPublicContextLightingData = false; + bool hasPublicContextShadowData = false; + bool hasPublicContextEnvironmentData = false; + bool hasPublicContextFinalColorData = false; + bool hasPublicContextStageColorData = false; bool hasPublicCameraRequestContextHasDirectionalShadow = false; bool hasPublicCameraRequestContextClearDirectionalShadow = false; bool hasRendererRecordingContextType = false; @@ -1176,6 +1182,30 @@ TEST_F( selectionScript, "HasPublicContextRecordShaderVectorFullscreenPass", hasPublicContextRecordShaderVectorFullscreenPass)); + EXPECT_TRUE(runtime->TryGetFieldValue( + selectionScript, + "HasPublicContextCameraData", + hasPublicContextCameraData)); + EXPECT_TRUE(runtime->TryGetFieldValue( + selectionScript, + "HasPublicContextLightingData", + hasPublicContextLightingData)); + EXPECT_TRUE(runtime->TryGetFieldValue( + selectionScript, + "HasPublicContextShadowData", + hasPublicContextShadowData)); + EXPECT_TRUE(runtime->TryGetFieldValue( + selectionScript, + "HasPublicContextEnvironmentData", + hasPublicContextEnvironmentData)); + EXPECT_TRUE(runtime->TryGetFieldValue( + selectionScript, + "HasPublicContextFinalColorData", + hasPublicContextFinalColorData)); + EXPECT_TRUE(runtime->TryGetFieldValue( + selectionScript, + "HasPublicContextStageColorData", + hasPublicContextStageColorData)); EXPECT_TRUE(runtime->TryGetFieldValue( selectionScript, "HasPublicCameraRequestContextHasDirectionalShadow", @@ -1197,6 +1227,12 @@ TEST_F( EXPECT_TRUE(hasPublicContextRecordOpaqueScenePhase); EXPECT_TRUE(hasPublicContextRecordBeforeOpaqueInjection); EXPECT_TRUE(hasPublicContextRecordShaderVectorFullscreenPass); + EXPECT_FALSE(hasPublicContextCameraData); + EXPECT_FALSE(hasPublicContextLightingData); + EXPECT_FALSE(hasPublicContextShadowData); + EXPECT_FALSE(hasPublicContextEnvironmentData); + EXPECT_FALSE(hasPublicContextFinalColorData); + EXPECT_FALSE(hasPublicContextStageColorData); EXPECT_TRUE(hasPublicCameraRequestContextHasDirectionalShadow); EXPECT_TRUE(hasPublicCameraRequestContextClearDirectionalShadow); EXPECT_FALSE(hasRendererRecordingContextType);