added new target "create_packages" in build script

PreferredBackBufferWidth and PreferredBackBufferHeight are returning values now
added EffectPass handling
applying effects is not a workaround anymore
This commit is contained in:
Glatzemann 2011-11-22 14:51:30 +00:00
parent e473924abc
commit d8d88b141c
29 changed files with 376 additions and 93 deletions

View File

@ -432,6 +432,7 @@
<Compile Include="NonXNA\RenderSystem\INativeSamplerState.cs" /> <Compile Include="NonXNA\RenderSystem\INativeSamplerState.cs" />
<Compile Include="NonXNA\RenderSystem\INativeTexture.cs" /> <Compile Include="NonXNA\RenderSystem\INativeTexture.cs" />
<Compile Include="NonXNA\RenderSystem\INativeTexture2D.cs" /> <Compile Include="NonXNA\RenderSystem\INativeTexture2D.cs" />
<Compile Include="NonXNA\RenderSystem\INativeEffectPass.cs" />
<Compile Include="NonXNA\RenderSystem\PreDefinedShader.cs" /> <Compile Include="NonXNA\RenderSystem\PreDefinedShader.cs" />
<Compile Include="NonXNA\RenderSystem\INativeBlendState.cs" /> <Compile Include="NonXNA\RenderSystem\INativeBlendState.cs" />
<Compile Include="NonXNA\RenderSystem\INativeBuffer.cs" /> <Compile Include="NonXNA\RenderSystem\INativeBuffer.cs" />

View File

@ -76,7 +76,7 @@ namespace ANX.Framework.Graphics
public Effect(GraphicsDevice graphicsDevice, byte[] byteCode) public Effect(GraphicsDevice graphicsDevice, byte[] byteCode)
: base(graphicsDevice) : base(graphicsDevice)
{ {
this.nativeEffect = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateEffect(graphicsDevice, new MemoryStream(byteCode, false)); this.nativeEffect = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateEffect(graphicsDevice, this, new MemoryStream(byteCode, false));
this.techniqueCollection = new EffectTechniqueCollection(this, this.nativeEffect); this.techniqueCollection = new EffectTechniqueCollection(this, this.nativeEffect);
this.currentTechnique = this.techniqueCollection[0]; this.currentTechnique = this.techniqueCollection[0];
@ -89,8 +89,7 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException(); throw new NotImplementedException();
} }
[Obsolete("This is not a original XNA property")] internal INativeEffect NativeEffect
public INativeEffect NativeEffect
{ {
get get
{ {

View File

@ -56,10 +56,21 @@ namespace ANX.Framework.Graphics
{ {
private string name; private string name;
private EffectAnnotationCollection annotations; private EffectAnnotationCollection annotations;
private Effect parentEffect;
internal EffectPass(Effect parentEffect)
{
if (parentEffect == null)
{
throw new ArgumentNullException("parentEffect");
}
this.parentEffect = parentEffect;
}
public void Apply() public void Apply()
{ {
throw new NotImplementedException(); this.parentEffect.NativeEffect.Apply(this.parentEffect.GraphicsDevice);
} }
public string Name public string Name

View File

@ -2,6 +2,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections; using System.Collections;
using ANX.Framework.NonXNA;
#endregion // Using Statements #endregion // Using Statements
@ -56,12 +57,37 @@ namespace ANX.Framework.Graphics
{ {
public sealed class EffectPassCollection : IEnumerable<EffectPass> public sealed class EffectPassCollection : IEnumerable<EffectPass>
{ {
#region Private Members
private Effect parentEffect;
private INativeEffect nativeEffect;
private INativeEffectTechnique parentTechnique;
private List<EffectPass> passes;
#endregion // Private Members
internal EffectPassCollection(Effect parentEffect, INativeEffect nativeEffect, INativeEffectTechnique parentTechnique)
{
this.parentEffect = parentEffect;
this.nativeEffect = nativeEffect;
this.parentTechnique = parentTechnique;
this.passes = new List<EffectPass>();
foreach (EffectPass pass in parentTechnique.Passes)
{
this.passes.Add(pass);
}
}
public EffectPass this[int index] public EffectPass this[int index]
{ {
get get
{ {
throw new NotImplementedException(); if (index >= passes.Count)
{
throw new ArgumentOutOfRangeException("index");
}
return passes[index];
} }
} }
@ -71,28 +97,28 @@ namespace ANX.Framework.Graphics
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
IEnumerator<EffectPass> IEnumerable<EffectPass>.GetEnumerator() IEnumerator<EffectPass> IEnumerable<EffectPass>.GetEnumerator()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
IEnumerator IEnumerable.GetEnumerator() IEnumerator IEnumerable.GetEnumerator()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public List<EffectPass>.Enumerator GetEnumerator() public List<EffectPass>.Enumerator GetEnumerator()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
public int Count public int Count
{ {
get get
{ {
throw new NotImplementedException(); return this.passes.Count;
} }
} }
} }

View File

@ -58,18 +58,23 @@ namespace ANX.Framework.Graphics
{ {
public sealed class EffectTechnique public sealed class EffectTechnique
{ {
private Effect parentEffect;
private INativeEffectTechnique nativeTechnique; private INativeEffectTechnique nativeTechnique;
private EffectPassCollection effectPassCollection;
public INativeEffectTechnique NativeTechnique internal EffectTechnique(Effect parentEffect, INativeEffectTechnique nativeTechnique)
{
this.parentEffect = parentEffect;
this.nativeTechnique = nativeTechnique;
this.effectPassCollection = new EffectPassCollection(parentEffect, parentEffect.NativeEffect, nativeTechnique);
}
internal INativeEffectTechnique NativeTechnique
{ {
get get
{ {
return this.nativeTechnique; return this.nativeTechnique;
} }
set
{
this.nativeTechnique = value;
}
} }
public string Name public string Name
@ -92,7 +97,7 @@ namespace ANX.Framework.Graphics
{ {
get get
{ {
throw new NotImplementedException(); return this.effectPassCollection;
} }
} }
} }

View File

@ -103,6 +103,10 @@ namespace ANX.Framework.Graphics
this.samplerStateCollection = new SamplerStateCollection(this, 8); //TODO: get maximum number of sampler states from capabilities this.samplerStateCollection = new SamplerStateCollection(this, 8); //TODO: get maximum number of sampler states from capabilities
this.textureCollection = new TextureCollection(); this.textureCollection = new TextureCollection();
this.vertexTextureCollection = new TextureCollection(); this.vertexTextureCollection = new TextureCollection();
this.BlendState = BlendState.Opaque;
this.DepthStencilState = DepthStencilState.Default;
this.RasterizerState = RasterizerState.CullCounterClockwise;
} }
~GraphicsDevice() ~GraphicsDevice()
@ -138,6 +142,7 @@ namespace ANX.Framework.Graphics
public void Present(Nullable<Rectangle> sourceRectangle, Nullable<Rectangle> destinationRectangle, IntPtr overrideWindowHandle) public void Present(Nullable<Rectangle> sourceRectangle, Nullable<Rectangle> destinationRectangle, IntPtr overrideWindowHandle)
{ {
//TODO: implement
throw new NotImplementedException(); throw new NotImplementedException();
} }
@ -326,7 +331,13 @@ namespace ANX.Framework.Graphics
public void Dispose() public void Dispose()
{ {
throw new NotImplementedException(); if (this.nativeDevice != null)
{
this.nativeDevice.Dispose();
this.nativeDevice = null;
}
//TODO: more to dispose?
} }
protected virtual void Dispose(Boolean disposeManaged) protected virtual void Dispose(Boolean disposeManaged)
@ -334,7 +345,7 @@ namespace ANX.Framework.Graphics
//TODO: implement //TODO: implement
} }
public INativeGraphicsDevice NativeDevice internal INativeGraphicsDevice NativeDevice
{ {
get get
{ {
@ -342,6 +353,7 @@ namespace ANX.Framework.Graphics
} }
} }
#region Public Properties
public IndexBuffer Indices public IndexBuffer Indices
{ {
get get
@ -452,31 +464,11 @@ namespace ANX.Framework.Graphics
} }
} }
public Rectangle ScissorRectangle
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public DisplayMode DisplayMode public DisplayMode DisplayMode
{ {
get get
{ {
throw new NotImplementedException(); return this.currentAdapter.CurrentDisplayMode;
}
}
public GraphicsDeviceStatus GraphicsDeviceStatus
{
get
{
throw new NotImplementedException();
} }
} }
@ -565,6 +557,28 @@ namespace ANX.Framework.Graphics
} }
} }
#endregion // Public Properties
public Rectangle ScissorRectangle
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public GraphicsDeviceStatus GraphicsDeviceStatus
{
get
{
throw new NotImplementedException();
}
}
public SamplerStateCollection VertexSamplerStates public SamplerStateCollection VertexSamplerStates
{ {
get get

View File

@ -70,6 +70,9 @@ namespace ANX.Framework
public static readonly int DefaultBackBufferWidth = 800; public static readonly int DefaultBackBufferWidth = 800;
public static readonly int DefaultBackBufferHeight = 600; //TODO: this is 480 in the original XNA public static readonly int DefaultBackBufferHeight = 600; //TODO: this is 480 in the original XNA
private int backBufferWidth = DefaultBackBufferWidth;
private int backBufferHeight = DefaultBackBufferHeight;
public event EventHandler<EventArgs> Disposed; public event EventHandler<EventArgs> Disposed;
public event EventHandler<EventArgs> DeviceCreated; public event EventHandler<EventArgs> DeviceCreated;
public event EventHandler<EventArgs> DeviceDisposing; public event EventHandler<EventArgs> DeviceDisposing;
@ -194,7 +197,6 @@ namespace ANX.Framework
{ {
CreateDevice(graphicsDeviceInformation); CreateDevice(graphicsDeviceInformation);
} }
} }
public void ToggleFullScreen() public void ToggleFullScreen()
@ -302,13 +304,19 @@ namespace ANX.Framework
public int PreferredBackBufferWidth public int PreferredBackBufferWidth
{ {
get { throw new NotImplementedException(); } get
{
return this.backBufferHeight;
}
set { throw new NotImplementedException(); } set { throw new NotImplementedException(); }
} }
public int PreferredBackBufferHeight public int PreferredBackBufferHeight
{ {
get { throw new NotImplementedException(); } get
{
return this.backBufferWidth;
}
set { throw new NotImplementedException(); } set { throw new NotImplementedException(); }
} }

View File

@ -0,0 +1,61 @@
#region Using Statements
using System;
using System.Collections.Generic;
using ANX.Framework.Graphics;
#endregion // Using Statements
#region License
//
// This file is part of the ANX.Framework created by the "ANX.Framework developer group".
//
// This file is released under the Ms-PL license.
//
//
//
// Microsoft Public License (Ms-PL)
//
// This license governs use of the accompanying software. If you use the software, you accept this license.
// If you do not accept the license, do not use the software.
//
// 1.Definitions
// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning
// here as under U.S. copyright law.
// A "contribution" is the original software, or any additions or changes to the software.
// A "contributor" is any person that distributes its contribution under this license.
// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
//
// 2.Grant of Rights
// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations
// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to
// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution
// or any derivative works that you create.
// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in
// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed
// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution
// in the software or derivative works of the contribution in the software.
//
// 3.Conditions and Limitations
// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your
// patent license from such contributor to the software ends automatically.
// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution
// notices that are present in the software.
// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including
// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or
// object code form, you may only do so under a license that complies with this license.
// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees,
// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the
// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a
// particular purpose and non-infringement.
#endregion // License
namespace ANX.Framework.NonXNA
{
public interface INativeEffectPass
{
string Name { get; }
}
}

View File

@ -1,5 +1,7 @@
#region Using Statements #region Using Statements
using System; using System;
using System.Collections.Generic;
using ANX.Framework.Graphics;
#endregion // Using Statements #endregion // Using Statements
@ -55,5 +57,7 @@ namespace ANX.Framework.NonXNA
public interface INativeEffectTechnique public interface INativeEffectTechnique
{ {
string Name { get; } string Name { get; }
IEnumerable<EffectPass> Passes { get; }
} }
} }

View File

@ -53,7 +53,7 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.NonXNA namespace ANX.Framework.NonXNA
{ {
public interface INativeGraphicsDevice public interface INativeGraphicsDevice : IDisposable
{ {
void Clear(ref Color color); void Clear(ref Color color);
void Clear(ClearOptions options, Vector4 color, float depth, int stencil); void Clear(ClearOptions options, Vector4 color, float depth, int stencil);

View File

@ -69,8 +69,8 @@ namespace ANX.Framework
INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage); INativeBuffer CreateVertexBuffer(GraphicsDevice graphics, VertexDeclaration vertexDeclaration, int vertexCount, BufferUsage usage);
INativeEffect CreateEffect(GraphicsDevice graphics, Stream byteCode); INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, Stream byteCode);
INativeEffect CreateEffect(GraphicsDevice graphics, Stream vertexShaderByteCode, Stream pixelShaderByteCode); INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, Stream vertexShaderByteCode, Stream pixelShaderByteCode);
INativeBlendState CreateBlendState(); INativeBlendState CreateBlendState();
INativeRasterizerState CreateRasterizerState(); INativeRasterizerState CreateRasterizerState();

View File

@ -31,11 +31,11 @@ using System.Runtime.InteropServices;
// //
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
[assembly: AssemblyVersion("0.4.23.*")] [assembly: AssemblyVersion("0.4.24.*")]
[assembly: AssemblyFileVersion("0.4.23.0")] [assembly: AssemblyFileVersion("0.4.24.0")]
[assembly:InternalsVisibleTo("ANX.Framework.Windows.DX10")] [assembly:InternalsVisibleTo("ANX.Framework.Windows.DX10")]
[assembly:InternalsVisibleTo("ANX.Framework.Windows.DX11.1")] [assembly:InternalsVisibleTo("ANX.RenderSystem.Windows.DX11")]
[assembly:InternalsVisibleTo("ANX.Framework.Windows.GL3")] [assembly:InternalsVisibleTo("ANX.Framework.Windows.GL3")]
[assembly:InternalsVisibleTo("ANX.Framework.Windows.Kinect")] [assembly:InternalsVisibleTo("ANX.Framework.Windows.Kinect")]
[assembly:InternalsVisibleTo("ANX.Framework.Windows.XInput")] [assembly:InternalsVisibleTo("ANX.Framework.Windows.XInput")]

View File

@ -71,6 +71,7 @@
<Compile Include="FormatConverter.cs" /> <Compile Include="FormatConverter.cs" />
<Compile Include="GraphicsDeviceWindowsDX10.cs" /> <Compile Include="GraphicsDeviceWindowsDX10.cs" />
<Compile Include="IndexBuffer_DX10.cs" /> <Compile Include="IndexBuffer_DX10.cs" />
<Compile Include="EffectPass_DX10.cs" />
<Compile Include="NativeMethods.cs" /> <Compile Include="NativeMethods.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RasterizerState_DX10.cs" /> <Compile Include="RasterizerState_DX10.cs" />

View File

@ -88,16 +88,16 @@ namespace ANX.Framework.Windows.DX10
return new VertexBuffer_DX10(graphics, vertexDeclaration, vertexCount, usage); return new VertexBuffer_DX10(graphics, vertexDeclaration, vertexCount, usage);
} }
public INativeEffect CreateEffect(GraphicsDevice graphics, Stream vertexShaderByteCode, Stream pixelShaderByteCode) public INativeEffect CreateEffect(GraphicsDevice graphics, ANX.Framework.Graphics.Effect managedEffect, Stream vertexShaderByteCode, Stream pixelShaderByteCode)
{ {
Effect_DX10 effect = new Effect_DX10(graphics, vertexShaderByteCode, pixelShaderByteCode); Effect_DX10 effect = new Effect_DX10(graphics, managedEffect, vertexShaderByteCode, pixelShaderByteCode);
return effect; return effect;
} }
public INativeEffect CreateEffect(GraphicsDevice graphics, System.IO.Stream byteCode) public INativeEffect CreateEffect(GraphicsDevice graphics, ANX.Framework.Graphics.Effect managedEffect, System.IO.Stream byteCode)
{ {
Effect_DX10 effect = new Effect_DX10(graphics, byteCode); Effect_DX10 effect = new Effect_DX10(graphics, managedEffect, byteCode);
return effect; return effect;
} }

View File

@ -0,0 +1,84 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using SharpDX.Direct3D10;
#endregion // Using Statements
#region License
//
// This file is part of the ANX.Framework created by the "ANX.Framework developer group".
//
// This file is released under the Ms-PL license.
//
//
//
// Microsoft Public License (Ms-PL)
//
// This license governs use of the accompanying software. If you use the software, you accept this license.
// If you do not accept the license, do not use the software.
//
// 1.Definitions
// The terms "reproduce," "reproduction," "derivative works," and "distribution" have the same meaning
// here as under U.S. copyright law.
// A "contribution" is the original software, or any additions or changes to the software.
// A "contributor" is any person that distributes its contribution under this license.
// "Licensed patents" are a contributor's patent claims that read directly on its contribution.
//
// 2.Grant of Rights
// (A) Copyright Grant- Subject to the terms of this license, including the license conditions and limitations
// in section 3, each contributor grants you a non-exclusive, worldwide, royalty-free copyright license to
// reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution
// or any derivative works that you create.
// (B) Patent Grant- Subject to the terms of this license, including the license conditions and limitations in
// section 3, each contributor grants you a non-exclusive, worldwide, royalty-free license under its licensed
// patents to make, have made, use, sell, offer for sale, import, and/or otherwise dispose of its contribution
// in the software or derivative works of the contribution in the software.
//
// 3.Conditions and Limitations
// (A) No Trademark License- This license does not grant you rights to use any contributors' name, logo, or trademarks.
// (B) If you bring a patent claim against any contributor over patents that you claim are infringed by the software, your
// patent license from such contributor to the software ends automatically.
// (C) If you distribute any portion of the software, you must retain all copyright, patent, trademark, and attribution
// notices that are present in the software.
// (D) If you distribute any portion of the software in source code form, you may do so only under this license by including
// a complete copy of this license with your distribution. If you distribute any portion of the software in compiled or
// object code form, you may only do so under a license that complies with this license.
// (E) The software is licensed "as-is." You bear the risk of using it. The contributors give no express warranties, guarantees,
// or conditions. You may have additional consumer rights under your local laws which this license cannot change. To the
// extent permitted under your local laws, the contributors exclude the implied warranties of merchantability, fitness for a
// particular purpose and non-infringement.
#endregion // License
namespace ANX.Framework.Windows.DX10
{
public class EffectPass_DX10 : INativeEffectPass
{
private EffectPass nativePass;
public EffectPass NativePass
{
get
{
return this.nativePass;
}
internal set
{
this.nativePass = value;
}
}
public string Name
{
get
{
return nativePass.Description.Name;
}
}
}
}

View File

@ -60,6 +60,17 @@ namespace ANX.Framework.Windows.DX10
public class EffectTechnique_DX10 : INativeEffectTechnique public class EffectTechnique_DX10 : INativeEffectTechnique
{ {
private EffectTechnique nativeTechnique; private EffectTechnique nativeTechnique;
private ANX.Framework.Graphics.Effect parentEffect;
internal EffectTechnique_DX10(ANX.Framework.Graphics.Effect parentEffect)
{
if (parentEffect == null)
{
throw new ArgumentNullException("parentEffect");
}
this.parentEffect = parentEffect;
}
public EffectTechnique NativeTechnique public EffectTechnique NativeTechnique
{ {
@ -80,5 +91,22 @@ namespace ANX.Framework.Windows.DX10
return nativeTechnique.Description.Name; return nativeTechnique.Description.Name;
} }
} }
public IEnumerable<Graphics.EffectPass> Passes
{
get
{
for (int i = 0; i < nativeTechnique.Description.PassCount; i++)
{
EffectPass_DX10 passDx10 = new EffectPass_DX10();
passDx10.NativePass = nativeTechnique.GetPassByIndex(i);
Graphics.EffectPass pass = new Graphics.EffectPass(this.parentEffect);
yield return pass;
}
}
}
} }
} }

View File

@ -66,12 +66,18 @@ namespace ANX.Framework.Windows.DX10
private ShaderBytecode vertexShaderByteCode; private ShaderBytecode vertexShaderByteCode;
private VertexShader vertexShader; private VertexShader vertexShader;
private PixelShader pixelShader; private PixelShader pixelShader;
private ANX.Framework.Graphics.Effect managedEffect;
private ShaderBytecode effectByteCode; private ShaderBytecode effectByteCode;
private SharpDX.Direct3D10.Effect nativeEffect; private SharpDX.Direct3D10.Effect nativeEffect;
public Effect_DX10(GraphicsDevice device, Stream vertexShaderByteCode, Stream pixelShaderByteCode) public Effect_DX10(GraphicsDevice device, ANX.Framework.Graphics.Effect managedEffect, Stream vertexShaderByteCode, Stream pixelShaderByteCode)
{ {
if (this.managedEffect == null)
{
throw new ArgumentNullException("managedEffect");
}
this.managedEffect = managedEffect;
if (vertexShaderByteCode.CanSeek) if (vertexShaderByteCode.CanSeek)
{ {
vertexShaderByteCode.Seek(0, SeekOrigin.Begin); vertexShaderByteCode.Seek(0, SeekOrigin.Begin);
@ -87,8 +93,14 @@ namespace ANX.Framework.Windows.DX10
this.pixelShader = new PixelShader((SharpDX.Direct3D10.Device)device.NativeDevice, this.pixelShaderByteCode); this.pixelShader = new PixelShader((SharpDX.Direct3D10.Device)device.NativeDevice, this.pixelShaderByteCode);
} }
public Effect_DX10(GraphicsDevice device, Stream effectByteCode) public Effect_DX10(GraphicsDevice device, ANX.Framework.Graphics.Effect managedEffect, Stream effectByteCode)
{ {
if (managedEffect == null)
{
throw new ArgumentNullException("managedEffect");
}
this.managedEffect = managedEffect;
if (effectByteCode.CanSeek) if (effectByteCode.CanSeek)
{ {
effectByteCode.Seek(0, SeekOrigin.Begin); effectByteCode.Seek(0, SeekOrigin.Begin);
@ -213,11 +225,10 @@ namespace ANX.Framework.Windows.DX10
{ {
for (int i = 0; i < nativeEffect.Description.TechniqueCount; i++) for (int i = 0; i < nativeEffect.Description.TechniqueCount; i++)
{ {
EffectTechnique_DX10 teqDx10 = new EffectTechnique_DX10(); EffectTechnique_DX10 teqDx10 = new EffectTechnique_DX10(this.managedEffect);
teqDx10.NativeTechnique = nativeEffect.GetTechniqueByIndex(i); teqDx10.NativeTechnique = nativeEffect.GetTechniqueByIndex(i);
Graphics.EffectTechnique teq = new Graphics.EffectTechnique(); Graphics.EffectTechnique teq = new Graphics.EffectTechnique(this.managedEffect, teqDx10);
teq.NativeTechnique = teqDx10;
yield return teq; yield return teq;
} }

View File

@ -477,5 +477,10 @@ namespace ANX.Framework.Windows.DX10
this.vSyncEnabled = value; this.vSyncEnabled = value;
} }
} }
public void Dispose()
{
//TODO: implement
}
} }
} }

View File

@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.7.3.0")] [assembly: AssemblyVersion("0.7.5.0")]
[assembly: AssemblyFileVersion("0.7.3.0")] [assembly: AssemblyFileVersion("0.7.5.0")]
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")] [assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]

View File

@ -90,15 +90,15 @@ namespace ANX.Framework.Windows.GL3
#endregion #endregion
#region CreateEffect #region CreateEffect
public INativeEffect CreateEffect(GraphicsDevice graphics, Stream byteCode) public INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect, Stream byteCode)
{ {
return new EffectGL3(byteCode); return new EffectGL3(managedEffect, byteCode);
} }
public INativeEffect CreateEffect(GraphicsDevice graphics, public INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect,
Stream vertexShaderByteCode, Stream pixelShaderByteCode) Stream vertexShaderByteCode, Stream pixelShaderByteCode)
{ {
return new EffectGL3(vertexShaderByteCode, pixelShaderByteCode); return new EffectGL3(managedEffect, vertexShaderByteCode, pixelShaderByteCode);
} }
#endregion #endregion

View File

@ -72,6 +72,8 @@ namespace ANX.Framework.Windows.GL3
/// The native shader handle. /// The native shader handle.
/// </summary> /// </summary>
internal int programHandle; internal int programHandle;
private Effect managedEffect;
#endregion #endregion
#region Public #region Public
@ -83,12 +85,9 @@ namespace ANX.Framework.Windows.GL3
List<EffectTechnique> techniques = new List<EffectTechnique>(); List<EffectTechnique> techniques = new List<EffectTechnique>();
// TODO: dummy, fill with actual data. // TODO: dummy, fill with actual data.
techniques.Add(new EffectTechnique() techniques.Add(new EffectTechnique(this.managedEffect, new EffectTechniqueGL3()));
{
NativeTechnique = new EffectTechniqueGL3(),
});
return techniques; return techniques;
} }
} }
#endregion #endregion
@ -137,19 +136,19 @@ namespace ANX.Framework.Windows.GL3
/// </summary> /// </summary>
/// <param name="vertexShaderByteCode">The vertex shader code.</param> /// <param name="vertexShaderByteCode">The vertex shader code.</param>
/// <param name="pixelShaderByteCode">The fragment shader code.</param> /// <param name="pixelShaderByteCode">The fragment shader code.</param>
public EffectGL3(Stream vertexShaderByteCode, public EffectGL3(Effect managedEffect, Stream vertexShaderByteCode, Stream pixelShaderByteCode)
Stream pixelShaderByteCode)
{ {
CreateShader(LoadShaderCode(vertexShaderByteCode), this.managedEffect = managedEffect;
LoadShaderCode(pixelShaderByteCode)); CreateShader(LoadShaderCode(vertexShaderByteCode), LoadShaderCode(pixelShaderByteCode));
} }
/// <summary> /// <summary>
/// Create a new effect instance of one streams. /// Create a new effect instance of one streams.
/// </summary> /// </summary>
/// <param name="byteCode">The byte code of the shader.</param> /// <param name="byteCode">The byte code of the shader.</param>
public EffectGL3(Stream byteCode) public EffectGL3(Effect managedEffect, Stream byteCode)
{ {
this.managedEffect = managedEffect;
string source = LoadShaderCode(byteCode); string source = LoadShaderCode(byteCode);
string[] parts = source.Split(new string[] { FragmentSeparator }, string[] parts = source.Split(new string[] { FragmentSeparator },
StringSplitOptions.RemoveEmptyEntries); StringSplitOptions.RemoveEmptyEntries);

View File

@ -74,5 +74,15 @@ namespace ANX.Framework.Windows.GL3
{ {
} }
#endregion #endregion
}
public System.Collections.Generic.IEnumerable<Graphics.EffectPass> Passes
{
get
{
//TODO: implement
yield return null;
}
}
}
} }

View File

@ -406,5 +406,10 @@ namespace ANX.Framework.Windows.GL3
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
}
public void Dispose()
{
//TODO: implement
}
}
} }

View File

@ -32,7 +32,7 @@ using System.Runtime.InteropServices;
// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern // Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
// übernehmen, indem Sie "*" eingeben: // übernehmen, indem Sie "*" eingeben:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.5.1.0")] [assembly: AssemblyVersion("0.5.2.0")]
[assembly: AssemblyFileVersion("0.5.1.0")] [assembly: AssemblyFileVersion("0.5.2.0")]
[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")] [assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]

View File

@ -8,8 +8,8 @@
<ProjectGuid>{B30DE9C2-0926-46B6-8351-9AF276C472D5}</ProjectGuid> <ProjectGuid>{B30DE9C2-0926-46B6-8351-9AF276C472D5}</ProjectGuid>
<OutputType>Library</OutputType> <OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ANX.RenderSystem.Windows.DX11._1</RootNamespace> <RootNamespace>ANX.RenderSystem.Windows.DX11</RootNamespace>
<AssemblyName>ANX.RenderSystem.Windows.DX11.1</AssemblyName> <AssemblyName>ANX.RenderSystem.Windows.DX11</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion> <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile> <TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment> <FileAlignment>512</FileAlignment>

View File

@ -96,13 +96,13 @@ namespace ANX.RenderSystem.Windows.DX11
return new VertexBuffer_DX11(graphics, vertexDeclaration, vertexCount, usage); return new VertexBuffer_DX11(graphics, vertexDeclaration, vertexCount, usage);
} }
public INativeEffect CreateEffect(GraphicsDevice graphics, Stream vertexShaderByteCode, Stream pixelShaderByteCode) public INativeEffect CreateEffect(GraphicsDevice graphics, Effect effect, Stream vertexShaderByteCode, Stream pixelShaderByteCode)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
//return new Effect_DX11(graphics, vertexShaderByteCode, pixelShaderByteCode); //return new Effect_DX11(graphics, vertexShaderByteCode, pixelShaderByteCode);
} }
public INativeEffect CreateEffect(GraphicsDevice graphics, System.IO.Stream byteCode) public INativeEffect CreateEffect(GraphicsDevice graphics, Effect effect, System.IO.Stream byteCode)
{ {
throw new NotImplementedException(); throw new NotImplementedException();
//return new Effect_DX11(graphics, byteCode); //return new Effect_DX11(graphics, byteCode);

View File

@ -648,5 +648,10 @@ namespace ANX.RenderSystem.Windows.DX11
throw new NotImplementedException(); throw new NotImplementedException();
} }
} }
public void Dispose()
{
//TODO: implement
} }
}
} }

View File

@ -121,7 +121,8 @@ namespace VertexIndexBuffer
{ {
GraphicsDevice.Clear(Color.CornflowerBlue); GraphicsDevice.Clear(Color.CornflowerBlue);
miniTriEffect.NativeEffect.Apply(GraphicsDevice); //TODO: this is not the right way to do that miniTriEffect.CurrentTechnique.Passes[0].Apply();
GraphicsDevice.SetVertexBuffer(vb); GraphicsDevice.SetVertexBuffer(vb);
GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 6); GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 6);

View File

@ -263,6 +263,11 @@
</exec> </exec>
</target> </target>
<target name="create_packages" description="generates all type of packages">
<call target="create_zip_packages" />
<call target="create_msi_packages" />
</target>
<target name="create_zip_packages" description="Generate zip package containing binaries" depends="build"> <target name="create_zip_packages" description="Generate zip package containing binaries" depends="build">
<loadfile file="${project.anx.path}/Properties/AssemblyInfo.cs" property="assembly_version_file" /> <loadfile file="${project.anx.path}/Properties/AssemblyInfo.cs" property="assembly_version_file" />
<regex pattern="AssemblyVersion\(.(?'assembly_version'\d+\.\d+.\d+)" input="${assembly_version_file}" /> <regex pattern="AssemblyVersion\(.(?'assembly_version'\d+\.\d+.\d+)" input="${assembly_version_file}" />
@ -278,7 +283,7 @@
</target> </target>
<target name="create_msi_package" description="Create the installer package" depends="build"> <target name="create_msi_packages" description="Create the installer package" depends="build">
<loadfile file="${project.anx.path}/Properties/AssemblyInfo.cs" property="assembly_version_file" /> <loadfile file="${project.anx.path}/Properties/AssemblyInfo.cs" property="assembly_version_file" />
<regex pattern="AssemblyVersion\(.(?'assembly_version'\d+\.\d+.\d+)" input="${assembly_version_file}" /> <regex pattern="AssemblyVersion\(.(?'assembly_version'\d+\.\d+.\d+)" input="${assembly_version_file}" />
<property name="build.output.installer_package" value="../package/${project.anx.name}-${build.configuration}-${assembly_version}.msi"/> <property name="build.output.installer_package" value="../package/${project.anx.name}-${build.configuration}-${assembly_version}.msi"/>