Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Commit

Permalink
Merge pull request #182 from extrahotchilipowder/monogame-sdl2
Browse files Browse the repository at this point in the history
[FNA] #147 cleanup and tabifying of remaining Graphics/ files
  • Loading branch information
flibitijibibo committed Mar 30, 2014
2 parents 6670130 + 75e0b1a commit de44018
Show file tree
Hide file tree
Showing 11 changed files with 1,971 additions and 1,748 deletions.
213 changes: 106 additions & 107 deletions MonoGame.Framework/Graphics/ModelBone.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,94 +8,120 @@
#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

public List<ModelMesh> Meshes
{
get
{
return this.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; }
public Matrix Transform
{
get { return this.transform; }
set { this.transform = value; }
}

/// <summary>
/// Transform of this node from the root of the model not from the parent
/// </summary>
public Matrix ModelTransform
{
get;
set;
}

#endregion

#region Internal Variables

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

#endregion

#region Private Variables

private List<ModelBone> children = new List<ModelBone>();

{
#region Public Properties

public List<ModelMesh> Meshes
{
get
{
return meshes;
}
private set
{
meshes = value;
}
}

/// <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;
}
}

/// <summary>
/// Transform of this node from the root of the model not from the parent
/// </summary>
public Matrix ModelTransform
{
get;
set;
}

#endregion

#region Internal Variables

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

#endregion

#region Private Variables

private List<ModelBone> children = new List<ModelBone>();

private List<ModelMesh> meshes = new List<ModelMesh>();

#endregion
#endregion

#region Public Constructor
#region Public Constructor

public ModelBone()
{
Children = new ModelBoneCollection(new List<ModelBone>());
}
public ModelBone()
{
Children = new ModelBoneCollection(new List<ModelBone>());
}

#endregion
#endregion

#region Public Methods
#region Public Methods

public void AddMesh(ModelMesh mesh)
public void AddMesh(ModelMesh mesh)
{
meshes.Add(mesh);
}
Expand All @@ -104,35 +130,8 @@ public void AddChild(ModelBone modelBone)
{
children.Add(modelBone);
Children = new ModelBoneCollection(children);
}

#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(); } }
//}
}
}

#endregion
}
}
126 changes: 45 additions & 81 deletions MonoGame.Framework/Graphics/ModelBoneCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,111 +8,75 @@
#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.
public ModelBone this[string boneName]
{
get
{
ModelBone ret;
if (TryGetValue(boneName, out ret))
{
return ret;
}
throw new KeyNotFoundException();
}
}
{
#region Public Properties

/// <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
{
ModelBone ret;
if (TryGetValue(boneName, out ret))
{
return ret;
}
throw new KeyNotFoundException();
}
}

#endregion
#endregion

#region Public Constructor
#region Public Constructor

public ModelBoneCollection(IList<ModelBone> list)
public ModelBoneCollection(IList<ModelBone> list)
: base(list)
{
}

#endregion
#endregion

#region Public Methods
#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.
public bool TryGetValue(string boneName, out ModelBone value)
/// <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;
}
}
value = null;
return false;
}

#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
// }
#endregion
}
}
}
Loading

0 comments on commit de44018

Please sign in to comment.