//includy definic funkci
include("paramevent.js");
include("loadscene.js");
include("runmodule.js");
include("visibility.js");
include("commandevent.js");


var sceneID = loadScene("../data/Tracks/hud-test/dalnice-all.vrut", 10000);
var scene = Scene.GetScene(sceneID);
var seatCameraID = scene.GetNodes("seat_camera");
var hudCameraID = scene.GetNodes("hud_camera");


//hlavní kamera
var cameraID = renderScene(sceneID, 20000);
scene.SetTransformation(cameraID, new Matrix(1, 0, 0, 0,
					     0, 1, 0, 0,
					     0, 0, 1, 0,
					     0, 0, 0, 1));


scene.Move(cameraID, seatCameraID[0].GetID());


//kamera pro HUD
var hudRootID = scene.GetNodes("AR_HUD")[0].GetID();
updateInstParamValue("RenderGl", "renderingRootID", "predef", hudRootID);
var cameraHudID = renderScene(sceneID, 20000);

scene.SetTransformation(cameraHudID, new Matrix(1, 0, 0, 0,
					     0, 1, 0, 0,
					     0, 0, 1, 0,
					     2000, 0, 0, 1));
scene.Move(cameraHudID, hudCameraID[0].GetID());


Event.GET_EVT_RENDER_FULLSCREEN_SET(1, 1, 0, 0, 512, 512, 0).PostToKernel();

var tickInterval = 50;
RegisterTimer(new Tick(), tickInterval);

function Tick() {
    this.perform = function () {
//		LOG("Tick " + tickInterval);		
		Event.GET_EVT_RENDER_IMAGE(sceneID, cameraHudID, -1, -1, "..\\data\\Tracks\\hud-test\\arhud-glass.png", false, true).PostToKernel();
    return tickInterval;
				}
		}

