protected override void OnPointCloudUpdated(PointCloudUpdatedEventArgs e)
        {
            base.OnPointCloudUpdated(e);

            if (!_indices.IsCreated)
            {
                InitializeIndices();
            }

            var vertices = new NativeArray <Vertex>(e.count, Allocator.Temp);

            for (var i = 0; i < vertices.Length; i++)
            {
                vertices[i] = new Vertex(e.pointCloud.points[e.startIndex + i], e.pointCloud.colors[e.startIndex + i]);

                _boundsMin = Vector3.Min(_boundsMin, vertices[i].position);
                _boundsMax = Vector3.Max(_boundsMax, vertices[i].position);
            }

            _mesh.SetVertexBufferParams(pointCloud.count, _vertexAttributeDescriptors);
            _mesh.SetVertexBufferData(vertices, 0, e.startIndex, e.count, 0);

            _mesh.SetIndexBufferParams(pointCloud.count, IndexFormat.UInt32);
            _mesh.SetIndexBufferData(_indices, e.startIndex, e.startIndex, e.count);
            _mesh.SetSubMesh(0, new SubMeshDescriptor(0, pointCloud.count, MeshTopology.Points));

            var bounds = new Bounds();

            bounds.SetMinMax(_boundsMin, _boundsMax);
            _mesh.bounds = bounds;
        }
        protected override void OnPointCloudUpdated(PointCloudUpdatedEventArgs e)
        {
            base.OnPointCloudUpdated(e);

            var size  = _particleSystem.main.startSize.constant;
            var alpha = _particleSystem.main.startColor.color.a;

            for (var i = e.startIndex; i < e.startIndex + e.count; ++i)
            {
                _particles[i].position  = e.pointCloud.points[i];
                _particles[i].startSize = size;

                var color = useConfidenceColor
                    ? confidenceGradient.Evaluate(e.pointCloud.confidences[i])
                    : (Color)e.pointCloud.colors[i];
                color.a = alpha;
                _particles[i].startColor = color;

                //_particles[i].remainingLifetime = 1f;
            }

            _particleSystem.SetParticles(_particles, e.pointCloud.count);
        }
 private void OnPointCloudUpdated(PointCloudUpdatedEventArgs e)
 {
     pointCloudUpdated?.Invoke(e);
 }
 protected virtual void OnPointCloudUpdated(PointCloudUpdatedEventArgs e)
 {
     // Intentionally empty.
 }