(61d00a474) v0.9.7.1

This commit is contained in:
Regalis
2020-03-04 13:04:10 +01:00
parent 3c50efa5c9
commit 3c09ebe02f
5086 changed files with 786063 additions and 295871 deletions
@@ -0,0 +1,53 @@
/* Original source Farseer Physics Engine:
* Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com
* Microsoft Permissive License (Ms-PL) v1.1
*/
using System.Collections.Generic;
using FarseerPhysics.Collision.Shapes;
using FarseerPhysics.Dynamics;
namespace FarseerPhysics.Content
{
public class FixtureTemplate
{
public Shape Shape;
public float Restitution;
public float Friction;
public string Name;
}
public class BodyTemplate
{
public List<FixtureTemplate> Fixtures;
public float Mass;
public BodyType BodyType;
public BodyTemplate()
{
Fixtures = new List<FixtureTemplate>();
}
public Body Create(World world)
{
Body body = world.CreateBody();
body.BodyType = BodyType;
foreach (FixtureTemplate fixtureTemplate in Fixtures)
{
Fixture fixture = body.CreateFixture(fixtureTemplate.Shape);
fixture.UserData = fixtureTemplate.Name;
fixture.Restitution = fixtureTemplate.Restitution;
fixture.Friction = fixtureTemplate.Friction;
}
if (Mass > 0f)
body.Mass = Mass;
return body;
}
}
public class BodyContainer : Dictionary<string, BodyTemplate> { }
}
@@ -0,0 +1,54 @@
/* Original source Farseer Physics Engine:
* Copyright (c) 2014 Ian Qvist, http://farseerphysics.codeplex.com
* Microsoft Permissive License (Ms-PL) v1.1
*/
using System.Collections.Generic;
using FarseerPhysics.Common;
using FarseerPhysics.Common.Decomposition;
/*namespace FarseerPhysics.Content
{
public struct Polygon
{
public Vertices Vertices;
public bool Closed;
public Polygon(Vertices v, bool closed)
{
Vertices = v;
Closed = closed;
}
}
public class PolygonContainer : Dictionary<string, Polygon>
{
public bool IsDecomposed
{
get { return _decomposed; }
}
private bool _decomposed;
public void Decompose()
{
Dictionary<string, Polygon> containerCopy = new Dictionary<string, Polygon>(this);
foreach (string key in containerCopy.Keys)
{
if (containerCopy[key].Closed)
{
List<Vertices> partition = Triangulate.ConvexPartition(containerCopy[key].Vertices, TriangulationAlgorithm.Bayazit);
if (partition.Count > 1)
{
Remove(key);
for (int i = 0; i < partition.Count; i++)
{
this[key + "_" + i.ToString()] = new Polygon(partition[i], true);
}
}
_decomposed = true;
}
}
}
}
}*/