<?xml version="1.0" encoding="UTF-8"?>
<X3D>
	<Engine DEF='engine'>
		<TimerJob DEF='timer'/>
		<SynchronizeJob DEF='synchronize'/>
		<RenderJob DEF='render'>
			<WindowGroup>
				<Window position='10 50' size='640,480' fullScreen='false' />
			</WindowGroup>
		</RenderJob>
	</Engine>

	<Scene DEF='scene'>

		<IOSensor DEF='VisionLib' type='VisionLib' configFile='SfMReconTracker.pm'>
			<field accessType='outputOnly' name='InstantVideo' type='SFImage'/>
			<field accessType='outputOnly' name='InstantCamera_Valid' type='SFBool'/>
			<field accessType='outputOnly' name='InstantCamera_CAM_aspect' type='SFFloat'/>
			<field accessType='outputOnly' name='InstantCamera_PrincipalPoint' type='SFVec2f'/>
			<field accessType='outputOnly' name='InstantCamera_FOV_vertical' type='SFFloat'/>
			<field accessType='outputOnly' name='InstantCamera_FOV_horizontal' type='SFFloat'/>
			<field accessType='outputOnly' name='InstantCamera_ModelView' type='SFMatrix4f'/>
		</IOSensor>

		<!-- camera settings, camera is not realy transformed, only intrinsics are set here -->
		<Viewpoint DEF='vp' position='0 0 0' fovMode='VERTICAL'/>
		<ROUTE fromNode='VisionLib' fromField='InstantCamera_FOV_vertical' toNode='vp' toField='fieldOfView'/>
		<ROUTE fromNode='VisionLib' fromField='InstantCamera_PrincipalPoint' toNode='vp' toField='principalPoint'/>
		<ROUTE fromNode='VisionLib' fromField='InstantCamera_CAM_aspect' toNode='vp' toField='aspect'/>

		<!-- background image-->
		<PolygonBackground fixedImageSize='640 480' mode='VERTICAL'>
			<Appearance>
				<PixelTexture2D DEF='tex' autoScale='false' envMode='replace' minFilter='nearest' magFilter='nearest'/>
					<TextureTransform scale='1 -1'/>
			</Appearance>
		</PolygonBackground>
		<ROUTE fromNode='VisionLib' fromField='InstantVideo' toNode='tex' toField='set_image'/>

		<NavigationInfo type='NONE' interactionType='NONE'/>

		<!-- the objects will be transformed with inverse of tracked camera transformation -->
		<MatrixTransform DEF='InstantCameraRelativeToCamPosition' invert='FALSE'>
        
            <Transform DEF='InstantCameraRtransObjRelativeToMarker' translation='0 0 0' rotation='1 0 0 0' scale='1 1 1'>
				<Inline url = ".\model\HouseModel.x3d"/>
			</Transform>
            
		</MatrixTransform>

		<ROUTE fromNode='VisionLib' fromField='InstantCamera_ModelView' toNode='InstantCameraRelativeToCamPosition' toField='matrix'/>
		<!-- camera valid field used to turn on/off shape rendering -->
		<ROUTE fromNode='VisionLib' fromField='InstantCamera_Valid' toNode='InstantCameraRelativeToCamPosition' toField='render'/>

	</Scene>
</X3D>