1 | <html> |
---|
2 | <head> |
---|
3 | <title>Cube of dojox.gfx3d.</title> |
---|
4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
5 | <style type="text/css"> |
---|
6 | @import "../../../dojo/resources/dojo.css"; |
---|
7 | @import "../../../dijit/tests/css/dijitTests.css"; |
---|
8 | </style> |
---|
9 | <!-- |
---|
10 | The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend |
---|
11 | <script type="text/javascript" src="Silverlight.js"></script> |
---|
12 | --> |
---|
13 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> |
---|
14 | <script type="text/javascript"> |
---|
15 | dojo.require("dojox.gfx3d"); |
---|
16 | dojo.require("dojox.gfx.utils"); |
---|
17 | |
---|
18 | makeObjects = function(){ |
---|
19 | var surface = dojox.gfx.createSurface("test", 500, 500); |
---|
20 | var view = surface.createViewport(); |
---|
21 | view.setLights([{direction: {x: -10, y: -5, z: 5}, color: "white"}], |
---|
22 | {color:"white", intensity: 2}, "white"); |
---|
23 | |
---|
24 | var m = dojox.gfx3d.matrix; |
---|
25 | var l = view.createCube({bottom: {x: 0, y: 0, z: 0}, top: {x: 100, y: 100, z: 100}}) |
---|
26 | .setFill({type: "plastic", finish: "dull", color: "lime"}); |
---|
27 | |
---|
28 | var camera = [m.cameraRotateXg(20), m.cameraRotateYg(20), m.cameraTranslate(-200, -200, 0)]; |
---|
29 | view.applyCameraTransform(camera); |
---|
30 | view.render(); |
---|
31 | |
---|
32 | //dojo.byId("out1").value = dojo.byId("test").innerHTML; |
---|
33 | //dojo.byId("out2").value = dojox.gfx.utils.toJson(surface, true); |
---|
34 | }; |
---|
35 | |
---|
36 | dojo.addOnLoad(makeObjects); |
---|
37 | |
---|
38 | </script> |
---|
39 | </head> |
---|
40 | <body> |
---|
41 | <h1>Cube Test</h1> |
---|
42 | <div id="test" style="width: 500px; height: 500px;"></div> |
---|
43 | <!-- |
---|
44 | <p><button onclick="makeObjects();">Go</button></p> |
---|
45 | <p><textarea id="out1" cols="40" rows="5"></textarea></p> |
---|
46 | <p><textarea id="out2" cols="40" rows="5"></textarea></p> |
---|
47 | --> |
---|
48 | <p>That's all Folks!</p> |
---|
49 | </body> |
---|
50 | </html> |
---|