Show More
Commit Description:
Optimize PreserveCounts and only recalculate when needed....
Commit Description:
Optimize PreserveCounts and only recalculate when needed. Previously would recalculate preservecounts every Update call (~1 per frame), which isn't necessary when there's no tick. Might be some room to tweak, like doing these updates only when preserves change. Some measurements: This takes about 30ms versus the .25 ms with no preserve (then like .0002ms). When the map is filled up with preserve, about 35ms and 9ms. With a handful of cells, it's more like 0.8ms (before JIT optimizes most of it away).
File last commit:
Show/Diff file:
Action:
FNA/src/Graphics/ModelBone.cs
116 lines | 2.0 KiB | text/x-csharp | CSharpLexer
#region License
/* FNA - XNA4 Reimplementation for Desktop Platforms
* Copyright 2009-2020 Ethan Lee and the MonoGame Team
*
* Released under the Microsoft Public License.
* See LICENSE for details.
*/
#endregion
#region Using Statements
using System.Collections.Generic;
#endregion
namespace Microsoft.Xna.Framework.Graphics
{
/// <summary>
/// Represents bone data for a model.
/// </summary>
public sealed class ModelBone
{
#region Public Properties
/// <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;
internal set;
}
/// <summary>
/// Gets the name of this bone.
/// </summary>
public string Name
{
get;
internal set;
}
/// <summary>
/// Gets the parent of this bone.
/// </summary>
public ModelBone Parent
{
get;
internal set;
}
/// <summary>
/// Gets or sets the matrix used to transform this bone relative to its parent
/// bone.
/// </summary>
public Matrix Transform
{
get;
set;
}
#endregion
#region Internal Properties
/// <summary>
/// Transform of this node from the root of the model not from the parent
/// </summary>
internal Matrix ModelTransform
{
get;
set;
}
#endregion
#region Private Variables
private List<ModelBone> children = new List<ModelBone>();
private List<ModelMesh> meshes = new List<ModelMesh>();
#endregion
#region Internal Constructor
internal ModelBone()
{
Children = new ModelBoneCollection(new List<ModelBone>());
meshes = new List<ModelMesh>();
}
#endregion
#region Internal Methods
internal void AddMesh(ModelMesh mesh)
{
meshes.Add(mesh);
}
internal void AddChild(ModelBone modelBone)
{
children.Add(modelBone);
Children = new ModelBoneCollection(children);
}
#endregion
}
}