-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexample.html
More file actions
51 lines (39 loc) · 1.37 KB
/
example.html
File metadata and controls
51 lines (39 loc) · 1.37 KB
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
<!doctype html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>STL Export Test</title>
<script type="text/javascript" charset="utf-8" src="THREE2STL.js"></script>
<script type="text/javascript" charset="utf-8" src="three.min.js"></script>
</head>
<body>
</body>
<script type="text/javascript" charset="utf-8">
var camera, scene, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 1000;
scene = new THREE.Scene();
//geometry = new THREE.TetrahedronGeometry( 200 );
geometry = new THREE.CubeGeometry( 200, 200, 200 );
material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
renderer = new THREE.CanvasRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
// this is where the exporting happens
console.log( stlFromGeometry( geometry, {download:true} ) )
}
function animate() {
// note: three.js includes requestAnimationFrame shim
requestAnimationFrame( animate );
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render( scene, camera );
}
</script>
</html>