61f7428510a49da2cecd3f4cf5720cbf51372f5b.svn-base 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
  2. <head>
  3. <title>Triangles 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 points = [
  16. {x: 0, y: 0, z: 150},
  17. {x: 50, y: 0, z: 0},
  18. {x: 0, y: 50, z: 0},
  19. {x: 0, y: 0, z: 150},
  20. {x: 50, y: 0, z: 0},
  21. {x: 0, y: -50, z: 0}
  22. ];
  23. var fan = [
  24. {x: 0, y: 0, z: 150},
  25. {x: 50, y: 0, z: 0},
  26. {x: 0, y: 50, z: 0},
  27. {x: -50, y: 0, z: 0},
  28. {x: 0, y: -50, z: 0}
  29. ];
  30. var strip = [
  31. {x: 0, y: -50, z: 0},
  32. {x: 0, y: 0, z: 150},
  33. {x: 50, y: 0, z: 0},
  34. {x: 0, y: 50, z: 0}
  35. ];
  36. var m = dojox.gfx3d.matrix;
  37. var normal = view.createTriangles(points)
  38. .setStroke({color: "blue", width: 1})
  39. .setFill("#ccc")
  40. .applyTransform(dojox.gfx3d.matrix.translate({x: 0, y: 0, z: 10}));
  41. view.createTriangles(strip, "strip")
  42. .setStroke({color: "red", width: 1})
  43. .setFill("#ccc")
  44. .applyTransform(dojox.gfx3d.matrix.translate({x: 150, y: 0, z: 10}));
  45. view.createTriangles(fan, "fan")
  46. .setStroke({color: "lime", width: 1})
  47. .setFill("#ccc")
  48. .applyTransform(dojox.gfx3d.matrix.translate({x: 300, y: 0, z: 10}));
  49. var camera = dojox.gfx3d.matrix.normalize([
  50. m.cameraRotateXg(-30),
  51. m.cameraRotateYg(-10),
  52. m.cameraTranslate(-50, -100, 0)
  53. ]);
  54. view.applyCameraTransform(camera);
  55. view.render();
  56. };
  57. mdebug = function(matrix){
  58. var m = dojox.gfx3d.matrix.normalize(matrix);
  59. console.debug("xx: " + m.xx + ", xy: " + m.xy + " | xz:" + m.xz + " | dx:" + m.dx);
  60. console.debug("yx: " + m.yx + ", yy: " + m.yy + " | yz:" + m.yz + " | dy:" + m.dy);
  61. console.debug("zx: " + m.zx + ", zy: " + m.zy + " | zz:" + m.zz + " | dz:" + m.dz);
  62. };
  63. dojo.addOnLoad(makeObjects);
  64. </script>
  65. </head>
  66. <body>
  67. <h1>Path3d Test</h1>
  68. <div id="test" style="width: 500px; height: 500px;"></div>
  69. <p>That's all Folks!</p>
  70. </body>
  71. </html>