How to use¶
Importing PCD from a file¶
PCD LoadFromFile( path, option )
try
{
PCDLib.PCD pcd = PCDLib.PCD.LoadFromFile("example.pcd");
Debug.Log("Number of points : " + pcd.pc.vertices);
if( pcd.points > 0 )
Debug.Log("First point : " + pcd.pc.vertices[0]);
}
catch( System.Exception e )
{
Debug.LogException(e);
}
Importing PCD from a file using a coroutine¶
IEnumerator LoadFromFileRoutine( onFinished, path, option, monitor )
void Start()
{
StartCoroutine(PCDLib.PCD.LoadFromFileRoutine( _OnFinished, "Assets/a.pcd"));
}
void _OnFinished( PCDLib.LoadResult result )
{
if( result.result == PCDLib.LoadResultCode.Successed )
{
Debug.Log("Load Success");
PCDLib.PCD pcd = result.pcd;
Debug.Log("Number of points : " + pcd.points);
}
else
{
Debug.LogError("Failed Load " + result.msg);
}
}
Exporting PCD to a file¶
void WriteToFile( pcd, path, option, writeColor )
try
{
//PCDLib.PCD pcd;
PCDLib.PCD.WriteToFile(pcd, "write.pcd");
Debug.Assert(System.IO.File.Exists("write.pcd"));
}
catch (System.Exception e)
{
Debug.LogException(e);
}
Generating a Mesh from PCD¶
//PCDLib.PCD pcd;
Mesh mesh = pcd.pc.ToMesh();
Debug.Log("mesh.vertexCount " + mesh.vertexCount);
Importing PCD as a Mesh¶
When you place a pcd in an Asset, it is imported as a Mesh asset.