stlviewer.html

Tue, 04 Apr 2017 03:13:58 +0200

author
mdd
date
Tue, 04 Apr 2017 03:13:58 +0200
changeset 12
b3cf0176512e
parent 11
098335a1d510
child 13
39fb313ba27c
permissions
-rw-r--r--

finished webrenderer

8
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
1 <!DOCTYPE html>
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
2 <html lang="en"><head>
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
3 <meta http-equiv="content-type" content="text/html; charset=UTF-8">
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
4 <title>ScubaTools Object Viewer</title>
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
5 <meta charset="utf-8">
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
6 <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
7
11
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
8 <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css" />
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
9 <link rel="stylesheet" href="stlviewer.css" />
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
10 <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
11 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
8
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
12
11
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
13 <script src="https://threejs.org/build/three.js"></script>
12
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
14 <script src="https://threejs.org/examples/js/Detector.js"></script>
11
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
15 <script src="https://threejs.org/examples/js/loaders/STLLoader.js"></script>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
16 <script src="https://threejs.org/examples/js/controls/OrbitControls.js"></script>
8
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
17
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
18 </head>
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
19 <body>
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
20 <div id="info">
11
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
21 <div class="listcontainer">
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
22 <h2>Available:</h2>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
23 <ul id="sortable1">
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
24 <!-- PLACEHOLDER CYLINDERS -->
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
25 </ul>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
26 </div>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
27 <div class="listcontainer">
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
28 <h2>Selected:</h2>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
29 <ul id="sortable2">
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
30
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
31 </ul>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
32 </div>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
33
8
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
34 <a href="https://neo-soft.org" target="_blank">NeoSoft</a> ScubaTools -
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
35 <a href="https://threejs.org/" target="_blank">three.js</a> -
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
36 STL loader by <a href="https://github.com/aleeper" target="_blank">aleeper</a>.
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
37 <br/>
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
38 Left mouse: rotate camera, right mouse: move camera, middle mouse or wheel: zoom
11
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
39
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
40
8
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
41 </div>
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
42
11
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
43 <script src="stlviewer.js"></script>
098335a1d510 web viewer 3d finished
mdd
parents: 8
diff changeset
44
8
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
45 <script>
12
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
46 if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
8
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
47 var container;
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
48 var camera, cameraTarget, scene, renderer;
12
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
49 var m_spacer = new THREE.MeshPhongMaterial( {
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
50 color: 0x736f6e, specular: 0x111111, shininess: 100 } );
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
51
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
52 /*
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
53 var mapHeight = new THREE.TextureLoader().load( "img/rust1.jpg" );
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
54 mapHeight.anisotropy = 4;
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
55 mapHeight.repeat.set( 0.998, 0.998 );
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
56 mapHeight.offset.set( 0.001, 0.001 );
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
57 mapHeight.wrapS = mapHeight.wrapT = THREE.RepeatWrapping;
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
58 mapHeight.format = THREE.RGBFormat;
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
59 var m_cylinder = new THREE.MeshPhongMaterial( {
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
60 color: 0x4682b4,
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
61 specular: 0x222222,
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
62 shininess: 25,
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
63 bumpMap: mapHeight,
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
64 bumpScale: 12
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
65 } );
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
66 */
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
67 var m_cylinder = new THREE.MeshPhongMaterial( {
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
68 color: 0x4682b4, specular: 0x111111, shininess: 200 } );
b3cf0176512e finished webrenderer
mdd
parents: 11
diff changeset
69 init();
8
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
70 animate();
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
71
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
72 </script><div><canvas style="width: 1589px; height: 711px;" height="711" width="1589"></canvas><div style="position: fixed; top: 0px; left: 0px; cursor: pointer; opacity: 0.9; z-index: 10000;"><canvas style="width: 80px; height: 48px; display: block;" height="48" width="80"></canvas><canvas style="width: 80px; height: 48px; display: none;" height="48" width="80"></canvas></div></div>
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
73
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
74
63b6f80e09ef added threejs stl viewer html testing
mdd
parents:
diff changeset
75 </body></html>

mercurial