Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit73f77c9

Browse files
authored
Create RuntimeLASConvert.cs
1 parent625d509 commit73f77c9

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// example script to convert LAS/LAZ file at runtime and then read it in regular viewer (as .ucpc format)
2+
3+
usingSystem.Diagnostics;
4+
usingSystem.IO;
5+
usingunitycodercom_PointCloudBinaryViewer;
6+
usingUnityEngine;
7+
usingDebug=UnityEngine.Debug;
8+
9+
namespaceunitycoder_examples
10+
{
11+
publicclassRuntimeLASConvert:MonoBehaviour
12+
{
13+
publicPointCloudViewerDX11binaryViewerDX11;
14+
15+
publicstringlasFile="runtime.las";
16+
17+
// inside streaming assets
18+
stringcommandlinePath="PointCloudConverter173b/PointCloudConverter.exe";
19+
20+
boolisConverting=false;
21+
22+
voidStart()
23+
{
24+
isConverting=true;
25+
26+
varsourceFile=lasFile;
27+
28+
// check if full path or relative to streaming assets
29+
if(Path.IsPathRooted(sourceFile)==false)
30+
{
31+
sourceFile=Path.Combine(Application.streamingAssetsPath,sourceFile);
32+
}
33+
34+
if(File.Exists(sourceFile))
35+
{
36+
Debug.Log("Converting file: "+sourceFile);
37+
}
38+
else
39+
{
40+
Debug.LogError("Input file missing: "+sourceFile);
41+
return;
42+
}
43+
44+
varoutputPath=Path.GetDirectoryName(sourceFile);
45+
outputPath=Path.Combine(outputPath,"runtime.ucpc");
46+
47+
48+
// start commandline tool with params https://github.com/unitycoder/UnityPointCloudViewer/wiki/Commandline-Tools
49+
varexePath=Path.Combine(Application.streamingAssetsPath,commandlinePath);
50+
ProcessStartInfostartInfo=newProcessStartInfo(exePath);
51+
startInfo.Arguments="-input="+sourceFile+" -flip=true -output="+outputPath;
52+
startInfo.UseShellExecute=true;
53+
startInfo.WindowStyle=ProcessWindowStyle.Hidden;
54+
//startInfo.WindowStyle = ProcessWindowStyle.Minimized;
55+
varprocess=Process.Start(startInfo);
56+
process.WaitForExit();
57+
58+
//Debug.Log(startInfo.Arguments);
59+
60+
isConverting=false;
61+
62+
// check if output exists
63+
if(File.Exists(outputPath))
64+
{
65+
Debug.Log("Reading output file: "+outputPath);
66+
binaryViewerDX11.CallReadPointCloudThreaded(outputPath);
67+
}
68+
else
69+
{
70+
Debug.LogError("File not found: "+outputPath);
71+
}
72+
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp