mirror of
https://github.com/storytold/LiveScan3D.git
synced 2026-10-17 00:23:00 +00:00
Modified the .ply file reader in LiveScanPlayer to allow for reading .ply files saved by meshlab.
This commit is contained in:
@@ -33,13 +33,18 @@ namespace LiveScanPlayer
|
|||||||
{
|
{
|
||||||
BinaryReader reader = new BinaryReader(new FileStream(filenames[currentFrameIdx], FileMode.Open));
|
BinaryReader reader = new BinaryReader(new FileStream(filenames[currentFrameIdx], FileMode.Open));
|
||||||
|
|
||||||
|
bool alpha = false;
|
||||||
string line = ReadLine(reader);
|
string line = ReadLine(reader);
|
||||||
while (!line.Contains("element vertex"))
|
while (!line.Contains("element vertex"))
|
||||||
line = ReadLine(reader);
|
line = ReadLine(reader);
|
||||||
string[] lineElems = line.Split(' ');
|
string[] lineElems = line.Split(' ');
|
||||||
int nPoints = Int32.Parse(lineElems[2]);
|
int nPoints = Int32.Parse(lineElems[2]);
|
||||||
while (!line.Contains("end_header"))
|
while (!line.Contains("end_header"))
|
||||||
|
{
|
||||||
|
if (line.Contains("alpha"))
|
||||||
|
alpha = true;
|
||||||
line = ReadLine(reader);
|
line = ReadLine(reader);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < nPoints; i++)
|
for (int i = 0; i < nPoints; i++)
|
||||||
{
|
{
|
||||||
@@ -51,6 +56,9 @@ namespace LiveScanPlayer
|
|||||||
{
|
{
|
||||||
colors.Add(reader.ReadByte());
|
colors.Add(reader.ReadByte());
|
||||||
}
|
}
|
||||||
|
//read additional alpha byte
|
||||||
|
if (alpha)
|
||||||
|
reader.ReadByte();
|
||||||
}
|
}
|
||||||
|
|
||||||
reader.Dispose();
|
reader.Dispose();
|
||||||
|
|||||||
Reference in New Issue
Block a user