Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

62 lines (47 sloc) 1.697 kb
<!doctype html>
<html lang="en">
<head>
<title>three.js - Jotunheimen</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<style>
body { margin: 0; overflow: hidden; }
</style>
</head>
<body>
<div id="webgl"></div>
<script src="../lib/three.min.js"></script>
<script src="../lib/TrackballControls.js"></script>
<script src="../lib/TerrainLoader.js"></script>
<script>
var width = window.innerWidth,
height = window.innerHeight;
var scene = new THREE.Scene();
scene.add(new THREE.AmbientLight(0xeeeeee));
var camera = new THREE.PerspectiveCamera(45, width / height, 0.1, 1000);
camera.position.set(0, -30, 30);
var renderer = new THREE.WebGLRenderer();
renderer.setSize(width, height);
var terrainLoader = new THREE.TerrainLoader();
terrainLoader.load('../assets/jotunheimen.bin', function(data) {
var geometry = new THREE.PlaneGeometry(60, 60, 199, 199);
for (var i = 0, l = geometry.vertices.length; i < l; i++) {
geometry.vertices[i].z = data[i] / 65535 * 5;
}
var material = new THREE.MeshPhongMaterial({
map: THREE.ImageUtils.loadTexture('../assets/jotunheimen-texture.jpg')
});
var plane = new THREE.Mesh(geometry, material);
scene.add(plane);
});
var controls = new THREE.TrackballControls(camera);
document.getElementById('webgl').appendChild(renderer.domElement);
render();
function render() {
controls.update();
requestAnimationFrame(render);
renderer.render(scene, camera);
}
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.