public override void UpdateForces(int nx) { if (nlist == null) { nlistComputer = GameObject.Find("ParticleManager").GetComponentInChildren <ComputeNeighbors>(); nlist = nlistComputer.NeighborList; dispersionShader.SetInt("maxNeighbors", nlistComputer.MaxNeighbors); dispersionShader.SetBuffer(forceHandle, "nlist", nlist); } dispersionShader.Dispatch(forceHandle, nx, 1, 1); }
public override void UpdateForces(int nx) { if (nlist == null) { nlistComputer = GameObject.Find("ParticleManager").GetComponentInChildren <ComputeNeighbors>(); nlist = nlistComputer.NeighborList; gravityShader.SetInt("maxNeighbors", nlistComputer.MaxNeighbors); gravityShader.SetFloat("cutoff", nlistComputer.Cutoff * 0.85f); //use 85% since nlist isn't rebuild each step gravityShader.SetBuffer(forceHandle, "nlist", nlist); } gravityShader.Dispatch(forceHandle, nx, 1, 1); }
public override void UpdatePostIntegrate(int nx) { if (nlist == null) { nlistComputer = GameObject.Find("ParticleManager").GetComponentInChildren <ComputeNeighbors>(); nlist = nlistComputer.NeighborList; intersectionShader.SetInt("maxNeighbors", nlistComputer.MaxNeighbors); intersectionShader.SetBuffer(intersectionsHandle, "nlist", nlist); } intersectionShader.Dispatch(intersectionsHandle, nx, 1, 1); intersectionShader.Dispatch(explodeHandle, nx, 1, 1); }