重新导入obi

This commit is contained in:
2026-04-06 11:35:18 +08:00
parent 05fa2d6e5e
commit ae3002a0e2
1643 changed files with 232496 additions and 13 deletions

View File

@@ -0,0 +1,73 @@
#if (OBI_ONI_SUPPORTED)
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace Obi
{
public class OniConstraintsBatchImpl : IConstraintsBatchImpl
{
protected IConstraints m_Constraints;
protected Oni.ConstraintType m_ConstraintType;
protected IntPtr m_OniBatch;
protected bool m_Enabled;
public IntPtr oniBatch
{
get { return m_OniBatch; }
}
public Oni.ConstraintType constraintType
{
get { return m_ConstraintType; }
}
public IConstraints constraints
{
get { return m_Constraints; }
}
public bool enabled
{
set
{
if (m_Enabled != value)
{
m_Enabled = value;
Oni.EnableBatch(m_OniBatch, m_Enabled);
}
}
get { return m_Enabled; }
}
public OniConstraintsBatchImpl(IConstraints constraints, Oni.ConstraintType type)
{
this.m_Constraints = constraints;
this.m_ConstraintType = type;
m_OniBatch = Oni.CreateBatch((int)type);
}
public void Destroy()
{
//Oni.DestroyBatch(m_OniBatch);
// remove the constraint batch from the solver
// (no need to destroy it as its destruction is managed by the solver)
// just reset the reference.
m_OniBatch = IntPtr.Zero;
}
public void SetConstraintCount(int constraintCount)
{
Oni.SetBatchConstraintCount(m_OniBatch, constraintCount);
}
public int GetConstraintCount()
{
return Oni.GetBatchConstraintCount(m_OniBatch);
}
}
}
#endif