commit
fb40be7f88
41
README.md
41
README.md
@ -1,41 +1,42 @@
|
||||
# Potree - WebGL Pointcloud Viewer
|
||||
|
||||
## About
|
||||
|
||||
Potree is a WebGL based point cloud viewer for large datasets.
|
||||
Thanks to WebGL, it runs in all major browsers without plugins.
|
||||
|
||||
Homepage: <a href="http://potree.org/">potree.org</a>
|
||||
<img src="http://potree.org/resources/images/pompei.jpg">
|
||||
|
||||
## Demos
|
||||
* <a href="http://potree.org/demo/pompei/pompei.html" target="_blank">pompei</a>
|
||||
* <a href="http://potree.org/demo/potree_2014.01.22/skatepark.html" target="_blank">skatepark</a>
|
||||
|
||||
This video shows a point cloud of the St. Stephens Cathedral. It consists of ~700m points.
|
||||
This video shows a point cloud of the St. Stephens Cathedral. It consists of ~700m points.
|
||||
<a href="http://www.youtube.com/watch?v=p9e6xElafJU" target="_blank"><img src="http://img.youtube.com/vi/p9e6xElafJU/0.jpg"></a>
|
||||
|
||||
Take a look at the [online showcase](http://potree.org/wp/demo/)
|
||||
|
||||
## Getting Started
|
||||
1. Deploy potree on a webserver.
|
||||
1. Deploy potree on a webserver.
|
||||
2. Open one of the demos in the examples directory. <br>
|
||||
Potree pages must run on a webserver so the url
|
||||
Potree pages must run on a webserver so the url
|
||||
should be something like "localhost/potree/examples/lion.html". URLs starting with "file:///" will not work.
|
||||
|
||||
This is what the lion demo looks like:
|
||||
|
||||

|
||||
|
||||
For more details, read the [Getting Started Section](./docs/getting_started.md)
|
||||
|
||||
## Convert Your Own Pointclouds
|
||||
Use the PotreeConverter to convert your own point clouds into the potree format.
|
||||
|
||||
PotreeConverter source code and binaries for windows are available here:
|
||||
https://github.com/potree/PotreeConverter
|
||||
Use the [PotreeConverter](https://github.com/potree/PotreeConverter) to convert your own point clouds into the potree format.
|
||||
|
||||
## Compatibility
|
||||
|
||||
| Browser | OS | Result |
|
||||
| -------------------- |:----:|:-------------:|
|
||||
| Chrome 32 | Win7 | works |
|
||||
| Firefox 26 | Win7 | works |
|
||||
| Safari | Mac | works |
|
||||
| Opera 19 | Win7 | works |
|
||||
| Internet Explorer 11 | Win7 | does not work |
|
||||
| Browser | OS | Result |
|
||||
| -------------------- |:-------:|:-------------:|
|
||||
| Chrome 32 | Win7 | works |
|
||||
| Firefox 26 | Win7 | works |
|
||||
| Opera 19 | Win7 | works |
|
||||
| Internet Explorer 11 | Win7 | technically works, if you don't expect performance |
|
||||
| Safari | Mac | works |
|
||||
| Firefox | Android | partially works, GUI and stability issues |
|
||||
| Opera | Android | partially works, GUI and stabilty issues and slow |
|
||||
|
||||
|
||||
## License
|
||||
|
||||
1278
build/js/potree.js
Normal file
1278
build/js/potree.js
Normal file
File diff suppressed because it is too large
Load Diff
1
build/js/potree.min.js
vendored
Normal file
1
build/js/potree.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
16
docs/build.md
Normal file
16
docs/build.md
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# How to build the library
|
||||
|
||||
## Installation
|
||||
|
||||
Make sure you have [node.js](http://nodejs.org/) installed
|
||||
|
||||
Setting up gulp:
|
||||
|
||||
cd potree_directory
|
||||
npm install -g gulp
|
||||
npm install --save-dev
|
||||
|
||||
## Usage
|
||||
|
||||
gulp scripts // creates single script files in build/js
|
||||
@ -7,6 +7,15 @@
|
||||
|
||||
<style type="text/css">
|
||||
|
||||
.info{
|
||||
color:white;
|
||||
font-weight: bold;
|
||||
text-shadow: 1px 1px 1px black,
|
||||
1px -1px 1px black,
|
||||
-1px 1px 1px black,
|
||||
-1px -1px 1px black;
|
||||
}
|
||||
|
||||
#lblDistance{
|
||||
color:white;
|
||||
font-weight: bold;
|
||||
@ -14,8 +23,6 @@
|
||||
2px -2px 2px black,
|
||||
-2px 2px 2px black,
|
||||
-2px -2px 2px black;
|
||||
|
||||
|
||||
}
|
||||
</style>
|
||||
|
||||
@ -23,13 +30,7 @@
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../src/Potree.js"></script>
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/PointAttributes.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
<script src="../build/js/potree.min.js"></script>
|
||||
|
||||
<input type="button" value="place start"
|
||||
style="position:absolute; left: 10px; top: 10px; width: 100px; z-index: 100"
|
||||
@ -38,7 +39,7 @@
|
||||
style="position:absolute; left: 10px; top: 40px; width: 100px; z-index: 100"
|
||||
onclick="placeEnd()">
|
||||
|
||||
<div id="lblDistance" style="position: absolute; width: 20px; z-index: 100;">abc</div>
|
||||
<div id="lblDistance" class="info" style="position: absolute; width: 20px; z-index: 100;">abc</div>
|
||||
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px;"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px;"></div>
|
||||
@ -58,39 +59,7 @@
|
||||
var spStart, spEnd, sConnection;
|
||||
var placeStartMode = false;
|
||||
var placeEndMode = false;
|
||||
var cube, cameraCube, sceneCube;
|
||||
|
||||
function loadSkybox(){
|
||||
cameraCube = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 100000 );
|
||||
sceneCube = new THREE.Scene();
|
||||
|
||||
var path = "../resources/textures/skybox/";
|
||||
var format = ".jpg";
|
||||
var urls = [
|
||||
path + 'px' + format, path + 'nx' + format,
|
||||
path + 'py' + format, path + 'ny' + format,
|
||||
path + 'pz' + format, path + 'nz' + format
|
||||
];
|
||||
|
||||
var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
|
||||
|
||||
var shader = THREE.ShaderLib[ "cube" ];
|
||||
shader.uniforms[ "tCube" ].value = textureCube;
|
||||
|
||||
var material = new THREE.ShaderMaterial( {
|
||||
|
||||
fragmentShader: shader.fragmentShader,
|
||||
vertexShader: shader.vertexShader,
|
||||
uniforms: shader.uniforms,
|
||||
depthWrite: false,
|
||||
side: THREE.BackSide
|
||||
|
||||
} ),
|
||||
|
||||
mesh = new THREE.Mesh( new THREE.BoxGeometry( 100, 100, 100 ), material );
|
||||
sceneCube.add( mesh );
|
||||
}
|
||||
var skybox;
|
||||
|
||||
function initGUI(){
|
||||
var gui = new dat.GUI({
|
||||
@ -125,7 +94,7 @@
|
||||
renderer.autoClear = false;
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
loadSkybox();
|
||||
skybox = Potree.utils.loadSkybox("../resources/textures/skybox/");
|
||||
|
||||
// pointcloud
|
||||
pointcloudMaterial = new THREE.PointCloudMaterial( { size: defaultPointSize, vertexColors: true } );
|
||||
@ -133,22 +102,19 @@
|
||||
pointcloud = new Potree.PointCloudOctree(pco, pointcloudMaterial);
|
||||
pointcloud.LOD = defaultLOD;
|
||||
pointcloud.rotation.set(Math.PI/2, 0.85* -Math.PI/2, -0.0);
|
||||
//pointcloud.scale.set(0.5,0.5,0.5);
|
||||
pointcloud.moveToOrigin();
|
||||
pointcloud.moveToGroundPlane();
|
||||
pointcloud.position.y -= 1.6
|
||||
scene.add(pointcloud);
|
||||
|
||||
// grid
|
||||
scene.add(createGrid(8,8,1));
|
||||
scene.add(Potree.utils.createGrid(8,8,1));
|
||||
|
||||
// measurement
|
||||
var sphereGeometry = new THREE.SphereGeometry(0.05, 32, 32);
|
||||
var sphereMaterial = new THREE.MeshBasicMaterial({color: 0xbb0000, shading: THREE.FlatShading});
|
||||
spStart = new THREE.Mesh(sphereGeometry, sphereMaterial);
|
||||
spEnd = new THREE.Mesh(sphereGeometry, sphereMaterial);
|
||||
//spStart.position.set(-1.1,1.05,2);
|
||||
//spEnd.position.set(1.3,1.0,1.15);
|
||||
spStart.position.set(-2.2,1.9, 1.66);
|
||||
spEnd.position.set(0.02,2,2.64);
|
||||
scene.add(spStart);
|
||||
@ -172,27 +138,6 @@
|
||||
renderer.domElement.addEventListener( 'click', onClick, false );
|
||||
}
|
||||
|
||||
function createGrid(width, length, spacing){
|
||||
var material = new THREE.LineBasicMaterial({
|
||||
color: 0xBBBBBB
|
||||
});
|
||||
|
||||
var geometry = new THREE.Geometry();
|
||||
for(var i = 0; i <= length; i++){
|
||||
geometry.vertices.push(new THREE.Vector3(-(spacing*width)/2, 0, i*spacing-(spacing*length)/2));
|
||||
geometry.vertices.push(new THREE.Vector3(+(spacing*width)/2, 0, i*spacing-(spacing*length)/2));
|
||||
}
|
||||
|
||||
for(var i = 0; i <= width; i++){
|
||||
geometry.vertices.push(new THREE.Vector3(i*spacing-(spacing*width)/2, 0, -(spacing*length)/2));
|
||||
geometry.vertices.push(new THREE.Vector3(i*spacing-(spacing*width)/2, 0, +(spacing*length)/2));
|
||||
}
|
||||
|
||||
var line = new THREE.Line(geometry, material, THREE.LinePieces);
|
||||
line.receiveShadow = true;
|
||||
return line;
|
||||
}
|
||||
|
||||
function onDocumentMouseMove( event ) {
|
||||
event.preventDefault();
|
||||
|
||||
@ -252,8 +197,8 @@
|
||||
document.getElementById("lblNumVisiblePoints").innerHTML = "visible points: " + Potree.utils.addCommas(numVisiblePoints);
|
||||
|
||||
// render skybox
|
||||
cameraCube.rotation.copy( camera.rotation );
|
||||
renderer.render( sceneCube, cameraCube );
|
||||
skybox.camera.rotation.copy(camera.rotation);
|
||||
renderer.render(skybox.scene, skybox.camera);
|
||||
|
||||
renderer.render(scene, camera);
|
||||
};
|
||||
|
||||
@ -29,15 +29,7 @@
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../src/Potree.js"></script>
|
||||
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/PointAttributes.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../src/LRU.js"></script>
|
||||
|
||||
|
||||
<script src="../build/js/potree.min.js"></script>
|
||||
|
||||
<div id="lblNumVisibleNodes" class="info" style="position: absolute; left: 10px; top: 80px; width: 400px; color:white"></div>
|
||||
<div id="lblNumVisiblePoints" class="info" style="position: absolute; left: 10px; top: 100px; width: 400px; color:white"></div>
|
||||
@ -53,46 +45,15 @@
|
||||
|
||||
var renderer;
|
||||
var camera;
|
||||
var cube;
|
||||
var scene;
|
||||
var pointclouds = [];
|
||||
var cameraCube, sceneCube;
|
||||
var stats;
|
||||
var pointcloudMaterial;
|
||||
|
||||
function loadSkybox(){
|
||||
cameraCube = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 100000 );
|
||||
sceneCube = new THREE.Scene();
|
||||
|
||||
var path = "../resources/textures/skybox/";
|
||||
var format = ".jpg";
|
||||
var urls = [
|
||||
path + 'px' + format, path + 'nx' + format,
|
||||
path + 'py' + format, path + 'ny' + format,
|
||||
path + 'pz' + format, path + 'nz' + format
|
||||
];
|
||||
|
||||
var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
|
||||
|
||||
var shader = THREE.ShaderLib[ "cube" ];
|
||||
shader.uniforms[ "tCube" ].value = textureCube;
|
||||
|
||||
var material = new THREE.ShaderMaterial( {
|
||||
|
||||
fragmentShader: shader.fragmentShader,
|
||||
vertexShader: shader.vertexShader,
|
||||
uniforms: shader.uniforms,
|
||||
depthWrite: false,
|
||||
side: THREE.BackSide
|
||||
|
||||
} ),
|
||||
|
||||
mesh = new THREE.Mesh( new THREE.BoxGeometry( 100, 100, 100 ), material );
|
||||
sceneCube.add( mesh );
|
||||
}
|
||||
var skybox;
|
||||
var stats;
|
||||
|
||||
function initGUI(){
|
||||
|
||||
// dat.gui
|
||||
var gui = new dat.GUI({
|
||||
height : 5 * 32 - 1
|
||||
});
|
||||
@ -104,7 +65,6 @@
|
||||
|
||||
var pLOD = gui.add(params, 'LOD', 0.5,20);
|
||||
pLOD.onChange(function(value){
|
||||
//pointCloud.LOD = value;
|
||||
for(var i = 0; i < pointclouds.length; i++){
|
||||
pointclouds[i].LOD = value;
|
||||
}
|
||||
@ -114,15 +74,16 @@
|
||||
pPointSize.onChange(function(value){
|
||||
pointcloudMaterial.size = value;
|
||||
});
|
||||
}
|
||||
|
||||
function initThree(){
|
||||
|
||||
// stats
|
||||
stats = new Stats();
|
||||
stats.domElement.style.position = 'absolute';
|
||||
stats.domElement.style.top = '0px';
|
||||
stats.domElement.style.margin = '5px';
|
||||
document.body.appendChild( stats.domElement );
|
||||
}
|
||||
|
||||
function initThree(){
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 100000);
|
||||
|
||||
@ -131,26 +92,17 @@
|
||||
renderer.autoClear = false;
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
loadSkybox();
|
||||
skybox = Potree.utils.loadSkybox("../resources/textures/skybox/");
|
||||
|
||||
// camera and controls
|
||||
camera.position.z = 25;
|
||||
camera.position.y = 10;
|
||||
camera.position.x = 15;
|
||||
camera.position.set(25, 10, 15);
|
||||
controls = new THREE.OrbitControls(camera, renderer.domElement);
|
||||
controls.target.set( 0, 3, 0 );
|
||||
camera.lookAt(controls.target);
|
||||
|
||||
// load pointcloud
|
||||
pointcloudMaterial = new THREE.PointCloudMaterial( { size: defaultPointSize, vertexColors: true } );
|
||||
|
||||
//// load pointcloud
|
||||
var pco = POCLoader.load(pointcloudPath);
|
||||
//pointCloud = new Potree.PointCloudOctree(pco, pointcloudMaterial);
|
||||
//pointCloud.LOD = defaultLOD;
|
||||
//pointCloud.rotation.set(Math.PI,-1.2,0);
|
||||
//pointCloud.moveToOrigin();
|
||||
//pointCloud.moveToGroundPlane();
|
||||
//scene.add(pointCloud);
|
||||
|
||||
for(var i = -2; i <= 2; i++){
|
||||
for(var j = -2; j <= 2; j++){
|
||||
@ -173,6 +125,7 @@
|
||||
|
||||
requestAnimationFrame(render);
|
||||
|
||||
// update numbers
|
||||
var numVisibleNodes = 0;
|
||||
var numVisiblePoints = 0;
|
||||
for(var i = 0; i < pointclouds.length; i++){
|
||||
@ -181,19 +134,18 @@
|
||||
numVisibleNodes += pointcloud.numVisibleNodes;
|
||||
numVisiblePoints += pointcloud.numVisiblePoints;
|
||||
}
|
||||
|
||||
// render skybox
|
||||
cameraCube.rotation.copy( camera.rotation );
|
||||
renderer.render( sceneCube, cameraCube );
|
||||
|
||||
renderer.render(scene, camera);
|
||||
|
||||
document.getElementById("lblNumVisibleNodes").innerHTML = "visible nodes: " + numVisibleNodes;
|
||||
document.getElementById("lblNumVisiblePoints").innerHTML = "visible points: " + Potree.utils.addCommas(numVisiblePoints);
|
||||
|
||||
stats.update();
|
||||
|
||||
controls.update(0.1);
|
||||
|
||||
// render skybox
|
||||
skybox.camera.rotation.copy(camera.rotation);
|
||||
renderer.render(skybox.scene, skybox.camera);
|
||||
|
||||
// render scene
|
||||
renderer.render(scene, camera);
|
||||
};
|
||||
|
||||
initThree();
|
||||
@ -202,8 +154,5 @@
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -3,11 +3,7 @@
|
||||
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../src/Potree.js"></script>
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/PointAttributes.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
<script src="../build/js/potree.min.js"></script>
|
||||
|
||||
</head>
|
||||
<body style="margin: 0px; padding: 0px;">
|
||||
@ -62,8 +58,6 @@ function generatePointcloud(){
|
||||
return pointcloud;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function init() {
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
|
||||
|
||||
@ -1,95 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/OrbitControls.js"></script>
|
||||
<script src="../src/Potree.js"></script>
|
||||
<script src="../src/PointCloudOctree.js"></script>
|
||||
<script src="../src/loader/POCLoader.js"></script>
|
||||
<script src="../src/loader/PointAttributes.js"></script>
|
||||
<script src="../src/utils.js"></script>
|
||||
|
||||
</head>
|
||||
<body style="margin: 0px; padding: 0px;">
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var renderer;
|
||||
var camera;
|
||||
var scene;
|
||||
|
||||
function generatePointcloud(){
|
||||
var geometry = new THREE.BufferGeometry();
|
||||
var width = 200;
|
||||
var length = 200;
|
||||
var numPoints = width*length;
|
||||
|
||||
var positions = new Float32Array(numPoints*3);
|
||||
var colors = new Float32Array(numPoints*3);
|
||||
|
||||
var color = new THREE.Color();
|
||||
var k = 0;
|
||||
for(var i = 0; i < width; i++){
|
||||
for(var j = 0; j < length; j++){
|
||||
var u = i/width;
|
||||
var v = j/length;
|
||||
var x = 10*u - 5;
|
||||
var y = (Math.cos(u*Math.PI*8) + Math.sin(v*Math.PI*8))/2;
|
||||
var z = 10*v - 5;
|
||||
|
||||
positions[3*k] = x;
|
||||
positions[3*k+1] = y;
|
||||
positions[3*k+2] = z;
|
||||
|
||||
var intensity = y+1;
|
||||
color.setRGB(u*intensity, v*intensity, 0);
|
||||
colors[3*k] = color.r;
|
||||
colors[3*k+1] = color.g;
|
||||
colors[3*k+2] = color.b;
|
||||
k++;
|
||||
}
|
||||
}
|
||||
|
||||
geometry.addAttribute('position', new THREE.Float32Attribute(positions, 3));
|
||||
geometry.addAttribute('color', new THREE.Float32Attribute(colors, 3));
|
||||
|
||||
var material = new THREE.PointCloudMaterial({ size: 0.01, vertexColors: true });
|
||||
var pointcloud = new THREE.PointCloud(geometry, material);
|
||||
|
||||
return pointcloud;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function init() {
|
||||
scene = new THREE.Scene();
|
||||
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 1000);
|
||||
|
||||
renderer = new THREE.WebGLRenderer();
|
||||
renderer.setSize(window.innerWidth, window.innerHeight);
|
||||
document.body.appendChild(renderer.domElement);
|
||||
|
||||
pointcloud = generatePointcloud();
|
||||
scene.add(pointcloud);
|
||||
|
||||
// controls
|
||||
camera.position.set(5,5,2);
|
||||
controls = new THREE.OrbitControls(camera);
|
||||
controls.target.set( 0, 0, 0 );
|
||||
camera.lookAt(new THREE.Vector3(0,0,0));
|
||||
}
|
||||
|
||||
function render() {
|
||||
requestAnimationFrame(render);
|
||||
|
||||
renderer.render(scene, camera);
|
||||
};
|
||||
|
||||
init();
|
||||
render();
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
40
gulpfile.js
Normal file
40
gulpfile.js
Normal file
@ -0,0 +1,40 @@
|
||||
|
||||
var path = require('path');
|
||||
var gulp = require('gulp');
|
||||
|
||||
var concat = require('gulp-concat');
|
||||
var size = require('gulp-size');
|
||||
var rename = require('gulp-rename');
|
||||
var uglify = require('gulp-uglify');
|
||||
|
||||
var paths = {
|
||||
potree : [
|
||||
"src/Potree.js",
|
||||
"src/extensions/PerspectiveCamera.js",
|
||||
"src/extensions/Ray.js",
|
||||
"src/loader/POCLoader.js",
|
||||
"src/loader/PointAttributes.js",
|
||||
"src/FirstPersonControls.js",
|
||||
"src/LRU.js",
|
||||
"src/PointCloudOctree.js",
|
||||
"src/PointCloudOctreeGeometry.js",
|
||||
"src/utils.js"
|
||||
]
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
gulp.task("scripts", function(){
|
||||
gulp.src(paths.potree)
|
||||
.pipe(concat('potree.js'))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/js'))
|
||||
.pipe(rename({suffix: '.min'}))
|
||||
.pipe(uglify({preserveComments: 'some'}))
|
||||
.pipe(size({showFiles: true}))
|
||||
.pipe(gulp.dest('build/js'));
|
||||
|
||||
return;
|
||||
});
|
||||
21
package.json
Normal file
21
package.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "potree",
|
||||
"private": true,
|
||||
"version": "0.0.1",
|
||||
"description": "WebGL point cloud viewer",
|
||||
"dependencies": {
|
||||
"gulp": "*",
|
||||
"gulp-size": "*",
|
||||
"gulp-concat": "*",
|
||||
"gulp-uglify": "*",
|
||||
"gulp-rename": "*"
|
||||
},
|
||||
"author": {},
|
||||
"license": "",
|
||||
"devDependencies": {
|
||||
"gulp": "~3.5.2",
|
||||
"gulp-rename": "~1.0.0",
|
||||
"gulp-concat": "~2.1.7",
|
||||
"gulp-uglify": "~0.2.1"
|
||||
}
|
||||
}
|
||||
@ -19,13 +19,6 @@ Potree.PointCloudOctreeProxyNode = function(geometryNode){
|
||||
|
||||
Potree.PointCloudOctreeProxyNode.prototype = Object.create(THREE.Object3D.prototype);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Potree.PointCloudOctree = function(geometry, material){
|
||||
THREE.Object3D.call( this );
|
||||
|
||||
|
||||
75
src/utils.js
75
src/utils.js
@ -34,23 +34,6 @@ Potree.utils.computeTransformedBoundingBox = function (box, transform) {
|
||||
boundingBox.setFromPoints( vertices );
|
||||
|
||||
return boundingBox;
|
||||
|
||||
|
||||
//var geom = new THREE.Geometry();
|
||||
//
|
||||
//geom.vertices = [
|
||||
// new THREE.Vector3(box.min.x, box.min.y, box.min.z).applyMatrix4(transform),
|
||||
// new THREE.Vector3(box.min.x, box.min.y, box.min.z).applyMatrix4(transform),
|
||||
// new THREE.Vector3(box.max.x, box.min.y, box.min.z).applyMatrix4(transform),
|
||||
// new THREE.Vector3(box.min.x, box.max.y, box.min.z).applyMatrix4(transform),
|
||||
// new THREE.Vector3(box.min.x, box.min.y, box.max.z).applyMatrix4(transform),
|
||||
// new THREE.Vector3(box.min.x, box.max.y, box.max.z).applyMatrix4(transform),
|
||||
// new THREE.Vector3(box.max.x, box.max.y, box.min.z).applyMatrix4(transform),
|
||||
// new THREE.Vector3(box.max.x, box.min.y, box.max.z).applyMatrix4(transform),
|
||||
// new THREE.Vector3(box.max.x, box.max.y, box.max.z).applyMatrix4(transform)
|
||||
//];
|
||||
//geom.computeBoundingBox();
|
||||
//return geom.boundingBox;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -69,4 +52,60 @@ Potree.utils.addCommas = function(nStr){
|
||||
x1 = x1.replace(rgx, '$1' + ',' + '$2');
|
||||
}
|
||||
return x1 + x2;
|
||||
}
|
||||
}
|
||||
|
||||
Potree.utils.loadSkybox = function(path){
|
||||
var camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 100000 );
|
||||
var scene = new THREE.Scene();
|
||||
|
||||
var format = ".jpg";
|
||||
var urls = [
|
||||
path + 'px' + format, path + 'nx' + format,
|
||||
path + 'py' + format, path + 'ny' + format,
|
||||
path + 'pz' + format, path + 'nz' + format
|
||||
];
|
||||
|
||||
var textureCube = THREE.ImageUtils.loadTextureCube( urls, new THREE.CubeRefractionMapping() );
|
||||
var material = new THREE.MeshBasicMaterial( { color: 0xffffff, envMap: textureCube, refractionRatio: 0.95 } );
|
||||
|
||||
var shader = THREE.ShaderLib[ "cube" ];
|
||||
shader.uniforms[ "tCube" ].value = textureCube;
|
||||
|
||||
var material = new THREE.ShaderMaterial( {
|
||||
|
||||
fragmentShader: shader.fragmentShader,
|
||||
vertexShader: shader.vertexShader,
|
||||
uniforms: shader.uniforms,
|
||||
depthWrite: false,
|
||||
side: THREE.BackSide
|
||||
|
||||
} ),
|
||||
|
||||
mesh = new THREE.Mesh( new THREE.BoxGeometry( 100, 100, 100 ), material );
|
||||
scene.add( mesh );
|
||||
|
||||
return {"camera": camera, "scene": scene};
|
||||
}
|
||||
|
||||
|
||||
Potree.utils.createGrid = function createGrid(width, length, spacing){
|
||||
var material = new THREE.LineBasicMaterial({
|
||||
color: 0xBBBBBB
|
||||
});
|
||||
|
||||
var geometry = new THREE.Geometry();
|
||||
for(var i = 0; i <= length; i++){
|
||||
geometry.vertices.push(new THREE.Vector3(-(spacing*width)/2, 0, i*spacing-(spacing*length)/2));
|
||||
geometry.vertices.push(new THREE.Vector3(+(spacing*width)/2, 0, i*spacing-(spacing*length)/2));
|
||||
}
|
||||
|
||||
for(var i = 0; i <= width; i++){
|
||||
geometry.vertices.push(new THREE.Vector3(i*spacing-(spacing*width)/2, 0, -(spacing*length)/2));
|
||||
geometry.vertices.push(new THREE.Vector3(i*spacing-(spacing*width)/2, 0, +(spacing*length)/2));
|
||||
}
|
||||
|
||||
var line = new THREE.Line(geometry, material, THREE.LinePieces);
|
||||
line.receiveShadow = true;
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user