FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
UnityPointCloudViewer/Extras/Scripts/RuntimeLASConvert.cs at master · unitycoder/UnityPointCloudViewer · GitHub
unitycoder
UnityPointCloudViewer
Repository navigation
Code
Issues
34
(34)
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
UnityPointCloudViewer
/
Extras
/
Scripts
/
RuntimeLASConvert.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
75 lines (59 loc) · 2.39 KB
Breadcrumbs
UnityPointCloudViewer
/
Extras
/
Scripts
/
RuntimeLASConvert.cs
Copy path
File metadata and controls
75 lines (59 loc) · 2.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// example script to convert LAS/LAZ file at runtime and then read it in regular viewer (as .ucpc format)
using
System
.
Diagnostics
;
using
System
.
IO
;
using
unitycodercom_PointCloudBinaryViewer
;
using
UnityEngine
;
using
Debug
=
UnityEngine
.
Debug
;
namespace
unitycoder_examples
{
public
class
RuntimeLASConvert
:
MonoBehaviour
{
public
PointCloudViewerDX11
binaryViewerDX11
;
public
string
lasFile
=
"runtime.las"
;
// inside streaming assets
string
commandlinePath
=
"PointCloudConverter173b/PointCloudConverter.exe"
;
bool
isConverting
=
false
;
void
Start
(
)
{
isConverting
=
true
;
var
sourceFile
=
lasFile
;
// check if full path or relative to streaming assets
if
(
Path
.
IsPathRooted
(
sourceFile
)
==
false
)
{
sourceFile
=
Path
.
Combine
(
Application
.
streamingAssetsPath
,
sourceFile
)
;
}
if
(
File
.
Exists
(
sourceFile
)
)
{
Debug
.
Log
(
"Converting file: "
+
sourceFile
)
;
}
else
{
Debug
.
LogError
(
"Input file missing: "
+
sourceFile
)
;
return
;
}
var
outputPath
=
Path
.
GetDirectoryName
(
sourceFile
)
;
outputPath
=
Path
.
Combine
(
outputPath
,
"runtime.ucpc"
)
;
// start commandline tool with params https://github.com/unitycoder/UnityPointCloudViewer/wiki/Commandline-Tools
var
exePath
=
Path
.
Combine
(
Application
.
streamingAssetsPath
,
commandlinePath
)
;
ProcessStartInfo
startInfo
=
new
ProcessStartInfo
(
exePath
)
;
startInfo
.
Arguments
=
"-input="
+
sourceFile
+
" -flip=true -output="
+
outputPath
;
startInfo
.
UseShellExecute
=
true
;
startInfo
.
WindowStyle
=
ProcessWindowStyle
.
Hidden
;
//startInfo.WindowStyle = ProcessWindowStyle.Minimized;
var
process
=
Process
.
Start
(
startInfo
)
;
process
.
WaitForExit
(
)
;
//Debug.Log(startInfo.Arguments);
isConverting
=
false
;
// check if output exists
if
(
File
.
Exists
(
outputPath
)
)
{
Debug
.
Log
(
"Reading output file: "
+
outputPath
)
;
binaryViewerDX11
.
CallReadPointCloudThreaded
(
outputPath
)
;
}
else
{
Debug
.
LogError
(
"File not found: "
+
outputPath
)
;
}
}
}
}
Back
|
FazBrowse Home
|
New Git URL