Filled missing implementations in

- ChildCollection
- AnimationChannel
- BoneContent
- GeometryContent and Collection
- MeshContent
- NodeContent and Collection
This commit is contained in:
SND\GinieDp_cp 2012-08-25 21:47:03 +00:00
parent 9164b2297e
commit 90d8c6d2ad
8 changed files with 92 additions and 48 deletions

View File

@ -15,39 +15,70 @@ namespace ANX.Framework.Content.Pipeline
{ {
public abstract class ChildCollection<TParent, TChild> : Collection<TChild> where TParent : class where TChild : class public abstract class ChildCollection<TParent, TChild> : Collection<TChild> where TParent : class where TChild : class
{ {
TParent parent;
protected ChildCollection(TParent parent) protected ChildCollection(TParent parent)
{ {
throw new NotImplementedException(); if (parent == null)
{
throw new ArgumentNullException("parent");
}
this.parent = parent;
} }
protected override void ClearItems() protected override void ClearItems()
{ {
foreach (var child in this)
{
this.SetParent(child, default(TParent));
}
base.ClearItems(); base.ClearItems();
throw new NotImplementedException();
} }
protected abstract TParent GetParent(TChild child); protected abstract TParent GetParent(TChild child);
protected override void InsertItem(int index, TChild item) protected override void InsertItem(int index, TChild item)
{ {
if (item == null)
{
throw new ArgumentNullException("item");
}
if (this.GetParent(item) != null)
{
throw new ArgumentException("item already has a parent item");
}
base.InsertItem(index, item); base.InsertItem(index, item);
this.SetParent(item, this.parent);
throw new NotImplementedException();
} }
protected override void RemoveItem(int index) protected override void RemoveItem(int index)
{ {
var child = base[index];
this.SetParent(child, default(TParent));
base.RemoveItem(index); base.RemoveItem(index);
throw new NotImplementedException();
} }
protected override void SetItem(int index, TChild item) protected override void SetItem(int index, TChild item)
{ {
base.SetItem(index, item); if (item == null)
{
throw new ArgumentNullException("item");
}
throw new NotImplementedException(); var child = base[index];
if (child == item)
{
return;
}
if (this.GetParent(item) != null)
{
throw new ArgumentException("item already has a parent item");
}
base.SetItem(index, item);
this.SetParent(item, parent);
this.SetParent(child, default(TParent));
} }
protected abstract void SetParent(TChild child, TParent parent); protected abstract void SetParent(TChild child, TParent parent);

View File

@ -15,80 +15,80 @@ namespace ANX.Framework.Content.Pipeline.Graphics
{ {
public sealed class AnimationChannel : ICollection<AnimationKeyframe>, IEnumerable<AnimationKeyframe>, IEnumerable public sealed class AnimationChannel : ICollection<AnimationKeyframe>, IEnumerable<AnimationKeyframe>, IEnumerable
{ {
List<AnimationKeyframe> frames = new List<AnimationKeyframe>();
public AnimationChannel() public AnimationChannel()
{ {
throw new NotImplementedException();
} }
public int Count public int Count
{ {
get get { return frames.Count; }
{
throw new NotImplementedException();
}
} }
public AnimationKeyframe this[int index] public AnimationKeyframe this[int index]
{ {
get get { return frames[index]; }
{
throw new NotImplementedException();
}
} }
public void Add(AnimationKeyframe item) public void Add(AnimationKeyframe item)
{ {
throw new NotImplementedException(); if (item == null)
{
throw new ArgumentNullException("item");
}
frames.Add(item);
} }
public void Clear() public void Clear()
{ {
throw new NotImplementedException(); frames.Clear();
} }
public bool Contains(AnimationKeyframe item) public bool Contains(AnimationKeyframe item)
{ {
throw new NotImplementedException(); return frames.Contains(item);
} }
public IEnumerator<AnimationKeyframe> GetEnumerator() public IEnumerator<AnimationKeyframe> GetEnumerator()
{ {
throw new NotImplementedException(); return frames.GetEnumerator();
} }
public int IndexOf(AnimationKeyframe item) public int IndexOf(AnimationKeyframe item)
{ {
throw new NotImplementedException(); return frames.IndexOf(item);
} }
public bool Remove(AnimationKeyframe item) public bool Remove(AnimationKeyframe item)
{ {
throw new NotImplementedException(); return frames.Remove(item);
} }
public void RemoveAt(int index) public void RemoveAt(int index)
{ {
throw new NotImplementedException(); frames.RemoveAt(index);
} }
bool ICollection<AnimationKeyframe>.IsReadOnly bool ICollection<AnimationKeyframe>.IsReadOnly
{ {
get { throw new NotImplementedException(); } get { return false; }
} }
void ICollection<AnimationKeyframe>.Add(AnimationKeyframe item) void ICollection<AnimationKeyframe>.Add(AnimationKeyframe item)
{ {
throw new NotImplementedException(); frames.Add(item);
} }
void ICollection<AnimationKeyframe>.CopyTo(AnimationKeyframe[] array, int arrayIndex) void ICollection<AnimationKeyframe>.CopyTo(AnimationKeyframe[] array, int arrayIndex)
{ {
throw new NotImplementedException(); frames.CopyTo(array, arrayIndex);
} }
IEnumerator System.Collections.IEnumerable.GetEnumerator() IEnumerator System.Collections.IEnumerable.GetEnumerator()
{ {
throw new NotImplementedException(); return frames.GetEnumerator();
} }
} }
} }

View File

@ -17,7 +17,5 @@ namespace ANX.Framework.Content.Pipeline.Graphics
public BoneContent() public BoneContent()
{ {
} }
} }
} }

View File

@ -14,9 +14,6 @@ namespace ANX.Framework.Content.Pipeline.Graphics
{ {
public class GeometryContent : ContentItem public class GeometryContent : ContentItem
{ {
public GeometryContent()
{
}
public IndexCollection Indices public IndexCollection Indices
{ {
@ -41,5 +38,11 @@ namespace ANX.Framework.Content.Pipeline.Graphics
get; get;
private set; private set;
} }
public GeometryContent()
{
Indices = new IndexCollection();
Vertices = new VertexContent();
}
} }
} }

View File

@ -9,10 +9,9 @@ namespace ANX.Framework.Content.Pipeline.Graphics
public sealed class GeometryContentCollection public sealed class GeometryContentCollection
: ChildCollection<MeshContent, GeometryContent> : ChildCollection<MeshContent, GeometryContent>
{ {
protected GeometryContentCollection(MeshContent parent) public GeometryContentCollection(MeshContent parent)
: base(parent) : base(parent)
{ {
throw new NotImplementedException();
} }
protected override MeshContent GetParent(GeometryContent child) protected override MeshContent GetParent(GeometryContent child)

View File

@ -14,10 +14,6 @@ namespace ANX.Framework.Content.Pipeline.Graphics
{ {
public class MeshContent : NodeContent public class MeshContent : NodeContent
{ {
public MeshContent()
{
}
public GeometryContentCollection Geometry public GeometryContentCollection Geometry
{ {
get; get;
@ -29,5 +25,13 @@ namespace ANX.Framework.Content.Pipeline.Graphics
get; get;
private set; private set;
} }
public MeshContent()
{
Geometry = new GeometryContentCollection(this);
Positions = new PositionCollection();
}
} }
} }

View File

@ -14,14 +14,16 @@ namespace ANX.Framework.Content.Pipeline.Graphics
{ {
public class NodeContent : ContentItem public class NodeContent : ContentItem
{ {
public NodeContent()
{
}
public Matrix AbsolutTransform public Matrix AbsolutTransform
{ {
get; get
private set; {
if (Parent != null)
{
return this.Transform * Parent.AbsolutTransform;
}
return this.Transform;
}
} }
public AnimationContentDictionary Animation public AnimationContentDictionary Animation
@ -47,5 +49,12 @@ namespace ANX.Framework.Content.Pipeline.Graphics
get; get;
set; set;
} }
public NodeContent()
{
Transform = Matrix.Identity;
Animation = new AnimationContentDictionary();
Children = new NodeContentCollection(this);
}
} }
} }

View File

@ -21,12 +21,12 @@ namespace ANX.Framework.Content.Pipeline.Graphics
protected override NodeContent GetParent(NodeContent child) protected override NodeContent GetParent(NodeContent child)
{ {
throw new NotImplementedException(); return child.Parent;
} }
protected override void SetParent(NodeContent child, NodeContent parent) protected override void SetParent(NodeContent child, NodeContent parent)
{ {
throw new NotImplementedException(); child.Parent = parent;
} }
} }
} }