var scriptJson=readFile("data/js/script.json"),demoScript=JSON.parse(scriptJson),sceneVariables={};function processVariables(c){if(c.hasOwnProperty("variables")){sceneVariables[c.name]=c.variables;for(var a in c.variables){var b=c.variables[a];addTwVariable(c.name,a,b.type,b.definition)}}}
function processDemoScript(){setPlaylistMusic(demoScript.music);setPlaylistLength(demoScript.totalTime);void 0!==demoScript.screen&&(setScreenDimensions(demoScript.screen.width,demoScript.screen.height),void 0!==demoScript.screen.aspectRatio?setWindowScreenAreaAspectRatio(demoScript.screen.aspectRatio.width,demoScript.screen.aspectRatio.height):setWindowScreenAreaAspectRatio(demoScript.screen.width,demoScript.screen.height));void 0!==demoScript.window&&void 0!==demoScript.window.title&&windowSetTitle(demoScript.window.title);
void 0!==demoScript.clearColor&&setClearColor(demoScript.clearColor.r,demoScript.clearColor.g,demoScript.clearColor.b,demoScript.clearColor.a);if(void 0!==demoScript.resolutions)for(var c=0;c<demoScript.resolutions.length;c++)setMenuResolution(c,demoScript.resolutions[c].width+"x"+demoScript.resolutions[c].height),!0===demoScript.resolutions[c].default&&setMenuComponentSelected(c)}
function processPlayer(){for(var c=0;void 0!==demoScript.shaderPrograms&&c<demoScript.shaderPrograms.length;c++){var a=demoScript.shaderPrograms[c];if(!0!==a.skip){addShaderProgram(a.name);for(var b=0;b<a.shaders.length;b++){var d=a.shaders[b];addShaderToProgramByName(a.name,d.name,d.filename)}}}for(c=0;c<demoScript.effects.length;c++)a=demoScript.effects[c],!0!==a.skip&&addPlayerEffect(a.name,a.reference);for(c=0;c<demoScript.scenes.length;c++)if(a=demoScript.scenes[c],!0!==a.skip&&(addPlayerScene("",
a.name,a.effect,a.startTime,a.durationTime),processVariables(a),!a.hasOwnProperty("effect")))for(b=0;b<a.scenes.length;b++)d=a.scenes[b],!0!==d.skip&&(addPlayerScene(a.name,d.name,d.effect,d.startTime,d.durationTime),processVariables(d))};var Player=function(){this.syncDefinitions={}},player=new Player;Player.prototype.isString=function(c){return"string"===typeof c||c instanceof String?!0:!1};
Player.prototype.setTimeVariables=function(c,a,b,d){this.isString(c.start)&&(c.start=convertTimeToSeconds(c.start));this.isString(c.duration)&&(c.duration=convertTimeToSeconds(c.duration));this.isString(c.end)&&(c.end=convertTimeToSeconds(c.end));void 0===c.start&&(c.start=a);void 0===c.duration&&(void 0!==c.end?c.duration=c.end-c.start:(c.duration=d,c.end=c.start+c.duration));void 0===c.end&&(c.end=c.start+c.duration)};
Player.prototype.preprocessTimeAnimation=function(c,a,b,d){if(void 0!==d)for(var g=0;g<d.length;g++){var f=d[g];this.setTimeVariables(f,c,b,a);c=f.end;a=f.duration;b=c+a}};Player.prototype.preprocess3dCoordinateAnimation=function(c,a,b,d,g){if(void 0!==d)for(b=a=c=0,void 0!==g&&(c=g.x,a=g.y,b=g.z),g=0;g<d.length;g++){var f=d[g];void 0===f.x&&(f.x=c);void 0===f.y&&(f.y=a);void 0===f.z&&(f.z=b);c=f.x;a=f.y;b=f.z}};
Player.prototype.preprocessColorAnimation=function(c,a,b,d,g){void 0!==d.sync&&void 0===d.sync.color&&(d.sync.color=!0===d.sync.all?!0:!1);var f=d=255,h=255,e=255;void 0===g&&(g=[{}]);this.preprocessTimeAnimation(c,a,b,g);for(c=0;c<g.length;c++)a=g[c],void 0===a.r&&(a.r=d),void 0===a.g&&(a.g=f),void 0===a.b&&(a.b=h),void 0===a.a&&(a.a=e),d=a.r,f=a.g,h=a.b,e=a.a};
Player.prototype.preprocessAngleAnimation=function(c,a,b,d){if(void 0!==d.angle){void 0!==d.sync&&void 0===d.sync.angle&&(d.sync.angle=!0===d.sync.all?!0:!1);this.preprocessTimeAnimation(c,a,b,d.angle);this.preprocess3dCoordinateAnimation(c,a,b,d.angle,{x:1,y:1,z:1});for(var g=b=a=c=0,f=0,h=0,e=0,l=0;l<d.angle.length;l++){var k=d.angle[l];void 0===k.degrees&&(k.degrees=c);void 0===k.degreesX&&(k.degreesX=a);void 0===k.degreesY&&(k.degreesY=b);void 0===k.degreesZ&&(k.degreesZ=g);void 0!==k.pivot?(void 0===
k.pivot.x&&(k.pivot.x=f),void 0===k.pivot.y&&(k.pivot.y=h),void 0===k.pivot.z&&(k.pivot.z=e)):(k.pivot={},k.pivot.x=f,k.pivot.y=h,k.pivot.z=e);c=k.degrees;a=k.degreesX;b=k.degreesY;g=k.degreesZ;f=k.pivot.x;h=k.pivot.y;e=k.pivot.z}}};
Player.prototype.preprocessPerspectiveAnimation=function(c,a,b,d){void 0!==d.sync&&void 0===d.sync.perspective&&(d.sync.perspective=!0===d.sync.all?!0:!1);void 0===d.perspective&&(d.perspective=[{}]);this.preprocessTimeAnimation(c,a,b,d.perspective);c=45;a=getWindowScreenAreaAspectRatio();b=1;for(var g=1E3,f=0;f<d.perspective.length;f++){var h=d.perspective[f];void 0===h.fov&&(h.fov=c);void 0===h.aspect&&(h.aspect=a);void 0===h.near&&(h.near=b);void 0===h.far&&(h.far=g);c=h.fov;a=h.aspect;b=h.near;
g=h.far}};Player.prototype.preprocessScaleAnimation=function(c,a,b,d){void 0!==d.sync&&void 0===d.sync.scale&&(d.sync.scale=!0===d.sync.all?!0:!1);void 0===d.scale&&(d.scale=[{}]);this.preprocessTimeAnimation(c,a,b,d.scale);this.preprocess3dCoordinateAnimation(c,a,b,d.scale,{x:1,y:1,z:1})};
Player.prototype.preprocessPositionAnimation=function(c,a,b,d,g){void 0!==d.position&&(void 0!==d.sync&&void 0===d.sync.position&&(d.sync.position=!0===d.sync.all?!0:!1),this.preprocessTimeAnimation(c,a,b,d.position),this.preprocess3dCoordinateAnimation(c,a,b,d.position,g))};
Player.prototype.preprocessAnimationDefinitions=function(c,a,b,d){b=c=a=c;this.preprocessColorAnimation(c,b-c,b,d,d.color);b=c=a;this.preprocessAngleAnimation(c,b-c,b,d);b=c=a;this.preprocessScaleAnimation(c,b-c,b,d);b=c=a;this.preprocessPositionAnimation(c,b-c,b,d,{x:0,y:0,z:0})};
Player.prototype.addSync=function(c){for(var a=0,b=0,d=0,g=0;g<c.length;g++){var f=c[g];this.setTimeVariables(f,a,b,d);a=f.start;b=f.end;d=b-a;void 0===f.pattern&&(f.pattern=[{}]);this.preprocessTimeAnimation(a,d,b,f.pattern);for(var h=0;h<f.pattern.length;h++){var e=f.pattern[h];e.started=!1;e.counter=0}this.syncDefinitions[f.name]=f}};
Player.prototype.addAnimation=function(c,a){for(var b="00001",d=getSceneStartTime(),g=getSceneEndTime(),f=0,h=0;h<a.length;h++){var e=a[h];void 0!==e.layer&&(b=e.layer);e.layer=b;void 0===c[b]&&(c[b]=[]);this.setTimeVariables(e,d,g,f);d=e.start;g=e.end;f=g-d;void 0!==e.sync&&void 0===e.sync.all&&(e.sync.all=!0);if(void 0!==e.object||void 0!==e.objectFunction){e.type="object";if(void 0!==e.object){if(void 0!==e.shape)if("SPHERE"===e.shape.type){var l=1;void 0!==e.shape.radius&&(l=e.shape.radius);var k=
30;void 0!==e.shape.lats&&(k=e.shape.lats);var m=30;void 0!==e.shape.longs&&(m=e.shape.longs);e.ref=setObjectSphereData(e.object,l,k,m)}else if("CYLINDER"===e.shape.type){k=1;void 0!==e.shape.base&&(k=e.shape.base);m=1;void 0!==e.shape.top&&(m=e.shape.top);var n=1;void 0!==e.shape.height&&(n=e.shape.height);l=30;void 0!==e.shape.slices&&(l=e.shape.slices);var p=30;void 0!==e.shape.stacks&&(p=e.shape.stacks);e.ref=setObjectCylinderData(e.object,k,m,n,l,p)}else if("DISK"===e.shape.type)k=0,void 0!==
e.shape.inner&&(k=e.shape.inner),m=1,void 0!==e.shape.outer&&(m=e.shape.outer),l=30,void 0!==e.shape.slices&&(l=e.shape.slices),n=30,void 0!==e.shape.loops&&(n=e.shape.loops),e.ref=setObjectDiskData(e.object,k,m,l,n);else if("CUBE"===e.shape.type)e.ref=setObjectCubeData(e.object);else{if("MATRIX"===e.shape.type||"CUSTOM"===e.shape.type)e.ref=loadObjectBasicShape(e.object,e.shape.type)}else e.ref=loadObject(e.object);!1===e.objectLighting&&useObjectLighting(e.ref.ptr,0);!1===e.objectCamera&&useObjectCamera(e.ref.ptr,
0)}void 0===e.fps&&(e.fps=0);void 0===e.camera&&(e.camera="Camera01");e.clearDepthBuffer=void 0===e.clearDepthBuffer?0:!0===e.clearDepthBuffer?1:0;l=d;k=g;m=k-l;this.preprocessAnimationDefinitions(l,m,k,e)}else void 0!==e.image?(e.type="image",e.ref=imageLoadImage(e.image),l=d,k=g,m=k-l,this.preprocessAnimationDefinitions(l,m,k,e)):void 0!==e.text?(e.type="text",void 0===e.text.perspective?e.text.perspective="2d":"3d"===e.text.perspective&&(e.clearDepthBuffer=void 0===e.clearDepthBuffer?0:!0===e.clearDepthBuffer?
1:0),l=d,k=g,m=k-l,this.preprocessAnimationDefinitions(l,m,k,e)):void 0!==e.fbo?(e.type="fbo",void 0===e.fbo.name&&(e.fbo.name="fbo"),e.ref=fboInit(e.fbo.name)):void 0!==e.light?(e.type="light",k=l=d,m=k-l,this.preprocessPositionAnimation(l,m,k,e,{x:0,y:0,z:1}),void 0!==e.ambientColor&&(k=l=d,m=k-l,this.preprocessColorAnimation(l,m,k,e,e.ambientColor)),void 0!==e.diffuseColor&&(k=l=d,m=k-l,this.preprocessColorAnimation(l,m,k,e,e.diffuseColor)),void 0!==e.specularColor&&(k=l=d,m=k-l,this.preprocessColorAnimation(l,
m,k,e,e.specularColor))):void 0!==e.camera&&(e.type="camera",k=l=d,m=k-l,this.preprocessPerspectiveAnimation(l,m,k,e),k=l=d,m=k-l,this.preprocessPositionAnimation(l,m,k,e,{x:0,y:0,z:2}),k=l=d,m=k-l,void 0!==e.sync&&void 0===e.sync.target&&(e.sync.target=!0===e.sync.all?!0:!1),this.preprocessTimeAnimation(l,m,k,e.target),this.preprocess3dCoordinateAnimation(l,m,k,e.target,{x:0,y:0,z:0}),k=l=d,m=k-l,void 0!==e.sync&&void 0===e.sync.up&&(e.sync.up=!0===e.sync.all?!0:!1),this.preprocessTimeAnimation(l,
m,k,e.up),this.preprocess3dCoordinateAnimation(l,m,k,e.up,{x:0,y:1,z:0}));void 0!==e.initFunction&&this.evaluateVariable(e,e.initFunction);c[b].push(e);d=g;g=d+f}return Object.keys(c).sort().reduce(function(a,b){a[b]=c[b];return a},{})};Player.prototype.evaluateVariable=function(c,a){return this.isString(a)&&"{"===a.charAt(0)?(new Function("animation",a))(c):a};
Player.prototype.enableShader=function(c){if(void 0!==c.shader&&(activateShaderProgram(c.shader.name),void 0!==c.shader.variables))for(var a=getUniformLocation,b=setUniformInt,d=setUniformFloat,g=c.shader.variables.length,f=0;f<g;f++){var h=c.shader.variables[f],e=a(h.name),l=this.evaluateVariable(c,h.value);"int"===h.type?b(e,l):d(e,l)}};Player.prototype.disableShader=function(c){void 0!==c.shader&&disableShaderProgram()};
Player.prototype.calculate3dCoordinateAnimation=function(c,a,b){var d={x:0,y:0,z:0};void 0!==b&&(d.x=b.x,d.y=b.y,d.z=b.z,void 0===b.sync&&void 0!==a.sync&&(b.sync=a.sync));if(void 0!==a){d.x=this.evaluateVariable(a,a[0].x);d.y=this.evaluateVariable(a,a[0].y);d.z=this.evaluateVariable(a,a[0].z);if(void 0!==a.sync&&!0===b.sync&&(c=a.start+a.duration*a.sync.progress,0==a.sync.progress))return d;b=interpolateLinear;for(var g=a.length,f=0;f<g;f++){var h=a[f];if(c>=h.start){var e=(c-h.start)/h.duration;
d.x=b(e,d.x,this.evaluateVariable(a,h.x));d.y=b(e,d.y,this.evaluateVariable(a,h.y));d.z=b(e,d.z,this.evaluateVariable(a,h.z))}}}return d};Player.prototype.calculateScaleAnimation=function(c,a){return this.calculate3dCoordinateAnimation(c,a.scale,{x:1,y:1,z:1})};Player.prototype.calculatePositionAnimation=function(c,a){return this.calculate3dCoordinateAnimation(c,a.position,{x:0,y:0,z:0})};
Player.prototype.calculatePerspectiveAnimation=function(c,a){var b={fov:45,aspect:getWindowScreenAreaAspectRatio(),near:1,far:1E3};if(void 0!==a.perspective){b.fov=this.evaluateVariable(a,a.perspective[0].fov);b.aspect=this.evaluateVariable(a,a.perspective[0].aspect);b.near=this.evaluateVariable(a,a.perspective[0].near);b.far=this.evaluateVariable(a,a.perspective[0].far);var d=c;if(void 0!==a.sync&&!0===a.sync.perspective&&(d=a.start+a.duration*a.sync.progress,0==a.sync.progress))return b;for(var g=
interpolateLinear,f=a.perspective.length,h=0;h<f;h++){var e=a.perspective[h];if(d>=e.start){var l=(d-e.start)/e.duration;b.fov=g(l,b.fov,this.evaluateVariable(a,e.fov));b.aspect=g(l,b.aspect,this.evaluateVariable(a,e.aspect));b.near=g(l,b.near,this.evaluateVariable(a,e.near));b.far=g(l,b.far,this.evaluateVariable(a,e.far))}}}return b};
Player.prototype.calculateColorAnimation=function(c,a,b){var d={r:255,g:255,b:255,a:255};if(void 0!==b){d.r=this.evaluateVariable(b,b[0].r);d.g=this.evaluateVariable(b,b[0].g);d.b=this.evaluateVariable(b,b[0].b);d.a=this.evaluateVariable(b,b[0].a);if(void 0!==a.sync&&!0===a.sync.color&&(c=a.start+a.duration*a.sync.progress,0==a.sync.progress))return d;for(var g=interpolateLinear,f=0;f<b.length;f++){var h=b[f];if(c>=h.start){var e=(c-h.start)/h.duration;d.r=g(e,d.r,this.evaluateVariable(a,h.r));d.g=
g(e,d.g,this.evaluateVariable(a,h.g));d.b=g(e,d.b,this.evaluateVariable(a,h.b));d.a=g(e,d.a,this.evaluateVariable(a,h.a))}}}return d};
Player.prototype.calculateAngleAnimation=function(c,a){var b={degrees:0,degreesX:0,degreesY:0,degreesZ:0,x:1,y:1,z:1,pivot:{x:0,y:0,z:0}};if(void 0!==a.angle){b.degrees=this.evaluateVariable(a,a.angle[0].degrees);b.degreesX=this.evaluateVariable(a,a.angle[0].degreesX);b.degreesY=this.evaluateVariable(a,a.angle[0].degreesY);b.degreesZ=this.evaluateVariable(a,a.angle[0].degreesZ);b.x=this.evaluateVariable(a,a.angle[0].x);b.y=this.evaluateVariable(a,a.angle[0].y);b.z=this.evaluateVariable(a,a.angle[0].z);
b.pivot.x=this.evaluateVariable(a,a.angle[0].pivot.x);b.pivot.y=this.evaluateVariable(a,a.angle[0].pivot.y);b.pivot.z=this.evaluateVariable(a,a.angle[0].pivot.z);var d=c;if(void 0!==a.sync&&!0===a.sync.angle&&(d=a.start+a.duration*a.sync.progress,0==a.sync.progress))return b;for(var g=interpolateLinear,f=a.angle.length,h=0;h<f;h++){var e=a.angle[h];if(d>=e.start){var l=(d-e.start)/e.duration;b.degrees=g(l,b.degrees,this.evaluateVariable(a,e.degrees));b.degreesX=g(l,b.degreesX,this.evaluateVariable(a,
e.degreesX));b.degreesY=g(l,b.degreesY,this.evaluateVariable(a,e.degreesY));b.degreesZ=g(l,b.degreesZ,this.evaluateVariable(a,e.degreesZ));b.x=g(l,b.x,this.evaluateVariable(a,e.x));b.y=g(l,b.y,this.evaluateVariable(a,e.y));b.z=g(l,b.z,this.evaluateVariable(a,e.z));b.pivot.x=g(l,b.pivot.x,this.evaluateVariable(a,e.pivot.x));b.pivot.y=g(l,b.pivot.y,this.evaluateVariable(a,e.pivot.y));b.pivot.z=g(l,b.pivot.z,this.evaluateVariable(a,e.pivot.z))}}}return b};
Player.prototype.drawImageAnimation=function(c,a){!0===a.additive&&setTextureBlendFunc(a.ref.ptr,GL_SRC_ALPHA,GL_ONE);if(void 0!==a.angle){var b=this.calculateAngleAnimation(c,a);setTexturePivotPixel(a.ref.ptr,b.pivot.x,b.pivot.y);setTextureAngle(a.ref.ptr,b.degrees)}b=this.calculateScaleAnimation(c,a);scaleTexture(a.ref.ptr,b.x,b.y);if(void 0!==a.position){var d=this.calculatePositionAnimation(c,a),g=d.x,f=d.y;demoScript.kanttuCompatibility&&(f=-(a.ref.h*b.y)/2,g=-(a.ref.w*b.x)/2+d.x,f=getScreenHeight()-
(d.y-f));setTexturePositionPixel(a.ref.ptr,g,f)}else alignTextureCenter(a.ref.ptr,1);b=this.calculateColorAnimation(c,a,a.color);glColor4ub(b.r,b.g,b.b,b.a);showImage(a.ref.ptr);setTextureDefaults(a.ref.ptr)};
Player.prototype.drawTextAnimation=function(c,a){setDrawTextString(a.text.string);if(void 0!==a.angle){var b=this.calculateAngleAnimation(c,a);setTextPivot(b.pivot.x,b.pivot.y,b.pivot.z);"2d"===a.text.perspective?setTextRotation(0,0,b.degrees):setTextRotation(b.degreesX,b.degreesY,b.degreesZ)}b=this.calculateScaleAnimation(c,a);setTextSize(b.x,b.y);if("2d"===a.text.perspective)if(void 0!==a.position){var d=f.x,g=f.y;demoScript.kanttuCompatibility&&(d=-(getTextStringWidth()*b.x)/2,b=-(getTextStringHeight()*
b.y)/2,d+=f.x,g=getScreenHeight()-(f.y-b));setTextPosition(d,g,0)}else alignTextCenter(1);else if(void 0!==a.position){var f=this.calculatePositionAnimation(c,a);setTextPosition(f.x,f.y,f.z)}f=this.calculateColorAnimation(c,a,a.color);glColor4ub(f.r,f.g,f.b,f.a);"2d"===a.text.perspective?drawText2d():(a.clearDepthBuffer&&glClear(GL_DEPTH_BUFFER_BIT),drawText3d());setTextDefaults()};
Player.prototype.drawObjectAnimation=function(c,a){var b=!1;if(void 0!==a.ref){if(void 0!==a.position){var d=this.calculatePositionAnimation(c,a);setObjectPosition(a.ref.ptr,d.x,d.y,d.z)}void 0!==a.angle&&(d=this.calculateAngleAnimation(c,a),setObjectPivot(a.ref.ptr,d.pivot.x,d.pivot.y,d.pivot.z),setObjectRotation(a.ref.ptr,d.degreesX,d.degreesY,d.degreesZ,d.x,d.y,d.z));void 0!==a.scale&&(d=this.calculateScaleAnimation(c,a),setObjectScale(a.ref.ptr,d.x,d.y,d.z));void 0!==a.color&&(d=this.calculateColorAnimation(c,
a,a.color),setObjectColor(a.ref.ptr,d.r/255,d.g/255,d.b/255,d.a/255));var d=a.camera,g=(c-a.start)*a.fps;void 0!==a.frame&&(g=a.frame);var f=a.clearDepthBuffer;void 0!==a.shape&&"CUSTOM"===a.shape.type&&(b=!0);b&&glPushMatrix();displayObject(a.ref.ptr,d,g,f)}void 0!==a.objectFunction&&this.evaluateVariable(a,a.objectFunction);b&&glPopMatrix()};
Player.prototype.drawFboAnimation=function(c,a){"begin"===a.fbo.action?(fboBind(a.ref.ptr),fboUpdateViewport(a.ref.ptr)):"end"===a.fbo.action&&(fboBind(),fboUpdateViewport(),fboBindTextures(a.ref.ptr),fboDrawFullScreen(a.ref.ptr),fboBindTextures())};
Player.prototype.drawLightAnimation=function(c,a){if(void 0!==a.ambientColor){var b=this.calculateColorAnimation(c,a,a.ambientColor);lightSetAmbientColor(a.light.index,b.r/255,b.g/255,b.b/255,b.a/255)}void 0!==a.diffuseColor&&(b=this.calculateColorAnimation(c,a,a.diffuseColor),lightSetDiffuseColor(a.light.index,b.r/255,b.g/255,b.b/255,b.a/255));void 0!==a.specularColor&&(b=this.calculateColorAnimation(c,a,a.specularColor),lightSetSpecularColor(a.light.index,b.r/255,b.g/255,b.b/255,b.a/255));void 0!==
a.position&&(b=this.calculate3dCoordinateAnimation(c,a.position,{x:0,y:0,z:1}),lightSetPosition(a.light.index,b.x,b.y,b.z));lightSetPositionObject(a.light.index);void 0!==a.positionObject?lightSetPositionObject(a.light.index,a.positionObject.ptr):void 0!==a.lightRelativePosition&&(a.positionObject=getObjectFromMemory(a.lightRelativePosition));"begin"==a.light.action?lightSetOn(a.light.index):"end"==a.light.action&&lightSetOff(a.light.index)};
Player.prototype.drawCameraAnimation=function(c,a){if(void 0!==a.perspective){var b=this.calculatePerspectiveAnimation(c,a);setCameraPerspective(b.fov,b.aspect,b.near,b.far)}void 0!==a.position&&(b=this.calculate3dCoordinateAnimation(c,a.position,{x:0,y:0,z:2}),setCameraPosition(b.x,b.y,b.z));void 0!==a.target&&(b=this.calculate3dCoordinateAnimation(c,a.target,{x:0,y:0,z:0}),setCameraLookAt(b.x,b.y,b.z));void 0!==a.up&&(b=this.calculate3dCoordinateAnimation(c,a.up,{x:0,y:1,z:0}),setCameraUpVector(b.x,
b.y,b.z));setCameraPositionObject();void 0!==a.positionObject?setCameraPositionObject(a.positionObject.ptr):void 0!==a.cameraRelativePosition&&(a.positionObject=getObjectFromMemory(a.cameraRelativePosition));setCameraTargetObject();void 0!==a.targetObject?setCameraTargetObject(a.targetObject.ptr):void 0!==a.cameraRelativeTarget&&(a.targetObject=getObjectFromMemory(a.cameraRelativeTarget));viewReset()};
Player.prototype.calculateAnimationSync=function(c,a){if(void 0!==a.sync){var b=this.syncDefinitions[a.sync.name];if(void 0!==b){var d=c%b.end;a.sync.progress=0;for(var g=b.pattern.length,f=0;f<g;f++){var h=b.pattern[f];h.started&&h.startTime+h.duration<c&&(h.started=!1);if(d>=h.start&&d<h.end){a.sync.progress=(d-h.start)/h.duration;1<a.sync.progress&&(a.sync.progress=1);h.started||(h.started=!0,h.startTime=c,void 0!==h.syncStartFunction?this.evaluateVariable(a,h.syncStartFunction):void 0!==b.syncStartFunction&&
this.evaluateVariable(a,b.syncStartFunction));void 0!==h.syncRunFunction?this.evaluateVariable(a,h.syncRunFunction):void 0!==b.syncRunFunction&&this.evaluateVariable(a,b.syncRunFunction);break}}}}};
Player.prototype.drawAnimation=function(c){var a=getSceneTimeFromStart(),b;for(b in c){glPushMatrix();if(c.hasOwnProperty(b))for(var d=c[b].length,g=0;g<d;g++){var f=c[b][g];a>=f.start&&a<f.end&&(this.calculateAnimationSync(a,f),this.enableShader(f),"image"===f.type?this.drawImageAnimation(a,f):"text"===f.type?this.drawTextAnimation(a,f):"object"===f.type?this.drawObjectAnimation(a,f):"fbo"===f.type?this.drawFboAnimation(a,f):"light"==f.type?this.drawLightAnimation(a,f):"camera"==f.type&&this.drawCameraAnimation(a,
f),void 0!==f.runFunction&&this.evaluateVariable(f,f.runFunction),this.disableShader(f))}glPopMatrix()}};
