public void Dispose()
 {
     ComputeUtilities.Release(ref positionsBuffer);
     ComputeUtilities.Release(ref velocitiesBuffer);
     ComputeUtilities.Release(ref lifetimesBuffer);
     ComputeUtilities.Release(predictedBuffers);
     ComputeUtilities.Release(ref deadBuffer);
     ComputeUtilities.Release(ref aliveBuffer);
     ComputeUtilities.Release(ref counter);
     ComputeUtilities.Release(ref emitCounter);
     ComputeUtilities.Release(ref argsBuffer);
     mesh = null;
     hash.Dispose();
 }
        private void DispatchUpdatePositionAndVelocity()
        {
            int updateKernel = computeShader.FindKernel("UpdatePositionAndVelocity");

            computeShader.SetInt("Width", lifetimesBuffer.count);
            computeShader.SetBuffer(updateKernel, "Lifetimes", lifetimesBuffer);
            computeShader.SetBuffer(updateKernel, "Motions", motionsBuffer);
            computeShader.SetBuffer(updateKernel, "PositionsREAD", positionsBuffers[READ]);
            computeShader.SetBuffer(updateKernel, "VelocitiesREAD", velocitiesBuffers[READ]);
            computeShader.SetBuffer(updateKernel, "PositionsWRITE", positionsBuffers[WRITE]);
            computeShader.SetBuffer(updateKernel, "VelocitiesWRITE", velocitiesBuffers[WRITE]);
            computeShader.Dispatch(updateKernel, Groups(lifetimesBuffer.count), 1, 1);
            ComputeUtilities.Swap(positionsBuffers);
            ComputeUtilities.Swap(velocitiesBuffers);
        }
 public void Dispose()
 {
     ComputeUtilities.Release(ref explosionsBuffer);
     ComputeUtilities.Release(positionsBuffers);
     ComputeUtilities.Release(velocitiesBuffers);
     ComputeUtilities.Release(ref lifetimesBuffer);
     ComputeUtilities.Release(ref motionsBuffer);
     ComputeUtilities.Release(ref colorsBuffer);
     ComputeUtilities.Release(ref deadBuffer);
     ComputeUtilities.Release(ref aliveBuffer);
     ComputeUtilities.Release(ref counter);
     ComputeUtilities.Release(ref counterIndex);
     ComputeUtilities.Release(ref emitCounter);
     ComputeUtilities.Release(ref argsBuffer);
     mesh = null;
     hash.Dispose();
 }
        private void DispatchSolveCollisions()
        {
            int solveConstraintsKernel = computeShader.FindKernel("SolveCollisions");

            computeShader.SetInt("Width", lifetimesBuffer.count);
            computeShader.SetBuffer(solveConstraintsKernel, "IndexMap", hash.IndexMap);
            computeShader.SetBuffer(solveConstraintsKernel, "Table", hash.Table);
            computeShader.SetTexture(solveConstraintsKernel, "_TerrainDistanceField", terrainSystem.terrainDistanceField);
            computeShader.SetBuffer(solveConstraintsKernel, "Lifetimes", lifetimesBuffer);
            computeShader.SetBuffer(solveConstraintsKernel, "PositionsREAD", positionsBuffers[READ]);
            computeShader.SetBuffer(solveConstraintsKernel, "VelocitiesREAD", velocitiesBuffers[READ]);
            computeShader.SetBuffer(solveConstraintsKernel, "PositionsWRITE", positionsBuffers[WRITE]);
            computeShader.SetBuffer(solveConstraintsKernel, "VelocitiesWRITE", velocitiesBuffers[WRITE]);
            computeShader.Dispatch(solveConstraintsKernel, Groups(lifetimesBuffer.count), 1, 1);
            ComputeUtilities.Swap(positionsBuffers);
            ComputeUtilities.Swap(velocitiesBuffers);
        }
Exemplo n.º 5
0
 public void Dispose()
 {
     ComputeUtilities.Release(ref tempBuffer1);
     ComputeUtilities.Release(ref tempBuffer2);
 }