-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclickhouse.js
77 lines (50 loc) · 1.73 KB
/
clickhouse.js
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
76
77
var container, controls;
var camera, scene, renderer;
init();
animate();
function init() {
container = document.createElement( 'div' );
document.body.appendChild( container );
camera = new THREE.PerspectiveCamera( 60, window.innerWidth / window.innerHeight, 0.1, 1000 );
camera.position.x = 50;
camera.position.y = 50;
camera.position.z = 50;
camera.lookAt(0, 0, 0);
camera.up.set(0, 0, 1);
controls = new THREE.TrackballControls( camera );
scene = new THREE.Scene();
scene.add( new THREE.HemisphereLight() );
var light = new THREE.PointLight( 0xffeedd );
light.position.set( 10, 10, 10 );
scene.add( light );
//3ds files dont store normal maps
var loader = new THREE.TextureLoader();
var normal = loader.load( 'js/examples/models/3ds/portalgun/textures/normal.jpg' );
var loader = new THREE.TDSLoader( );
loader.setPath( 'js/examples/models/3ds/portalgun/textures/' );
//var modelFile = 'js/examples/models/3ds/portalgun/portalgun.3ds';
var modelFile = 'Testmodel.3ds';
loader.load( modelFile, function ( object ) {
object.traverse( function ( child ) {
if ( child instanceof THREE.Mesh ) {
child.material.normalMap = normal;
}
} );
scene.add( object );
});
renderer = new THREE.WebGLRenderer();
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
container.appendChild( renderer.domElement );
window.addEventListener( 'resize', resize, false );
}
function resize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
}
function animate() {
controls.update();
renderer.render( scene, camera );
requestAnimationFrame( animate );
}