Subversion Repositories Applications.papyrus

Rev

Details | Last modification | View Log | RSS feed

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