]> git.pond.sub.org Git - eow/blob - static/dojo-release-1.1.1/dojox/gfx3d/tests/test_edges.html
add Dojo 1.1.1
[eow] / static / dojo-release-1.1.1 / dojox / gfx3d / tests / test_edges.html
1 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
2 <head>
3 <title>Edges 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">
11
12 dojo.require("dojox.gfx3d");
13
14 makeObjects = function(){
15         var surface = dojox.gfx.createSurface("test", 500, 500);
16         var view = surface.createViewport();
17         var lines = [
18                 {x: 100, y: 10, z: 5},
19                 {x: 80, y: 80, z: 55},
20                 {x: 120, y: 80, z: 75},
21                 {x: 250, y: 92, z: 15},
22                 {x: 200, y: 25, z: 5},
23                 {x: 156, y: 40, z: 45}
24         ];
25
26         var m = dojox.gfx3d.matrix;
27         var loop = view.createEdges(lines, "loop")
28                 .setStroke({color: "blue", width: 1})
29                 .applyTransform(dojox.gfx3d.matrix.translate({x: 0, y: 0, z: 0}));
30
31         var strip  = view.createEdges(lines, "strip")
32                 .setStroke({color: "red", width: 1})
33                 .applyTransform(dojox.gfx3d.matrix.translate({x: 0, y: 100, z: 0}));
34
35         var normal = view.createEdges(lines)
36                 .setStroke({color: "lime", width: 1})
37                 .applyTransform(dojox.gfx3d.matrix.translate({x: 0, y: 200, z: 0}));
38
39         var camera = dojox.gfx3d.matrix.normalize([
40                 m.cameraRotateZg(20), 
41                 //m.cameraRotateYg(30),
42                 //m.cameraRotateXg(50),
43                 m.cameraTranslate(0, 0, 0)
44         ]);
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
58 dojo.addOnLoad(makeObjects);
59
60 </script>
61 </head>
62 <body>
63         <h1>Edges Test</h1>
64         <p> Test of the Edges, there are three modes</p>
65         <ul>
66                 <li>none, any two vertice pair form one edge, lime</li>
67                 <li>strip, vertices are connected by edges. red</li>
68                 <li>loop, the same as strip, close the path, blue</li>
69         </ul>
70 <div id="test" style="width: 500px; height: 500px;"></div>
71 <p>That's all Folks!</p>
72 </body>
73 </html>