File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ < html >
3
+ < head >
4
+ < script type ="text/javascript " src ="../lib/three.js "> </ script >
5
+
6
+ < script type ="text/javascript ">
7
+ function init ( ) {
8
+ // renderer
9
+ var renderer = new THREE . WebGLRenderer ( {
10
+ canvas : document . getElementById ( 'mainCanvas' )
11
+ } ) ;
12
+ renderer . setClearColor ( 0x000000 ) ; // black
13
+
14
+ // scene
15
+ var scene = new THREE . Scene ( ) ;
16
+
17
+ // camera
18
+ var camera = new THREE . PerspectiveCamera ( 45 , 4 / 3 , 1 , 1000 ) ;
19
+ camera . position . set ( 0 , 0 , 5 ) ;
20
+ scene . add ( camera ) ;
21
+
22
+ // a cube in the scene
23
+ var cube = new THREE . Mesh ( new THREE . CubeGeometry ( 1 , 2 , 3 ) ,
24
+ new THREE . MeshBasicMaterial ( {
25
+ color : 0xff0000
26
+ } )
27
+ ) ;
28
+ scene . add ( cube ) ;
29
+
30
+ // render
31
+ renderer . render ( scene , camera ) ;
32
+ }
33
+ </ script >
34
+ </ head >
35
+
36
+ < body onload ="init() ">
37
+ < canvas id ="mainCanvas " width ="400px " height ="300px " > </ canvas >
38
+ </ body >
39
+ </ html >
You can’t perform that action at this time.
0 commit comments