291 lines
7.9 KiB
HTML
291 lines
7.9 KiB
HTML
|
|
|
|
<html>
|
|
<head>
|
|
<title>tern-auscover project, chowilla</title>
|
|
<style>canvas { width: 100%; height: 100% }</style>
|
|
</head>
|
|
<body style="margin: 0; padding: 0">
|
|
|
|
<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;
|
|
}
|
|
|
|
a:hover, a:visited, a:link, a:active{
|
|
color: #ccccff;
|
|
text-decoration: none;
|
|
}
|
|
|
|
</style>
|
|
|
|
<script src="../libs/plasio/js/laslaz.js"></script>
|
|
<script src="../libs/plasio/vendor/bluebird.js"></script>
|
|
<script src="../libs/three.js/build/three.js"></script>
|
|
<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="../build/js/potree.js"></script>
|
|
<script src="../src/loader/POCLoader.js"></script>
|
|
<script src="../src/PointCloudOctree.js"></script>
|
|
<script src="../src/PointCloudOctreeGeometry.js"></script>
|
|
<script src="../src/materials/PointCloudColorMaterial.js"></script>
|
|
<script src="../src/materials/PointCloudRGBMaterial.js"></script>
|
|
<script src="../src/materials/PointCloudHeightMaterial.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>
|
|
<div class="info" style="position: absolute; left: 10px; top: 140px; width: 400px; color:white"> move: w,a,s,d<br>
|
|
rotate: left mouse<br>
|
|
pan: right mouse</div>
|
|
|
|
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
|
<a href="http://potree.org" target="_blank">potree.org</a><br>
|
|
Chowilla, data from <a href="http://tern-auscover.science.uq.edu.au/thredds/catalog/auscover/field_and_airborne_datasets/airborne/lidar/chowilla/Chowilla_2012_02_01/square/tiles_(1000x1000)/laz_no_overlap/catalog.html" target="_blank">tern-auscover project</a><br>
|
|
Experimental rendering of large scale uncolored lidar data.
|
|
</div>
|
|
|
|
<script>
|
|
var defaultPointSize = 0.04;
|
|
var defaultLOD = 8;
|
|
var defaultFOV = 60;
|
|
// var pointcloudPath = "../../../../pointclouds/surface_and_edge/overpass/overpass_laz/cloud.js";
|
|
//var pointcloudPath = "../../../../pointclouds/tern_auscover/chowilla/chowilla_web/cloud_level_5.js";
|
|
var pointcloudPath = "../../../../pointclouds/tern_auscover/chowilla/chowilla_quadtree/cloud_quad_level_5_laz.js";
|
|
var clock = new THREE.Clock()
|
|
|
|
var renderer;
|
|
var camera;
|
|
var cube;
|
|
var scene;
|
|
var pointCloud;
|
|
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 );
|
|
}
|
|
|
|
function initGUI(){
|
|
var gui = new dat.GUI({
|
|
height : 5 * 32 - 1
|
|
});
|
|
|
|
var params = {
|
|
PointSize: defaultPointSize,
|
|
LOD: defaultLOD,
|
|
FOV: defaultFOV,
|
|
|
|
};
|
|
|
|
var pLOD = gui.add(params, 'LOD', 0.5,20);
|
|
pLOD.onChange(function(value){
|
|
pointCloud.LOD = value;
|
|
});
|
|
|
|
var pPointSize = gui.add(params, 'PointSize', 0.01, 0.1);
|
|
pPointSize.onChange(function(value){
|
|
pointcloudMaterial.size = value;
|
|
});
|
|
|
|
var pFOV = gui.add(params, 'FOV', 20, 120);
|
|
pFOV.onChange(function(value){
|
|
camera.fov = value;
|
|
camera.updateProjectionMatrix();
|
|
});
|
|
}
|
|
|
|
function initThree(){
|
|
stats = new Stats();
|
|
stats.domElement.style.position = 'absolute';
|
|
stats.domElement.style.top = '0px';
|
|
stats.domElement.style.margin = '5px';
|
|
document.body.appendChild( stats.domElement );
|
|
|
|
scene = new THREE.Scene();
|
|
camera = new THREE.PerspectiveCamera(75, window.innerWidth/window.innerHeight, 0.1, 100000);
|
|
|
|
renderer = new THREE.WebGLRenderer();
|
|
renderer.setSize(window.innerWidth, window.innerHeight);
|
|
renderer.autoClear = false;
|
|
document.body.appendChild(renderer.domElement);
|
|
|
|
loadSkybox();
|
|
|
|
// camera and controls
|
|
camera.position.set(0,5,10);
|
|
camera.fov = defaultFOV;
|
|
camera.updateProjectionMatrix();
|
|
controls = new THREE.FirstPersonControls(camera, renderer.domElement);
|
|
camera.rotation.order = 'ZYX';
|
|
controls.moveSpeed *= 30;
|
|
camera.position.set(0, 200, 0);
|
|
camera.rotation.set(-0.3, -Math.PI/4, 0);
|
|
|
|
//pointcloudMaterial = new Potree.PointCloudRGBMaterial();
|
|
//pointcloudMaterial = new Potree.PointCloudColorMaterial(1.0, 0, 0);
|
|
pointcloudMaterial = new Potree.PointCloudHeightMaterial();
|
|
|
|
// load pointcloud
|
|
var pco = POCLoader.load(pointcloudPath);
|
|
pointCloud = new Potree.PointCloudOctree(pco, pointcloudMaterial);
|
|
pointCloud.LOD = defaultLOD;
|
|
|
|
pointCloud.applyMatrix(new THREE.Matrix4().set(
|
|
1,0,0,0,
|
|
0,0,1,0,
|
|
0,-1,0,0,
|
|
0,0,0,1
|
|
));
|
|
|
|
//pointCloud.moveToOrigin();
|
|
//pointCloud.moveToGroundPlane();
|
|
pointcloudMaterial.setBoundingBox(pointCloud.getBoundingBoxWorld());
|
|
|
|
scene.add(pointCloud);
|
|
}
|
|
|
|
function createPointcloudMaterial(){
|
|
var attributes = {};
|
|
var uniforms = {
|
|
color: { type: "c", value: new THREE.Color( 0xffffff ) },
|
|
size: { type: "f", value: 55 }
|
|
};
|
|
interpolationMaterial = new THREE.ShaderMaterial( {
|
|
uniforms: uniforms,
|
|
attributes: attributes,
|
|
vertexShader: document.getElementById( 'vs_points' ).textContent,
|
|
fragmentShader: document.getElementById( 'fs_interpolation' ).textContent,
|
|
vertexColors: THREE.VertexColors,
|
|
|
|
alphaTest: 0.9,
|
|
|
|
} );
|
|
|
|
|
|
var attributes = {};
|
|
var uniforms = {
|
|
color: { type: "c", value: new THREE.Color( 0xffffff ) },
|
|
size: { type: "f", value: 55 }
|
|
};
|
|
var pointsMaterial = new THREE.ShaderMaterial( {
|
|
uniforms: uniforms,
|
|
attributes: attributes,
|
|
vertexShader: document.getElementById( 'vs_points' ).textContent,
|
|
fragmentShader: document.getElementById( 'fs_points' ).textContent,
|
|
vertexColors: THREE.VertexColors,
|
|
|
|
alphaTest: 0.9,
|
|
|
|
} );
|
|
|
|
return pointsMaterial;
|
|
}
|
|
|
|
function render() {
|
|
|
|
requestAnimationFrame(render);
|
|
|
|
stats.update();
|
|
controls.update(clock.getDelta());
|
|
|
|
pointCloud.update( camera );
|
|
|
|
// render skybox
|
|
cameraCube.rotation.copy( camera.rotation );
|
|
renderer.render( sceneCube, cameraCube );
|
|
|
|
renderer.render(scene, camera);
|
|
|
|
document.getElementById("lblNumVisibleNodes").innerHTML = "visible nodes: " + pointCloud.numVisibleNodes;
|
|
document.getElementById("lblNumVisiblePoints").innerHTML = "visible points: " + Potree.utils.addCommas(pointCloud.numVisiblePoints);
|
|
|
|
|
|
|
|
};
|
|
|
|
initThree();
|
|
initGUI();
|
|
render();
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
</html>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!--
|
|
function Test(){
|
|
this.lala = "asd";
|
|
|
|
self.addEventListener("message", function(e){
|
|
self.postMessage("gruesse");
|
|
});
|
|
}
|
|
|
|
var blob = new Blob(["(", Test.toString(), ")()"], {type: 'application/javascript'});
|
|
var blobURL = URL.createObjectURL(blob);
|
|
var ww = new Worker(blobURL);
|
|
|
|
ww.onmessage = function(e){
|
|
console.log("message from worker: " + e.data);
|
|
}
|
|
--> |