1 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
3 <title>Pilot test 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 @import "../../../dijit/themes/tundra/tundra.css";
10 <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
11 <script type="text/javascript">
13 dojo.require("dojox.gfx3d");
15 var angles = {x: 0, y: 0, z: 0};
20 var p = dojo.byId("action");
21 var m = dojox.gfx3d.matrix;
22 if(p.value == "Move to Back!"){
23 console.debug(p.value);
24 p.value = "Move to Front!";
25 cube.setTransform(m.translate(20, 0, -120))
27 p.value = "Move to Back!";
28 cube.setTransform(m.translate(50, 0, 150))
34 makeObjects = function(){
35 var surface = dojox.gfx.createSurface("test", 500, 500);
36 view = surface.createViewport();
37 var c = { bottom: {x: 0, y: 0, z: 0}, top :{x: 100, y: 100, z: 100} };
38 var xaxis = [{x: 0, y: 0, z: 0}, {x: 200, y: 0, z: 0}];
39 var yaxis = [{x: 0, y: 0, z: 0}, {x: 0, y: 200, z: 0}];
40 var zaxis = [{x: 0, y: 0, z: 0}, {x: 0, y: 0, z: 200}];
42 var m = dojox.gfx3d.matrix;
44 view.createEdges(xaxis).setStroke({color: "red", width: 1});
45 view.createEdges(yaxis).setStroke({color: "green", width: 1});
46 view.createEdges(zaxis).setStroke({color: "blue", width: 1});
49 .setFill({type: "plastic", finish: dojox.gfx3d.lighting.finish.dull, color: "blue"})
50 .setStroke({color: "black", width: 1});
52 cube = view.createCube(c)
53 .setTransform(m.translate(50, 50, 150))
54 .setFill({type: "plastic", finish: dojox.gfx3d.lighting.finish.dull, color: "lime"})
55 .setStroke({color: "black", width: 1});
57 var camera = dojox.gfx3d.matrix.normalize([
60 m.cameraTranslate(-200, -300, 0)
63 view.applyCameraTransform(camera);
64 view.setLights([{direction: {x: 10, y: 7, z: 5}, color: "white"}],
65 {color:"white", intensity: 2}, "white");
68 // add the click event handler
69 dojo.connect(dojo.byId("action"), "onclick", moveMe);
72 mdebug = function(matrix){
73 var m = dojox.gfx3d.matrix.normalize(matrix);
74 console.debug("xx: " + m.xx + ", xy: " + m.xy + " | xz:" + m.xz + " | dx:" + m.dx);
75 console.debug("yx: " + m.yx + ", yy: " + m.yy + " | yz:" + m.yz + " | dy:" + m.dy);
76 console.debug("zx: " + m.zx + ", zy: " + m.zy + " | zz:" + m.zz + " | dz:" + m.dz);
79 dojo.addOnLoad(makeObjects);
85 <p> The color of X, Y, Z axes are red, green, blue. One cube is in the center (0, 0, 0), click the button to move the other one back
86 and forth, using this to test <em>dojox.gfx3d.drawer.conservative</em></p>
87 <input id="action" type="button" value="Move to Back!"/>
89 <div id="test" style="width: 500px; height: 500px;"></div>
90 <p>That's all Folks!</p>