diff --git a/ANX.Framework/Content/GraphicTypeReaders/EffectReader.cs b/ANX.Framework/Content/GraphicTypeReaders/EffectReader.cs index 94798a55..0f794655 100644 --- a/ANX.Framework/Content/GraphicTypeReaders/EffectReader.cs +++ b/ANX.Framework/Content/GraphicTypeReaders/EffectReader.cs @@ -3,6 +3,7 @@ using System; using System.IO; using ANX.Framework.Graphics; using ANX.Framework.ContentPipeline; +using ANX.Framework.NonXNA; #endregion // Using Statements diff --git a/ANX.Framework/Content/GraphicTypeReaders/ModelReader.cs b/ANX.Framework/Content/GraphicTypeReaders/ModelReader.cs index 3a703c6f..eae656ca 100644 --- a/ANX.Framework/Content/GraphicTypeReaders/ModelReader.cs +++ b/ANX.Framework/Content/GraphicTypeReaders/ModelReader.cs @@ -4,6 +4,7 @@ using System.IO; using System.Collections.Generic; using ANX.Framework.Graphics; using ANX.Framework.ContentPipeline; +using ANX.Framework.NonXNA; #endregion // Using Statements diff --git a/ANX.Framework/Content/GraphicTypeReaders/Texture2DReader.cs b/ANX.Framework/Content/GraphicTypeReaders/Texture2DReader.cs index 0b58d5c9..2366a02d 100644 --- a/ANX.Framework/Content/GraphicTypeReaders/Texture2DReader.cs +++ b/ANX.Framework/Content/GraphicTypeReaders/Texture2DReader.cs @@ -3,6 +3,7 @@ using System; using System.IO; using ANX.Framework.Graphics; using System.Collections.Generic; +using ANX.Framework.NonXNA; #endregion // Using Statements diff --git a/ANX.Framework/Content/GraphicTypeReaders/Texture3DReader.cs b/ANX.Framework/Content/GraphicTypeReaders/Texture3DReader.cs index 2af72e26..8a91bd8f 100644 --- a/ANX.Framework/Content/GraphicTypeReaders/Texture3DReader.cs +++ b/ANX.Framework/Content/GraphicTypeReaders/Texture3DReader.cs @@ -3,6 +3,7 @@ using System; using System.IO; using ANX.Framework.Graphics; using System.Collections.Generic; +using ANX.Framework.NonXNA; #endregion // Using Statements diff --git a/ANX.Framework/Content/GraphicTypeReaders/TextureCubeReader.cs b/ANX.Framework/Content/GraphicTypeReaders/TextureCubeReader.cs index 28b48b8c..ba820915 100644 --- a/ANX.Framework/Content/GraphicTypeReaders/TextureCubeReader.cs +++ b/ANX.Framework/Content/GraphicTypeReaders/TextureCubeReader.cs @@ -3,6 +3,7 @@ using System; using System.IO; using ANX.Framework.Graphics; using System.Collections.Generic; +using ANX.Framework.NonXNA; #endregion // Using Statements diff --git a/ANX.Framework/NonXNA/AddInSystemFactory.cs b/ANX.Framework/NonXNA/AddInSystemFactory.cs index 1636aced..0cf1100d 100644 --- a/ANX.Framework/NonXNA/AddInSystemFactory.cs +++ b/ANX.Framework/NonXNA/AddInSystemFactory.cs @@ -90,6 +90,8 @@ namespace ANX.Framework.NonXNA { if (!initialized) { + initialized = true; + logger.Info("[ANX] Initializing ANX.Framework AddInSystemFactory..."); String executingAssembly = Assembly.GetExecutingAssembly().Location; @@ -129,7 +131,7 @@ namespace ANX.Framework.NonXNA } } - initialized = true; + SetDefaultCreators(); } } @@ -152,6 +154,11 @@ namespace ANX.Framework.NonXNA public T GetCreator(String name) where T : class, ICreator { + if (!initialized) + { + Initialize(); + } + ICreator creator = null; creators.TryGetValue(name.ToLowerInvariant(), out creator); return creator as T; @@ -159,6 +166,11 @@ namespace ANX.Framework.NonXNA public IEnumerable GetCreators() where T : class, ICreator { + if (!initialized) + { + Initialize(); + } + Type t = typeof(T); foreach (ICreator creator in this.creators.Values) @@ -172,6 +184,11 @@ namespace ANX.Framework.NonXNA public T GetDefaultCreator() where T : class, ICreator { + if (!initialized) + { + Initialize(); + } + Type type = typeof(T); if (defaultCreators.ContainsKey(type)) @@ -189,10 +206,53 @@ namespace ANX.Framework.NonXNA public void SetDefaultCreator(string creatorName) { + if (!initialized) + { + Initialize(); + } + ICreator creator = null; creators.TryGetValue(creatorName.ToLowerInvariant(), out creator); defaultCreators[creator.GetType().GetInterfaces()[0]] = creator; } + private void SetDefaultCreators() + { + foreach (ICreator creator in this.creators.Values) + { + string type = creator.GetType().GetInterfaces()[0].ToString(); + + switch (type) + { + case "ANX.Framework.NonXNA.IRenderSystemCreator": + IRenderSystemCreator renderSystemCreator = creator as IRenderSystemCreator; + IRenderSystemCreator defaultRenderSystemCreator = GetDefaultCreator(); + if (renderSystemCreator != null && (defaultRenderSystemCreator == null || defaultRenderSystemCreator.Priority > renderSystemCreator.Priority)) + { + SetDefaultCreator(renderSystemCreator); + } + break; + case "ANX.Framework.NonXNA.ISoundSystemCreator": + ISoundSystemCreator soundSystemCreator = creator as ISoundSystemCreator; + ISoundSystemCreator defaultSoundSystemCreator = GetDefaultCreator(); + if (soundSystemCreator != null && (defaultSoundSystemCreator == null || defaultSoundSystemCreator.Priority > soundSystemCreator.Priority)) + { + SetDefaultCreator(soundSystemCreator); + } + break; + case "ANX.Framework.NonXNA.IInputSystemCreator": + IInputSystemCreator inputSystemCreator = creator as IInputSystemCreator; + IInputSystemCreator defaultInputSystemCreator = GetDefaultCreator(); + if (inputSystemCreator != null && (defaultInputSystemCreator == null || defaultInputSystemCreator.Priority > inputSystemCreator.Priority)) + { + SetDefaultCreator(inputSystemCreator); + } + break; + default: + throw new InvalidOperationException(String.Format("unable to set a default system for creator of type '{0}'", type)); + } + } + } + } } diff --git a/ANX.Framework/NonXNA/ICreator.cs b/ANX.Framework/NonXNA/ICreator.cs index 7715e4b7..6fe32b5b 100644 --- a/ANX.Framework/NonXNA/ICreator.cs +++ b/ANX.Framework/NonXNA/ICreator.cs @@ -63,5 +63,6 @@ namespace ANX.Framework.NonXNA string Name { get; } + int Priority { get; } } } diff --git a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs index 733344af..cb4e4054 100644 --- a/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs +++ b/ANX.Framework/NonXNA/RenderSystem/IRenderSystemCreator.cs @@ -55,7 +55,7 @@ using ANX.Framework.NonXNA.RenderSystem; #endregion // License -namespace ANX.Framework +namespace ANX.Framework.NonXNA { public interface IRenderSystemCreator : ICreator { diff --git a/InputSystems/ANX.InputSystem.Windows.Kinect/Creator.cs b/InputSystems/ANX.InputSystem.Windows.Kinect/Creator.cs index 12dbff43..e58aa68b 100644 --- a/InputSystems/ANX.InputSystem.Windows.Kinect/Creator.cs +++ b/InputSystems/ANX.InputSystem.Windows.Kinect/Creator.cs @@ -62,6 +62,11 @@ namespace ANX.InputSystem.Windows.Kinect get { return "Kinect"; } } + public int Priority + { + get { return int.MaxValue; } + } + public void RegisterCreator(AddInSystemFactory factory) { factory.AddCreator(this); diff --git a/InputSystems/ANX.InputSystem.Windows.Kinect/Properties/AssemblyInfo.cs b/InputSystems/ANX.InputSystem.Windows.Kinect/Properties/AssemblyInfo.cs index 19406fec..724595a8 100644 --- a/InputSystems/ANX.InputSystem.Windows.Kinect/Properties/AssemblyInfo.cs +++ b/InputSystems/ANX.InputSystem.Windows.Kinect/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.5.2.0")] -[assembly: AssemblyFileVersion("0.5.2.0")] +[assembly: AssemblyVersion("0.5.3.0")] +[assembly: AssemblyFileVersion("0.5.3.0")] diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs b/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs index 9b0449fd..db0bb90d 100644 --- a/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs +++ b/InputSystems/ANX.InputSystem.Windows.XInput/Creator.cs @@ -71,6 +71,11 @@ namespace ANX.InputSystem.Windows.XInput } } + public int Priority + { + get { return 10; } + } + public void RegisterCreator(AddInSystemFactory factory) { logger.Debug("adding XInput creator to creator collection of AddInSystemFactory"); diff --git a/InputSystems/ANX.InputSystem.Windows.XInput/Properties/AssemblyInfo.cs b/InputSystems/ANX.InputSystem.Windows.XInput/Properties/AssemblyInfo.cs index ec123a31..3d5de665 100644 --- a/InputSystems/ANX.InputSystem.Windows.XInput/Properties/AssemblyInfo.cs +++ b/InputSystems/ANX.InputSystem.Windows.XInput/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.6.1.0")] -[assembly: AssemblyFileVersion("0.6.1.0")] +[assembly: AssemblyVersion("0.6.2.0")] +[assembly: AssemblyFileVersion("0.6.2.0")] diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs index 8ed9f044..d0224bcb 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/Creator.cs @@ -68,6 +68,11 @@ namespace ANX.Framework.Windows.DX10 get { return "DirectX10"; } } + public int Priority + { + get { return 10; } + } + public GameHost CreateGameHost(Game game) { return new WindowsGameHost(game); diff --git a/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs b/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs index 5243a779..fb2eac95 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/Properties/AssemblyInfo.cs @@ -32,7 +32,7 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.7.9.0")] -[assembly: AssemblyFileVersion("0.7.9.0")] +[assembly: AssemblyVersion("0.7.10.0")] +[assembly: AssemblyFileVersion("0.7.10.0")] [assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")] diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs index b9daa4d5..ead8d529 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs +++ b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs @@ -73,6 +73,12 @@ namespace ANX.Framework.Windows.GL3 return "OpenGL3"; } } + + public int Priority + { + get { return 100; } + } + #endregion #region RegisterRenderSystemCreator diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs b/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs index 81eb2990..75841c3c 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs +++ b/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs @@ -32,7 +32,7 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.5.3.0")] -[assembly: AssemblyFileVersion("0.5.3.0")] +[assembly: AssemblyVersion("0.5.4.0")] +[assembly: AssemblyFileVersion("0.5.4.0")] [assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")] diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs index 170fc291..16d67ce1 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Creator.cs @@ -73,6 +73,11 @@ namespace ANX.RenderSystem.Windows.DX11 get { return "DirectX11"; } } + public int Priority + { + get { return int.MaxValue; } + } + public GameHost CreateGameHost(Game game) { throw new NotImplementedException(); diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs index 91a5d86a..aecb276a 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/Properties/AssemblyInfo.cs @@ -29,5 +29,5 @@ using System.Runtime.InteropServices; // Buildnummer // Revision // -[assembly: AssemblyVersion("0.1.1.0")] -[assembly: AssemblyFileVersion("0.1.1.0")] +[assembly: AssemblyVersion("0.1.2.0")] +[assembly: AssemblyFileVersion("0.1.2.0")] diff --git a/Samples/StencilBuffer/Game1.cs b/Samples/StencilBuffer/Game1.cs index 8f736963..7506ad4b 100644 --- a/Samples/StencilBuffer/Game1.cs +++ b/Samples/StencilBuffer/Game1.cs @@ -14,38 +14,42 @@ namespace StencilBuffer private Texture2D crate; private Texture2D ground; - private SamplerState SamplerState; - private DepthStencilState RenderGroundStencilState; - private DepthStencilState RenderObjectsStencilState; - private DepthStencilState StencilStateRenderShadows; + protected static SamplerState SamplerState = new SamplerState() + { + AddressU = TextureAddressMode.Wrap, + AddressV = TextureAddressMode.Wrap, + AddressW = TextureAddressMode.Wrap, + Filter = TextureFilter.Linear, + }; - //protected static SamplerState SamplerState = new SamplerState - //{ - // AddressU = TextureAddressMode.Wrap, - // AddressV = TextureAddressMode.Wrap, - // AddressW = TextureAddressMode.Wrap, - // Filter = TextureFilter.Linear, - //}; + private static readonly DepthStencilState RenderGroundStencilState = new DepthStencilState() + { + DepthBufferEnable = false, + DepthBufferWriteEnable = false, + StencilEnable = true, + ReferenceStencil = 1, + StencilPass = StencilOperation.Replace, + StencilFunction = CompareFunction.Always, + }; - //private static readonly DepthStencilState RenderObjectsStencilState = new DepthStencilState() - //{ - // DepthBufferEnable = true, - // DepthBufferWriteEnable = true, - // DepthBufferFunction = CompareFunction.Always, - // ReferenceStencil = 2, - // StencilEnable = true, - // StencilPass = StencilOperation.Increment, - //}; + private static readonly DepthStencilState RenderObjectsStencilState = new DepthStencilState() + { + DepthBufferEnable = true, + DepthBufferWriteEnable = true, + DepthBufferFunction = CompareFunction.Always, + ReferenceStencil = 1, + StencilEnable = false, + StencilPass = StencilOperation.Replace, + }; - //private static readonly DepthStencilState StencilStateRenderShadows = new DepthStencilState - //{ - // DepthBufferEnable = true, - // DepthBufferWriteEnable = true, - // DepthBufferFunction = CompareFunction.LessEqual, - // ReferenceStencil = 1, - // StencilEnable = true, - // StencilPass = StencilOperation.Keep, - //}; + private static readonly DepthStencilState StencilStateRenderShadows = new DepthStencilState + { + DepthBufferEnable = false, + StencilEnable = true, + ReferenceStencil = 1, + StencilPass = StencilOperation.Increment, + StencilFunction = CompareFunction.LessEqual, + }; public Game1() { @@ -67,44 +71,6 @@ namespace StencilBuffer crate = Content.Load(@"Textures/chest"); ground = Content.Load(@"Textures/stone_tile"); - - this.SamplerState = new SamplerState() - { - AddressU = TextureAddressMode.Wrap, - AddressV = TextureAddressMode.Wrap, - AddressW = TextureAddressMode.Wrap, - Filter = TextureFilter.Linear, - }; - - this.RenderGroundStencilState = new DepthStencilState() - { - DepthBufferEnable = false, - DepthBufferWriteEnable = false, - StencilEnable = true, - ReferenceStencil = 1, - StencilPass = StencilOperation.Replace, - StencilFunction = CompareFunction.Always, - }; - - this.RenderObjectsStencilState = new DepthStencilState() - { - DepthBufferEnable = true, - DepthBufferWriteEnable = true, - DepthBufferFunction = CompareFunction.Always, - ReferenceStencil = 1, - StencilEnable = false, - StencilPass = StencilOperation.Replace, - }; - - this.StencilStateRenderShadows = new DepthStencilState - { - DepthBufferEnable = false, - StencilEnable = true, - ReferenceStencil = 1, - StencilPass = StencilOperation.Increment, - StencilFunction = CompareFunction.LessEqual, - }; - } private void RenderObjects() @@ -132,7 +98,7 @@ namespace StencilBuffer { spriteBatch.Begin(SpriteSortMode.Texture, null, SamplerState, StencilStateRenderShadows, null); spriteBatch.Draw(crate, new Vector2(125, 125), new Color(0, 0, 0, 0.5f)); - spriteBatch.Draw(crate, new Vector2(20, 20), new Color(0, 0, 0, 0.5f)); + spriteBatch.Draw(crate, new Vector2(10, 10), new Color(0, 0, 0, 0.5f)); spriteBatch.End(); } diff --git a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs index 5011ecff..4888e31b 100644 --- a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs +++ b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Creator.cs @@ -70,5 +70,11 @@ namespace ANX.SoundSystem.Windows.XAudio { get { return "XAudio"; } } + + public int Priority + { + get { return 10; } + } + } } diff --git a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Properties/AssemblyInfo.cs b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Properties/AssemblyInfo.cs index 7c444890..3802bf09 100644 --- a/SoundSystems/ANX.SoundSystem.Windows.XAudio/Properties/AssemblyInfo.cs +++ b/SoundSystems/ANX.SoundSystem.Windows.XAudio/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // übernehmen, indem Sie "*" eingeben: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("0.0.1.0")] -[assembly: AssemblyFileVersion("0.0.1.0")] +[assembly: AssemblyVersion("0.0.2.0")] +[assembly: AssemblyFileVersion("0.0.2.0")]