修改水

This commit is contained in:
2026-01-01 22:00:33 +08:00
parent 040a222bd6
commit 9ceffccd39
1800 changed files with 103929 additions and 139495 deletions

View File

@@ -24,7 +24,11 @@ namespace Obi
public bool enabled
{
set { m_Enabled = value; }
set
{
if (m_Enabled != value)
m_Enabled = value;
}
get { return m_Enabled; }
}
@@ -46,17 +50,22 @@ namespace Obi
protected NativeArray<int> particleIndices;
protected NativeArray<float> lambdas;
public virtual JobHandle Initialize(JobHandle inputDeps, float stepTime, float substepTime, int steps, float timeLeft)
public virtual JobHandle Initialize(JobHandle inputDeps, float substepTime)
{
if (lambdas.IsCreated)
{
inputDeps = new ClearLambdasJob {lambdas = lambdas}.Schedule(lambdas.Length, 256, inputDeps);
// no need for jobs here, memclear is faster and we don't pay scheduling overhead.
unsafe
{
UnsafeUtility.MemClear(NativeArrayUnsafeUtility.GetUnsafeBufferPointerWithoutChecks(lambdas),
lambdas.Length * UnsafeUtility.SizeOf<float>());
}
}
return inputDeps;
}
// implemented by concrete constraint subclasses.
public abstract JobHandle Evaluate(JobHandle inputDeps, float stepTime, float substepTime, int steps, float timeLeft);
public abstract JobHandle Evaluate(JobHandle inputDeps, float stepTime, float substepTime, int substeps);
public abstract JobHandle Apply(JobHandle inputDeps, float substepTime);
public virtual void Destroy()
@@ -95,16 +104,6 @@ namespace Obi
counts[particleIndex] = 0;
}
}
[BurstCompile]
public struct ClearLambdasJob : IJobParallelFor
{
public NativeArray<float> lambdas;
public void Execute(int i)
{
lambdas[i] = 0;
}
}
}
}
#endif