private void ShadowChange() { if (UseShadows.get()) { if (MyEffect.get() == null || MyEffect.getPath().Equals("Deferred/PointLightNoShadows")) { MyEffect.set("Deferred/PointLightShadows"); } ShadowCube = AssetManager.RequestCubeMap((int)ShadowMapSize.get(), SurfaceFormat.HalfSingle, DepthFormat.Depth24Stencil8, ShadowCube); if (MyEffect.Holder != null) { DeferredLightEffect effect3D = (DeferredLightEffect)(MyEffect.Holder); if (ShadowCube.Value != null) { effect3D.ShadowReference.SetValue(ShadowCube.Value); } } DrawShadows(); } else { if (MyEffect.get() == null || MyEffect.getPath().Equals("Effects/Deferred/PointLightShadows")) { MyEffect.set("Deferred/PointLightNoShadows"); } AssetManager.FreeRenderTarget(ShadowCube); } }
public static RenderCubeAsset RequestCubeMap(int Size, SurfaceFormat surfaceFormat, DepthFormat depthFormat, RenderCubeAsset OldCube) { RenderCubeAsset asset = OldCube; if (asset != null && !asset.InUse && asset.Value.Size == Size && asset.Value.Format == surfaceFormat && asset.Value.DepthStencilFormat == depthFormat) { return(OldCube); } else { return(RequestCubeMap(Size, surfaceFormat, depthFormat)); } }