public PerformanceSegment addPerformanceMeter(XnaScrapId name, bool autoreset = false) { PerformanceSegment seg; if (!m_timer.Keys.Contains(name)) { seg = new PerformanceSegment(name.ToString()); m_timer.Add(name,seg); if (autoreset) m_autoreset.Add(seg); return seg; } else { throw new Exception(); } }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { base.Initialize(); // performance PerformanceMonitor perfMon = Game.Services.GetService(typeof(PerformanceMonitor)) as PerformanceMonitor; if (perfMon != null) { m_mainTimer = perfMon.addPerformanceMeter(new XnaScrapId("SceneManagement"),true); m_insertTimer = m_mainTimer.addSubTimer("Inserting"); m_queryTimer = m_mainTimer.addSubTimer("Queries"); m_updateTimer = m_mainTimer.addSubTimer("NodeUpdates"); } }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // register elements IObjectBuilder objectBuilder = Game.Services.GetService(typeof(IObjectBuilder)) as IObjectBuilder; if (objectBuilder != null) { registerElements(objectBuilder); } // performance PerformanceMonitor perfMon = Game.Services.GetService(typeof(PerformanceMonitor)) as PerformanceMonitor; if (perfMon != null) { m_mainTimer = perfMon.addPerformanceMeter(new XnaScrapId("CBeroRenderManager")); m_sceneTimer = m_mainTimer.addSubTimer("Scene"); m_overlayTimer = m_mainTimer.addSubTimer("Overlays"); } #if WINDOWS // register REST stuff NetCtrlService netCtrlService = Game.Services.GetService(typeof(NetCtrlService)) as NetCtrlService; if (netCtrlService != null) { netCtrlService.AddServiceNode(new RenderManagerNode(this), this); } #endif base.Initialize(); m_spriteBatch = new SpriteBatch(GraphicsDevice); GraphicsDevice.DepthStencilState = DepthStencilState.Default; #region materials BasicEffect basicEffect = new BasicEffect(GraphicsDevice); basicEffect.EnableDefaultLighting(); basicEffect.PreferPerPixelLighting = true; m_basicEffectMaterial.Effect = basicEffect; m_basicEffectMaterial.Technique = basicEffect.Techniques.First().Name; Material.ParameterMapping worldviewprojection = new Material.ParameterMapping(); worldviewprojection.name = "WorldViewProj"; worldviewprojection.perInstance = true; worldviewprojection.semantic = Material.ShaderParameterSemantic.MODEL_VIEW_PROJECTION_MATRIX; m_basicEffectMaterial.ParameterMappings.Add(worldviewprojection); SkinnedEffect skinnedEffect = new SkinnedEffect(GraphicsDevice); skinnedEffect.EnableDefaultLighting(); m_skinnedEffectMaterial.Effect = skinnedEffect; m_skinnedEffectMaterial.Technique = skinnedEffect.Techniques.First().Name; RenderState.PushMaterial(m_basicEffectMaterial); #endregion #region effects m_defaultEffect = new CBeroEffect(this); m_defaultCollection = new RenderTargetCollection(DefaultRenderTarget.GetInstance().Id, new IRenderTarget[] { DefaultRenderTarget.GetInstance() }); m_defaultCollection.Effect = m_defaultEffect; m_defaultEffect.AddPass(new RenderSceneWithMaterialsPass(this, m_defaultCollection)); m_defaultEffect.AddPass(new RenderOverlaysPass(this, m_defaultCollection)); // add DefaultRenderTarget m_renderTargets.Add(DefaultRenderTarget.GetInstance().Id, m_defaultCollection); #endregion }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // init elements IObjectBuilder objectBuilder = Game.Services.GetService(typeof(IObjectBuilder)) as IObjectBuilder; if (objectBuilder != null) { registerElements(objectBuilder); m_navigationMeshService.registerElements(objectBuilder); } // performance PerformanceMonitor perfMon = Game.Services.GetService(typeof(PerformanceMonitor)) as PerformanceMonitor; if (perfMon != null) { m_mainTimer = perfMon.addPerformanceMeter(new XnaScrapId("CollisionManager")); m_findTimer = m_mainTimer.addSubTimer("DetectCollisions"); m_resolveTimer = m_mainTimer.addSubTimer("ResolveCollisions"); } base.Initialize(); }
public PerformanceSegment addSubTimer(String name) { PerformanceSegment seg = null; if (!m_subSegment.Keys.Contains(name)) { seg = new PerformanceSegment(name); m_subSegment.Add(name, seg); return seg; } else { throw new Exception(); } }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { base.Initialize(); m_mainTimer = addPerformanceMeter(new XnaScrapId("PerformanceMonitor")); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here base.Initialize(); // performance PerformanceMonitor perfMon = Game.Services.GetService(typeof(PerformanceMonitor)) as PerformanceMonitor; if (perfMon != null) { m_mainTimer = perfMon.addPerformanceMeter(new XnaScrapId("ActionService")); } }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // init elements IObjectBuilder objectBuilder = Game.Services.GetService(typeof(IObjectBuilder)) as IObjectBuilder; if (objectBuilder != null) { registerElements(objectBuilder); } // performance PerformanceMonitor perfMon = Game.Services.GetService(typeof(PerformanceMonitor)) as PerformanceMonitor; if (perfMon != null) { m_mainTimer = perfMon.addPerformanceMeter(new XnaScrapId("LogicService")); } base.Initialize(); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // TODO: Add your initialization code here IObjectBuilder objectBuilder = Game.Services.GetService(typeof(IObjectBuilder)) as IObjectBuilder; if (objectBuilder != null) { registerElements(objectBuilder); } // performance PerformanceMonitor perfMon = Game.Services.GetService(typeof(PerformanceMonitor)) as PerformanceMonitor; if (perfMon != null) { m_mainTimer = perfMon.addPerformanceMeter(new XnaScrapId("NavigationMeshManager"),true); } base.Initialize(); }
/// <summary> /// Allows the game component to perform any initialization it needs to before starting /// to run. This is where it can query for any required services and load content. /// </summary> public override void Initialize() { // init elements // performance PerformanceMonitor perfMon = Game.Services.GetService(typeof(PerformanceMonitor)) as PerformanceMonitor; if (perfMon != null) { m_mainTimer = perfMon.addPerformanceMeter(new XnaScrapId("ObjectBuilder")); m_creation = m_mainTimer.addSubTimer("ObjectCreation"); m_destruction = m_mainTimer.addSubTimer("ObjectDestruction"); } base.Initialize(); }