- Some smaller Refactorings in Metro systems
- Added a bunch of Basic TypeWriters to the ContentPipeline
This commit is contained in:
parent
6bb1c61be7
commit
d17743ef3a
@ -32,20 +32,42 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingBoxWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingSphereWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingFrustumWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\QuaternionWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\PlaneWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector4Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector3Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector2Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\RectangleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\RayWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\PointWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\MatrixWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\ByteWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\CharWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\BooleanWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\ColorWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\DoubleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int16Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int32Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int64Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\ObjectWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\StringWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\SingleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\DateTimeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\DecimalWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\NullableWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\TimeSpanWriter.cs" />
|
||||
<Compile Include="TargetPlatform.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -32,20 +32,42 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingBoxWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingSphereWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingFrustumWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\QuaternionWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\PlaneWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector4Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector3Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector2Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\RectangleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\RayWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\PointWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\MatrixWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\ByteWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\CharWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\BooleanWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\ColorWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\DoubleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int16Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int32Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int64Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\ObjectWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\StringWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\SingleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\DateTimeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\DecimalWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\NullableWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\TimeSpanWriter.cs" />
|
||||
<Compile Include="TargetPlatform.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -32,20 +32,42 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingBoxWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingSphereWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingFrustumWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\QuaternionWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\PlaneWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector4Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector3Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector2Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\RectangleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\RayWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\PointWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\MatrixWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\ByteWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\CharWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\BooleanWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\ColorWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\DoubleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int16Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int32Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int64Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\ObjectWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\StringWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\SingleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\DateTimeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\DecimalWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\NullableWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\TimeSpanWriter.cs" />
|
||||
<Compile Include="TargetPlatform.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -34,20 +34,42 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
||||
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingBoxWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingSphereWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\BoundingFrustumWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\QuaternionWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\PlaneWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector4Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector3Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\Vector2Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\RectangleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\RayWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\PointWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\MatrixWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\ByteWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\CharWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\BooleanWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\MathTypeWriters\ColorWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\DoubleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int16Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int32Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\Int64Writer.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\ObjectWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\StringWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\PrimitiveTypeWriters\SingleWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\DateTimeWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\DecimalWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\NullableWriter.cs" />
|
||||
<Compile Include="Serialization\Compiler\SystemTypeWriters\TimeSpanWriter.cs" />
|
||||
<Compile Include="TargetPlatform.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -0,0 +1,13 @@
|
||||
using System;
|
||||
|
||||
namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
|
||||
{
|
||||
internal abstract class BuiltinTypeWriter<T> : ContentTypeWriter<T>
|
||||
{
|
||||
public override string GetRuntimeReader(TargetPlatform targetPlatform)
|
||||
{
|
||||
// TODO!
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
@ -9,6 +9,7 @@ using System;
|
||||
|
||||
namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class ContentTypeWriterAttribute : Attribute
|
||||
{
|
||||
public ContentTypeWriterAttribute()
|
||||
|
@ -0,0 +1,18 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class BoundingBoxWriter : BuiltinTypeWriter<BoundingBox>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, BoundingBox value)
|
||||
{
|
||||
output.Write(value.Min);
|
||||
output.Write(value.Max);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class BoundingFrustumWriter : BuiltinTypeWriter<BoundingFrustum>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, BoundingFrustum value)
|
||||
{
|
||||
output.Write(value.Matrix);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class BoundingSphereWriter : BuiltinTypeWriter<BoundingSphere>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, BoundingSphere value)
|
||||
{
|
||||
output.Write(value.Center);
|
||||
output.Write(value.Radius);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class ColorWriter : BuiltinTypeWriter<Color>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Color value)
|
||||
{
|
||||
output.Write(value.PackedValue);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class MatrixWriter : BuiltinTypeWriter<Matrix>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Matrix value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class PlaneWriter : BuiltinTypeWriter<Plane>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Plane value)
|
||||
{
|
||||
output.Write(value.Normal);
|
||||
output.Write(value.D);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class PointWriter : BuiltinTypeWriter<Point>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Point value)
|
||||
{
|
||||
output.Write(value.X);
|
||||
output.Write(value.Y);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class QuaternionWriter : BuiltinTypeWriter<Quaternion>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Quaternion value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class RayWriter : BuiltinTypeWriter<Ray>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Ray value)
|
||||
{
|
||||
output.Write(value.Position);
|
||||
output.Write(value.Direction);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class RectangleWriter : BuiltinTypeWriter<Rectangle>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Rectangle value)
|
||||
{
|
||||
output.Write(value.X);
|
||||
output.Write(value.Y);
|
||||
output.Write(value.Width);
|
||||
output.Write(value.Height);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class Vector2Writer : BuiltinTypeWriter<Vector2>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Vector2 value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class Vector3Writer : BuiltinTypeWriter<Vector3>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Vector3 value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.MathTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class Vector4Writer : BuiltinTypeWriter<Vector4>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, Vector4 value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class BooleanWriter : BuiltinTypeWriter<byte>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, byte value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class ByteWriter : BuiltinTypeWriter<byte>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, byte value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
[ContentTypeWriter]
|
||||
internal class SByteWriter : BuiltinTypeWriter<sbyte>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, sbyte value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class CharWriter : BuiltinTypeWriter<bool>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, bool value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class DoubleWriter : BuiltinTypeWriter<double>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, double value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class Int16Writer : BuiltinTypeWriter<short>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, short value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
[ContentTypeWriter]
|
||||
internal class UInt16Writer : BuiltinTypeWriter<ushort>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, ushort value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class Int32Writer : BuiltinTypeWriter<int>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, int value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
[ContentTypeWriter]
|
||||
internal class UInt32Writer : BuiltinTypeWriter<uint>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, uint value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class Int64Writer : BuiltinTypeWriter<long>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, long value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
|
||||
[ContentTypeWriter]
|
||||
internal class UInt64Writer : BuiltinTypeWriter<ulong>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, ulong value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class ObjectWriter : ContentTypeWriter
|
||||
{
|
||||
public ObjectWriter()
|
||||
: base(typeof(object))
|
||||
{
|
||||
}
|
||||
|
||||
protected internal override void Write(ContentWriter output, object value)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
|
||||
public override string GetRuntimeReader(TargetPlatform targetPlatform)
|
||||
{
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class SingleWriter : BuiltinTypeWriter<float>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, float value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.PrimitiveTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class StringWriter : BuiltinTypeWriter<string>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, string value)
|
||||
{
|
||||
output.Write(value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.SystemTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class DateTimeWriter : BuiltinTypeWriter<DateTime>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, DateTime value)
|
||||
{
|
||||
DateTimeKind kind = value.Kind;
|
||||
if (kind == DateTimeKind.Local)
|
||||
{
|
||||
value = value.ToUniversalTime();
|
||||
}
|
||||
output.Write(value.Ticks | (long)kind << 62);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.SystemTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class DecimalWriter : BuiltinTypeWriter<decimal>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, decimal value)
|
||||
{
|
||||
int[] bits = decimal.GetBits(value);
|
||||
for (int i = 0; i < bits.Length; i++)
|
||||
{
|
||||
output.Write(bits[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.SystemTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class NullableWriter<T> : BuiltinTypeWriter<T?> where T : struct
|
||||
{
|
||||
private ContentTypeWriter underlyingTypeWriter;
|
||||
|
||||
protected override void Initialize(ContentCompiler compiler)
|
||||
{
|
||||
underlyingTypeWriter = compiler.GetTypeWriter(typeof(T));
|
||||
}
|
||||
|
||||
protected internal override void Write(ContentWriter output, T? value)
|
||||
{
|
||||
output.Write(value.HasValue);
|
||||
if (value.HasValue)
|
||||
{
|
||||
output.WriteRawObject(value.Value, underlyingTypeWriter);
|
||||
}
|
||||
}
|
||||
|
||||
protected internal override void Write(ContentWriter output, object value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
output.Write(false);
|
||||
return;
|
||||
}
|
||||
|
||||
base.Write(output, value);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
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.Content.Pipeline.Serialization.Compiler.SystemTypeWriters
|
||||
{
|
||||
[ContentTypeWriter]
|
||||
internal class TimeSpanWriter : BuiltinTypeWriter<TimeSpan>
|
||||
{
|
||||
protected internal override void Write(ContentWriter output, TimeSpan value)
|
||||
{
|
||||
output.Write(value.Ticks);
|
||||
}
|
||||
}
|
||||
}
|
@ -430,6 +430,7 @@
|
||||
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
||||
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||
@ -472,6 +473,7 @@
|
||||
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
||||
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
||||
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
||||
<Compile Include="NonXNA\Windows8\TaskHelper.cs" />
|
||||
<Compile Include="Plane.cs" />
|
||||
<Compile Include="PlaneIntersectionType.cs" />
|
||||
<Compile Include="PlayerIndex.cs" />
|
||||
|
@ -430,6 +430,7 @@
|
||||
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
||||
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||
@ -472,6 +473,7 @@
|
||||
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
||||
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
||||
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
||||
<Compile Include="NonXNA\Windows8\TaskHelper.cs" />
|
||||
<Compile Include="Plane.cs" />
|
||||
<Compile Include="PlaneIntersectionType.cs" />
|
||||
<Compile Include="PlayerIndex.cs" />
|
||||
|
@ -431,6 +431,7 @@
|
||||
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
||||
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||
@ -473,6 +474,7 @@
|
||||
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
||||
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
||||
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
||||
<Compile Include="NonXNA\Windows8\TaskHelper.cs" />
|
||||
<Compile Include="Plane.cs" />
|
||||
<Compile Include="PlaneIntersectionType.cs" />
|
||||
<Compile Include="PlayerIndex.cs" />
|
||||
|
@ -433,6 +433,7 @@
|
||||
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
||||
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||
@ -475,6 +476,7 @@
|
||||
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
||||
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
||||
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
||||
<Compile Include="NonXNA\Windows8\TaskHelper.cs" />
|
||||
<Compile Include="Plane.cs" />
|
||||
<Compile Include="PlaneIntersectionType.cs" />
|
||||
<Compile Include="PlayerIndex.cs" />
|
||||
|
@ -20,13 +20,11 @@ namespace ANX.Framework.Content
|
||||
|
||||
protected internal override T? Read(ContentReader input, T? existingInstance)
|
||||
{
|
||||
bool isNull = !input.ReadBoolean();
|
||||
bool hasValue = input.ReadBoolean();
|
||||
|
||||
if (isNull)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new T?(input.ReadRawObject<T>(this.baseTypeReader));
|
||||
return hasValue ?
|
||||
new T?(input.ReadRawObject<T>(this.baseTypeReader)) :
|
||||
null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using ANX.Framework.NonXNA.Windows8;
|
||||
|
||||
// This file is part of the ANX.Framework created by the
|
||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||
@ -23,7 +24,6 @@ namespace ANX.Framework.NonXNA.Reflection
|
||||
|
||||
#region Private
|
||||
private List<string> allAssemblyNames;
|
||||
private Stream assemblyListStream;
|
||||
#endregion
|
||||
|
||||
#region Constructor
|
||||
@ -54,8 +54,10 @@ namespace ANX.Framework.NonXNA.Reflection
|
||||
#region Load
|
||||
public void Load()
|
||||
{
|
||||
Stream assemblyListStream = null;
|
||||
|
||||
#if WINDOWSMETRO
|
||||
LoadStreamFromMetroAssets();
|
||||
assemblyListStream = LoadStreamFromMetroAssets();
|
||||
#endif
|
||||
|
||||
if (assemblyListStream != null)
|
||||
@ -67,18 +69,14 @@ namespace ANX.Framework.NonXNA.Reflection
|
||||
|
||||
#region LoadStreamFromMetroAssets
|
||||
#if WINDOWSMETRO
|
||||
private void LoadStreamFromMetroAssets()
|
||||
private Stream LoadStreamFromMetroAssets()
|
||||
{
|
||||
var library = Windows.ApplicationModel.Package.Current.InstalledLocation;
|
||||
try
|
||||
Stream result = AssetsHelper.LoadStreamFromAssets("Assets\\" + Filename);
|
||||
|
||||
if(result == null)
|
||||
{
|
||||
var task = library.OpenStreamForReadAsync("Assets\\" + Filename);
|
||||
assemblyListStream = TaskHelper.WaitForAsyncOperation(task);
|
||||
}
|
||||
catch
|
||||
{
|
||||
assemblyListStream = new MemoryStream();
|
||||
BinaryWriter writer = new BinaryWriter(assemblyListStream);
|
||||
result = new MemoryStream();
|
||||
BinaryWriter writer = new BinaryWriter(result);
|
||||
writer.Write(5);
|
||||
writer.Write("ANX.PlatformSystem.Metro");
|
||||
writer.Write("ANX.RenderSystem.Windows.Metro");
|
||||
@ -86,8 +84,10 @@ namespace ANX.Framework.NonXNA.Reflection
|
||||
writer.Write("ANX.MediaSystem.Windows.OpenAL");
|
||||
writer.Write("ANX.SoundSystem.Windows.XAudio");
|
||||
|
||||
assemblyListStream.Position = 0;
|
||||
result.Position = 0;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
#endregion
|
||||
|
49
ANX.Framework/NonXNA/Windows8/AssetsHelper.cs
Normal file
49
ANX.Framework/NonXNA/Windows8/AssetsHelper.cs
Normal file
@ -0,0 +1,49 @@
|
||||
#if WINDOWSMETRO
|
||||
using System;
|
||||
using System.IO;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.Storage;
|
||||
|
||||
// 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.NonXNA.Windows8
|
||||
{
|
||||
public static class AssetsHelper
|
||||
{
|
||||
private static StorageFolder installLocation;
|
||||
|
||||
static AssetsHelper()
|
||||
{
|
||||
installLocation = Package.Current.InstalledLocation;
|
||||
}
|
||||
|
||||
public static Stream LoadStreamFromAssets(string relativeFilepath)
|
||||
{
|
||||
relativeFilepath = relativeFilepath.Replace("/", "\\");
|
||||
try
|
||||
{
|
||||
var task = installLocation.OpenStreamForReadAsync(relativeFilepath);
|
||||
Stream filestream = TaskHelper.WaitForAsyncOperation(task);
|
||||
|
||||
// TODO: this copy is really inefficient!!
|
||||
// Find out why reading from the asset stream causes
|
||||
// the position property to go crazy :/
|
||||
MemoryStream stream = new MemoryStream();
|
||||
filestream.CopyTo(stream);
|
||||
filestream.Dispose();
|
||||
filestream = null;
|
||||
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,45 +1,35 @@
|
||||
#if WINDOWSMETRO
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// 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
|
||||
|
||||
#if WINDOWSMETRO
|
||||
namespace ANX.Framework
|
||||
{
|
||||
public struct DictionaryEntry
|
||||
{
|
||||
private Object key;
|
||||
private Object value;
|
||||
public struct DictionaryEntry
|
||||
{
|
||||
private Object key;
|
||||
private Object value;
|
||||
|
||||
public DictionaryEntry(Object key, Object value)
|
||||
{
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Object Key
|
||||
{
|
||||
get { return this.key; }
|
||||
set { this.key = value; }
|
||||
}
|
||||
|
||||
public Object Value
|
||||
{
|
||||
get { return this.value; }
|
||||
set { this.value = value; }
|
||||
}
|
||||
}
|
||||
|
||||
public static class TaskHelper
|
||||
public DictionaryEntry(Object key, Object value)
|
||||
{
|
||||
public static T WaitForAsyncOperation<T>(Task<T> task)
|
||||
{
|
||||
task.Wait();
|
||||
return task.Result;
|
||||
}
|
||||
this.key = key;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public Object Key
|
||||
{
|
||||
get { return this.key; }
|
||||
set { this.key = value; }
|
||||
}
|
||||
|
||||
public Object Value
|
||||
{
|
||||
get { return this.value; }
|
||||
set { this.value = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
18
ANX.Framework/NonXNA/Windows8/TaskHelper.cs
Normal file
18
ANX.Framework/NonXNA/Windows8/TaskHelper.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// 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.NonXNA.Windows8
|
||||
{
|
||||
public static class TaskHelper
|
||||
{
|
||||
public static T WaitForAsyncOperation<T>(Task<T> task)
|
||||
{
|
||||
task.Wait();
|
||||
return task.Result;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System.IO;
|
||||
using ANX.Framework;
|
||||
using ANX.Framework.NonXNA.PlatformSystem;
|
||||
using ANX.Framework.NonXNA.Windows8;
|
||||
using Windows.ApplicationModel;
|
||||
using Windows.Storage;
|
||||
|
||||
@ -33,35 +34,7 @@ namespace ANX.PlatformSystem.Metro
|
||||
#region OpenStream
|
||||
public Stream OpenStream(string filepath)
|
||||
{
|
||||
filepath = filepath.Replace("/", "\\");
|
||||
Stream filestream = LoadStreamFromMetroAssets(filepath);
|
||||
|
||||
// TODO: this copy is really inefficient!!
|
||||
// Find out why reading from the asset stream causes
|
||||
// the position property to go crazy :/
|
||||
MemoryStream stream = new MemoryStream();
|
||||
filestream.CopyTo(stream);
|
||||
filestream.Dispose();
|
||||
filestream = null;
|
||||
|
||||
stream.Position = 0;
|
||||
return stream;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region LoadStreamFromMetroAssets
|
||||
private Stream LoadStreamFromMetroAssets(string filepath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var task = installLocation.OpenStreamForReadAsync(filepath);
|
||||
return TaskHelper.WaitForAsyncOperation(task);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
return null;
|
||||
return AssetsHelper.LoadStreamFromAssets(filepath);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
@ -195,16 +195,11 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#region Apply
|
||||
public void Apply(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
GraphicsDeviceWindowsMetro gdMetro =
|
||||
graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
||||
var device = gdMetro.NativeDevice.NativeDevice;
|
||||
var context = gdMetro.NativeDevice.NativeContext;
|
||||
|
||||
UpdateNativeBlendState(device);
|
||||
UpdateNativeBlendState();
|
||||
this.bound = true;
|
||||
|
||||
context.OutputMerger.SetBlendState(nativeBlendState,
|
||||
this.blendFactor, this.multiSampleMask);
|
||||
NativeDxDevice.Current.OutputMerger.SetBlendState(
|
||||
nativeBlendState, this.blendFactor, this.multiSampleMask);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -220,7 +215,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#endregion
|
||||
|
||||
#region UpdateNativeBlendState
|
||||
private void UpdateNativeBlendState(Dx11.Device device)
|
||||
private void UpdateNativeBlendState()
|
||||
{
|
||||
if (isDirty == true || nativeBlendState == null)
|
||||
{
|
||||
@ -230,7 +225,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
nativeBlendState = null;
|
||||
}
|
||||
|
||||
nativeBlendState = new Dx11.BlendState(device,
|
||||
nativeBlendState = new Dx11.BlendState(
|
||||
NativeDxDevice.Current.NativeDevice,
|
||||
ref blendStateDescription);
|
||||
|
||||
isDirty = false;
|
||||
|
@ -193,15 +193,10 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#region Apply
|
||||
public void Apply(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
GraphicsDeviceWindowsMetro gdMetro =
|
||||
graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
||||
var device = gdMetro.NativeDevice.NativeDevice;
|
||||
var context = gdMetro.NativeDevice.NativeContext;
|
||||
|
||||
UpdateNativeDepthStencilState(device);
|
||||
UpdateNativeDepthStencilState();
|
||||
bound = true;
|
||||
|
||||
context.OutputMerger.SetDepthStencilState(
|
||||
NativeDxDevice.Current.OutputMerger.SetDepthStencilState(
|
||||
nativeDepthStencilState, referenceStencil);
|
||||
}
|
||||
#endregion
|
||||
@ -218,7 +213,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#endregion
|
||||
|
||||
#region UpdateNativeDepthStencilState
|
||||
private void UpdateNativeDepthStencilState(Dx11.Device1 device)
|
||||
private void UpdateNativeDepthStencilState()
|
||||
{
|
||||
if (isDirty == true || nativeDepthStencilState == null)
|
||||
{
|
||||
@ -228,8 +223,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
nativeDepthStencilState = null;
|
||||
}
|
||||
|
||||
nativeDepthStencilState =
|
||||
new Dx11.DepthStencilState(device, ref description);
|
||||
nativeDepthStencilState = new Dx11.DepthStencilState(
|
||||
NativeDxDevice.Current.NativeDevice, ref description);
|
||||
|
||||
isDirty = false;
|
||||
}
|
||||
|
@ -14,50 +14,20 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
public class Effect_Metro : INativeEffect
|
||||
{
|
||||
#region Private
|
||||
private Dx11.VertexShader vertexShader;
|
||||
private Dx11.PixelShader pixelShader;
|
||||
private Effect managedEffect;
|
||||
#endregion
|
||||
|
||||
#region Public
|
||||
//internal Dx11.Effect NativeEffect
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// return this.nativeEffect;
|
||||
// }
|
||||
//}
|
||||
|
||||
internal Dx11.VertexShader NativeVertexShader
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.vertexShader;
|
||||
}
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
internal Dx11.PixelShader NativePixelShader
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.pixelShader;
|
||||
}
|
||||
}
|
||||
|
||||
internal Dx11.VertexShader VertexShader
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.vertexShader;
|
||||
}
|
||||
}
|
||||
|
||||
internal Dx11.PixelShader PixelShader
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.pixelShader;
|
||||
}
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public IEnumerable<EffectTechnique> Techniques
|
||||
@ -65,7 +35,6 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
get
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
|
||||
//for (int i = 0; i < nativeEffect.Description.TechniqueCount; i++)
|
||||
//{
|
||||
// EffectTechnique_DX10 teqDx10 = new EffectTechnique_DX10(this.managedEffect);
|
||||
@ -83,7 +52,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
get
|
||||
{
|
||||
//TODO: implement
|
||||
|
||||
|
||||
System.Diagnostics.Debugger.Break();
|
||||
|
||||
return null;
|
||||
@ -109,10 +78,10 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
this.managedEffect = managedEffect;
|
||||
|
||||
byte[] vertexData = SeekIfPossibleAndReadBytes(vertexShaderByteCode);
|
||||
vertexShader = new Dx11.VertexShader((Dx11.Device)device.NativeDevice, vertexData);
|
||||
NativeVertexShader = new Dx11.VertexShader((Dx11.Device)device.NativeDevice, vertexData);
|
||||
|
||||
byte[] pixelData = SeekIfPossibleAndReadBytes(pixelShaderByteCode);
|
||||
pixelShader = new Dx11.PixelShader((Dx11.Device)device.NativeDevice, pixelData);
|
||||
NativePixelShader = new Dx11.PixelShader((Dx11.Device)device.NativeDevice, pixelData);
|
||||
}
|
||||
|
||||
public Effect_Metro(GraphicsDevice device, Effect managedEffect, Stream effectByteCode)
|
||||
@ -161,16 +130,16 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#region Dispose
|
||||
public void Dispose()
|
||||
{
|
||||
if (pixelShader != null)
|
||||
if (NativeVertexShader != null)
|
||||
{
|
||||
pixelShader.Dispose();
|
||||
pixelShader = null;
|
||||
NativeVertexShader.Dispose();
|
||||
NativeVertexShader = null;
|
||||
}
|
||||
|
||||
if (vertexShader != null)
|
||||
if (NativePixelShader != null)
|
||||
{
|
||||
vertexShader.Dispose();
|
||||
vertexShader = null;
|
||||
NativePixelShader.Dispose();
|
||||
NativePixelShader = null;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
@ -56,7 +56,9 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
|
||||
ResizeRenderWindow(presentationParameters);
|
||||
|
||||
currentViewport = new Dx11.Viewport(0, 0, presentationParameters.BackBufferWidth, presentationParameters.BackBufferHeight);
|
||||
currentViewport = new Dx11.Viewport(0, 0,
|
||||
presentationParameters.BackBufferWidth,
|
||||
presentationParameters.BackBufferHeight);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -161,9 +163,12 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#endregion // DrawPrimitives & DrawIndexedPrimitives
|
||||
|
||||
#region DrawInstancedPrimitives
|
||||
public void DrawInstancedPrimitives(PrimitiveType primitiveType, int baseVertex, int minVertexIndex, int numVertices, int startIndex, int primitiveCount, int instanceCount)
|
||||
public void DrawInstancedPrimitives(PrimitiveType primitiveType,
|
||||
int baseVertex, int minVertexIndex, int numVertices, int startIndex,
|
||||
int primitiveCount, int instanceCount)
|
||||
{
|
||||
NativeDevice.NativeContext.DrawIndexedInstanced(numVertices, instanceCount, startIndex, baseVertex, 0);
|
||||
NativeDevice.NativeContext.DrawIndexedInstanced(numVertices,
|
||||
instanceCount, startIndex, baseVertex, 0);
|
||||
}
|
||||
|
||||
#endregion // DrawInstancedPrimitives
|
||||
|
@ -80,11 +80,6 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes,
|
||||
T[] data, int startIndex, int elementCount) where T : struct
|
||||
{
|
||||
GraphicsDeviceWindowsMetro metroGraphicsDevice =
|
||||
graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
||||
Dx11.Device1 device = metroGraphicsDevice.NativeDevice.NativeDevice;
|
||||
Dx11.DeviceContext1 context = metroGraphicsDevice.NativeDevice.NativeContext;
|
||||
|
||||
//TODO: check offsetInBytes parameter for bounds etc.
|
||||
|
||||
GCHandle pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||
@ -102,8 +97,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
}
|
||||
|
||||
SharpDX.DataStream stream;
|
||||
SharpDX.DataBox box = context.MapSubresource(this.buffer,
|
||||
Dx11.MapMode.WriteDiscard, Dx11.MapFlags.None, out stream);
|
||||
SharpDX.DataBox box = NativeDxDevice.Current.MapSubresource(buffer, out stream);
|
||||
if (startIndex > 0 || elementCount < data.Length)
|
||||
{
|
||||
for (int i = startIndex; i < startIndex + elementCount; i++)
|
||||
@ -115,7 +109,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
{
|
||||
vData.CopyTo(stream);
|
||||
}
|
||||
context.UnmapSubresource(this.buffer, 0);
|
||||
NativeDxDevice.Current.UnmapSubresource(buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,20 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
return nativeContext;
|
||||
}
|
||||
}
|
||||
|
||||
internal Dx11.OutputMergerStage OutputMerger
|
||||
{
|
||||
get
|
||||
{
|
||||
return nativeContext.OutputMerger;
|
||||
}
|
||||
}
|
||||
|
||||
internal static NativeDxDevice Current
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Public
|
||||
@ -50,6 +64,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#region Constructor
|
||||
public NativeDxDevice(PresentationParameters presentationParameters)
|
||||
{
|
||||
Current = this;
|
||||
|
||||
this.presentationParameters = presentationParameters;
|
||||
swapChain = new SwapChainMetro(this, presentationParameters);
|
||||
|
||||
@ -102,9 +118,9 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
var viewport = new Dx11.Viewport((float)RenderTargetBounds.X, (float)RenderTargetBounds.Y,
|
||||
(float)RenderTargetBounds.Width, (float)RenderTargetBounds.Height, 0.0f, 1.0f);
|
||||
|
||||
NativeContext.Rasterizer.SetViewports(viewport);
|
||||
nativeContext.Rasterizer.SetViewports(viewport);
|
||||
|
||||
NativeContext.OutputMerger.SetTargets(depthStencilView, renderTargetView);
|
||||
nativeContext.OutputMerger.SetTargets(depthStencilView, renderTargetView);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -114,7 +130,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
// TODO: find better solution to lazy init the swapChain from the coreWindow!!
|
||||
EnsureScreenBuffersAvailable();
|
||||
|
||||
NativeContext.ClearDepthStencilView(depthStencilView, flags, depth, stencil);
|
||||
nativeContext.ClearDepthStencilView(depthStencilView, flags, depth, stencil);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -124,7 +140,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
// TODO: find better solution to lazy init the swapChain from the coreWindow!!
|
||||
EnsureScreenBuffersAvailable();
|
||||
|
||||
NativeContext.ClearRenderTargetView(renderTargetView, color);
|
||||
nativeContext.ClearRenderTargetView(renderTargetView, color);
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -145,6 +161,28 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region MapSubresource
|
||||
public SharpDX.DataBox MapSubresource(Dx11.Buffer resource,
|
||||
out SharpDX.DataStream stream)
|
||||
{
|
||||
return nativeContext.MapSubresource(resource, Dx11.MapMode.WriteDiscard,
|
||||
Dx11.MapFlags.None, out stream);
|
||||
}
|
||||
|
||||
public SharpDX.DataBox MapSubresource(Dx11.Resource resource, int subresource)
|
||||
{
|
||||
return nativeContext.MapSubresource(resource, subresource,
|
||||
Dx11.MapMode.WriteDiscard, Dx11.MapFlags.None);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region UnmapSubresource
|
||||
public void UnmapSubresource(Dx11.Resource resource, int subresource)
|
||||
{
|
||||
nativeContext.UnmapSubresource(resource, subresource);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Dispose
|
||||
public void Dispose()
|
||||
{
|
||||
|
@ -97,14 +97,11 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#region Apply
|
||||
public void Apply(GraphicsDevice graphicsDevice)
|
||||
{
|
||||
GraphicsDeviceWindowsMetro gdMetro = graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
||||
var device = gdMetro.NativeDevice.NativeDevice;
|
||||
var context = gdMetro.NativeDevice.NativeContext;
|
||||
|
||||
UpdateNativeRasterizerState(device);
|
||||
UpdateNativeRasterizerState();
|
||||
bound = true;
|
||||
|
||||
context.Rasterizer.State = nativeRasterizerState;
|
||||
NativeDxDevice.Current.NativeContext.Rasterizer.State =
|
||||
nativeRasterizerState;
|
||||
}
|
||||
#endregion
|
||||
|
||||
@ -120,7 +117,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#endregion
|
||||
|
||||
#region UpdateNativeRasterizerState
|
||||
private void UpdateNativeRasterizerState(Dx11.Device1 device)
|
||||
private void UpdateNativeRasterizerState()
|
||||
{
|
||||
if (isDirty == true ||
|
||||
nativeRasterizerState == null)
|
||||
@ -129,8 +126,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
|
||||
try
|
||||
{
|
||||
nativeRasterizerState =
|
||||
new Dx11.RasterizerState1(device, description);
|
||||
nativeRasterizerState = new Dx11.RasterizerState1(
|
||||
NativeDxDevice.Current.NativeDevice, description);
|
||||
isDirty = false;
|
||||
}
|
||||
catch
|
||||
|
@ -99,10 +99,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#region Apply (TODO)
|
||||
public void Apply(GraphicsDevice graphicsDevice, int index)
|
||||
{
|
||||
var gdMetro = graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
||||
Dx11.Device1 device = gdMetro.NativeDevice.NativeDevice;
|
||||
|
||||
UpdateNativeSamplerState(device);
|
||||
UpdateNativeSamplerState();
|
||||
bound = true;
|
||||
|
||||
throw new NotImplementedException();
|
||||
@ -122,7 +119,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
#endregion
|
||||
|
||||
#region UpdateNativeSamplerState
|
||||
private void UpdateNativeSamplerState(Dx11.Device1 device)
|
||||
private void UpdateNativeSamplerState()
|
||||
{
|
||||
if (isDirty == true || nativeSamplerState == null)
|
||||
{
|
||||
@ -132,8 +129,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
nativeSamplerState = null;
|
||||
}
|
||||
|
||||
nativeSamplerState =
|
||||
new Dx11.SamplerState(device, ref description);
|
||||
nativeSamplerState = new Dx11.SamplerState(
|
||||
NativeDxDevice.Current.NativeDevice, ref description);
|
||||
|
||||
isDirty = false;
|
||||
}
|
||||
|
@ -167,15 +167,11 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
//TODO: handle offsetInBytes parameter
|
||||
//TODO: handle startIndex parameter
|
||||
//TODO: handle elementCount parameter
|
||||
|
||||
var metroGraphicsDevice = graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
||||
Dx11.Device1 device = metroGraphicsDevice.NativeDevice.NativeDevice;
|
||||
Dx11.DeviceContext1 context = metroGraphicsDevice.NativeDevice.NativeContext;
|
||||
|
||||
|
||||
if (this.surfaceFormat == SurfaceFormat.Color)
|
||||
{
|
||||
int subresource = Dx11.Texture2D.CalculateSubResourceIndex(0, 0, 1);
|
||||
SharpDX.DataBox rectangle = context.MapSubresource(this.nativeTexture, subresource, Dx11.MapMode.WriteDiscard, Dx11.MapFlags.None);
|
||||
SharpDX.DataBox rectangle = NativeDxDevice.Current.MapSubresource(nativeTexture, subresource);
|
||||
int rowPitch = rectangle.RowPitch;
|
||||
|
||||
unsafe
|
||||
@ -203,7 +199,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
handle.Free();
|
||||
}
|
||||
|
||||
context.UnmapSubresource(this.nativeTexture, subresource);
|
||||
NativeDxDevice.Current.UnmapSubresource(nativeTexture, subresource);
|
||||
}
|
||||
else if (surfaceFormat == SurfaceFormat.Dxt5 || surfaceFormat == SurfaceFormat.Dxt3 || surfaceFormat == SurfaceFormat.Dxt1)
|
||||
{
|
||||
|
@ -74,10 +74,6 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes,
|
||||
T[] data, int startIndex, int elementCount) where T : struct
|
||||
{
|
||||
GraphicsDeviceWindowsMetro gdMetro =
|
||||
graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
||||
Dx11.DeviceContext1 context = gdMetro.NativeDevice.NativeContext;
|
||||
|
||||
//TODO: check offsetInBytes parameter for bounds etc.
|
||||
|
||||
GCHandle pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||
@ -95,8 +91,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
}
|
||||
|
||||
SharpDX.DataStream stream;
|
||||
SharpDX.DataBox box = context.MapSubresource(buffer,
|
||||
Dx11.MapMode.WriteDiscard, Dx11.MapFlags.None, out stream);
|
||||
SharpDX.DataBox box = NativeDxDevice.Current.MapSubresource(buffer, out stream);
|
||||
if (startIndex > 0 || elementCount < data.Length)
|
||||
{
|
||||
for (int i = startIndex; i < startIndex + elementCount; i++)
|
||||
@ -108,7 +103,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
||||
{
|
||||
vData.CopyTo(stream);
|
||||
}
|
||||
context.UnmapSubresource(buffer, 0);
|
||||
NativeDxDevice.Current.UnmapSubresource(buffer, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user