Skip to content
Snippets Groups Projects
template.x3d 5.44 KiB
Newer Older
<!DOCTYPE X3D PUBLIC 'ISO//Web3D//DTD X3D 3.2//EN' 'http://www.web3d.org/specifications/x3d-3.2.dtd'>
<X3D xmlns:cfn='_xml/_xsd/CommonFunctions' xmlns:cvs='CVSInfo' xmlns:fn='http://www.w3.org/2005/xpath-functions' xmlns:lfn='local_functions' xmlns:ss='urn:schemas-microsoft-com:office:spreadsheet' xmlns:v2kfn='_xml/_xsd/V2Kfunctions' xmlns:x3d='http://www.web3d.org/specifications/x3d-3.2.xsd' xmlns:xlink='http://www.w3.org/1999/xlink' xmlns:xs='http://www.w3.org/2001/XMLSchema' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' profile='Immersive' version='3.2' xsd:noNamespaceSchemaLocation='http://www.web3d.org/specifications/x3d-3.2.xsd'>
	<Engine DEF='engine'>
		<RenderJob DEF='render'>
			<WindowGroup>
				<Window position='10 50' size='933,700' fullScreen='false'/>
			</WindowGroup>
		</RenderJob>
	</Engine>
	<Scene>
		<Background skyColor='0 0 0'/>
		<ProximitySensor DEF='HereIAm' enabled='true' size='10000000 10000000 10000000'/>
		<ProtoDeclare name='Spin_Proto'>
			<ProtoInterface>
				<field name='spin_position' accessType='inputOnly' type='SFVec3f'/>
				<field name='spin_scale' accessType='inputOnly' type='SFVec3f'/>
				<field name='spin_rotation' accessType='inputOnly' type='SFRotation'/>
				<field name='spin_color' accessType='inputOnly' type='SFColor'/>
			</ProtoInterface>
			<ProtoBody>
				<Group>
					<Transform DEF='Spin'>
						<IS>
							<connect nodeField='scale' protoField='spin_scale'/>
							<connect nodeField='translation' protoField='spin_position'/>
							<connect nodeField='rotation' protoField='spin_rotation'/>
						</IS>
						<Transform translation='0 0.375 0'>
							<Shape>
								<Cone bottomRadius='0.25' bottom='true' solid='true' height='0.25' side='true'/>
								<Appearance>
									<Material DEF='ConeColor'>
										<IS>
											<connect nodeField='diffuseColor' protoField='spin_color'/>
										</IS>
									</Material>
								</Appearance>
							</Shape>
						</Transform>
						<Transform translation='0 -0.125 0'>
							<Shape>
								<Cylinder radius='0.1' height='0.75'/>
								<Appearance>
									<Material DEF='CylinderColor'>
									 <IS>
										<connect nodeField='diffuseColor' protoField='spin_color'/>
									</IS>
									</Material>
								</Appearance>
							</Shape>
						</Transform>
					</Transform>
				</Group>
			</ProtoBody>
		</ProtoDeclare>
		<Transform DEF='ArrowsHUD'>
			<Transform DEF='Arrows' translation='-4.5 -3 -10' scale='0.75 0.75 0.75'>
				<Group DEF='ArrowGreen'>
					<Shape>
						<Cylinder DEF='ArrowCylinder' radius='0.025' top='false'/>
						<Appearance DEF='Green'>
							<Material diffuseColor='0 1 0'/>
						</Appearance>
					</Shape>
					<Transform translation='0 1 0'>
						<Shape>
							<Cone DEF='ArrowCone' bottomRadius='0.05' height='0.1'/>
							<Appearance USE='Green'/>
						</Shape>
					</Transform>
					<Transform translation='0 1.1 0'>
						<Billboard>
							<Shape>
								<Appearance DEF='LabelAppearance'>
									<Material diffuseColor='1 1 0'/>
								</Appearance>
								<Text string='Y'>
									<FontStyle DEF='LabelFont' size='0.25'/>
								</Text>
							</Shape>
						</Billboard>
					</Transform>
				</Group>
				<Group DEF='ArrowBlue'>
					<Transform rotation='0 0 1 -1.57079'>
						<Shape>
							<Cylinder USE='ArrowCylinder'/>
							<Appearance DEF='Blue'>
								<Material diffuseColor='0 0 1'/>
							</Appearance>
						</Shape>
						<Transform translation='0 1 0'>
							<Shape>
								<Cone USE='ArrowCone'/>
								<Appearance USE='Blue'/>
							</Shape>
						</Transform>
						<Transform rotation='0 0 1 1.57079' translation='0.072 1.1 0'>
							<Billboard>
								<Shape>
									<Appearance USE='LabelAppearance'/>
									<Text string='X'>
										<FontStyle USE='LabelFont'/>
									</Text>
								</Shape>
							</Billboard>
						</Transform>
					</Transform>
				</Group>
				<Group DEF='ArrowRed'>
					<Transform rotation='1 0 0 1.57079'>
						<Shape>
							<Cylinder USE='ArrowCylinder'/>
							<Appearance DEF='Red'>
								<Material diffuseColor='1 0 0'/>
							</Appearance>
						</Shape>
						<Transform translation='0 1 0'>
							<Shape>
								<Cone USE='ArrowCone'/>
								<Appearance USE='Red'/>
							</Shape>
						</Transform>
						<Transform rotation='1 0 0 -1.57079' translation='0 1.1 0.072'>
							<Billboard>
								<Shape>
									<Appearance USE='LabelAppearance'/>
									<Text string='Z'>
										<FontStyle USE='LabelFont'/>
									</Text>
								</Shape>
							</Billboard>
						</Transform>
					</Transform>
				</Group>
			</Transform>
		</Transform>
		<Script DEF='ChangeRot' >
			<field accessType='inputOnly' type='SFRotation' name='orientation'/>
			<field accessType='outputOnly' name='CoordRot' type='SFRotation'/>
			<![CDATA[javascript: 
				function orientation(orientation){
					CoordRot= new SFRotation(orientation[0], orientation[1], orientation[2], -orientation[3]);
				}
			]]>
		<ROUTE fromNode='HereIAm' fromField='orientation_changed' toNode='ArrowsHUD' toField='rotation'/>
		<ROUTE fromNode='HereIAm' fromField='position_changed' toNode='ArrowsHUD' toField='translation'/>
		<ROUTE fromNode='HereIAm' fromField='orientation_changed' toNode='ChangeRot' toField='orientation'/>
		<ROUTE fromNode='ChangeRot' fromField='CoordRot' toNode='Arrows' toField='set_rotation'/>
</Script>
	</Scene>
</X3D>