fixed issue #454 (InputSystem loaded too late)
fixed issue #466 (RenderSystem loaded too late)
This commit is contained in:
parent
05112d1e75
commit
4b58957ca5
@ -3,6 +3,7 @@ using System;
|
||||
using System.IO;
|
||||
using ANX.Framework.Graphics;
|
||||
using ANX.Framework.ContentPipeline;
|
||||
using ANX.Framework.NonXNA;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -3,6 +3,7 @@ using System;
|
||||
using System.IO;
|
||||
using ANX.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using ANX.Framework.NonXNA;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
|
@ -3,6 +3,7 @@ using System;
|
||||
using System.IO;
|
||||
using ANX.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using ANX.Framework.NonXNA;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
|
@ -3,6 +3,7 @@ using System;
|
||||
using System.IO;
|
||||
using ANX.Framework.Graphics;
|
||||
using System.Collections.Generic;
|
||||
using ANX.Framework.NonXNA;
|
||||
|
||||
#endregion // Using Statements
|
||||
|
||||
|
@ -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<T>(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<T> GetCreators<T>() 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<T>() 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<IRenderSystemCreator>();
|
||||
if (renderSystemCreator != null && (defaultRenderSystemCreator == null || defaultRenderSystemCreator.Priority > renderSystemCreator.Priority))
|
||||
{
|
||||
SetDefaultCreator<IRenderSystemCreator>(renderSystemCreator);
|
||||
}
|
||||
break;
|
||||
case "ANX.Framework.NonXNA.ISoundSystemCreator":
|
||||
ISoundSystemCreator soundSystemCreator = creator as ISoundSystemCreator;
|
||||
ISoundSystemCreator defaultSoundSystemCreator = GetDefaultCreator<ISoundSystemCreator>();
|
||||
if (soundSystemCreator != null && (defaultSoundSystemCreator == null || defaultSoundSystemCreator.Priority > soundSystemCreator.Priority))
|
||||
{
|
||||
SetDefaultCreator<ISoundSystemCreator>(soundSystemCreator);
|
||||
}
|
||||
break;
|
||||
case "ANX.Framework.NonXNA.IInputSystemCreator":
|
||||
IInputSystemCreator inputSystemCreator = creator as IInputSystemCreator;
|
||||
IInputSystemCreator defaultInputSystemCreator = GetDefaultCreator<IInputSystemCreator>();
|
||||
if (inputSystemCreator != null && (defaultInputSystemCreator == null || defaultInputSystemCreator.Priority > inputSystemCreator.Priority))
|
||||
{
|
||||
SetDefaultCreator<IInputSystemCreator>(inputSystemCreator);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new InvalidOperationException(String.Format("unable to set a default system for creator of type '{0}'", type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -63,5 +63,6 @@ namespace ANX.Framework.NonXNA
|
||||
|
||||
string Name { get; }
|
||||
|
||||
int Priority { get; }
|
||||
}
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ using ANX.Framework.NonXNA.RenderSystem;
|
||||
|
||||
#endregion // License
|
||||
|
||||
namespace ANX.Framework
|
||||
namespace ANX.Framework.NonXNA
|
||||
{
|
||||
public interface IRenderSystemCreator : ICreator
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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")]
|
||||
|
@ -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");
|
||||
|
@ -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")]
|
||||
|
@ -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);
|
||||
|
@ -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")]
|
||||
|
@ -73,6 +73,12 @@ namespace ANX.Framework.Windows.GL3
|
||||
return "OpenGL3";
|
||||
}
|
||||
}
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get { return 100; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region RegisterRenderSystemCreator
|
||||
|
@ -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")]
|
||||
|
@ -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();
|
||||
|
@ -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")]
|
||||
|
@ -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<Texture2D>(@"Textures/chest");
|
||||
ground = Content.Load<Texture2D>(@"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();
|
||||
}
|
||||
|
||||
|
@ -70,5 +70,11 @@ namespace ANX.SoundSystem.Windows.XAudio
|
||||
{
|
||||
get { return "XAudio"; }
|
||||
}
|
||||
|
||||
public int Priority
|
||||
{
|
||||
get { return 10; }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -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")]
|
||||
|
Loading…
x
Reference in New Issue
Block a user