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
{
TParent parent;
protected ChildCollection(TParent parent)
{
throw new NotImplementedException();
if (parent == null)
{
throw new ArgumentNullException("parent");
}
this.parent = parent;
}
protected override void ClearItems()
{
foreach (var child in this)
{
this.SetParent(child, default(TParent));
}
base.ClearItems();
throw new NotImplementedException();
}
protected abstract TParent GetParent(TChild child);
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);
throw new NotImplementedException();
this.SetParent(item, this.parent);
}
protected override void RemoveItem(int index)
{
var child = base[index];
this.SetParent(child, default(TParent));
base.RemoveItem(index);
throw new NotImplementedException();
}
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);

View File

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

View File

@ -14,9 +14,6 @@ namespace ANX.Framework.Content.Pipeline.Graphics
{
public class GeometryContent : ContentItem
{
public GeometryContent()
{
}
public IndexCollection Indices
{
@ -41,5 +38,11 @@ namespace ANX.Framework.Content.Pipeline.Graphics
get;
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
: ChildCollection<MeshContent, GeometryContent>
{
protected GeometryContentCollection(MeshContent parent)
public GeometryContentCollection(MeshContent parent)
: base(parent)
{
throw new NotImplementedException();
}
protected override MeshContent GetParent(GeometryContent child)

View File

@ -14,10 +14,6 @@ namespace ANX.Framework.Content.Pipeline.Graphics
{
public class MeshContent : NodeContent
{
public MeshContent()
{
}
public GeometryContentCollection Geometry
{
get;
@ -29,5 +25,13 @@ namespace ANX.Framework.Content.Pipeline.Graphics
get;
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 NodeContent()
{
}
public Matrix AbsolutTransform
{
get;
private set;
get
{
if (Parent != null)
{
return this.Transform * Parent.AbsolutTransform;
}
return this.Transform;
}
}
public AnimationContentDictionary Animation
@ -47,5 +49,12 @@ namespace ANX.Framework.Content.Pipeline.Graphics
get;
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)
{
throw new NotImplementedException();
return child.Parent;
}
protected override void SetParent(NodeContent child, NodeContent parent)
{
throw new NotImplementedException();
child.Parent = parent;
}
}
}