1 <html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" >
3 <title>Camera rotate 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 @import "../../../dijit/themes/tundra/tundra.css";
10 <script type="text/javascript" src="../../../dojo/dojo.js" djConfig="isDebug: false"></script>
11 <script type="text/javascript" src="../object.js"></script>
12 <script type="text/javascript" src="../scheduler.js"></script>
13 <script type="text/javascript">
15 dojo.require("dojox.gfx3d");
17 var angles = {x: 30, y: 30, z: 0};
22 var m = dojox.gfx3d.matrix;
24 if(dojo.byId('rx').checked){
27 if(dojo.byId('ry').checked){
30 if(dojo.byId('rz').checked){
34 m.cameraTranslate(-300, -200, 0),
35 m.cameraRotateXg(angles.x),
36 m.cameraRotateYg(angles.y),
37 m.cameraRotateZg(angles.z)
40 view.setCameraTransform(t);
44 makeObjects = function(){
45 var surface = dojox.gfx.createSurface("test", 500, 500);
46 view = surface.createViewport();
48 var c = {bottom: {x: 0, y: 0, z: 0}, top :{x: 100, y: 100, z: 100}};
49 var xaxis = [{x: 0, y: 0, z: 0}, {x: 200, y: 0, z: 0}];
50 var yaxis = [{x: 0, y: 0, z: 0}, {x: 0, y: 200, z: 0}];
51 var zaxis = [{x: 0, y: 0, z: 0}, {x: 0, y: 0, z: 200}];
53 var m = dojox.gfx3d.matrix;
55 view.createEdges(xaxis).setStroke({color: "red", width: 1});
56 view.createEdges(yaxis).setStroke({color: "green", width: 1});
57 view.createEdges(zaxis).setStroke({color: "blue", width: 1});
59 cube = view.createCube(c).setStroke({color: "lime", width: 1});
61 var camera = dojox.gfx3d.matrix.normalize([
62 m.cameraTranslate(-300, -200, 0),
63 m.cameraRotateXg(angles.x),
64 m.cameraRotateYg(angles.y),
65 m.cameraRotateZg(angles.z),
68 view.applyCameraTransform(camera);
70 window.setInterval(rotate, 50);
73 dojo.addOnLoad(makeObjects);
78 <h1>Camera rotate</h1>
79 <p>The cube is in the center (0, 0, 0): The color of X, Y, Z axes are red, green, blue. The view renders all the objects
80 in each frame, the <em>conservative</em> drawer is used.</p>
82 <input id="rx" type="checkbox" name="rotateX" checked="true" value="on"/>
83 <label for="rx"> Rotate around X-axis</label> <br/>
84 <input id="ry" type="checkbox" name="rotateY" checked="false" value="off"/>
85 <label for="ry"> Rotate around Y-axis</label> <br/>
86 <input id="rz" type="checkbox" name="rotateZ" checked="false" value="off"/>
87 <label for="rz"> Rotate around Z-axis</label> <br/>
90 <div id="test" style="width: 500px; height: 500px;"></div>
91 <p>That's all Folks!</p>