potree-core 2.0.3 → 2.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018 Tentone
3
+ Copyright (c) Tentone
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -62,4 +62,22 @@ http://plas.io/
62
62
 
63
63
  The MIT License (MIT)
64
64
 
65
- Copyright (c) 2014 Uday Verma, uday.karan@gmail.com
65
+ Copyright (c) 2014 Uday Verma, uday.karan@gmail.com
66
+
67
+ Permission is hereby granted, free of charge, to any person obtaining a copy
68
+ of this software and associated documentation files (the "Software"), to deal
69
+ in the Software without restriction, including without limitation the rights
70
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
71
+ copies of the Software, and to permit persons to whom the Software is
72
+ furnished to do so, subject to the following conditions:
73
+
74
+ The above copyright notice and this permission notice shall be included in
75
+ all copies or substantial portions of the Software.
76
+
77
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
78
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
79
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
80
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
81
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
82
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
83
+ THE SOFTWARE.
package/README.md CHANGED
@@ -1,173 +1,72 @@
1
- # Potree Core
1
+ # Potree Core 2.0
2
2
 
3
3
  [![npm version](https://badge.fury.io/js/potree-core.svg)](https://badge.fury.io/js/potree-core)
4
4
  [![GitHub version](https://badge.fury.io/gh/tentone%2Fpotree-core.svg)](https://badge.fury.io/gh/tentone%2Fpotree-core)
5
5
 
6
- - This project was originally based on Potree 1.6 and is now since version 2.0 based on [fork]https://github.com/shiukaheng/potree-loader] of the [Potree-Loader](https://github.com/pnext/three-loader).
6
+ - This project was originally based on [Potree Viewer 1.6](https://github.com/potree/potree) and is now since version 2.0 based on the [shiukaheng fork](https://github.com/shiukaheng/potree-loader) of the [Potree-Loader](https://github.com/pnext/three-loader).
7
7
  - Potree is a web based pouint cloud visualizer project created by Markus Schütz.
8
- - This project contains only the main parts of the potree project adapted to be more easily used as a independent library (I have only adapted code from the original repository).
9
- - Support for pointclouds from LAS, LAZ, Binary files and Greyhound server.
10
- - Point clouds are automatically updated, frustum culling is used to avoid unnecessary updates (better update performance for multiple point clouds).
11
- - Supports logarithmic depth buffer (just by enabling it on the threejs renderer), useful for large scale visualization.
12
-
13
-
14
-
15
- ### How to use
16
- - Download the custom potree build from the build folder or add it to your project using NPM.
17
- - https://www.npmjs.com/package/potree-core
18
- - Include it alonside the worker folder in your project (can be found on the source folder).
19
- - Download threejs from github repository.
20
- - https://github.com/mrdoob/three.js/tree/dev/build
21
- - The build is a ES module, that can be imported to other projects, it assumes the existence of THREE namespace for threejs dependencies.
22
-
23
-
8
+ - This project contains only the main parts of the potree project adapted to be more easily used as a independent library, the code was adapted from the original repositorys.
9
+ - Support for pointclouds from LAS, LAZ, Binary files.
10
+ - Some features require support for the following GL extensions
11
+ - EXT_frag_depth, WEBGL_depth_texture, OES_vertex_array_object
24
12
 
25
- ### Demo
13
+ ## Demo
26
14
  - Live demo at https://tentone.github.io/potree-core/
27
- - Contains the same model multiple times stored in different formats.
28
15
  - Double click the models to raycast the scene and create marker points.
29
16
 
30
17
  <img src="https://raw.githubusercontent.com/tentone/potree-core/master/screenshot.png" width="700">
31
18
 
32
19
 
33
- ### Example
34
- - Bellow its a fully functional example of how to use this wrapper to load potree point clouds to a THREE.js project
20
+ ## Example
21
+ - The project can be build running the commands `npm install` and `npm run build`.
22
+ - Download the potree build from the build folder or add it to your project using NPM.
23
+ - Include it alonside the worker folder in your project (can be found on the source folder).
24
+ - The build is a ES module, that can be imported to other projects, threejs should be available as a peer dependency.
25
+ - Bellow its a fully functional example of how to use this wrapper to load potree point clouds to a three.js project
35
26
 
36
27
  ```javascript
37
- var scene = new THREE.Scene();
38
- var camera = new THREE.PerspectiveCamera(60, 1, 0.1, 10000);
39
-
40
- var canvas = document.createElement("canvas");
41
- canvas.style.position = "absolute";
42
- canvas.style.top = "0px";
43
- canvas.style.left = "0px";
44
- canvas.style.width = "100%";
45
- canvas.style.height = "100%";
46
- document.body.appendChild(canvas);
47
-
48
- var renderer = new THREE.WebGLRenderer({canvas:canvas});
49
-
50
- var geometry = new THREE.BoxGeometry(1, 1, 1);
51
- var material = new THREE.MeshBasicMaterial({color: 0x00ff00});
52
- var cube = new THREE.Mesh(geometry, material);
28
+ const scene = new Scene();
29
+ const camera = new PerspectiveCamera(60, 1, 0.1, 10000);
30
+
31
+ const canvas = document.getElementById("canvas");
32
+
33
+ const renderer = new WebGLRenderer({canvas:canvas});
34
+
35
+ const geometry = new BoxGeometry(1, 1, 1);
36
+ const material = new MeshBasicMaterial({color: 0x00ff00});
37
+ const cube = new Mesh(geometry, material);
53
38
  scene.add(cube);
54
39
 
55
- var controls = new THREE.OrbitControls(camera, canvas);
40
+ const controls = new OrbitControls(camera, canvas);
56
41
  camera.position.z = 10;
57
42
 
58
- var points = new Potree.Group();
59
- points.setPointBudget(10000000)
60
- scene.add(points);
43
+ const pointClouds = [];
61
44
 
62
- Potree.loadPointCloud("data/test/cloud.js", name, function(data)
63
- {
64
- var pointcloud = data.pointcloud;
65
- points.add(pointcloud);
45
+ const baseUrl = "data/test/";
46
+ const potree = new Potree();
47
+ potree.loadPointCloud("cloud.js", url => `${baseUrl}${url}`,).then(function(pco) {
48
+ scene.add(pco);
49
+ pointClouds.push(pco);
66
50
  });
67
51
 
68
52
  function loop()
69
53
  {
54
+ potree.updatePointClouds(pointClouds, camera, renderer);
55
+
70
56
  controls.update();
71
57
  renderer.render(scene, camera);
58
+
72
59
  requestAnimationFrame(loop);
73
60
  };
74
61
  loop();
75
-
76
- document.body.onresize = function()
77
- {
78
- var width = window.innerWidth;
79
- var height = window.innerHeight;
80
- renderer.setSize(width, height);
81
- camera.aspect = width / height;
82
- camera.updateProjectionMatrix();
83
- }
84
- document.body.onresize();
85
62
  ```
86
63
 
87
-
88
-
89
- ### API Reference
90
-
91
- - The project has no generated documentation but bellow are some of the main configuration elements.
92
- - A example can be found in the repository `index.html` file.
93
-
94
-
95
-
96
- ##### Potree.BasicGroup
97
-
98
- - Container that stores point cloud objects and updates them on render.
99
- - The container supports frustum culling using the point cloud bouding box.
100
- - Automatically stops updating the point cloud if out of view.
101
- - This container only support pointColorType set as RGB, pointSizeType set as FIXED and shape set as SQUARE.
102
-
103
-
104
-
105
- ##### Potree.Group
106
-
107
- - Complete container with support for all potree features.
108
- - Some features require support for the following GL extensions
109
-
110
- - EXT_frag_depth, WEBGL_depth_texture, OES_vertex_array_object
111
-
112
-
113
-
114
- ##### Potree.loadPointCloud
115
-
116
- - Method to load a point cloud database file
117
- - `Potree.loadPointCloud(url, name, onLoad)`
118
-
119
-
120
-
121
- ##### Potree.PointCloudMaterial
122
-
123
- - Material used by threejs to draw the point clouds, based on RawShaderMaterial
124
- - shape
125
- - Defines the shape used to draw points
126
- - Potree.PointShape.SQUARE
127
- - Potree.PointShape.CIRCLE
128
- - Potree.PointShape.PARABOLOID
129
- - pointSizeType
130
- - Defines how the point cloud points are sized, fixed mode keeps the same size, adaptive resizes points accordingly to their distance to the camera
131
- - Possible values are
132
- - Potree.PointSizeType.FIXED
133
- - Potree.PointSizeType.ATTENUATED
134
- - Potree.PointSizeType.ADAPTIVE
135
- - pointColorType
136
- - Defines how to color the drawn points
137
- - Possible values are
138
- - Potree.PointColorType.RGB
139
- - Potree.PointColorType.COLOR
140
- - Potree.PointColorType.DEPTH
141
- - Potree.PointColorType.HEIGHT
142
- - Potree.PointColorType.INTENSITY
143
- - Potree.PointColorType.INTENSITY_GRADIENT
144
- - Potree.PointColorType.LOD
145
- - Potree.PointColorType.POINT_INDEX
146
- - Potree.PointColorType.CLASSIFICATION
147
- - Potree.PointColorType.RETURN_NUMBER
148
- - Potree.PointColorType.SOURCE
149
- - Potree.PointColorType.NORMAL
150
- - Potree.PointColorType.PHONG
151
- - Potree.PointColorType.RGB_HEIGHT
152
- - logarithmicDepthBuffer
153
- - Set true to enable logarithmic depth buffer
154
- - weighted
155
- - If true points are drawn as weighted splats
156
- - treeType
157
- - Defines the type of point cloud tree being drawn by this material
158
- - This should be automatically defined by the loader
159
- - Potree.TreeType.OCTREE
160
- - Potree.TreeType.KDTREE
161
-
162
- - Potree.PointCloudTree
163
- - Base Object3D used to store and represent point cloud data.
164
- - These objects are created by the loader
165
-
166
- ### Notes
64
+ ## Notes
167
65
  - Since potree-core is meant to be used as library and not as a full software as potree some features are not available.
168
- - EDL shading is not supported by potree core (might be added later).
66
+ - EDL shading is not supported by potree core.
169
67
  - Removed classification and clipping functionality.
170
68
  - Removed Arena 4D point cloud support.
69
+ - Removed Entwine Point Tile file support.
171
70
  - GUI elements were removed from the library
172
71
  - PotreeViewer
173
72
  - Controls, Input, GUI, Tools
@@ -179,10 +78,7 @@ document.body.onresize();
179
78
  - JQuery, TWEEN and Proj4 dependencies
180
79
 
181
80
 
182
- ### Building
183
- - The project can be build running the commands `npm install` and `npm run build`.
184
-
185
- ### Potree Converter
81
+ ## Potree Converter
186
82
  - Use the (Potree Converter)[https://github.com/potree/PotreeConverter/releases] tool to create point cloud data from LAS, ZLAS or BIN point cloud files
187
83
  - Potree Converter 1.8 creates a multi file structure with each node as an individual file.
188
84
  - Potree Converter 2.1 creates a single file for all points and separates files for hierarchy index, its faster to create files. Requires a HTTP server configured for file streaming.
@@ -190,9 +86,13 @@ document.body.onresize();
190
86
  - There are two main versions 2.1 witch generates 4 contained files with point data, hierarchy,
191
87
  - To generate a folder output from a input file run the command `.\PotreeConverter '..\input.laz' -o ../output`
192
88
 
89
+
193
90
  ### TXT2LAS
194
91
  - The potree converter tool only supports las and laz files, so textural file formats such as .pts, .xyz, have to be first converted into a supported format.
195
92
  - The TXT2LAS tool from the (LASTools)[https://github.com/LAStools/LAStools] repository can be used for this effect.
196
93
  - To run the tool use the command `.\txt2las64 -i input.pts -ipts -parse xyziRGB -set_scale 0.001 0.001 0.001 -set_version 1.4 -o output.laz`
197
94
 
198
95
 
96
+ ### To Do
97
+ - Supports logarithmic depth buffer (just by enabling it on the threejs renderer), useful for large scale visualization.
98
+ - Point clouds are automatically updated, frustum culling is used to avoid unnecessary updates (better update performance for multiple point clouds).