diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3.csproj
deleted file mode 100644
index fd1e14e9..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3.csproj
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {EB8258E0-6741-4DB9-B756-1EBDF67B1ED6}
- Library
- Properties
- ANX.RenderSystem.Windows.GL3
- ANX.RenderSystem.Windows.GL3
- v4.0
- 512
-
-
- true
- full
- false
- ..\..\bin\Debug\
- TRACE;DEBUG;XNAEXT
- prompt
- 4
- x86
- Auto
- true
-
-
- pdbonly
- true
- ..\bin\Release\
- TRACE;XNAEXT
- prompt
- 4
- x86
- true
-
-
-
- ..\..\lib\OpenTK\OpenTK.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}
- ANX.Framework
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_Linux.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_Linux.csproj
deleted file mode 100644
index c73eb47e..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_Linux.csproj
+++ /dev/null
@@ -1,89 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {EB8258E0-6741-4DB9-B756-1EBDF67B1ED6}
- Library
- Properties
- ANX.RenderSystem.Windows.GL3
- ANX.RenderSystem.Windows.GL3
- v4.0
- 512
-
-
- true
- full
- false
- ..\..\bin\Debug\
- XNAEXT;DEBUG;TRACE;LINUX;
- prompt
- 4
- x86
- Auto
- true
-
-
- pdbonly
- true
- ..\bin\Release\
- XNAEXT;TRACE;LINUX;
- prompt
- 4
- x86
- true
-
-
-
- ..\..\lib\OpenTK\OpenTK.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}
- ANX.Framework
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_PSVita.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_PSVita.csproj
deleted file mode 100644
index ceea511e..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_PSVita.csproj
+++ /dev/null
@@ -1,90 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 10.0.0
- 2.0
- {EB8258E0-6741-4DB9-B756-1EBDF67B1ED6}
- Library
- Properties
- ANX.RenderSystem.Windows.GL3
- ANX.RenderSystem.Windows.GL3
- 512
- {69878862-DA7D-4DC6-B0A1-50D8FAB4242F};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
-
-
- true
- full
- false
- ..\..\bin\Debug\
- XNAEXT;DEBUG;TRACE;PSVITA;
- prompt
- 4
- x86
- Auto
- true
-
-
- pdbonly
- true
- ..\bin\Release\
- XNAEXT;TRACE;PSVITA;
- prompt
- 4
- x86
- true
-
-
-
- ..\..\lib\OpenTK\OpenTK.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}
- ANX.Framework
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_WindowsMetro.csproj b/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_WindowsMetro.csproj
deleted file mode 100644
index 4b10a143..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ANX.RenderSystem.Windows.GL3_WindowsMetro.csproj
+++ /dev/null
@@ -1,95 +0,0 @@
-
-
-
- Debug
- AnyCPU
- 8.0.30703
- 2.0
- {EB8258E0-6741-4DB9-B756-1EBDF67B1ED6}
- Library
- Properties
- ANX.RenderSystem.Windows.GL3
- ANX.RenderSystem.Windows.GL3
- 512
- {BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
- en-US
- Test_TemporaryKey.pfx
-
-
- true
- full
- false
- ..\..\bin\Debug\
- XNAEXT;DEBUG;TRACE;WINDOWSMETRO;
- prompt
- 4
- x86
- Auto
- true
-
-
- pdbonly
- true
- ..\bin\Release\
- XNAEXT;TRACE;WINDOWSMETRO;
- prompt
- 4
- x86
- true
-
-
-
- ..\..\lib\OpenTK\OpenTK.dll
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {6899F0C9-70B9-4EB0-9DD3-E598D4BE3E35}
- ANX.Framework
-
-
-
-
-
-
-
-
- 11.0
-
-
-
\ No newline at end of file
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/BlendStateGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/BlendStateGL3.cs
deleted file mode 100644
index 46cd2d24..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/BlendStateGL3.cs
+++ /dev/null
@@ -1,353 +0,0 @@
-using System;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using ANX.Framework.NonXNA.Development;
-using OpenTK.Graphics.OpenGL;
-using ANX.RenderSystem.Windows.GL3.Helpers;
-using ANX.Framework;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native Blend State object for OpenGL.
- ///
- /// Basically this is a wrapper class for setting the different values all
- /// at once, because OpenGL has no State objects like DirectX.
- ///
- /// For Information on OpenGL blending: http://www.opengl.org/wiki/Blending
- ///
- [PercentageComplete(90)]
- [TestStateAttribute(TestStateAttribute.TestState.Untested)]
- public class BlendStateGL3 : INativeBlendState
- {
- #region Private
- internal static BlendStateGL3 Current
- {
- get;
- private set;
- }
- #endregion
-
- #region Public
- #region IsBound
- ///
- /// Flag if the blend state is bound to the device or not.
- ///
- public bool IsBound
- {
- get;
- private set;
- }
- #endregion
-
- #region AlphaBlendFunction
- public BlendFunction AlphaBlendFunction
- {
- set;
- private get;
- }
- #endregion
-
- #region ColorBlendFunction
- public BlendFunction ColorBlendFunction
- {
- set;
- private get;
- }
- #endregion
-
- #region AlphaSourceBlend
- public Blend AlphaSourceBlend
- {
- set;
- private get;
- }
- #endregion
-
- #region AlphaDestinationBlend
- public Blend AlphaDestinationBlend
- {
- set;
- private get;
- }
- #endregion
-
- #region ColorSourceBlend
- public Blend ColorSourceBlend
- {
- set;
- private get;
- }
- #endregion
-
- #region ColorDestinationBlend
- public Blend ColorDestinationBlend
- {
- set;
- private get;
- }
- #endregion
-
- #region ColorWriteChannels
- public ColorWriteChannels ColorWriteChannels
- {
- set;
- private get;
- }
- #endregion
-
- #region ColorWriteChannels1
- public ColorWriteChannels ColorWriteChannels1
- {
- set;
- private get;
- }
- #endregion
-
- #region ColorWriteChannels2
- public ColorWriteChannels ColorWriteChannels2
- {
- set;
- private get;
- }
- #endregion
-
- #region ColorWriteChannels3
- public ColorWriteChannels ColorWriteChannels3
- {
- set;
- private get;
- }
- #endregion
-
- #region BlendFactor
- public Color BlendFactor
- {
- set;
- private get;
- }
- #endregion
-
- #region MultiSampleMask
- public int MultiSampleMask
- {
- set;
- private get;
- }
- #endregion
- #endregion
-
- #region Constructor
- ///
- /// Create a new OpenGL Blend State wrapper object.
- ///
- internal BlendStateGL3()
- {
- IsBound = false;
- }
- #endregion
-
- #region Apply (TODO)
- ///
- /// Apply the blend state on the graphics device.
- ///
- /// The current graphics device.
- public void Apply(GraphicsDevice graphicsDevice)
- {
- IsBound = true;
- Current = this;
-
- GL.Enable(EnableCap.Blend);
-
- GL.BlendEquationSeparate(
- TranslateBlendFunction(ColorBlendFunction),
- TranslateBlendFunction(AlphaBlendFunction));
- ErrorHelper.Check("BlendEquationSeparate");
-
- GL.BlendFuncSeparate(
- TranslateBlendSrc(ColorSourceBlend),
- TranslateBlendDest(ColorDestinationBlend),
- TranslateBlendSrc(AlphaSourceBlend),
- TranslateBlendDest(AlphaDestinationBlend));
- ErrorHelper.Check("BlendFuncSeparate");
-
- SetColorWriteChannel(0, ColorWriteChannels);
- SetColorWriteChannel(1, ColorWriteChannels1);
- SetColorWriteChannel(2, ColorWriteChannels2);
- SetColorWriteChannel(3, ColorWriteChannels3);
-
- GL.BlendColor(BlendFactor.R * DatatypesMapping.ColorMultiplier,
- BlendFactor.G * DatatypesMapping.ColorMultiplier,
- BlendFactor.B * DatatypesMapping.ColorMultiplier,
- BlendFactor.A * DatatypesMapping.ColorMultiplier);
- ErrorHelper.Check("BlendColor");
-
- // TODO: multi sample mask
- }
- #endregion
-
- #region Release
- ///
- /// Release the blend state.
- ///
- public void Release()
- {
- IsBound = false;
- Current = null;
- }
- #endregion
-
- #region Dispose
- ///
- /// Dispose this blend state object.
- ///
- public void Dispose()
- {
- }
- #endregion
-
- #region SetColorWriteChannel
- ///
- /// Set the color mask for the specified index.
- ///
- /// Index of the color mask.
- /// Mask channels to enable.
- private void SetColorWriteChannel(int index, ColorWriteChannels channels)
- {
- bool r = (channels | ColorWriteChannels.Red) == channels;
- bool g = (channels | ColorWriteChannels.Green) == channels;
- bool b = (channels | ColorWriteChannels.Blue) == channels;
- bool a = (channels | ColorWriteChannels.Alpha) == channels;
-
- GL.ColorMask(index, r, g, b, a);
- ErrorHelper.Check("ColorMask");
- }
- #endregion
-
- #region TranslateBlendSrc
- ///
- /// Translate the ANX Blend mode to the OpenGL Blend Factor Source.
- ///
- /// ANX Blend Function.
- /// OpenGL Blend Factor Source.
- private BlendingFactorSrc TranslateBlendSrc(Blend blending)
- {
- switch (blending)
- {
- case Blend.SourceAlpha:
- return BlendingFactorSrc.SrcAlpha;
-
- case Blend.DestinationAlpha:
- return BlendingFactorSrc.DstAlpha;
-
- case Blend.DestinationColor:
- return BlendingFactorSrc.DstColor;
-
- case Blend.InverseDestinationAlpha:
- return BlendingFactorSrc.OneMinusDstAlpha;
-
- case Blend.InverseDestinationColor:
- return BlendingFactorSrc.OneMinusDstColor;
-
- case Blend.InverseSourceAlpha:
- return BlendingFactorSrc.OneMinusSrcAlpha;
-
- case Blend.One:
- return BlendingFactorSrc.One;
-
- case Blend.SourceAlphaSaturation:
- return BlendingFactorSrc.SrcAlphaSaturate;
-
- case Blend.Zero:
- return BlendingFactorSrc.Zero;
-
- default:
- throw new ArgumentException("Unable to translate SourceBlend '" +
- blending + "' to OpenGL BlendingFactorSrc.");
- }
- }
- #endregion
-
- #region TranslateBlendDest
- ///
- /// Translate the ANX Blend mode to the OpenGL Blend Factor Destination.
- ///
- /// ANX Blend Function.
- /// OpenGL Blend Factor Destination.
- private BlendingFactorDest TranslateBlendDest(Blend blending)
- {
- switch (blending)
- {
- case Blend.SourceAlpha:
- return BlendingFactorDest.SrcAlpha;
-
- case Blend.DestinationAlpha:
- return BlendingFactorDest.DstAlpha;
-
- case Blend.DestinationColor:
- return BlendingFactorDest.DstColor;
-
- case Blend.InverseDestinationAlpha:
- return BlendingFactorDest.OneMinusDstAlpha;
-
- case Blend.InverseDestinationColor:
- return BlendingFactorDest.OneMinusDstColor;
-
- case Blend.InverseSourceAlpha:
- return BlendingFactorDest.OneMinusSrcAlpha;
-
- case Blend.InverseSourceColor:
- return BlendingFactorDest.OneMinusSrcColor;
-
- case Blend.One:
- return BlendingFactorDest.One;
-
- case Blend.SourceColor:
- return BlendingFactorDest.SrcColor;
-
- case Blend.Zero:
- return BlendingFactorDest.Zero;
-
- default:
- throw new ArgumentException("Unable to translate DestinationBlend '" +
- blending + "' to OpenGL BlendingFactorDest.");
- }
- }
- #endregion
-
- #region TranslateBlendFunction
- ///
- /// Translate the ANX Blend Function to the OpenGL Blend Equation Mode.
- ///
- /// ANX Blend Function.
- /// OpenGL Blend Equation Mode.
- private BlendEquationMode TranslateBlendFunction(BlendFunction func)
- {
- switch (func)
- {
- case BlendFunction.Add:
- return BlendEquationMode.FuncAdd;
-
- case BlendFunction.Subtract:
- return BlendEquationMode.FuncSubtract;
-
- case BlendFunction.ReverseSubtract:
- return BlendEquationMode.FuncReverseSubtract;
-
- case BlendFunction.Min:
- return BlendEquationMode.Min;
-
- case BlendFunction.Max:
- return BlendEquationMode.Max;
- }
-
- throw new ArgumentException("Unable to translate BlendFunction '" +
- func + "' to OpenGL BlendEquationMode.");
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs b/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs
deleted file mode 100644
index 653e2d74..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/Creator.cs
+++ /dev/null
@@ -1,347 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Collections.ObjectModel;
-using System.IO;
-using ANX.Framework;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using ANX.Framework.NonXNA.Development;
-using ANX.Framework.NonXNA.RenderSystem;
-using ANX.Framework.Windows.GL3;
-using OpenTK;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- [PercentageComplete(90)]
- [TestState(TestStateAttribute.TestState.Untested)]
- [Developer("AstrorEnales")]
- public class Creator : IRenderSystemCreator
- {
- #region Public
- public string Name
- {
- get
- {
- return "OpenGL3";
- }
- }
-
- public int Priority
- {
- get
- {
- return 100;
- }
- }
-
- public bool IsSupported
- {
- get
- {
- //TODO: this is just a very basic version of test for support
- PlatformName os = OSInformation.GetName();
- return OSInformation.IsWindows ||
- os == PlatformName.Linux ||
- os == PlatformName.MacOSX;
- }
- }
-
- public EffectSourceLanguage GetStockShaderSourceLanguage
- {
- get
- {
- return EffectSourceLanguage.GLSL_FX;
- }
- }
- #endregion
-
- #region CreateEffect
- public INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect,
- Stream byteCode)
- {
- AddInSystemFactory.Instance.PreventSystemChange(
- AddInType.RenderSystem);
-
- return new EffectGL3(managedEffect, byteCode);
- }
-
- public INativeEffect CreateEffect(GraphicsDevice graphics, Effect managedEffect,
- Stream vertexShaderByteCode, Stream pixelShaderByteCode)
- {
- AddInSystemFactory.Instance.PreventSystemChange(
- AddInType.RenderSystem);
-
- return new EffectGL3(managedEffect, vertexShaderByteCode, pixelShaderByteCode);
- }
- #endregion
-
- #region CreateGraphicsDevice
- INativeGraphicsDevice IRenderSystemCreator.CreateGraphicsDevice(PresentationParameters presentationParameters)
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new GraphicsDeviceWindowsGL3(presentationParameters);
- }
- #endregion
-
- #region CreateTexture
- ///
- /// Create a new native texture.
- ///
- /// Graphics device.
- /// The format of the texture.
- /// The width of the texture.
- /// The height of the texture.
- /// The number of mipmaps in the texture.
- ///
- public INativeTexture2D CreateTexture(GraphicsDevice graphics,
- SurfaceFormat surfaceFormat, int width, int height, int mipCount)
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new Texture2DGL3(surfaceFormat, width, height, mipCount);
- }
- #endregion
-
- #region CreateIndexBuffer
- ///
- /// Create a native index buffer.
- ///
- /// The current graphics device.
- /// The size of a single index element.
- /// The number of indices stored in the buffer.
- ///
- /// The usage type of the buffer.
- /// Native OpenGL index buffer.
- public INativeIndexBuffer CreateIndexBuffer(GraphicsDevice graphics,
- IndexBuffer managedBuffer, IndexElementSize size, int indexCount,
- BufferUsage usage)
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new IndexBufferGL3(managedBuffer, size, indexCount, usage);
- }
- #endregion
-
- #region CreateVertexBuffer
- ///
- /// Create a native vertex buffer.
- ///
- /// The current graphics device.
- /// The vertex declaration for the buffer.
- /// The number of vertices stored in the buffer.
- ///
- /// The usage type of the buffer.
- /// Native OpenGL vertex buffer.
- public INativeVertexBuffer CreateVertexBuffer(GraphicsDevice graphics,
- VertexBuffer managedBuffer, VertexDeclaration vertexDeclaration,
- int vertexCount, BufferUsage usage)
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new VertexBufferGL3(managedBuffer, vertexDeclaration, vertexCount,
- usage);
- }
- #endregion
-
-#if XNAEXT
- #region CreateConstantBuffer (TODO)
- public INativeConstantBuffer CreateConstantBuffer(GraphicsDevice graphics, ConstantBuffer managedBuffer,
- BufferUsage usage)
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
-
- throw new NotImplementedException();
- }
- #endregion
-#endif
-
- #region CreateBlendState
- ///
- /// Create a new native blend state.
- ///
- /// Native Blend State.
- public INativeBlendState CreateBlendState()
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new BlendStateGL3();
- }
- #endregion
-
- #region CreateBlendState
- ///
- /// Create a new native rasterizer state.
- ///
- /// Native Rasterizer State.
- public INativeRasterizerState CreateRasterizerState()
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new RasterizerStateGL3();
- }
- #endregion
-
- #region CreateDepthStencilState
- ///
- /// Create a new native Depth Stencil State.
- ///
- /// Native Depth Stencil State.
- public INativeDepthStencilState CreateDepthStencilState()
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new DepthStencilStateGL3();
- }
- #endregion
-
- #region CreateSamplerState
- ///
- /// Create a new native sampler state.
- ///
- /// Native Sampler State.
- public INativeSamplerState CreateSamplerState()
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new SamplerStateGL3();
- }
- #endregion
-
- #region GetShaderByteCode
- ///
- /// Get the byte code of a pre defined shader.
- ///
- /// Pre defined shader type.
- /// Byte code of the shader.
- public byte[] GetShaderByteCode(PreDefinedShader type)
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
-
- if (type == PreDefinedShader.SpriteBatch)
- {
- return ShaderByteCode.SpriteBatchByteCode;
- }
- else if (type == PreDefinedShader.AlphaTestEffect)
- {
- return ShaderByteCode.AlphaTestEffectByteCode;
- }
- else if (type == PreDefinedShader.BasicEffect)
- {
- return ShaderByteCode.BasicEffectByteCode;
- }
- else if (type == PreDefinedShader.DualTextureEffect)
- {
- return ShaderByteCode.DualTextureEffectByteCode;
- }
- else if (type == PreDefinedShader.EnvironmentMapEffect)
- {
- return ShaderByteCode.EnvironmentMapEffectByteCode;
- }
- else if (type == PreDefinedShader.SkinnedEffect)
- {
- return ShaderByteCode.SkinnedEffectByteCode;
- }
-
- throw new NotImplementedException("ByteCode for '" + type.ToString() + "' is not yet available");
- }
- #endregion
-
- #region GetAdapterList (TODO)
- ///
- /// Get a list of available graphics adapter information.
- ///
- /// List of graphics adapters.
- public ReadOnlyCollection GetAdapterList()
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
-
- var result = new List();
- foreach (DisplayDevice device in DisplayDevice.AvailableDisplays)
- {
- var displayModeCollection = new DisplayModeCollection();
- foreach (string format in Enum.GetNames(typeof(SurfaceFormat)))
- {
- SurfaceFormat surfaceFormat =
- (SurfaceFormat)Enum.Parse(typeof(SurfaceFormat), format);
-
- // TODO: device.BitsPerPixel
- if (surfaceFormat != SurfaceFormat.Color)//adapter.Supports(surfaceFormat) == false)
- {
- continue;
- }
-
- var modes = new List();
-
- foreach (DisplayResolution res in device.AvailableResolutions)
- {
- float aspect = (float)res.Width / (float)res.Height;
- modes.Add(new DisplayMode
- {
- AspectRatio = aspect,
- Width = res.Width,
- Height = res.Height,
- TitleSafeArea = new Rectangle(0, 0, res.Width, res.Height),
- Format = surfaceFormat,
- });
- }
-
- displayModeCollection[surfaceFormat] = modes.ToArray();
- }
-
- GraphicsAdapter newAdapter = new GraphicsAdapter
- {
- SupportedDisplayModes = displayModeCollection,
- IsDefaultAdapter = device.IsPrimary,
-
- // TODO:
- DeviceId = 0,
- DeviceName = "",
- Revision = 0,
- SubSystemId = 0,
- VendorId = 0,
- };
-
- result.Add(newAdapter);
- }
-
- return new ReadOnlyCollection(result);
- }
- #endregion
-
- #region CreateRenderTarget
- public INativeRenderTarget2D CreateRenderTarget(GraphicsDevice graphics,
- int width, int height, bool mipMap, SurfaceFormat preferredFormat,
- DepthFormat preferredDepthFormat, int preferredMultiSampleCount,
- RenderTargetUsage usage)
- {
- AddInSystemFactory.Instance.PreventSystemChange(AddInType.RenderSystem);
- return new RenderTarget2DGL3(width, height, mipMap, preferredFormat,
- preferredDepthFormat, preferredMultiSampleCount, usage);
- }
- #endregion
-
- #region IsLanguageSupported
- public bool IsLanguageSupported(EffectSourceLanguage sourceLanguage)
- {
- return sourceLanguage == EffectSourceLanguage.GLSL_FX || sourceLanguage == EffectSourceLanguage.GLSL;
- }
- #endregion
-
- #region CreateOcclusionQuery
- public IOcclusionQuery CreateOcclusionQuery()
- {
- return new OcclusionQueryGL3();
- }
- #endregion
-
- #region SetTextureSampler (TODO)
- public void SetTextureSampler(int index, Texture value)
- {
- TextureUnit textureUnit = TextureUnit.Texture0 + index;
- GL.ActiveTexture(textureUnit);
- int handle = (value.NativeTexture as Texture2DGL3).NativeHandle;
- GL.BindTexture(TextureTarget.Texture2D, handle);
- int unitIndex = (int)(textureUnit - TextureUnit.Texture0);
- //GL.Uniform1(UniformIndex, 1, ref unitIndex);
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/DepthStencilStateGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/DepthStencilStateGL3.cs
deleted file mode 100644
index 0aaf8ccc..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/DepthStencilStateGL3.cs
+++ /dev/null
@@ -1,400 +0,0 @@
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using ANX.Framework.NonXNA.Development;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native Depth Stencil State object for OpenGL.
- ///
- /// Basically this is a wrapper class for setting the different values all
- /// at once, because OpenGL has no State objects like DirectX.
- ///
- [PercentageComplete(100)]
- [TestStateAttribute(TestStateAttribute.TestState.Untested)]
- public class DepthStencilStateGL3 : INativeDepthStencilState
- {
- #region Private
- internal static DepthStencilStateGL3 Current
- {
- get;
- private set;
- }
- #endregion
-
- #region Public
- #region IsBound
- ///
- /// Flag if the state object is bound to the device.
- ///
- public bool IsBound
- {
- get;
- private set;
- }
- #endregion
-
- #region DepthBufferEnable
- public bool DepthBufferEnable
- {
- set;
- private get;
- }
- #endregion
-
- #region DepthBufferFunction
- public CompareFunction DepthBufferFunction
- {
- set;
- private get;
- }
- #endregion
-
- #region DepthBufferWriteEnable
- public bool DepthBufferWriteEnable
- {
- set;
- private get;
- }
- #endregion
-
- #region StencilEnable
- public bool StencilEnable
- {
- set;
- private get;
- }
- #endregion
-
- #region StencilFunction
- public CompareFunction StencilFunction
- {
- set;
- private get;
- }
- #endregion
-
- #region StencilMask
- public int StencilMask
- {
- set;
- private get;
- }
- #endregion
-
- #region StencilDepthBufferFail
- public StencilOperation StencilDepthBufferFail
- {
- set;
- private get;
- }
- #endregion
-
- #region StencilFail
- public StencilOperation StencilFail
- {
- set;
- private get;
- }
- #endregion
-
- #region StencilPass
- public StencilOperation StencilPass
- {
- set;
- private get;
- }
- #endregion
-
- #region CounterClockwiseStencilDepthBufferFail
- public StencilOperation CounterClockwiseStencilDepthBufferFail
- {
- set;
- private get;
- }
- #endregion
-
- #region CounterClockwiseStencilFail
- public StencilOperation CounterClockwiseStencilFail
- {
- set;
- private get;
- }
- #endregion
-
- #region CounterClockwiseStencilFunction
- public CompareFunction CounterClockwiseStencilFunction
- {
- set;
- private get;
- }
- #endregion
-
- #region CounterClockwiseStencilPass
- public StencilOperation CounterClockwiseStencilPass
- {
- set;
- private get;
- }
- #endregion
-
- #region TwoSidedStencilMode
- public bool TwoSidedStencilMode
- {
- set;
- private get;
- }
- #endregion
-
- #region ReferenceStencil
- public int ReferenceStencil
- {
- set;
- private get;
- }
- #endregion
-
- #region StencilWriteMask
- public int StencilWriteMask
- {
- set;
- private get;
- }
- #endregion
- #endregion
-
- #region Constructor
- ///
- /// Create a new depth stencil state object.
- ///
- internal DepthStencilStateGL3()
- {
- IsBound = false;
- }
- #endregion
-
- #region Apply
- ///
- /// Apply the depth stencil state to the graphics device.
- ///
- /// The current graphics device.
- public void Apply(GraphicsDevice graphicsDevice)
- {
- IsBound = true;
- Current = this;
-
- #region Depth
- if (DepthBufferEnable)
- {
- GL.Enable(EnableCap.DepthTest);
- }
- else
- {
- GL.Disable(EnableCap.DepthTest);
- }
- ErrorHelper.Check("DepthTest");
-
- GL.DepthFunc(TranslateDepthFunction(DepthBufferFunction));
- ErrorHelper.Check("DepthFunc");
-
- GL.DepthMask(DepthBufferWriteEnable);
- ErrorHelper.Check("DepthMask");
- #endregion
-
- #region Stencil
- if (StencilEnable)
- {
- GL.Enable(EnableCap.StencilTest);
- }
- else
- {
- GL.Disable(EnableCap.StencilTest);
- }
- ErrorHelper.Check("StencilTest");
-
- GL.StencilMask(StencilWriteMask);
- ErrorHelper.Check("StencilMask");
-
- if (TwoSidedStencilMode)
- {
- GL.StencilOpSeparate(StencilFace.Front,
- TranslateStencilOp(StencilFail),
- TranslateStencilOp(StencilDepthBufferFail),
- TranslateStencilOp(StencilPass));
- ErrorHelper.Check("StencilOpSeparate Front");
-
- GL.StencilOpSeparate(StencilFace.Back,
- TranslateStencilOp(CounterClockwiseStencilFail),
- TranslateStencilOp(CounterClockwiseStencilDepthBufferFail),
- TranslateStencilOp(CounterClockwiseStencilPass));
- ErrorHelper.Check("StencilOpSeparate Back");
-
- GL.StencilFuncSeparate(StencilFace.Front,
- TranslateStencilFunction(StencilFunction),
- ReferenceStencil, StencilMask);
- ErrorHelper.Check("StencilFuncSeparate Front");
-
- GL.StencilFuncSeparate(StencilFace.Back,
- TranslateStencilFunction(CounterClockwiseStencilFunction),
- ReferenceStencil, StencilMask);
- ErrorHelper.Check("StencilFuncSeparate Back");
- }
- else
- {
- GL.StencilOp(
- TranslateStencilOp(StencilFail),
- TranslateStencilOp(StencilDepthBufferFail),
- TranslateStencilOp(StencilPass));
- ErrorHelper.Check("StencilOp");
-
- GL.StencilFunc(TranslateStencilFunction(StencilFunction),
- ReferenceStencil, StencilMask);
- ErrorHelper.Check("StencilFunc");
- }
- #endregion
- }
- #endregion
-
- #region TranslateStencilOp
- ///
- /// Translate the ANX stencil operation to OpenGL.
- ///
- /// ANX stencil operation.
- /// Translated OpenGL stencil operation.
- private OpenTK.Graphics.OpenGL.StencilOp TranslateStencilOp(
- StencilOperation operation)
- {
- switch (operation)
- {
- default:
- case StencilOperation.Decrement:
- return StencilOp.Decr;
-
- case StencilOperation.DecrementSaturation:
- return StencilOp.DecrWrap;
-
- case StencilOperation.Increment:
- return StencilOp.Incr;
-
- case StencilOperation.IncrementSaturation:
- return StencilOp.IncrWrap;
-
- case StencilOperation.Invert:
- return StencilOp.Invert;
-
- case StencilOperation.Keep:
- return StencilOp.Keep;
-
- case StencilOperation.Replace:
- return StencilOp.Replace;
-
- case StencilOperation.Zero:
- return StencilOp.Zero;
- }
- }
- #endregion
-
- #region TranslateDepthFunction
- ///
- /// Translate the ANX compare function to the OpenGL depth function.
- ///
- /// ANX compare function.
- /// Translated OpenGL depth function.
- private OpenTK.Graphics.OpenGL.DepthFunction TranslateDepthFunction(
- CompareFunction func)
- {
- switch (func)
- {
- default:
- case CompareFunction.Always:
- return OpenTK.Graphics.OpenGL.DepthFunction.Always;
-
- case CompareFunction.Equal:
- return OpenTK.Graphics.OpenGL.DepthFunction.Equal;
-
- case CompareFunction.Greater:
- return OpenTK.Graphics.OpenGL.DepthFunction.Greater;
-
- case CompareFunction.GreaterEqual:
- return OpenTK.Graphics.OpenGL.DepthFunction.Gequal;
-
- case CompareFunction.Less:
- return OpenTK.Graphics.OpenGL.DepthFunction.Less;
-
- case CompareFunction.LessEqual:
- return OpenTK.Graphics.OpenGL.DepthFunction.Lequal;
-
- case CompareFunction.Never:
- return OpenTK.Graphics.OpenGL.DepthFunction.Never;
-
- case CompareFunction.NotEqual:
- return OpenTK.Graphics.OpenGL.DepthFunction.Notequal;
- }
- }
- #endregion
-
- #region TranslateStencilFunction
- ///
- /// Translate the ANX compare function to the OpenGL stencil function.
- ///
- /// ANX compare function.
- /// Translated OpenGL stencil function.
- private OpenTK.Graphics.OpenGL.StencilFunction TranslateStencilFunction(
- CompareFunction func)
- {
- switch (func)
- {
- default:
- case CompareFunction.Always:
- return OpenTK.Graphics.OpenGL.StencilFunction.Always;
-
- case CompareFunction.Equal:
- return OpenTK.Graphics.OpenGL.StencilFunction.Equal;
-
- case CompareFunction.Greater:
- return OpenTK.Graphics.OpenGL.StencilFunction.Greater;
-
- case CompareFunction.GreaterEqual:
- return OpenTK.Graphics.OpenGL.StencilFunction.Gequal;
-
- case CompareFunction.Less:
- return OpenTK.Graphics.OpenGL.StencilFunction.Less;
-
- case CompareFunction.LessEqual:
- return OpenTK.Graphics.OpenGL.StencilFunction.Lequal;
-
- case CompareFunction.Never:
- return OpenTK.Graphics.OpenGL.StencilFunction.Never;
-
- case CompareFunction.NotEqual:
- return OpenTK.Graphics.OpenGL.StencilFunction.Notequal;
- }
- }
- #endregion
-
- #region Release
- ///
- /// Release the depth stencil state.
- ///
- public void Release()
- {
- IsBound = false;
- Current = null;
- }
- #endregion
-
- #region Dispose
- ///
- /// Dispose the depth stencil state object.
- ///
- public void Dispose()
- {
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/EffectGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/EffectGL3.cs
deleted file mode 100644
index a09ffcea..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/EffectGL3.cs
+++ /dev/null
@@ -1,298 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using ANX.RenderSystem.Windows.GL3.Helpers;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native OpenGL Effect implementation.
- /// http://wiki.delphigl.com/index.php/Tutorial_glsl
- ///
- public class EffectGL3 : INativeEffect
- {
- #region Private
- private Effect managedEffect;
- private ShaderData shaderData;
- private List parameters;
- private List techniques;
- internal bool IsDisposed;
-
- internal EffectTechniqueGL3 CurrentTechnique
- {
- get
- {
- if (managedEffect.CurrentTechnique == null)
- return null;
-
- return managedEffect.CurrentTechnique.NativeTechnique as EffectTechniqueGL3;
- }
- }
- #endregion
-
- #region Public
- #region Techniques
- public IEnumerable Techniques
- {
- get
- {
- if (techniques.Count == 0)
- {
- Compile();
- }
-
- return techniques;
- }
- }
- #endregion
-
- #region Parameters
- public IEnumerable Parameters
- {
- get
- {
- if (techniques.Count == 0)
- {
- Compile();
- }
-
- return parameters;
- }
- }
- #endregion
- #endregion
-
- #region Constructor
- ///
- /// Private helper constructor for the basic initialization.
- ///
- private EffectGL3(Effect setManagedEffect)
- {
- GraphicsResourceManager.UpdateResource(this, true);
-
- parameters = new List();
- techniques = new List();
- managedEffect = setManagedEffect;
- }
-
- ~EffectGL3()
- {
- GraphicsResourceManager.UpdateResource(this, false);
- }
-
- ///
- /// Create a new effect instance of separate streams.
- ///
- /// The vertex shader code.
- /// The fragment shader code.
- public EffectGL3(Effect setManagedEffect, Stream vertexShaderByteCode, Stream pixelShaderByteCode)
- : this(setManagedEffect)
- {
-// TODO: this is probably not right!
- throw new NotImplementedException("TODO: implement effect constructor with vertex and fragment streams, check HOWTO...");
- //CreateShader(ShaderHelper.LoadShaderCode(vertexShaderByteCode),
- // ShaderHelper.LoadShaderCode(pixelShaderByteCode));
- }
-
- ///
- /// Create a new effect instance of one streams.
- ///
- /// The byte code of the shader.
- public EffectGL3(Effect setManagedEffect, Stream byteCode)
- : this(setManagedEffect)
- {
- string source = ShaderHelper.LoadShaderCode(byteCode);
- shaderData = ShaderHelper.ParseShaderCode(source);
- }
- #endregion
-
- #region RecreateData
- internal void RecreateData()
- {
- Compile();
- }
- #endregion
-
- #region Compile
- private void Compile()
- {
- parameters.Clear();
- techniques.Clear();
- Dictionary vertexShaders = new Dictionary();
- Dictionary fragmentShaders = new Dictionary();
- List parameterNames = new List();
-
- #region Compile vertex shaders
- foreach (string vertexName in shaderData.VertexShaderCodes.Keys)
- {
- string vertexSource = shaderData.VertexGlobalCode + shaderData.VertexShaderCodes[vertexName];
-
- int vertexShader = GL.CreateShader(ShaderType.VertexShader);
- string vertexError = CompileShader(vertexShader, vertexSource);
- if (String.IsNullOrEmpty(vertexError) == false)
- throw new InvalidDataException("Failed to compile the vertex shader '" + vertexName + "' cause of: " +
- vertexError);
-
- vertexShaders.Add(vertexName, vertexShader);
- }
- #endregion
-
- #region Compile fragment shaders
- foreach (string fragmentName in shaderData.FragmentShaderCodes.Keys)
- {
- string fragmentSource = shaderData.FragmentGlobalCode + shaderData.FragmentShaderCodes[fragmentName];
-
- int fragmentShader = GL.CreateShader(ShaderType.FragmentShader);
- string fragmentError = CompileShader(fragmentShader, fragmentSource);
- if (String.IsNullOrEmpty(fragmentError) == false)
- throw new InvalidDataException("Failed to compile the fragment shader '" + fragmentName + "' cause of: " +
- fragmentError);
-
- fragmentShaders.Add(fragmentName, fragmentShader);
- }
- #endregion
-
- #region Compile programs
- foreach (string programName in shaderData.Techniques.Keys)
- {
- string vertexName = shaderData.Techniques[programName].Key;
- string fragmentName = shaderData.Techniques[programName].Value;
-
- int programHandle = GL.CreateProgram();
- ErrorHelper.Check("CreateProgram");
- GL.AttachShader(programHandle, vertexShaders[vertexName]);
- ErrorHelper.Check("AttachShader vertexShader");
- GL.AttachShader(programHandle, fragmentShaders[fragmentName]);
- ErrorHelper.Check("AttachShader fragmentShader");
- GL.LinkProgram(programHandle);
-
- int result;
- GL.GetProgram(programHandle, ProgramParameter.LinkStatus, out result);
- if (result == 0)
- {
- string programError;
- GL.GetProgramInfoLog(programHandle, out programError);
- throw new InvalidDataException("Failed to link the shader program '" +
- programName + "' because of: " + programError);
- }
-
- EffectTechniqueGL3 technique = new EffectTechniqueGL3(managedEffect, programName, programHandle);
- techniques.Add(new EffectTechnique(managedEffect, technique));
- AddParametersFrom(programHandle, parameterNames, technique);
- }
- #endregion
- }
- #endregion
-
- #region CompileShader
- private string CompileShader(int shader, string source)
- {
- GL.ShaderSource(shader, source);
- GL.CompileShader(shader);
-
- int result;
- GL.GetShader(shader, ShaderParameter.CompileStatus, out result);
- if (result == 0)
- {
- string error = "";
- GL.GetShaderInfoLog(shader, out error);
-
- GL.DeleteShader(shader);
-
- return error;
- }
-
- return null;
- }
- #endregion
-
- #region AddParametersFrom
- private void AddParametersFrom(int programHandle, List parameterNames,
- EffectTechniqueGL3 technique)
- {
- int uniformCount;
- GL.GetProgram(programHandle, ProgramParameter.ActiveUniforms,
- out uniformCount);
- ErrorHelper.Check("GetProgram ActiveUniforms");
-
- for (int index = 0; index < uniformCount; index++)
- {
- string name = GL.GetActiveUniformName(programHandle, index);
- ErrorHelper.Check("GetActiveUniformName name=" + name);
-
- if (parameterNames.Contains(name) == false)
- {
- parameterNames.Add(name);
- int uniformIndex = GL.GetUniformLocation(programHandle, name);
- ErrorHelper.Check("GetUniformLocation name=" + name +
- " uniformIndex=" + uniformIndex);
- parameters.Add(new EffectParameter()
- {
- NativeParameter =
- new EffectParameterGL3(technique, name, uniformIndex),
- });
- }
- }
- }
- #endregion
-
- #region Apply
- public void Apply(GraphicsDevice graphicsDevice)
- {
- GL.UseProgram(CurrentTechnique.programHandle);
- GraphicsDeviceWindowsGL3.activeEffect = this;
- ErrorHelper.Check("UseProgram");
- }
- #endregion
-
- #region Dispose
- ///
- /// Dispose the native shader data.
- ///
- public void Dispose()
- {
- if (IsDisposed == false)
- {
- IsDisposed = true;
- DisposeResource();
- }
- }
-
- internal void DisposeResource()
- {
- if (GraphicsDeviceWindowsGL3.IsContextCurrent == false)
- {
- return;
- }
-
- foreach (EffectTechnique technique in techniques)
- {
- int programHandle =
- (technique.NativeTechnique as EffectTechniqueGL3).programHandle;
-
- GL.DeleteProgram(programHandle);
- ErrorHelper.Check("DeleteProgram");
-
- int result;
- GL.GetProgram(programHandle, ProgramParameter.DeleteStatus, out result);
- if (result == 0)
- {
- string deleteError;
- GL.GetProgramInfoLog(programHandle, out deleteError);
- throw new Exception("Failed to delete the shader program '" +
- technique.Name + "' because of: " + deleteError);
- }
- }
- techniques.Clear();
- parameters.Clear();
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/EffectParameterGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/EffectParameterGL3.cs
deleted file mode 100644
index 3d5f2432..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/EffectParameterGL3.cs
+++ /dev/null
@@ -1,569 +0,0 @@
-using System;
-using ANX.Framework;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native OpenGL implementation of an effect parameter.
- ///
- public class EffectParameterGL3 : INativeEffectParameter
- {
- #region Private
- private EffectTechniqueGL3 parentTechnique;
- #endregion
-
- #region Public
- ///
- /// The name of the effect parameter.
- ///
- public string Name
- {
- get;
- private set;
- }
-
- ///
- /// The index of the uniform.
- ///
- public int UniformIndex
- {
- get;
- private set;
- }
- #endregion
-
- #region Constructor
- ///
- /// Create a ne effect parameter object.
- ///
- internal EffectParameterGL3(EffectTechniqueGL3 setParentTechnique,
- string setName, int setUniformIndex)
- {
- parentTechnique = setParentTechnique;
- Name = setName;
- UniformIndex = setUniformIndex;
- }
- #endregion
-
- #region SetValue
- #region SetValue (Matrix)
- ///
- /// Set a matrix value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Matrix value, bool transpose)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
-
- OpenTK.Matrix4 matrix = new OpenTK.Matrix4(
- value.M11, value.M12, value.M13, value.M14,
- value.M21, value.M22, value.M23, value.M24,
- value.M31, value.M32, value.M33, value.M34,
- value.M41, value.M42, value.M43, value.M44);
-
- GL.UniformMatrix4(UniformIndex, transpose, ref matrix);
- ErrorHelper.Check("UniformMatrix4");
- }
- #endregion
-
- #region SetValue (Matrix[])
- ///
- /// Set a Matrix array value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Matrix[] value, bool transpose)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- float[] array = new float[value.Length * 16];
- for (int index = 0; index < value.Length; index++)
- {
- array[(index * 16)] = value[index].M11;
- array[(index * 16) + 1] = value[index].M12;
- array[(index * 16) + 2] = value[index].M13;
- array[(index * 16) + 3] = value[index].M14;
- array[(index * 16) + 4] = value[index].M21;
- array[(index * 16) + 5] = value[index].M22;
- array[(index * 16) + 6] = value[index].M23;
- array[(index * 16) + 7] = value[index].M24;
- array[(index * 16) + 8] = value[index].M31;
- array[(index * 16) + 9] = value[index].M32;
- array[(index * 16) + 10] = value[index].M33;
- array[(index * 16) + 11] = value[index].M34;
- array[(index * 16) + 12] = value[index].M41;
- array[(index * 16) + 13] = value[index].M42;
- array[(index * 16) + 14] = value[index].M43;
- array[(index * 16) + 15] = value[index].M44;
- }
- GL.UniformMatrix4(UniformIndex, array.Length, transpose, array);
- ErrorHelper.Check("UniformMatrix4v");
- }
- #endregion
-
- #region SetValue (Texture)
- private Texture textureCache = null;
- ///
- /// Set a texture value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Texture value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- if (textureCache == null ||
- textureCache != value)
- {
- textureCache = value;
- // TODO: multiple texture units
- TextureUnit textureUnit = TextureUnit.Texture0;
- GL.ActiveTexture(textureUnit);
- ErrorHelper.Check("ActiveTexture");
- int handle = (value.NativeTexture as Texture2DGL3).NativeHandle;
- GL.BindTexture(TextureTarget.Texture2D, handle);
- ErrorHelper.Check("BindTexture");
- int unitIndex = (int)(textureUnit - TextureUnit.Texture0);
- GL.Uniform1(UniformIndex, 1, ref unitIndex);
- ErrorHelper.Check("Uniform1");
- }
- }
- #endregion
-
- #region SetValue (int)
- ///
- /// Set an int value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(int value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform1(UniformIndex, value);
- ErrorHelper.Check("Uniform1i");
- }
- #endregion
-
- #region SetValue (int[])
- ///
- /// Set an int array value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(int[] value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform1(UniformIndex, value.Length, value);
- ErrorHelper.Check("Uniform1iv");
- }
- #endregion
-
- #region SetValue (float)
- ///
- /// Set a float value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(float value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform1(UniformIndex, value);
- ErrorHelper.Check("Uniform1f");
- }
- #endregion
-
- #region SetValue (float[])
- ///
- /// Set a float array value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(float[] value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform1(UniformIndex, value.Length, value);
- ErrorHelper.Check("Uniform1fv");
- }
- #endregion
-
- #region SetValue (Vector2)
- ///
- /// Set a Vector2 value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Vector2 value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform2(UniformIndex, value.X, value.Y);
- ErrorHelper.Check("Uniform2f");
- }
- #endregion
-
- #region SetValue (Vector2[])
- ///
- /// Set a Vector2 array value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Vector2[] value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- float[] array = new float[value.Length * 2];
- for(int index = 0; index < value.Length; index++)
- {
- array[(index * 2)] = value[index].X;
- array[(index * 2) + 1] = value[index].Y;
- }
- GL.Uniform2(UniformIndex, array.Length, array);
- ErrorHelper.Check("Uniform2fv");
- }
- #endregion
-
- #region SetValue (Vector3)
- ///
- /// Set a Vector3 value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Vector3 value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform3(UniformIndex, value.X, value.Y, value.Z);
- ErrorHelper.Check("Uniform3f");
- }
- #endregion
-
- #region SetValue (Vector3[])
- ///
- /// Set a Vector3 array value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Vector3[] value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- float[] array = new float[value.Length * 3];
- for (int index = 0; index < value.Length; index++)
- {
- array[(index * 3)] = value[index].X;
- array[(index * 3) + 1] = value[index].Y;
- array[(index * 3) + 2] = value[index].Z;
- }
- GL.Uniform3(UniformIndex, array.Length, array);
- ErrorHelper.Check("Uniform3fv");
- }
- #endregion
-
- #region SetValue (Vector4)
- ///
- /// Set a Vector4 value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Vector4 value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform4(UniformIndex, value.X, value.Y, value.Z, value.W);
- ErrorHelper.Check("Uniform4f");
- }
- #endregion
-
- #region SetValue (Vector4[])
- ///
- /// Set a Vector4 array value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Vector4[] value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- float[] array = new float[value.Length * 4];
- for (int index = 0; index < value.Length; index++)
- {
- array[(index * 4)] = value[index].X;
- array[(index * 4) + 1] = value[index].Y;
- array[(index * 4) + 2] = value[index].Z;
- array[(index * 4) + 3] = value[index].W;
- }
- GL.Uniform4(UniformIndex, array.Length, array);
- ErrorHelper.Check("Uniform4fv");
- }
- #endregion
-
- #region SetValue (bool)
- ///
- /// Set a bool value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(bool value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform1(UniformIndex, value ? 1 : 0);
- ErrorHelper.Check("Uniform4f");
- }
- #endregion
-
- #region SetValue (bool[])
- ///
- /// Set a bool array value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(bool[] value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- int[] glBooleans = new int[value.Length];
- for (int index = 0; index < value.Length; index++)
- {
- glBooleans[index] = value[index] ? 1 : 0;
- }
- GL.Uniform1(UniformIndex, value.Length, glBooleans);
- ErrorHelper.Check("Uniform1iv");
- }
- #endregion
-
- #region SetValue (Quaternion)
- ///
- /// Set a Quaternion value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Quaternion value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- GL.Uniform4(UniformIndex, value.X, value.Y, value.Z, value.W);
- ErrorHelper.Check("Uniform4f");
- }
- #endregion
-
- #region SetValue (Quaternion[])
- ///
- /// Set a Quaternion array value to the effect parameter.
- ///
- /// Value for the parameter
- public void SetValue(Quaternion[] value)
- {
- GL.UseProgram(parentTechnique.programHandle);
- ErrorHelper.Check("UseProgram");
- float[] array = new float[value.Length * 4];
- for (int index = 0; index < value.Length; index++)
- {
- array[(index * 4)] = value[index].X;
- array[(index * 4) + 1] = value[index].Y;
- array[(index * 4) + 2] = value[index].Z;
- array[(index * 4) + 3] = value[index].W;
- }
- GL.Uniform4(UniformIndex, array.Length, array);
- ErrorHelper.Check("Uniform4fv");
- }
- #endregion
-
- #region SetValue (string, TODO)
- public void SetValue(string value)
- {
- throw new NotImplementedException();
- }
- #endregion
- #endregion
-
- #region GetValue
- #region GetValueBoolean
- public bool GetValueBoolean()
- {
- int result;
- GL.GetUniform(parentTechnique.programHandle, UniformIndex, out result);
- ErrorHelper.Check("GetUniform");
- return result == 1;
- }
- #endregion
-
- #region GetValueBooleanArray (TODO)
- public bool[] GetValueBooleanArray(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueInt32
- public int GetValueInt32()
- {
- int result;
- GL.GetUniform(parentTechnique.programHandle, UniformIndex, out result);
- ErrorHelper.Check("GetUniform");
- return result;
- }
- #endregion
-
- #region GetValueInt32Array (TODO)
- public int[] GetValueInt32Array(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueMatrix (TODO)
- public Matrix GetValueMatrix()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueMatrixArray (TODO)
- public Matrix[] GetValueMatrixArray(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueMatrixTranspose (TODO)
- public Matrix GetValueMatrixTranspose()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueMatrixTransposeArray (TODO)
- public Matrix[] GetValueMatrixTransposeArray(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueQuaternion (TODO)
- public Quaternion GetValueQuaternion()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueQuaternionArray (TODO)
- public Quaternion[] GetValueQuaternionArray(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueSingle
- public float GetValueSingle()
- {
- float result;
- GL.GetUniform(parentTechnique.programHandle, UniformIndex, out result);
- ErrorHelper.Check("GetUniform");
- return result;
- }
- #endregion
-
- #region GetValueSingleArray (TODO)
- public float[] GetValueSingleArray(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueString (TODO)
- public string GetValueString()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueTexture2D (TODO)
- public Texture2D GetValueTexture2D()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueTexture3D (TODO)
- public Texture3D GetValueTexture3D()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueTextureCube (TODO)
- public TextureCube GetValueTextureCube()
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueVector2
- public Vector2 GetValueVector2()
- {
- float[] result = new float[2];
- unsafe
- {
- fixed (float* ptr = &result[0])
- {
- GL.GetUniform(parentTechnique.programHandle, UniformIndex, ptr);
- }
- }
- ErrorHelper.Check("GetUniform");
- return new Vector2(result[0], result[1]);
- }
- #endregion
-
- #region GetValueVector2Array (TODO)
- public Vector2[] GetValueVector2Array(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueVector3
- public Vector3 GetValueVector3()
- {
- float[] result = new float[3];
- unsafe
- {
- fixed (float* ptr = &result[0])
- {
- GL.GetUniform(parentTechnique.programHandle, UniformIndex, ptr);
- }
- }
- ErrorHelper.Check("GetUniform");
- return new Vector3(result[0], result[1], result[2]);
- }
- #endregion
-
- #region GetValueVector3Array (TODO)
- public Vector3[] GetValueVector3Array(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetValueVector4
- public Vector4 GetValueVector4()
- {
- float[] result = new float[4];
- unsafe
- {
- fixed (float* ptr = &result[0])
- {
- GL.GetUniform(parentTechnique.programHandle, UniformIndex, ptr);
- }
- }
- ErrorHelper.Check("GetUniform");
- return new Vector4(result[0], result[1], result[2], result[3]);
- }
- #endregion
-
- #region GetValueVector4Array (TODO)
- public Vector4[] GetValueVector4Array(int count)
- {
- throw new NotImplementedException();
- }
- #endregion
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/EffectPassGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/EffectPassGL3.cs
deleted file mode 100644
index d5e38d00..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/EffectPassGL3.cs
+++ /dev/null
@@ -1,20 +0,0 @@
-using System;
-using ANX.Framework.NonXNA;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- public class EffectPassGL3 : INativeEffectPass
- {
- public string Name
- {
- get
- {
- return "p0";
- }
- }
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/EffectTechniqueGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/EffectTechniqueGL3.cs
deleted file mode 100644
index e4e45266..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/EffectTechniqueGL3.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-using System.Collections.Generic;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native OpenGL implementation of an effect technique.
- ///
- public class EffectTechniqueGL3 : INativeEffectTechnique
- {
- #region Private
- ///
- /// The native shader handle.
- ///
- internal int programHandle;
-
- ///
- /// The active attributes of this technique.
- ///
- internal ShaderAttributeGL3[] activeAttributes;
-
- ///
- /// We currently have only one pass per technique.
- ///
- private EffectPass pass;
-
- private Effect parentEffect;
- #endregion
-
- #region Public
- ///
- /// The name of the effect technique.
- ///
- public string Name
- {
- get;
- private set;
- }
-
- ///
- /// The passes of the technique.
- ///
- public IEnumerable Passes
- {
- get
- {
- yield return pass;
- }
- }
- #endregion
-
- #region Constructor
- ///
- /// Create a ne effect technique object.
- ///
- internal EffectTechniqueGL3(Effect setParentEffect, string setName, int setProgramHandle)
- {
- parentEffect = setParentEffect;
- Name = setName;
- programHandle = setProgramHandle;
-
- GetAttributes();
-
- pass = new EffectPass(parentEffect);
- }
- #endregion
-
- #region GetAttributes
- private void GetAttributes()
- {
- int attributeCount;
- GL.GetProgram(programHandle, ProgramParameter.ActiveAttributes,
- out attributeCount);
- activeAttributes = new ShaderAttributeGL3[attributeCount];
- for (int index = 0; index < attributeCount; index++)
- {
- activeAttributes[index] = new ShaderAttributeGL3(programHandle, index);
- }
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ErrorHelper.cs b/RenderSystems/ANX.Framework.Windows.GL3/ErrorHelper.cs
deleted file mode 100644
index 420af7c8..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ErrorHelper.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System.Diagnostics;
-using System.Reflection;
-using ANX.Framework.NonXNA;
-using OpenTK.Graphics.OpenGL;
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- internal static class ErrorHelper
- {
- public static void Check(string extraInformation = "")
- {
- ErrorCode code = GL.GetError();
- if (code != ErrorCode.NoError)
- {
- string frameInfo = "";
- foreach (StackFrame frame in new StackTrace().GetFrames())
- {
- MethodBase method = frame.GetMethod();
- frameInfo += "\n\t" + "at " + method.DeclaringType + "." +
- method + ":" + frame.GetFileLineNumber();
- }
-
- string message = "OpenGL Error '" + code + "' Checked at: '" +
- extraInformation + "'" + frameInfo;
-
- Logger.Info(message);
- }
- }
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/GraphicsDeviceWindowsGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/GraphicsDeviceWindowsGL3.cs
deleted file mode 100644
index 227e8430..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/GraphicsDeviceWindowsGL3.cs
+++ /dev/null
@@ -1,458 +0,0 @@
-using System;
-using ANX.Framework;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using ANX.RenderSystem.Windows.GL3.Helpers;
-using OpenTK.Graphics;
-using OpenTK.Graphics.OpenGL;
-using OpenTK.Platform;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- public class GraphicsDeviceWindowsGL3 : INativeGraphicsDevice
- {
- #region Constants
- private const float ColorMultiplier = 1f / 255f;
- #endregion
-
- #region Private
- private GraphicsContext nativeContext;
- private IWindowInfo nativeWindowInfo;
- private GraphicsMode graphicsMode;
-
- private int cachedVersionMinor = -1;
- private int cachedVersionMajor = -1;
-
- internal static VertexBufferGL3[] boundVertexBuffers;
- private static RenderTarget2DGL3[] boundRenderTargets;
- internal static IndexBufferGL3 boundIndexBuffer;
- internal static EffectGL3 activeEffect;
-
- internal static GraphicsDeviceWindowsGL3 Current
- {
- get;
- private set;
- }
-
- internal static bool IsContextCurrent
- {
- get
- {
- return (Current == null || Current.nativeContext == null) ? false : Current.nativeContext.IsCurrent;
- }
- }
- #endregion
-
- #region Public
- #region VSync
- public bool VSync
- {
- get
- {
- return nativeContext.VSync;
- }
- set
- {
- nativeContext.VSync = value;
- }
- }
- #endregion
- #endregion
-
- #region Constructor
- internal GraphicsDeviceWindowsGL3(PresentationParameters presentationParameters)
- {
- Current = this;
- ResetDevice(presentationParameters);
- }
- #endregion
-
- #region ResetDevice
- private void ResetDevice(PresentationParameters presentationParameters)
- {
- if (nativeContext != null)
- Dispose();
-
- boundVertexBuffers = new VertexBufferGL3[0];
- boundRenderTargets = new RenderTarget2DGL3[0];
- boundIndexBuffer = null;
- activeEffect = null;
-
- int depth = 0;
- int stencil = 0;
- switch (presentationParameters.DepthStencilFormat)
- {
- case DepthFormat.None:
- break;
-
- case DepthFormat.Depth16:
- depth = 16;
- break;
-
- case DepthFormat.Depth24:
- depth = 24;
- break;
-
- case DepthFormat.Depth24Stencil8:
- depth = 24;
- stencil = 8;
- break;
- }
-
- ResizeRenderWindow(presentationParameters);
-
- var colorFormat = DatatypesMapping.SurfaceToColorFormat(presentationParameters.BackBufferFormat);
- graphicsMode = new GraphicsMode(colorFormat, depth, stencil, presentationParameters.MultiSampleCount);
-
- CreateWindowInfo(presentationParameters.DeviceWindowHandle, graphicsMode.Index.Value);
-
- nativeContext = new GraphicsContext(graphicsMode, nativeWindowInfo);
- nativeContext.MakeCurrent(nativeWindowInfo);
- nativeContext.LoadAll();
-
- LogOpenGLInformation();
-
- GL.Viewport(0, 0, presentationParameters.BackBufferWidth, presentationParameters.BackBufferHeight);
-
- GraphicsResourceManager.RecreateAllResources();
- }
- #endregion
-
- #region LogOpenGLInformation
- private void LogOpenGLInformation()
- {
- string version = GL.GetString(StringName.Version);
- string vendor = GL.GetString(StringName.Vendor);
- string renderer = GL.GetString(StringName.Renderer);
- string shadingLanguageVersion = GL.GetString(StringName.ShadingLanguageVersion);
- Logger.Info("OpenGL version: " + version + " (" + vendor + " - " + renderer + ")");
- Logger.Info("GLSL version: " + shadingLanguageVersion);
- string[] parts = version.Split(new char[] { '.', ' ' });
- cachedVersionMajor = int.Parse(parts[0]);
- cachedVersionMinor = int.Parse(parts[1]);
- }
- #endregion
-
- #region CreateWindowInfo
- private void CreateWindowInfo(IntPtr windowHandle, IntPtr graphicsModeHandle)
- {
- if (OpenTK.Configuration.RunningOnWindows)
- nativeWindowInfo = Utilities.CreateWindowsWindowInfo(windowHandle);
- else if (OpenTK.Configuration.RunningOnX11)
- nativeWindowInfo = LinuxInterop.CreateX11WindowInfo(windowHandle, graphicsModeHandle);
- else if (OpenTK.Configuration.RunningOnMacOS)
- nativeWindowInfo = Utilities.CreateMacOSCarbonWindowInfo(windowHandle, false, true);
- else
- throw new NotImplementedException();
-
- }
- #endregion
-
- #region SetViewport
- public void SetViewport(Viewport viewport)
- {
- GL.Viewport(viewport.X, viewport.Y, viewport.Width, viewport.Height);
- ErrorHelper.Check("SetViewport");
- }
- #endregion
-
- #region Clear
- private uint? lastClearColor;
- ///
- /// Clear the current screen by the specified clear color.
- ///
- /// Clear color.
- public void Clear(ref Color color)
- {
- uint newClearColor = color.PackedValue;
- if (lastClearColor.HasValue == false ||
- lastClearColor != newClearColor)
- {
- lastClearColor = newClearColor;
- GL.ClearColor(color.R * ColorMultiplier, color.G * ColorMultiplier,
- color.B * ColorMultiplier, color.A * ColorMultiplier);
- ErrorHelper.Check("ClearColor");
- }
- GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
- ErrorHelper.Check("Clear");
- }
-
- ///
- /// Clear the current screen by the specified clear color and options.
- ///
- /// Clear options defining which components
- /// should be cleared.
- /// Clear color.
- /// Depth value.
- /// Stencil value.
- public void Clear(ClearOptions options, Vector4 color, float depth,
- int stencil)
- {
- Color anxColor;
- DatatypesMapping.Convert(ref color, out anxColor);
- uint newClearColor = anxColor.PackedValue;
- if (lastClearColor != newClearColor)
- {
- lastClearColor = newClearColor;
- GL.ClearColor(anxColor.R * ColorMultiplier, anxColor.G * ColorMultiplier,
- anxColor.B * ColorMultiplier, anxColor.A * ColorMultiplier);
- ErrorHelper.Check("ClearColor");
- }
-
- ClearBufferMask mask = (ClearBufferMask)0;
- if ((options | ClearOptions.Target) == options)
- {
- mask |= ClearBufferMask.ColorBufferBit;
- }
- if ((options | ClearOptions.Stencil) == options)
- {
- mask |= ClearBufferMask.StencilBufferBit;
- }
- if ((options | ClearOptions.DepthBuffer) == options)
- {
- mask |= ClearBufferMask.DepthBufferBit;
- }
-
- GL.ClearDepth(depth);
- ErrorHelper.Check("ClearDepth");
- GL.ClearStencil(stencil);
- ErrorHelper.Check("ClearStencil");
- GL.Clear(mask);
- ErrorHelper.Check("Clear");
- }
- #endregion
-
- #region Present
- ///
- /// Swap the graphics buffers.
- ///
- public void Present()
- {
- if (nativeContext != null)
- {
- nativeContext.SwapBuffers();
- }
- }
- #endregion
-
- #region DrawIndexedPrimitives
- public void DrawIndexedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices,
- int startIndex, int primitiveCount)
- {
- // TODO: baseVertex, minVertexIndex, numVertices, startIndex
- DrawElementsType elementsType = boundIndexBuffer.elementSize == IndexElementSize.SixteenBits ?
- DrawElementsType.UnsignedShort :
- DrawElementsType.UnsignedInt;
-
- int count;
- BeginMode mode = DatatypesMapping.PrimitiveTypeToBeginMode(primitiveType, primitiveCount, out count);
-
- GL.DrawElements(mode, count, elementsType, 0);
- ErrorHelper.Check("DrawElements");
- }
- #endregion
-
- #region DrawInstancedPrimitives (TODO)
- public void DrawInstancedPrimitives(PrimitiveType primitiveType,
- int baseVertex, int minVertexIndex, int numVertices, int startIndex,
- int primitiveCount, int instanceCount)
- {
- //GL.DrawArraysInstanced(
- // DatatypesMapping.PrimitiveTypeToBeginMode(primitiveType),
- // baseVertex, numVertices, instanceCount);
- throw new NotImplementedException();
- }
- #endregion
-
- #region DrawUserIndexedPrimitives (TODO)
- public void DrawUserIndexedPrimitives(PrimitiveType primitiveType,
- T[] vertexData, int vertexOffset, int numVertices, Array indexData,
- int indexOffset, int primitiveCount, VertexDeclaration vertexDeclaration,
- IndexElementSize indexFormat) where T : struct, IVertexType
- {
- //BeginMode mode = DatatypesMapping.PrimitiveTypeToBeginMode(primitiveType);
-
- //if (indexFormat == IndexElementSize.SixteenBits)
- //{
- // ushort[] indices = new ushort[indexData.Length];
- // indexData.CopyTo(indices, 0);
- // GL.DrawElements(mode, numVertices, DrawElementsType.UnsignedShort,
- // indices);
- //}
- //else
- //{
- // uint[] indices = new uint[indexData.Length];
- // indexData.CopyTo(indices, 0);
- // GL.DrawElements(mode, numVertices, DrawElementsType.UnsignedInt,
- // indices);
- //}
-
- throw new NotImplementedException();
- }
- #endregion
-
- #region DrawUserPrimitives (TODO)
- public void DrawUserPrimitives(PrimitiveType primitiveType,
- T[] vertexData, int vertexOffset, int primitiveCount,
- VertexDeclaration vertexDeclaration) where T : struct, IVertexType
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region DrawPrimitives (TODO: check)
- public void DrawPrimitives(PrimitiveType primitiveType, int vertexOffset,
- int primitiveCount)
- {
- int count;
- BeginMode mode = DatatypesMapping.PrimitiveTypeToBeginMode(primitiveType,
- primitiveCount, out count);
- GL.DrawArrays(mode, vertexOffset, count);
- ErrorHelper.Check("DrawArrays");
- }
- #endregion
-
- #region SetConstantBuffer (TODO)
-#if XNAEXT
- public void SetConstantBuffer(int slot, ConstantBuffer constantBuffer)
- {
- if (constantBuffer == null)
- throw new ArgumentNullException("constantBuffer");
-
- throw new NotImplementedException();
- }
-#endif
- #endregion
-
- #region SetVertexBuffers
- public void SetVertexBuffers(VertexBufferBinding[] vertexBuffers)
- {
- boundVertexBuffers = new VertexBufferGL3[vertexBuffers.Length];
- for (int index = 0; index < vertexBuffers.Length; index++)
- {
- var nativeBuffer = (VertexBufferGL3)vertexBuffers[index].VertexBuffer.NativeVertexBuffer;
- boundVertexBuffers[index] = nativeBuffer;
- nativeBuffer.Bind(activeEffect);
- }
- }
- #endregion
-
- #region SetIndexBuffer
- public void SetIndexBuffer(IndexBuffer indexBuffer)
- {
- boundIndexBuffer = (IndexBufferGL3)indexBuffer.NativeIndexBuffer;
- GL.BindBuffer(BufferTarget.ElementArrayBuffer, boundIndexBuffer.BufferHandle);
- ErrorHelper.Check("BindBuffer");
- }
- #endregion
-
- #region ResizeRenderWindow
- private void ResizeRenderWindow(PresentationParameters presentationParameters)
- {
- if (OpenTK.Configuration.RunningOnWindows)
- {
- WindowsInterop.ResizeWindow(presentationParameters.DeviceWindowHandle,
- presentationParameters.BackBufferWidth,
- presentationParameters.BackBufferHeight);
- }
- else
- {
- LinuxInterop.ResizeWindow(presentationParameters.DeviceWindowHandle,
- presentationParameters.BackBufferWidth,
- presentationParameters.BackBufferHeight);
- }
- }
- #endregion
-
- #region SetRenderTargets
- public void SetRenderTargets(params RenderTargetBinding[] renderTargets)
- {
- if (renderTargets == null)
- {
- if (boundRenderTargets.Length > 0)
- {
- for (int index = 0; index < boundRenderTargets.Length; index++)
- {
- boundRenderTargets[index].Unbind();
- }
- boundRenderTargets = new RenderTarget2DGL3[0];
- }
- }
- else
- {
- boundRenderTargets = new RenderTarget2DGL3[renderTargets.Length];
- for (int index = 0; index < renderTargets.Length; index++)
- {
- RenderTarget2D renderTarget =
- renderTargets[index].RenderTarget as RenderTarget2D;
- RenderTarget2DGL3 nativeRenderTarget =
- renderTarget.NativeRenderTarget as RenderTarget2DGL3;
- boundRenderTargets[index] = nativeRenderTarget;
-
- nativeRenderTarget.Bind();
- }
- }
- }
- #endregion
-
- #region GetBackBufferData (TODO)
- public void GetBackBufferData(Rectangle? rect, T[] data,
- int startIndex, int elementCount) where T : struct
- {
- throw new NotImplementedException();
- }
-
- public void GetBackBufferData(T[] data) where T : struct
- {
- //glReadPixels(0, 0, nWidth, nHeight, GL_RGB, GL_UNSIGNED_BYTE, m_pPixelData)
- throw new NotImplementedException();
- }
-
- public void GetBackBufferData(T[] data, int startIndex,
- int elementCount) where T : struct
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region ResizeBuffers
- public void ResizeBuffers(PresentationParameters presentationParameters)
- {
- ResizeRenderWindow(presentationParameters);
-
- GL.Viewport(0, 0, presentationParameters.BackBufferWidth,
- presentationParameters.BackBufferHeight);
-
- ResetDevice(presentationParameters);
- }
- #endregion
-
- #region Dispose
- public void Dispose()
- {
- GraphicsResourceManager.DisposeAllResources();
-
- lastClearColor = new uint?();
- boundVertexBuffers = null;
- boundIndexBuffer = null;
- activeEffect = null;
- boundRenderTargets = null;
-
- if (nativeWindowInfo != null)
- {
- nativeWindowInfo.Dispose();
- nativeWindowInfo = null;
- }
- if (nativeContext != null)
- {
- nativeContext.Dispose();
- nativeContext = null;
- }
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Helpers/DatatypesMapping.cs b/RenderSystems/ANX.Framework.Windows.GL3/Helpers/DatatypesMapping.cs
deleted file mode 100644
index 7010c988..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/Helpers/DatatypesMapping.cs
+++ /dev/null
@@ -1,299 +0,0 @@
-using System;
-using ANX.Framework;
-using ANX.Framework.Graphics;
-using OpenTK.Graphics;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3.Helpers
-{
- internal static class DatatypesMapping
- {
- #region Constants
- public const float ColorMultiplier = 1f / 255f;
- #endregion
-
- #region Convert ANX.Color -> OpenTK.Color4
- public static void Convert(ref Color anxColor, out Color4 otkColor)
- {
- otkColor.R = anxColor.R * ColorMultiplier;
- otkColor.G = anxColor.G * ColorMultiplier;
- otkColor.B = anxColor.B * ColorMultiplier;
- otkColor.A = anxColor.A * ColorMultiplier;
- }
- #endregion
-
- #region Convert OpenTK.Color4 -> ANX.Color
- public static void Convert(ref Color4 otkColor, out Color anxColor)
- {
- byte r = (byte)(otkColor.R * 255);
- byte g = (byte)(otkColor.G * 255);
- byte b = (byte)(otkColor.B * 255);
- byte a = (byte)(otkColor.A * 255);
- anxColor.packedValue = (uint)(r + (g << 8) + (b << 16) + (a << 24));
- }
- #endregion
-
- #region Convert ANX.Vector4 -> ANX.Color
- public static void Convert(ref Vector4 anxVector, out Color anxColor)
- {
- byte r = (byte)(anxVector.X * 255);
- byte g = (byte)(anxVector.Y * 255);
- byte b = (byte)(anxVector.Z * 255);
- byte a = (byte)(anxVector.W * 255);
- anxColor.packedValue = (uint)(r + (g << 8) + (b << 16) + (a << 24));
- }
- #endregion
-
- #region SurfaceToColorFormat (TODO)
- ///
- /// Translate the XNA surface format to an OpenGL ColorFormat.
- ///
- /// XNA surface format.
- /// Translated color format for OpenGL.
- public static ColorFormat SurfaceToColorFormat(SurfaceFormat format)
- {
- switch (format)
- {
- // TODO
- case SurfaceFormat.Dxt1:
- case SurfaceFormat.Dxt3:
- case SurfaceFormat.Dxt5:
- case SurfaceFormat.HdrBlendable:
- throw new NotImplementedException("Surface Format '" + format +
- "' isn't implemented yet!");
-
- // TODO: CHECK!
- case SurfaceFormat.NormalizedByte2:
- return new ColorFormat(8, 8, 0, 0);
-
- //DONE
- default:
- case SurfaceFormat.Color:
- case SurfaceFormat.NormalizedByte4:
- return new ColorFormat(8, 8, 8, 8);
-
- case SurfaceFormat.HalfVector2:
- return new ColorFormat(16, 16, 0, 0);
-
- case SurfaceFormat.HalfVector4:
- return new ColorFormat(16, 16, 16, 16);
-
- case SurfaceFormat.Bgra4444:
- return new ColorFormat(4, 4, 4, 4);
-
- case SurfaceFormat.Bgra5551:
- return new ColorFormat(5, 5, 5, 1);
-
- case SurfaceFormat.Alpha8:
- return new ColorFormat(0, 0, 0, 8);
-
- case SurfaceFormat.Bgr565:
- return new ColorFormat(5, 6, 5, 0);
-
- case SurfaceFormat.Rg32:
- return new ColorFormat(16, 16, 0, 0);
-
- case SurfaceFormat.Rgba1010102:
- return new ColorFormat(10, 10, 10, 2);
-
- case SurfaceFormat.Rgba64:
- return new ColorFormat(16, 16, 16, 16);
-
- case SurfaceFormat.HalfSingle:
- return new ColorFormat(16, 0, 0, 0);
-
- case SurfaceFormat.Single:
- return new ColorFormat(32, 0, 0, 0);
-
- case SurfaceFormat.Vector2:
- return new ColorFormat(32, 32, 0, 0);
-
- case SurfaceFormat.Vector4:
- return new ColorFormat(32, 32, 32, 32);
- }
- }
- #endregion
-
- #region SurfaceToPixelInternalFormat (TODO)
- ///
- /// Translate the XNA surface format to an OpenGL PixelInternalFormat.
- ///
- /// XNA surface format.
- /// Translated format for OpenGL.
- public static PixelInternalFormat SurfaceToPixelInternalFormat(
- SurfaceFormat format)
- {
- switch (format)
- {
- // TODO
- case SurfaceFormat.HdrBlendable:
- case SurfaceFormat.Bgr565:
- throw new NotImplementedException("Surface Format '" + format +
- "' isn't implemented yet!");
-
- // TODO: CHECK!
- case SurfaceFormat.NormalizedByte2:
- return PixelInternalFormat.Rg8;
-
- default:
- case SurfaceFormat.Color:
- case SurfaceFormat.NormalizedByte4:
- return PixelInternalFormat.Rgba;
-
- case SurfaceFormat.Dxt1:
- return PixelInternalFormat.CompressedRgbaS3tcDxt1Ext;
-
- case SurfaceFormat.Dxt3:
- return PixelInternalFormat.CompressedRgbaS3tcDxt3Ext;
-
- case SurfaceFormat.Dxt5:
- return PixelInternalFormat.CompressedRgbaS3tcDxt5Ext;
-
- case SurfaceFormat.HalfVector2:
- return PixelInternalFormat.Rg16;
-
- case SurfaceFormat.Rgba64:
- case SurfaceFormat.HalfVector4:
- return PixelInternalFormat.Rgba16f;
-
- case SurfaceFormat.Bgra4444:
- return PixelInternalFormat.Rgba4;
-
- case SurfaceFormat.Bgra5551:
- return PixelInternalFormat.Rgb5A1;
-
- case SurfaceFormat.Alpha8:
- return PixelInternalFormat.Alpha8;
-
- case SurfaceFormat.Vector2:
- case SurfaceFormat.Rg32:
- return PixelInternalFormat.Rg32f;
-
- case SurfaceFormat.Rgba1010102:
- return PixelInternalFormat.Rgb10A2;
-
- case SurfaceFormat.HalfSingle:
- return PixelInternalFormat.R16f;
-
- case SurfaceFormat.Single:
- return PixelInternalFormat.R32f;
-
- case SurfaceFormat.Vector4:
- return PixelInternalFormat.Rgba32f;
- }
- }
- #endregion
-
- #region PrimitiveTypeToBeginMode
- ///
- /// Translate the XNA PrimitiveType to an OpenGL BeginMode.
- ///
- /// XNA PrimitiveType.
- /// Translated BeginMode for OpenGL.
- public static BeginMode PrimitiveTypeToBeginMode(PrimitiveType type, int primitiveCount, out int count)
- {
- switch (type)
- {
- case PrimitiveType.LineList:
- count = primitiveCount * 2;
- return BeginMode.Lines;
-
- case PrimitiveType.LineStrip:
- count = primitiveCount + 1;
- return BeginMode.LineStrip;
-
- default:
- case PrimitiveType.TriangleList:
- count = primitiveCount * 3;
- return BeginMode.Triangles;
-
- case PrimitiveType.TriangleStrip:
- count = primitiveCount + 2;
- return BeginMode.TriangleStrip;
- }
- }
- #endregion
-
- #region Tests
- private class Tests
- {
- #region TestConvertColorToOtkColor
- public static void TestConvertColorToOtkColor()
- {
- Color anxColor = new Color(1f, 0.5f, 0.75f, 0f);
- Color4 color;
- DatatypesMapping.Convert(ref anxColor, out color);
- Console.WriteLine(color.ToString());
- }
- #endregion
-
- #region TestConvertOtkColorToColor
- public static void TestConvertOtkColorToColor()
- {
- Color4 color = new Color4(1f, 0.5f, 0.75f, 0f);
- Color anxColor;
- DatatypesMapping.Convert(ref color, out anxColor);
- Console.WriteLine(anxColor.ToString());
- }
- #endregion
-
- #region TestConvertVector4ToColor
- public static void TestConvertVector4ToColor()
- {
- Vector4 vector = new Vector4(1f, 0.5f, 0.75f, 0f);
- Color color;
- DatatypesMapping.Convert(ref vector, out color);
- Console.WriteLine(color.ToString());
- }
- #endregion
-
- #region TestPrimitiveTypeToBeginMode
- public static void TestPrimitiveTypeToBeginMode()
- {
- PrimitiveType type = PrimitiveType.LineList;
- int primitiveCount = 10;
- int count = 0;
-
- BeginMode result = DatatypesMapping.PrimitiveTypeToBeginMode(type,
- primitiveCount, out count);
- AssetValues(result, BeginMode.Lines);
- AssetValues(count, primitiveCount * 2);
-
- type = PrimitiveType.LineStrip;
- result = DatatypesMapping.PrimitiveTypeToBeginMode(type, primitiveCount,
- out count);
- AssetValues(result, BeginMode.LineStrip);
- AssetValues(count, primitiveCount + 1);
-
- type = PrimitiveType.TriangleList;
- result = DatatypesMapping.PrimitiveTypeToBeginMode(type, primitiveCount,
- out count);
- AssetValues(result, BeginMode.Triangles);
- AssetValues(count, primitiveCount * 3);
-
- type = PrimitiveType.TriangleStrip;
- result = DatatypesMapping.PrimitiveTypeToBeginMode(type, primitiveCount,
- out count);
- AssetValues(result, BeginMode.TriangleStrip);
- AssetValues(count, primitiveCount + 2);
- }
- #endregion
-
- #region AssetValues
- private static void AssetValues(T first, T second)
- {
- if (first.Equals(second) == false)
- {
- throw new Exception("The two values are not equal:\n\t1: " + first +
- "\n\t2: " + second);
- }
- }
- #endregion
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Helpers/GraphicsResourceManager.cs b/RenderSystems/ANX.Framework.Windows.GL3/Helpers/GraphicsResourceManager.cs
deleted file mode 100644
index 70c42fff..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/Helpers/GraphicsResourceManager.cs
+++ /dev/null
@@ -1,195 +0,0 @@
-using System;
-using System.Collections.Generic;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3.Helpers
-{
- internal static class GraphicsResourceManager
- {
- #region Private
- private static List allTextures;
-
- private static List allEffects;
-
- private static List allVertexBuffers;
-
- private static List allIndexBuffers;
- #endregion
-
- #region Constructor
- static GraphicsResourceManager()
- {
- allTextures = new List();
- allEffects = new List();
- allVertexBuffers = new List();
- allIndexBuffers = new List();
- }
- #endregion
-
- #region UpdateResource
- public static void UpdateResource(T resource, bool register)
- {
- IList list = null;
-
- if (typeof(T) == typeof(Texture2DGL3))
- {
- list = (IList)allTextures;
- }
- else if (typeof(T) == typeof(EffectGL3))
- {
- list = (IList)allEffects;
- }
- else if (typeof(T) == typeof(VertexBufferGL3))
- {
- list = (IList)allVertexBuffers;
- }
- else if (typeof(T) == typeof(IndexBufferGL3))
- {
- list = (IList)allIndexBuffers;
- }
-
- lock (list)
- {
- if (register)
- {
- list.Add(resource);
- }
- else
- {
- list.Remove(resource);
- }
- }
- }
- #endregion
-
- #region DisposeAllResources
- public static void DisposeAllResources()
- {
- #region Textures
- lock (allTextures)
- {
- foreach (Texture2DGL3 texture in allTextures)
- {
- if (texture.IsDisposed == false)
- {
- texture.DisposeResource();
- }
- }
- }
- #endregion
-
- #region Effects
- lock (allEffects)
- {
- foreach (EffectGL3 effect in allEffects)
- {
- if (effect.IsDisposed == false)
- {
- effect.DisposeResource();
- }
- }
- }
- #endregion
-
- #region VertexBuffers
- lock (allVertexBuffers)
- {
- foreach (VertexBufferGL3 buffer in allVertexBuffers)
- {
- if (buffer.IsDisposed == false)
- {
- buffer.DisposeResource();
- }
- }
- }
- #endregion
-
- #region IndexBuffers
- lock (allIndexBuffers)
- {
- foreach (IndexBufferGL3 buffer in allIndexBuffers)
- {
- if (buffer.IsDisposed == false)
- {
- buffer.DisposeResource();
- }
- }
- }
- #endregion
- }
- #endregion
-
- #region RecreateAllResources
- public static void RecreateAllResources()
- {
- #region Textures
- lock (allTextures)
- {
- foreach (Texture2DGL3 texture in allTextures)
- {
- if (texture.IsDisposed == false)
- {
- texture.RecreateData();
- }
- }
- }
- #endregion
-
- #region Effects
- lock (allEffects)
- {
- foreach (EffectGL3 effect in allEffects)
- {
- if (effect.IsDisposed == false)
- {
- effect.RecreateData();
- }
- }
- }
- #endregion
-
- #region VertexBuffers
- lock (allVertexBuffers)
- {
- foreach (VertexBufferGL3 buffer in allVertexBuffers)
- {
- if (buffer.IsDisposed == false)
- {
- buffer.RecreateData();
- }
- }
- }
- #endregion
-
- #region IndexBuffers
- lock (allIndexBuffers)
- {
- foreach (IndexBufferGL3 buffer in allIndexBuffers)
- {
- if (buffer.IsDisposed == false)
- {
- buffer.RecreateData();
- }
- }
- }
- #endregion
-
- if (BlendStateGL3.Current != null)
- {
- BlendStateGL3.Current.Apply(null);
- }
- if (RasterizerStateGL3.Current != null)
- {
- RasterizerStateGL3.Current.Apply(null);
- }
- if (DepthStencilStateGL3.Current != null)
- {
- DepthStencilStateGL3.Current.Apply(null);
- }
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Helpers/LinuxInterop.cs b/RenderSystems/ANX.Framework.Windows.GL3/Helpers/LinuxInterop.cs
deleted file mode 100644
index eaa103ba..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/Helpers/LinuxInterop.cs
+++ /dev/null
@@ -1,118 +0,0 @@
-using System;
-using System.Reflection;
-using System.Runtime.InteropServices;
-using OpenTK.Platform;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3.Helpers
-{
- internal static class LinuxInterop
- {
- #region XVisualInfo (Helper struct)
- [StructLayout(LayoutKind.Sequential)]
- private struct XVisualInfo
- {
- public IntPtr Visual;
- public IntPtr VisualID;
- public int Screen;
- public int Depth;
- public int Class;
- public long RedMask;
- public long GreenMask;
- public long blueMask;
- public int ColormapSize;
- public int BitsPerRgb;
-
- public override string ToString()
- {
- return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})",
- VisualID, Screen, Depth, Class);
- }
- }
- #endregion
-
- #region Invokes
- [DllImport("libX11")]
- private static extern IntPtr XCreateColormap(IntPtr display, IntPtr window,
- IntPtr visual, int alloc);
-
- [DllImport("libX11", EntryPoint = "XGetVisualInfo")]
- private static extern IntPtr XGetVisualInfoInternal(IntPtr display,
- IntPtr vinfo_mask, ref XVisualInfo template, out int nitems);
-
- [DllImport("libX11")]
- private static extern int XPending(IntPtr diplay);
-
- [DllImport("libX11")]
- private static extern void XResizeWindow(IntPtr display, IntPtr window,
- int width, int height);
- #endregion
-
- #region GetStaticFieldValue
- private static object GetStaticFieldValue(Type type, string fieldName)
- {
- return type.GetField(fieldName,
- BindingFlags.Static | BindingFlags.NonPublic).GetValue(null);
- }
- #endregion
-
- #region SetStaticFieldValue
- private static void SetStaticFieldValue(Type type, string fieldName,
- object value)
- {
- type.GetField(fieldName,
- BindingFlags.Static | BindingFlags.NonPublic).SetValue(null, value);
- }
- #endregion
-
- #region CreateX11WindowInfo
- public static IWindowInfo CreateX11WindowInfo(IntPtr windowHandle,
- IntPtr graphicsModeHandle)
- {
- // Use reflection to retrieve the necessary values from Mono's
- // Windows.Forms implementation.
- Type xplatui = Type.GetType(
- "System.Windows.Forms.XplatUIX11, System.Windows.Forms");
- if (xplatui == null)
- {
- throw new PlatformNotSupportedException(
- "System.Windows.Forms.XplatUIX11 missing. Unsupported platform " +
- "or Mono runtime version, aborting.");
- }
-
- // get the required handles from the X11 API.
- IntPtr display = (IntPtr)GetStaticFieldValue(xplatui, "DisplayHandle");
- IntPtr rootWindow = (IntPtr)GetStaticFieldValue(xplatui, "RootWindow");
- int screen = (int)GetStaticFieldValue(xplatui, "ScreenNo");
-
- // get the XVisualInfo for this GraphicsMode
- XVisualInfo info = new XVisualInfo()
- {
- VisualID = graphicsModeHandle,
- };
- int dummy;
- IntPtr infoPtr = XGetVisualInfoInternal(display,
- (IntPtr)1 /* VisualInfoMask.ID */, ref info, out dummy);
- info = (XVisualInfo)Marshal.PtrToStructure(infoPtr, typeof(XVisualInfo));
-
- // set the X11 colormap.
- SetStaticFieldValue(xplatui, "CustomVisual", info.Visual);
- SetStaticFieldValue(xplatui, "CustomColormap", XCreateColormap(display, rootWindow, info.Visual, 0));
-
- return Utilities.CreateX11WindowInfo(display, screen, windowHandle,
- rootWindow, infoPtr);
- }
- #endregion
-
- #region ResizeWindow
- public static void ResizeWindow(IntPtr windowHandle, int backBufferWidth,
- int backBufferHeight)
- {
- XResizeWindow(IntPtr.Zero, windowHandle, backBufferWidth, backBufferHeight);
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Helpers/WindowsInterop.cs b/RenderSystems/ANX.Framework.Windows.GL3/Helpers/WindowsInterop.cs
deleted file mode 100644
index 2e85698e..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/Helpers/WindowsInterop.cs
+++ /dev/null
@@ -1,69 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3.Helpers
-{
- internal static class WindowsInterop
- {
- #region RECT (Helper struct)
- [StructLayout(LayoutKind.Sequential)]
- private struct RECT
- {
- ///
- /// X position of upper-left corner.
- ///
- public int Left;
- ///
- /// Y position of upper-left corner.
- ///
- public int Top;
- ///
- /// X position of lower-right corner.
- ///
- public int Right;
- ///
- /// Y position of lower-right corner.
- ///
- public int Bottom;
- }
- #endregion
-
- #region Invokes
- [DllImport("user32.dll")]
- private static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter,
- int x, int y, int width, int height, uint uFlags);
-
- [DllImport("user32.dll")]
- [return: MarshalAs(UnmanagedType.Bool)]
- private static extern bool GetWindowRect(IntPtr hWnd, out RECT lpRect);
-
- [DllImport("user32.dll")]
- [return: MarshalAs(UnmanagedType.Bool)]
- private static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);
- #endregion
-
- #region ResizeWindow
- public static void ResizeWindow(IntPtr windowHandle, int backBufferWidth,
- int backBufferHeight)
- {
- RECT windowRect;
- RECT clientRect;
- if (GetWindowRect(windowHandle, out windowRect) &&
- GetClientRect(windowHandle, out clientRect))
- {
- int width = backBufferWidth + (windowRect.Right - windowRect.Left) -
- clientRect.Right;
- int height = backBufferHeight + (windowRect.Bottom - windowRect.Top) -
- clientRect.Bottom;
-
- SetWindowPos(windowHandle, IntPtr.Zero, windowRect.Left, windowRect.Top,
- width, height, 0);
- }
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/IndexBufferGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/IndexBufferGL3.cs
deleted file mode 100644
index fef928c9..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/IndexBufferGL3.cs
+++ /dev/null
@@ -1,264 +0,0 @@
-using System;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA.RenderSystem;
-using OpenTK.Graphics.OpenGL;
-using ANX.RenderSystem.Windows.GL3.Helpers;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native OpenGL implementation of a Index Buffer.
- ///
- public class IndexBufferGL3 : INativeIndexBuffer
- {
- #region Private
- private IndexBuffer managedBuffer;
-
- private int bufferHandle;
- ///
- /// Native index buffer handle.
- ///
- internal int BufferHandle
- {
- get
- {
- return bufferHandle;
- }
- }
-
- private int indexCount;
-
- internal IndexElementSize elementSize;
-
- private BufferUsage usage;
-
- private BufferUsageHint usageHint;
-
- internal bool IsDisposed;
- #endregion
-
- #region Constructor
- ///
- /// Create a new Index Buffer object.
- ///
- internal IndexBufferGL3(IndexBuffer setManagedBuffer,
- IndexElementSize setElementSize, int setIndexCount, BufferUsage setUsage)
- {
- GraphicsResourceManager.UpdateResource(this, true);
-
- managedBuffer = setManagedBuffer;
- indexCount = setIndexCount;
- elementSize = setElementSize;
- usage = setUsage;
-
- bool isDynamicBuffer = managedBuffer is DynamicIndexBuffer;
-
- usageHint = isDynamicBuffer ?
- BufferUsageHint.DynamicDraw :
- BufferUsageHint.StaticDraw;
-
- CreateBuffer();
- }
-
- ~IndexBufferGL3()
- {
- GraphicsResourceManager.UpdateResource(this, false);
- }
- #endregion
-
- #region CreateBuffer
- private void CreateBuffer()
- {
- GL.GenBuffers(1, out bufferHandle);
- ErrorHelper.Check("GenBuffers");
- GL.BindBuffer(BufferTarget.ElementArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
- int size = indexCount *
- (elementSize == IndexElementSize.SixteenBits ? 16 : 32);
- GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)size, IntPtr.Zero,
- usageHint);
- ErrorHelper.Check("BufferData");
-
- int setSize;
- GL.GetBufferParameter(BufferTarget.ElementArrayBuffer,
- BufferParameterName.BufferSize, out setSize);
- if (setSize != size)
- {
- throw new Exception("Failed to set the vertexBuffer data. DataSize=" +
- size + " SetSize=" + setSize);
- }
- }
- #endregion
-
- #region RecreateData
- internal void RecreateData()
- {
- CreateBuffer();
- }
- #endregion
-
- #region SetData
- public void SetData(GraphicsDevice graphicsDevice, T[] data)
- where T : struct
- {
- BufferData(data, 0);
- }
- #endregion
-
- #region SetData
- public void SetData(GraphicsDevice graphicsDevice, T[] data,
- int startIndex, int elementCount) where T : struct
- {
- if (startIndex != 0 ||
- elementCount != data.Length)
- {
- T[] subArray = new T[elementCount];
- Array.Copy(data, startIndex, subArray, 0, elementCount);
- BufferData(subArray, 0);
- }
- else
- {
- BufferData(data, 0);
- }
- }
- #endregion
-
- #region SetData
- public void SetData(GraphicsDevice graphicsDevice, int offsetInBytes,
- T[] data, int startIndex, int elementCount) where T : struct
- {
- if (startIndex != 0 ||
- elementCount != data.Length)
- {
- T[] subArray = new T[elementCount];
- Array.Copy(data, startIndex, subArray, 0, elementCount);
- BufferData(subArray, offsetInBytes);
- }
- else
- {
- BufferData(data, offsetInBytes);
- }
- }
- #endregion
-
- #region BufferData (private helper)
- private void BufferData(T[] data, int offset) where T : struct
- {
- int size = (elementSize == IndexElementSize.SixteenBits ?
- 2 : 4) * data.Length;
-
- GL.BindBuffer(BufferTarget.ElementArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
-
- if (offset == 0)
- {
- GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)size, data,
- usageHint);
- ErrorHelper.Check("BufferData size=" + size);
- }
- else
- {
- GL.BufferSubData(BufferTarget.ElementArrayBuffer, (IntPtr)offset,
- (IntPtr)size, data);
- ErrorHelper.Check("BufferSubData offset=" + offset + " size=" + size);
- }
-
- int setSize;
- GL.GetBufferParameter(BufferTarget.ElementArrayBuffer,
- BufferParameterName.BufferSize, out setSize);
- if (setSize != size)
- {
- throw new Exception("Failed to set the indexBuffer data. DataSize=" +
- size + " SetSize=" + setSize);
- }
- }
- #endregion
-
- #region GetData
- public void GetData(T[] data) where T : struct
- {
- BufferData(data, 0);
- }
- #endregion
-
- #region GetData
- public void GetData(T[] data, int startIndex, int elementCount)
- where T : struct
- {
- if (startIndex != 0 ||
- elementCount != data.Length)
- {
- T[] subArray = new T[elementCount];
- Array.Copy(data, startIndex, subArray, 0, elementCount);
- BufferData(subArray, 0);
- }
- else
- {
- BufferData(data, 0);
- }
- }
- #endregion
-
- #region GetData
- public void GetData(int offsetInBytes, T[] data, int startIndex,
- int elementCount) where T : struct
- {
- if (startIndex != 0 ||
- elementCount != data.Length)
- {
- T[] subArray = new T[elementCount];
- Array.Copy(data, startIndex, subArray, 0, elementCount);
- BufferData(subArray, offsetInBytes);
- }
- else
- {
- BufferData(data, offsetInBytes);
- }
- }
- #endregion
-
- #region GetBufferData (private helper)
- private void GetBufferData(T[] data, int offset) where T : struct
- {
- int size = (elementSize == IndexElementSize.SixteenBits ?
- 2 : 4) * data.Length;
-
- GL.BindBuffer(BufferTarget.ElementArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
-
- GL.GetBufferSubData(BufferTarget.ElementArrayBuffer, (IntPtr)offset,
- (IntPtr)size, data);
- ErrorHelper.Check("GetBufferSubData");
- }
- #endregion
-
- #region Dispose
- ///
- /// Dispose the native index buffer data.
- ///
- public void Dispose()
- {
- if (IsDisposed == false)
- {
- IsDisposed = true;
- DisposeResource();
- }
- }
-
- internal void DisposeResource()
- {
- if (bufferHandle != -1 &&
- GraphicsDeviceWindowsGL3.IsContextCurrent)
- {
- GL.DeleteBuffers(1, ref bufferHandle);
- ErrorHelper.Check("DeleteBuffers");
- bufferHandle = -1;
- }
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/OcclusionQueryGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/OcclusionQueryGL3.cs
deleted file mode 100644
index 1acc355d..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/OcclusionQueryGL3.cs
+++ /dev/null
@@ -1,73 +0,0 @@
-using ANX.Framework.NonXNA.Development;
-using ANX.Framework.NonXNA.RenderSystem;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- [PercentageComplete(100)]
- [TestState(TestStateAttribute.TestState.Untested)]
- [Developer("AstrorEnales")]
- public class OcclusionQueryGL3 : IOcclusionQuery
- {
- private uint[] handle;
-
- #region Public
- public bool IsComplete
- {
- get
- {
- int state;
- GL.GetQueryObject(handle[0], GetQueryObjectParam.QueryResultAvailable, out state);
- return state != 0;
- }
- }
-
- public int PixelCount
- {
- get
- {
- int result;
- GL.GetQueryObject(handle[0], GetQueryObjectParam.QueryResult, out result);
- return result;
- }
- }
- #endregion
-
- #region Constructor
- public OcclusionQueryGL3()
- {
- handle = new uint[1];
- GL.GenQueries(1, handle);
- }
- #endregion
-
- #region Begin
- public void Begin()
- {
- //GLCore.ColorMask(false, false, false, false);
- //GLCore.DepthMask(false);
- GL.BeginQuery(QueryTarget.SamplesPassed, handle[0]);
- }
- #endregion
-
- #region End
- public void End()
- {
- GL.EndQuery(QueryTarget.SamplesPassed);
- //GLCore.DepthMask(true);
- //GLCore.ColorMask(true, true, true, true);
- }
- #endregion
-
- #region Dispose
- public void Dispose()
- {
- GL.DeleteQueries(1, handle);
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs b/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs
deleted file mode 100644
index 610e357b..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/Properties/AssemblyInfo.cs
+++ /dev/null
@@ -1,38 +0,0 @@
-using System.Reflection;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-// Allgemeine Informationen über eine Assembly werden über die folgenden
-// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
-// die mit einer Assembly verknüpft sind.
-[assembly: AssemblyTitle("ANX.RenderSystem.Windows.GL3")]
-[assembly: AssemblyDescription("")]
-[assembly: AssemblyConfiguration("")]
-[assembly: AssemblyCompany("ANX.Framework Team")]
-[assembly: AssemblyProduct("ANX.RenderSystem.Windows.GL3")]
-[assembly: AssemblyCopyright("Copyright © ANX.Framework Team 2011 - 2012")]
-[assembly: AssemblyTrademark("")]
-[assembly: AssemblyCulture("")]
-
-// Durch Festlegen von ComVisible auf "false" werden die Typen in dieser Assembly unsichtbar
-// für COM-Komponenten. Wenn Sie auf einen Typ in dieser Assembly von
-// COM zugreifen müssen, legen Sie das ComVisible-Attribut für diesen Typ auf "true" fest.
-[assembly: ComVisible(false)]
-
-// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
-[assembly: Guid("14d07c57-8b86-4f6e-bacb-69f65aba5633")]
-
-// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
-//
-// Hauptversion
-// Nebenversion
-// Buildnummer
-// Revision
-//
-// Sie können alle Werte angeben oder die standardmäßigen Build- und Revisionsnummern
-// übernehmen, indem Sie "*" eingeben:
-// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("0.5.11.0")]
-[assembly: AssemblyFileVersion("0.5.11.0")]
-
-[assembly: InternalsVisibleTo("ANX.Framework.ContentPipeline")]
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/RasterizerStateGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/RasterizerStateGL3.cs
deleted file mode 100644
index 8b964641..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/RasterizerStateGL3.cs
+++ /dev/null
@@ -1,218 +0,0 @@
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using ANX.Framework.NonXNA.Development;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native Rasterizer State object for OpenGL.
- ///
- /// Basically this is a wrapper class for setting the different values all
- /// at once, because OpenGL has no State objects like DirectX.
- ///
- [PercentageComplete(100)]
- [TestStateAttribute(TestStateAttribute.TestState.Untested)]
- public class RasterizerStateGL3 : INativeRasterizerState
- {
- #region Private
- internal static RasterizerStateGL3 Current
- {
- get;
- private set;
- }
- #endregion
-
- #region Public
- #region IsBound
- ///
- /// Flag if the state object is bound to the device.
- ///
- public bool IsBound
- {
- get;
- private set;
- }
- #endregion
-
- #region CullMode
- ///
- /// The cull mode of the state object.
- ///
- public CullMode CullMode
- {
- set;
- private get;
- }
- #endregion
-
- #region ScissorTestEnable
- ///
- /// Flag if the state object has scissor test enabled.
- ///
- public bool ScissorTestEnable
- {
- set;
- private get;
- }
- #endregion
-
- #region FillMode
- ///
- /// The fill mode of the state object.
- ///
- public FillMode FillMode
- {
- set;
- private get;
- }
- #endregion
-
- #region SlopeScaleDepthBias
- ///
- /// The SlopeScaleDepthBias of the state object.
- ///
- public float SlopeScaleDepthBias
- {
- set;
- private get;
- }
- #endregion
-
- #region DepthBias
- ///
- /// The depth bias of the state object.
- ///
- public float DepthBias
- {
- set;
- private get;
- }
- #endregion
-
- #region MultiSampleAntiAlias
- ///
- /// Flag if the state object has MSAA enabled.
- ///
- public bool MultiSampleAntiAlias
- {
- set;
- private get;
- }
- #endregion
- #endregion
-
- #region Constructor
- ///
- /// Create a new rasterizer state object.
- ///
- internal RasterizerStateGL3()
- {
- IsBound = false;
- }
- #endregion
-
- #region Apply
- ///
- /// Apply the rasterizer state to the graphics device.
- ///
- /// The current graphics device.
- public void Apply(GraphicsDevice graphicsDevice)
- {
- IsBound = true;
- Current = this;
-
- #region Cull Mode
- GL.FrontFace(FrontFaceDirection.Cw);
- ErrorHelper.Check("FrontFace");
- if (CullMode == CullMode.None)
- {
- GL.Disable(EnableCap.CullFace);
- GL.CullFace(CullFaceMode.FrontAndBack);
- }
- else
- {
- GL.Enable(EnableCap.CullFace);
- GL.CullFace(CullMode == CullMode.None ?
- CullFaceMode.FrontAndBack :
- CullMode == CullMode.CullClockwiseFace ?
- CullFaceMode.Front :
- CullFaceMode.Back);
- }
- ErrorHelper.Check("Set CullMode");
- #endregion
-
- GL.PolygonMode(MaterialFace.FrontAndBack,
- FillMode == FillMode.WireFrame ? PolygonMode.Line : PolygonMode.Fill);
- ErrorHelper.Check("PolygonMode");
-
- #region ScissorTestEnable
- if (ScissorTestEnable)
- {
- GL.Enable(EnableCap.ScissorTest);
- }
- else
- {
- GL.Disable(EnableCap.ScissorTest);
- }
- ErrorHelper.Check("Set ScissorTest");
- #endregion
-
- #region DepthBias / SlopeScaleDepthBias (TODO: test!)
- // NOTE: http://www.opengl.org/sdk/docs/man/xhtml/glPolygonOffset.xml
-
- // Good article about difference between OpenGL and DirectX concerning
- // Depth Bias: http://aras-p.info/blog/2008/06/12/depth-bias-and-the-power-of-deceiving-yourself/
-
- if (DepthBias != 0f &&
- SlopeScaleDepthBias != 0f)
- {
- GL.Enable(EnableCap.PolygonOffsetFill);
- GL.PolygonOffset(SlopeScaleDepthBias, DepthBias);
- }
- else
- {
- GL.Disable(EnableCap.PolygonOffsetFill);
- }
- ErrorHelper.Check("Set DepthBias");
- #endregion
-
- #region MultiSampleAntiAlias
- if (MultiSampleAntiAlias)
- {
- GL.Enable(EnableCap.Multisample);
- }
- else
- {
- GL.Disable(EnableCap.Multisample);
- }
- ErrorHelper.Check("Set Multisample");
- #endregion
- }
- #endregion
-
- #region Release
- ///
- /// Release the rasterizer state.
- ///
- public void Release()
- {
- IsBound = false;
- Current = null;
- }
- #endregion
-
- #region Dispose
- ///
- /// Dispose the rasterizer state object.
- ///
- public void Dispose()
- {
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/RenderTarget2DGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/RenderTarget2DGL3.cs
deleted file mode 100644
index 1c53035f..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/RenderTarget2DGL3.cs
+++ /dev/null
@@ -1,144 +0,0 @@
-using System;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA.RenderSystem;
-using OpenTK.Graphics.OpenGL;
-using ANX.RenderSystem.Windows.GL3.Helpers;
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- public class RenderTarget2DGL3 : Texture2DGL3, INativeRenderTarget2D
- {
- #region Private
- private int framebufferHandle;
- private int renderbufferHandle;
-
- private bool generateMipmaps;
- #endregion
-
- // TODO: usage, preferredMultiSampleCount
- #region Constructor
- public RenderTarget2DGL3(int width, int height, bool mipMap,
- SurfaceFormat preferredFormat, DepthFormat preferredDepthFormat,
- int preferredMultiSampleCount, RenderTargetUsage usage)
- : base()
- {
- generateMipmaps = mipMap;
- PixelInternalFormat nativeFormat =
- DatatypesMapping.SurfaceToPixelInternalFormat(preferredFormat);
-
- #region Image creation
- NativeHandle = GL.GenTexture();
- GL.BindTexture(TextureTarget.Texture2D, NativeHandle);
- GL.TexParameter(TextureTarget.Texture2D,
- TextureParameterName.TextureMagFilter, (int)All.Linear);
- GL.TexParameter(TextureTarget.Texture2D,
- TextureParameterName.TextureWrapS, (int)All.ClampToEdge);
- GL.TexParameter(TextureTarget.Texture2D,
- TextureParameterName.TextureWrapT, (int)All.ClampToEdge);
- if (generateMipmaps)
- {
- GL.TexParameter(TextureTarget.Texture2D,
- TextureParameterName.GenerateMipmap, 1);
- GL.TexParameter(TextureTarget.Texture2D,
- TextureParameterName.TextureMinFilter, (int)All.LinearMipmapLinear);
- }
- else
- {
- GL.TexParameter(TextureTarget.Texture2D,
- TextureParameterName.TextureMinFilter, (int)All.Linear);
- }
-
- GL.TexImage2D(TextureTarget.Texture2D, 0, nativeFormat,
- width, height, 0, (PixelFormat)nativeFormat, PixelType.UnsignedByte,
- IntPtr.Zero);
- GL.BindTexture(TextureTarget.Texture2D, 0);
- #endregion
-
- // create a renderbuffer object to store depth info
- GL.GenRenderbuffers(1, out renderbufferHandle);
- GL.BindRenderbuffer(RenderbufferTarget.Renderbuffer, renderbufferHandle);
- GL.RenderbufferStorage(RenderbufferTarget.Renderbuffer,
- DepthFormatConversion(preferredDepthFormat), width, height);
- GL.BindRenderbuffer(RenderbufferTarget.RenderbufferExt, 0);
-
- // create a framebuffer object
- GL.GenFramebuffers(1, out framebufferHandle);
- GL.BindFramebuffer(FramebufferTarget.Framebuffer, framebufferHandle);
-
- // attach the texture to FBO color attachment point
- GL.FramebufferTexture2D(FramebufferTarget.Framebuffer,
- FramebufferAttachment.ColorAttachment0, TextureTarget.Texture2D,
- NativeHandle, 0);
-
- // attach the renderbuffer to depth attachment point
- GL.FramebufferRenderbuffer(FramebufferTarget.Framebuffer,
- FramebufferAttachment.DepthAttachment,
- RenderbufferTarget.Renderbuffer, renderbufferHandle);
-
- // check FBO status
- FramebufferErrorCode status = GL.CheckFramebufferStatus(
- FramebufferTarget.Framebuffer);
- if (status != FramebufferErrorCode.FramebufferComplete)
- {
- throw new InvalidOperationException(
- "Failed to create the render target! Error=" + status);
- }
-
- // switch back to window-system-provided framebuffer
- GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
- }
- #endregion
-
- #region DepthFormatConversion
- private RenderbufferStorage DepthFormatConversion(DepthFormat depthFormat)
- {
- switch(depthFormat)
- {
- default:
- case DepthFormat.None:
- // TODO
- return RenderbufferStorage.DepthComponent16;
- //return (RenderbufferStorage)All.DepthComponent;
-
- case DepthFormat.Depth16:
- return RenderbufferStorage.DepthComponent16;
-
- case DepthFormat.Depth24:
- return RenderbufferStorage.DepthComponent24;
-
- case DepthFormat.Depth24Stencil8:
- return RenderbufferStorage.DepthComponent32;
- }
- }
- #endregion
-
- #region Bind
- public void Bind()
- {
- GL.BindFramebuffer(FramebufferTarget.Framebuffer, framebufferHandle);
- }
- #endregion
-
- #region Unbind
- public void Unbind()
- {
- GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
- if (generateMipmaps)
- {
- GL.BindTexture(TextureTarget.Texture2D, NativeHandle);
- GL.GenerateMipmap(GenerateMipmapTarget.Texture2D);
- GL.BindTexture(TextureTarget.Texture2D, 0);
- }
- }
- #endregion
-
- #region Dispose
- public override void Dispose()
- {
- base.Dispose();
- GL.DeleteFramebuffers(1, ref framebufferHandle);
- GL.DeleteRenderbuffers(1, ref renderbufferHandle);
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/SamplerStateGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/SamplerStateGL3.cs
deleted file mode 100644
index 318eb59c..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/SamplerStateGL3.cs
+++ /dev/null
@@ -1,139 +0,0 @@
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA;
-using ANX.Framework.NonXNA.Development;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native Sampler State object for OpenGL.
- ///
- /// Basically this is a wrapper class for setting the different values all
- /// at once, because OpenGL has no State objects like DirectX.
- ///
- /// Info for OpenGL filter states:
- /// http://gregs-blog.com/2008/01/17/opengl-texture-filter-parameters-explained/
- ///
- /// Info for OGL 3.3 sampler objects (sadly not implemented in OpenTK yet):
- /// http://www.sinanc.org/blog/?p=215
- ///
- [PercentageComplete(10)]
- [TestState(TestStateAttribute.TestState.Untested)]
- public class SamplerStateGL3 : INativeSamplerState
- {
- #region Public
- #region IsBound
- ///
- /// Flag if the state object is bound to the device.
- ///
- public bool IsBound
- {
- get;
- private set;
- }
- #endregion
-
- #region AddressU
- public TextureAddressMode AddressU
- {
- set;
- private get;
- }
- #endregion
-
- #region AddressV
- public TextureAddressMode AddressV
- {
- set;
- private get;
- }
- #endregion
-
- #region AddressW
- public TextureAddressMode AddressW
- {
- set;
- private get;
- }
- #endregion
-
- #region Filter
- public TextureFilter Filter
- {
- set;
- private get;
- }
- #endregion
-
- #region MaxAnisotropy
- public int MaxAnisotropy
- {
- set;
- private get;
- }
- #endregion
-
- #region MaxMipLevel
- public int MaxMipLevel
- {
- set;
- private get;
- }
- #endregion
-
- #region MipMapLevelOfDetailBias
- public float MipMapLevelOfDetailBias
- {
- set;
- private get;
- }
- #endregion
- #endregion
-
- #region Constructor
- ///
- /// Create a new sampler state object.
- ///
- internal SamplerStateGL3()
- {
- IsBound = false;
- }
- #endregion
-
- #region Apply
- ///
- /// Apply the sampler state.
- ///
- /// Graphics device.
- /// The index of which sampler should be modified.
- public void Apply(GraphicsDevice graphicsDevice, int index)
- {
- IsBound = true;
-
- // TODO: set stuff
- }
- #endregion
-
- #region Release
- ///
- /// Release the sampler state.
- ///
- public void Release()
- {
- IsBound = false;
- }
- #endregion
-
- #region Dispose
- ///
- /// Dispose the sampler state object.
- ///
- public void Dispose()
- {
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ShaderAttributeGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/ShaderAttributeGL3.cs
deleted file mode 100644
index 975ead34..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ShaderAttributeGL3.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-using System;
-using OpenTK.Graphics.OpenGL;
-using ANX.Framework.Graphics;
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- public struct ShaderAttributeGL3
- {
- #region Public
- public string Name;
- public int Location;
- public int Size;
- public ActiveAttribType Type;
- #endregion
-
- #region Constructor
- public ShaderAttributeGL3(int programHandle, int index)
- {
- Name = GL.GetActiveAttrib(programHandle, index, out Size, out Type);
- Location = GL.GetAttribLocation(programHandle, Name);
- }
- #endregion
-
- #region Bind
- public void Bind(VertexElementUsage usage, int stride, int offset)
- {
- GL.EnableVertexAttribArray(Location);
- ErrorHelper.Check("Failed to bind shader attribute " + Name);
-
- int size = 0;
- VertexAttribPointerType type = VertexAttribPointerType.Float;
- bool normalized = false;
-
- switch (usage)
- {
- case VertexElementUsage.Binormal:
- case VertexElementUsage.Normal:
- case VertexElementUsage.Tangent:
- case VertexElementUsage.BlendIndices:
- case VertexElementUsage.BlendWeight:
- case VertexElementUsage.Position:
- size = 3;
- break;
-
- case VertexElementUsage.Color:
- size = 4;
- type = VertexAttribPointerType.UnsignedByte;
- normalized = true;
- break;
-
- case VertexElementUsage.TextureCoordinate:
- size = 2;
- break;
-
- case VertexElementUsage.Fog:
- case VertexElementUsage.PointSize:
- case VertexElementUsage.TessellateFactor:
- size = 1;
- break;
-
- // TODO
- case VertexElementUsage.Depth:
- case VertexElementUsage.Sample:
- throw new NotImplementedException();
- }
-
- GL.VertexAttribPointer(Location, size, type, normalized, stride, (IntPtr)offset);
- }
- #endregion
-
- #region ToString
- public override string ToString()
- {
- return "ShaderAttribute{Name: " + Name +
- ", Location: " + Location +
- ", Size: " + Size +
- ", Type: " + Type + "}";
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ShaderByteCode.cs b/RenderSystems/ANX.Framework.Windows.GL3/ShaderByteCode.cs
deleted file mode 100644
index f6bf9e1a..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ShaderByteCode.cs
+++ /dev/null
@@ -1,437 +0,0 @@
-using System;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.Framework.Windows.GL3
-{
- internal static class ShaderByteCode
- {
- #region SpriteBatchShader
- internal static byte[] SpriteBatchByteCode = new byte[]
- {
- 187, 004, 118, 101, 114, 116, 101, 120, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034, 123, 117,
- 110, 105, 102, 111, 114, 109, 032, 109, 097, 116, 052, 032, 077, 097, 116,
- 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109, 059, 097, 116,
- 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 052, 032, 112, 111,
- 115, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099,
- 052, 032, 099, 111, 108, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101,
- 032, 118, 101, 099, 050, 032, 116, 101, 120, 059, 118, 097, 114, 121, 105,
- 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118,
- 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067,
- 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040,
- 032, 041, 123, 103, 108, 095, 080, 111, 115, 105, 116, 105, 111, 110, 061,
- 077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109,
- 042, 112, 111, 115, 059, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120,
- 067, 111, 111, 114, 100, 061, 116, 101, 120, 059, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 061, 099, 111, 108, 059, 125, 125, 125,
- 102, 114, 097, 103, 109, 101, 110, 116, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114, 034,
- 123, 117, 110, 105, 102, 111, 114, 109, 032, 115, 097, 109, 112, 108, 101,
- 114, 050, 068, 032, 084, 101, 120, 116, 117, 114, 101, 059, 118, 097, 114,
- 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103,
- 032, 118, 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105,
- 110, 040, 032, 041, 123, 103, 108, 095, 070, 114, 097, 103, 067, 111, 108,
- 111, 114, 061, 116, 101, 120, 116, 117, 114, 101, 050, 068, 040, 084, 101,
- 120, 116, 117, 114, 101, 044, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 041, 042, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 125, 125, 125, 116, 101, 099, 104, 110, 105,
- 113, 117, 101, 115, 123, 116, 101, 099, 104, 110, 105, 113, 117, 101, 032,
- 034, 083, 112, 114, 105, 116, 101, 084, 101, 099, 104, 110, 105, 113, 117,
- 101, 034, 123, 118, 101, 114, 116, 101, 120, 032, 034, 083, 112, 114, 105,
- 116, 101, 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034,
- 102, 114, 097, 103, 109, 101, 110, 116, 032, 034, 083, 112, 114, 105, 116,
- 101, 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114,
- 034, 125, 125, 085, 005, 093, 183, 066, 090, 070, 104, 093, 184, 253, 199,
- 246, 081, 152, 083, 013, 048, 171, 074, 063, 021, 247, 182, 129, 011, 094,
- 003, 189, 026, 178, 121, 230, 157, 193, 056, 001, 064, 136, 044, 054, 172,
- 146, 241, 173, 160, 182, 034, 092, 221, 158, 045, 049, 229, 144, 171, 015,
- 022, 089, 025, 248, 163, 175, 081
- };
- #endregion //SpriteBatchShader
-
- #region AlphaTestEffectShader
- internal static byte[] AlphaTestEffectByteCode = new byte[]
- {
- 187, 004, 118, 101, 114, 116, 101, 120, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034, 123, 117,
- 110, 105, 102, 111, 114, 109, 032, 109, 097, 116, 052, 032, 077, 097, 116,
- 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109, 059, 097, 116,
- 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 052, 032, 112, 111,
- 115, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099,
- 052, 032, 099, 111, 108, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101,
- 032, 118, 101, 099, 050, 032, 116, 101, 120, 059, 118, 097, 114, 121, 105,
- 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118,
- 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067,
- 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040,
- 032, 041, 123, 103, 108, 095, 080, 111, 115, 105, 116, 105, 111, 110, 061,
- 077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109,
- 042, 112, 111, 115, 059, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120,
- 067, 111, 111, 114, 100, 061, 116, 101, 120, 059, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 061, 099, 111, 108, 059, 125, 125, 125,
- 102, 114, 097, 103, 109, 101, 110, 116, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114, 034,
- 123, 117, 110, 105, 102, 111, 114, 109, 032, 115, 097, 109, 112, 108, 101,
- 114, 050, 068, 032, 084, 101, 120, 116, 117, 114, 101, 059, 118, 097, 114,
- 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103,
- 032, 118, 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105,
- 110, 040, 032, 041, 123, 103, 108, 095, 070, 114, 097, 103, 067, 111, 108,
- 111, 114, 061, 116, 101, 120, 116, 117, 114, 101, 050, 068, 040, 084, 101,
- 120, 116, 117, 114, 101, 044, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 041, 042, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 125, 125, 125, 116, 101, 099, 104, 110, 105,
- 113, 117, 101, 115, 123, 116, 101, 099, 104, 110, 105, 113, 117, 101, 032,
- 034, 083, 112, 114, 105, 116, 101, 084, 101, 099, 104, 110, 105, 113, 117,
- 101, 034, 123, 118, 101, 114, 116, 101, 120, 032, 034, 083, 112, 114, 105,
- 116, 101, 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034,
- 102, 114, 097, 103, 109, 101, 110, 116, 032, 034, 083, 112, 114, 105, 116,
- 101, 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114,
- 034, 125, 125, 085, 005, 093, 183, 066, 090, 070, 104, 093, 184, 253, 199,
- 246, 081, 152, 083, 013, 048, 171, 074, 063, 021, 247, 182, 129, 011, 094,
- 003, 189, 026, 178, 121, 230, 157, 193, 056, 001, 064, 136, 044, 054, 172,
- 146, 241, 173, 160, 182, 034, 092, 221, 158, 045, 049, 229, 144, 171, 015,
- 022, 089, 025, 248, 163, 175, 081
- };
- #endregion //AlphaTestEffectShader
-
- #region BasicEffectShader
- internal static byte[] BasicEffectByteCode = new byte[]
- {
- 187, 004, 118, 101, 114, 116, 101, 120, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034, 123, 117,
- 110, 105, 102, 111, 114, 109, 032, 109, 097, 116, 052, 032, 077, 097, 116,
- 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109, 059, 097, 116,
- 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 052, 032, 112, 111,
- 115, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099,
- 052, 032, 099, 111, 108, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101,
- 032, 118, 101, 099, 050, 032, 116, 101, 120, 059, 118, 097, 114, 121, 105,
- 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118,
- 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067,
- 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040,
- 032, 041, 123, 103, 108, 095, 080, 111, 115, 105, 116, 105, 111, 110, 061,
- 077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109,
- 042, 112, 111, 115, 059, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120,
- 067, 111, 111, 114, 100, 061, 116, 101, 120, 059, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 061, 099, 111, 108, 059, 125, 125, 125,
- 102, 114, 097, 103, 109, 101, 110, 116, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114, 034,
- 123, 117, 110, 105, 102, 111, 114, 109, 032, 115, 097, 109, 112, 108, 101,
- 114, 050, 068, 032, 084, 101, 120, 116, 117, 114, 101, 059, 118, 097, 114,
- 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103,
- 032, 118, 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105,
- 110, 040, 032, 041, 123, 103, 108, 095, 070, 114, 097, 103, 067, 111, 108,
- 111, 114, 061, 116, 101, 120, 116, 117, 114, 101, 050, 068, 040, 084, 101,
- 120, 116, 117, 114, 101, 044, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 041, 042, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 125, 125, 125, 116, 101, 099, 104, 110, 105,
- 113, 117, 101, 115, 123, 116, 101, 099, 104, 110, 105, 113, 117, 101, 032,
- 034, 083, 112, 114, 105, 116, 101, 084, 101, 099, 104, 110, 105, 113, 117,
- 101, 034, 123, 118, 101, 114, 116, 101, 120, 032, 034, 083, 112, 114, 105,
- 116, 101, 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034,
- 102, 114, 097, 103, 109, 101, 110, 116, 032, 034, 083, 112, 114, 105, 116,
- 101, 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114,
- 034, 125, 125, 085, 005, 093, 183, 066, 090, 070, 104, 093, 184, 253, 199,
- 246, 081, 152, 083, 013, 048, 171, 074, 063, 021, 247, 182, 129, 011, 094,
- 003, 189, 026, 178, 121, 230, 157, 193, 056, 001, 064, 136, 044, 054, 172,
- 146, 241, 173, 160, 182, 034, 092, 221, 158, 045, 049, 229, 144, 171, 015,
- 022, 089, 025, 248, 163, 175, 081
- };
- #endregion //BasicEffectShader
-
- #region DualTextureEffectShader
- internal static byte[] DualTextureEffectByteCode = new byte[]
- {
- 228, 019, 118, 101, 114, 116, 101, 120, 103, 108, 111, 098, 097, 108, 123,
- 117, 110, 105, 102, 111, 114, 109, 032, 118, 101, 099, 052, 032, 068, 105,
- 102, 102, 117, 115, 101, 067, 111, 108, 111, 114, 059, 117, 110, 105, 102,
- 111, 114, 109, 032, 118, 101, 099, 052, 032, 070, 111, 103, 086, 101, 099,
- 116, 111, 114, 059, 117, 110, 105, 102, 111, 114, 109, 032, 109, 097, 116,
- 052, 032, 087, 111, 114, 108, 100, 086, 105, 101, 119, 080, 114, 111, 106,
- 059, 125, 118, 101, 114, 116, 101, 120, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 086, 083, 068, 117, 097, 108,
- 084, 101, 120, 116, 117, 114, 101, 034, 123, 097, 116, 116, 114, 105, 098,
- 117, 116, 101, 032, 118, 101, 099, 052, 032, 112, 111, 115, 059, 097, 116,
- 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 050, 032, 116, 101,
- 120, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099,
- 050, 032, 116, 101, 120, 050, 059, 118, 097, 114, 121, 105, 110, 103, 032,
- 118, 101, 099, 052, 032, 100, 105, 102, 102, 117, 115, 101, 059, 118, 097,
- 114, 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 115, 112, 101, 099,
- 117, 108, 097, 114, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101,
- 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111,
- 111, 114, 100, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101, 099,
- 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111,
- 114, 100, 050, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040, 032,
- 041, 123, 103, 108, 095, 080, 111, 115, 105, 116, 105, 111, 110, 061, 087,
- 111, 114, 108, 100, 086, 105, 101, 119, 080, 114, 111, 106, 042, 112, 111,
- 115, 059, 100, 105, 102, 102, 117, 115, 101, 061, 068, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 059, 115, 112, 101, 099, 117, 108, 097,
- 114, 061, 118, 101, 099, 052, 040, 048, 044, 048, 044, 048, 044, 115, 097,
- 116, 117, 114, 097, 116, 101, 040, 100, 111, 116, 040, 112, 111, 115, 044,
- 070, 111, 103, 086, 101, 099, 116, 111, 114, 041, 041, 041, 059, 100, 105,
- 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114, 100, 061, 116,
- 101, 120, 059, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111,
- 111, 114, 100, 050, 061, 116, 101, 120, 050, 059, 125, 125, 115, 104, 097,
- 100, 101, 114, 032, 034, 086, 083, 068, 117, 097, 108, 084, 101, 120, 116,
- 117, 114, 101, 078, 111, 070, 111, 103, 034, 123, 097, 116, 116, 114, 105,
- 098, 117, 116, 101, 032, 118, 101, 099, 052, 032, 112, 111, 115, 059, 097,
- 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 050, 032, 116,
- 101, 120, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101,
- 099, 050, 032, 116, 101, 120, 050, 059, 118, 097, 114, 121, 105, 110, 103,
- 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117, 115, 101, 059, 118,
- 097, 114, 121, 105, 110, 103, 032, 118, 101, 099, 050, 032, 100, 105, 102,
- 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114, 100, 059, 118, 097,
- 114, 121, 105, 110, 103, 032, 118, 101, 099, 050, 032, 100, 105, 102, 102,
- 117, 115, 101, 084, 101, 120, 067, 111, 111, 114, 100, 050, 059, 118, 111,
- 105, 100, 032, 109, 097, 105, 110, 040, 032, 041, 123, 103, 108, 095, 080,
- 111, 115, 105, 116, 105, 111, 110, 061, 087, 111, 114, 108, 100, 086, 105,
- 101, 119, 080, 114, 111, 106, 042, 112, 111, 115, 059, 100, 105, 102, 102,
- 117, 115, 101, 061, 068, 105, 102, 102, 117, 115, 101, 067, 111, 108, 111,
- 114, 059, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111,
- 114, 100, 061, 116, 101, 120, 059, 100, 105, 102, 102, 117, 115, 101, 084,
- 101, 120, 067, 111, 111, 114, 100, 050, 061, 116, 101, 120, 050, 059, 125,
- 125, 115, 104, 097, 100, 101, 114, 032, 034, 086, 083, 068, 117, 097, 108,
- 084, 101, 120, 116, 117, 114, 101, 086, 101, 114, 116, 101, 120, 067, 111,
- 108, 111, 114, 034, 123, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032,
- 118, 101, 099, 052, 032, 112, 111, 115, 059, 097, 116, 116, 114, 105, 098,
- 117, 116, 101, 032, 118, 101, 099, 050, 032, 116, 101, 120, 059, 097, 116,
- 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 050, 032, 116, 101,
- 120, 050, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101,
- 099, 052, 032, 099, 111, 108, 059, 118, 097, 114, 121, 105, 110, 103, 032,
- 118, 101, 099, 052, 032, 100, 105, 102, 102, 117, 115, 101, 059, 118, 097,
- 114, 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 115, 112, 101, 099,
- 117, 108, 097, 114, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101,
- 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111,
- 111, 114, 100, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101, 099,
- 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111,
- 114, 100, 050, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040, 032,
- 041, 123, 103, 108, 095, 080, 111, 115, 105, 116, 105, 111, 110, 061, 087,
- 111, 114, 108, 100, 086, 105, 101, 119, 080, 114, 111, 106, 042, 112, 111,
- 115, 059, 100, 105, 102, 102, 117, 115, 101, 061, 068, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 042, 099, 111, 108, 059, 115, 112, 101,
- 099, 117, 108, 097, 114, 061, 118, 101, 099, 052, 040, 048, 044, 048, 044,
- 048, 044, 115, 097, 116, 117, 114, 097, 116, 101, 040, 100, 111, 116, 040,
- 112, 111, 115, 044, 070, 111, 103, 086, 101, 099, 116, 111, 114, 041, 041,
- 041, 059, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111,
- 114, 100, 061, 116, 101, 120, 059, 100, 105, 102, 102, 117, 115, 101, 084,
- 101, 120, 067, 111, 111, 114, 100, 050, 061, 116, 101, 120, 050, 059, 125,
- 125, 115, 104, 097, 100, 101, 114, 032, 034, 086, 083, 068, 117, 097, 108,
- 084, 101, 120, 116, 117, 114, 101, 086, 101, 114, 116, 101, 120, 067, 111,
- 108, 111, 114, 078, 111, 070, 111, 103, 034, 123, 097, 116, 116, 114, 105,
- 098, 117, 116, 101, 032, 118, 101, 099, 052, 032, 112, 111, 115, 059, 097,
- 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 050, 032, 116,
- 101, 120, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101,
- 099, 050, 032, 116, 101, 120, 050, 059, 097, 116, 116, 114, 105, 098, 117,
- 116, 101, 032, 118, 101, 099, 052, 032, 099, 111, 108, 059, 118, 097, 114,
- 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117,
- 115, 101, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101, 099, 050,
- 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114,
- 100, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101, 099, 050, 032,
- 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114, 100,
- 050, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040, 032, 041, 123,
- 103, 108, 095, 080, 111, 115, 105, 116, 105, 111, 110, 061, 087, 111, 114,
- 108, 100, 086, 105, 101, 119, 080, 114, 111, 106, 042, 112, 111, 115, 059,
- 100, 105, 102, 102, 117, 115, 101, 061, 068, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 042, 099, 111, 108, 059, 100, 105, 102, 102, 117,
- 115, 101, 084, 101, 120, 067, 111, 111, 114, 100, 061, 116, 101, 120, 059,
- 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114, 100,
- 050, 061, 116, 101, 120, 050, 059, 125, 125, 125, 102, 114, 097, 103, 109,
- 101, 110, 116, 103, 108, 111, 098, 097, 108, 123, 117, 110, 105, 102, 111,
- 114, 109, 032, 115, 097, 109, 112, 108, 101, 114, 050, 068, 032, 084, 101,
- 120, 116, 117, 114, 101, 059, 117, 110, 105, 102, 111, 114, 109, 032, 115,
- 097, 109, 112, 108, 101, 114, 050, 068, 032, 084, 101, 120, 116, 117, 114,
- 101, 050, 059, 117, 110, 105, 102, 111, 114, 109, 032, 118, 101, 099, 051,
- 032, 070, 111, 103, 067, 111, 108, 111, 114, 059, 125, 102, 114, 097, 103,
- 109, 101, 110, 116, 115, 104, 097, 100, 101, 114, 115, 123, 115, 104, 097,
- 100, 101, 114, 032, 034, 080, 083, 068, 117, 097, 108, 084, 101, 120, 116,
- 117, 114, 101, 034, 123, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101,
- 099, 052, 032, 100, 105, 102, 102, 117, 115, 101, 059, 118, 097, 114, 121,
- 105, 110, 103, 032, 118, 101, 099, 052, 032, 115, 112, 101, 099, 117, 108,
- 097, 114, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101, 099, 050,
- 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114,
- 100, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101, 099, 050, 032,
- 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114, 100,
- 050, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040, 032, 041, 123,
- 118, 101, 099, 052, 032, 099, 111, 108, 111, 114, 061, 116, 101, 120, 116,
- 117, 114, 101, 050, 068, 040, 084, 101, 120, 116, 117, 114, 101, 044, 100,
- 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114, 100, 041,
- 059, 118, 101, 099, 052, 032, 111, 118, 101, 114, 108, 097, 121, 061, 116,
- 101, 120, 116, 117, 114, 101, 050, 068, 040, 084, 101, 120, 116, 117, 114,
- 101, 050, 044, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111,
- 111, 114, 100, 050, 041, 059, 099, 111, 108, 111, 114, 046, 114, 103, 098,
- 032, 042, 061, 032, 050, 059, 099, 111, 108, 111, 114, 032, 042, 061, 032,
- 111, 118, 101, 114, 108, 097, 121, 042, 100, 105, 102, 102, 117, 115, 101,
- 059, 099, 111, 108, 111, 114, 046, 114, 103, 098, 061, 108, 101, 114, 112,
- 040, 099, 111, 108, 111, 114, 046, 114, 103, 098, 044, 070, 111, 103, 067,
- 111, 108, 111, 114, 042, 099, 111, 108, 111, 114, 046, 097, 044, 115, 112,
- 101, 099, 117, 108, 097, 114, 046, 119, 041, 059, 103, 108, 095, 070, 114,
- 097, 103, 067, 111, 108, 111, 114, 061, 099, 111, 108, 111, 114, 059, 125,
- 125, 115, 104, 097, 100, 101, 114, 032, 034, 080, 083, 068, 117, 097, 108,
- 084, 101, 120, 116, 117, 114, 101, 078, 111, 070, 111, 103, 034, 123, 118,
- 097, 114, 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102,
- 102, 117, 115, 101, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101,
- 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111,
- 111, 114, 100, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118, 101, 099,
- 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111,
- 114, 100, 050, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040, 032,
- 041, 123, 118, 101, 099, 052, 032, 099, 111, 108, 111, 114, 061, 116, 101,
- 120, 116, 117, 114, 101, 050, 068, 040, 084, 101, 120, 116, 117, 114, 101,
- 044, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067, 111, 111, 114,
- 100, 041, 059, 118, 101, 099, 052, 032, 111, 118, 101, 114, 108, 097, 121,
- 061, 116, 101, 120, 116, 117, 114, 101, 050, 068, 040, 084, 101, 120, 116,
- 117, 114, 101, 050, 044, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120,
- 067, 111, 111, 114, 100, 050, 041, 059, 099, 111, 108, 111, 114, 046, 114,
- 103, 098, 032, 042, 061, 032, 050, 059, 099, 111, 108, 111, 114, 032, 042,
- 061, 032, 111, 118, 101, 114, 108, 097, 121, 042, 100, 105, 102, 102, 117,
- 115, 101, 059, 103, 108, 095, 070, 114, 097, 103, 067, 111, 108, 111, 114,
- 061, 099, 111, 108, 111, 114, 059, 125, 125, 125, 116, 101, 099, 104, 110,
- 105, 113, 117, 101, 115, 123, 116, 101, 099, 104, 110, 105, 113, 117, 101,
- 032, 034, 068, 117, 097, 108, 084, 101, 120, 116, 117, 114, 101, 069, 102,
- 102, 101, 099, 116, 034, 123, 118, 101, 114, 116, 101, 120, 032, 034, 086,
- 083, 068, 117, 097, 108, 084, 101, 120, 116, 117, 114, 101, 034, 102, 114,
- 097, 103, 109, 101, 110, 116, 032, 034, 080, 083, 068, 117, 097, 108, 084,
- 101, 120, 116, 117, 114, 101, 034, 125, 116, 101, 099, 104, 110, 105, 113,
- 117, 101, 032, 034, 068, 117, 097, 108, 084, 101, 120, 116, 117, 114, 101,
- 069, 102, 102, 101, 099, 116, 078, 111, 070, 111, 103, 034, 123, 118, 101,
- 114, 116, 101, 120, 032, 034, 086, 083, 068, 117, 097, 108, 084, 101, 120,
- 116, 117, 114, 101, 078, 111, 070, 111, 103, 034, 102, 114, 097, 103, 109,
- 101, 110, 116, 032, 034, 080, 083, 068, 117, 097, 108, 084, 101, 120, 116,
- 117, 114, 101, 078, 111, 070, 111, 103, 034, 125, 116, 101, 099, 104, 110,
- 105, 113, 117, 101, 032, 034, 068, 117, 097, 108, 084, 101, 120, 116, 117,
- 114, 101, 069, 102, 102, 101, 099, 116, 086, 101, 114, 116, 101, 120, 067,
- 111, 108, 111, 114, 034, 123, 118, 101, 114, 116, 101, 120, 032, 034, 086,
- 083, 068, 117, 097, 108, 084, 101, 120, 116, 117, 114, 101, 086, 101, 114,
- 116, 101, 120, 067, 111, 108, 111, 114, 034, 102, 114, 097, 103, 109, 101,
- 110, 116, 032, 034, 080, 083, 068, 117, 097, 108, 084, 101, 120, 116, 117,
- 114, 101, 034, 125, 116, 101, 099, 104, 110, 105, 113, 117, 101, 032, 034,
- 068, 117, 097, 108, 084, 101, 120, 116, 117, 114, 101, 069, 102, 102, 101,
- 099, 116, 078, 111, 070, 111, 103, 086, 101, 114, 116, 101, 120, 067, 111,
- 108, 111, 114, 034, 123, 118, 101, 114, 116, 101, 120, 032, 034, 086, 083,
- 068, 117, 097, 108, 084, 101, 120, 116, 117, 114, 101, 086, 101, 114, 116,
- 101, 120, 067, 111, 108, 111, 114, 078, 111, 070, 111, 103, 034, 102, 114,
- 097, 103, 109, 101, 110, 116, 032, 034, 080, 083, 068, 117, 097, 108, 084,
- 101, 120, 116, 117, 114, 101, 078, 111, 070, 111, 103, 034, 125, 125, 175,
- 031, 128, 135, 091, 053, 148, 130, 202, 159, 176, 084, 033, 124, 189, 185,
- 203, 176, 133, 157, 191, 216, 029, 170, 061, 255, 076, 118, 188, 098, 065,
- 207, 215, 039, 153, 215, 233, 181, 035, 132, 019, 152, 136, 212, 164, 051,
- 001, 074, 135, 233, 177, 169, 110, 009, 048, 124, 035, 141, 123, 034, 179,
- 143, 110, 122
- };
- #endregion //DualTextureEffectShader
-
- #region EnvironmentMapEffectShader
- internal static byte[] EnvironmentMapEffectByteCode = new byte[]
- {
- 187, 004, 118, 101, 114, 116, 101, 120, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034, 123, 117,
- 110, 105, 102, 111, 114, 109, 032, 109, 097, 116, 052, 032, 077, 097, 116,
- 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109, 059, 097, 116,
- 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 052, 032, 112, 111,
- 115, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099,
- 052, 032, 099, 111, 108, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101,
- 032, 118, 101, 099, 050, 032, 116, 101, 120, 059, 118, 097, 114, 121, 105,
- 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118,
- 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067,
- 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040,
- 032, 041, 123, 103, 108, 095, 080, 111, 115, 105, 116, 105, 111, 110, 061,
- 077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109,
- 042, 112, 111, 115, 059, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120,
- 067, 111, 111, 114, 100, 061, 116, 101, 120, 059, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 061, 099, 111, 108, 059, 125, 125, 125,
- 102, 114, 097, 103, 109, 101, 110, 116, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114, 034,
- 123, 117, 110, 105, 102, 111, 114, 109, 032, 115, 097, 109, 112, 108, 101,
- 114, 050, 068, 032, 084, 101, 120, 116, 117, 114, 101, 059, 118, 097, 114,
- 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103,
- 032, 118, 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105,
- 110, 040, 032, 041, 123, 103, 108, 095, 070, 114, 097, 103, 067, 111, 108,
- 111, 114, 061, 116, 101, 120, 116, 117, 114, 101, 050, 068, 040, 084, 101,
- 120, 116, 117, 114, 101, 044, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 041, 042, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 125, 125, 125, 116, 101, 099, 104, 110, 105,
- 113, 117, 101, 115, 123, 116, 101, 099, 104, 110, 105, 113, 117, 101, 032,
- 034, 083, 112, 114, 105, 116, 101, 084, 101, 099, 104, 110, 105, 113, 117,
- 101, 034, 123, 118, 101, 114, 116, 101, 120, 032, 034, 083, 112, 114, 105,
- 116, 101, 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034,
- 102, 114, 097, 103, 109, 101, 110, 116, 032, 034, 083, 112, 114, 105, 116,
- 101, 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114,
- 034, 125, 125, 085, 005, 093, 183, 066, 090, 070, 104, 093, 184, 253, 199,
- 246, 081, 152, 083, 013, 048, 171, 074, 063, 021, 247, 182, 129, 011, 094,
- 003, 189, 026, 178, 121, 230, 157, 193, 056, 001, 064, 136, 044, 054, 172,
- 146, 241, 173, 160, 182, 034, 092, 221, 158, 045, 049, 229, 144, 171, 015,
- 022, 089, 025, 248, 163, 175, 081
- };
- #endregion //EnvironmentMapEffectShader
-
- #region SkinnedEffectShader
- internal static byte[] SkinnedEffectByteCode = new byte[]
- {
- 187, 004, 118, 101, 114, 116, 101, 120, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034, 123, 117,
- 110, 105, 102, 111, 114, 109, 032, 109, 097, 116, 052, 032, 077, 097, 116,
- 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109, 059, 097, 116,
- 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099, 052, 032, 112, 111,
- 115, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101, 032, 118, 101, 099,
- 052, 032, 099, 111, 108, 059, 097, 116, 116, 114, 105, 098, 117, 116, 101,
- 032, 118, 101, 099, 050, 032, 116, 101, 120, 059, 118, 097, 114, 121, 105,
- 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103, 032, 118,
- 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120, 067,
- 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105, 110, 040,
- 032, 041, 123, 103, 108, 095, 080, 111, 115, 105, 116, 105, 111, 110, 061,
- 077, 097, 116, 114, 105, 120, 084, 114, 097, 110, 115, 102, 111, 114, 109,
- 042, 112, 111, 115, 059, 100, 105, 102, 102, 117, 115, 101, 084, 101, 120,
- 067, 111, 111, 114, 100, 061, 116, 101, 120, 059, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 061, 099, 111, 108, 059, 125, 125, 125,
- 102, 114, 097, 103, 109, 101, 110, 116, 115, 104, 097, 100, 101, 114, 115,
- 123, 115, 104, 097, 100, 101, 114, 032, 034, 083, 112, 114, 105, 116, 101,
- 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114, 034,
- 123, 117, 110, 105, 102, 111, 114, 109, 032, 115, 097, 109, 112, 108, 101,
- 114, 050, 068, 032, 084, 101, 120, 116, 117, 114, 101, 059, 118, 097, 114,
- 121, 105, 110, 103, 032, 118, 101, 099, 052, 032, 100, 105, 102, 102, 117,
- 115, 101, 067, 111, 108, 111, 114, 059, 118, 097, 114, 121, 105, 110, 103,
- 032, 118, 101, 099, 050, 032, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 059, 118, 111, 105, 100, 032, 109, 097, 105,
- 110, 040, 032, 041, 123, 103, 108, 095, 070, 114, 097, 103, 067, 111, 108,
- 111, 114, 061, 116, 101, 120, 116, 117, 114, 101, 050, 068, 040, 084, 101,
- 120, 116, 117, 114, 101, 044, 100, 105, 102, 102, 117, 115, 101, 084, 101,
- 120, 067, 111, 111, 114, 100, 041, 042, 100, 105, 102, 102, 117, 115, 101,
- 067, 111, 108, 111, 114, 059, 125, 125, 125, 116, 101, 099, 104, 110, 105,
- 113, 117, 101, 115, 123, 116, 101, 099, 104, 110, 105, 113, 117, 101, 032,
- 034, 083, 112, 114, 105, 116, 101, 084, 101, 099, 104, 110, 105, 113, 117,
- 101, 034, 123, 118, 101, 114, 116, 101, 120, 032, 034, 083, 112, 114, 105,
- 116, 101, 086, 101, 114, 116, 101, 120, 083, 104, 097, 100, 101, 114, 034,
- 102, 114, 097, 103, 109, 101, 110, 116, 032, 034, 083, 112, 114, 105, 116,
- 101, 070, 114, 097, 103, 109, 101, 110, 116, 083, 104, 097, 100, 101, 114,
- 034, 125, 125, 085, 005, 093, 183, 066, 090, 070, 104, 093, 184, 253, 199,
- 246, 081, 152, 083, 013, 048, 171, 074, 063, 021, 247, 182, 129, 011, 094,
- 003, 189, 026, 178, 121, 230, 157, 193, 056, 001, 064, 136, 044, 054, 172,
- 146, 241, 173, 160, 182, 034, 092, 221, 158, 045, 049, 229, 144, 171, 015,
- 022, 089, 025, 248, 163, 175, 081
- };
- #endregion //SkinnedEffectShader
-
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ShaderData.cs b/RenderSystems/ANX.Framework.Windows.GL3/ShaderData.cs
deleted file mode 100644
index 86b889e8..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ShaderData.cs
+++ /dev/null
@@ -1,30 +0,0 @@
-using System;
-using System.Collections.Generic;
-using StringPair = System.Collections.Generic.KeyValuePair;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- public class ShaderData
- {
- public string VertexGlobalCode;
-
- public Dictionary VertexShaderCodes;
-
- public string FragmentGlobalCode;
-
- public Dictionary FragmentShaderCodes;
-
- public Dictionary Techniques;
-
- public ShaderData()
- {
- VertexShaderCodes = new Dictionary();
- FragmentShaderCodes = new Dictionary();
- Techniques = new Dictionary();
- }
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/ShaderHelper.cs b/RenderSystems/ANX.Framework.Windows.GL3/ShaderHelper.cs
deleted file mode 100644
index 0cee507b..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/ShaderHelper.cs
+++ /dev/null
@@ -1,362 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Security.Cryptography;
-using StringPair = System.Collections.Generic.KeyValuePair;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- public static class ShaderHelper
- {
- #region SaveShaderCode (for external)
- public static byte[] SaveShaderCode(string effectCode)
- {
- effectCode = CleanCode(effectCode);
-
- MemoryStream stream = new MemoryStream();
- BinaryWriter writer = new BinaryWriter(stream);
-
- // First of all writer the shader code (which is already preceeded
- // by a length identifier, making it harder to manipulate the code)
- writer.Write(effectCode);
-
- // And now we additionally generate a sha hash so it nearly becomes
- // impossible to manipulate the shader.
- using (SHA512Managed sha = new SHA512Managed())
- {
- byte[] data = stream.ToArray();
- byte[] hash = sha.ComputeHash(data);
- // The hash is added to the end of the stream.
- writer.Write(hash);
- writer.Flush();
- }
-
- return stream.ToArray();
- }
- #endregion
-
- #region LoadShaderCode
- public static string LoadShaderCode(Stream stream)
- {
- BinaryReader reader = new BinaryReader(stream);
- // First load the source.
- string source = reader.ReadString();
- byte[] hash;
- // And now check if it was manipulated.
- using (SHA512Managed sha = new SHA512Managed())
- {
- int lengthRead = (int)stream.Position;
- stream.Position = 0;
- byte[] data = reader.ReadBytes(lengthRead);
- hash = sha.ComputeHash(data);
- }
- byte[] loadedHash = reader.ReadBytes(64);
- for (int index = 0; index < hash.Length; index++)
- {
- if (hash[index] != loadedHash[index])
- {
- throw new InvalidDataException("Failed to load the shader " +
- "because the data got manipulated!");
- }
- }
-
- return source;
- }
- #endregion
-
- #region CleanCode
- private static string CleanCode(string input)
- {
- // We wanna clean up the shader a little bit, so we remove
- // empty lines, spaces and tabs at beginning and end and also
- // remove comments.
- List lines = new List(input.Split('\n'));
- input = "";
- for (int index = lines.Count - 1; index >= 0; index--)
- {
- lines[index] = lines[index].Trim();
- if (String.IsNullOrEmpty(lines[index]) ||
- lines[index].StartsWith("//"))
- {
- lines.RemoveAt(index);
- continue;
- }
-
- input = lines[index] + input;
- }
-
- #region Multiline comment removing
- input = input.Replace("/*/*", "/* /*");
- input = input.Replace("*/*/", "*/ */");
-
- int length = input.Length;
- int foundStartIndex = -1;
- int openCommentsCount = 0;
- for (int index = 0; index < length - 1; index++)
- {
- if (input[index] == '/' &&
- input[index + 1] == '*')
- {
- if (openCommentsCount == 0)
- {
- foundStartIndex = index;
- }
- openCommentsCount++;
- }
-
- if (input[index] == '*' &&
- input[index + 1] == '/')
- {
- openCommentsCount--;
- if (openCommentsCount == 0)
- {
- int commentLength = index - foundStartIndex + 2;
- length -= commentLength;
- index = foundStartIndex - 1;
- input = input.Remove(foundStartIndex, commentLength);
- foundStartIndex = -1;
- }
- }
- }
-
- if (openCommentsCount > 0)
- {
- throw new Exception("Unable to clean the shader code because it seems " +
- "some multiline comments interfere with each other or with the code. " +
- "Please make sure your shader code and comments are well formatted!");
- }
- #endregion
-
- // Now to some additional cleanup
- string[] minimizables =
- {
- " * ", " = ", " + ", " / ", " - ", ", ",
- };
-
- foreach (string mizable in minimizables)
- {
- input = input.Replace(mizable, mizable.Trim());
- }
-
- return input;
- }
- #endregion
-
- #region ParseShaderCode
- public static ShaderData ParseShaderCode(string source)
- {
- ShaderData result = new ShaderData();
-
- string[] partIdentifiers =
- {
- "vertexglobal",
- "vertexshaders",
- "fragmentglobal",
- "fragmentshaders",
- "techniques",
- };
-
- int index = 0;
- while (index < source.Length)
- {
- for (int partIdsIndex = 0; partIdsIndex < partIdentifiers.Length; partIdsIndex++)
- {
- string partId = partIdentifiers[partIdsIndex];
- bool isValid = true;
- for (int partIndex = 0; partIndex < partId.Length; partIndex++)
- {
- if (source[index + partIndex] != partId[partIndex])
- {
- isValid = false;
- break;
- }
- }
-
- if (isValid)
- {
- int startIndex = index + partId.Length;
- startIndex = source.IndexOf('{', startIndex) + 1;
- string area = ExtractArea(source, startIndex);
- index = startIndex + area.Length - 1;
- switch (partIdsIndex)
- {
- case 0:
- result.VertexGlobalCode = area;
- break;
- case 2:
- result.FragmentGlobalCode = area;
- break;
- case 1:
- ExtractNamedAreas(area, "shader", 0, result);
- break;
- case 3:
- ExtractNamedAreas(area, "shader", 1, result);
- break;
- case 4:
- ExtractNamedAreas(area, "technique", 2, result);
- break;
- }
- }
- }
-
- index++;
- }
-
- return result;
- }
- #endregion
-
- #region ExtractNamedAreas
- private static void ExtractNamedAreas(string areaSource, string identifier,
- int addToId, ShaderData result)
- {
- int index = 0;
- while (index < areaSource.Length)
- {
- bool isValid = true;
- for (int partIndex = 0; partIndex < identifier.Length; partIndex++)
- {
- if (areaSource[index + partIndex] != identifier[partIndex])
- {
- isValid = false;
- break;
- }
- }
-
- if (isValid)
- {
- int startIndex = index + identifier.Length;
- startIndex = areaSource.IndexOf('"', startIndex) + 1;
-
- string name = areaSource.Substring(startIndex,
- areaSource.IndexOf('"', startIndex) - startIndex);
-
- startIndex = areaSource.IndexOf('{', startIndex) + 1;
- string area = ExtractArea(areaSource, startIndex);
-
- switch (addToId)
- {
- case 0:
- result.VertexShaderCodes.Add(name, area);
- break;
- case 1:
- result.FragmentShaderCodes.Add(name, area);
- break;
- case 2:
- int vertexIndex = area.IndexOf("vertex");
- vertexIndex = area.IndexOf('"', vertexIndex) + 1;
- string vertexName = area.Substring(vertexIndex,
- area.IndexOf('"', vertexIndex) - vertexIndex);
-
- int fragmentIndex = area.IndexOf("fragment");
- fragmentIndex = area.IndexOf('"', fragmentIndex) + 1;
- string fragmentName = area.Substring(fragmentIndex,
- area.IndexOf('"', fragmentIndex) - fragmentIndex);
- result.Techniques.Add(name, new StringPair(vertexName, fragmentName));
- break;
- }
- }
-
- index++;
- }
- }
- #endregion
-
- #region ExtractArea
- private static string ExtractArea(string source, int startIndex)
- {
- int endIndex = startIndex;
- int openBraceCount = 0;
- for (int index = startIndex; index < source.Length; index++)
- {
- if (source[index] == '{')
- {
- openBraceCount++;
- }
- if (source[index] == '}')
- {
- openBraceCount--;
- }
- if (openBraceCount == -1)
- {
- endIndex = index;
- break;
- }
- }
- return source.Substring(startIndex, endIndex - startIndex);
- }
- #endregion
-
- private class Tests
- {
- #region TestCleanCode
- public static void TestCleanCode()
- {
- string input = File.ReadAllText(@"..\..\shader\GL3\SpriteBatch_GLSL.fx");
- Console.WriteLine(CleanCode(input));
- }
- #endregion
-
- #region TestCleanCodeWithExtendedComments
- public static void TestCleanCodeWithExtendedComments()
- {
- string input =
-@"// This is a simple comment.
-
-/*Hello
-im a multiline comment*/
-
-/* Multiline on a single line */
-
-/* And now the hardcore...a multiline comment
-/*in a multiline comment/*in another one
-*/*/
-Wow...
-*/
-";
- Console.WriteLine(CleanCode(input));
- }
- #endregion
-
- #region TestParseShaderCode
- public static void TestParseShaderCode()
- {
- string input = CleanCode(File.ReadAllText(
- @"..\..\shader\GL3\SpriteBatch_GLSL.fx"));
-
- ShaderData data = ParseShaderCode(input);
-
- Console.WriteLine("Vertex globals:");
- Console.WriteLine(data.VertexGlobalCode);
- Console.WriteLine("-------------------------");
- Console.WriteLine("Fragment globals:");
- Console.WriteLine(data.FragmentGlobalCode);
- Console.WriteLine("-------------------------");
- foreach (StringPair pair in data.VertexShaderCodes)
- {
- Console.WriteLine("vertex shader: " + pair.Key);
- Console.WriteLine(pair.Value);
- Console.WriteLine("-------------------------");
- }
- foreach (StringPair pair in data.FragmentShaderCodes)
- {
- Console.WriteLine("fragment shader: " + pair.Key);
- Console.WriteLine(pair.Value);
- Console.WriteLine("-------------------------");
- }
- foreach (KeyValuePair pair in data.Techniques)
- {
- Console.WriteLine("technique: " + pair.Key);
- Console.WriteLine("vertex shader: " + pair.Value.Key);
- Console.WriteLine("fragment shader: " + pair.Value.Value);
- Console.WriteLine("-------------------------");
- }
- }
- #endregion
- }
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/SupportedPlatformsImpl.cs b/RenderSystems/ANX.Framework.Windows.GL3/SupportedPlatformsImpl.cs
deleted file mode 100644
index 4d6a6202..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/SupportedPlatformsImpl.cs
+++ /dev/null
@@ -1,28 +0,0 @@
-using System;
-using ANX.Framework.NonXNA;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- public class SupportedPlatformsImpl : ISupportedPlatforms
- {
- public PlatformName[] Names
- {
- get
- {
- return new PlatformName[]
- {
- PlatformName.WindowsXP,
- PlatformName.WindowsVista,
- PlatformName.Windows7,
- PlatformName.Windows8,
- PlatformName.Linux,
- PlatformName.MacOSX,
- };
- }
- }
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/Texture2DGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/Texture2DGL3.cs
deleted file mode 100644
index ffd5e01c..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/Texture2DGL3.cs
+++ /dev/null
@@ -1,339 +0,0 @@
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using ANX.Framework;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA.RenderSystem;
-using ANX.RenderSystem.Windows.GL3.Helpers;
-using OpenTK.Graphics.OpenGL;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- public class Texture2DGL3 : INativeTexture2D
- {
- #region Private
- private PixelInternalFormat nativeFormat;
-
- ///
- /// [1-n]
- ///
- private int numberOfMipMaps;
-
- private int width;
- private int height;
- private bool isCompressed;
- internal bool IsDisposed;
- private int uncompressedDataSize;
- private byte[] texData;
- private int maxSetDataSize;
- #endregion
-
- #region Public
- protected internal int NativeHandle { get; protected set; }
- #endregion
-
- #region Constructor
- internal Texture2DGL3()
- {
- GraphicsResourceManager.UpdateResource(this, true);
- }
-
- internal Texture2DGL3(SurfaceFormat surfaceFormat, int setWidth, int setHeight, int mipCount)
- {
- GraphicsResourceManager.UpdateResource(this, true);
-
- width = setWidth;
- height = setHeight;
- numberOfMipMaps = mipCount;
- nativeFormat = DatatypesMapping.SurfaceToPixelInternalFormat(surfaceFormat);
- isCompressed = nativeFormat.ToString().StartsWith("Compressed");
-
- uncompressedDataSize = GetUncompressedDataSize();
-
- CreateTexture();
- }
-
- ~Texture2DGL3()
- {
- GraphicsResourceManager.UpdateResource(this, false);
- }
- #endregion
-
- #region CreateTexture
- private void CreateTexture()
- {
- NativeHandle = GL.GenTexture();
- GL.BindTexture(TextureTarget.Texture2D, NativeHandle);
-
- int wrapMode = (int)All.ClampToEdge;
- All minFilter = numberOfMipMaps > 1 ? All.LinearMipmapLinear : All.Linear;
-
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapS, wrapMode);
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureWrapT, wrapMode);
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMagFilter, (int)All.Linear);
- GL.TexParameter(TextureTarget.Texture2D, TextureParameterName.TextureMinFilter, (int)minFilter);
-#if DEBUG
- ErrorHelper.Check("TexParameter");
-#endif
- }
- #endregion
-
- // TODO: offsetInBytes
- // TODO: elementCount
- #region SetData
- public void SetData(GraphicsDevice graphicsDevice, T[] data) where T : struct
- {
- SetData(graphicsDevice, 0, data, 0, data.Length);
- }
-
- public void SetData(GraphicsDevice graphicsDevice, T[] data, int startIndex, int elementCount) where T : struct
- {
- SetData(graphicsDevice, 0, data, 0, data.Length);
- }
-
- public void SetData(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
- {
- int size = Marshal.SizeOf(typeof(T)) * data.Length;
- if (size > maxSetDataSize)
- maxSetDataSize = size;
-
- GL.BindTexture(TextureTarget.Texture2D, NativeHandle);
- GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
-
- try
- {
- IntPtr dataPointer = handle.AddrOfPinnedObject();
- // Go to the starting point.
- dataPointer += startIndex;
-
- int mipmapWidth = Math.Max(width >> level, 1);
- int mipmapHeight = Math.Max(height >> level, 1);
-
- if (isCompressed)
- {
- GL.CompressedTexImage2D(TextureTarget.Texture2D, level, nativeFormat, width, height, 0, data.Length,
- dataPointer);
-#if DEBUG
- ErrorHelper.Check("CompressedTexImage2D Format=" + nativeFormat);
-#endif
- }
- else
- {
- GL.TexImage2D(TextureTarget.Texture2D, level, nativeFormat, mipmapWidth, mipmapHeight, 0,
- (PixelFormat)nativeFormat, PixelType.UnsignedByte, dataPointer);
-#if DEBUG
- ErrorHelper.Check("TexImage2D Format=" + nativeFormat);
-#endif
- }
- }
- finally
- {
- handle.Free();
- }
- }
-
- public void SetData(GraphicsDevice graphicsDevice, int offsetInBytes, T[] data, int startIndex, int elementCount)
- where T : struct
- {
- int size = Marshal.SizeOf(typeof(T)) * data.Length;
- if (size > maxSetDataSize)
- maxSetDataSize = size;
-
- GL.BindTexture(TextureTarget.Texture2D, NativeHandle);
- GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
-
- try
- {
- IntPtr dataPointer = handle.AddrOfPinnedObject();
- dataPointer += startIndex;
-
- if (isCompressed)
- {
- GL.CompressedTexImage2D(TextureTarget.Texture2D, 0, nativeFormat, width, height, 0, data.Length, dataPointer);
-#if DEBUG
- ErrorHelper.Check("CompressedTexImage2D Format=" + nativeFormat);
-#endif
- }
- else
- {
- GL.TexImage2D(TextureTarget.Texture2D, 0, nativeFormat, width, height, 0, (PixelFormat)nativeFormat,
- PixelType.UnsignedByte, dataPointer);
-#if DEBUG
- ErrorHelper.Check("TexImage2D Format=" + nativeFormat);
-#endif
- }
- }
- finally
- {
- handle.Free();
- }
- }
- #endregion
-
- #region GetData (TODO)
- public void GetData(int level, Rectangle? rect, T[] data, int startIndex, int elementCount) where T : struct
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region GetData
- public void GetData(T[] data) where T : struct
- {
- GetData(data, 0, data.Length);
- }
- #endregion
-
- // TODO: compressed texture (see: http://www.bearisgaming.com/texture2d-getdata-and-dxt-compression/)
- // TODO: elementCount
- #region GetData
- public void GetData(T[] data, int startIndex, int elementCount) where T : struct
- {
- if (isCompressed)
- throw new NotImplementedException("GetData is currently not implemented for compressed texture format " +
- nativeFormat + ".");
-
- if (data == null)
- throw new ArgumentNullException("data");
-
- int size = Marshal.SizeOf(typeof(T)) * data.Length;
-
- if (size < uncompressedDataSize)
- throw new InvalidDataException("The size of the data passed in is too large or too small for this resource.");
-
- GCHandle handle = GCHandle.Alloc(data, GCHandleType.Pinned);
- IntPtr ptr = handle.AddrOfPinnedObject();
- ptr += startIndex;
-
- GL.GetTexImage(TextureTarget.Texture2D, 0, (PixelFormat)nativeFormat, PixelType.UnsignedByte, ptr);
-
- handle.Free();
- }
- #endregion
-
- #region GetTextureData
- private void GetTextureData()
- {
- GL.BindTexture(TextureTarget.Texture2D, NativeHandle);
-
- if (isCompressed)
- {
- texData = new byte[maxSetDataSize];
- GCHandle handle = GCHandle.Alloc(texData, GCHandleType.Pinned);
-
- GL.GetCompressedTexImage(TextureTarget.Texture2D, 0, handle.AddrOfPinnedObject());
-
- handle.Free();
- }
- else
- {
- texData = new byte[uncompressedDataSize];
- GCHandle handle = GCHandle.Alloc(texData, GCHandleType.Pinned);
-
- GL.GetTexImage(TextureTarget.Texture2D, 0, (PixelFormat)nativeFormat, PixelType.UnsignedByte,
- handle.AddrOfPinnedObject());
-
- handle.Free();
- }
- }
- #endregion
-
- #region RecreateData
- internal void RecreateData()
- {
- CreateTexture();
- SetData(null, texData);
- texData = null;
- }
- #endregion
-
- #region GetUncompressedDataSize
- private int GetUncompressedDataSize()
- {
- int size = width * height;
-
- switch (nativeFormat)
- {
- default:
- case PixelInternalFormat.R32f:
- case PixelInternalFormat.Rgb10A2:
- case PixelInternalFormat.Rg16:
- case PixelInternalFormat.Rgba:
- size *= 4;
- break;
-
- case PixelInternalFormat.Rg32f:
- case PixelInternalFormat.Rgba16f:
- size *= 8;
- break;
-
- case PixelInternalFormat.R16f:
- case PixelInternalFormat.Rgb5A1:
- case PixelInternalFormat.Rgba4:
- size *= 2;
- break;
-
- case PixelInternalFormat.Alpha8:
- //size *= 1;
- break;
-
- case PixelInternalFormat.Rgba32f:
- size *= 16;
- break;
- }
-
- return size;
- }
- #endregion
-
- #region SaveAsJpeg (TODO)
- public void SaveAsJpeg(Stream stream, int width, int height)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region SaveAsPng (TODO)
- public void SaveAsPng(Stream stream, int width, int height)
- {
- throw new NotImplementedException();
- }
- #endregion
-
- #region Dispose
- ///
- /// Dispose the native OpenGL texture handle.
- ///
- public virtual void Dispose()
- {
- if (IsDisposed == false)
- {
- IsDisposed = true;
- DisposeResource();
- }
- }
-
- internal void DisposeResource()
- {
- if (IsDisposed == false)
- {
- GetTextureData();
- }
-
- if (NativeHandle != -1 &&
- GraphicsDeviceWindowsGL3.IsContextCurrent)
- {
- GL.DeleteTexture(NativeHandle);
- NativeHandle = -1;
-#if DEBUG
- ErrorHelper.Check("DeleteTexture");
-#endif
- }
- }
- #endregion
- }
-}
diff --git a/RenderSystems/ANX.Framework.Windows.GL3/VertexBufferGL3.cs b/RenderSystems/ANX.Framework.Windows.GL3/VertexBufferGL3.cs
deleted file mode 100644
index 55254243..00000000
--- a/RenderSystems/ANX.Framework.Windows.GL3/VertexBufferGL3.cs
+++ /dev/null
@@ -1,307 +0,0 @@
-using System;
-using System.Runtime.InteropServices;
-using ANX.Framework.Graphics;
-using ANX.Framework.NonXNA.RenderSystem;
-using OpenTK.Graphics.OpenGL;
-using ANX.RenderSystem.Windows.GL3.Helpers;
-
-// This file is part of the ANX.Framework created by the
-// "ANX.Framework developer group" and released under the Ms-PL license.
-// For details see: http://anxframework.codeplex.com/license
-
-namespace ANX.RenderSystem.Windows.GL3
-{
- ///
- /// Native OpenGL implementation of a Vertex Buffer.
- ///
- /// Great tutorial about VBO/IBO directly for OpenTK:
- /// http://www.opentk.com/doc/graphics/geometry/vertex-buffer-objects
- ///
- public class VertexBufferGL3 : INativeVertexBuffer
- {
- #region Private
- private VertexBuffer managedBuffer;
-
- ///
- /// Native vertex buffer handle.
- ///
- private int bufferHandle;
- internal int BufferHandle
- {
- get
- {
- return bufferHandle;
- }
- }
-
- private VertexDeclaration vertexDeclaration;
-
- private BufferUsage usage;
-
- private int vertexCount;
-
- private BufferUsageHint usageHint;
-
- internal bool IsDisposed;
- #endregion
-
- #region Constructor
- ///
- /// Create a new Vertex Buffer object.
- ///
- internal VertexBufferGL3(VertexBuffer setManagedBuffer,
- VertexDeclaration setVertexDeclaration, int setVertexCount,
- BufferUsage setUsage)
- {
- GraphicsResourceManager.UpdateResource(this, true);
-
- managedBuffer = setManagedBuffer;
- vertexDeclaration = setVertexDeclaration;
- usage = setUsage;
- vertexCount = setVertexCount;
-
- bool isDynamicBuffer = managedBuffer is DynamicVertexBuffer;
-
- usageHint = isDynamicBuffer ?
- BufferUsageHint.DynamicDraw :
- BufferUsageHint.StaticDraw;
-
- CreateBuffer();
- }
-
- ~VertexBufferGL3()
- {
- GraphicsResourceManager.UpdateResource(this, false);
- }
- #endregion
-
- #region CreateBuffer
- private void CreateBuffer()
- {
- GL.GenBuffers(1, out bufferHandle);
- ErrorHelper.Check("GenBuffers");
- GL.BindBuffer(BufferTarget.ArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
- int size = vertexDeclaration.VertexStride * vertexCount;
- GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)size, IntPtr.Zero,
- usageHint);
- ErrorHelper.Check("BufferData");
-
- int setSize;
- GL.GetBufferParameter(BufferTarget.ArrayBuffer,
- BufferParameterName.BufferSize, out setSize);
- if (setSize != size)
- {
- throw new Exception("Failed to set the vertexBuffer data. DataSize=" +
- size + " SetSize=" + setSize);
- }
- }
- #endregion
-
- #region RecreateData
- internal void RecreateData()
- {
- CreateBuffer();
- }
- #endregion
-
- #region SetData
- public void SetData(GraphicsDevice graphicsDevice, T[] data)
- where T : struct
- {
- BufferData(data, 0);
- }
- #endregion
-
- #region SetData
- public void SetData(GraphicsDevice graphicsDevice, T[] data,
- int startIndex, int elementCount) where T : struct
- {
- if (startIndex != 0 ||
- elementCount != data.Length)
- {
- T[] subArray = new T[elementCount];
- Array.Copy(data, startIndex, subArray, 0, elementCount);
- BufferData(subArray, 0);
- }
- else
- {
- BufferData(data, 0);
- }
- }
- #endregion
-
- #region SetData
- public void SetData(GraphicsDevice graphicsDevice, int offsetInBytes,
- T[] data, int startIndex, int elementCount) where T : struct
- {
- if (startIndex != 0 ||
- elementCount != data.Length)
- {
- T[] subArray = new T[elementCount];
- Array.Copy(data, startIndex, subArray, 0, elementCount);
- BufferData(subArray, offsetInBytes);
- }
- else
- {
- BufferData(data, offsetInBytes);
- }
- }
- #endregion
-
- #region SetData
- public void SetData(GraphicsDevice graphicsDevice, int offsetInBytes,
- T[] data, int startIndex, int elementCount, int vertexStride) where T : struct
- {
- T[] elements;
- if (startIndex != 0 ||
- elementCount != data.Length)
- {
- elements = new T[elementCount];
- Array.Copy(data, startIndex, elements, 0, elementCount);
- }
- else
- {
- elements = data;
- }
-
- int size = Marshal.SizeOf(typeof(T));
-
- GL.BindBuffer(BufferTarget.ArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
-
- for (int index = 0; index < elementCount; index++)
- {
- GL.BufferSubData(BufferTarget.ArrayBuffer,
- (IntPtr)offsetInBytes + (index * vertexStride),
- (IntPtr)size, ref elements[index]);
- ErrorHelper.Check("BufferSubData");
- }
- }
- #endregion
-
- #region BufferData (private helper)
- private void BufferData(T[] data, int offset) where T : struct
- {
- int size = Marshal.SizeOf(typeof(T)) * data.Length;
-
- GL.BindBuffer(BufferTarget.ArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
-
- GL.BufferSubData(BufferTarget.ArrayBuffer, (IntPtr)offset,
- (IntPtr)size, data);
- ErrorHelper.Check("BufferSubData");
- }
- #endregion
-
- #region GetData
- public void GetData(T[] data) where T : struct
- {
- int size = Marshal.SizeOf(typeof(T)) * data.Length;
-
- GL.BindBuffer(BufferTarget.ArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
-
- GL.GetBufferSubData(BufferTarget.ArrayBuffer, IntPtr.Zero,
- (IntPtr)size, data);
- ErrorHelper.Check("GetBufferSubData");
- }
- #endregion
-
- #region GetData
- public void GetData(T[] data, int startIndex, int elementCount)
- where T : struct
- {
- T[] copyElements = new T[elementCount];
- int size = Marshal.SizeOf(typeof(T)) * elementCount;
-
- GL.BindBuffer(BufferTarget.ArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
-
- GL.GetBufferSubData(BufferTarget.ArrayBuffer, (IntPtr)0,
- (IntPtr)size, copyElements);
- ErrorHelper.Check("GetBufferSubData");
-
- Array.Copy(copyElements, 0, data, startIndex, elementCount);
- }
- #endregion
-
- #region GetData
- public void GetData(int offsetInBytes, T[] data, int startIndex,
- int elementCount, int vertexStride) where T : struct
- {
- T[] copyElements = new T[elementCount];
- int size = Marshal.SizeOf(typeof(T));
-
- GL.BindBuffer(BufferTarget.ArrayBuffer, bufferHandle);
- ErrorHelper.Check("BindBuffer");
-
- for (int index = 0; index < elementCount; index++)
- {
- GL.GetBufferSubData(BufferTarget.ArrayBuffer,
- (IntPtr)offsetInBytes + (index * vertexStride),
- (IntPtr)size,
- ref copyElements[index]);
- ErrorHelper.Check("GetBufferSubData");
- }
-
- Array.Copy(copyElements, 0, data, startIndex, elementCount);
- }
- #endregion
-
- #region Bind
- public void Bind(EffectGL3 activeEffect)
- {
- GL.BindBuffer(BufferTarget.ArrayBuffer, BufferHandle);
- ErrorHelper.Check("BindBuffer");
- MapVertexDeclaration(activeEffect);
- }
- #endregion
-
- #region MapVertexDeclaration
- private void MapVertexDeclaration(EffectGL3 effect)
- {
- EffectTechniqueGL3 currentTechnique = effect.CurrentTechnique;
- ShaderAttributeGL3[] attributes = currentTechnique.activeAttributes;
- VertexElement[] elements = vertexDeclaration.GetVertexElements();
-
- if (elements.Length != attributes.Length)
- throw new InvalidOperationException("Mapping the VertexDeclaration onto the glsl attributes failed because " +
- "we have " + attributes.Length + " Shader Attributes and " + elements.Length + " elements in the vertex " +
- "declaration which doesn't fit!");
-
- for (int index = 0; index < attributes.Length; index++)
- {
- int location = attributes[index].Location;
- attributes[index].Bind(elements[location].VertexElementUsage, vertexDeclaration.VertexStride,
- elements[location].Offset);
- }
- }
- #endregion
-
- #region Dispose
- ///
- /// Dispose the native index buffer data.
- ///
- public void Dispose()
- {
- if (IsDisposed == false)
- {
- IsDisposed = true;
- DisposeResource();
- }
- }
-
- internal void DisposeResource()
- {
- if (bufferHandle != -1 &&
- GraphicsDeviceWindowsGL3.IsContextCurrent)
- {
- GL.DeleteBuffers(1, ref bufferHandle);
- ErrorHelper.Check("DeleteBuffers");
- bufferHandle = -1;
- }
- }
- #endregion
- }
-}