-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
127 lines (107 loc) · 4.18 KB
/
index.html
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<title>main</title>
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Exo+2:wght@100&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/style.css">
<script src="js/three.min.js"></script>
<script src="js/nexus.js"></script>
<script src="js/nexus_three.js"></script>
<script src="js/trackball_three.js"></script>
<script src="js/FirstPersonControls.js"></script>
</head>
<body>
<div class="topnav">
<h2 id="main">Full Stack Architectural Assistant</h2>
<a href="#projects">Projects</a>
<a href="#demos">Demos</a>
<a href="#contact">Contact</a>
</div>
<p>Still in progrss</p>
<div class="acknowledgements">
<ul>
<h2>Built with</h2>
<li><a href="https://www.sidefx.com/">Houdini</a></li>
<li><a href="https://threejs.org/">Three.js</a></li>
<li><a href="http://vcg.isti.cnr.it/nexus/">Nexus</a></li>
</ul>
</div>
<div id="container"></div>
</body>
<script>
var camera = new THREE.PerspectiveCamera( 30, window.innerWidth / window.innerHeight, 0.1, 1000 );
camera.position.z = 100;
camera.position.y = 100;
var controls = new THREE.TrackballControls( camera );
controls.target.set( 0, 0, 0 );
controls.rotateSpeed = 10.0;
controls.zoomSpeed = 1.5;
controls.panSpeed = 0.8;
controls.noZoom = false;
controls.noPan = false;
controls.staticMoving = true;
controls.dynamicDampingFactor = 0.3;
controls.keys = [ 65, 83, 68 ];
controls.addEventListener( 'change', function() { redraw = true; } );
var scene = new THREE.Scene();
scene.background = new THREE.Color( 0x000000 );
scene.fog = new THREE.Fog( 0x050505, 2000, 3500 );
scene.add( new THREE.AmbientLight( 0x444444 ) );
var light1 = new THREE.DirectionalLight( 0xffffff, 1.0 );
light1.position.set( 1, 1, -1 );
scene.add( light1 );
var light2 = new THREE.DirectionalLight( 0xffffff, 1.0 );
light2.position.set( -1, -1, 1 );
scene.add( light2 );
var renderer = new THREE.WebGLRenderer( { antialias: false } );
renderer.setClearColor( scene.fog.color );
renderer.setPixelRatio( window.devicePixelRatio );
renderer.setSize( window.innerWidth, window.innerHeight );
var container = document.getElementById( 'container');
container.appendChild( renderer.domElement );
function onNexusLoad() {
var s = 1/nexus_obj.geometry.boundingSphere.radius * 100;
var target = new THREE.Vector3();
var p = nexus_obj.geometry.boundingBox.getCenter(target).negate();
nexus_obj.position.set(p.x*s, p.y*s, p.z*s);
nexus_obj.scale.set(s, s, s);
redraw = true;
}
function getURLParameter(name) {
return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.search) || [null, ''])[1].replace(/\+/g, '%20')) || null;
}
var model = getURLParameter('model') || "models/test.nxz";
/* An appropriate material can be used as optional fifth arg for the NexusObject constructor */
// let material = false;
/* Material customizations examples: */
// let material = new THREE.PointsMaterial( { size:3, color: 0x00ff00, transparent: false, opacity:0.25 } );
let material = new THREE.MeshLambertMaterial( { color: 0xffffff} );
// let material = new THREE.MeshNormalMaterial({ flatShading: true });
material.side = THREE.DoubleSide;
var nexus_obj = new NexusObject(model, onNexusLoad, function() { redraw = true; }, renderer, material);
scene.add(nexus_obj);
window.addEventListener( 'resize', onWindowResize, false );
function onWindowResize() {
camera.aspect = window.innerWidth / window.innerHeight;
camera.updateProjectionMatrix();
renderer.setSize( window.innerWidth, window.innerHeight );
// controls.handleResize();
controls.update();
redraw = true;
}
var redraw = true;
function animate() {
requestAnimationFrame(animate);
controls.update();
if(redraw) {
renderer.render( scene, camera );
redraw = false;
}
}
animate();
</script>
</html>