forked from KitWallace/openscad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
view-model.xq
46 lines (43 loc) · 1.47 KB
/
view-model.xq
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
declare option exist:serialize "method=xhtml media-type=text/html";
let $model := request:get-parameter("model",())
let $title := request:get-parameter("title","")
let $url := request:get-parameter("url",())
return
<html>
<head>
<title>{$title}</title>
</head>
<body>
<h1>{$title} </h1>
<div>
<canvas id="3d" width="640" height="480"/>
<script type="text/javascript" src="http://kitwallace.co.uk/js/jsc3d.js"/>
<script lang="text/javascript">
function init() {{
viewer.setParameter("InitRotationX",-45);
viewer.setParameter("InitRotationY",0);
viewer.setParameter("InitRotationZ",0);
viewer.init();
viewer.update();
}}
var canvas = document.getElementById('3d');
var viewer = new JSC3D.Viewer(canvas);
viewer.setParameter('SceneUrl', 'models/{$model}.stl');
viewer.setParameter('RenderMode', 'flat');
viewer.setParameter('ProgressBar', 'on');
viewer.setParameter("Definition","high");
viewer.setParameter("ModelColor","#B2B2CC");
viewer.setParameter("BackgroundColor1","#FFFFFF");
viewer.setParameter("BackgroundColor2","#FFFFFF");
init();
</script>
</div>
<div>
{if (exists($url))
then <div>See <a href="{$url}">{$url}</a></div>
else <a href="solid-index.xq#{$model}">Solid Index</a>
}   <a href="models/{$model}.stl">Download STL</a>  
<a href="http://kitwallace.co.uk">Kit Wallace</a>
</div>
</body>
</html>