using System.Collections.Generic;
using UnityEngine.Formats.Alembic.Sdk;
namespace UnityEngine.Formats.Alembic.Importer
{
///
/// The Scene data container for animated point clouds.
///
[ExecuteInEditMode]
public class AlembicPointsCloud : MonoBehaviour
{
// members
PinnedList m_points = new PinnedList();
PinnedList m_velocities = new PinnedList();
PinnedList m_ids = new PinnedList();
internal AlembicPoints m_abc = null;
[Tooltip("Sort points by distance from sortFrom object")]
internal bool m_sort = false;
internal Transform m_sortFrom;
// properties
internal PinnedList pointsList { get { return m_points; } }
internal PinnedList velocitiesList { get { return m_velocities; } }
internal PinnedList idsList { get { return m_ids; } }
///
/// The list of point cloud positions.
///
public List Positions => pointsList.List;
///
/// The list of point cloud velocities.
///
public List Velocities => velocitiesList.List;
///
/// The list of point cloud identifiers.
///
public List Ids => idsList.List;
///
/// The center of the point cloud bounding box.
///
public Vector3 BoundsCenter { get; internal set; }
///
/// The extent of the point cloud bounding box.
///
public Vector3 BoundsExtents { get; internal set; }
void Reset()
{
var cam = Camera.main;
if (cam != null)
{
m_sortFrom = cam.GetComponent();
}
}
private void OnDestroy()
{
if (m_points != null) m_points.Dispose();
if (m_velocities != null) m_velocities.Dispose();
if (m_ids != null) m_ids.Dispose();
}
}
}