Skip to content

Commit

Permalink
[FNA] flibitijibibo#147 first pass cleanup for remainder of Graphics/…
Browse files Browse the repository at this point in the history
… - this commit will be for more "structural" changes. more white space and tabbing fixes will be in separate commit
  • Loading branch information
extrahotchilipowder committed Mar 29, 2014
1 parent 1d33f51 commit 66dc169
Show file tree
Hide file tree
Showing 11 changed files with 647 additions and 639 deletions.
109 changes: 54 additions & 55 deletions MonoGame.Framework/Graphics/ModelBone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@
#endregion

#region Using Statements
using Microsoft.Xna.Framework;
using System;
using System.Collections.Generic;
#endregion

namespace Microsoft.Xna.Framework.Graphics
{
// Summary:
// Represents bone data for a model. Reference page contains links to related
// conceptual articles.
/// <summary>
/// Represents bone data for a model. Reference page contains links to related
/// conceptual articles.
/// </summary>
public sealed class ModelBone
{
#region Public Properties
Expand All @@ -26,33 +25,60 @@ public List<ModelMesh> Meshes
{
get
{
return this.meshes;
return meshes;
}
private set
{
meshes = value;
}
}

// Summary:
// Gets a collection of bones that are children of this bone.
public ModelBoneCollection Children { get; private set; }
//
// Summary:
// Gets the index of this bone in the Bones collection.
public int Index { get; set; }
//
// Summary:
// Gets the name of this bone.
public string Name { get; set; }
//
// Summary:
// Gets the parent of this bone.
public ModelBone Parent { get; set; }
/// <summary>
/// Gets a collection of bones that are children of this bone.
/// </summary>
public ModelBoneCollection Children
{
get;
private set;
}

/// <summary>
/// Gets the index of this bone in the Bones collection.
/// </summary>
public int Index
{
get;
set;
}

/// <summary>
/// Gets the name of this bone.
/// </summary>
public string Name
{
get;
set;
}

/// <summary>
/// Gets the parent of this bone.
/// </summary>
public ModelBone Parent
{
get;
set;
}

public Matrix Transform
{
get { return this.transform; }
set { this.transform = value; }
get
{
return this.transform;
}
set
{
this.transform = value;
}
}

/// <summary>
Expand All @@ -68,10 +94,10 @@ public Matrix ModelTransform

#region Internal Variables

//
// Summary:
// Gets or sets the matrix used to transform this bone relative to its parent
// bone.
/// <summary>
/// Gets or sets the matrix used to transform this bone relative to its parent
/// bone.
/// </summary>
internal Matrix transform;

#endregion
Expand Down Expand Up @@ -108,31 +134,4 @@ public void AddChild(ModelBone modelBone)

#endregion
}

//// Summary:
//// Represents bone data for a model. Reference page contains links to related
//// conceptual articles.
//public sealed class ModelBone
//{
// // Summary:
// // Gets a collection of bones that are children of this bone.
// public ModelBoneCollection Children { get { throw new NotImplementedException(); } }
// //
// // Summary:
// // Gets the index of this bone in the Bones collection.
// public int Index { get { throw new NotImplementedException(); } }
// //
// // Summary:
// // Gets the name of this bone.
// public string Name { get { throw new NotImplementedException(); } }
// //
// // Summary:
// // Gets the parent of this bone.
// public ModelBone Parent { get { throw new NotImplementedException(); } }
// //
// // Summary:
// // Gets or sets the matrix used to transform this bone relative to its parent
// // bone.
// public Matrix Transform { get { throw new NotImplementedException(); } set { throw new NotImplementedException(); } }
//}
}
}
80 changes: 22 additions & 58 deletions MonoGame.Framework/Graphics/ModelBoneCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,26 @@
#endregion

#region Using Statements
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Reflection;

#endregion

namespace Microsoft.Xna.Framework.Graphics
{
// Summary:
// Represents a set of bones associated with a model.
/// <summary>
/// Represents a set of bones associated with a model.
/// </summary>
public class ModelBoneCollection : ReadOnlyCollection<ModelBone>
{
#region Public Properties

// Summary:
// Retrieves a ModelBone from the collection, given the name of the bone.
//
// Parameters:
// boneName:
// The name of the bone to retrieve.
/// <summary>
/// Retrieves a ModelBone from the collection, given the name of the bone.
/// </summary>
/// <param name="boneName">
/// The name of the bone to retrieve.
/// </param>
public ModelBone this[string boneName]
{
get
Expand All @@ -55,24 +54,21 @@ public ModelBoneCollection(IList<ModelBone> list)

#region Public Methods

// // Summary:
// // Returns a ModelBoneCollection.Enumerator that can iterate through a ModelBoneCollection.
// public ModelBoneCollection.Enumerator GetEnumerator() { throw new NotImplementedException(); }
//
// Summary:
// Finds a bone with a given name if it exists in the collection.
//
// Parameters:
// boneName:
// The name of the bone to find.
//
// value:
// [OutAttribute] The bone named boneName, if found.
/// <summary>
/// Finds a bone with a given name if it exists in the collection.
/// </summary>
/// <param name="boneName">
/// The name of the bone to find.
/// </param>
/// <param name="value">
/// [OutAttribute] The bone named boneName, if found.
/// </param>
public bool TryGetValue(string boneName, out ModelBone value)
{
foreach (ModelBone bone in base.Items)
{
if (bone.Name == boneName) {
if (bone.Name == boneName)
{
value = bone;
return true;
}
Expand All @@ -82,37 +78,5 @@ public bool TryGetValue(string boneName, out ModelBone value)
}

#endregion

// // Summary:
// // Provides the ability to iterate through the bones in an ModelBoneCollection.
// public struct Enumerator : IEnumerator<ModelBone>, IDisposable, IEnumerator
// {

// // Summary:
// // Gets the current element in the ModelBoneCollection.
// public ModelBone Current { get { throw new NotImplementedException(); } }

// // Summary:
// // Immediately releases the unmanaged resources used by this object.
// public void Dispose() { throw new NotImplementedException(); }
// //
// // Summary:
// // Advances the enumerator to the next element of the ModelBoneCollection.
// public bool MoveNext() { throw new NotImplementedException(); }

// #region IEnumerator Members

// object IEnumerator.Current
// {
// get { throw new NotImplementedException(); }
// }

// public void Reset()
// {
// throw new NotImplementedException();
// }

// #endregion
// }
}
}
}
61 changes: 38 additions & 23 deletions MonoGame.Framework/Graphics/ModelEffectCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@

namespace Microsoft.Xna.Framework.Graphics
{
// Summary:
// Represents a collection of effects associated with a model.
/// <summary>
/// Represents a collection of effects associated with a model.
/// </summary>
public sealed class ModelEffectCollection : ReadOnlyCollection<Effect>
{

#region Public Constructor

public ModelEffectCollection(IList<Effect> list)
Expand All @@ -40,11 +40,12 @@ internal ModelEffectCollection() : base(new List<Effect>())

#region Public Methods

// Summary:
// Returns a ModelEffectCollection.Enumerator that can iterate through a ModelEffectCollection.
/// <summary>
/// Returns a ModelEffectCollection.Enumerator that can iterate through a ModelEffectCollection.
/// </summary>
public new ModelEffectCollection.Enumerator GetEnumerator()
{
return new ModelEffectCollection.Enumerator((List<Effect>)Items);
return new ModelEffectCollection.Enumerator((List<Effect>) Items);
}

#endregion
Expand All @@ -56,6 +57,7 @@ internal void Add(Effect item)
{
Items.Add (item);
}

internal void Remove(Effect item)
{
Items.Remove (item);
Expand All @@ -65,14 +67,21 @@ internal void Remove(Effect item)

#region Public Enumerator struct

// Summary:
// Provides the ability to iterate through the bones in an ModelEffectCollection.
/// <summary>
/// Provides the ability to iterate through the bones in an ModelEffectCollection.
/// </summary>
public struct Enumerator : IEnumerator<Effect>, IDisposable, IEnumerator
{

// Summary:
// Gets the current element in the ModelEffectCollection.
public Effect Current { get { return enumerator.Current; } }
/// <summary>
/// Gets the current element in the ModelEffectCollection.
/// </summary>
public Effect Current
{
get
{
return enumerator.Current;
}
}

List<Effect>.Enumerator enumerator;
bool disposed;
Expand All @@ -83,8 +92,9 @@ internal Enumerator(List<Effect> list)
disposed = false;
}

// Summary:
// Immediately releases the unmanaged resources used by this object.
/// <summary>
/// Immediately releases the unmanaged resources used by this object.
/// </summary>
public void Dispose()
{
if (!disposed)
Expand All @@ -94,26 +104,31 @@ public void Dispose()
}
}

//
// Summary:
// Advances the enumerator to the next element of the ModelEffectCollection.
public bool MoveNext() { return enumerator.MoveNext(); }
/// <summary>
/// Advances the enumerator to the next element of the ModelEffectCollection.
/// </summary>
public bool MoveNext()
{
return enumerator.MoveNext();
}

object IEnumerator.Current
{
get { return Current; }
get
{
return Current;
}
}

void IEnumerator.Reset()
{
IEnumerator resetEnumerator = enumerator;
resetEnumerator.Reset ();
enumerator = (List<Effect>.Enumerator)resetEnumerator;
resetEnumerator.Reset();
enumerator = (List<Effect>.Enumerator) resetEnumerator;
}

}

#endregion

}
}
}
Loading

0 comments on commit 66dc169

Please sign in to comment.