void Update() { BufferTools.Swap(filledVoxelGridBuffer); BufferTools.Swap(triangleIntersectionBuffer); if (triVertPosBuffers != null && triangleCount > 0) { DoCollisions(); } }
IEnumerator PostRenderUpdate() { while (this.enabled) { yield return(new WaitForEndOfFrame()); BufferTools.Swap(quadDataBuffer); //now the data is readable ClearBuffer(WRITE); } }
void IWantVoxelAges.GiveSwappedVoxelAgeBuffer(ComputeBuffer voxelAgeStatesREAD) { BufferTools.Swap(voxelAgeBuffer); cubeAgeSimulationShader.SetVector("_Dimensions", DanceBoxManager.inst.voxelDimensions4); cubeAgeSimulationShader.SetVector("_InvDimensions", DanceBoxManager.inst.inverseVoxelDimensions4); cubeAgeSimulationShader.SetFloat("_DeltaTime", Time.deltaTime * decaySpeed); cubeAgeSimulationShader.SetInt("_Gravity", gravity); cubeAgeSimulationShader.SetBuffer(caskernal, "ROldCubeAges", voxelAgeBuffer[READ]); cubeAgeSimulationShader.SetBuffer(caskernal, "RNewCubeAges", voxelAgeStatesREAD); cubeAgeSimulationShader.SetBuffer(caskernal, "WCubeAges", voxelAgeBuffer[WRITE]); cubeAgeSimulationShader.Dispatch(caskernal, DanceBoxManager.inst.totalVoxelsThreadGroup, 1, 1); voxelAgeRecipient.GiveSwappedVoxelAgeBuffer(voxelAgeBuffer[READ]); }
private void Update() { BufferTools.Swap(triVertexPositionBuffer); if (debug) { int[] argdata = new int[] { 0, 1, 0, 0 }; argBuffer.SetData(argdata); ComputeBuffer.CopyCount(triVertexPositionBuffer[READ], argBuffer, 0); argBuffer.GetData(argdata); DoDebug(argdata); } DoRender(); }
void Update() { BufferTools.Swap(filledVoxelGridBuffer); voxelAgeGenerator.SetBuffer(vgkernal, "WVoxelAgeBuffer", filledVoxelGridBuffer[WRITE]); voxelAgeGenerator.Dispatch(vgkernal, DanceBoxManager.inst.totalVoxelsThreadGroup, 1, 1); // DanceBoxManager.inst.voxelDimX, DanceBoxManager.inst.voxelDimY, DanceBoxManager.inst.voxelDimZ); voxelAgeGenerator.SetFloat("_Time", Time.time); if (debug) { Debug.Log("Running"); BufferTools.DebugComputeGrid <float>(filledVoxelGridBuffer[READ], "output voxel ages READ", DanceBoxManager.inst.singleDimensionCount); } voxelAgeRecipient.GiveSwappedVoxelAgeBuffer(filledVoxelGridBuffer[READ]); }
void LateUpdate() { BufferTools.Swap(quadDataBuffer); //now the data is readable }
private void LateUpdate() { BufferTools.Swap(voxelAgeBuffer); }