- 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>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.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" />
|
<Compile Include="TargetPlatform.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -32,20 +32,42 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.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" />
|
<Compile Include="TargetPlatform.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -32,20 +32,42 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.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" />
|
<Compile Include="TargetPlatform.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -34,20 +34,42 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<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>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="Serialization\Compiler\BuiltInTypeWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
<Compile Include="Serialization\Compiler\ContentCompiler.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
<Compile Include="Serialization\Compiler\ContentTypeWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
<Compile Include="Serialization\Compiler\ContentTypeWriterAttribute.cs" />
|
||||||
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
<Compile Include="Serialization\Compiler\ContentWriter.cs" />
|
||||||
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
<Compile Include="Serialization\Compiler\GenericContentTypeWriter.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.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" />
|
<Compile Include="TargetPlatform.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<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
|
namespace ANX.Framework.Content.Pipeline.Serialization.Compiler
|
||||||
{
|
{
|
||||||
|
[AttributeUsage(AttributeTargets.Class)]
|
||||||
public class ContentTypeWriterAttribute : Attribute
|
public class ContentTypeWriterAttribute : Attribute
|
||||||
{
|
{
|
||||||
public ContentTypeWriterAttribute()
|
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\PlatformSystem\INativeContentManager.cs" />
|
||||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||||
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
||||||
|
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||||
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
||||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||||
@ -472,6 +473,7 @@
|
|||||||
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
||||||
|
<Compile Include="NonXNA\Windows8\TaskHelper.cs" />
|
||||||
<Compile Include="Plane.cs" />
|
<Compile Include="Plane.cs" />
|
||||||
<Compile Include="PlaneIntersectionType.cs" />
|
<Compile Include="PlaneIntersectionType.cs" />
|
||||||
<Compile Include="PlayerIndex.cs" />
|
<Compile Include="PlayerIndex.cs" />
|
||||||
|
@ -430,6 +430,7 @@
|
|||||||
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
||||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||||
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
||||||
|
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||||
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
||||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||||
@ -472,6 +473,7 @@
|
|||||||
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
||||||
|
<Compile Include="NonXNA\Windows8\TaskHelper.cs" />
|
||||||
<Compile Include="Plane.cs" />
|
<Compile Include="Plane.cs" />
|
||||||
<Compile Include="PlaneIntersectionType.cs" />
|
<Compile Include="PlaneIntersectionType.cs" />
|
||||||
<Compile Include="PlayerIndex.cs" />
|
<Compile Include="PlayerIndex.cs" />
|
||||||
|
@ -431,6 +431,7 @@
|
|||||||
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
||||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||||
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
||||||
|
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||||
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
||||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||||
@ -473,6 +474,7 @@
|
|||||||
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
||||||
|
<Compile Include="NonXNA\Windows8\TaskHelper.cs" />
|
||||||
<Compile Include="Plane.cs" />
|
<Compile Include="Plane.cs" />
|
||||||
<Compile Include="PlaneIntersectionType.cs" />
|
<Compile Include="PlaneIntersectionType.cs" />
|
||||||
<Compile Include="PlayerIndex.cs" />
|
<Compile Include="PlayerIndex.cs" />
|
||||||
|
@ -433,6 +433,7 @@
|
|||||||
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
<Compile Include="NonXNA\PlatformSystem\INativeContentManager.cs" />
|
||||||
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
<Compile Include="NonXNA\Reflection\AssemblyLoader.cs" />
|
||||||
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
<Compile Include="NonXNA\Reflection\AssemblyListFile.cs" />
|
||||||
|
<Compile Include="NonXNA\Windows8\AssetsHelper.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
<Compile Include="NonXNA\Windows8\IServiceProvider.cs" />
|
||||||
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
<Compile Include="NonXNA\MediaSystem\IMediaSystemCreator.cs" />
|
||||||
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
<Compile Include="NonXNA\NoInputDeviceException.cs" />
|
||||||
@ -475,6 +476,7 @@
|
|||||||
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
<Compile Include="NonXNA\Windows8\FileAccess.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
<Compile Include="NonXNA\Windows8\FileShare.cs" />
|
||||||
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
<Compile Include="NonXNA\Windows8\ResourceReader.cs" />
|
||||||
|
<Compile Include="NonXNA\Windows8\TaskHelper.cs" />
|
||||||
<Compile Include="Plane.cs" />
|
<Compile Include="Plane.cs" />
|
||||||
<Compile Include="PlaneIntersectionType.cs" />
|
<Compile Include="PlaneIntersectionType.cs" />
|
||||||
<Compile Include="PlayerIndex.cs" />
|
<Compile Include="PlayerIndex.cs" />
|
||||||
|
@ -20,13 +20,11 @@ namespace ANX.Framework.Content
|
|||||||
|
|
||||||
protected internal override T? Read(ContentReader input, T? existingInstance)
|
protected internal override T? Read(ContentReader input, T? existingInstance)
|
||||||
{
|
{
|
||||||
bool isNull = !input.ReadBoolean();
|
bool hasValue = input.ReadBoolean();
|
||||||
|
|
||||||
if (isNull)
|
return hasValue ?
|
||||||
{
|
new T?(input.ReadRawObject<T>(this.baseTypeReader)) :
|
||||||
return null;
|
null;
|
||||||
}
|
|
||||||
return new T?(input.ReadRawObject<T>(this.baseTypeReader));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using ANX.Framework.NonXNA.Windows8;
|
||||||
|
|
||||||
// This file is part of the ANX.Framework created by the
|
// This file is part of the ANX.Framework created by the
|
||||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||||
@ -23,7 +24,6 @@ namespace ANX.Framework.NonXNA.Reflection
|
|||||||
|
|
||||||
#region Private
|
#region Private
|
||||||
private List<string> allAssemblyNames;
|
private List<string> allAssemblyNames;
|
||||||
private Stream assemblyListStream;
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Constructor
|
#region Constructor
|
||||||
@ -54,8 +54,10 @@ namespace ANX.Framework.NonXNA.Reflection
|
|||||||
#region Load
|
#region Load
|
||||||
public void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
|
Stream assemblyListStream = null;
|
||||||
|
|
||||||
#if WINDOWSMETRO
|
#if WINDOWSMETRO
|
||||||
LoadStreamFromMetroAssets();
|
assemblyListStream = LoadStreamFromMetroAssets();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (assemblyListStream != null)
|
if (assemblyListStream != null)
|
||||||
@ -67,18 +69,14 @@ namespace ANX.Framework.NonXNA.Reflection
|
|||||||
|
|
||||||
#region LoadStreamFromMetroAssets
|
#region LoadStreamFromMetroAssets
|
||||||
#if WINDOWSMETRO
|
#if WINDOWSMETRO
|
||||||
private void LoadStreamFromMetroAssets()
|
private Stream LoadStreamFromMetroAssets()
|
||||||
{
|
{
|
||||||
var library = Windows.ApplicationModel.Package.Current.InstalledLocation;
|
Stream result = AssetsHelper.LoadStreamFromAssets("Assets\\" + Filename);
|
||||||
try
|
|
||||||
|
if(result == null)
|
||||||
{
|
{
|
||||||
var task = library.OpenStreamForReadAsync("Assets\\" + Filename);
|
result = new MemoryStream();
|
||||||
assemblyListStream = TaskHelper.WaitForAsyncOperation(task);
|
BinaryWriter writer = new BinaryWriter(result);
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
assemblyListStream = new MemoryStream();
|
|
||||||
BinaryWriter writer = new BinaryWriter(assemblyListStream);
|
|
||||||
writer.Write(5);
|
writer.Write(5);
|
||||||
writer.Write("ANX.PlatformSystem.Metro");
|
writer.Write("ANX.PlatformSystem.Metro");
|
||||||
writer.Write("ANX.RenderSystem.Windows.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.MediaSystem.Windows.OpenAL");
|
||||||
writer.Write("ANX.SoundSystem.Windows.XAudio");
|
writer.Write("ANX.SoundSystem.Windows.XAudio");
|
||||||
|
|
||||||
assemblyListStream.Position = 0;
|
result.Position = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endregion
|
#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,12 +1,11 @@
|
|||||||
#if WINDOWSMETRO
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
// This file is part of the ANX.Framework created by the
|
// This file is part of the ANX.Framework created by the
|
||||||
// "ANX.Framework developer group" and released under the Ms-PL license.
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
||||||
// For details see: http://anxframework.codeplex.com/license
|
// For details see: http://anxframework.codeplex.com/license
|
||||||
|
|
||||||
|
#if WINDOWSMETRO
|
||||||
namespace ANX.Framework
|
namespace ANX.Framework
|
||||||
{
|
{
|
||||||
public struct DictionaryEntry
|
public struct DictionaryEntry
|
||||||
@ -32,14 +31,5 @@ namespace ANX.Framework
|
|||||||
set { this.value = value; }
|
set { this.value = value; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TaskHelper
|
|
||||||
{
|
|
||||||
public static T WaitForAsyncOperation<T>(Task<T> task)
|
|
||||||
{
|
|
||||||
task.Wait();
|
|
||||||
return task.Result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#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 System.IO;
|
||||||
using ANX.Framework;
|
using ANX.Framework;
|
||||||
using ANX.Framework.NonXNA.PlatformSystem;
|
using ANX.Framework.NonXNA.PlatformSystem;
|
||||||
|
using ANX.Framework.NonXNA.Windows8;
|
||||||
using Windows.ApplicationModel;
|
using Windows.ApplicationModel;
|
||||||
using Windows.Storage;
|
using Windows.Storage;
|
||||||
|
|
||||||
@ -33,35 +34,7 @@ namespace ANX.PlatformSystem.Metro
|
|||||||
#region OpenStream
|
#region OpenStream
|
||||||
public Stream OpenStream(string filepath)
|
public Stream OpenStream(string filepath)
|
||||||
{
|
{
|
||||||
filepath = filepath.Replace("/", "\\");
|
return AssetsHelper.LoadStreamFromAssets(filepath);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -195,16 +195,11 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#region Apply
|
#region Apply
|
||||||
public void Apply(GraphicsDevice graphicsDevice)
|
public void Apply(GraphicsDevice graphicsDevice)
|
||||||
{
|
{
|
||||||
GraphicsDeviceWindowsMetro gdMetro =
|
UpdateNativeBlendState();
|
||||||
graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
|
||||||
var device = gdMetro.NativeDevice.NativeDevice;
|
|
||||||
var context = gdMetro.NativeDevice.NativeContext;
|
|
||||||
|
|
||||||
UpdateNativeBlendState(device);
|
|
||||||
this.bound = true;
|
this.bound = true;
|
||||||
|
|
||||||
context.OutputMerger.SetBlendState(nativeBlendState,
|
NativeDxDevice.Current.OutputMerger.SetBlendState(
|
||||||
this.blendFactor, this.multiSampleMask);
|
nativeBlendState, this.blendFactor, this.multiSampleMask);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -220,7 +215,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region UpdateNativeBlendState
|
#region UpdateNativeBlendState
|
||||||
private void UpdateNativeBlendState(Dx11.Device device)
|
private void UpdateNativeBlendState()
|
||||||
{
|
{
|
||||||
if (isDirty == true || nativeBlendState == null)
|
if (isDirty == true || nativeBlendState == null)
|
||||||
{
|
{
|
||||||
@ -230,7 +225,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
nativeBlendState = null;
|
nativeBlendState = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
nativeBlendState = new Dx11.BlendState(device,
|
nativeBlendState = new Dx11.BlendState(
|
||||||
|
NativeDxDevice.Current.NativeDevice,
|
||||||
ref blendStateDescription);
|
ref blendStateDescription);
|
||||||
|
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
|
@ -193,15 +193,10 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#region Apply
|
#region Apply
|
||||||
public void Apply(GraphicsDevice graphicsDevice)
|
public void Apply(GraphicsDevice graphicsDevice)
|
||||||
{
|
{
|
||||||
GraphicsDeviceWindowsMetro gdMetro =
|
UpdateNativeDepthStencilState();
|
||||||
graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
|
||||||
var device = gdMetro.NativeDevice.NativeDevice;
|
|
||||||
var context = gdMetro.NativeDevice.NativeContext;
|
|
||||||
|
|
||||||
UpdateNativeDepthStencilState(device);
|
|
||||||
bound = true;
|
bound = true;
|
||||||
|
|
||||||
context.OutputMerger.SetDepthStencilState(
|
NativeDxDevice.Current.OutputMerger.SetDepthStencilState(
|
||||||
nativeDepthStencilState, referenceStencil);
|
nativeDepthStencilState, referenceStencil);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
@ -218,7 +213,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region UpdateNativeDepthStencilState
|
#region UpdateNativeDepthStencilState
|
||||||
private void UpdateNativeDepthStencilState(Dx11.Device1 device)
|
private void UpdateNativeDepthStencilState()
|
||||||
{
|
{
|
||||||
if (isDirty == true || nativeDepthStencilState == null)
|
if (isDirty == true || nativeDepthStencilState == null)
|
||||||
{
|
{
|
||||||
@ -228,8 +223,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
nativeDepthStencilState = null;
|
nativeDepthStencilState = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
nativeDepthStencilState =
|
nativeDepthStencilState = new Dx11.DepthStencilState(
|
||||||
new Dx11.DepthStencilState(device, ref description);
|
NativeDxDevice.Current.NativeDevice, ref description);
|
||||||
|
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
}
|
}
|
||||||
|
@ -14,50 +14,20 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
public class Effect_Metro : INativeEffect
|
public class Effect_Metro : INativeEffect
|
||||||
{
|
{
|
||||||
#region Private
|
#region Private
|
||||||
private Dx11.VertexShader vertexShader;
|
|
||||||
private Dx11.PixelShader pixelShader;
|
|
||||||
private Effect managedEffect;
|
private Effect managedEffect;
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public
|
#region Public
|
||||||
//internal Dx11.Effect NativeEffect
|
|
||||||
//{
|
|
||||||
// get
|
|
||||||
// {
|
|
||||||
// return this.nativeEffect;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
|
||||||
internal Dx11.VertexShader NativeVertexShader
|
internal Dx11.VertexShader NativeVertexShader
|
||||||
{
|
{
|
||||||
get
|
get;
|
||||||
{
|
private set;
|
||||||
return this.vertexShader;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal Dx11.PixelShader NativePixelShader
|
internal Dx11.PixelShader NativePixelShader
|
||||||
{
|
{
|
||||||
get
|
get;
|
||||||
{
|
private set;
|
||||||
return this.pixelShader;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Dx11.VertexShader VertexShader
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return this.vertexShader;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
internal Dx11.PixelShader PixelShader
|
|
||||||
{
|
|
||||||
get
|
|
||||||
{
|
|
||||||
return this.pixelShader;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<EffectTechnique> Techniques
|
public IEnumerable<EffectTechnique> Techniques
|
||||||
@ -65,7 +35,6 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
get
|
get
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
|
|
||||||
//for (int i = 0; i < nativeEffect.Description.TechniqueCount; i++)
|
//for (int i = 0; i < nativeEffect.Description.TechniqueCount; i++)
|
||||||
//{
|
//{
|
||||||
// EffectTechnique_DX10 teqDx10 = new EffectTechnique_DX10(this.managedEffect);
|
// EffectTechnique_DX10 teqDx10 = new EffectTechnique_DX10(this.managedEffect);
|
||||||
@ -109,10 +78,10 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
this.managedEffect = managedEffect;
|
this.managedEffect = managedEffect;
|
||||||
|
|
||||||
byte[] vertexData = SeekIfPossibleAndReadBytes(vertexShaderByteCode);
|
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);
|
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)
|
public Effect_Metro(GraphicsDevice device, Effect managedEffect, Stream effectByteCode)
|
||||||
@ -161,16 +130,16 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#region Dispose
|
#region Dispose
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (pixelShader != null)
|
if (NativeVertexShader != null)
|
||||||
{
|
{
|
||||||
pixelShader.Dispose();
|
NativeVertexShader.Dispose();
|
||||||
pixelShader = null;
|
NativeVertexShader = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vertexShader != null)
|
if (NativePixelShader != null)
|
||||||
{
|
{
|
||||||
vertexShader.Dispose();
|
NativePixelShader.Dispose();
|
||||||
vertexShader = null;
|
NativePixelShader = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -56,7 +56,9 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
|
|
||||||
ResizeRenderWindow(presentationParameters);
|
ResizeRenderWindow(presentationParameters);
|
||||||
|
|
||||||
currentViewport = new Dx11.Viewport(0, 0, presentationParameters.BackBufferWidth, presentationParameters.BackBufferHeight);
|
currentViewport = new Dx11.Viewport(0, 0,
|
||||||
|
presentationParameters.BackBufferWidth,
|
||||||
|
presentationParameters.BackBufferHeight);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -161,9 +163,12 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#endregion // DrawPrimitives & DrawIndexedPrimitives
|
#endregion // DrawPrimitives & DrawIndexedPrimitives
|
||||||
|
|
||||||
#region DrawInstancedPrimitives
|
#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
|
#endregion // DrawInstancedPrimitives
|
||||||
|
@ -80,11 +80,6 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes,
|
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes,
|
||||||
T[] data, int startIndex, int elementCount) where T : struct
|
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.
|
//TODO: check offsetInBytes parameter for bounds etc.
|
||||||
|
|
||||||
GCHandle pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
|
GCHandle pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||||
@ -102,8 +97,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
}
|
}
|
||||||
|
|
||||||
SharpDX.DataStream stream;
|
SharpDX.DataStream stream;
|
||||||
SharpDX.DataBox box = context.MapSubresource(this.buffer,
|
SharpDX.DataBox box = NativeDxDevice.Current.MapSubresource(buffer, out stream);
|
||||||
Dx11.MapMode.WriteDiscard, Dx11.MapFlags.None, out stream);
|
|
||||||
if (startIndex > 0 || elementCount < data.Length)
|
if (startIndex > 0 || elementCount < data.Length)
|
||||||
{
|
{
|
||||||
for (int i = startIndex; i < startIndex + elementCount; i++)
|
for (int i = startIndex; i < startIndex + elementCount; i++)
|
||||||
@ -115,7 +109,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
{
|
{
|
||||||
vData.CopyTo(stream);
|
vData.CopyTo(stream);
|
||||||
}
|
}
|
||||||
context.UnmapSubresource(this.buffer, 0);
|
NativeDxDevice.Current.UnmapSubresource(buffer, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,6 +37,20 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
return nativeContext;
|
return nativeContext;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
internal Dx11.OutputMergerStage OutputMerger
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return nativeContext.OutputMerger;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
internal static NativeDxDevice Current
|
||||||
|
{
|
||||||
|
get;
|
||||||
|
private set;
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Public
|
#region Public
|
||||||
@ -50,6 +64,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#region Constructor
|
#region Constructor
|
||||||
public NativeDxDevice(PresentationParameters presentationParameters)
|
public NativeDxDevice(PresentationParameters presentationParameters)
|
||||||
{
|
{
|
||||||
|
Current = this;
|
||||||
|
|
||||||
this.presentationParameters = presentationParameters;
|
this.presentationParameters = presentationParameters;
|
||||||
swapChain = new SwapChainMetro(this, 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,
|
var viewport = new Dx11.Viewport((float)RenderTargetBounds.X, (float)RenderTargetBounds.Y,
|
||||||
(float)RenderTargetBounds.Width, (float)RenderTargetBounds.Height, 0.0f, 1.0f);
|
(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
|
#endregion
|
||||||
|
|
||||||
@ -114,7 +130,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
// TODO: find better solution to lazy init the swapChain from the coreWindow!!
|
// TODO: find better solution to lazy init the swapChain from the coreWindow!!
|
||||||
EnsureScreenBuffersAvailable();
|
EnsureScreenBuffersAvailable();
|
||||||
|
|
||||||
NativeContext.ClearDepthStencilView(depthStencilView, flags, depth, stencil);
|
nativeContext.ClearDepthStencilView(depthStencilView, flags, depth, stencil);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -124,7 +140,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
// TODO: find better solution to lazy init the swapChain from the coreWindow!!
|
// TODO: find better solution to lazy init the swapChain from the coreWindow!!
|
||||||
EnsureScreenBuffersAvailable();
|
EnsureScreenBuffersAvailable();
|
||||||
|
|
||||||
NativeContext.ClearRenderTargetView(renderTargetView, color);
|
nativeContext.ClearRenderTargetView(renderTargetView, color);
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -145,6 +161,28 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
}
|
}
|
||||||
#endregion
|
#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
|
#region Dispose
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
|
@ -97,14 +97,11 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#region Apply
|
#region Apply
|
||||||
public void Apply(GraphicsDevice graphicsDevice)
|
public void Apply(GraphicsDevice graphicsDevice)
|
||||||
{
|
{
|
||||||
GraphicsDeviceWindowsMetro gdMetro = graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
UpdateNativeRasterizerState();
|
||||||
var device = gdMetro.NativeDevice.NativeDevice;
|
|
||||||
var context = gdMetro.NativeDevice.NativeContext;
|
|
||||||
|
|
||||||
UpdateNativeRasterizerState(device);
|
|
||||||
bound = true;
|
bound = true;
|
||||||
|
|
||||||
context.Rasterizer.State = nativeRasterizerState;
|
NativeDxDevice.Current.NativeContext.Rasterizer.State =
|
||||||
|
nativeRasterizerState;
|
||||||
}
|
}
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@ -120,7 +117,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region UpdateNativeRasterizerState
|
#region UpdateNativeRasterizerState
|
||||||
private void UpdateNativeRasterizerState(Dx11.Device1 device)
|
private void UpdateNativeRasterizerState()
|
||||||
{
|
{
|
||||||
if (isDirty == true ||
|
if (isDirty == true ||
|
||||||
nativeRasterizerState == null)
|
nativeRasterizerState == null)
|
||||||
@ -129,8 +126,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
nativeRasterizerState =
|
nativeRasterizerState = new Dx11.RasterizerState1(
|
||||||
new Dx11.RasterizerState1(device, description);
|
NativeDxDevice.Current.NativeDevice, description);
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
@ -99,10 +99,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#region Apply (TODO)
|
#region Apply (TODO)
|
||||||
public void Apply(GraphicsDevice graphicsDevice, int index)
|
public void Apply(GraphicsDevice graphicsDevice, int index)
|
||||||
{
|
{
|
||||||
var gdMetro = graphicsDevice.NativeDevice as GraphicsDeviceWindowsMetro;
|
UpdateNativeSamplerState();
|
||||||
Dx11.Device1 device = gdMetro.NativeDevice.NativeDevice;
|
|
||||||
|
|
||||||
UpdateNativeSamplerState(device);
|
|
||||||
bound = true;
|
bound = true;
|
||||||
|
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
@ -122,7 +119,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region UpdateNativeSamplerState
|
#region UpdateNativeSamplerState
|
||||||
private void UpdateNativeSamplerState(Dx11.Device1 device)
|
private void UpdateNativeSamplerState()
|
||||||
{
|
{
|
||||||
if (isDirty == true || nativeSamplerState == null)
|
if (isDirty == true || nativeSamplerState == null)
|
||||||
{
|
{
|
||||||
@ -132,8 +129,8 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
nativeSamplerState = null;
|
nativeSamplerState = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
nativeSamplerState =
|
nativeSamplerState = new Dx11.SamplerState(
|
||||||
new Dx11.SamplerState(device, ref description);
|
NativeDxDevice.Current.NativeDevice, ref description);
|
||||||
|
|
||||||
isDirty = false;
|
isDirty = false;
|
||||||
}
|
}
|
||||||
|
@ -168,14 +168,10 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
//TODO: handle startIndex parameter
|
//TODO: handle startIndex parameter
|
||||||
//TODO: handle elementCount 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)
|
if (this.surfaceFormat == SurfaceFormat.Color)
|
||||||
{
|
{
|
||||||
int subresource = Dx11.Texture2D.CalculateSubResourceIndex(0, 0, 1);
|
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;
|
int rowPitch = rectangle.RowPitch;
|
||||||
|
|
||||||
unsafe
|
unsafe
|
||||||
@ -203,7 +199,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
handle.Free();
|
handle.Free();
|
||||||
}
|
}
|
||||||
|
|
||||||
context.UnmapSubresource(this.nativeTexture, subresource);
|
NativeDxDevice.Current.UnmapSubresource(nativeTexture, subresource);
|
||||||
}
|
}
|
||||||
else if (surfaceFormat == SurfaceFormat.Dxt5 || surfaceFormat == SurfaceFormat.Dxt3 || surfaceFormat == SurfaceFormat.Dxt1)
|
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,
|
public void SetData<T>(GraphicsDevice graphicsDevice, int offsetInBytes,
|
||||||
T[] data, int startIndex, int elementCount) where T : struct
|
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.
|
//TODO: check offsetInBytes parameter for bounds etc.
|
||||||
|
|
||||||
GCHandle pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
|
GCHandle pinnedArray = GCHandle.Alloc(data, GCHandleType.Pinned);
|
||||||
@ -95,8 +91,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
}
|
}
|
||||||
|
|
||||||
SharpDX.DataStream stream;
|
SharpDX.DataStream stream;
|
||||||
SharpDX.DataBox box = context.MapSubresource(buffer,
|
SharpDX.DataBox box = NativeDxDevice.Current.MapSubresource(buffer, out stream);
|
||||||
Dx11.MapMode.WriteDiscard, Dx11.MapFlags.None, out stream);
|
|
||||||
if (startIndex > 0 || elementCount < data.Length)
|
if (startIndex > 0 || elementCount < data.Length)
|
||||||
{
|
{
|
||||||
for (int i = startIndex; i < startIndex + elementCount; i++)
|
for (int i = startIndex; i < startIndex + elementCount; i++)
|
||||||
@ -108,7 +103,7 @@ namespace ANX.RenderSystem.Windows.Metro
|
|||||||
{
|
{
|
||||||
vData.CopyTo(stream);
|
vData.CopyTo(stream);
|
||||||
}
|
}
|
||||||
context.UnmapSubresource(buffer, 0);
|
NativeDxDevice.Current.UnmapSubresource(buffer, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user