<?php

/**
 * @copyright  Copyright 2012 metaio GmbH. All rights reserved.
 * @link       http://www.metaio.com
 * @author     Frank Angermann
 * 
 * @abstract	Using junaio to create a 360 degree experience
 * 				 				
 * 				Learnings:
 * 					- use create360Object in the Arel XML Helper
 **/
require_once '../ARELLibrary/arel_xmlhelper.class.php';
ArelXMLHelper::start(NULL, NULL, "Orientation");
//first arrow
$object360 = ArelXMLHelper::create360Object("360", "/resources/360_new.zip", "/resources/photo.JPG", array(0, 0, -1500), array(40000, 40000, 40000), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(90, 0, 0)));
//make sure the object is always rendered first. small number == draw first
//not necessary here, but might be important if you have other 360objects with transparency in the scene
$object360->setRenderOrderPosition(-1000);
ArelXMLHelper::outputObject($object360);
ArelXMLHelper::end();
 * @link       http://www.metaio.com
 * @author     Frank Angermann
 * 
 * @abstract	Your own AR Shooter
 * 				 				
 * 				Learnings:
 * 				(Simple)
 * 					- use occlusion with location based channels
 *					- advanced animation control
 *					- use the getObjectFromScreenCoordinates to determine which 3D model was hit 
 * 				(Advanced) - look for the *ADVANCED* comments
 * 					- adding new models on the fly (more troopers to shoot)
 **/
require_once '../ARELLibrary/arel_xmlhelper.class.php';
if (!empty($_GET['l'])) {
    $position = explode(",", $_GET['l']);
} else {
    trigger_error("user position (l) missing. For testing, please provide a 'l' GET parameter with your request. e.g. pois/search/?l=23.34534,11.56734,0");
}
ArelXMLHelper::start(NULL, "/arel/index.html", ArelXMLHelper::TRACKING_GPS);
//a trooper
$legoMan = ArelXMLHelper::create360Object("legoTrooper", "/resources/legoStormTrooper.zip", "/resources/legoStormTrooper.png", array(0, 2000, -1500), array(0.4, 0.4, 0.4), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(90, 0, 90)));
ArelXMLHelper::outputObject($legoMan);
//the weapon
$legoWeapon = ArelXMLHelper::createScreenFixedModel3D("legoBlaster", "/resources/legoBlaster.zip", "/resources/legoBlaster.png", ArelAnchor::ANCHOR_BR, array(1, 1, 1), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 90, 0)));
ArelXMLHelper::outputObject($legoWeapon);
//occlusion model
$box = ArelXMLHelper::create360Object("box", "/resources/occlusionBox.zip", NULL, array(0, 0, -6400), array(50, 50, 50), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(90, 0, 90)));
$box->setOccluding(true);
ArelXMLHelper::outputObject($box);
ArelXMLHelper::end();