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