-
-
Notifications
You must be signed in to change notification settings - Fork 279
/
Copy pathIConstraintDescription.cs
82 lines (74 loc) · 4.26 KB
/
IConstraintDescription.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
namespace BepuPhysics.Constraints
{
/// <summary>
/// Marks a type as a description of a constraint associated with a particular batch.
/// </summary>
/// <remarks>
/// Note that one batch may have multiple description types associated with it, each one potentially offering a different subset of properties or translation logic.
/// </remarks>
/// <typeparam name="TDescription">Type of the description object.</typeparam>
public interface IConstraintDescription<TDescription>
where TDescription : unmanaged, IConstraintDescription<TDescription>
{
/// <summary>
/// Changes the batch-held memory at a given location to match the given description.
/// </summary>
/// <param name="batch">Batch to modify.</param>
/// <param name="bundleIndex">Index of the target constraint's bundle.</param>
/// <param name="innerIndex">Index of the target constraint within its bundle.</param>
void ApplyDescription(ref TypeBatch batch, int bundleIndex, int innerIndex);
/// <summary>
/// Creates a description from the batch-held memory at a given location.
/// </summary>
/// <param name="batch">Batch to read.</param>
/// <param name="bundleIndex">Index of the source constraint's bundle.</param>
/// <param name="innerIndex">Index of the source constraint within its bundle.</param>
/// <param name="description">Description of the constraint.</param>
static abstract void BuildDescription(ref TypeBatch batch, int bundleIndex, int innerIndex, out TDescription description);
/// <summary>
/// Gets the type id of the constraint that this is a description of.
/// </summary>
static abstract int ConstraintTypeId { get; }
/// <summary>
/// Gets the type of the type batch which contains described constraints.
/// </summary>
static abstract Type TypeProcessorType { get; }
/// <summary>
/// Creates a type processor for this constraint type.
/// </summary>
static abstract TypeProcessor CreateTypeProcessor();
}
/// <summary>
/// Marks a type as a one body constraint description.
/// </summary>
/// <typeparam name="TDescription">Type of the description.</typeparam>
/// <remarks>This and the other body-count aware interfaces exist to give the compiler a way to report errors when using Solver.Add with different body counts.</remarks>
public interface IOneBodyConstraintDescription<TDescription> : IConstraintDescription<TDescription> where TDescription : unmanaged, IOneBodyConstraintDescription<TDescription>
{
}
/// <summary>
/// Marks a type as a two body constraint description.
/// </summary>
/// <typeparam name="TDescription">Type of the description.</typeparam>
/// <remarks>This and the other body-count aware interfaces exist to give the compiler a way to report errors when using Solver.Add with different body counts.</remarks>
public interface ITwoBodyConstraintDescription<TDescription> : IConstraintDescription<TDescription> where TDescription : unmanaged, ITwoBodyConstraintDescription<TDescription>
{
}
/// <summary>
/// Marks a type as a three body constraint description.
/// </summary>
/// <typeparam name="TDescription">Type of the description.</typeparam>
/// <remarks>This and the other body-count aware interfaces exist to give the compiler a way to report errors when using Solver.Add with different body counts.</remarks>
public interface IThreeBodyConstraintDescription<TDescription> : IConstraintDescription<TDescription> where TDescription : unmanaged, IThreeBodyConstraintDescription<TDescription>
{
}
/// <summary>
/// Marks a type as a four body constraint description.
/// </summary>
/// <typeparam name="TDescription">Type of the description.</typeparam>
/// <remarks>This and the other body-count aware interfaces exist to give the compiler a way to report errors when using Solver.Add with different body counts.</remarks>
public interface IFourBodyConstraintDescription<TDescription> : IConstraintDescription<TDescription> where TDescription : unmanaged, IFourBodyConstraintDescription<TDescription>
{
}
}