From 1441ae2704e27a27460629eed29eb4628837a3e1 Mon Sep 17 00:00:00 2001 From: "SND\\AstrorEnales_cp" Date: Mon, 16 Jan 2012 15:03:28 +0000 Subject: [PATCH] Fixed some signatures and added all methods to the INativeEffectParameter interface. - Implemented some of the Get methods in the EffectParameterGL3 --- ANX.Framework/Graphics/BlendState.cs | 3 +- ANX.Framework/Graphics/DepthStencilState.cs | 3 +- ANX.Framework/Graphics/Effect.cs | 3 +- ANX.Framework/Graphics/EffectParameter.cs | 264 ++++++++-------- ANX.Framework/Graphics/GraphicsDevice.cs | 2 +- ANX.Framework/Graphics/GraphicsResource.cs | 3 +- ANX.Framework/Graphics/IndexBuffer.cs | 3 +- ANX.Framework/Graphics/OcclusionQuery.cs | 3 +- ANX.Framework/Graphics/RasterizerState.cs | 3 +- ANX.Framework/Graphics/RenderTarget2D.cs | 3 +- ANX.Framework/Graphics/RenderTargetCube.cs | 3 +- ANX.Framework/Graphics/SamplerState.cs | 3 +- ANX.Framework/Graphics/Texture2D.cs | 3 +- ANX.Framework/Graphics/Texture3D.cs | 3 +- ANX.Framework/Graphics/TextureCube.cs | 3 +- ANX.Framework/Graphics/VertexBuffer.cs | 3 +- ANX.Framework/Graphics/VertexDeclaration.cs | 3 +- ANX.Framework/Net/PacketReader.cs | 10 + ANX.Framework/Net/PacketWriter.cs | 10 + .../RenderSystem/INativeEffectParameter.cs | 60 +++- ANX.Framework/Storage/StorageContainer.cs | 28 +- .../EffectParameter_DX10.cs | 135 +++++++- .../ANX.Framework.Windows.GL3.csproj | 2 + .../EffectParameterGL3.cs | 297 +++++++++++++++--- .../EffectParameter_DX11.cs | 131 +++++++- .../EffectParameter_Metro.cs | 126 +++++++- 26 files changed, 903 insertions(+), 207 deletions(-) diff --git a/ANX.Framework/Graphics/BlendState.cs b/ANX.Framework/Graphics/BlendState.cs index b0c21cf7..ec4caf23 100644 --- a/ANX.Framework/Graphics/BlendState.cs +++ b/ANX.Framework/Graphics/BlendState.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -360,7 +361,7 @@ namespace ANX.Framework.Graphics } } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { base.Dispose(disposeManaged); } diff --git a/ANX.Framework/Graphics/DepthStencilState.cs b/ANX.Framework/Graphics/DepthStencilState.cs index 46013b81..e5e7e44a 100644 --- a/ANX.Framework/Graphics/DepthStencilState.cs +++ b/ANX.Framework/Graphics/DepthStencilState.cs @@ -1,6 +1,7 @@ #region Using Statements using System; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -447,7 +448,7 @@ namespace ANX.Framework.Graphics } } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { base.Dispose(disposeManaged); } diff --git a/ANX.Framework/Graphics/Effect.cs b/ANX.Framework/Graphics/Effect.cs index b92f3037..ce2696c2 100644 --- a/ANX.Framework/Graphics/Effect.cs +++ b/ANX.Framework/Graphics/Effect.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using ANX.Framework.NonXNA; using System.IO; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -169,7 +170,7 @@ namespace ANX.Framework.Graphics } } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/EffectParameter.cs b/ANX.Framework/Graphics/EffectParameter.cs index ae248fa1..b6ad1297 100644 --- a/ANX.Framework/Graphics/EffectParameter.cs +++ b/ANX.Framework/Graphics/EffectParameter.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -57,8 +58,9 @@ using ANX.Framework.NonXNA; namespace ANX.Framework.Graphics { public sealed class EffectParameter - { - private INativeEffectParameter nativeParameter; + { + #region Public + private INativeEffectParameter nativeParameter; public INativeEffectParameter NativeParameter { @@ -70,119 +72,194 @@ namespace ANX.Framework.Graphics { this.nativeParameter = value; } - } + } + public EffectAnnotationCollection Annotations + { + get + { + throw new NotImplementedException(); + } + } - public bool GetValueBoolean() - { - throw new NotImplementedException(); + public int ColumnCount + { + get + { + throw new NotImplementedException(); + } + } + + public EffectParameterCollection Elements + { + get + { + throw new NotImplementedException(); + } + } + + public string Name + { + get + { + return this.NativeParameter.Name; + } + } + + public EffectParameterClass ParameterClass + { + get + { + throw new NotImplementedException(); + } + } + + public EffectParameterType ParameterType + { + get + { + throw new NotImplementedException(); + } + } + + public int RowCount + { + get + { + throw new NotImplementedException(); + } + } + + public string Semantic + { + get + { + throw new NotImplementedException(); + } + } + + public EffectParameterCollection StructureMembers + { + get + { + throw new NotImplementedException(); + } + } + #endregion + + #region GetValue + public bool GetValueBoolean() + { + return nativeParameter.GetValueBoolean(); } public bool[] GetValueBooleanArray(int count) - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueBooleanArray(count); } public int GetValueInt32() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueInt32(); } public Int32[] GetValueInt32Array(int count) { - throw new NotImplementedException(); + return nativeParameter.GetValueInt32Array(count); } public Matrix GetValueMatrix() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueMatrix(); } public Matrix[] GetValueMatrixArray(int count) - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueMatrixArray(count); } public Matrix GetValueMatrixTranspose() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueMatrixTranspose(); } public Matrix[] GetValueMatrixTransposeArray(int count) - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueMatrixTransposeArray(count); } public Quaternion GetValueQuaternion() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueQuaternion(); } public Quaternion[] GetValueQuaternionArray(int count) - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueQuaternionArray(count); } public float GetValueSingle() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueSingle(); } public float[] GetValueSingleArray(int count) - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueSingleArray(count); } public string GetValueString() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueString(); } public Texture2D GetValueTexture2D() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueTexture2D(); } public Texture3D GetValueTexture3D() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueTexture3D(); } public TextureCube GetValueTextureCube() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueTextureCube(); } public Vector2 GetValueVector2() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueVector2(); } public Vector2[] GetValueVector2Array(int count) - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueVector2Array(count); } public Vector3 GetValueVector3() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueVector3(); } public Vector3[] GetValueVector3Array(int count) - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueVector3Array(count); } public Vector4 GetValueVector4() - { - throw new NotImplementedException(); + { + return nativeParameter.GetValueVector4(); } public Vector4[] GetValueVector4Array(int count) { - throw new NotImplementedException(); + return nativeParameter.GetValueVector4Array(count); } + #endregion - public void SetValue(bool value) + #region SetValue + public void SetValue([MarshalAs(UnmanagedType.U1)] bool value) { nativeParameter.SetValue(value); } @@ -203,13 +280,13 @@ namespace ANX.Framework.Graphics } public void SetValue(Matrix value) - { - nativeParameter.SetValue(value); + { + nativeParameter.SetValue(value, false); } public void SetValue(Matrix[] value) { - nativeParameter.SetValue(value); + nativeParameter.SetValue(value, false); } public void SetValue(Quaternion value) @@ -233,8 +310,8 @@ namespace ANX.Framework.Graphics } public void SetValue(string value) - { - throw new NotImplementedException(); + { + nativeParameter.SetValue(value); } public void SetValue(Texture value) @@ -273,85 +350,14 @@ namespace ANX.Framework.Graphics } public void SetValueTranspose(Matrix value) - { - throw new NotImplementedException(); + { + nativeParameter.SetValue(value, true); } public void SetValueTranspose(Matrix[] value) - { - throw new NotImplementedException(); - } - - public EffectAnnotationCollection Annotations - { - get - { - throw new NotImplementedException(); - } - } - - public int ColumnCount - { - get - { - throw new NotImplementedException(); - } - } - - public EffectParameterCollection Elements - { - get - { - throw new NotImplementedException(); - } - } - - public string Name - { - get - { - return this.NativeParameter.Name; - } - } - - public EffectParameterClass ParameterClass - { - get - { - throw new NotImplementedException(); - } - } - - public EffectParameterType ParameterType - { - get - { - throw new NotImplementedException(); - } - } - - public int RowCount - { - get - { - throw new NotImplementedException(); - } - } - - public string Semantic - { - get - { - throw new NotImplementedException(); - } - } - - public EffectParameterCollection StructureMembers - { - get - { - throw new NotImplementedException(); - } - } + { + nativeParameter.SetValue(value, true); + } + #endregion } } diff --git a/ANX.Framework/Graphics/GraphicsDevice.cs b/ANX.Framework/Graphics/GraphicsDevice.cs index 85030956..be1ebab2 100644 --- a/ANX.Framework/Graphics/GraphicsDevice.cs +++ b/ANX.Framework/Graphics/GraphicsDevice.cs @@ -367,7 +367,7 @@ namespace ANX.Framework.Graphics //TODO: more to dispose? } - protected virtual void Dispose(Boolean disposeManaged) + protected virtual void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { //TODO: implement } diff --git a/ANX.Framework/Graphics/GraphicsResource.cs b/ANX.Framework/Graphics/GraphicsResource.cs index 6405abd8..af6ec68e 100644 --- a/ANX.Framework/Graphics/GraphicsResource.cs +++ b/ANX.Framework/Graphics/GraphicsResource.cs @@ -1,6 +1,7 @@ #region Using Statements using System; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -107,7 +108,7 @@ namespace ANX.Framework.Graphics } } - protected virtual void Dispose(Boolean disposeManaged) + protected virtual void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/IndexBuffer.cs b/ANX.Framework/Graphics/IndexBuffer.cs index 25ffd1bc..2bd7d658 100644 --- a/ANX.Framework/Graphics/IndexBuffer.cs +++ b/ANX.Framework/Graphics/IndexBuffer.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -218,7 +219,7 @@ namespace ANX.Framework.Graphics } } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/OcclusionQuery.cs b/ANX.Framework/Graphics/OcclusionQuery.cs index f0d8d150..4ae2a10e 100644 --- a/ANX.Framework/Graphics/OcclusionQuery.cs +++ b/ANX.Framework/Graphics/OcclusionQuery.cs @@ -1,5 +1,6 @@ #region Using Statements using System; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -96,7 +97,7 @@ namespace ANX.Framework.Graphics throw new NotImplementedException(); } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/RasterizerState.cs b/ANX.Framework/Graphics/RasterizerState.cs index aa9e52fc..00fe53e3 100644 --- a/ANX.Framework/Graphics/RasterizerState.cs +++ b/ANX.Framework/Graphics/RasterizerState.cs @@ -1,6 +1,7 @@ #region Using Statements using System; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -229,7 +230,7 @@ namespace ANX.Framework.Graphics } } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { base.Dispose(disposeManaged); } diff --git a/ANX.Framework/Graphics/RenderTarget2D.cs b/ANX.Framework/Graphics/RenderTarget2D.cs index d377f595..de1af774 100644 --- a/ANX.Framework/Graphics/RenderTarget2D.cs +++ b/ANX.Framework/Graphics/RenderTarget2D.cs @@ -6,6 +6,7 @@ using System.Text; using ANX.Framework.NonXNA; using ANX.Framework.Graphics; using ANX.Framework.NonXNA.RenderSystem; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -113,7 +114,7 @@ namespace ANX.Framework.Graphics #endregion // Constructors - protected virtual void Dispose(Boolean disposeManaged) + protected virtual void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/RenderTargetCube.cs b/ANX.Framework/Graphics/RenderTargetCube.cs index e8c6d6c9..84e6c19f 100644 --- a/ANX.Framework/Graphics/RenderTargetCube.cs +++ b/ANX.Framework/Graphics/RenderTargetCube.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Text; using ANX.Framework.NonXNA; using ANX.Framework.Graphics; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -73,7 +74,7 @@ namespace ANX.Framework.Graphics throw new NotImplementedException(); } - protected virtual void Dispose(Boolean disposeManaged) + protected virtual void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/SamplerState.cs b/ANX.Framework/Graphics/SamplerState.cs index f10a37b7..4a53d6d4 100644 --- a/ANX.Framework/Graphics/SamplerState.cs +++ b/ANX.Framework/Graphics/SamplerState.cs @@ -1,6 +1,7 @@ #region Using Statements using System; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -256,7 +257,7 @@ namespace ANX.Framework.Graphics } } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { base.Dispose(disposeManaged); } diff --git a/ANX.Framework/Graphics/Texture2D.cs b/ANX.Framework/Graphics/Texture2D.cs index f7e9aa0f..987d1af9 100644 --- a/ANX.Framework/Graphics/Texture2D.cs +++ b/ANX.Framework/Graphics/Texture2D.cs @@ -3,6 +3,7 @@ using System; using System.IO; using ANX.Framework.NonXNA.RenderSystem; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -148,7 +149,7 @@ namespace ANX.Framework.Graphics base.Dispose(true); } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { base.Dispose(disposeManaged); } diff --git a/ANX.Framework/Graphics/Texture3D.cs b/ANX.Framework/Graphics/Texture3D.cs index 9bc7a7f4..ae1216a5 100644 --- a/ANX.Framework/Graphics/Texture3D.cs +++ b/ANX.Framework/Graphics/Texture3D.cs @@ -1,5 +1,6 @@ #region Using Statements using System; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -95,7 +96,7 @@ namespace ANX.Framework.Graphics throw new NotImplementedException(); } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/TextureCube.cs b/ANX.Framework/Graphics/TextureCube.cs index 8e91c089..3e6ae2cd 100644 --- a/ANX.Framework/Graphics/TextureCube.cs +++ b/ANX.Framework/Graphics/TextureCube.cs @@ -1,5 +1,6 @@ #region Using Statements using System; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -95,7 +96,7 @@ namespace ANX.Framework.Graphics throw new NotImplementedException(); } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/VertexBuffer.cs b/ANX.Framework/Graphics/VertexBuffer.cs index b5f97f4b..60bbc411 100644 --- a/ANX.Framework/Graphics/VertexBuffer.cs +++ b/ANX.Framework/Graphics/VertexBuffer.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; using ANX.Framework.NonXNA; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -219,7 +220,7 @@ namespace ANX.Framework.Graphics } } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Graphics/VertexDeclaration.cs b/ANX.Framework/Graphics/VertexDeclaration.cs index 4534a1eb..aef57d1d 100644 --- a/ANX.Framework/Graphics/VertexDeclaration.cs +++ b/ANX.Framework/Graphics/VertexDeclaration.cs @@ -1,5 +1,6 @@ #region Using Statements using System; +using System.Runtime.InteropServices; #endregion // Using Statements @@ -99,7 +100,7 @@ namespace ANX.Framework.Graphics } } - protected override void Dispose(Boolean disposeManaged) + protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged) { throw new NotImplementedException(); } diff --git a/ANX.Framework/Net/PacketReader.cs b/ANX.Framework/Net/PacketReader.cs index a76e2c6d..8cab82a9 100644 --- a/ANX.Framework/Net/PacketReader.cs +++ b/ANX.Framework/Net/PacketReader.cs @@ -82,6 +82,16 @@ namespace ANX.Framework.Net { } + public float ReadSingle() + { + return ReadSingle(); + } + + public double ReadDouble() + { + return ReadDouble(); + } + public Vector2 ReadVector2() { return new Vector2 diff --git a/ANX.Framework/Net/PacketWriter.cs b/ANX.Framework/Net/PacketWriter.cs index 5ab073d0..166644e1 100644 --- a/ANX.Framework/Net/PacketWriter.cs +++ b/ANX.Framework/Net/PacketWriter.cs @@ -82,6 +82,16 @@ namespace ANX.Framework.Net { } + public void Write(float value) + { + Write(value); + } + + public void Write(double value) + { + Write(value); + } + public void Write(Vector2 value) { Write(value.X); diff --git a/ANX.Framework/NonXNA/RenderSystem/INativeEffectParameter.cs b/ANX.Framework/NonXNA/RenderSystem/INativeEffectParameter.cs index 02a5549c..30d2cc46 100644 --- a/ANX.Framework/NonXNA/RenderSystem/INativeEffectParameter.cs +++ b/ANX.Framework/NonXNA/RenderSystem/INativeEffectParameter.cs @@ -57,7 +57,54 @@ namespace ANX.Framework.NonXNA { string Name { get; } - void SetValue(bool value); + #region GetValue + bool GetValueBoolean(); + + bool[] GetValueBooleanArray(int count); + + int GetValueInt32(); + + int[] GetValueInt32Array(int count); + + Matrix GetValueMatrix(); + + Matrix[] GetValueMatrixArray(int count); + + Matrix GetValueMatrixTranspose(); + + Matrix[] GetValueMatrixTransposeArray(int count); + + Quaternion GetValueQuaternion(); + + Quaternion[] GetValueQuaternionArray(int count); + + float GetValueSingle(); + + float[] GetValueSingleArray(int count); + + string GetValueString(); + + Texture2D GetValueTexture2D(); + + Texture3D GetValueTexture3D(); + + TextureCube GetValueTextureCube(); + + Vector2 GetValueVector2(); + + Vector2[] GetValueVector2Array(int count); + + Vector3 GetValueVector3(); + + Vector3[] GetValueVector3Array(int count); + + Vector4 GetValueVector4(); + + Vector4[] GetValueVector4Array(int count); + #endregion + + #region SetValue + void SetValue(bool value); void SetValue(bool[] value); @@ -65,9 +112,9 @@ namespace ANX.Framework.NonXNA void SetValue(int[] value); - void SetValue(Matrix value); + void SetValue(Matrix value, bool transpose); - void SetValue(Matrix[] value); + void SetValue(Matrix[] value, bool transpose); void SetValue(Quaternion value); @@ -87,8 +134,11 @@ namespace ANX.Framework.NonXNA void SetValue(Vector4 value); - void SetValue(Vector4[] value); + void SetValue(Vector4[] value); + + void SetValue(string value); void SetValue(Texture value); - } + #endregion + } } diff --git a/ANX.Framework/Storage/StorageContainer.cs b/ANX.Framework/Storage/StorageContainer.cs index d94c0795..e445857e 100644 --- a/ANX.Framework/Storage/StorageContainer.cs +++ b/ANX.Framework/Storage/StorageContainer.cs @@ -69,6 +69,11 @@ namespace ANX.Framework.Storage baseDirectory.Create(); //fails silently if directory exists } + ~StorageContainer() + { + Dispose(); + } + /// /// Returns the full path for the given relative path, and makes /// some sanity checks. @@ -116,6 +121,11 @@ namespace ANX.Framework.Storage return File.Exists(GetTestFullPath(file)); } + public string[] GetDirectoryNames() + { + return GetDirectoryNames("*"); + } + public string[] GetDirectoryNames(string searchPattern = "*") { List dirs = new List(); @@ -127,6 +137,11 @@ namespace ANX.Framework.Storage return dirs.ToArray(); } + public string[] GetFileNames() + { + return GetFileNames("*"); + } + public string[] GetFileNames(string searchPattern = "*") { List files = new List(); @@ -138,7 +153,18 @@ namespace ANX.Framework.Storage return files.ToArray(); } - public Stream OpenFile(string file, FileMode fileMode, FileAccess fileAccess = FileAccess.ReadWrite, FileShare fileShare = FileShare.None) + public Stream OpenFile(string file, FileMode fileMode) + { + return OpenFile(file, fileMode, FileAccess.ReadWrite, FileShare.None); + } + + public Stream OpenFile(string file, FileMode fileMode, FileAccess fileAccess) + { + return OpenFile(file, fileMode, fileAccess, FileShare.None); + } + + public Stream OpenFile(string file, FileMode fileMode, + FileAccess fileAccess = FileAccess.ReadWrite, FileShare fileShare = FileShare.None) { return File.Open(GetTestFullPath(file), fileMode, fileAccess, fileShare); } diff --git a/RenderSystems/ANX.Framework.Windows.DX10/EffectParameter_DX10.cs b/RenderSystems/ANX.Framework.Windows.DX10/EffectParameter_DX10.cs index 66b78ad1..15167c4b 100644 --- a/RenderSystems/ANX.Framework.Windows.DX10/EffectParameter_DX10.cs +++ b/RenderSystems/ANX.Framework.Windows.DX10/EffectParameter_DX10.cs @@ -95,14 +95,16 @@ namespace ANX.Framework.Windows.DX10 nativeEffectVariable.AsScalar().Set(value); } - public void SetValue(Matrix value) + public void SetValue(Matrix value, bool transpose) { + // TODO: handle transpose! SharpDX.Matrix m = new SharpDX.Matrix(value.M11, value.M12, value.M13, value.M14, value.M21, value.M22, value.M23, value.M24, value.M31, value.M32, value.M33, value.M34, value.M41, value.M42, value.M43, value.M44); nativeEffectVariable.AsMatrix().SetMatrix(m); } - public void SetValue(Matrix[] value) - { + public void SetValue(Matrix[] value, bool transpose) + { + // TODO: handle transpose! int count = value.Length; SharpDX.Matrix[] m = new SharpDX.Matrix[count]; Matrix anxMatrix; @@ -202,5 +204,130 @@ namespace ANX.Framework.Windows.DX10 return nativeEffectVariable.Description.Name; } } - } + + #region INativeEffectParameter Member + + + public bool GetValueBoolean() + { + throw new NotImplementedException(); + } + + public bool[] GetValueBooleanArray(int count) + { + throw new NotImplementedException(); + } + + public int GetValueInt32() + { + throw new NotImplementedException(); + } + + public int[] GetValueInt32Array(int count) + { + throw new NotImplementedException(); + } + + public Matrix GetValueMatrix() + { + throw new NotImplementedException(); + } + + public Matrix[] GetValueMatrixArray(int count) + { + throw new NotImplementedException(); + } + + public Matrix GetValueMatrixTranspose() + { + throw new NotImplementedException(); + } + + public Matrix[] GetValueMatrixTransposeArray(int count) + { + throw new NotImplementedException(); + } + + public Quaternion GetValueQuaternion() + { + throw new NotImplementedException(); + } + + public Quaternion[] GetValueQuaternionArray(int count) + { + throw new NotImplementedException(); + } + + public float GetValueSingle() + { + throw new NotImplementedException(); + } + + public float[] GetValueSingleArray(int count) + { + throw new NotImplementedException(); + } + + public string GetValueString() + { + throw new NotImplementedException(); + } + + public Graphics.Texture2D GetValueTexture2D() + { + throw new NotImplementedException(); + } + + public Graphics.Texture3D GetValueTexture3D() + { + throw new NotImplementedException(); + } + + public TextureCube GetValueTextureCube() + { + throw new NotImplementedException(); + } + + public Vector2 GetValueVector2() + { + throw new NotImplementedException(); + } + + public Vector2[] GetValueVector2Array(int count) + { + throw new NotImplementedException(); + } + + public Vector3 GetValueVector3() + { + throw new NotImplementedException(); + } + + public Vector3[] GetValueVector3Array(int count) + { + throw new NotImplementedException(); + } + + public Vector4 GetValueVector4() + { + throw new NotImplementedException(); + } + + public Vector4[] GetValueVector4Array(int count) + { + throw new NotImplementedException(); + } + + #endregion + + #region INativeEffectParameter Member + + + public void SetValue(string value) + { + throw new NotImplementedException(); + } + + #endregion + } } diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.Framework.Windows.GL3.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.Framework.Windows.GL3.csproj index 300f3f2c..898e5531 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.Framework.Windows.GL3.csproj +++ b/RenderSystems/ANX.Framework.Windows.GL3/ANX.Framework.Windows.GL3.csproj @@ -23,6 +23,7 @@ 4 x86 Auto + true pdbonly @@ -32,6 +33,7 @@ prompt 4 x86 + true diff --git a/RenderSystems/ANX.Framework.Windows.GL3/EffectParameterGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/EffectParameterGL3.cs index 2935ef7b..fa3a166a 100644 --- a/RenderSystems/ANX.Framework.Windows.GL3/EffectParameterGL3.cs +++ b/RenderSystems/ANX.Framework.Windows.GL3/EffectParameterGL3.cs @@ -94,12 +94,13 @@ namespace ANX.Framework.Windows.GL3 } #endregion + #region SetValue #region SetValue (Matrix) /// /// Set a matrix value to the effect parameter. /// /// Value for the parameter - public void SetValue(Matrix value) + public void SetValue(Matrix value, bool transpose) { GL.UseProgram(parentTechnique.programHandle); ErrorHelper.Check("UseProgram"); @@ -110,7 +111,7 @@ namespace ANX.Framework.Windows.GL3 value.M31, value.M32, value.M33, value.M34, value.M41, value.M42, value.M43, value.M44); - GL.UniformMatrix4(UniformIndex, false, ref matrix); + GL.UniformMatrix4(UniformIndex, transpose, ref matrix); ErrorHelper.Check("UniformMatrix4"); } #endregion @@ -120,7 +121,7 @@ namespace ANX.Framework.Windows.GL3 /// Set a Matrix array value to the effect parameter. /// /// Value for the parameter - public void SetValue(Matrix[] value) + public void SetValue(Matrix[] value, bool transpose) { GL.UseProgram(parentTechnique.programHandle); ErrorHelper.Check("UseProgram"); @@ -144,33 +145,11 @@ namespace ANX.Framework.Windows.GL3 array[(index * 16) + 14] = value[index].M43; array[(index * 16) + 15] = value[index].M44; } - GL.UniformMatrix4(UniformIndex, array.Length, false, array); + GL.UniformMatrix4(UniformIndex, array.Length, transpose, array); ErrorHelper.Check("UniformMatrix4v"); } #endregion - #region SetValue (Quaternion) (TODO) - /// - /// Set a Quaternion value to the effect parameter. - /// - /// Value for the parameter - public void SetValue(Quaternion value) - { - throw new NotImplementedException(); - } - #endregion - - #region SetValue (Quaternion[]) (TODO) - /// - /// Set a Quaternion array value to the effect parameter. - /// - /// Value for the parameter - public void SetValue(Quaternion[] value) - { - throw new NotImplementedException(); - } - #endregion - #region SetValue (Texture) private Texture textureCache = null; /// @@ -198,28 +177,6 @@ namespace ANX.Framework.Windows.GL3 } #endregion - #region SetValue (bool) (TODO) - /// - /// Set a bool value to the effect parameter. - /// - /// Value for the parameter - public void SetValue(bool value) - { - throw new NotImplementedException(); - } - #endregion - - #region SetValue (bool[]) (TODO) - /// - /// Set a bool array value to the effect parameter. - /// - /// Value for the parameter - public void SetValue(bool[] value) - { - throw new NotImplementedException(); - } - #endregion - #region SetValue (int) /// /// Set an int value to the effect parameter. @@ -380,5 +337,249 @@ namespace ANX.Framework.Windows.GL3 ErrorHelper.Check("Uniform4fv"); } #endregion + + #region SetValue (bool) (TODO) + /// + /// Set a bool value to the effect parameter. + /// + /// Value for the parameter + public void SetValue(bool value) + { + throw new NotImplementedException(); + } + #endregion + + #region SetValue (bool[]) (TODO) + /// + /// Set a bool array value to the effect parameter. + /// + /// Value for the parameter + public void SetValue(bool[] value) + { + throw new NotImplementedException(); + } + #endregion + + #region SetValue (Quaternion) (TODO) + /// + /// Set a Quaternion value to the effect parameter. + /// + /// Value for the parameter + public void SetValue(Quaternion value) + { + throw new NotImplementedException(); + } + #endregion + + #region SetValue (Quaternion[]) (TODO) + /// + /// Set a Quaternion array value to the effect parameter. + /// + /// Value for the parameter + public void SetValue(Quaternion[] value) + { + throw new NotImplementedException(); + } + #endregion + + #region SetValue (string, TODO) + public void SetValue(string value) + { + throw new NotImplementedException(); + } + #endregion + #endregion + + #region GetValue + #region GetValueBoolean + public bool GetValueBoolean() + { + int result; + GL.GetUniform(parentTechnique.programHandle, UniformIndex, out result); + ErrorHelper.Check("GetUniform"); + return result == 1; + } + #endregion + + #region GetValueBooleanArray (TODO) + public bool[] GetValueBooleanArray(int count) + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueInt32 + public int GetValueInt32() + { + int result; + GL.GetUniform(parentTechnique.programHandle, UniformIndex, out result); + ErrorHelper.Check("GetUniform"); + return result; + } + #endregion + + #region GetValueInt32Array (TODO) + public int[] GetValueInt32Array(int count) + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueMatrix (TODO) + public Matrix GetValueMatrix() + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueMatrixArray (TODO) + public Matrix[] GetValueMatrixArray(int count) + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueMatrixTranspose (TODO) + public Matrix GetValueMatrixTranspose() + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueMatrixTransposeArray (TODO) + public Matrix[] GetValueMatrixTransposeArray(int count) + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueQuaternion (TODO) + public Quaternion GetValueQuaternion() + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueQuaternionArray (TODO) + public Quaternion[] GetValueQuaternionArray(int count) + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueSingle + public float GetValueSingle() + { + float result; + GL.GetUniform(parentTechnique.programHandle, UniformIndex, out result); + ErrorHelper.Check("GetUniform"); + return result; + } + #endregion + + #region GetValueSingleArray (TODO) + public float[] GetValueSingleArray(int count) + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueString (TODO) + public string GetValueString() + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueTexture2D (TODO) + public Texture2D GetValueTexture2D() + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueTexture3D (TODO) + public Texture3D GetValueTexture3D() + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueTextureCube (TODO) + public TextureCube GetValueTextureCube() + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueVector2 + public Vector2 GetValueVector2() + { + float[] result = new float[2]; + unsafe + { + fixed (float* ptr = &result[0]) + { + GL.GetUniform(parentTechnique.programHandle, UniformIndex, ptr); + } + } + ErrorHelper.Check("GetUniform"); + return new Vector2(result[0], result[1]); + } + #endregion + + #region GetValueVector2Array (TODO) + public Vector2[] GetValueVector2Array(int count) + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueVector3 + public Vector3 GetValueVector3() + { + float[] result = new float[3]; + unsafe + { + fixed (float* ptr = &result[0]) + { + GL.GetUniform(parentTechnique.programHandle, UniformIndex, ptr); + } + } + ErrorHelper.Check("GetUniform"); + return new Vector3(result[0], result[1], result[2]); + } + #endregion + + #region GetValueVector3Array (TODO) + public Vector3[] GetValueVector3Array(int count) + { + throw new NotImplementedException(); + } + #endregion + + #region GetValueVector4 + public Vector4 GetValueVector4() + { + float[] result = new float[4]; + unsafe + { + fixed (float* ptr = &result[0]) + { + GL.GetUniform(parentTechnique.programHandle, UniformIndex, ptr); + } + } + ErrorHelper.Check("GetUniform"); + return new Vector4(result[0], result[1], result[2], result[3]); + } + #endregion + + #region GetValueVector4Array (TODO) + public Vector4[] GetValueVector4Array(int count) + { + throw new NotImplementedException(); + } + #endregion + #endregion } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.DX11/EffectParameter_DX11.cs b/RenderSystems/ANX.RenderSystem.Windows.DX11/EffectParameter_DX11.cs index 24054de2..66385fbf 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.DX11/EffectParameter_DX11.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.DX11/EffectParameter_DX11.cs @@ -96,13 +96,13 @@ namespace ANX.RenderSystem.Windows.DX11 nativeEffectVariable.AsScalar().Set(value); } - public void SetValue(Matrix value) + public void SetValue(Matrix value, bool transpose) { SharpDX.Matrix m = new SharpDX.Matrix(value.M11, value.M12, value.M13, value.M14, value.M21, value.M22, value.M23, value.M24, value.M31, value.M32, value.M33, value.M34, value.M41, value.M42, value.M43, value.M44); nativeEffectVariable.AsMatrix().SetMatrix(m); } - public void SetValue(Matrix[] value) + public void SetValue(Matrix[] value, bool transpose) { int count = value.Length; SharpDX.Matrix[] m = new SharpDX.Matrix[count]; @@ -198,5 +198,130 @@ namespace ANX.RenderSystem.Windows.DX11 return nativeEffectVariable.Description.Name; } } - } + + #region INativeEffectParameter Member + + + public bool GetValueBoolean() + { + throw new NotImplementedException(); + } + + public bool[] GetValueBooleanArray(int count) + { + throw new NotImplementedException(); + } + + public int GetValueInt32() + { + throw new NotImplementedException(); + } + + public int[] GetValueInt32Array(int count) + { + throw new NotImplementedException(); + } + + public Matrix GetValueMatrix() + { + throw new NotImplementedException(); + } + + public Matrix[] GetValueMatrixArray(int count) + { + throw new NotImplementedException(); + } + + public Matrix GetValueMatrixTranspose() + { + throw new NotImplementedException(); + } + + public Matrix[] GetValueMatrixTransposeArray(int count) + { + throw new NotImplementedException(); + } + + public Quaternion GetValueQuaternion() + { + throw new NotImplementedException(); + } + + public Quaternion[] GetValueQuaternionArray(int count) + { + throw new NotImplementedException(); + } + + public float GetValueSingle() + { + throw new NotImplementedException(); + } + + public float[] GetValueSingleArray(int count) + { + throw new NotImplementedException(); + } + + public string GetValueString() + { + throw new NotImplementedException(); + } + + public Framework.Graphics.Texture2D GetValueTexture2D() + { + throw new NotImplementedException(); + } + + public Framework.Graphics.Texture3D GetValueTexture3D() + { + throw new NotImplementedException(); + } + + public TextureCube GetValueTextureCube() + { + throw new NotImplementedException(); + } + + public Vector2 GetValueVector2() + { + throw new NotImplementedException(); + } + + public Vector2[] GetValueVector2Array(int count) + { + throw new NotImplementedException(); + } + + public Vector3 GetValueVector3() + { + throw new NotImplementedException(); + } + + public Vector3[] GetValueVector3Array(int count) + { + throw new NotImplementedException(); + } + + public Vector4 GetValueVector4() + { + throw new NotImplementedException(); + } + + public Vector4[] GetValueVector4Array(int count) + { + throw new NotImplementedException(); + } + + #endregion + + #region INativeEffectParameter Member + + + public void SetValue(string value) + { + throw new NotImplementedException(); + } + + #endregion + } } diff --git a/RenderSystems/ANX.RenderSystem.Windows.Metro/EffectParameter_Metro.cs b/RenderSystems/ANX.RenderSystem.Windows.Metro/EffectParameter_Metro.cs index 66b78ad1..50a50146 100644 --- a/RenderSystems/ANX.RenderSystem.Windows.Metro/EffectParameter_Metro.cs +++ b/RenderSystems/ANX.RenderSystem.Windows.Metro/EffectParameter_Metro.cs @@ -201,6 +201,130 @@ namespace ANX.Framework.Windows.DX10 { return nativeEffectVariable.Description.Name; } - } + } + #region INativeEffectParameter Member + + + public bool GetValueBoolean() + { + throw new NotImplementedException(); + } + + public bool[] GetValueBooleanArray(int count) + { + throw new NotImplementedException(); + } + + public int GetValueInt32() + { + throw new NotImplementedException(); + } + + public int[] GetValueInt32Array(int count) + { + throw new NotImplementedException(); + } + + public Matrix GetValueMatrix() + { + throw new NotImplementedException(); + } + + public Matrix[] GetValueMatrixArray(int count) + { + throw new NotImplementedException(); + } + + public Matrix GetValueMatrixTranspose() + { + throw new NotImplementedException(); + } + + public Matrix[] GetValueMatrixTransposeArray(int count) + { + throw new NotImplementedException(); + } + + public Quaternion GetValueQuaternion() + { + throw new NotImplementedException(); + } + + public Quaternion[] GetValueQuaternionArray(int count) + { + throw new NotImplementedException(); + } + + public float GetValueSingle() + { + throw new NotImplementedException(); + } + + public float[] GetValueSingleArray(int count) + { + throw new NotImplementedException(); + } + + public string GetValueString() + { + throw new NotImplementedException(); + } + + public Graphics.Texture2D GetValueTexture2D() + { + throw new NotImplementedException(); + } + + public Graphics.Texture3D GetValueTexture3D() + { + throw new NotImplementedException(); + } + + public TextureCube GetValueTextureCube() + { + throw new NotImplementedException(); + } + + public Vector2 GetValueVector2() + { + throw new NotImplementedException(); + } + + public Vector2[] GetValueVector2Array(int count) + { + throw new NotImplementedException(); + } + + public Vector3 GetValueVector3() + { + throw new NotImplementedException(); + } + + public Vector3[] GetValueVector3Array(int count) + { + throw new NotImplementedException(); + } + + public Vector4 GetValueVector4() + { + throw new NotImplementedException(); + } + + public Vector4[] GetValueVector4Array(int count) + { + throw new NotImplementedException(); + } + + #endregion + + #region INativeEffectParameter Member + + + public void SetValue(string value) + { + throw new NotImplementedException(); + } + + #endregion } }