Cleanup in many graphics classes, mostly regions, usings and class order, added attributes and implemented some smaller methods

This commit is contained in:
SND\AstrorEnales_cp 2012-09-04 08:31:17 +00:00
parent 28f3010330
commit 7031e5b44e
63 changed files with 1606 additions and 1933 deletions

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,7 +1,6 @@
#region Using Statements
using System;
#endregion // Using Statements
using System.Globalization;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,41 +8,21 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Untested)]
[Developer("AstrorEnales")]
public class DisplayMode
{
public float AspectRatio
{
get;
set;
}
public SurfaceFormat Format
{
get;
set;
}
public int Height
{
get;
set;
}
public Rectangle TitleSafeArea
{
get;
set;
}
public int Width
{
get;
set;
}
public float AspectRatio { get; set; }
public SurfaceFormat Format { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public Rectangle TitleSafeArea { get; set; }
public override string ToString()
{
throw new NotImplementedException();
{
return String.Format(CultureInfo.CurrentCulture, "{{Width:{0} Height:{1} Format:{2} AspectRatio:{3}}}",
Width, Height, Format, AspectRatio);
}
}
}

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
@ -10,7 +7,54 @@ using System;
namespace ANX.Framework.Graphics
{
public sealed class EffectAnnotation
{
{
public int ColumnCount
{
get
{
throw new NotImplementedException();
}
}
public string Name
{
get
{
throw new NotImplementedException();
}
}
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 bool GetValueBoolean()
{
@ -51,54 +95,5 @@ namespace ANX.Framework.Graphics
{
throw new NotImplementedException();
}
public int ColumnCount
{
get
{
throw new NotImplementedException();
}
}
public string Name
{
get
{
throw new NotImplementedException();
}
}
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();
}
}
}
}

View File

@ -1,13 +1,3 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using ANX.Framework.Graphics;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,12 +1,6 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using System.Runtime.InteropServices;
#endregion // Using Statements
using ANX.Framework.NonXNA;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -14,307 +8,308 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics
{
public sealed class EffectParameter
public sealed class EffectParameter
{
private INativeEffectParameter nativeParameter;
#region Public
public INativeEffectParameter NativeParameter
{
#region Public
private INativeEffectParameter nativeParameter;
get
{
return this.nativeParameter;
}
set
{
this.nativeParameter = value;
}
}
public INativeEffectParameter NativeParameter
{
get
{
return this.nativeParameter;
}
set
{
this.nativeParameter = value;
}
}
public EffectAnnotationCollection Annotations
{
get
{
throw new NotImplementedException();
}
}
public EffectAnnotationCollection Annotations
{
get
{
throw new NotImplementedException();
}
}
public int ColumnCount
{
get
{
throw new NotImplementedException();
}
}
public int ColumnCount
{
get
{
throw new NotImplementedException();
}
}
public EffectParameterCollection Elements
{
get
{
throw new NotImplementedException();
}
}
public EffectParameterCollection Elements
{
get
{
throw new NotImplementedException();
}
}
public string Name
{
get
{
return this.NativeParameter.Name;
}
}
public string Name
{
get
{
return this.NativeParameter.Name;
}
}
public EffectParameterClass ParameterClass
{
get
{
throw new NotImplementedException();
}
}
public EffectParameterClass ParameterClass
{
get
{
throw new NotImplementedException();
}
}
public EffectParameterType ParameterType
{
get
{
throw new NotImplementedException();
}
}
public EffectParameterType ParameterType
{
get
{
throw new NotImplementedException();
}
}
public int RowCount
{
get
{
throw new NotImplementedException();
}
}
public int RowCount
{
get
{
throw new NotImplementedException();
}
}
public string Semantic
{
get
{
throw new NotImplementedException();
}
}
public string Semantic
{
get
{
throw new NotImplementedException();
}
}
public EffectParameterCollection StructureMembers
{
get
{
throw new NotImplementedException();
}
}
#endregion
public EffectParameterCollection StructureMembers
{
get
{
throw new NotImplementedException();
}
}
#endregion
#region GetValue
public bool GetValueBoolean()
{
return nativeParameter.GetValueBoolean();
}
#region GetValue
public bool GetValueBoolean()
{
return nativeParameter.GetValueBoolean();
}
public bool[] GetValueBooleanArray(int count)
{
return nativeParameter.GetValueBooleanArray(count);
}
public bool[] GetValueBooleanArray(int count)
{
return nativeParameter.GetValueBooleanArray(count);
}
public int GetValueInt32()
{
return nativeParameter.GetValueInt32();
}
public int GetValueInt32()
{
return nativeParameter.GetValueInt32();
}
public Int32[] GetValueInt32Array(int count)
{
return nativeParameter.GetValueInt32Array(count);
}
public Int32[] GetValueInt32Array(int count)
{
return nativeParameter.GetValueInt32Array(count);
}
public Matrix GetValueMatrix()
{
return nativeParameter.GetValueMatrix();
}
public Matrix GetValueMatrix()
{
return nativeParameter.GetValueMatrix();
}
public Matrix[] GetValueMatrixArray(int count)
{
return nativeParameter.GetValueMatrixArray(count);
}
public Matrix[] GetValueMatrixArray(int count)
{
return nativeParameter.GetValueMatrixArray(count);
}
public Matrix GetValueMatrixTranspose()
{
return nativeParameter.GetValueMatrixTranspose();
}
public Matrix GetValueMatrixTranspose()
{
return nativeParameter.GetValueMatrixTranspose();
}
public Matrix[] GetValueMatrixTransposeArray(int count)
{
return nativeParameter.GetValueMatrixTransposeArray(count);
}
public Matrix[] GetValueMatrixTransposeArray(int count)
{
return nativeParameter.GetValueMatrixTransposeArray(count);
}
public Quaternion GetValueQuaternion()
{
return nativeParameter.GetValueQuaternion();
}
public Quaternion GetValueQuaternion()
{
return nativeParameter.GetValueQuaternion();
}
public Quaternion[] GetValueQuaternionArray(int count)
{
return nativeParameter.GetValueQuaternionArray(count);
}
public Quaternion[] GetValueQuaternionArray(int count)
{
return nativeParameter.GetValueQuaternionArray(count);
}
public float GetValueSingle()
{
return nativeParameter.GetValueSingle();
}
public float GetValueSingle()
{
return nativeParameter.GetValueSingle();
}
public float[] GetValueSingleArray(int count)
{
return nativeParameter.GetValueSingleArray(count);
}
public float[] GetValueSingleArray(int count)
{
return nativeParameter.GetValueSingleArray(count);
}
public string GetValueString()
{
return nativeParameter.GetValueString();
}
public string GetValueString()
{
return nativeParameter.GetValueString();
}
public Texture2D GetValueTexture2D()
{
return nativeParameter.GetValueTexture2D();
}
public Texture2D GetValueTexture2D()
{
return nativeParameter.GetValueTexture2D();
}
public Texture3D GetValueTexture3D()
{
return nativeParameter.GetValueTexture3D();
}
public Texture3D GetValueTexture3D()
{
return nativeParameter.GetValueTexture3D();
}
public TextureCube GetValueTextureCube()
{
return nativeParameter.GetValueTextureCube();
}
public TextureCube GetValueTextureCube()
{
return nativeParameter.GetValueTextureCube();
}
public Vector2 GetValueVector2()
{
return nativeParameter.GetValueVector2();
}
public Vector2 GetValueVector2()
{
return nativeParameter.GetValueVector2();
}
public Vector2[] GetValueVector2Array(int count)
{
return nativeParameter.GetValueVector2Array(count);
}
public Vector2[] GetValueVector2Array(int count)
{
return nativeParameter.GetValueVector2Array(count);
}
public Vector3 GetValueVector3()
{
return nativeParameter.GetValueVector3();
}
public Vector3 GetValueVector3()
{
return nativeParameter.GetValueVector3();
}
public Vector3[] GetValueVector3Array(int count)
{
return nativeParameter.GetValueVector3Array(count);
}
public Vector3[] GetValueVector3Array(int count)
{
return nativeParameter.GetValueVector3Array(count);
}
public Vector4 GetValueVector4()
{
return nativeParameter.GetValueVector4();
}
public Vector4 GetValueVector4()
{
return nativeParameter.GetValueVector4();
}
public Vector4[] GetValueVector4Array(int count)
{
return nativeParameter.GetValueVector4Array(count);
}
#endregion
public Vector4[] GetValueVector4Array(int count)
{
return nativeParameter.GetValueVector4Array(count);
}
#endregion
#region SetValue
public void SetValue([MarshalAs(UnmanagedType.U1)] bool value)
{
nativeParameter.SetValue(value);
}
#region SetValue
public void SetValue([MarshalAs(UnmanagedType.U1)] bool value)
{
nativeParameter.SetValue(value);
}
public void SetValue(bool[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(bool[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(int value)
{
nativeParameter.SetValue(value);
}
public void SetValue(int value)
{
nativeParameter.SetValue(value);
}
public void SetValue(int[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(int[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Matrix value)
{
nativeParameter.SetValue(value, false);
}
public void SetValue(Matrix value)
{
nativeParameter.SetValue(value, false);
}
public void SetValue(Matrix[] value)
{
nativeParameter.SetValue(value, false);
}
public void SetValue(Matrix[] value)
{
nativeParameter.SetValue(value, false);
}
public void SetValue(Quaternion value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Quaternion value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Quaternion[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Quaternion[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(float value)
{
nativeParameter.SetValue(value);
}
public void SetValue(float value)
{
nativeParameter.SetValue(value);
}
public void SetValue(float[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(float[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(string value)
{
nativeParameter.SetValue(value);
}
public void SetValue(string value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Texture value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Texture value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector2 value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector2 value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector2[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector2[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector3 value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector3 value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector3[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector3[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector4 value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector4 value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector4[] value)
{
nativeParameter.SetValue(value);
}
public void SetValue(Vector4[] value)
{
nativeParameter.SetValue(value);
}
public void SetValueTranspose(Matrix value)
{
nativeParameter.SetValue(value, true);
}
public void SetValueTranspose(Matrix value)
{
nativeParameter.SetValue(value, true);
}
public void SetValueTranspose(Matrix[] value)
{
nativeParameter.SetValue(value, true);
}
#endregion
}
public void SetValueTranspose(Matrix[] value)
{
nativeParameter.SetValue(value, true);
}
#endregion
}
}

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
@ -13,14 +10,28 @@ namespace ANX.Framework.Graphics
{
private string name;
private EffectAnnotationCollection annotations;
private Effect parentEffect;
private Effect parentEffect;
public string Name
{
get
{
return this.name;
}
}
public EffectAnnotationCollection Annotations
{
get
{
return this.annotations;
}
}
internal EffectPass(Effect parentEffect)
{
if (parentEffect == null)
{
throw new ArgumentNullException("parentEffect");
}
this.parentEffect = parentEffect;
}
@ -29,21 +40,5 @@ namespace ANX.Framework.Graphics
{
this.parentEffect.NativeEffect.Apply(this.parentEffect.GraphicsDevice);
}
public string Name
{
get
{
return this.name;
}
}
public EffectAnnotationCollection Annotations
{
get
{
return this.annotations;
}
}
}
}

View File

@ -1,12 +1,6 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
@ -17,7 +11,39 @@ namespace ANX.Framework.Graphics
{
private Effect parentEffect;
private INativeEffectTechnique nativeTechnique;
private EffectPassCollection effectPassCollection;
private EffectPassCollection effectPassCollection;
internal INativeEffectTechnique NativeTechnique
{
get
{
return this.nativeTechnique;
}
}
public string Name
{
get
{
return nativeTechnique.Name;
}
}
public EffectAnnotationCollection Annotations
{
get
{
throw new NotImplementedException();
}
}
public EffectPassCollection Passes
{
get
{
return this.effectPassCollection;
}
}
internal EffectTechnique(Effect parentEffect, INativeEffectTechnique nativeTechnique)
{
@ -25,37 +51,5 @@ namespace ANX.Framework.Graphics
this.nativeTechnique = nativeTechnique;
this.effectPassCollection = new EffectPassCollection(parentEffect, parentEffect.NativeEffect, nativeTechnique);
}
internal INativeEffectTechnique NativeTechnique
{
get
{
return this.nativeTechnique;
}
}
public string Name
{
get
{
return nativeTechnique.Name;
}
}
public EffectAnnotationCollection Annotations
{
get
{
throw new NotImplementedException();
}
}
public EffectPassCollection Passes
{
get
{
return this.effectPassCollection;
}
}
}
}

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,13 +1,9 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel;
using System.Linq;
using ANX.Framework.NonXNA;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
@ -16,124 +12,67 @@ namespace ANX.Framework.Graphics
{
public sealed class GraphicsAdapter
{
private static List<GraphicsAdapter> adapters;
private DisplayModeCollection supportedDisplayModes;
public static ReadOnlyCollection<GraphicsAdapter> Adapters
{
get;
private set;
}
public static GraphicsAdapter DefaultAdapter
{
get
{
return Adapters.Where(a => a.IsDefaultAdapter).First<GraphicsAdapter>();
}
}
public static bool UseNullDevice { get; set; }
public static bool UseReferenceDevice { get; set; }
public int DeviceId { get; set; }
public string DeviceName { get; set; }
public bool IsDefaultAdapter { get; set; }
public int Revision { get; set; }
public int SubSystemId { get; set; }
public int VendorId { get; set; }
public DisplayMode CurrentDisplayMode
{
get
{
throw new NotImplementedException();
}
}
public string Description
{
get
{
throw new NotImplementedException();
}
}
public bool IsWideScreen
{
get
{
throw new NotImplementedException();
}
}
public IntPtr MonitorHandle
{
get
{
throw new NotImplementedException();
}
}
public DisplayModeCollection SupportedDisplayModes { get; set; }
static GraphicsAdapter()
{
adapters = new List<GraphicsAdapter>();
IRenderSystemCreator renderSystemCreator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
adapters.AddRange(renderSystemCreator.GetAdapterList());
}
public static ReadOnlyCollection<GraphicsAdapter> Adapters
{
get
{
return new ReadOnlyCollection<GraphicsAdapter>(adapters);
}
}
public static GraphicsAdapter DefaultAdapter
{
get
{
GraphicsAdapter defaultAdapter = adapters.Where(a => a.IsDefaultAdapter).First<GraphicsAdapter>();
return defaultAdapter;
}
}
public static bool UseNullDevice
{
get;
set;
}
public static bool UseReferenceDevice
{
get;
set;
}
public DisplayMode CurrentDisplayMode
{
get
{
throw new NotImplementedException();
}
}
public string Description
{
get
{
throw new NotImplementedException();
}
}
public int DeviceId
{
get;
set;
}
public string DeviceName
{
get;
set;
}
public bool IsDefaultAdapter
{
get;
set;
}
public bool IsWideScreen
{
get
{
throw new NotImplementedException();
}
}
public IntPtr MonitorHandle
{
get
{
throw new NotImplementedException();
}
}
public int Revision
{
get;
set;
}
public int SubSystemId
{
get;
set;
}
public DisplayModeCollection SupportedDisplayModes
{
get
{
return this.supportedDisplayModes;
}
set
{
this.supportedDisplayModes = value;
}
}
public int VendorId
{
get;
set;
{
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
Adapters = new ReadOnlyCollection<GraphicsAdapter>(creator.GetAdapterList());
}
public bool IsProfileSupported(GraphicsProfile graphicsProfile)
@ -141,15 +80,18 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException();
}
public bool QueryBackBufferFormat(GraphicsProfile graphicsProfile, SurfaceFormat format, DepthFormat depthFormat, int multiSampleCount, out SurfaceFormat selectedFormat, out DepthFormat selectedDepthFormat, out int selectedMultiSampleCount)
public bool QueryBackBufferFormat(GraphicsProfile graphicsProfile, SurfaceFormat format, DepthFormat depthFormat,
int multiSampleCount, out SurfaceFormat selectedFormat, out DepthFormat selectedDepthFormat,
out int selectedMultiSampleCount)
{
throw new NotImplementedException();
}
public bool QueryRenderTargetFormat(GraphicsProfile graphicsProfile, SurfaceFormat format, DepthFormat depthFormat, int multiSampleCount, out SurfaceFormat selectedFormat, out DepthFormat selectedDepthFormat, out int selectedMultiSampleCount)
public bool QueryRenderTargetFormat(GraphicsProfile graphicsProfile, SurfaceFormat format, DepthFormat depthFormat,
int multiSampleCount, out SurfaceFormat selectedFormat, out DepthFormat selectedDepthFormat,
out int selectedMultiSampleCount)
{
throw new NotImplementedException();
}
}
}

View File

@ -1,11 +1,3 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,7 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,12 +7,13 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Tested)]
internal interface IDynamicGraphicsResource
{
{
bool IsContentLost { get; }
event EventHandler<EventArgs> ContentLost;
void SetContentLost(bool isContentLost);
bool IsContentLost { get; }
}
}

View File

@ -1,9 +1,5 @@
#region Using Statements
using System;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
@ -16,11 +12,8 @@ namespace ANX.Framework.Graphics
public interface IEffectFog
{
Vector3 FogColor { get; set; }
bool FogEnabled { get; set; }
float FogEnd { get; set; }
float FogStart { get; set; }
}
}

View File

@ -1,9 +1,5 @@
#region Using Statements
using System;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
@ -15,16 +11,12 @@ namespace ANX.Framework.Graphics
[Developer("Glatzemann")]
public interface IEffectLights
{
void EnableDefaultLighting();
Vector3 AmbientLightColor { get; set; }
DirectionalLight DirectionalLight0 { get; }
DirectionalLight DirectionalLight1 { get; }
DirectionalLight DirectionalLight2 { get; }
bool LightingEnabled { get; set; }
void EnableDefaultLighting();
}
}

View File

@ -1,9 +1,5 @@
#region Using Statements
using System;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
@ -16,9 +12,7 @@ namespace ANX.Framework.Graphics
public interface IEffectMatrices
{
Matrix Projection { get; set; }
Matrix View { get; set; }
Matrix World { get; set; }
}
}

View File

@ -1,13 +1,6 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,9 +1,5 @@
#region Using Statements
using System;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,20 +1,16 @@
#region Using Statements
using System;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Tested)]
[Developer("Glatzemann")]
public interface IVertexType
{
VertexDeclaration VertexDeclaration { get; }
}
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Tested)]
[Developer("Glatzemann")]
public interface IVertexType
{
VertexDeclaration VertexDeclaration { get; }
}
}

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,7 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,85 +7,85 @@ using System;
namespace ANX.Framework.Graphics
{
public sealed class ModelMeshPart
{
internal ModelMesh parentMesh;
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Untested)]
public sealed class ModelMeshPart
{
#region Private
internal ModelMesh parentMesh;
private Effect effect;
private IndexBuffer indexBuffer;
private int numVertices;
private int primitiveCount;
private int startIndex;
private Object tag;
private VertexBuffer vertexBuffer;
private int vertexOffset;
#endregion
private Effect effect;
#region Public
public Effect Effect
{
get { return effect; }
set
{
if (this.effect != value)
{
var old = this.effect;
this.effect = value;
this.parentMesh.EffectChangedOnMeshPart(this, old, value);
}
}
}
public Effect Effect
{
get { return effect; }
set
{
if (this.effect != value)
{
var old = this.effect;
this.effect = value;
this.parentMesh.EffectChangedOnMeshPart(this, old, value);
}
}
}
public IndexBuffer IndexBuffer
{
get { return indexBuffer; }
internal set { this.indexBuffer = value; }
}
private IndexBuffer indexBuffer;
public int NumVertices
{
get { return numVertices; }
}
public IndexBuffer IndexBuffer
{
get { return indexBuffer; }
internal set { this.indexBuffer = value; }
}
public int PrimitiveCount
{
get { return primitiveCount; }
}
private int numVertices;
public int StartIndex
{
get { return startIndex; }
}
public int NumVertices
{
get { return numVertices; }
}
public Object Tag
{
get { return tag; }
set { tag = value; }
}
private int primitiveCount;
public int PrimitiveCount
{
get { return primitiveCount; }
}
public VertexBuffer VertexBuffer
{
get { return vertexBuffer; }
internal set { this.vertexBuffer = value; }
}
private int startIndex;
public int StartIndex
{
get { return startIndex; }
}
public int VertexOffset
{
get { return vertexOffset; }
}
#endregion
private Object tag;
public Object Tag
{
get { return tag; }
set { tag = value; }
}
private VertexBuffer vertexBuffer;
public VertexBuffer VertexBuffer
{
get { return vertexBuffer; }
internal set { this.vertexBuffer = value; }
}
private int vertexOffset;
public int VertexOffset
{
get { return vertexOffset; }
}
internal ModelMeshPart(int vertexOffset, int numVertices, int startIndex, int primitiveCount, object tag)
{
this.vertexOffset = vertexOffset;
this.numVertices = numVertices;
this.startIndex = startIndex;
this.primitiveCount = primitiveCount;
this.tag = tag;
}
}
internal ModelMeshPart(int vertexOffset, int numVertices, int startIndex, int primitiveCount, object tag)
{
this.vertexOffset = vertexOffset;
this.numVertices = numVertices;
this.startIndex = startIndex;
this.primitiveCount = primitiveCount;
this.tag = tag;
}
}
}

View File

@ -1,10 +1,8 @@
#region Using Statements
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Collections;
#endregion // Using Statements
using System.Collections.Generic;
using System.Collections.ObjectModel;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -12,6 +10,8 @@ using System.Collections;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Untested)]
public sealed class ModelMeshPartCollection : ReadOnlyCollection<ModelMeshPart>
{
private ModelMeshPart[] modelMeshParts;
@ -30,7 +30,23 @@ namespace ANX.Framework.Graphics
public struct Enumerator : IEnumerator<ModelMeshPart>, IDisposable, IEnumerator
{
private ModelMeshPart[] wrappedArray;
private int position;
private int position;
public ModelMeshPart Current
{
get
{
return this.wrappedArray[this.position];
}
}
object IEnumerator.Current
{
get
{
return this.Current;
}
}
internal Enumerator(ModelMeshPart[] wrappedArray)
{
@ -38,14 +54,6 @@ namespace ANX.Framework.Graphics
this.position = -1;
}
public ModelMeshPart Current
{
get
{
return this.wrappedArray[this.position];
}
}
public bool MoveNext()
{
this.position++;
@ -65,14 +73,6 @@ namespace ANX.Framework.Graphics
public void Dispose()
{
}
object IEnumerator.Current
{
get
{
return this.Current;
}
}
}
}
}

View File

@ -1,12 +1,5 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using ANX.Framework.Graphics;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -14,6 +7,7 @@ using ANX.Framework.Graphics;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
public sealed class NoSuitableGraphicsDeviceException : Exception
{
public NoSuitableGraphicsDeviceException()

View File

@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
using ANX.Framework.NonXNA.RenderSystem;
// This file is part of the ANX.Framework created by the
@ -9,6 +10,9 @@ using ANX.Framework.NonXNA.RenderSystem;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Untested)]
[Developer("AstrorEnales")]
public class OcclusionQuery : GraphicsResource, IGraphicsResource
{
#region Private

View File

@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -8,8 +9,15 @@ using ANX.Framework.NonXNA;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
public class RasterizerState : GraphicsResource
{
#region Constants
public static readonly RasterizerState CullClockwise;
public static readonly RasterizerState CullCounterClockwise;
public static readonly RasterizerState CullNone;
#endregion
#region Private
private INativeRasterizerState nativeRasterizerState;
@ -19,15 +27,9 @@ namespace ANX.Framework.Graphics
private bool multiSampleAntiAlias;
private bool scissorTestEnable;
private float slopeScaleDepthBias;
#endregion
#region Public
public static readonly RasterizerState CullClockwise;
public static readonly RasterizerState CullCounterClockwise;
public static readonly RasterizerState CullNone;
#region NativeRasterizerState
internal INativeRasterizerState NativeRasterizerState
{
get
@ -35,9 +37,7 @@ namespace ANX.Framework.Graphics
return this.nativeRasterizerState;
}
}
#endregion
#region CullMode
public CullMode CullMode
{
get
@ -46,15 +46,12 @@ namespace ANX.Framework.Graphics
}
set
{
ValidateSetProperty();
ThrowIfBound();
this.cullMode = value;
this.nativeRasterizerState.CullMode = value;
}
}
#endregion
#region DepthBias
public float DepthBias
{
get
@ -63,15 +60,12 @@ namespace ANX.Framework.Graphics
}
set
{
ValidateSetProperty();
ThrowIfBound();
this.depthBias = value;
this.nativeRasterizerState.DepthBias = value;
}
}
#endregion
#region FillMode
public FillMode FillMode
{
get
@ -80,15 +74,12 @@ namespace ANX.Framework.Graphics
}
set
{
ValidateSetProperty();
ThrowIfBound();
this.fillMode = value;
this.nativeRasterizerState.FillMode = value;
}
}
#endregion
#region MultiSampleAntiAlias
public bool MultiSampleAntiAlias
{
get
@ -97,15 +88,12 @@ namespace ANX.Framework.Graphics
}
set
{
ValidateSetProperty();
ThrowIfBound();
this.multiSampleAntiAlias = value;
this.nativeRasterizerState.MultiSampleAntiAlias = value;
}
}
#endregion
#region SlopeScaleDepthBias
public bool ScissorTestEnable
{
get
@ -114,15 +102,12 @@ namespace ANX.Framework.Graphics
}
set
{
ValidateSetProperty();
ThrowIfBound();
this.scissorTestEnable = value;
this.nativeRasterizerState.ScissorTestEnable = value;
}
}
#endregion
#region SlopeScaleDepthBias
public float SlopeScaleDepthBias
{
get
@ -131,21 +116,18 @@ namespace ANX.Framework.Graphics
}
set
{
ValidateSetProperty();
ThrowIfBound();
this.slopeScaleDepthBias = value;
this.nativeRasterizerState.SlopeScaleDepthBias = value;
}
}
#endregion
#endregion
#region Constructor
public RasterizerState()
{
this.nativeRasterizerState =
AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>()
.CreateRasterizerState();
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
this.nativeRasterizerState = creator.CreateRasterizerState();
this.CullMode = CullMode.CullCounterClockwiseFace;
this.DepthBias = 0f;
@ -157,9 +139,8 @@ namespace ANX.Framework.Graphics
private RasterizerState(CullMode cullMode, string name)
{
this.nativeRasterizerState =
AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>()
.CreateRasterizerState();
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
this.nativeRasterizerState = creator.CreateRasterizerState();
this.CullMode = cullMode;
this.DepthBias = 0f;
@ -167,29 +148,23 @@ namespace ANX.Framework.Graphics
this.MultiSampleAntiAlias = true;
this.ScissorTestEnable = false;
this.SlopeScaleDepthBias = 0f;
Name = name;
}
static RasterizerState()
{
CullClockwise = new RasterizerState(CullMode.CullClockwiseFace,
"RasterizerState.CullClockwise");
CullCounterClockwise = new RasterizerState(CullMode.CullCounterClockwiseFace,
"RasterizerState.CullCounterClockwise");
CullClockwise = new RasterizerState(CullMode.CullClockwiseFace, "RasterizerState.CullClockwise");
CullCounterClockwise = new RasterizerState(CullMode.CullCounterClockwiseFace, "RasterizerState.CullCounterClockwise");
CullNone = new RasterizerState(CullMode.None, "RasterizerState.CullNone");
}
#endregion
#region ValidateSetProperty (private helper)
private void ValidateSetProperty()
#region ThrowIfBound
private void ThrowIfBound()
{
if (this.nativeRasterizerState.IsBound)
{
throw new InvalidOperationException(
"You are not allowed to change RasterizerState properties " +
throw new InvalidOperationException("You are not allowed to change RasterizerState properties " +
"while it is bound to the GraphicsDevice.");
}
}
#endregion

View File

@ -1,15 +1,7 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA.RenderSystem;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
#endregion // Using Statements
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.RenderSystem;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -17,123 +9,126 @@ using System.Runtime.CompilerServices;
namespace ANX.Framework.Graphics
{
public class RenderTarget2D : Texture2D, IDynamicGraphicsResource
{
public event EventHandler<EventArgs> ContentLost;
public class RenderTarget2D : Texture2D, IDynamicGraphicsResource
{
public event EventHandler<EventArgs> ContentLost;
#region Private Members
private DepthFormat depthStencilFormat;
private int multiSampleCount;
private RenderTargetUsage usage;
private bool isContentLost;
private INativeRenderTarget2D nativeRenderTarget;
#region Private
private DepthFormat depthStencilFormat;
private int multiSampleCount;
private RenderTargetUsage usage;
private bool isContentLost;
private INativeRenderTarget2D nativeRenderTarget;
#endregion
#endregion // Private Members
internal INativeRenderTarget2D NativeRenderTarget
{
get
{
return this.nativeRenderTarget;
}
}
#region Constructors
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height)
: base(graphicsDevice)
{
this.width = width;
this.height = height;
public DepthFormat DepthStencilFormat
{
get
{
return this.depthStencilFormat;
}
}
base.levelCount = 1;
base.format = SurfaceFormat.Color;
public bool IsContentLost
{
get
{
return this.isContentLost;
}
}
this.depthStencilFormat = DepthFormat.None;
this.multiSampleCount = 0;
this.usage = RenderTargetUsage.DiscardContents;
public int MultiSampleCount
{
get
{
return this.multiSampleCount;
}
}
this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage);
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
}
public RenderTargetUsage RenderTargetUsage
{
get
{
return this.usage;
}
}
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)
: base(graphicsDevice)
{
this.depthStencilFormat = DepthFormat.None;
this.multiSampleCount = 0;
this.usage = RenderTargetUsage.DiscardContents;
#region Constructor
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height)
: base(graphicsDevice)
{
this.width = width;
this.height = height;
this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage);
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
}
base.levelCount = 1;
base.format = SurfaceFormat.Color;
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
: base(graphicsDevice)
{
this.depthStencilFormat = preferredDepthFormat;
this.multiSampleCount = preferredMultiSampleCount;
this.usage = usage;
this.depthStencilFormat = DepthFormat.None;
this.multiSampleCount = 0;
this.usage = RenderTargetUsage.DiscardContents;
this.nativeRenderTarget = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color, this.depthStencilFormat, this.multiSampleCount, this.usage);
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
}
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
this.nativeRenderTarget = creator.CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color,
this.depthStencilFormat, this.multiSampleCount, this.usage);
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
}
#endregion // Constructors
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)
: base(graphicsDevice)
{
this.depthStencilFormat = DepthFormat.None;
this.multiSampleCount = 0;
this.usage = RenderTargetUsage.DiscardContents;
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
this.nativeRenderTarget = creator.CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color,
this.depthStencilFormat, this.multiSampleCount, this.usage);
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
}
internal INativeRenderTarget2D NativeRenderTarget
{
get
{
return this.nativeRenderTarget;
}
}
public RenderTarget2D(GraphicsDevice graphicsDevice, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat,
int preferredMultiSampleCount, RenderTargetUsage usage)
: base(graphicsDevice)
{
this.depthStencilFormat = preferredDepthFormat;
this.multiSampleCount = preferredMultiSampleCount;
this.usage = usage;
public DepthFormat DepthStencilFormat
{
get
{
return this.depthStencilFormat;
}
}
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
this.nativeRenderTarget = creator.CreateRenderTarget(graphicsDevice, width, height, false, SurfaceFormat.Color,
this.depthStencilFormat, this.multiSampleCount, this.usage);
base.nativeTexture = this.nativeRenderTarget as INativeTexture2D;
}
#endregion
public bool IsContentLost
{
get
{
return this.isContentLost;
}
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
public int MultiSampleCount
{
get
{
return this.multiSampleCount;
}
}
void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
{
this.isContentLost = isContentLost;
if (isContentLost)
raise_ContentLost(this, EventArgs.Empty);
public RenderTargetUsage RenderTargetUsage
{
get
{
return this.usage;
}
}
throw new NotImplementedException();
}
void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
{
this.isContentLost = isContentLost;
if (isContentLost)
{
raise_ContentLost(this, EventArgs.Empty);
}
throw new NotImplementedException();
}
protected void raise_ContentLost(object sender, EventArgs args)
{
if (ContentLost != null)
{
ContentLost(sender, args);
}
}
}
protected void raise_ContentLost(object sender, EventArgs args)
{
if (ContentLost != null)
ContentLost(sender, args);
}
}
}

View File

@ -1,7 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,12 +7,31 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
public struct RenderTargetBinding
{
#region Private Members
#region Private
private Texture renderTarget;
private CubeMapFace cubeMapFace;
#endregion // Private Members
#endregion
#region Public
public Texture RenderTarget
{
get
{
return this.renderTarget;
}
}
public CubeMapFace CubeMapFace
{
get
{
return this.cubeMapFace;
}
}
#endregion
public RenderTargetBinding(RenderTarget2D renderTarget)
{
@ -32,21 +49,5 @@ namespace ANX.Framework.Graphics
{
return new RenderTargetBinding(renderTarget);
}
public Texture RenderTarget
{
get
{
return this.renderTarget;
}
}
public CubeMapFace CubeMapFace
{
get
{
return this.cubeMapFace;
}
}
}
}

View File

@ -1,13 +1,6 @@
#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA;
using ANX.Framework.Graphics;
using System.Runtime.InteropServices;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -15,70 +8,72 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics
{
public class RenderTargetCube : TextureCube, IDynamicGraphicsResource
{
public event EventHandler<EventArgs> ContentLost;
[PercentageComplete(0)]
public class RenderTargetCube : TextureCube, IDynamicGraphicsResource
{
public event EventHandler<EventArgs> ContentLost;
public RenderTargetCube(GraphicsDevice graphicsDevice, int size, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)
: base(graphicsDevice, size, mipMap, preferredFormat)
{
throw new NotImplementedException();
}
public DepthFormat DepthStencilFormat
{
get
{
throw new NotImplementedException();
}
}
public RenderTargetCube(GraphicsDevice graphicsDevice, int size, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount, RenderTargetUsage usage)
: base(graphicsDevice, size, mipMap, preferredFormat)
{
throw new NotImplementedException();
}
public bool IsContentLost
{
get
{
throw new NotImplementedException();
}
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
public int MultiSampleCount
{
get
{
throw new NotImplementedException();
}
}
public DepthFormat DepthStencilFormat
{
get
{
throw new NotImplementedException();
}
}
public RenderTargetUsage RenderTargetUsage
{
get
{
throw new NotImplementedException();
}
}
public bool IsContentLost
{
get
{
throw new NotImplementedException();
}
}
public RenderTargetCube(GraphicsDevice graphicsDevice, int size, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap,
SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat)
: base(graphicsDevice, size, mipMap, preferredFormat)
{
throw new NotImplementedException();
}
public int MultiSampleCount
{
get
{
throw new NotImplementedException();
}
}
public RenderTargetCube(GraphicsDevice graphicsDevice, int size, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap,
SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat, int preferredMultiSampleCount,
RenderTargetUsage usage)
: base(graphicsDevice, size, mipMap, preferredFormat)
{
throw new NotImplementedException();
}
public RenderTargetUsage RenderTargetUsage
{
get
{
throw new NotImplementedException();
}
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
{
throw new NotImplementedException();
}
void IDynamicGraphicsResource.SetContentLost(bool isContentLost)
{
throw new NotImplementedException();
}
protected void raise_ContentLost(object sender, EventArgs args)
{
if (ContentLost != null)
{
ContentLost(sender, args);
}
}
}
protected void raise_ContentLost(object sender, EventArgs args)
{
if (ContentLost != null)
ContentLost(sender, args);
}
}
}

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,7 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,17 +7,14 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
public sealed class ResourceCreatedEventArgs : EventArgs
{
{
public object Resource { get; set; }
public ResourceCreatedEventArgs(object resource)
{
this.Resource = resource;
}
public object Resource
{
get;
set;
}
}
}

View File

@ -1,7 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,24 +7,16 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
public sealed class ResourceDestroyedEventArgs : EventArgs
{
{
public string Name { get; set; }
public object Tag { get; set; }
public ResourceDestroyedEventArgs(string name, object tag)
{
this.Tag = tag;
this.Name = name;
}
public string Name
{
get;
set;
}
public object Tag
{
get;
set;
}
}
}

View File

@ -1,9 +1,7 @@
#region Using Statements
using System;
using ANX.Framework.NonXNA;
using System.Runtime.InteropServices;
#endregion // Using Statements
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -11,212 +9,208 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics
{
public class SamplerState : GraphicsResource
{
#region Private Members
private INativeSamplerState nativeSamplerState;
[PercentageComplete(100)]
public class SamplerState : GraphicsResource
{
#region Constants
public static readonly SamplerState AnisotropicClamp;
public static readonly SamplerState AnisotropicWrap;
public static readonly SamplerState LinearClamp;
public static readonly SamplerState LinearWrap;
public static readonly SamplerState PointClamp;
public static readonly SamplerState PointWrap;
#endregion
private TextureAddressMode addressU;
private TextureAddressMode addressV;
private TextureAddressMode addressW;
private TextureFilter filter;
private int maxAnisotropy;
private int maxMipLevel;
private float mipMapLevelOfDetailBias;
#region Private
private INativeSamplerState nativeSamplerState;
#endregion // Private Members
private TextureAddressMode addressU;
private TextureAddressMode addressV;
private TextureAddressMode addressW;
private TextureFilter filter;
private int maxAnisotropy;
private int maxMipLevel;
private float mipMapLevelOfDetailBias;
#endregion
public static readonly SamplerState AnisotropicClamp;
public static readonly SamplerState AnisotropicWrap;
public static readonly SamplerState LinearClamp;
public static readonly SamplerState LinearWrap;
public static readonly SamplerState PointClamp;
public static readonly SamplerState PointWrap;
#region Public
internal INativeSamplerState NativeSamplerState
{
get
{
return this.nativeSamplerState;
}
}
public SamplerState()
{
this.nativeSamplerState = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateSamplerState();
public TextureAddressMode AddressU
{
get
{
return this.addressU;
}
set
{
ThrowIfBound();
this.addressU = value;
this.nativeSamplerState.AddressU = value;
}
}
this.AddressU = TextureAddressMode.Wrap;
this.AddressV = TextureAddressMode.Wrap;
this.AddressW = TextureAddressMode.Wrap;
this.Filter = TextureFilter.Linear;
this.MaxAnisotropy = 0;
this.MaxMipLevel = 0;
this.MipMapLevelOfDetailBias = 0f;
}
public TextureAddressMode AddressV
{
get
{
return this.addressV;
}
set
{
ThrowIfBound();
this.addressV = value;
this.nativeSamplerState.AddressV = value;
}
}
private SamplerState(TextureFilter filter, TextureAddressMode addressMode, string name)
{
this.nativeSamplerState = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateSamplerState();
public TextureAddressMode AddressW
{
get
{
return this.addressW;
}
set
{
ThrowIfBound();
this.addressW = value;
this.nativeSamplerState.AddressW = value;
}
}
this.AddressU = addressMode;
this.AddressV = addressMode;
this.AddressW = addressMode;
this.Filter = filter;
this.MaxAnisotropy = 0;
this.MaxMipLevel = 0;
this.MipMapLevelOfDetailBias = 0f;
public TextureFilter Filter
{
get
{
return this.filter;
}
set
{
ThrowIfBound();
this.filter = value;
this.nativeSamplerState.Filter = value;
}
}
Name = name;
}
public int MaxAnisotropy
{
get
{
return this.maxAnisotropy;
}
set
{
ThrowIfBound();
this.maxAnisotropy = value;
this.nativeSamplerState.MaxAnisotropy = value;
}
}
static SamplerState()
{
PointWrap = new SamplerState(TextureFilter.Point, TextureAddressMode.Wrap, "SamplerState.PointWrap");
PointClamp = new SamplerState(TextureFilter.Point, TextureAddressMode.Clamp, "SamplerState.PointClamp");
LinearWrap = new SamplerState(TextureFilter.Linear, TextureAddressMode.Wrap, "SamplerState.LinearWrap");
LinearClamp = new SamplerState(TextureFilter.Linear, TextureAddressMode.Clamp, "SamplerState.LinearClamp");
AnisotropicWrap = new SamplerState(TextureFilter.Anisotropic, TextureAddressMode.Wrap, "SamplerState.AnisotropicWrap");
AnisotropicClamp = new SamplerState(TextureFilter.Anisotropic, TextureAddressMode.Clamp, "SamplerState.AnisotropicClamp");
}
public int MaxMipLevel
{
get
{
return this.maxMipLevel;
}
set
{
ThrowIfBound();
this.maxMipLevel = value;
this.nativeSamplerState.MaxMipLevel = value;
}
}
internal INativeSamplerState NativeSamplerState
{
get
{
return this.nativeSamplerState;
}
}
public float MipMapLevelOfDetailBias
{
get
{
return this.mipMapLevelOfDetailBias;
}
set
{
ThrowIfBound();
this.mipMapLevelOfDetailBias = value;
this.nativeSamplerState.MipMapLevelOfDetailBias = value;
}
}
#endregion
public TextureAddressMode AddressU
{
get
{
return this.addressU;
}
set
{
if (this.nativeSamplerState.IsBound)
{
throw new InvalidOperationException("You are not allowed to change SamplerState properties while it is bound to the GraphicsDevice.");
}
#region Constructor
public SamplerState()
{
CreateNative();
AddressU = TextureAddressMode.Wrap;
AddressV = TextureAddressMode.Wrap;
AddressW = TextureAddressMode.Wrap;
Filter = TextureFilter.Linear;
MaxAnisotropy = 0;
MaxMipLevel = 0;
MipMapLevelOfDetailBias = 0f;
}
this.addressU = value;
this.nativeSamplerState.AddressU = value;
}
}
private SamplerState(TextureFilter filter, TextureAddressMode addressMode, string name)
{
CreateNative();
AddressU = addressMode;
AddressV = addressMode;
AddressW = addressMode;
Filter = filter;
MaxAnisotropy = 0;
MaxMipLevel = 0;
MipMapLevelOfDetailBias = 0f;
Name = name;
}
public TextureAddressMode AddressV
{
get
{
return this.addressV;
}
set
{
if (this.nativeSamplerState.IsBound)
{
throw new InvalidOperationException("You are not allowed to change SamplerState properties while it is bound to the GraphicsDevice.");
}
static SamplerState()
{
PointWrap = new SamplerState(TextureFilter.Point, TextureAddressMode.Wrap, "SamplerState.PointWrap");
PointClamp = new SamplerState(TextureFilter.Point, TextureAddressMode.Clamp, "SamplerState.PointClamp");
LinearWrap = new SamplerState(TextureFilter.Linear, TextureAddressMode.Wrap, "SamplerState.LinearWrap");
LinearClamp = new SamplerState(TextureFilter.Linear, TextureAddressMode.Clamp, "SamplerState.LinearClamp");
AnisotropicWrap = new SamplerState(TextureFilter.Anisotropic, TextureAddressMode.Wrap,
"SamplerState.AnisotropicWrap");
AnisotropicClamp = new SamplerState(TextureFilter.Anisotropic, TextureAddressMode.Clamp,
"SamplerState.AnisotropicClamp");
}
#endregion
this.addressV = value;
this.nativeSamplerState.AddressV = value;
}
}
#region Dispose
public override void Dispose()
{
if (this.nativeSamplerState != null)
{
this.nativeSamplerState.Dispose();
this.nativeSamplerState = null;
}
}
public TextureAddressMode AddressW
{
get
{
return this.addressW;
}
set
{
if (this.nativeSamplerState.IsBound)
{
throw new InvalidOperationException("You are not allowed to change SamplerState properties while it is bound to the GraphicsDevice.");
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
base.Dispose(disposeManaged);
}
#endregion
this.addressW = value;
this.nativeSamplerState.AddressW = value;
}
}
#region CreateNative
private void CreateNative()
{
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
nativeSamplerState = creator.CreateSamplerState();
}
#endregion
public TextureFilter Filter
{
get
{
return this.filter;
}
set
{
if (this.nativeSamplerState.IsBound)
{
throw new InvalidOperationException("You are not allowed to change SamplerState properties while it is bound to the GraphicsDevice.");
}
this.filter = value;
this.nativeSamplerState.Filter = value;
}
}
public int MaxAnisotropy
{
get
{
return this.maxAnisotropy;
}
set
{
if (this.nativeSamplerState.IsBound)
{
throw new InvalidOperationException("You are not allowed to change SamplerState properties while it is bound to the GraphicsDevice.");
}
this.maxAnisotropy = value;
this.nativeSamplerState.MaxAnisotropy = value;
}
}
public int MaxMipLevel
{
get
{
return this.maxMipLevel;
}
set
{
if (this.nativeSamplerState.IsBound)
{
throw new InvalidOperationException("You are not allowed to change SamplerState properties while it is bound to the GraphicsDevice.");
}
this.maxMipLevel = value;
this.nativeSamplerState.MaxMipLevel = value;
}
}
public float MipMapLevelOfDetailBias
{
get
{
return this.mipMapLevelOfDetailBias;
}
set
{
if (this.nativeSamplerState.IsBound)
{
throw new InvalidOperationException("You are not allowed to change SamplerState properties while it is bound to the GraphicsDevice.");
}
this.mipMapLevelOfDetailBias = value;
this.nativeSamplerState.MipMapLevelOfDetailBias = value;
}
}
public override void Dispose()
{
if (this.nativeSamplerState != null)
{
this.nativeSamplerState.Dispose();
this.nativeSamplerState = null;
}
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
base.Dispose(disposeManaged);
}
}
#region ThrowIfBound
private void ThrowIfBound()
{
if (nativeSamplerState.IsBound)
throw new InvalidOperationException("You are not allowed to change SamplerState properties while it is " +
"bound to the GraphicsDevice.");
}
#endregion
}
}

View File

@ -1,7 +1,4 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,6 +6,7 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
public sealed class SamplerStateCollection
{
private SamplerState[] samplerStates;
@ -20,9 +18,7 @@ namespace ANX.Framework.Graphics
this.samplerStates = new SamplerState[maxSamplers];
for (int i = 0; i < samplerStates.Length; i++)
{
samplerStates[i] = SamplerState.LinearWrap;
}
}
public SamplerState this[int index]

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,9 +1,4 @@
#region Using Statements
using System;
using ANX.Framework.NonXNA.RenderSystem;
using ANX.Framework.NonXNA;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -15,7 +10,36 @@ namespace ANX.Framework.Graphics
{
protected internal int levelCount;
protected internal SurfaceFormat format;
protected internal INativeTexture nativeTexture;
protected internal INativeTexture nativeTexture;
public int LevelCount
{
get
{
return this.levelCount;
}
}
public SurfaceFormat Format
{
get
{
return this.format;
}
}
internal INativeTexture NativeTexture
{
get
{
if (this.nativeTexture == null)
{
ReCreateNativeTextureSurface();
}
return this.nativeTexture;
}
}
public Texture(GraphicsDevice graphicsDevice)
: base(graphicsDevice)
@ -30,35 +54,6 @@ namespace ANX.Framework.Graphics
base.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed;
}
public int LevelCount
{
get
{
return this.levelCount;
}
}
public SurfaceFormat Format
{
get
{
return this.format;
}
}
internal INativeTexture NativeTexture
{
get
{
if (this.nativeTexture == null)
{
ReCreateNativeTextureSurface();
}
return this.nativeTexture;
}
}
public override void Dispose()
{
Dispose(true);
@ -76,22 +71,13 @@ namespace ANX.Framework.Graphics
internal abstract void ReCreateNativeTextureSurface();
private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e)
{
if (nativeTexture != null)
{
nativeTexture.Dispose();
nativeTexture = null;
}
{
Dispose(true);
}
private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e)
{
if (nativeTexture != null)
{
nativeTexture.Dispose();
nativeTexture = null;
}
{
Dispose(true);
ReCreateNativeTextureSurface();
}
}

View File

@ -1,189 +1,179 @@
#region Using Statements
using System;
using System.IO;
using System.Runtime.InteropServices;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.RenderSystem;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
namespace ANX.Framework.Graphics
{
public class Texture2D : Texture, IGraphicsResource
{
#region Private
protected internal int width;
protected internal int height;
public class Texture2D : Texture, IGraphicsResource
{
#region Private
protected internal int width;
protected internal int height;
private INativeTexture2D nativeTexture2D;
private INativeTexture2D NativeTexture2D
{
get
{
if (nativeTexture2D == null)
{
CreateNativeTextureSurface();
}
private INativeTexture2D nativeTexture2D;
private INativeTexture2D NativeTexture2D
{
get
{
if (nativeTexture2D == null)
CreateNativeTextureSurface();
return nativeTexture2D;
}
}
#endregion
return nativeTexture2D;
}
}
#endregion
#region Public
public Rectangle Bounds
{
get
{
return new Rectangle(0, 0, this.width, this.height);
}
}
#region Public
public Rectangle Bounds
{
get
{
return new Rectangle(0, 0, this.width, this.height);
}
}
public int Width
{
get
{
return this.width;
}
}
public int Width
{
get
{
return this.width;
}
}
public int Height
{
get
{
return this.height;
}
}
#endregion
public int Height
{
get
{
return this.height;
}
}
#endregion
#region Constructor (TODO)
internal Texture2D(GraphicsDevice graphicsDevice)
: base(graphicsDevice)
{
}
#region Constructor (TODO)
internal Texture2D(GraphicsDevice graphicsDevice)
: base(graphicsDevice)
{
}
public Texture2D(GraphicsDevice graphicsDevice, int width, int height)
: base(graphicsDevice)
{
this.width = width;
this.height = height;
public Texture2D(GraphicsDevice graphicsDevice, int width, int height)
: base(graphicsDevice)
{
this.width = width;
this.height = height;
base.levelCount = 1;
base.format = SurfaceFormat.Color;
base.levelCount = 1;
base.format = SurfaceFormat.Color;
CreateNativeTextureSurface();
}
CreateNativeTextureSurface();
}
public Texture2D(GraphicsDevice graphicsDevice, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat format)
: base(graphicsDevice)
{
this.width = width;
this.height = height;
public Texture2D(GraphicsDevice graphicsDevice, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat format)
: base(graphicsDevice)
{
this.width = width;
this.height = height;
base.levelCount = 1; //TODO: mipmap paramter?!?!?
base.format = format;
base.levelCount = 1; //TODO: mipmap paramter?!?!?
base.format = format;
CreateNativeTextureSurface();
}
#endregion
CreateNativeTextureSurface();
}
#endregion
#region FromStream (TODO)
public static Texture2D FromStream(GraphicsDevice graphicsDevice,
Stream stream)
{
throw new NotImplementedException();
}
#region FromStream (TODO)
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream)
{
throw new NotImplementedException();
}
public static Texture2D FromStream(GraphicsDevice graphicsDevice,
Stream stream, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool zoom)
{
throw new NotImplementedException();
}
#endregion
public static Texture2D FromStream(GraphicsDevice graphicsDevice, Stream stream, int width, int height,
[MarshalAsAttribute(UnmanagedType.U1)] bool zoom)
{
throw new NotImplementedException();
}
#endregion
#region GetData
public void GetData<T>(int level, Nullable<Rectangle> rect, T[] data,
int startIndex, int elementCount) where T : struct
{
NativeTexture2D.GetData(level, rect, data, startIndex, elementCount);
}
#region GetData
public void GetData<T>(int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct
{
NativeTexture2D.GetData(level, rect, data, startIndex, elementCount);
}
public void GetData<T>(T[] data) where T : struct
{
NativeTexture.GetData(data);
}
public void GetData<T>(T[] data) where T : struct
{
NativeTexture.GetData(data);
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
NativeTexture.GetData(data, startIndex, elementCount);
}
#endregion
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
NativeTexture.GetData(data, startIndex, elementCount);
}
#endregion
#region SetData
public void SetData<T>(int level, Nullable<Rectangle> rect, T[] data,
int startIndex, int elementCount) where T : struct
{
NativeTexture2D.SetData(level, rect, data, startIndex, elementCount);
}
#region SetData
public void SetData<T>(int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct
{
NativeTexture2D.SetData(level, rect, data, startIndex, elementCount);
}
public void SetData<T>(T[] data) where T : struct
{
NativeTexture.SetData<T>(GraphicsDevice, data);
}
public void SetData<T>(T[] data) where T : struct
{
NativeTexture.SetData<T>(GraphicsDevice, data);
}
public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
NativeTexture.SetData<T>(GraphicsDevice, data, startIndex, elementCount);
}
#endregion
public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
NativeTexture.SetData<T>(GraphicsDevice, data, startIndex, elementCount);
}
#endregion
#region SaveAsJpeg
public void SaveAsJpeg(Stream stream, int width, int height)
{
NativeTexture2D.SaveAsJpeg(stream, width, height);
}
#endregion
#region SaveAsJpeg
public void SaveAsJpeg(Stream stream, int width, int height)
{
NativeTexture2D.SaveAsJpeg(stream, width, height);
}
#endregion
#region SaveAsPng
public void SaveAsPng(Stream stream, int width, int height)
{
NativeTexture2D.SaveAsPng(stream, width, height);
}
#endregion
#region SaveAsPng
public void SaveAsPng(Stream stream, int width, int height)
{
NativeTexture2D.SaveAsPng(stream, width, height);
}
#endregion
#region Dispose
public override void Dispose()
{
base.Dispose(true);
}
#region Dispose
public override void Dispose()
{
base.Dispose(true);
}
protected override void Dispose(
[MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
base.Dispose(disposeManaged);
}
#endregion
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
base.Dispose(disposeManaged);
}
#endregion
#region ReCreateNativeTextureSurface
internal override void ReCreateNativeTextureSurface()
{
CreateNativeTextureSurface();
}
#endregion
#region ReCreateNativeTextureSurface
internal override void ReCreateNativeTextureSurface()
{
CreateNativeTextureSurface();
}
#endregion
#region CreateNativeTextureSurface
private void CreateNativeTextureSurface()
{
nativeTexture2D =
AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>().CreateTexture(GraphicsDevice, format, width, height, levelCount);
base.nativeTexture = nativeTexture2D;
}
#endregion
}
#region CreateNativeTextureSurface
private void CreateNativeTextureSurface()
{
var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
nativeTexture2D = creator.CreateTexture(GraphicsDevice, format, width, height, levelCount);
base.nativeTexture = nativeTexture2D;
}
#endregion
}
}

View File

@ -1,8 +1,6 @@
#region Using Statements
using System;
using System.Runtime.InteropServices;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -10,75 +8,78 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics
{
public class Texture3D : Texture, IGraphicsResource
{
public Texture3D(GraphicsDevice graphics, int width, int height, int depth, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat format)
: base(graphics)
{
[PercentageComplete(0)]
public class Texture3D : Texture, IGraphicsResource
{
public int Depth
{
get;
private set;
}
}
public int Width
{
get;
private set;
}
public void GetData<T>(int level, int left, int top, int right, int bottom, int front, int back, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public int Height
{
get;
private set;
}
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public Texture3D(GraphicsDevice graphics, int width, int height, int depth,
[MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat format)
: base(graphics)
{
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(int level, int left, int top, int right, int bottom, int front, int back, T[] data,
int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(int level, int left, int top, int right, int bottom, int front, int back, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(int level, int left, int top, int right, int bottom, int front, int back, T[] data,
int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public override void Dispose()
{
throw new NotImplementedException();
}
public void SetData<T>(T[] data) where T : struct
{
throw new NotImplementedException();
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
public void SetData<T>(T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public int Depth
{
get;
private set;
}
public override void Dispose()
{
throw new NotImplementedException();
}
public int Width
{
get;
private set;
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
public int Height
{
get;
private set;
}
internal override void ReCreateNativeTextureSurface()
{
throw new NotImplementedException();
}
}
internal override void ReCreateNativeTextureSurface()
{
throw new NotImplementedException();
}
}
}

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,6 @@
#region Using Statements
using System;
using System.Runtime.InteropServices;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -10,63 +8,71 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics
{
public class TextureCube : Texture, IGraphicsResource
{
public TextureCube(GraphicsDevice graphics, int size, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap, SurfaceFormat format)
: base(graphics)
{
this.Size = size;
}
[PercentageComplete(0)]
public class TextureCube : Texture, IGraphicsResource
{
public int Size
{
get;
private set;
}
public void GetData<T>(CubeMapFace cubeMapFace, int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public TextureCube(GraphicsDevice graphics, int size, [MarshalAsAttribute(UnmanagedType.U1)] bool mipMap,
SurfaceFormat format)
: base(graphics)
{
this.Size = size;
}
public void GetData<T>(CubeMapFace cubeMapFace, T[] data) where T : struct
{
throw new NotImplementedException();
}
#region GetData (TODO)
public void GetData<T>(CubeMapFace cubeMapFace, int level, Nullable<Rectangle> rect, T[] data, int startIndex,
int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(CubeMapFace cubeMapFace, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(CubeMapFace cubeMapFace, T[] data) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(CubeMapFace cubeMapFace, int level, Nullable<Rectangle> rect, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void GetData<T>(CubeMapFace cubeMapFace, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
public void SetData<T>(CubeMapFace cubeMapFace, T[] data) where T : struct
{
throw new NotImplementedException();
}
#region SetData (TODO)
public void SetData<T>(CubeMapFace cubeMapFace, int level, Nullable<Rectangle> rect, T[] data, int startIndex,
int elementCount) where T : struct
{
throw new NotImplementedException();
}
public void SetData<T>(CubeMapFace cubeMapFace, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
public override void Dispose()
{
throw new NotImplementedException();
}
public void SetData<T>(CubeMapFace cubeMapFace, T[] data) where T : struct
{
throw new NotImplementedException();
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
public void SetData<T>(CubeMapFace cubeMapFace, T[] data, int startIndex, int elementCount) where T : struct
{
throw new NotImplementedException();
}
#endregion
public int Size
{
get;
private set;
}
public override void Dispose()
{
throw new NotImplementedException();
}
internal override void ReCreateNativeTextureSurface()
{
throw new NotImplementedException();
}
}
protected override void Dispose([MarshalAs(UnmanagedType.U1)] bool disposeManaged)
{
throw new NotImplementedException();
}
internal override void ReCreateNativeTextureSurface()
{
throw new NotImplementedException();
}
}
}

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,7 +1,4 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,13 +6,40 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
public struct VertexBufferBinding
{
#region Private Members
#region Private
private VertexBuffer vertexBuffer;
private int instanceFrequency;
private int vertexOffset;
#endregion // Private Members
#endregion
#region Public
public VertexBuffer VertexBuffer
{
get
{
return this.vertexBuffer;
}
}
public int InstanceFrequency
{
get
{
return this.instanceFrequency;
}
}
public int VertexOffset
{
get
{
return this.vertexOffset;
}
}
#endregion
public VertexBufferBinding(VertexBuffer vertexBuffer)
{
@ -42,29 +66,5 @@ namespace ANX.Framework.Graphics
{
return new VertexBufferBinding(vertexBuffer);
}
public VertexBuffer VertexBuffer
{
get
{
return this.vertexBuffer;
}
}
public int InstanceFrequency
{
get
{
return this.instanceFrequency;
}
}
public int VertexOffset
{
get
{
return this.vertexOffset;
}
}
}
}

View File

@ -1,5 +1,6 @@
using System;
using System.Runtime.InteropServices;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -7,6 +8,7 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics
{
[PercentageComplete(100)]
public class VertexDeclaration : GraphicsResource
{
private VertexElement[] elements;
@ -33,10 +35,7 @@ namespace ANX.Framework.Graphics
public VertexElement[] GetVertexElements()
{
if (elements != null)
return elements.Clone() as VertexElement[];
else
return null;
return (elements != null) ? (elements.Clone() as VertexElement[]) : null;
}
public override void Dispose()
@ -70,7 +69,7 @@ namespace ANX.Framework.Graphics
case VertexElementFormat.Vector4:
return 16;
default:
throw new ArgumentException("unknown VertexElementFormat size '" + format + "'");
throw new ArgumentException("Unknown VertexElementFormat size '" + format + "'.");
}
}
}

View File

@ -1,7 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,15 +7,65 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(95)]
public struct VertexElement
{
#region Private Members
#region Private
private int offset;
private VertexElementFormat elementFormat;
private VertexElementUsage elementUsage;
private int usageIndex;
#endregion // Private Members
#endregion
#region Public
public int Offset
{
get
{
return this.offset;
}
set
{
this.offset = value;
}
}
public VertexElementFormat VertexElementFormat
{
get
{
return this.elementFormat;
}
set
{
this.elementFormat = value;
}
}
public VertexElementUsage VertexElementUsage
{
get
{
return this.elementUsage;
}
set
{
this.elementUsage = value;
}
}
public int UsageIndex
{
get
{
return this.usageIndex;
}
set
{
this.usageIndex = value;
}
}
#endregion
public VertexElement(int offset, VertexElementFormat elementFormat, VertexElementUsage elementUsage, int usageIndex)
{
@ -27,54 +75,6 @@ namespace ANX.Framework.Graphics
this.usageIndex = usageIndex;
}
public int Offset
{
get
{
return this.offset;
}
set
{
this.offset = value;
}
}
public VertexElementFormat VertexElementFormat
{
get
{
return this.elementFormat;
}
set
{
this.elementFormat = value;
}
}
public VertexElementUsage VertexElementUsage
{
get
{
return this.elementUsage;
}
set
{
this.elementUsage = value;
}
}
public int UsageIndex
{
get
{
return this.usageIndex;
}
set
{
this.usageIndex = value;
}
}
public override int GetHashCode()
{
throw new NotImplementedException();
@ -82,27 +82,28 @@ namespace ANX.Framework.Graphics
public override string ToString()
{
return string.Format("{{Offset:{0} Format:{1} Usage:{2} UsageIndex:{3}}}", this.offset, this.elementFormat, this.elementUsage, this.usageIndex);
return String.Format("{{Offset:{0} Format:{1} Usage:{2} UsageIndex:{3}}}", offset, elementFormat, elementUsage,
usageIndex);
}
public override bool Equals(object obj)
{
if (obj != null && obj.GetType() == this.GetType())
{
if (obj != null && obj is VertexElement)
return this == (VertexElement)obj;
}
return false;
}
public static bool operator ==(VertexElement lhs, VertexElement rhs)
{
return lhs.offset == rhs.offset && lhs.elementFormat == rhs.elementFormat && lhs.elementUsage == rhs.elementUsage && lhs.usageIndex == rhs.usageIndex;
return lhs.offset == rhs.offset && lhs.elementFormat == rhs.elementFormat && lhs.elementUsage == rhs.elementUsage &&
lhs.usageIndex == rhs.usageIndex;
}
public static bool operator !=(VertexElement lhs, VertexElement rhs)
{
return lhs.offset != rhs.offset || lhs.elementFormat != rhs.elementFormat || lhs.elementUsage != rhs.elementUsage || lhs.usageIndex == rhs.usageIndex;
return lhs.offset != rhs.offset || lhs.elementFormat != rhs.elementFormat || lhs.elementUsage != rhs.elementUsage ||
lhs.usageIndex == rhs.usageIndex;
}
}
}

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,8 +1,3 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license

View File

@ -1,4 +1,5 @@
using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,6 +7,7 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(95)]
public struct VertexPositionColor : IVertexType
{
public Vector3 Position;
@ -15,10 +17,7 @@ namespace ANX.Framework.Graphics
VertexDeclaration IVertexType.VertexDeclaration
{
get
{
return VertexDeclaration;
}
get { return VertexDeclaration; }
}
public VertexPositionColor(Vector3 position, Color color)
@ -31,15 +30,12 @@ namespace ANX.Framework.Graphics
{
VertexElement[] elements =
{
new VertexElement(0, VertexElementFormat.Vector3,
VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Color,
VertexElementUsage.Color, 0),
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Color, VertexElementUsage.Color, 0),
};
VertexDeclaration declaration = new VertexDeclaration(16, elements);
declaration.Name = "VertexPositionColor.VertexDeclaration";
VertexDeclaration = declaration;
VertexDeclaration = new VertexDeclaration(16, elements);
VertexDeclaration.Name = "VertexPositionColor.VertexDeclaration";
}
public override int GetHashCode()
@ -49,16 +45,13 @@ namespace ANX.Framework.Graphics
public override string ToString()
{
return string.Format("{{Position:{0} Color:{1}}}",
this.Position, this.Color);
return String.Format("{{Position:{0} Color:{1}}}", Position, Color);
}
public override bool Equals(object obj)
{
if (obj != null && obj.GetType() == this.GetType())
{
if (obj != null && obj is VertexPositionColor)
return this == (VertexPositionColor)obj;
}
return false;
}
@ -70,8 +63,7 @@ namespace ANX.Framework.Graphics
public static bool operator !=(VertexPositionColor lhs, VertexPositionColor rhs)
{
return lhs.Color.Equals(rhs.Color) == false ||
lhs.Position.Equals(rhs.Position) == false;
return lhs.Color.Equals(rhs.Color) == false || lhs.Position.Equals(rhs.Position) == false;
}
}
}

View File

@ -1,4 +1,5 @@
using System;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -6,6 +7,7 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(95)]
public struct VertexPositionColorTexture : IVertexType
{
public Vector3 Position;
@ -16,14 +18,10 @@ namespace ANX.Framework.Graphics
VertexDeclaration IVertexType.VertexDeclaration
{
get
{
return VertexDeclaration;
}
get { return VertexDeclaration; }
}
public VertexPositionColorTexture(Vector3 position, Color color,
Vector2 textureCoordinate)
public VertexPositionColorTexture(Vector3 position, Color color, Vector2 textureCoordinate)
{
this.Position = position;
this.Color = color;
@ -34,17 +32,13 @@ namespace ANX.Framework.Graphics
{
VertexElement[] elements =
{
new VertexElement(0, VertexElementFormat.Vector3,
VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Color,
VertexElementUsage.Color, 0),
new VertexElement(16, VertexElementFormat.Vector2,
VertexElementUsage.TextureCoordinate, 0),
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Color, VertexElementUsage.Color, 0),
new VertexElement(16, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
};
VertexDeclaration delcaration = new VertexDeclaration(24, elements);
delcaration.Name = "VertexPositionColorTexture.VertexDeclaration";
VertexDeclaration = delcaration;
VertexDeclaration = new VertexDeclaration(24, elements);
VertexDeclaration.Name = "VertexPositionColorTexture.VertexDeclaration";
}
public override int GetHashCode()
@ -54,33 +48,26 @@ namespace ANX.Framework.Graphics
public override string ToString()
{
return string.Format("{{Position:{0} Color:{1} TextureCoordinate:{2}}}",
this.Position, this.Color, this.TextureCoordinate);
return String.Format("{{Position:{0} Color:{1} TextureCoordinate:{2}}}", Position, Color, TextureCoordinate);
}
public override bool Equals(object obj)
{
if (obj != null && obj.GetType() == this.GetType())
{
if (obj != null && obj is VertexPositionColorTexture)
return this == (VertexPositionColorTexture)obj;
}
return false;
}
public static bool operator ==(VertexPositionColorTexture lhs,
VertexPositionColorTexture rhs)
public static bool operator ==(VertexPositionColorTexture lhs, VertexPositionColorTexture rhs)
{
return lhs.Color.Equals(rhs.Color) &&
lhs.Position.Equals(rhs.Position) &&
return lhs.Color.Equals(rhs.Color) && lhs.Position.Equals(rhs.Position) &&
lhs.TextureCoordinate.Equals(rhs.TextureCoordinate);
}
public static bool operator !=(VertexPositionColorTexture lhs,
VertexPositionColorTexture rhs)
public static bool operator !=(VertexPositionColorTexture lhs, VertexPositionColorTexture rhs)
{
return lhs.Color.Equals(rhs.Color) == false ||
lhs.Position.Equals(rhs.Position) == false ||
return lhs.Color.Equals(rhs.Color) == false || lhs.Position.Equals(rhs.Position) == false ||
lhs.TextureCoordinate.Equals(rhs.TextureCoordinate) == false;
}
}

View File

@ -1,7 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,6 +7,7 @@ using System;
namespace ANX.Framework.Graphics
{
[PercentageComplete(95)]
public struct VertexPositionNormalTexture : IVertexType
{
public Vector3 Position;
@ -31,13 +30,14 @@ namespace ANX.Framework.Graphics
static VertexPositionNormalTexture()
{
VertexElement[] elements = new VertexElement[] { new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
};
VertexDeclaration d = new VertexDeclaration(32, elements);
d.Name = "VertexPositionNormalTexture.VertexDeclaration";
VertexDeclaration = d;
VertexElement[] elements = new VertexElement[]
{
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Vector3, VertexElementUsage.Normal, 0),
new VertexElement(24, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
};
VertexDeclaration = new VertexDeclaration(32, elements);
VertexDeclaration.Name = "VertexPositionNormalTexture.VertexDeclaration";
}
public override int GetHashCode()
@ -47,27 +47,27 @@ namespace ANX.Framework.Graphics
public override string ToString()
{
return string.Format("{{Position:{0} Normal:{1} TextureCoordinate:{2}}}", this.Position, this.Normal, this.TextureCoordinate);
return String.Format("{{Position:{0} Normal:{1} TextureCoordinate:{2}}}", Position, Normal, TextureCoordinate);
}
public override bool Equals(object obj)
{
if (obj != null && obj.GetType() == this.GetType())
{
if (obj != null && obj is VertexPositionNormalTexture)
return this == (VertexPositionNormalTexture)obj;
}
return false;
}
public static bool operator ==(VertexPositionNormalTexture lhs, VertexPositionNormalTexture rhs)
{
return lhs.Normal.Equals(rhs.Normal) && lhs.Position.Equals(rhs.Position) && lhs.TextureCoordinate.Equals(rhs.TextureCoordinate);
return lhs.Normal.Equals(rhs.Normal) && lhs.Position.Equals(rhs.Position) &&
lhs.TextureCoordinate.Equals(rhs.TextureCoordinate);
}
public static bool operator !=(VertexPositionNormalTexture lhs, VertexPositionNormalTexture rhs)
{
return !lhs.Normal.Equals(rhs.Normal) || !lhs.Position.Equals(rhs.Position) || !lhs.TextureCoordinate.Equals(rhs.TextureCoordinate);
return lhs.Normal.Equals(rhs.Normal) == false || lhs.Position.Equals(rhs.Position) == false ||
lhs.TextureCoordinate.Equals(rhs.TextureCoordinate) == false;
}
}
}

View File

@ -1,7 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,62 +7,62 @@ using System;
namespace ANX.Framework.Graphics
{
public struct VertexPositionTexture : IVertexType
{
public Vector3 Position;
public Vector2 TextureCoordinate;
[PercentageComplete(95)]
public struct VertexPositionTexture : IVertexType
{
public Vector3 Position;
public Vector2 TextureCoordinate;
public static readonly VertexDeclaration VertexDeclaration;
public static readonly VertexDeclaration VertexDeclaration;
VertexDeclaration IVertexType.VertexDeclaration
{
get { return VertexDeclaration; }
}
VertexDeclaration IVertexType.VertexDeclaration
{
get { return VertexDeclaration; }
}
public VertexPositionTexture(Vector3 position, Vector2 textureCoordinate)
{
this.Position = position;
this.TextureCoordinate = textureCoordinate;
}
public VertexPositionTexture(Vector3 position, Vector2 textureCoordinate)
{
this.Position = position;
this.TextureCoordinate = textureCoordinate;
}
static VertexPositionTexture()
{
VertexElement[] elements = new VertexElement[] { new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
};
VertexDeclaration d = new VertexDeclaration(20, elements);
d.Name = "VertexPositionTexture.VertexDeclaration";
VertexDeclaration = d;
}
static VertexPositionTexture()
{
VertexElement[] elements = new VertexElement[]
{
new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
new VertexElement(12, VertexElementFormat.Vector2, VertexElementUsage.TextureCoordinate, 0),
};
VertexDeclaration = new VertexDeclaration(20, elements);
VertexDeclaration.Name = "VertexPositionTexture.VertexDeclaration";
}
public override int GetHashCode()
{
throw new NotImplementedException();
}
public override int GetHashCode()
{
throw new NotImplementedException();
}
public override string ToString()
{
return string.Format("{{Position:{0} TextureCoordinate:{1}}}", this.Position, this.TextureCoordinate);
}
public override string ToString()
{
return String.Format("{{Position:{0} TextureCoordinate:{1}}}", Position, TextureCoordinate);
}
public override bool Equals(object obj)
{
if (obj != null && obj.GetType() == this.GetType())
{
return this == (VertexPositionTexture)obj;
}
public override bool Equals(object obj)
{
if (obj != null && obj is VertexPositionTexture)
return this == (VertexPositionTexture)obj;
return false;
}
return false;
}
public static bool operator ==(VertexPositionTexture lhs, VertexPositionTexture rhs)
{
return lhs.TextureCoordinate.Equals(rhs.TextureCoordinate) && lhs.Position.Equals(rhs.Position);
}
public static bool operator ==(VertexPositionTexture lhs, VertexPositionTexture rhs)
{
return lhs.TextureCoordinate.Equals(rhs.TextureCoordinate) && lhs.Position.Equals(rhs.Position);
}
public static bool operator !=(VertexPositionTexture lhs, VertexPositionTexture rhs)
{
return !lhs.TextureCoordinate.Equals(rhs.TextureCoordinate) || !lhs.Position.Equals(rhs.Position);
}
}
public static bool operator !=(VertexPositionTexture lhs, VertexPositionTexture rhs)
{
return !lhs.TextureCoordinate.Equals(rhs.TextureCoordinate) || !lhs.Position.Equals(rhs.Position);
}
}
}

View File

@ -1,8 +1,5 @@
#region Using Statements
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
@ -10,15 +7,127 @@ using System;
namespace ANX.Framework.Graphics
{
public struct Viewport
{
private int x;
{
#region Private
private int x;
private int y;
private int width;
private int height;
private float near;
private float far;
#endregion
public Viewport(int x, int y, int width, int height)
#region Public
public float AspectRatio
{
get
{
if (this.width != 0 && this.height != 0)
return (float)width / (float)height;
return 0f;
}
}
public Rectangle Bounds
{
get
{
return new Rectangle(x, y, width, height);
}
set
{
this.x = value.X;
this.y = value.Y;
this.width = value.Width;
this.height = value.Height;
}
}
public int Height
{
get
{
return this.height;
}
set
{
this.height = value;
}
}
public float MaxDepth
{
get
{
return this.far;
}
set
{
this.far = value;
}
}
public float MinDepth
{
get
{
return this.near;
}
set
{
this.near = value;
}
}
public Rectangle TitleSafeArea
{
get
{
// On Windows Xna simply returns the rectangle. Check if we need any other implementation on other platforms!
return new Rectangle(x, y, width, height);
}
}
public int Width
{
get
{
return this.width;
}
set
{
this.width = value;
}
}
public int X
{
get
{
return this.x;
}
set
{
this.x = value;
}
}
public int Y
{
get
{
return this.y;
}
set
{
this.y = value;
}
}
#endregion
#region Constructor
public Viewport(int x, int y, int width, int height)
{
this.x = x;
this.y = y;
@ -33,131 +142,63 @@ namespace ANX.Framework.Graphics
this.x = bounds.X;
this.y = bounds.Y;
this.width = bounds.Width;
this.height = bounds.Height; this.near = 0f;
this.height = bounds.Height;
this.near = 0f;
this.far = 1f;
}
#endregion
public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
#region Project
public Vector3 Project(Vector3 source, Matrix projection, Matrix view, Matrix world)
{
Matrix wv;
Matrix wvp;
Matrix.Multiply(ref world, ref view, out wv);
Matrix.Multiply(ref wv, ref projection, out wvp);
Vector3 vector;
Vector3.Transform(ref source, ref wvp, out vector);
float num = source.X * wvp.M14 + source.Y * wvp.M24 + source.Z * wvp.M34 + wvp.M44;
if (WithinEpsilon(num) == false)
vector /= num;
vector.X = (vector.X + 1f) * 0.5f * (float)width + (float)x;
vector.Y = (-vector.Y + 1f) * 0.5f * (float)height + (float)y;
vector.Z = vector.Z * (far - near) + near;
return vector;
}
#endregion
#region Unproject
public Vector3 Unproject(Vector3 source, Matrix projection, Matrix view, Matrix world)
{
Matrix wv;
Matrix wvp;
Matrix.Multiply(ref world, ref view, out wv);
Matrix.Multiply(ref wv, ref projection, out wvp);
wvp = Matrix.Invert(wvp);
source.X = (source.X - (float)x) / (float)width * 2f - 1f;
source.Y = -((source.Y - (float)y) / (float)height * 2f - 1f);
source.Z = (source.Z - near) / (far - near);
Vector3 vector;
Vector3.Transform(ref source, ref wvp, out vector);
float num = source.X * wvp.M14 + source.Y * wvp.M24 + source.Z * wvp.M34 + wvp.M44;
return (WithinEpsilon(num) == false) ? vector /= num : vector;
}
#endregion
#region WithinEpsilon
private static bool WithinEpsilon(float num)
{
num -= 1f;
return -1.401298E-45f <= num && num <= 1.401298E-45f;
}
#endregion
#region ToString
public override string ToString()
{
throw new NotImplementedException();
}
public Vector3 Unproject(Vector3 source, Matrix projection, Matrix view, Matrix world)
{
throw new NotImplementedException();
}
public float AspectRatio
{
get
{
if (this.width != 0 && this.height != 0)
{
return (float)width / (float)height;
}
return 0f;
}
}
public Rectangle Bounds
{
get
{
return new Rectangle(x, y, width, height);
}
set
{
this.x = value.X;
this.y = value.Y;
this.width = value.Width;
this.height = value.Height;
}
}
public int Height
{
get
{
return this.height;
}
set
{
this.height = value;
}
}
public float MaxDepth
{
get
{
return this.far;
}
set
{
this.far = value;
}
}
public float MinDepth
{
get
{
return this.near;
}
set
{
this.near = value;
}
}
public Rectangle TitleSafeArea
{
get
{
throw new NotImplementedException();
}
}
public int Width
{
get
{
return this.width;
}
set
{
this.width = value;
}
}
public int X
{
get
{
return this.x;
}
set
{
this.x = value;
}
}
public int Y
{
get
{
return this.y;
}
set
{
this.y = value;
}
}
public override string ToString()
{
return String.Format("Viewport X: {0} Y:{1} Width: {2} Height: {3} AspectRatio: {4} MinDepth: {5} MaxDepth: {6}", X, Y, Width, Height, AspectRatio, MinDepth, MaxDepth);
return String.Format("Viewport X: {0} Y:{1} Width: {2} Height: {3} AspectRatio: {4} MinDepth: {5} MaxDepth: {6}",
X, Y, Width, Height, AspectRatio, MinDepth, MaxDepth);
}
#endregion
}
}