summaryrefslogtreecommitdiffstats
path: root/test/samples/uscxml/test-scenegraph.scxml
blob: 0efcd6d67e5120a15f65425812a363371dc15198 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<scxml datamodel="ecmascript" initial="start" binding="late" 
	xmlns="http://www.w3.org/2005/07/scxml" 
	xmlns:scenegraph="http://uscxml.tk.informatik.tu-darmstadt.de/scenegraph.xsd">
	<datamodel>
		<data id="pitch">0</data>
		<data id="yaw">0</data>
		<data id="roll">0</data>
	</datamodel>
	<state id="start">
		<invoke type="heartbeat">
			<param name="interval" expr="'10ms'" />
			<param name="eventname" expr="'heartbeat.20ms'" />
		</invoke>
		<invoke type="scenegraph">
			<content>
				<scenegraph:display x="10%" y="10 %" width="50 % " height=" 50 % ">
					<scenegraph:viewport x="0" y="0" width="50%" height="50%" id="scene1">
						<scenegraph:scale x="0.3" y="0.3" z="1">
							<scenegraph:translation x="0" y="-10" z="1">
								<scenegraph:node src="http://people.sc.fsu.edu/~jburkardt/data/obj/airboat.obj" />
							</scenegraph:translation>
						</scenegraph:scale>
					</scenegraph:viewport>
					<scenegraph:viewport x="0" y="50%" width="50%" height="50%" id="scene3">
						<scenegraph:rotation id="treeRotation" pitch="100deg" roll="3.15149rad" yaw="10deg">
							<scenegraph:node src="http://cs.iupui.edu/~aharris/webDesign/vrml/tree.wrl" />
						</scenegraph:rotation>
					</scenegraph:viewport>
					<scenegraph:viewport x="50%" y="50%" width="50%" height="50%" id="scene4">
						<scenegraph:translation x="0" y="0" z="0">
							<scenegraph:node src="scenegraph/HARD_MP_VAL_000.wrl" />
						</scenegraph:translation>
					</scenegraph:viewport>
					<scenegraph:viewport x="50%" y="0" width="50%" height="50%" id="scene2">
						<scenegraph:translation x="0" y="0" z="0">
							<scenegraph:node src="http://cs.iupui.edu/~aharris/mm/vrml4/house.wrl" />
						</scenegraph:translation>
					</scenegraph:viewport>
				</scenegraph:display>

				<scenegraph:display x="20%" y="20 %" width="50 % " height=" 50 % ">
					<scenegraph:viewport x="0" y="0" width="100%" height="100%" id="scene1">
						<scenegraph:translation x="0" y="0" z="0">
							<scenegraph:node src="scenegraph/HARD_MP_VAL_000.wrl" />
						</scenegraph:translation>
					</scenegraph:viewport>
				</scenegraph:display>
			</content>
		</invoke>
		<state id="animate">
			<onentry>
				<script>
					var nodeSet = document.evaluate("//scenegraph:rotation[@id='treeRotation']").asNodeSet();
					nodeSet[0].setAttribute("pitch", "pitch" + pitch + "deg");
					nodeSet[0].setAttribute("roll", "roll" + roll + "deg");
					nodeSet[0].setAttribute("yaw", "yaw" + yaw + "deg");
					pitch += 0.5;
					roll += 0.3;
					yaw += 0.1;
				</script>
			</onentry>
			<transition event="heartbeat.20ms" target="animate" />
		</state>
	</state>
	<final id="final">
		<onentry>
			<log expr="'Finished!'" />
		</onentry>
	</final>
</scxml>