| 1 | <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" > |
| 2 | <head> |
| 3 | <title>Cylinder 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 | </style> |
| 9 | <script type="text/javascript" src="../../../dojo/dojo.js" data-dojo-config="isDebug: true"></script> |
| 10 | |
| 11 | <script type="text/javascript"> |
| 12 | |
| 13 | dojo.require("dojox.gfx3d"); |
| 14 | |
| 15 | makeObjects = function(){ |
| 16 | var surface = dojox.gfx.createSurface("test", 500, 400); |
| 17 | var view = surface.createViewport(); |
| 18 | view.setLights([ |
| 19 | {direction: {x: 0, y: 0, z: -10}, color: "white"}, |
| 20 | {direction: {x: 10, y: 0, z: -10}, color: "#444"} |
| 21 | ], {color: "white", intensity: 2}, "white"); |
| 22 | |
| 23 | var m = dojox.gfx3d.matrix; |
| 24 | |
| 25 | view.createCylinder({}) |
| 26 | .setTransform([m.translate(150, 250, 0), m.rotateZg(60), m.rotateXg(-60)]) |
| 27 | .setStroke("black") |
| 28 | .setFill({type: "plastic", finish: "glossy", color: "red"}); |
| 29 | |
| 30 | view.createCylinder({}) |
| 31 | .setTransform([m.translate(150, 100, 0), m.rotateZg(45), m.rotateXg(-135)]) |
| 32 | .setStroke("black") |
| 33 | .setFill({type: "plastic", finish: "shiny", color: "yellow"}); |
| 34 | |
| 35 | view.createCylinder({}) |
| 36 | .setTransform([m.translate(250, 200, 0), m.rotateZg(-30), m.rotateXg(-30)]) |
| 37 | .setStroke("black") |
| 38 | .setFill({type: "plastic", finish: "dull", color: "lime"}); |
| 39 | |
| 40 | //var camera = m.normalize([m.cameraRotateXg(15), m.cameraRotateYg(15), m.cameraTranslate(-200, -300, 0)]); |
| 41 | //var camera = m.normalize([m.cameraRotateXg(15), m.cameraRotateYg(15)]); |
| 42 | var camera = m.normalize({}); |
| 43 | |
| 44 | view.applyCameraTransform(camera); |
| 45 | view.render(); |
| 46 | }; |
| 47 | |
| 48 | mdebug = function(matrix){ |
| 49 | var m = dojox.gfx3d.matrix.normalize(matrix); |
| 50 | console.debug("xx: " + m.xx + ", xy: " + m.xy + " | xz:" + m.xz + " | dx:" + m.dx); |
| 51 | console.debug("yx: " + m.yx + ", yy: " + m.yy + " | yz:" + m.yz + " | dy:" + m.dy); |
| 52 | console.debug("zx: " + m.zx + ", zy: " + m.zy + " | zz:" + m.zz + " | dz:" + m.dz); |
| 53 | }; |
| 54 | |
| 55 | dojo.addOnLoad(makeObjects); |
| 56 | |
| 57 | </script> |
| 58 | </head> |
| 59 | <body> |
| 60 | <h1>Cylinder Test</h1> |
| 61 | <div id="test" style="width: 500px; height: 400px;"></div> |
| 62 | <p>That's all Folks!</p> |
| 63 | </body> |
| 64 | </html> |