This commit is contained in:
SND\GinieDp_cp 2012-08-27 21:24:20 +00:00
parent cc4358e031
commit 1ecc704c16
4 changed files with 220 additions and 163 deletions

View File

@ -42,7 +42,7 @@ namespace ANX.Framework.Content.Pipeline.Graphics
public GeometryContent()
{
Indices = new IndexCollection();
Vertices = new VertexContent();
Vertices = new VertexContent(this);
}
}
}

View File

@ -15,77 +15,114 @@ namespace ANX.Framework.Content.Pipeline.Graphics
{
public sealed class IndirectPositionCollection : IList<Vector3>, ICollection<Vector3>, IEnumerable<Vector3>, IEnumerable
{
private GeometryContent geometry;
private VertexChannel<int> indices;
int IList<Vector3>.IndexOf(Vector3 item)
#region Properties
public int Count
{
throw new NotImplementedException();
get { throw new NotImplementedException(); }
}
public bool IsReadOnly
{
get { return true; }
}
public Vector3 this[int index]
{
get
{
if (geometry.Parent == null)
{
throw new InvalidOperationException("Geometry must have a mesh parent.");
}
int vIndex = this.indices[index];
return geometry.Parent.Positions[vIndex];
}
set
{
throw new NotSupportedException();
}
}
#endregion
#region Constructor
public IndirectPositionCollection(GeometryContent geometry, VertexChannel<int> positionIndices)
{
this.geometry = geometry;
this.indices = positionIndices;
}
#endregion
#region Methods
public int IndexOf(Vector3 item)
{
for (int i = 0; i < Count; i++)
{
if (this[i] == item)
{
return i;
}
}
return -1;
}
public bool Contains(Vector3 item)
{
return this.IndexOf(item) >= 0;
}
public void CopyTo(Vector3[] array, int arrayIndex)
{
for (int i = 0; i < Count; i++)
{
array[arrayIndex++] = this[i];
}
}
void IList<Vector3>.Insert(int index, Vector3 item)
{
throw new NotImplementedException();
throw new NotSupportedException("Collection is fixed size");
}
void IList<Vector3>.RemoveAt(int index)
{
throw new NotImplementedException();
}
Vector3 IList<Vector3>.this[int index]
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
throw new NotSupportedException("Collection is fixed size");
}
void ICollection<Vector3>.Add(Vector3 item)
{
throw new NotImplementedException();
throw new NotSupportedException("Collection is fixed size");
}
void ICollection<Vector3>.Clear()
{
throw new NotImplementedException();
}
bool ICollection<Vector3>.Contains(Vector3 item)
{
throw new NotImplementedException();
}
void ICollection<Vector3>.CopyTo(Vector3[] array, int arrayIndex)
{
throw new NotImplementedException();
}
int ICollection<Vector3>.Count
{
get { throw new NotImplementedException(); }
}
bool ICollection<Vector3>.IsReadOnly
{
get { throw new NotImplementedException(); }
throw new NotSupportedException("Collection is fixed size");
}
bool ICollection<Vector3>.Remove(Vector3 item)
{
throw new NotImplementedException();
throw new NotSupportedException("Collection is fixed size");
}
IEnumerator<Vector3> IEnumerable<Vector3>.GetEnumerator()
{
throw new NotImplementedException();
for (int i = 0; i < Count; i++)
{
yield return this[i];
}
yield break;
}
IEnumerator IEnumerable.GetEnumerator()
{
throw new NotImplementedException();
for (int i = 0; i < Count; i++)
{
yield return this[i];
}
yield break;
}
#endregion
}
}

View File

@ -15,163 +15,176 @@ namespace ANX.Framework.Content.Pipeline.Graphics
{
public abstract class VertexChannel : IList, ICollection, IEnumerable
{
int IList.Add(object value)
#region Properties
public string Name
{
throw new NotImplementedException();
get;
private set;
}
void IList.Clear()
{
throw new NotImplementedException();
protected IList Source
{
get; set;
}
bool IList.Contains(object value)
public int Count
{
throw new NotImplementedException();
}
int IList.IndexOf(object value)
{
throw new NotImplementedException();
}
void IList.Insert(int index, object value)
{
throw new NotImplementedException();
}
bool IList.IsFixedSize
{
get { throw new NotImplementedException(); }
}
bool IList.IsReadOnly
{
get { throw new NotImplementedException(); }
}
void IList.Remove(object value)
{
throw new NotImplementedException();
}
void IList.RemoveAt(int index)
{
throw new NotImplementedException();
}
object IList.this[int index]
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
void ICollection.CopyTo(Array array, int index)
{
throw new NotImplementedException();
}
int ICollection.Count
{
get { throw new NotImplementedException(); }
get { return Source.Count; }
}
bool ICollection.IsSynchronized
{
get { throw new NotImplementedException(); }
get { return false; }
}
object ICollection.SyncRoot
{
get { throw new NotImplementedException(); }
get { return Source.SyncRoot; }
}
IEnumerator IEnumerable.GetEnumerator()
bool IList.IsFixedSize
{
throw new NotImplementedException();
get { return true; }
}
bool IList.IsReadOnly
{
get { return false; }
}
public object this[int index]
{
get { return Source[index]; }
set { Source[index] = value; }
}
#endregion
#region Constructor
public VertexChannel(string name)
{
this.Name = name;
}
#endregion
#region Methods
int IList.Add(object value)
{
throw new NotSupportedException("Size is fixed");
}
void IList.Insert(int index, object value)
{
throw new NotSupportedException("Size is fixed");
}
void IList.Clear()
{
throw new NotSupportedException("Size is fixed");
}
void IList.Remove(object value)
{
throw new NotSupportedException("Size is fixed");
}
void IList.RemoveAt(int index)
{
throw new NotSupportedException("Size is fixed");
}
public bool Contains(object value)
{
return Source.Contains(value);
}
public int IndexOf(object value)
{
return Source.IndexOf(value);
}
public void CopyTo(Array array, int index)
{
Source.CopyTo(array, index);
}
public IEnumerator GetEnumerator()
{
return Source.GetEnumerator();
}
#endregion
}
public sealed class VertexChannel<T> : VertexChannel, IList<T>, ICollection<T>, IEnumerable<T>, IEnumerable
{
private List<T> source;
int IList<T>.IndexOf(T item)
#region Properties
public new T this[int index]
{
throw new NotImplementedException();
}
void IList<T>.Insert(int index, T item)
{
throw new NotImplementedException();
}
void IList<T>.RemoveAt(int index)
{
throw new NotImplementedException();
}
T IList<T>.this[int index]
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
void ICollection<T>.Add(T item)
{
throw new NotImplementedException();
}
void ICollection<T>.Clear()
{
throw new NotImplementedException();
}
bool ICollection<T>.Contains(T item)
{
throw new NotImplementedException();
}
void ICollection<T>.CopyTo(T[] array, int arrayIndex)
{
throw new NotImplementedException();
}
int ICollection<T>.Count
{
get { throw new NotImplementedException(); }
get { return source[index]; }
set { source[index] = value; }
}
bool ICollection<T>.IsReadOnly
{
get { throw new NotImplementedException(); }
get { return false; }
}
#endregion
#region Constructor
public VertexChannel(string name)
: base(name)
{
source = new List<T>();
Source = source;
}
#endregion
#region Methods
void IList<T>.Insert(int index, T item)
{
throw new NotSupportedException("Size is fixed");
}
void IList<T>.RemoveAt(int index)
{
throw new NotSupportedException("Size is fixed");
}
void ICollection<T>.Add(T item)
{
throw new NotSupportedException("Size is fixed");
}
void ICollection<T>.Clear()
{
throw new NotSupportedException("Size is fixed");
}
bool ICollection<T>.Remove(T item)
{
throw new NotImplementedException();
throw new NotSupportedException("Size is fixed");
}
IEnumerator<T> IEnumerable<T>.GetEnumerator()
public int IndexOf(T item)
{
throw new NotImplementedException();
return source.IndexOf(item);
}
IEnumerator IEnumerable.GetEnumerator()
public bool Contains(T item)
{
throw new NotImplementedException();
return source.Contains(item);
}
public void CopyTo(T[] array, int arrayIndex)
{
source.CopyTo(array, arrayIndex);
}
public IEnumerator<T> GetEnumerator()
{
return source.GetEnumerator();
}
#endregion
}
}

View File

@ -35,12 +35,19 @@ namespace ANX.Framework.Content.Pipeline.Graphics
public int VertexCount
{
get;
private set;
get { return PositionIndices.Count; }
}
public VertexContent(GeometryContent content)
{
Channels = new VertexChannelCollection();
PositionIndices = new VertexChannel<int>("PositionIndices");
Positions = new IndirectPositionCollection(content, PositionIndices);
}
public int Add(int positionIndex)
{
throw new NotImplementedException();
}