Files
Fishing2/Assets/Obi/Scripts/Common/Backends/Compute/Constraints/Tether/ComputeTetherConstraints.cs
2026-01-22 22:08:21 +08:00

33 lines
1.0 KiB
C#

using System;
using UnityEngine;
namespace Obi
{
public class ComputeTetherConstraints : ComputeConstraintsImpl<ComputeTetherConstraintsBatch>
{
public ComputeShader constraintsShader;
public int projectKernel;
public int applyKernel;
public ComputeTetherConstraints(ComputeSolverImpl solver) : base(solver, Oni.ConstraintType.Tether)
{
constraintsShader = GameObject.Instantiate(Resources.Load<ComputeShader>("Compute/TetherConstraints"));
projectKernel = constraintsShader.FindKernel("Project");
applyKernel = constraintsShader.FindKernel("Apply");
}
public override IConstraintsBatchImpl CreateConstraintsBatch()
{
var dataBatch = new ComputeTetherConstraintsBatch(this);
batches.Add(dataBatch);
return dataBatch;
}
public override void RemoveBatch(IConstraintsBatchImpl batch)
{
batches.Remove(batch as ComputeTetherConstraintsBatch);
batch.Destroy();
}
}
}