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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
#region Using Statements
using System; using System;
using System.Globalization;
#endregion // Using Statements using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,41 +8,21 @@ using System;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
[PercentageComplete(100)]
[TestState(TestStateAttribute.TestState.Untested)]
[Developer("AstrorEnales")]
public class DisplayMode public class DisplayMode
{ {
public float AspectRatio public float AspectRatio { get; set; }
{ public SurfaceFormat Format { get; set; }
get; public int Width { get; set; }
set; public int Height { get; set; }
} public Rectangle TitleSafeArea { get; set; }
public SurfaceFormat Format
{
get;
set;
}
public int Height
{
get;
set;
}
public Rectangle TitleSafeArea
{
get;
set;
}
public int Width
{
get;
set;
}
public override string ToString() 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; using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license
@ -10,7 +7,54 @@ using System;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
public sealed class EffectAnnotation 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() public bool GetValueBoolean()
{ {
@ -51,54 +95,5 @@ namespace ANX.Framework.Graphics
{ {
throw new NotImplementedException(); 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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license

View File

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

View File

@ -1,8 +1,5 @@
#region Using Statements
using System; using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license
@ -13,14 +10,28 @@ namespace ANX.Framework.Graphics
{ {
private string name; private string name;
private EffectAnnotationCollection annotations; 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) internal EffectPass(Effect parentEffect)
{ {
if (parentEffect == null) if (parentEffect == null)
{
throw new ArgumentNullException("parentEffect"); throw new ArgumentNullException("parentEffect");
}
this.parentEffect = parentEffect; this.parentEffect = parentEffect;
} }
@ -29,21 +40,5 @@ namespace ANX.Framework.Graphics
{ {
this.parentEffect.NativeEffect.Apply(this.parentEffect.GraphicsDevice); 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;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license
@ -17,7 +11,39 @@ namespace ANX.Framework.Graphics
{ {
private Effect parentEffect; private Effect parentEffect;
private INativeEffectTechnique nativeTechnique; 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) internal EffectTechnique(Effect parentEffect, INativeEffectTechnique nativeTechnique)
{ {
@ -25,37 +51,5 @@ namespace ANX.Framework.Graphics
this.nativeTechnique = nativeTechnique; this.nativeTechnique = nativeTechnique;
this.effectPassCollection = new EffectPassCollection(parentEffect, parentEffect.NativeEffect, 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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license

View File

@ -1,13 +1,9 @@
#region Using Statements
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq;
using ANX.Framework.NonXNA; using ANX.Framework.NonXNA;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license
@ -16,124 +12,67 @@ namespace ANX.Framework.Graphics
{ {
public sealed class GraphicsAdapter public sealed class GraphicsAdapter
{ {
private static List<GraphicsAdapter> adapters; public static ReadOnlyCollection<GraphicsAdapter> Adapters
private DisplayModeCollection supportedDisplayModes; {
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() static GraphicsAdapter()
{ {
adapters = new List<GraphicsAdapter>(); var creator = AddInSystemFactory.Instance.GetDefaultCreator<IRenderSystemCreator>();
Adapters = new ReadOnlyCollection<GraphicsAdapter>(creator.GetAdapterList());
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;
} }
public bool IsProfileSupported(GraphicsProfile graphicsProfile) public bool IsProfileSupported(GraphicsProfile graphicsProfile)
@ -141,15 +80,18 @@ namespace ANX.Framework.Graphics
throw new NotImplementedException(); 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(); 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(); 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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,8 +1,5 @@
#region Using Statements
using System; using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/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.RenderSystem;
using ANX.Framework.NonXNA;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "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 int levelCount;
protected internal SurfaceFormat format; 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) public Texture(GraphicsDevice graphicsDevice)
: base(graphicsDevice) : base(graphicsDevice)
@ -30,35 +54,6 @@ namespace ANX.Framework.Graphics
base.GraphicsDevice.ResourceDestroyed -= GraphicsDevice_ResourceDestroyed; 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() public override void Dispose()
{ {
Dispose(true); Dispose(true);
@ -76,22 +71,13 @@ namespace ANX.Framework.Graphics
internal abstract void ReCreateNativeTextureSurface(); internal abstract void ReCreateNativeTextureSurface();
private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e) private void GraphicsDevice_ResourceDestroyed(object sender, ResourceDestroyedEventArgs e)
{ {
if (nativeTexture != null) Dispose(true);
{
nativeTexture.Dispose();
nativeTexture = null;
}
} }
private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e) private void GraphicsDevice_ResourceCreated(object sender, ResourceCreatedEventArgs e)
{ {
if (nativeTexture != null) Dispose(true);
{
nativeTexture.Dispose();
nativeTexture = null;
}
ReCreateNativeTextureSurface(); ReCreateNativeTextureSurface();
} }
} }

View File

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

View File

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

View File

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

View File

@ -1,7 +1,4 @@
#region Using Statements using ANX.Framework.NonXNA.Development;
using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,13 +6,40 @@ using System;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
[PercentageComplete(100)]
public struct VertexBufferBinding public struct VertexBufferBinding
{ {
#region Private Members #region Private
private VertexBuffer vertexBuffer; private VertexBuffer vertexBuffer;
private int instanceFrequency; private int instanceFrequency;
private int vertexOffset; 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) public VertexBufferBinding(VertexBuffer vertexBuffer)
{ {
@ -42,29 +66,5 @@ namespace ANX.Framework.Graphics
{ {
return new VertexBufferBinding(vertexBuffer); 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;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -7,6 +8,7 @@ using System.Runtime.InteropServices;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
[PercentageComplete(100)]
public class VertexDeclaration : GraphicsResource public class VertexDeclaration : GraphicsResource
{ {
private VertexElement[] elements; private VertexElement[] elements;
@ -33,10 +35,7 @@ namespace ANX.Framework.Graphics
public VertexElement[] GetVertexElements() public VertexElement[] GetVertexElements()
{ {
if (elements != null) return (elements != null) ? (elements.Clone() as VertexElement[]) : null;
return elements.Clone() as VertexElement[];
else
return null;
} }
public override void Dispose() public override void Dispose()
@ -70,7 +69,7 @@ namespace ANX.Framework.Graphics
case VertexElementFormat.Vector4: case VertexElementFormat.Vector4:
return 16; return 16;
default: 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; using System;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
@ -9,15 +7,65 @@ using System;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
[PercentageComplete(95)]
public struct VertexElement public struct VertexElement
{ {
#region Private Members #region Private
private int offset; private int offset;
private VertexElementFormat elementFormat; private VertexElementFormat elementFormat;
private VertexElementUsage elementUsage; private VertexElementUsage elementUsage;
private int usageIndex; private int usageIndex;
#endregion
#endregion // Private Members #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) public VertexElement(int offset, VertexElementFormat elementFormat, VertexElementUsage elementUsage, int usageIndex)
{ {
@ -27,54 +75,6 @@ namespace ANX.Framework.Graphics
this.usageIndex = usageIndex; 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() public override int GetHashCode()
{ {
throw new NotImplementedException(); throw new NotImplementedException();
@ -82,27 +82,28 @@ namespace ANX.Framework.Graphics
public override string ToString() 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) public override bool Equals(object obj)
{ {
if (obj != null && obj.GetType() == this.GetType()) if (obj != null && obj is VertexElement)
{
return this == (VertexElement)obj; return this == (VertexElement)obj;
}
return false; return false;
} }
public static bool operator ==(VertexElement lhs, VertexElement rhs) 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) 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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/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 // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license

View File

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

View File

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

View File

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

View File

@ -1,8 +1,5 @@
#region Using Statements
using System; using System;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the // This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license. // "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license // For details see: http://anxframework.codeplex.com/license
@ -10,15 +7,127 @@ using System;
namespace ANX.Framework.Graphics namespace ANX.Framework.Graphics
{ {
public struct Viewport public struct Viewport
{ {
private int x; #region Private
private int x;
private int y; private int y;
private int width; private int width;
private int height; private int height;
private float near; private float near;
private float far; 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.x = x;
this.y = y; this.y = y;
@ -33,131 +142,63 @@ namespace ANX.Framework.Graphics
this.x = bounds.X; this.x = bounds.X;
this.y = bounds.Y; this.y = bounds.Y;
this.width = bounds.Width; this.width = bounds.Width;
this.height = bounds.Height; this.near = 0f; this.height = bounds.Height;
this.near = 0f;
this.far = 1f; 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(); 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);
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);
} }
#endregion
} }
} }