Exemple #1
0
 public void Solve()
 {
     _velocities.SetBuffer(_compute, _kernel);
     _positions.SetBuffer(_compute, _kernel);
     _lifes.SetBuffer(_compute, _kernel);
     _broadphase.SetBuffer(_compute, _kernel);
     _compute.Dispatch(_kernel, _velocities.SimSizeX, _velocities.SimSizeY, _velocities.SimSizeZ);
     _velocities.Swap();
 }
Exemple #2
0
 public void Solve()
 {
     _walls.Update();
     _velocities.SetBuffer(_compute, _kernel);
     _positions.SetBuffer(_compute, _kernel);
     _walls.SetBuffer(_compute, _kernel);
     _compute.Dispatch(_kernel, _velocities.SimSizeX, _velocities.SimSizeY, _velocities.SimSizeZ);
     _velocities.Swap();
 }
Exemple #3
0
        public void Solve()
        {
            if (_polygons.PolygonCount == 0)
            {
                return;
            }

            _velocities.SetBuffer(_compute, _kernel);
            _positions.SetBuffer(_compute, _kernel);
            _lifes.SetBuffer(_compute, _kernel);
            _polygons.SetBuffer(_compute, _kernel);
            _compute.Dispatch(_kernel, _velocities.SimSizeX, _velocities.SimSizeY, _velocities.SimSizeZ);
            _velocities.Swap();
        }
Exemple #4
0
        public void Detect(float distance)
        {
            int x = _lifes.SimSizeX, y = _lifes.SimSizeY, z = _lifes.SimSizeZ;

            _hashes.Init(_grid);

            _sort.Init(_keys);
            _sort.SortInt(_keys, _hashes.Hashes);

            _grid.Construct(_keys);

            _grid.SetParams(_compute);
            _compute.SetFloat(ShaderConst.PROP_BROADPHASE_SQR_DISTANCE, distance * distance);
            _compute.SetBuffer(_kernelSolve, ShaderConst.BUF_BROADPHASE_KEYS, _keys);
            _positions.SetBuffer(_compute, _kernelSolve);
            _lifes.SetBuffer(_compute, _kernelSolve);
            _grid.SetBuffer(_compute, _kernelSolve);
            SetBuffer(_compute, _kernelSolve);
            _compute.Dispatch(_kernelSolve, x, y, z);
        }
 public void Simulate()
 {
     _velocities.SetBuffer(_compute, _kernelSimulate);
     _positions.SetBuffer(_compute, _kernelSimulate);
     _compute.Dispatch(_kernelSimulate, _positions.SimSizeX, _positions.SimSizeY, _positions.SimSizeZ);
 }
 public void Check()
 {
     _lifes.SetBuffer(_compute, _kernel);
     _positions.SetBuffer(_compute, _kernel);
     _compute.Dispatch(_kernel, _positions.SimSizeX, _positions.SimSizeY, _positions.SimSizeZ);
 }