internal override void Destruct() { Dispose(); MyFoliageComponents.Deregister(this); base.Destruct(); }
internal override void Construct() { base.Construct(); Type = MyActorComponentEnum.Foliage; m_streams = new Dictionary <int, MyFoliageStream>(); MyFoliageComponents.Register(this); }
private static void UpdateSceneFrame() { MySimpleProfiler.Begin("Textures"); ProfilerShort.Begin("LoadMeshes"); MyMeshes.Load(); ProfilerShort.End(); ProfilerShort.Begin("QueryTexturesFromEntities"); QueryTexturesFromEntities(); ProfilerShort.End(); ProfilerShort.Begin("MyTextures.Load"); MyManagers.FileTextures.LoadAllRequested(); ProfilerShort.End(); ProfilerShort.Begin("GatherTextures"); GatherTextures(); ProfilerShort.End(); MySimpleProfiler.End("Textures"); MyBillboardRenderer.OnFrameStart(); UpdateActors(); MyBigMeshTable.Table.MoveToGPU(); ProfilerShort.Begin("Update merged groups"); ProfilerShort.Begin("UpdateBeforeDraw"); foreach (var r in MyComponentFactory <MyGroupRootComponent> .GetAll()) { r.UpdateBeforeDraw(); } ProfilerShort.End(); ProfilerShort.Begin("MoveToGPU"); foreach (var r in MyComponentFactory <MyGroupRootComponent> .GetAll()) { foreach (var val in r.m_materialGroups.Values) { // optimize: keep list+set for updating val.MoveToGPU(); } } ProfilerShort.End(); ProfilerShort.End(); ProfilerShort.Begin("Fill foliage streams"); MyGpuProfiler.IC_BeginBlock("Fill foliage streams"); m_foliageGenerator.PerFrame(); m_foliageGenerator.Begin(); MyFoliageComponents.Update(); m_foliageGenerator.End(); MyGpuProfiler.IC_EndBlock(); ProfilerShort.End(); MyCommon.MoveToNextFrame(); }
internal static unsafe void InitSubsystems() { InitializeBlendStates(); InitializeRasterizerStates(); InitilizeSamplerStates(); MyScene.Init(); MyRender11.Init(); MyCommon.Init(); MyPipelineStates.Init(); MyTextures.Init(); MyVertexLayouts.Init(); MyShaders.Init(); MyRwTextures.Init(); MyHwBuffers.Init(); MyMeshes.Init(); MyMeshTableSRV.Init(); MyMergeInstancing.Init(); MyLightRendering.Init(); MyLinesRenderer.Init(); MySpritesRenderer.Init(); MyPrimitivesRenderer.Init(); MyOutline.Init(); MyBlur.Init(); MyFoliageComponents.Init(); MyBillboardRenderer.Init(); // hardcoded limits MyDebugRenderer.Init(); MyScreenDecals.Init(); MyEnvProbeProcessing.Init(); MyAtmosphereRenderer.Init(); MyCloudRenderer.Init(); MyAAEdgeMarking.Init(); MyScreenPass.Init(); MyCopyToRT.Init(); MyBlendTargets.Init(); MyFXAA.Init(); MyDepthResolve.Init(); MyBloom.Init(); MyLuminanceAverage.Init(); MyToneMapping.Init(); MySSAO.Init(); MyPlanetBlur.Init(); MyHdrDebugTools.Init(); MySceneMaterials.Init(); MyMaterials1.Init(); MyVoxelMaterials1.Init(); MyMeshMaterials1.Init(); }
internal static unsafe void InitSubsystems() { MyRwTextures.Init(); MyHwBuffers.Init(); MyPipelineStates.Init(); ResetShadows(MyRenderProxy.Settings.ShadowCascadeCount, RenderSettings.ShadowQuality.ShadowCascadeResolution()); MyRender11.Init(); MyCommon.Init(); SamplerStates.Init(); MyDepthStencilState.Init(); MyTextures.Init(); MyVertexLayouts.Init(); MyShaders.Init(); MyMeshes.Init(); MyMeshTableSRV.Init(); MyLightRendering.Init(); MyLinesRenderer.Init(); MySpritesRenderer.Init(); MyPrimitivesRenderer.Init(); MyOutline.Init(); MyBlur.Init(); MyTransparentRendering.Init(); MyFoliageComponents.Init(); MyBillboardRenderer.Init(); // hardcoded limits MyDebugRenderer.Init(); MyScreenDecals.Init(); MyEnvProbeProcessing.Init(); MyAtmosphereRenderer.Init(); MyCloudRenderer.Init(); MyAAEdgeMarking.Init(); MyScreenPass.Init(); MyCopyToRT.Init(); MyBlendTargets.Init(); MyFXAA.Init(); MyDepthResolve.Init(); MyBloom.Init(); MyLuminanceAverage.Init(); MyToneMapping.Init(); MySSAO.Init(); MyPlanetBlur.Init(); MyHdrDebugTools.Init(); MySceneMaterials.Init(); MyMaterials1.Init(); MyVoxelMaterials1.Init(); MyMeshMaterials1.Init(); }
internal static void UnloadData() { MyManagers.OnUnloadData(); MyActorFactory.RemoveAll(); // many-to-one relation, can live withput owners, deallocated separately // MyComponentFactory<MyInstancingComponent>.RemoveAll(); //MyVoxelMesh.RemoveAll(); //MyDynamicMesh.RemoveAll(); MyRender11.Log.WriteLine("Unloading session data"); // Remove leftover persistent debug draw messages m_debugDrawMessages.Clear(); MyScene.DynamicRenderablesDBVH.Clear(); if (MyScene.SeparateGeometry) { MyScene.StaticRenderablesDBVH.Clear(); } MyScene.GroupsDBVH.Clear(); MyScene.FoliageDBVH.Clear(); MyClipmapFactory.RemoveAll(); MyClipmap.UnloadCache(); MyInstancing.OnSessionEnd(); MyFoliageComponents.OnSessionEnd(); MyMeshes.OnSessionEnd(); MyLights.OnSessionEnd(); MyMaterials1.OnSessionEnd(); MyVoxelMaterials1.OnSessionEnd(); MyMeshMaterials1.OnSessionEnd(); MyScreenDecals.OnSessionEnd(); MyBigMeshTable.Table.OnSessionEnd(); MyPrimitivesRenderer.Unload(); MyTransparentRendering.OnSessionEnd(); //MyAssetsLoader.ClearMeshes(); }
internal static unsafe void InitSubsystems() { MyManagers.OnDeviceInit(); //MyRwTextures.Init(); MyHwBuffers.Init(); ResetShadows(MyShadowCascades.Settings.NewData.CascadesCount, RenderSettings.ShadowQuality.ShadowCascadeResolution()); MyRender11.Init(); MyCommon.Init(); MyVertexLayouts.Init(); MyShaders.Init(); MyMeshes.Init(); MyMeshTableSrv.Init(); MyLightRendering.Init(); MyLinesRenderer.Init(); MySpritesRenderer.Init(); MyPrimitivesRenderer.Init(); MyOutline.Init(); MyBlur.Init(); MyTransparentRendering.Init(); MyFoliageComponents.Init(); MyBillboardRenderer.Init(); // hardcoded limits MyDebugRenderer.Init(); MyScreenDecals.Init(); MyEnvProbeProcessing.Init(); MyAtmosphereRenderer.Init(); MyCloudRenderer.Init(); MyAAEdgeMarking.Init(); MyScreenPass.Init(); MyCopyToRT.Init(); MyBlendTargets.Init(); MyFXAA.Init(); MyDepthResolve.Init(); MyBloom.Init(); MyLuminanceAverage.Init(); MyToneMapping.Init(); MySSAO.Init(); MyHdrDebugTools.Init(); MySceneMaterials.Init(); MyMaterials1.Init(); MyVoxelMaterials1.Init(); MyMeshMaterials1.Init(); MyHBAO.Init(); try { if (m_settings.UseStereoRendering) { var openVR = new MyOpenVR(); MyStereoStencilMask.InitUsingOpenVR(); } } catch (System.Exception e) { if (!VRage.MyCompilationSymbols.DX11ForceStereo) { throw; } MyStereoStencilMask.InitUsingUndefinedMask(); } }