forked from xeolabs/scenejs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
360 lines (310 loc) · 12.5 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<head>
<title>SceneJS V3</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
<link href="css/styles.css" rel="stylesheet"/>
<script src="lib/jquery-1.8.3.min.js"></script>
<script src="lib/jquery.bxslider.min.js"></script>
<link href="css/jquery.bxslider.css" rel="stylesheet"/>
<link href="css/prettify.css" rel="stylesheet"/>
<script src="lib/prettify.js"></script>
<style>
p.sectionHeading {
font-weight: bold;
font-size: 20px;
padding-bottom: 0;
padding-top: 15px;
}
p.quickStart {
font-weight: bold;
font-size: 30px;
padding-bottom: 0;
padding-top: 15px;
}
p.bulletHeading {
font-weight: bold;
padding-top: 0px;
padding-bottom: 5px;
}
p.bullet {
padding-top: 0;
padding-bottom: 5px;
margin-top: 0px;
/*line-height: 20px;*/
/*color: #2a2a2a; */
}
/*p {*/
/*padding-top: 0;*/
/*margin-top: 0px;*/
/*line-height: 20px;*/
/*color: #2a2a2a;*/
/*font: 400 14px/1.4 "Open Sans", sans-serif;*/
/*}*/
.col {
background-repeat: no-repeat;
background-color: white;
}
.left {
float: left;
width: 30%;
padding: 10px;
padding-left: 0;
}
.right {
float: left;
width: 65%;
padding-left: 25px;
padding-top: 10px;
padding-right: 0;
}
</style>
</head>
<body>
<div id="top">
<div class="links"><a href="examples.html">Examples</a> | <a
href="https://github.com/xeolabs/scenejs#downloads">Downloads</a> | <a
href="https://github.com/xeolabs/scenejs/issues">Issues</a> | <a
href="https://github.com/xeolabs/scenejs/tree/V3.1/licenses">License</a> | <a
href="https://twitter.com/xeolabs">Twitter</a> | <a
href="http://www.facebook.com/group.php?gid=350488973712">Facebook</a></div>
</div>
<div id="header">
<div class="inner">
<ul class="bxslider">
<li>
<a href="https://smiletrain.biodigitalhuman.com/home/"><img
src="images/smiletrain.jpg" alt=""
title="Smile Train: World's first surgery simulator to train doctors for cleft repair surgery "/></a>
</li>
<li>
<a href="examples.html?page=city"><img
src="images/procedural-city.jpg" alt=""
title="SceneJS Example: Procedurally-Generated City"/></a>
</li>
<li>
<a href="http://www.biodigital.com/biodigital-human.html">
<img src="images/human.jpg" alt=""
title="BioDigital Human: A Web-based atlas of human anatomy and conditions"/>
</a>
</li>
<li>
<a href="examples.html?page=tronTank"><img
src="images/tronTank.jpg" alt=""
title="SceneJS Example: Tank Program from the 1982 Disney motion picture Tron"/></a>
</li>
<li>
<a href="http://bimsurfer.org">
<img src="images/bimSurfer.jpg" alt=""
title="BIMSurfer - Open-Source IFC Viewer"/>
</a>
</li>
<li>
<a href="http://www.biodigital.com/biodigital-human.html">
<img src="images/bdhuman-skin.png" alt=""
title="BioDigital Human: Skin Cross-Section"/>
</a>
</li>
<li>
<a href="examples.html?page=customHeightmap"><img
src="images/heightMapWithFog.jpg" alt=""
title="SceneJS Example: Heightmap with Fog"/></a>
</li>
<li>
<a href="http://www.biodigital.com/biodigital-human.html">
<img src="images/salmonella.png" alt=""
title="BioDigital Human: Salmonella Bacterium"/>
</a>
</li>
<li>
<a href="examples.html?page=bubbles">
<img src="images/bubbles.jpg" alt=""
title="SceneJS Examples: Bubbles using a custom fragment shader"/>
</a>
</li>
<li>
<a href="examples.html?page=multitexturing"><img
src="images/earth.jpg" alt=""
title="SceneJS Example: Earth rendered with color, specular, alpha and glow maps"/></a>
</li>
<!--<li>-->
<!--<a href="http://openglinsights.com/"><img-->
<!--src="images/openGLInsights.jpg" alt=""-->
<!--title="SceneJS: A WebGL-Based Scene Graph Engine - OpenGL Insights 2012"/></a>-->
<!--</li>-->
</ul>
</div>
</div>
<div id="intro">
<!--<p>A JSON-based scene graph engine on WebGL</p>-->
<p><span class="strong">SceneJS</span> is an open-source 3D engine for JavaScript that provides a JSON-based scene
graph API on WebGL. It was created by <a href="http://about.me/kaylindsay">Lindsay Kay</a> for efficient rendering of large numbers
of objects for high-detail visualisation.</p>
</div>
<div id="container">
<div style="width:100%;">
<div class="col left">
<p class="sectionHeading">Features</p>
<div id="featureList">
</div>
</div>
<div class="col right">
<p class="sectionHeading quickStart">Quick Start</p>
<p>First, include the <a href="api/latest/scenejs.js">SceneJS
library</a> in the <head> tag of your web page:
</p>
<pre><script src="http://scenejs.org/api/latest/scenejs.js"></script></pre>
<p>Then build a scene. We'll make a spinning blue teapot:</p>
<pre class="prettyprint lang-javascript">
var scene = SceneJS.createScene({
nodes:[
{
type:"material",
color: { r: 0.3, g: 0.3, b: 1.0 },
nodes:[
{
type: "rotate",
id: "myRotate",
y: 1.0,
angle: 0,
nodes: [
{
type:"prims/teapot"
}
]
}
]
}
]
});
</pre>
<p>And voilà, one blue teapot:</p><br>
<a href="examples.html?page=firstExample"
target="other"> <img
style="display: block; margin-left: auto; margin-right: auto;" src="images/firstExample.png"/></a>
<br>
<p>Now let's start the teapot spinning:</p>
<pre class="prettyprint lang-javascript">
scene.getNode("myRotate", function(myRotate) {
var angle = 0;
scene.on("tick",
function() {
myRotate.setAngle(angle += 0.5);
});
});
</pre>
<p>
<a href="examples.html?page=firstExample"
target="other">Run this example</a></p>
<p class="sectionHeading">Plugins</p>
<p>To keep the core library small, SceneJS dynamically loads it's non-core functionality from a directory of
plugins. In the example above, the <code>prims/teapot</code> node is a custom node type instantiated from a <a
href="https://github.com/xeolabs/scenejs/tree/V3.1/api/latest/plugins/node/prims/teapot.js">prims/teapot</a> plugin, which SceneJS
loaded on-demand from <a href="https://github.com/xeolabs/scenejs/tree/V3.1/api/latest/plugins">the plugins directory</a> within its repository on
GitHub.</p>
<p>If you'd rather serve the plugins yourself, then just copy that directory to your server and configure
SceneJS to load them from there, like this:</p>
<pre class="prettyprint lang-javascript">SceneJS.setConfigs({
pluginPath: "./foo/myPluginsDir"
});
</pre>
<p>Want to write your own plugins? Excellent, please read more about the plugin API <a
href="https://github.com/xeolabs/scenejs#plugin-api">here</a>.</p>
</div>
</div>
</div>
<a href="https://github.com/xeolabs/scenejs" target="_blank"><img
style="position: absolute; top: 0; left: 0; border: 0;"
src="https://s3.amazonaws.com/github/ribbons/forkme_left_red_aa0000.png" alt="Fork me on GitHub"></a>
<script>
jQuery(document).ready(
function ($) {
addFeatures();
addPrettify();
addSlider();
});
function addFeatures() {
$.ajax({
type:'GET',
url:'examples/features.json',
dataType:'json',
success:function (features) {
var featureList = $('#featureList');
var category;
var categoryElem;
var subCategoryElem;
var featureElem;
var subSection;
var subCategory;
var feature;
var li;
for (var categoryName in features) {
if (features.hasOwnProperty(categoryName)) {
category = features[categoryName];
categoryElem = $('<h3/>')
.addClass('feature-category')
.text(category.title)
.appendTo(featureList);
for (var i = 0, len = category.nodes.length; i < len; i++) {
subCategory = category.nodes[i];
subCategoryElem = $('<div/>')
.addClass('feature-subcategory')
.appendTo(featureList);
var nodes = subCategory.nodes;
if (nodes) {
for (var j = 0, lenj = subCategory.nodes.length; j < lenj; j++) {
feature = subCategory.nodes[j];
featureElem = $('<a/>')
.addClass('feature-feature')
.attr('href', 'examples.html?page=' + feature.page)
.text(feature.title)
.appendTo(subCategoryElem);
if (j < lenj - 2) {
$('<span/>')
.text(", ")
.appendTo(featureElem);
} else if (j < lenj - 1) {
$('<span/>')
.text(" and ")
.appendTo(featureElem);
}
}
}
}
}
}
}
});
}
function addPrettify() {
var els = document.querySelectorAll('pre');
for (var i = 0, el; el = els[i]; i++) {
if (!el.classList.contains('noprettyprint')) {
el.classList.add('prettyprint');
}
}
var el = document.createElement('script');
el.type = 'text/javascript';
el.src = 'lib/prettify.js';
el.onload = function () {
prettyPrint();
};
document.body.appendChild(el);
}
function addSlider() {
$('.bxslider').bxSlider({
mode:'fade',
pause:6000,
useCSS:false,
infiniteLoop:true,
hideControlOnEnd:true,
speed:1000,
captions:true,
auto:true,
pager:false
});
}
</script>
</body>
</html>