Пример #1
0
/**
 * This function is wrapper on the ARELXMLHelper class to offer localization and make POIs creation process easy
 * @param $objects_array: array of POIs object
 * @param string $lang: Language of the phone for localization
 * @param null $html_page: The Html page path to show in your channel if any
 */
function createLocationBasedAREL($objects_array, $lang = 'en', $html_page = NULL)
{
    //getting language pack according to the user specified language
    $translator = new JsonTranslator($lang);
    $language_pack = $translator->getLanguagePack(LANGUAGE_INFO);
    if ($lang != 'en') {
        //getting language pack for english so that if the user specified language pack don't have a specific word, then the english word can be used.
        $language_pack_en = self::getLocals(array('en'));
    }
    ArelXMLHelper::start(NULL, $html_page, ArelXMLHelper::TRACKING_GPS);
    if (!empty($objects_array)) {
        foreach ($objects_array as $object) {
            $popup = $object->getPopup();
            $buttons = $popup->getButtons();
            $new_buttons_array = array();
            foreach ($buttons as $button) {
                if (isset($language_pack[$button[0]])) {
                    $button[0] = utf8_encode($language_pack[$button[0]]);
                } elseif (isset($language_pack_en[$button[0]])) {
                    $button[0] = utf8_encode($language_pack_en[$button[0]]);
                }
                array_push($new_buttons_array, $button);
            }
            $popup->setButtons($new_buttons_array);
            $object->setPopup($popup);
            ArelXMLHelper::outputObject($object);
        }
    }
    ArelXMLHelper::end();
}
Пример #2
0
<?php

require_once 'ARELLibrary/arel_xmlhelper.class.php';
//start output
ArelXMLHelper::start(NULL, "loading.html", "assets/Tracking.zip");
$deer = ArelXMLHelper::createGLUEModel3D("1", "assets/deer.obj", "assets/dog_uvw_02.png", array(0, -100, 0), array(3, 3, 3), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 0, 0)), 1);
$sheep = ArelXMLHelper::createGLUEModel3D("2", "assets/sheep.obj", "assets/sheep_uvw_02.png", array(0, -100, 0), array(3, 3, 3), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(-90, 0, 0)), 2);
$tricycle = ArelXMLHelper::createGLUEModel3D("3", "assets/tricycle.obj", "assets/tricycle_uvw_tex.png", array(0, -100, 0), array(3, 3, 3), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(90, 0, 0)), 3);
// $doll = ArelXMLHelper::createGLUEModel3D(
// "3",	//ID
// "assets/dolls.mfbx", //model Path
// "assets/tricycle_uvw_tex.png", //texture Path
// array(0,-100,0), //translation
// array(3,3,3), //scale
// new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(90,0,0)), //rotation
// 4 //CoordinateSystemID
// );
//output the object
ArelXMLHelper::outputObject($deer);
ArelXMLHelper::outputObject($sheep);
ArelXMLHelper::outputObject($tricycle);
// ArelXMLHelper::outputObject($doll);
//end the output
ArelXMLHelper::end();
Пример #3
0
<?php

require_once 'ARELLibrary/arel_xmlhelper.class.php';
//start output
ArelXMLHelper::start(NULL, "FrntEnd.html", "assets/Tracking.zip");
$deer = ArelXMLHelper::createGLUEModel3D("deer", "assets/deer.obj", "assets/dog_uvw_02.png", array(0, -100, 0), array(3, 3, 3), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 0, 0)), 1);
$sheep = ArelXMLHelper::createGLUEModel3D("sheep", "assets/sheep.obj", "assets/sheep_uvw_02.png", array(0, -100, 0), array(3, 3, 3), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 0, 0)), 2);
$tricycle = ArelXMLHelper::createGLUEModel3D("tryc", "assets/tricycle.obj", "assets/tricycle_uvw_tex.png", array(0, -100, 0), array(3, 3, 3), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 0, 0)), 3);
$doll = ArelXMLHelper::createGLUEModel3D("metaio", "assets/metaioman.md2", "assets/metaioman.png", array(0, -100, 0), array(3, 3, 3), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 0, 0)), 4);
//output the object
ArelXMLHelper::outputObject($deer);
ArelXMLHelper::outputObject($sheep);
ArelXMLHelper::outputObject($tricycle);
ArelXMLHelper::outputObject($doll);
//end the output
ArelXMLHelper::end();
Пример #4
0
 *  			start over! 
 **/
error_reporting(E_ALL);
//for displaying errors
ini_set("display_errors", 1);
require_once '../ARELLibrary/arel_xmlhelper.class.php';
//use the Arel Helper to start the output with arel
//start output
ArelXMLHelper::start(NULL, "arel/index.html", "resources/tracking_tutorial.zip");
//metaio man 3D Model
//Important: note how it is set to transparent
$oObject = ArelXMLHelper::createGLUEModel3D("mMan", "resources/metaioman.md2", "resources/metaioman.png", array(-150, -100, 0), array(2, 2, 2), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 0, 90)), 1);
//set the object transparent
$oObject->setTransparency(1);
//return the model
ArelXMLHelper::outputObject($oObject);
//2. a trooper model
//note the additional parameter that is used in AREL JS
$oObject = ArelXMLHelper::createGLUEModel3D("lTrooper", "resources/legoStormTrooper.zip", "resources/legoStormTrooper.png", array(150, -100, 0), array(0.1, 0.1, 0.1), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(90, 0, 0)), 1);
//the sound will be needed in AREL JS once the anmation starts
$oObject->addParameter("appearSound", "resources/beam.mp3");
//return the model
ArelXMLHelper::outputObject($oObject);
//the occlusion box, making the trooper invisible for the time it has not appeared
$box = ArelXMLHelper::createGLUEModel3D("box", "resources/occlusionBox.zip", NULL, array(0, -350, -350), array(7, 7, 7), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 0, 0)), 1);
//this model is set as a occlusion model
$box->setOccluding(true);
//output the object
ArelXMLHelper::outputObject($box);
//end the output
ArelXMLHelper::end();
Пример #5
0
 * 					- show html information on which image to track
 * 					- hide and display the "what to track" information based on tracking events
 * 					- start an animation based on touchstart (click) event of the object
 * 					- start an animation based on animation ended event of the object 
 **/
error_reporting(E_ALL);
ini_set('display_errors', '1');
require_once '../ARELLibrary/arel_xmlhelper.class.php';
//use the Arel Helper to start the output with arel
//start output
ArelXMLHelper::start(NULL, "arel.html", NULL);
//Create the blaster
$id = "blaster";
$model = "legoBlaster.zip";
$texture = "legoBlaster.png";
$screenAnchor = ArelAnchor::ANCHOR_BR;
$scale = array(0.75, 0.75, 0.75);
$rotation = array(0, 90, 0);
$oObject = ArelXMLHelper::createScreenFixedModel3D($id, $model, $texture, $screenAnchor, $scale, new ArelRotation(ArelRotation::ROTATION_EULERDEG, $rotation));
ArelXMLHelper::outputObject($oObject);
//Create the Crosshair
$id = "fadenkreuz";
$model = "";
$texture = "fadenkreuz.png";
$screenAnchor = ArelAnchor::ANCHOR_CC;
$scale = array(1, 1, 1);
$rotation = array(0, 0, 0);
$oObject = ArelXMLHelper::createScreenFixedModel3D($id, $model, $texture, $screenAnchor, $scale, new ArelRotation(ArelRotation::ROTATION_EULERDEG, $rotation));
ArelXMLHelper::outputObject($oObject);
//end the output
ArelXMLHelper::end();
Пример #6
0
 * 
 * @abstract	This tutorial will create a simple scavenger hunt. The user is provided with several markings in his environment. Once he is close to one of those,
 * 				he/she can hit the scan button and scan the glue man to find a treasure. 
 * 				 				
 * 				Learnings:
 * 					- GUI buttons
 * 					- switching between GLUE and Location Based information
 * 					- tracking handling
 **/
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");
}
//create the xml start
ArelXMLHelper::start(NULL, "arel/index.html", NULL);
//start by defining some positions of geo referenced POIs and give those names and thumbnails
$treasureLocations = array(array("37.772547,-122.418437,0", "San Francisco", "NorthAmerica"), array("48.160747,11.551219,0", "Munich", "Europe"), array("48.857261,2.3493,0", "Paris", "Europe"), array("40.73269,-73.995094,0", "New York", "NorthAmerica"), array("-33.92399,18.463669,0", "Cape Town", "Africa"), array("30.062557,31.246433,0", "Cairo", "Africa"), array("-37.813107,144.96304,0", "Melbourne", "Australia"), array("3.139145,101.689396,0", "Kuala Lumpur", "Asia"), array("35.685187,139.692306,0", "Tokio", "Asia"), array("19.019279,72.849541,0", "Mumbai", "Asia"), array("-12.042007,-77.040482,0", "Lima", "SouthAmerica"), array("51.493355,-0.127945,0", "London", "Europe"));
//display the POIs as defined in the Constructor
foreach ($treasureLocations as $i => $findPOI) {
    //title of the POI
    $title = "Treasure " . $findPOI[1];
    //create the POI
    $poi = ArelXMLHelper::createLocationBasedPOI($i, $title, explode(",", $findPOI[0]), "thumb.png", "icon.png", "A beautiful city", NULL);
    //20000km -> 20'000'000m -> see them all over the world
    $poi->setMaxDistance(20000000);
    ArelXMLHelper::outputObject($poi);
}
ArelXMLHelper::end();
exit;
Пример #7
0
<?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();
Пример #8
0
    //position the cards
    $y = 150 * floor($i / CARDS_PER_ROW) - 200;
    $x = 150 * ($i % CARDS_PER_ROW) - 250;
    //get the texture -> texture name is one for the odd ones (so 1 and 2 have the same texture, texture is only 1)
    //you can check the resources folder: e.g. texture_1.png, texture_3.png, etc...
    $j = $cardIDs[$i];
    if ($cardIDs[$i] % 2 == 0) {
        $j = $cardIDs[$i] - 1;
    }
    //create the memory card
    $memoryCard = ArelXMLHelper::createGLUEModel3D($cardIDs[$i], "resources/memory.zip", "resources/texture_{$j}.png", array($x, $y, 0), array(3, 3, 3), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(0, 0, 0)), 1);
    //add a parameter to the memory Card to which model shall be opened once the matching pair is found
    //see further down ($foundModel)
    $memoryCard->addParameter("foundModelID", "model_{$j}");
    //output the memory card one by one
    ArelXMLHelper::outputObject($memoryCard);
}
//the models if a match was found
$aModelIDs = array("model_1", "model_3", "model_5", "model_7", "model_9", "model_11", "model_13", "model_15");
//return all the models to be opened
foreach ($aModelIDs as $model) {
    //return the model to be found -> scale them really tiny, so they are not seen
    $foundModel = ArelXMLHelper::createGLUEModel3D($model, "resources/models/{$model}.zip", NULL, array(0, 0, 0), array(0.01, 0.01, 0.01), new ArelRotation(ArelRotation::ROTATION_EULERDEG, array(90, 0, 90)), 1);
    //currently, we have to make sure the sound is being downloaded -> add it to the parameter
    //if only referenced in AREL JS, it will not be downloaded
    //this sound will be played when the model is found
    $foundModel->addParameter("soundFound", "resources/sound/{$model}.mp3");
    //output
    ArelXMLHelper::outputObject($foundModel);
}
ArelXMLHelper::end();