d197a3de888693388f34e997170daf52c1cff85a.svn-base 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. dojo.require("dojox.gfx3d");
  12. makeObjects = function(){
  13. var surface = dojox.gfx.createSurface("test", 500, 500);
  14. var view = surface.createViewport();
  15. var lines = [
  16. {x: 100, y: 10, z: 5},
  17. {x: 80, y: 80, z: 55},
  18. {x: 120, y: 80, z: 75},
  19. {x: 250, y: 92, z: 15},
  20. {x: 200, y: 25, z: 5},
  21. {x: 156, y: 40, z: 45}
  22. ];
  23. var m = dojox.gfx3d.matrix;
  24. var loop = view.createEdges(lines, "loop")
  25. .setStroke({color: "blue", width: 1})
  26. .applyTransform(dojox.gfx3d.matrix.translate({x: 0, y: 0, z: 0}));
  27. var strip = view.createEdges(lines, "strip")
  28. .setStroke({color: "red", width: 1})
  29. .applyTransform(dojox.gfx3d.matrix.translate({x: 0, y: 100, z: 0}));
  30. var normal = view.createEdges(lines)
  31. .setStroke({color: "lime", width: 1})
  32. .applyTransform(dojox.gfx3d.matrix.translate({x: 0, y: 200, z: 0}));
  33. var camera = dojox.gfx3d.matrix.normalize([
  34. m.cameraRotateZg(20),
  35. //m.cameraRotateYg(30),
  36. //m.cameraRotateXg(50),
  37. m.cameraTranslate(0, 0, 0)
  38. ]);
  39. view.applyCameraTransform(camera);
  40. view.render();
  41. };
  42. mdebug = function(matrix){
  43. var m = dojox.gfx3d.matrix.normalize(matrix);
  44. console.debug("xx: " + m.xx + ", xy: " + m.xy + " | xz:" + m.xz + " | dx:" + m.dx);
  45. console.debug("yx: " + m.yx + ", yy: " + m.yy + " | yz:" + m.yz + " | dy:" + m.dy);
  46. console.debug("zx: " + m.zx + ", zy: " + m.zy + " | zz:" + m.zz + " | dz:" + m.dz);
  47. };
  48. dojo.addOnLoad(makeObjects);
  49. </script>
  50. </head>
  51. <body>
  52. <h1>Edges Test</h1>
  53. <p> Test of the Edges, there are three modes</p>
  54. <ul>
  55. <li>none, any two vertice pair form one edge, lime</li>
  56. <li>strip, vertices are connected by edges. red</li>
  57. <li>loop, the same as strip, close the path, blue</li>
  58. </ul>
  59. <div id="test" style="width: 500px; height: 500px;"></div>
  60. <p>That's all Folks!</p>
  61. </body>
  62. </html>