void FillBuffer() { OperationInfo[] opInfo = new OperationInfo[operations.Count]; for (int i = 0; i < operations.Count; i++) { RaymarchOperation o = operations[i]; if (o == null) { UpdateComponentLists(); o = operations[i]; } opInfo[i] = new OperationInfo() { operation = (int)o.operation, childCount = o.childCount, blendStrength = o.blendStrength }; } ShapeInfo[] shapeInfo = new ShapeInfo[shapes.Count]; for (int i = 0; i < shapes.Count; i++) { RaymarchShape s = shapes[i]; if (s == null) { UpdateComponentLists(); s = shapes[i]; } shapeInfo[i] = new ShapeInfo() { position = s.transform.position, shape = (int)s.shape, color = new Vector3(s.color.r, s.color.g, s.color.b), sphereRadius = s.sphereRadius, boxDimensions = s.boxDimensions, roundBoxDimensions = s.roundBoxDimensions, roundBoxFactor = s.roundBoxFactor, torusInnerRadius = s.torusInnerRadius, torusOuterRadius = s.torusOuterRadius, coneHeight = s.coneHeight, coneRatio = s.coneRatio, }; } opBuffer = new ComputeBuffer(opInfo.Length, OperationInfo.GetSize()); shapeBuffer = new ComputeBuffer(shapeInfo.Length, ShapeInfo.GetSize()); opBuffer.SetData(opInfo); shapeBuffer.SetData(shapeInfo); Material.SetBuffer("operations", opBuffer); Material.SetBuffer("shapes", shapeBuffer); }