46b7891dd53fde2d54d0bc4656918e2fe889ea8c.svn-base 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <html>
  2. <head>
  3. <title>Cube 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. <!--
  10. The next line should include Microsoft's Silverligth.js, if you plan to use the silverlight backend
  11. <script type="text/javascript" src="Silverlight.js"></script>
  12. -->
  13. <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: true"></script>
  14. <script type="text/javascript">
  15. dojo.require("dojox.gfx3d");
  16. dojo.require("dojox.gfx.utils");
  17. makeObjects = function(){
  18. var surface = dojox.gfx.createSurface("test", 500, 500);
  19. var view = surface.createViewport();
  20. view.setLights([{direction: {x: -10, y: -5, z: 5}, color: "white"}],
  21. {color:"white", intensity: 2}, "white");
  22. var m = dojox.gfx3d.matrix;
  23. var l = view.createCube({bottom: {x: 0, y: 0, z: 0}, top: {x: 100, y: 100, z: 100}})
  24. .setFill({type: "plastic", finish: "dull", color: "lime"});
  25. var camera = [m.cameraRotateXg(20), m.cameraRotateYg(20), m.cameraTranslate(-200, -200, 0)];
  26. view.applyCameraTransform(camera);
  27. view.render();
  28. //dojo.byId("out1").value = dojo.byId("test").innerHTML;
  29. //dojo.byId("out2").value = dojox.gfx.utils.toJson(surface, true);
  30. };
  31. dojo.addOnLoad(makeObjects);
  32. </script>
  33. </head>
  34. <body>
  35. <h1>Cube Test</h1>
  36. <div id="test" style="width: 500px; height: 500px;"></div>
  37. <!--
  38. <p><button onclick="makeObjects();">Go</button></p>
  39. <p><textarea id="out1" cols="40" rows="5"></textarea></p>
  40. <p><textarea id="out2" cols="40" rows="5"></textarea></p>
  41. -->
  42. <p>That's all Folks!</p>
  43. </body>
  44. </html>