public override void Update(GameTime gameTime) { if (SceneInstance != null) { SceneInstance.Update(gameTime); } }
public override void Draw(GameTime gameTime) { if (SceneInstance == null || MainRenderFrame == null) { return; } // If the width or height changed, we have to recycle all temporary allocated resources. // NOTE: We assume that they are mostly resolution dependent. if (previousWidth != MainRenderFrame.Width || previousHeight != MainRenderFrame.Height) { // Force a recycle of all allocated temporary textures renderContext.Allocator.Recycle(link => true); } previousWidth = MainRenderFrame.Width; previousHeight = MainRenderFrame.Height; // Update the entities at draw time. renderContext.Time = gameTime; SceneInstance.Draw(renderContext); // Renders the scene SceneInstance.Draw(renderContext, MainRenderFrame); }
protected override void LoadContent() { var assetManager = Services.GetSafeServiceAs<AssetManager>(); // Preload the scene if it exists if (InitialSceneUrl != null && assetManager.Exists(InitialSceneUrl)) { SceneInstance = new SceneInstance(Services, assetManager.Load<Scene>(InitialSceneUrl)); } if (MainRenderFrame == null) { MainRenderFrame = RenderFrame.FromTexture(GraphicsDevice.BackBuffer, GraphicsDevice.DepthStencilBuffer); previousWidth = MainRenderFrame.Width; previousHeight = MainRenderFrame.Height; } // Create the drawing context renderContext = RenderContext.GetShared(Services); }
protected override void LoadContent() { var assetManager = Services.GetSafeServiceAs <AssetManager>(); // Preload the scene if it exists if (InitialSceneUrl != null && assetManager.Exists(InitialSceneUrl)) { SceneInstance = new SceneInstance(Services, assetManager.Load <Scene>(InitialSceneUrl)); } if (MainRenderFrame == null) { MainRenderFrame = RenderFrame.FromTexture(GraphicsDevice.BackBuffer, GraphicsDevice.DepthStencilBuffer); previousWidth = MainRenderFrame.Width; previousHeight = MainRenderFrame.Height; } // Create the drawing context renderContext = RenderContext.GetShared(Services); }
protected override void DrawCore(RenderContext context, RenderFrame output) { if (ChildScene == null || !ChildScene.Enabled) { return; } currentSceneInstance = SceneInstance.GetCurrent(Context); childSceneProcessor = childSceneProcessor ?? currentSceneInstance.GetProcessor<ChildSceneProcessor>(); if (childSceneProcessor == null) { return; } SceneInstance sceneInstance = childSceneProcessor.GetSceneInstance(ChildScene); if (sceneInstance != null) { sceneInstance.Draw(context, output, GraphicsCompositorOverride); } }
protected override void DrawCore(RenderContext context, RenderFrame output) { if (ChildScene == null || !ChildScene.Enabled) { return; } currentSceneInstance = SceneInstance.GetCurrent(Context); childSceneProcessor = childSceneProcessor ?? currentSceneInstance.GetProcessor <ChildSceneProcessor>(); if (childSceneProcessor == null) { return; } SceneInstance sceneInstance = childSceneProcessor.GetSceneInstance(ChildScene); if (sceneInstance != null) { sceneInstance.Draw(context, output, GraphicsCompositorOverride); } }
public virtual void Initialize(SceneInstance sceneInstance, Entity sceneEntity) { SceneEntity = sceneEntity; SceneInstance = sceneInstance; Input = Services.GetServiceAs<InputManager>(); graphicsDeviceService = Services.GetServiceAs<IGraphicsDeviceService>(); RootEntity = Create(); if (RootEntity != null) { AssignEntityGroupToEntity(RootEntity); sceneInstance.Scene.AddChild(RootEntity); } IsSelected = false; }