public Game(Root root, RenderWindow renderWindow) { _root = root; _renderWindow = renderWindow; _renderItems = new List<IRenderItem>(); _context = this; }
static void Main(string[] args) { IConfigurationManager ConfigurationManager = ConfigurationManagerFactory.CreateDefault(); using (Root _root = new Root("game.log")) { ConfigurationManager.RestoreConfiguration(_root); if (ConfigurationManager.ShowConfigDialog(_root)) { ConfigurationManager.SaveConfiguration(_root); using (RenderWindow _renderWindow = _root.Initialize(true, "Illisian.Niva")) { var game = new Game(_root, _renderWindow); WindowEventMonitor.Instance.RegisterListener(_renderWindow, game); game.OnLoad(); game.CreateScene(); _root.FrameRenderingQueued += game.OnRenderFrame; _root.FrameStarted += game.UpdateInput; _root.FrameStarted += game.UpdateOverlay; _root.FrameEnded += game.OnRenderFrameEnd; _root.StartRendering(); game.OnUnload(); } } } }
private bool _configure( Options options ) { // instantiate the Root singleton engine = new Root( "AxiomDemos.log" ); _setupResources(); dlg = new DemoConfigDialog(); dlg.LoadRenderSystemConfig += new ConfigDialog.LoadRenderSystemConfigEventHandler( LoadRenderSystemConfiguration ); dlg.SaveRenderSystemConfig += new ConfigDialog.SaveRenderSystemConfigEventHandler( SaveRenderSystemConfiguration ); dlg.LoadDemos( DemoAssembly ); if ( String.IsNullOrEmpty( options.Sample ) ) { DialogResult result = dlg.ShowDialog(); if ( result == DialogResult.Cancel ) { Root.Instance.Dispose(); engine = null; return false; } } else { engine.RenderSystem = engine.RenderSystems[ 0 ]; this.LoadRenderSystemConfiguration( this, engine.RenderSystems[ 0 ] ); } return true; }
void Initialize() { try { //new AndroidAssetArchive( this.Context.Assets ); // instantiate the Root singleton _engine = new Root( "AxiomDemos.log" ); ( new Axiom.RenderSystems.OpenGLES.GLESPlugin() ).Initialize(); ( new Axiom.Platform.Android.Plugin() ).Initialize(); Root.Instance.RenderSystem = Root.Instance.RenderSystems[ "OpenGLES" ]; _loadPlugins(); _setupResources(); demo = new Demos.Tutorial1(); demo.Setup( this.GraphicsContext, this.Width, this.Height ); } catch ( Exception ex ) { Console.WriteLine( "An exception has occurred. See below for details:" ); Console.WriteLine( BuildExceptionString( ex ) ); } }
public void Initialise(Root item) { _root = item; Game.Context.Input.KeyDown += Input_KeyDown; Game.Context.Input.KeyUp += Input_KeyUp; }
private void PreInitialize() { this.ConfigurationManager = new DefaultConfigurationManager(); // instantiate the Root singleton this.Engine = new Root( this.ConfigurationManager.LogFilename ); // add event handlers for frame events this.Engine.FrameStarted += Engine_FrameRenderingQueued; }
public WinFormConfigurationDialog( Root engine, ResourceGroupManager resourceManager ) { this.Engine = engine; this.ResourceManager = resourceManager; this.SetStyle( SWF.ControlStyles.DoubleBuffer, true ); InitializeComponent(); LogoResourceName = _logoResourceNameDefault; IconResourceName = _iconResourceNameDefault; }
private static void Main() { using (var r = new Root()) { r.RenderSystem = r.RenderSystems[0]; using (r.Initialize(true)) { var win = new DemoWindow(r); win.OnLoad(); r.FrameRenderingQueued += win.OnRenderFrame; r.StartRendering(); win.OnUnload(); } } }
public void Start(string host, bool userConfigure, bool debugSettings) { // HACK: Use an English culture so that Axiom.Overlays.Elements.BorderPanel works. System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture; // HACK: Get assembly Axiom.Platforms.Win32.dll loaded before any dynamically created assembly. // This is to avoid an exception getting thrown from the Root constructor. System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor(typeof(Axiom.Platforms.Win32.Win32InputReader).TypeHandle); var service = Connect(host); var configuration = ConfigurationManagerFactory.CreateDefault(); using (var root = new Root("MOOLGOSS.log")) using (Globals.Input = new Input()) { root.RenderSystem = root.RenderSystems[0]; root.RenderSystem.ConfigOptions["VSync"].Value = "Yes"; root.RenderSystem.ConfigOptions["Full Screen"].Value = "Yes"; var bestMode = root.RenderSystem.ConfigOptions["Video Mode"].PossibleValues .Where(x => x.Value.Contains("32-bit color")) .LastOrDefault().Value; if (bestMode != null) root.RenderSystem.ConfigOptions["Video Mode"].Value = bestMode; if (debugSettings) { root.RenderSystem.ConfigOptions["Full Screen"].Value = "No"; root.RenderSystem.ConfigOptions["Video Mode"].Value = "800 x 600 @ 32-bit color"; } if (userConfigure && !configuration.ShowConfigDialog(root)) return; var window = CreateRenderWindow(root.RenderSystem.ConfigOptions["Video Mode"].Value == "Yes"); Globals.Input.Initialize(window, ownMouse: !debugSettings); ResourceGroupManager.Instance.AddResourceLocation("Media", "Folder", true); ResourceGroupManager.Instance.InitializeAllResourceGroups(); Globals.Scene = root.CreateSceneManager(SceneType.Generic); Globals.UI = new UserInterface(); Globals.UI.AddMode(new TitleScreen()); Globals.UI.AddMode(new Gameplay(service)); Globals.UI.AddMode(new Docked()); Globals.UI.SetMode("Title Screen"); CreateCamera(window); root.FrameStarted += FrameStartedHandler; root.StartRendering(); } }
private bool _configure( ) { // instantiate the Root singleton engine = new Root( "AxiomDemos.log" ); _setupResources(); // HACK: Temporary ConfigDialog dlg = new ConfigDialog(); DialogResult result = dlg.ShowDialog(); if ( result == DialogResult.Cancel ) { Root.Instance.Dispose(); engine = null; return false; } return true; }
private bool _configure() { new XnaResourceGroupManager(); // instantiate the Root singleton engine = new Root( "AxiomDemos.log" ); #if (XBOX || XBOX360) // ( new Axiom.RenderSystems.Xna.Plugin() ).Initialize(); #endif Root.Instance.RenderSystem = Root.Instance.RenderSystems[ "Xna" ]; Root.Instance.RenderSystem.ConfigOptions[ "Use Content Pipeline" ].Value = "Yes"; Root.Instance.RenderSystem.ConfigOptions[ "Video Mode" ].Value = "1280 x 720 @ 32-bit color"; _setupResources(); engine.FrameStarted += engine_FrameStarted; return true; }
private static void Main() { using (var r = new Root()) { if (r.RenderSystems.Count == 0) throw new Exception("No Rendersystem found"); Console.WriteLine("Select a Rendersystem"); for (var i = 0; i < r.RenderSystems.Count; i++) Console.WriteLine("{0}: {1}", i + 1, r.RenderSystems[i].Name); while (true) { int index; if (!int.TryParse(Console.ReadKey(true).KeyChar.ToString(), out index)) continue; if (index < 1) continue; index--; if (index >= r.RenderSystems.Count) continue; r.RenderSystem = r.RenderSystems[index]; break; } using (r.Initialize(true)) { var win = new DemoWindow(r, r.AutoWindow); win.OnLoad(); r.FrameRenderingQueued += win.OnRenderFrame; r.StartRendering(); win.OnUnload(); } } }
static void Main(string[] args) { AxiomTutorial app = new AxiomTutorial(); Root engine = new Root("EULog.txt"); List<RenderSystem> renderSystems = new List<RenderSystem>(engine.RenderSystems.Values); //renderSystems[0] engine.RenderSystem = renderSystems[0]; const string CONFIG_FILE = @"EngineConfig.xml"; string resourceConfigPath = Path.GetFullPath(CONFIG_FILE); if (File.Exists(resourceConfigPath)) { EngineConfig config = new EngineConfig(); // load the config file // relative from the location of debug and releases executables config.ReadXml(CONFIG_FILE); // interrogate the available resource paths foreach (EngineConfig.FilePathRow row in config.FilePath) { ResourceGroupManager.Instance.AddResourceLocation(Path.GetFullPath(row.src), row.type, row.group); } } /* ConfigDialog dlg = new ConfigDialog(); DialogResult result = dlg.ShowDialog(); if (result == DialogResult.Cancel) { return; } */ app.SetupResources(); app.Start(); }
/// <summary> /// Called to shutdown the engine and dispose of all it's resources. /// </summary> public void Dispose() { // force the engine to shutdown Shutdown(); if (OverlayManager.Instance != null) { OverlayManager.Instance.Dispose(); } if (OverlayElementManager.Instance != null) { OverlayElementManager.Instance.Dispose(); } if (FontManager.Instance != null) { FontManager.Instance.Dispose(); } if (ArchiveManager.Instance != null) { ArchiveManager.Instance.Dispose(); } if (SkeletonManager.Instance != null) { SkeletonManager.Instance.Dispose(); } if (MeshManager.Instance != null) { MeshManager.Instance.Dispose(); } if (MaterialManager.Instance != null) { MaterialManager.Instance.Dispose(); } Axiom.Serialization.MaterialSerializer.materialSourceFiles.Clear(); if (ParticleSystemManager.Instance != null) { ParticleSystemManager.Instance.Dispose(); } if (ControllerManager.Instance != null) { ControllerManager.Instance.Dispose(); } if (HighLevelGpuProgramManager.Instance != null) { HighLevelGpuProgramManager.Instance.Dispose(); } if (PluginManager.Instance != null) { PluginManager.Instance.Dispose(); } Pass.ProcessPendingUpdates(); if (PlatformManager.Instance != null) { PlatformManager.Instance.Dispose(); } if (LogManager.Instance != null) { LogManager.Instance.Dispose(); } instance = null; }
public virtual bool Setup() { // instantiate the Root singleton engine = new Root( "AxiomEngine.log" ); // engine = Root.Instance; ResourceGroupManager.Instance.AddResourceLocation("./media/", "Folder", "General", false, true); Axiom.Core.ResourceGroupManager.Instance.InitializeAllResourceGroups(); engine.RenderSystem = engine.RenderSystems.First().Value; // window = Root.Instance.Initialize(false); window = CreateRenderWindow(this.pictureEdit1); // add event handlers for frame events engine.FrameStarted += OnFrameStarted; // engine.FrameRenderingQueued += OnFrameRenderingQueued; // engine.FrameEnded += OnFrameEnded; // TechDemoListener rwl = new TechDemoListener(window); // WindowEventMonitor.Instance.RegisterListener(window, rwl); ChooseSceneManager(); CreateCamera(); CreateViewports(); // set default mipmap level TextureManager.Instance.DefaultMipmapCount = 5; // Create any resource listeners (for loading screens) // this.CreateResourceListener(); // Load resources ResourceGroupManager.Instance.InitializeAllResourceGroups(); //ShowDebugOverlay(showDebugOverlay); //CreateGUI(); // input = SetupInput(); // call the overridden CreateScene method CreateScene(); return true; }
public override void Close() { _engine = null; demo.Dispose(); base.Close(); }
/// <summary> /// /// </summary> public abstract bool ShowConfigDialog( Root engine );
public void Initialise(Axiom.Core.Root item) { _root = item; }
/// <summary> /// /// </summary> /// <param name="engine"></param> /// <param name="defaultRenderer"></param> public abstract void SaveConfiguration( Root engine, string defaultRenderer );
/// <summary> /// Constructor. /// </summary> /// <remarks> /// This public contructor is intended for the user to decide when the Root object gets instantiated. /// This is a critical step in preparing the engine for use. /// </remarks> /// <param name="configFileName">Name of the config file to load.</param> /// <param name="logFileName">Name of the default log file. (not used)</param> public Root(string configFileName, string logFileName) { if (instance == null) { instance = this; this.configFileName = configFileName; this.meterFrameCount = 0; this.pendingMeterFrameCount = 0; StringBuilder info = new StringBuilder(); // write the initial info at the top of the log info.AppendFormat("*********Axiom 3D Engine Log *************{0}", Environment.NewLine); info.AppendFormat("Copyright {0}{1}", this.Copyright, Environment.NewLine); info.AppendFormat("Version: {0}{1}", this.Version, Environment.NewLine); info.AppendFormat("Operating System: {0}{1}", Environment.OSVersion.ToString(), Environment.NewLine); info.AppendFormat(".Net Framework: {0}{1}", Environment.Version.ToString(), Environment.NewLine); // Initializes the Log Manager singleton LogManager logMgr = new LogManager(); /// Since logging is application wide, not just for axiom, it is now the application's /// responsibility to initialize logging. We now assume that the app has initialized the /// log first. //logMgr.CreateLog(logFileName, true, true); logMgr.Write(info.ToString()); logMgr.Write("*-*-* Axiom Intializing"); new ArchiveManager(); sceneManagerList = SceneManagerEnumerator.Instance; new MaterialManager(); new MeshManager(); new SkeletonManager(); new ParticleSystemManager(); PlatformManager.LoadInstance(); // create a new timer timer = PlatformManager.Instance.CreateTimer(); new OverlayManager(); new OverlayElementManager(); new FontManager(); new ZipArchiveFactory(); new CodecManager(); // register all build in codecs CodecManager.Instance.RegisterCodecs(); new HighLevelGpuProgramManager(); new CompositorManager(); new PluginManager(); PluginManager.Instance.LoadAll(); } }
/// <summary> /// Stops the gamer services component from updating /// </summary> public void Shutdown() { _engine.FrameStarted -= Update; _engine = null; _renderSystem = null; _window = null; }
/// <summary> /// Create an instance of the ConfigurationDialog /// </summary> /// <returns></returns> public override IConfigurationDialog CreateConfigurationDialog( Root engine, ResourceGroupManager resourceManager ) { return new WinFormConfigurationDialog( engine, resourceManager ); }
protected bool Setup() { if (repositoryDirectoryList.Count > 0) RepositoryClass.Instance.InitializeRepository(repositoryDirectoryList); else RepositoryClass.Instance.InitializeRepositoryPath(); // get a reference to the engine singleton engine = new Root(null, null); // retrieve the max FPS, if it exists getMaxFPSFromRegistry(); // add event handlers for frame events engine.FrameStarted += new FrameEvent(OnFrameStarted); engine.FrameEnded += new FrameEvent(OnFrameEnded); // make the collisionAPI object collisionManager = new CollisionAPI(false); // allow for setting up resource gathering if (!SetupResources()) return false; //show the config dialog and collect options if (!ConfigureAxiom()) { // shutting right back down engine.Shutdown(); return false; } if (!CheckShaderCaps()) { MessageBox.Show("Your graphics card does not support pixel shader 2.0 and vertex shader 2.0, which are required to run this tool.", "Graphics Card Not Supported", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); engine.Shutdown(); return false; } ChooseSceneManager(); CreateCamera(); CreateViewports(); // set default mipmap level TextureManager.Instance.DefaultNumMipMaps = 5; materialSchemeNames = MaterialManager.Instance.SchemeNames; if (materialSchemeNames.Count > 1) materialSchemeToolStripMenuItem.Enabled = true; // call the overridden CreateScene method CreateScene(); InitializeAxiomControlCallbacks(); return true; }
/// <summary> /// Constructor. /// </summary> /// <remarks> /// This public contructor is intended for the user to decide when the Root object gets instantiated. /// This is a critical step in preparing the engine for use. /// </remarks> /// <param name="logFilename">Name of the default log file.</param> public Root( string logFilename ) { if ( instance == null ) { instance = this; var info = new StringBuilder(); // write the initial info at the top of the log info.AppendFormat( "*********Axiom 3D Engine Log *************\n" ); info.AppendFormat( "{0}\n", Copyright ); info.AppendFormat("Version: {0}\n", Version); info.AppendFormat( "Operating System: {0}\n", Environment.OSVersion.ToString() ); var isMono = Type.GetType( "Mono.Runtime" ) != null; info.AppendFormat( "{1} Framework: {0}\n", Environment.Version.ToString(), isMono ? "Mono" : ".Net" ); // Initializes the Log Manager singleton if ( LogManager.Instance == null ) { new LogManager(); } this.logMgr = LogManager.Instance; //if logFileName is null, then just the Diagnostics (debug) writes will be made // create a new default log this.logMgr.CreateLog( logFilename, true, true ); this.logMgr.Write( info.ToString() ); this.logMgr.Write( "*-*-* Axiom Initializing" ); new PlatformManager(); ArchiveManager.Instance.Initialize(); #if !SILVERLIGHT ArchiveManager.Instance.AddArchiveFactory( new ZipArchiveFactory() ); #endif ArchiveManager.Instance.AddArchiveFactory( new FileSystemArchiveFactory() ); new ResourceGroupManager(); new CodecManager(); new HighLevelGpuProgramManager(); // Register image codecs DDSCodec.Initialize(); PVRTCCodec.Initialize(); ResourceGroupManager.Instance.Initialize(); // WorkQueue (note: users can replace this if they want) var defaultQ = new DefaultWorkQueue( "Root" ); // never process responses in main thread for longer than 10ms by default defaultQ.ResponseProcessingTimeLimit = 10; #if AXIOM_THREAD_SUPPORT #if !WINDOWS_PHONE defaultQ.WorkerThreadCount = Environment.ProcessorCount; #endif // only allow workers to access rendersystem if threadsupport is 1 if ( Axiom.Configuration.Config.AxiomThreadLevel == 1 ) defaultQ.WorkersCanAccessRenderSystem = true; else defaultQ.WorkersCanAccessRenderSystem = false; #endif this._workQueue = defaultQ; var resBack = new ResourceBackgroundQueue(); this.sceneManagerEnumerator = SceneManagerEnumerator.Instance; var mat = MaterialManager.Instance; var mesh = MeshManager.Instance; SkeletonManager.Instance.Initialize(); new ParticleSystemManager(); // create a new timer this.timer = new Timer(); FontManager.Instance.Initialize(); OverlayManager.Instance.Initialize(); new OverlayElementManager(); CompositorManager.Instance.Initialize(); LodStrategyManager.Instance.Initialize(); ScriptCompilerManager.Instance.Initialize(); new PluginManager(); PluginManager.Instance.LoadAll(); // instantiate and register base movable factories this.entityFactory = new EntityFactory(); AddMovableObjectFactory( this.entityFactory, true ); this.lightFactory = new LightFactory(); AddMovableObjectFactory( this.lightFactory, true ); this.billboardSetFactory = new BillboardSetFactory(); AddMovableObjectFactory( this.billboardSetFactory, true ); this.manualObjectFactory = new ManualObjectFactory(); AddMovableObjectFactory( this.manualObjectFactory, true ); this.billboardChainFactory = new BillboardChainFactory(); AddMovableObjectFactory( this.billboardChainFactory, true ); this.ribbonTrailFactory = new RibbonTrailFactory(); AddMovableObjectFactory( this.ribbonTrailFactory, true ); this.movableTextFactory = new MovableTextFactory(); AddMovableObjectFactory( this.movableTextFactory, true ); } }
public void Initialise(Root item) { _root = item; }
/// <summary> /// Called to shutdown the engine and dispose of all it's resources. /// </summary> public void Dispose() { // force the engine to shutdown Shutdown(); DDSCodec.Shutdown(); PVRTCCodec.Shutdown(); CompositorManager.Instance.SafeDispose(); OverlayManager.Instance.SafeDispose(); OverlayElementManager.Instance.SafeDispose(); FontManager.Instance.SafeDispose(); ArchiveManager.Instance.SafeDispose(); SkeletonManager.Instance.SafeDispose(); MeshManager.Instance.SafeDispose(); MaterialManager.Instance.SafeDispose(); ParticleSystemManager.Instance.SafeDispose(); ControllerManager.Instance.SafeDispose(); HighLevelGpuProgramManager.Instance.SafeDispose(); PluginManager.Instance.SafeDispose(); Pass.ProcessPendingUpdates(); ResourceGroupManager.Instance.SafeDispose(); // Note: The dispose method implementation of both ResourceBackgroundQueue and // DefaultWorkQueue internally calls Shutdown, so the direct call to Shutdown methods // isn't necessary in Root.Shutdown. ResourceBackgroundQueue.Instance.Dispose(); this._workQueue.Dispose(); this._workQueue = null; CodecManager.Instance.SafeDispose(); #if !XBOX360 PlatformManager.Instance.SafeDispose(); #endif this.activeRenderSystem = null; WindowEventMonitor.Instance.SafeDispose(); #if DEBUG ObjectManager.Instance.SafeDispose(); #endif LogManager.Instance.SafeDispose(); instance = null; }
/// <summary> /// Creates a new instance of <see cref="XnaGamerServices"/> /// </summary> /// <param name="engine">The engine</param> /// <param name="renderSystem">the rendersystem in use</param> /// <param name="window">The primary window</param> public XnaGamerServices( Root engine, XnaRenderSystem renderSystem, RenderWindow window ) { _engine = engine; _renderSystem = renderSystem; _window = window; }
/// <summary> /// /// </summary> /// <param name="engine"></param> public abstract bool RestoreConfiguration( Root engine );
protected bool Setup() { RepositoryClass.Instance.InitializeRepositoryPath(); // get a reference to the engine singleton engine = new Root("", "trace.txt"); // add event handlers for frame events engine.FrameStarted += new FrameEvent(OnFrameStarted); engine.FrameEnded += new FrameEvent(OnFrameEnded); // allow for setting up resource gathering if (!SetupResources()) return false; //show the config dialog and collect options if (!ConfigureAxiom()) { // shutting right back down engine.Shutdown(); return false; } if (!CheckShaderCaps()) { MessageBox.Show("Your graphics card does not support pixel shader 2.0 and vertex shader 2.0, which are required to run this tool.", "Graphics Card Not Supported", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); engine.Shutdown(); return false; } ChooseSceneManager(); CreateCamera(); CreateViewports(); // set default mipmap level TextureManager.Instance.DefaultNumMipMaps = 5; // call the overridden CreateScene method CreateScene(); return true; }
/// <summary> /// /// </summary> /// <param name="engine"></param> public abstract void SaveConfiguration( Root engine );