public void Update() { DispatchEmit(); nextFrameTime += Time.deltaTime; for (int j = 0; j < maxIterations && nextFrameTime > timestep; j++) { nextFrameTime -= timestep; DispatchPredictPositions(); hash.Process(predictedBuffers[READ], lifetimesBuffer); for (int i = 0; i < 4; i++) { DispatchSolveConstraints(); } DispatchUpdate(); } Render(); }
public void Update() { nextFrameTime += Time.deltaTime; float lifetimeTimestep = 0; for (int j = 0; j < maxIterations && nextFrameTime > timestep; j++) { nextFrameTime -= timestep; lifetimeTimestep += timestep; DispatchUpdatePositionAndVelocity(); hash.Process(positionsBuffers[READ], lifetimesBuffer); for (int i = 0; i < 4; i++) { DispatchSolveCollisions(); } } DispatchUpdate(lifetimeTimestep); DispatchAddTerrain(); Render(); }