Added some TestState and Percentage Attributes and implemented the Texture3DReader and the TextureCubeReader correctly

This commit is contained in:
SND\AstrorEnales_cp 2012-10-11 07:27:50 +00:00 committed by Konstantin Koch
parent 5ac399a71d
commit bff87410e9
21 changed files with 125 additions and 130 deletions

View File

@ -7,21 +7,25 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
public class AlphaTestEffectReader : ContentTypeReader<AlphaTestEffect>
{
protected internal override AlphaTestEffect Read(ContentReader input, AlphaTestEffect existingInstance)
{
var graphics = input.ResolveGraphicsDevice();
var effect = new AlphaTestEffect(graphics);
var effect = new AlphaTestEffect(graphics)
{
Texture = input.ReadExternalReference<Texture2D>(),
AlphaFunction = (CompareFunction)input.ReadInt32(),
ReferenceAlpha = input.ReadInt32(),
DiffuseColor = input.ReadVector3(),
Alpha = input.ReadSingle(),
VertexColorEnabled = input.ReadBoolean()
};
effect.Texture = input.ReadExternalReference<Texture2D>();
effect.AlphaFunction = (CompareFunction)input.ReadInt32();
effect.ReferenceAlpha = input.ReadInt32();
effect.DiffuseColor = input.ReadVector3();
effect.Alpha = input.ReadSingle();
effect.VertexColorEnabled = input.ReadBoolean();
return effect;
return effect;
}
}
}

View File

@ -10,26 +10,31 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
public class BasicEffectReader : ContentTypeReader<BasicEffect>
{
protected internal override BasicEffect Read(ContentReader input, BasicEffect existingInstance)
{
var graphics = input.ResolveGraphicsDevice();
var effect = new BasicEffect(graphics);
Texture2D texture = input.ReadExternalReference<Texture2D>();
// TODO: enable parameter setup when basic effect is implemented
//if (texture != null)
//{
// effect.Texture = texture;
// effect.TextureEnabled = true;
//}
/*effect.DiffuseColor = */input.ReadVector3();
/*effect.EmissiveColor = */input.ReadVector3();
/*effect.SpecularColor = */input.ReadVector3();
/*effect.SpecularPower = */input.ReadSingle();
/*effect.Alpha = */input.ReadSingle();
/*effect.VertexColorEnabled = */input.ReadBoolean();
var texture = input.ReadExternalReference<Texture2D>();
var effect = new BasicEffect(graphics)
{
DiffuseColor = input.ReadVector3(),
EmissiveColor = input.ReadVector3(),
SpecularColor = input.ReadVector3(),
SpecularPower = input.ReadSingle(),
Alpha = input.ReadSingle(),
VertexColorEnabled = input.ReadBoolean()
};
if (texture != null)
{
effect.Texture = texture;
effect.TextureEnabled = true;
}
return effect;
}
}

View File

@ -10,19 +10,23 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
public class DualTextureEffectReader : ContentTypeReader<DualTextureEffect>
{
protected internal override DualTextureEffect Read(ContentReader input, DualTextureEffect existingInstance)
{
var graphics = input.ResolveGraphicsDevice();
var effect = new DualTextureEffect(graphics);
var effect = new DualTextureEffect(graphics)
{
Texture = input.ReadExternalReference<Texture2D>(),
Texture2 = input.ReadExternalReference<Texture2D>(),
DiffuseColor = input.ReadVector3(),
Alpha = input.ReadSingle(),
VertexColorEnabled = input.ReadBoolean()
};
effect.Texture =input.ReadExternalReference<Texture2D>();
effect.Texture2 = input.ReadExternalReference<Texture2D>();
effect.DiffuseColor = input.ReadVector3();
effect.Alpha = input.ReadSingle();
effect.VertexColorEnabled = input.ReadBoolean();
return effect;
}
}

View File

@ -10,7 +10,9 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
public class EnvironmentMapEffectReader : ContentTypeReader<EnvironmentMapEffect>
{
protected internal override EnvironmentMapEffect Read(ContentReader input, EnvironmentMapEffect existingInstance)

View File

@ -16,15 +16,16 @@ namespace ANX.Framework.Content
protected internal override SkinnedEffect Read(ContentReader input, SkinnedEffect existingInstance)
{
var graphics = input.ResolveGraphicsDevice();
var effect = new SkinnedEffect(graphics);
effect.Texture = input.ReadExternalReference<Texture2D>();
effect.WeightsPerVertex = input.ReadInt32();
effect.DiffuseColor = input.ReadVector3();
effect.EmissiveColor = input.ReadVector3();
effect.SpecularColor = input.ReadVector3();
effect.SpecularPower = input.ReadSingle();
effect.Alpha = input.ReadSingle();
var effect = new SkinnedEffect(graphics)
{
Texture = input.ReadExternalReference<Texture2D>(),
WeightsPerVertex = input.ReadInt32(),
DiffuseColor = input.ReadVector3(),
EmissiveColor = input.ReadVector3(),
SpecularColor = input.ReadVector3(),
SpecularPower = input.ReadSingle(),
Alpha = input.ReadSingle()
};
return effect;
}

View File

@ -1,6 +1,5 @@
using System;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
// This file is part of the ANX.Framework created by the
@ -9,7 +8,9 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[Developer("GinieDP")]
[PercentageComplete(100)]
[Developer("GinieDP, AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class Texture2DReader : ContentTypeReader<Texture2D>
{
protected internal override Texture2D Read(ContentReader input, Texture2D existingInstance)
@ -24,7 +25,7 @@ namespace ANX.Framework.Content
{
int size = input.ReadInt32();
byte[] data = input.ReadBytes(size);
texture2D.SetData<byte>(level, null, data, 0, size);
texture2D.SetData(level, null, data, 0, size);
}
return texture2D;
}

View File

@ -1,8 +1,7 @@
#region Using Statements
using System;
using System.Collections.Generic;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
@ -13,19 +12,13 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[Developer("GinieDP")]
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class Texture3DReader : ContentTypeReader<Texture3D>
{
protected internal override Texture3D Read(ContentReader input, Texture3D existingInstance)
{
IServiceProvider service = input.ContentManager.ServiceProvider;
var rfc = service.GetService(typeof(IRenderSystemCreator)) as IRenderSystemCreator;
if (rfc == null)
{
throw new ContentLoadException("Service not found IRenderFrameworkCreator");
}
GraphicsDevice graphics = input.ResolveGraphicsDevice();
SurfaceFormat surfaceFormat = (SurfaceFormat)input.ReadInt32();
int width = input.ReadInt32();
@ -33,16 +26,18 @@ namespace ANX.Framework.Content
int depth = input.ReadInt32();
int mipCount = input.ReadInt32();
List<byte> colorData = new List<byte>();
for (int i = 0; i < mipCount; i++)
var texture3D = new Texture3D(graphics, width, height, depth, mipCount > 1, surfaceFormat);
for (int index = 0; index < mipCount; index++)
{
int size = input.ReadInt32();
colorData.AddRange(input.ReadBytes(size));
byte[] data = input.ReadBytes(size);
texture3D.SetData(index, 0, 0, width, height, 0, depth, data, 0, size);
width = Math.Max(width >> 1, 1);
height = Math.Max(height >> 1, 1);
depth = Math.Max(depth >> 1, 1);
}
throw new NotImplementedException();
//return rfc.CreateTexture(graphics, surfaceFormat, width, height, mipCount, depth, colorData.ToArray();
return texture3D;
}
}
}

View File

@ -1,8 +1,7 @@
#region Using Statements
using System;
using System.Collections.Generic;
using ANX.Framework.Graphics;
using ANX.Framework.NonXNA;
using ANX.Framework.NonXNA.Development;
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
@ -13,38 +12,30 @@ using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[Developer("GinieDP")]
[PercentageComplete(100)]
[Developer("AstrorEnales")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class TextureCubeReader : ContentTypeReader<TextureCube>
{
protected internal override TextureCube Read(ContentReader input, TextureCube existingInstance)
{
IServiceProvider service = input.ContentManager.ServiceProvider;
var rfc = service.GetService(typeof(IRenderSystemCreator)) as IRenderSystemCreator;
if (rfc == null)
{
throw new ContentLoadException("Service not found IRenderFrameworkCreator");
}
GraphicsDevice graphics = input.ResolveGraphicsDevice();
SurfaceFormat surfaceFormat = (SurfaceFormat)input.ReadInt32();
int size = input.ReadInt32();
int mipCount = input.ReadInt32();
List<byte> colorData = new List<byte>();
// for each cube face: +x, -x, +y, -y, +z, -z
var textureCube = new TextureCube(graphics, size, mipCount > 1, surfaceFormat);
for (int face = 0; face < 6; face++)
{
for (int i = 0; i < mipCount; i++)
for (int index = 0; index < mipCount; index++)
{
int dataSize = input.ReadInt32();
colorData.AddRange(input.ReadBytes(dataSize));
byte[] data = input.ReadBytes(dataSize);
textureCube.SetData((CubeMapFace)face, index, null, data, 0, dataSize);
}
}
throw new NotImplementedException();
//return rfc.CreateTexture(graphics, surfaceFormat, size, mipCount, colorData.ToArray());
return textureCube;
}
}
}

View File

@ -1,16 +1,16 @@
#region Using Statements
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class BoundingBoxReader : ContentTypeReader<BoundingBox>
{
protected internal override BoundingBox Read(ContentReader input, BoundingBox existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
#endregion
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class BoundingFrustumReader : ContentTypeReader<BoundingFrustum>
{
protected internal override BoundingFrustum Read(ContentReader input, BoundingFrustum existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class BoundingSphereReader : ContentTypeReader<BoundingSphere>
{
protected internal override BoundingSphere Read(ContentReader input, BoundingSphere existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class ColorReader : ContentTypeReader<Color>
{
protected internal override Color Read(ContentReader input, Color existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class MatrixReader : ContentTypeReader<Matrix>
{
protected internal override Matrix Read(ContentReader input, Matrix existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class PlaneReader : ContentTypeReader<Plane>
{
protected internal override Plane Read(ContentReader input, Plane existingInstance)

View File

@ -1,24 +1,21 @@
#region Using Statements
#endregion
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class PointReader : ContentTypeReader<Point>
{
protected internal override Point Read(ContentReader input, Point existingInstance)
{
var result = new Point();
result.X = input.ReadInt32();
result.Y = input.ReadInt32();
return result;
return new Point(input.ReadInt32(), input.ReadInt32());
}
}
}

View File

@ -1,26 +1,21 @@
#region Using Statements
#endregion
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class QuaternionReader : ContentTypeReader<Quaternion>
{
protected internal override Quaternion Read(ContentReader input, Quaternion existingInstance)
{
var result = new Quaternion();
result.X = input.ReadSingle();
result.Y = input.ReadSingle();
result.Z = input.ReadSingle();
result.W = input.ReadSingle();
return result;
return new Quaternion(input.ReadSingle(), input.ReadSingle(), input.ReadSingle(), input.ReadSingle());
}
}
}

View File

@ -1,16 +1,16 @@
#region Using Statements
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
public class RayReader : ContentTypeReader<Ray>
{
protected internal override Ray Read(ContentReader input, Ray existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
#endregion
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class RectangleReader : ContentTypeReader<Rectangle>
{
protected internal override Rectangle Read(ContentReader input, Rectangle existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
#endregion
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class Vector2Reader : ContentTypeReader<Vector2>
{
protected internal override Vector2 Read(ContentReader input, Vector2 existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
#endregion
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class Vector3Reader : ContentTypeReader<Vector3>
{
protected internal override Vector3 Read(ContentReader input, Vector3 existingInstance)

View File

@ -1,16 +1,16 @@
#region Using Statements
using ANX.Framework.NonXNA.Development;
#endregion // Using Statements
// This file is part of the ANX.Framework created by the
// "ANX.Framework developer group" and released under the Ms-PL license.
// For details see: http://anxframework.codeplex.com/license
using ANX.Framework.NonXNA.Development;
namespace ANX.Framework.Content
{
[PercentageComplete(100)]
[Developer("GinieDP")]
[TestState(TestStateAttribute.TestState.Untested)]
internal class Vector4Reader : ContentTypeReader<Vector4>
{
protected internal override Vector4 Read(ContentReader input, Vector4 existingInstance)