text: /*!
   * New BSD License
   *
   * Copyright (c) 2011, Morten Nobel-Joergensen, Kickstart Games ( http://www.kickstartgames.com/ )
   * All rights reserved.
   *
   * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
   * following conditions are met:
   *
   * - Redistributions of source code must retain the above copyright notice, this list of conditions and the following
   * disclaimer.
   * - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following
   * disclaimer in the documentation and/or other materials provided with the distribution.
   *
   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
   * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   *
   * -----
   * KICK.math is based on
   * glMatrix.js - High performance matrix and vector operations for WebGL
   * http://code.google.com/p/glmatrix/
   * version 0.9.6
   *
   * Copyright (c) 2011 Brandon Jones
   *
   * This software is provided 'as-is', without any express or implied
   * warranty. In no event will the authors be held liable for any damages
   * arising from the use of this software.
   *
   * Permission is granted to anyone to use this software for any purpose,
   * including commercial applications, and to alter it and redistribute it
   * freely, subject to the following restrictions:
   *
   *    1. The origin of this software must not be misrepresented; you must not
   *    claim that you wrote the original software. If you use this software
   *    in a product, an acknowledgment in the product documentation would be
   *    appreciated but is not required.
   *
   *    2. Altered source versions must be plainly marked as such, and must not
   *    be misrepresented as being the original software.
   *
   *    3. This notice may not be removed or altered from any source
   *    distribution.
   */
   'use strict';var KICK=KICK||{};KICK.namespace=KICK.namespace||function(g){var g=g.split("."),l=KICK,h;"KICK"===g[0]&&(g=g.slice(1));for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.core");g.Constants={};Object.defineProperties(g.Constants,{_VERSION:{value:"0.0.0",configurable:!0,enumerable:!0},_ASSERT:{value:!0,enumerable:!0,configurable:!0},_DEBUG:{value:!0,enumerable:!0,configurable:!0},_DEGREE_TO_RADIAN:{value:0.01745329251994,enumerable:!0},_RADIAN_TO_DEGREE:{value:57.2957795130824,enumerable:!0},_EPSILON:{value:1.0E-5,enumerable:!0},_LIGHT_TYPE_AMBIENT:{value:1,enumerable:!0},_LIGHT_TYPE_DIRECTIONAL:{value:2,enumerable:!0},_LIGHT_TYPE_POINT:{value:3,
  enumerable:!0},GL_DEPTH_BUFFER_BIT:{value:256,enumerable:!0},GL_STENCIL_BUFFER_BIT:{value:1024,enumerable:!0},GL_COLOR_BUFFER_BIT:{value:16384,enumerable:!0},GL_POINTS:{value:0,enumerable:!0},GL_LINES:{value:1,enumerable:!0},GL_LINE_LOOP:{value:2,enumerable:!0},GL_LINE_STRIP:{value:3,enumerable:!0},GL_TRIANGLES:{value:4,enumerable:!0},GL_TRIANGLE_STRIP:{value:5,enumerable:!0},GL_TRIANGLE_FAN:{value:6,enumerable:!0},GL_ZERO:{value:0,enumerable:!0},GL_ONE:{value:1,enumerable:!0},GL_SRC_COLOR:{value:768,
  enumerable:!0},GL_ONE_MINUS_SRC_COLOR:{value:769,enumerable:!0},GL_SRC_ALPHA:{value:770,enumerable:!0},GL_ONE_MINUS_SRC_ALPHA:{value:771,enumerable:!0},GL_DST_ALPHA:{value:772,enumerable:!0},GL_ONE_MINUS_DST_ALPHA:{value:773,enumerable:!0},GL_DST_COLOR:{value:774,enumerable:!0},GL_ONE_MINUS_DST_COLOR:{value:775,enumerable:!0},GL_SRC_ALPHA_SATURATE:{value:776,enumerable:!0},GL_FUNC_ADD:{value:32774,enumerable:!0},GL_BLEND_EQUATION:{value:32777,enumerable:!0},GL_BLEND_EQUATION_RGB:{value:32777,enumerable:!0},
  GL_BLEND_EQUATION_ALPHA:{value:34877,enumerable:!0},GL_FUNC_SUBTRACT:{value:32778,enumerable:!0},GL_FUNC_REVERSE_SUBTRACT:{value:32779,enumerable:!0},GL_BLEND_DST_RGB:{value:32968,enumerable:!0},GL_BLEND_SRC_RGB:{value:32969,enumerable:!0},GL_BLEND_DST_ALPHA:{value:32970,enumerable:!0},GL_BLEND_SRC_ALPHA:{value:32971,enumerable:!0},GL_CONSTANT_COLOR:{value:32769,enumerable:!0},GL_ONE_MINUS_CONSTANT_COLOR:{value:32770,enumerable:!0},GL_CONSTANT_ALPHA:{value:32771,enumerable:!0},GL_ONE_MINUS_CONSTANT_ALPHA:{value:32772,
  enumerable:!0},GL_BLEND_COLOR:{value:32773,enumerable:!0},GL_ARRAY_BUFFER:{value:34962,enumerable:!0},GL_ELEMENT_ARRAY_BUFFER:{value:34963,enumerable:!0},GL_ARRAY_BUFFER_BINDING:{value:34964,enumerable:!0},GL_ELEMENT_ARRAY_BUFFER_BINDING:{value:34965,enumerable:!0},GL_STREAM_DRAW:{value:35040,enumerable:!0},GL_STATIC_DRAW:{value:35044,enumerable:!0},GL_DYNAMIC_DRAW:{value:35048,enumerable:!0},GL_BUFFER_SIZE:{value:34660,enumerable:!0},GL_BUFFER_USAGE:{value:34661,enumerable:!0},GL_CURRENT_VERTEX_ATTRIB:{value:34342,
  enumerable:!0},GL_FRONT:{value:1028,enumerable:!0},GL_BACK:{value:1029,enumerable:!0},GL_FRONT_AND_BACK:{value:1032,enumerable:!0},GL_TEXTURE_2D:{value:3553,enumerable:!0},GL_CULL_FACE:{value:2884,enumerable:!0},GL_BLEND:{value:3042,enumerable:!0},GL_DITHER:{value:3024,enumerable:!0},GL_STENCIL_TEST:{value:2960,enumerable:!0},GL_DEPTH_TEST:{value:2929,enumerable:!0},GL_SCISSOR_TEST:{value:3089,enumerable:!0},GL_POLYGON_OFFSET_FILL:{value:32823,enumerable:!0},GL_SAMPLE_ALPHA_TO_COVERAGE:{value:32926,
  enumerable:!0},GL_SAMPLE_COVERAGE:{value:32928,enumerable:!0},GL_NO_ERROR:{value:0,enumerable:!0},GL_INVALID_ENUM:{value:1280,enumerable:!0},GL_INVALID_VALUE:{value:1281,enumerable:!0},GL_INVALID_OPERATION:{value:1282,enumerable:!0},GL_OUT_OF_MEMORY:{value:1285,enumerable:!0},GL_CW:{value:2304,enumerable:!0},GL_CCW:{value:2305,enumerable:!0},GL_LINE_WIDTH:{value:2849,enumerable:!0},GL_ALIASED_POINT_SIZE_RANGE:{value:33901,enumerable:!0},GL_ALIASED_LINE_WIDTH_RANGE:{value:33902,enumerable:!0},GL_CULL_FACE_MODE:{value:2885,
  enumerable:!0},GL_FRONT_FACE:{value:2886,enumerable:!0},GL_DEPTH_RANGE:{value:2928,enumerable:!0},GL_DEPTH_WRITEMASK:{value:2930,enumerable:!0},GL_DEPTH_CLEAR_VALUE:{value:2931,enumerable:!0},GL_DEPTH_FUNC:{value:2932,enumerable:!0},GL_STENCIL_CLEAR_VALUE:{value:2961,enumerable:!0},GL_STENCIL_FUNC:{value:2962,enumerable:!0},GL_STENCIL_FAIL:{value:2964,enumerable:!0},GL_STENCIL_PASS_DEPTH_FAIL:{value:2965,enumerable:!0},GL_STENCIL_PASS_DEPTH_PASS:{value:2966,enumerable:!0},GL_STENCIL_REF:{value:2967,
  enumerable:!0},GL_STENCIL_VALUE_MASK:{value:2963,enumerable:!0},GL_STENCIL_WRITEMASK:{value:2968,enumerable:!0},GL_STENCIL_BACK_FUNC:{value:34816,enumerable:!0},GL_STENCIL_BACK_FAIL:{value:34817,enumerable:!0},GL_STENCIL_BACK_PASS_DEPTH_FAIL:{value:34818,enumerable:!0},GL_STENCIL_BACK_PASS_DEPTH_PASS:{value:34819,enumerable:!0},GL_STENCIL_BACK_REF:{value:36003,enumerable:!0},GL_STENCIL_BACK_VALUE_MASK:{value:36004,enumerable:!0},GL_STENCIL_BACK_WRITEMASK:{value:36005,enumerable:!0},GL_VIEWPORT:{value:2978,
  enumerable:!0},GL_SCISSOR_BOX:{value:3088,enumerable:!0},GL_COLOR_CLEAR_VALUE:{value:3106,enumerable:!0},GL_COLOR_WRITEMASK:{value:3107,enumerable:!0},GL_UNPACK_ALIGNMENT:{value:3317,enumerable:!0},GL_PACK_ALIGNMENT:{value:3333,enumerable:!0},GL_MAX_TEXTURE_SIZE:{value:3379,enumerable:!0},GL_MAX_VIEWPORT_DIMS:{value:3386,enumerable:!0},GL_SUBPIXEL_BITS:{value:3408,enumerable:!0},GL_RED_BITS:{value:3410,enumerable:!0},GL_GREEN_BITS:{value:3411,enumerable:!0},GL_BLUE_BITS:{value:3412,enumerable:!0},
  GL_ALPHA_BITS:{value:3413,enumerable:!0},GL_DEPTH_BITS:{value:3414,enumerable:!0},GL_STENCIL_BITS:{value:3415,enumerable:!0},GL_POLYGON_OFFSET_UNITS:{value:10752,enumerable:!0},GL_POLYGON_OFFSET_FACTOR:{value:32824,enumerable:!0},GL_TEXTURE_BINDING_2D:{value:32873,enumerable:!0},GL_SAMPLE_BUFFERS:{value:32936,enumerable:!0},GL_SAMPLES:{value:32937,enumerable:!0},GL_SAMPLE_COVERAGE_VALUE:{value:32938,enumerable:!0},GL_SAMPLE_COVERAGE_INVERT:{value:32939,enumerable:!0},GL_COMPRESSED_TEXTURE_FORMATS:{value:34467,
  enumerable:!0},GL_DONT_CARE:{value:4352,enumerable:!0},GL_FASTEST:{value:4353,enumerable:!0},GL_NICEST:{value:4354,enumerable:!0},GL_GENERATE_MIPMAP_HINT:{value:33170,enumerable:!0},GL_BYTE:{value:5120,enumerable:!0},GL_UNSIGNED_BYTE:{value:5121,enumerable:!0},GL_SHORT:{value:5122,enumerable:!0},GL_UNSIGNED_SHORT:{value:5123,enumerable:!0},GL_INT:{value:5124,enumerable:!0},GL_UNSIGNED_INT:{value:5125,enumerable:!0},GL_FLOAT:{value:5126,enumerable:!0},GL_DEPTH_COMPONENT:{value:6402,enumerable:!0},
  GL_ALPHA:{value:6406,enumerable:!0},GL_RGB:{value:6407,enumerable:!0},GL_RGBA:{value:6408,enumerable:!0},GL_LUMINANCE:{value:6409,enumerable:!0},GL_LUMINANCE_ALPHA:{value:6410,enumerable:!0},GL_UNSIGNED_SHORT_4_4_4_4:{value:32819,enumerable:!0},GL_UNSIGNED_SHORT_5_5_5_1:{value:32820,enumerable:!0},GL_UNSIGNED_SHORT_5_6_5:{value:33635,enumerable:!0},GL_FRAGMENT_SHADER:{value:35632,enumerable:!0},GL_VERTEX_SHADER:{value:35633,enumerable:!0},GL_MAX_VERTEX_ATTRIBS:{value:34921,enumerable:!0},GL_MAX_VERTEX_UNIFORM_VECTORS:{value:36347,
  enumerable:!0},GL_MAX_VARYING_VECTORS:{value:36348,enumerable:!0},GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:{value:35661,enumerable:!0},GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:{value:35660,enumerable:!0},GL_MAX_TEXTURE_IMAGE_UNITS:{value:34930,enumerable:!0},GL_MAX_FRAGMENT_UNIFORM_VECTORS:{value:36349,enumerable:!0},GL_SHADER_TYPE:{value:35663,enumerable:!0},GL_DELETE_STATUS:{value:35712,enumerable:!0},GL_LINK_STATUS:{value:35714,enumerable:!0},GL_VALIDATE_STATUS:{value:35715,enumerable:!0},GL_ATTACHED_SHADERS:{value:35717,
  enumerable:!0},GL_ACTIVE_UNIFORMS:{value:35718,enumerable:!0},GL_ACTIVE_ATTRIBUTES:{value:35721,enumerable:!0},GL_SHADING_LANGUAGE_VERSION:{value:35724,enumerable:!0},GL_CURRENT_PROGRAM:{value:35725,enumerable:!0},GL_NEVER:{value:512,enumerable:!0},GL_LESS:{value:513,enumerable:!0},GL_EQUAL:{value:514,enumerable:!0},GL_LEQUAL:{value:515,enumerable:!0},GL_GREATER:{value:516,enumerable:!0},GL_NOTEQUAL:{value:517,enumerable:!0},GL_GEQUAL:{value:518,enumerable:!0},GL_ALWAYS:{value:519,enumerable:!0},
  GL_KEEP:{value:7680,enumerable:!0},GL_REPLACE:{value:7681,enumerable:!0},GL_INCR:{value:7682,enumerable:!0},GL_DECR:{value:7683,enumerable:!0},GL_INVERT:{value:5386,enumerable:!0},GL_INCR_WRAP:{value:34055,enumerable:!0},GL_DECR_WRAP:{value:34056,enumerable:!0},GL_VENDOR:{value:7936,enumerable:!0},GL_RENDERER:{value:7937,enumerable:!0},GL_VERSION:{value:7938,enumerable:!0},GL_NEAREST:{value:9728,enumerable:!0},GL_LINEAR:{value:9729,enumerable:!0},GL_NEAREST_MIPMAP_NEAREST:{value:9984,enumerable:!0},
  GL_LINEAR_MIPMAP_NEAREST:{value:9985,enumerable:!0},GL_NEAREST_MIPMAP_LINEAR:{value:9986,enumerable:!0},GL_LINEAR_MIPMAP_LINEAR:{value:9987,enumerable:!0},GL_TEXTURE_MAG_FILTER:{value:10240,enumerable:!0},GL_TEXTURE_MIN_FILTER:{value:10241,enumerable:!0},GL_TEXTURE_WRAP_S:{value:10242,enumerable:!0},GL_TEXTURE_WRAP_T:{value:10243,enumerable:!0},GL_TEXTURE:{value:5890,enumerable:!0},GL_TEXTURE_CUBE_MAP:{value:34067,enumerable:!0},GL_TEXTURE_BINDING_CUBE_MAP:{value:34068,enumerable:!0},GL_TEXTURE_CUBE_MAP_POSITIVE_X:{value:34069,
  enumerable:!0},GL_TEXTURE_CUBE_MAP_NEGATIVE_X:{value:34070,enumerable:!0},GL_TEXTURE_CUBE_MAP_POSITIVE_Y:{value:34071,enumerable:!0},GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:{value:34072,enumerable:!0},GL_TEXTURE_CUBE_MAP_POSITIVE_Z:{value:34073,enumerable:!0},GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:{value:34074,enumerable:!0},GL_MAX_CUBE_MAP_TEXTURE_SIZE:{value:34076,enumerable:!0},GL_TEXTURE0:{value:33984,enumerable:!0},GL_TEXTURE1:{value:33985,enumerable:!0},GL_TEXTURE2:{value:33986,enumerable:!0},GL_TEXTURE3:{value:33987,
  enumerable:!0},GL_TEXTURE4:{value:33988,enumerable:!0},GL_TEXTURE5:{value:33989,enumerable:!0},GL_TEXTURE6:{value:33990,enumerable:!0},GL_TEXTURE7:{value:33991,enumerable:!0},GL_TEXTURE8:{value:33992,enumerable:!0},GL_TEXTURE9:{value:33993,enumerable:!0},GL_TEXTURE10:{value:33994,enumerable:!0},GL_TEXTURE11:{value:33995,enumerable:!0},GL_TEXTURE12:{value:33996,enumerable:!0},GL_TEXTURE13:{value:33997,enumerable:!0},GL_TEXTURE14:{value:33998,enumerable:!0},GL_TEXTURE15:{value:33999,enumerable:!0},
  GL_TEXTURE16:{value:34E3,enumerable:!0},GL_TEXTURE17:{value:34001,enumerable:!0},GL_TEXTURE18:{value:34002,enumerable:!0},GL_TEXTURE19:{value:34003,enumerable:!0},GL_TEXTURE20:{value:34004,enumerable:!0},GL_TEXTURE21:{value:34005,enumerable:!0},GL_TEXTURE22:{value:34006,enumerable:!0},GL_TEXTURE23:{value:34007,enumerable:!0},GL_TEXTURE24:{value:34008,enumerable:!0},GL_TEXTURE25:{value:34009,enumerable:!0},GL_TEXTURE26:{value:34010,enumerable:!0},GL_TEXTURE27:{value:34011,enumerable:!0},GL_TEXTURE28:{value:34012,
  enumerable:!0},GL_TEXTURE29:{value:34013,enumerable:!0},GL_TEXTURE30:{value:34014,enumerable:!0},GL_TEXTURE31:{value:34015,enumerable:!0},GL_ACTIVE_TEXTURE:{value:34016,enumerable:!0},GL_REPEAT:{value:10497,enumerable:!0},GL_CLAMP_TO_EDGE:{value:33071,enumerable:!0},GL_MIRRORED_REPEAT:{value:33648,enumerable:!0},GL_FLOAT_VEC2:{value:35664,enumerable:!0},GL_FLOAT_VEC3:{value:35665,enumerable:!0},GL_FLOAT_VEC4:{value:35666,enumerable:!0},GL_INT_VEC2:{value:35667,enumerable:!0},GL_INT_VEC3:{value:35668,
  enumerable:!0},GL_INT_VEC4:{value:35669,enumerable:!0},GL_BOOL:{value:35670,enumerable:!0},GL_BOOL_VEC2:{value:35671,enumerable:!0},GL_BOOL_VEC3:{value:35672,enumerable:!0},GL_BOOL_VEC4:{value:35673,enumerable:!0},GL_FLOAT_MAT2:{value:35674,enumerable:!0},GL_FLOAT_MAT3:{value:35675,enumerable:!0},GL_FLOAT_MAT4:{value:35676,enumerable:!0},GL_SAMPLER_2D:{value:35678,enumerable:!0},GL_SAMPLER_CUBE:{value:35680,enumerable:!0},GL_VERTEX_ATTRIB_ARRAY_ENABLED:{value:34338,enumerable:!0},GL_VERTEX_ATTRIB_ARRAY_SIZE:{value:34339,
  enumerable:!0},GL_VERTEX_ATTRIB_ARRAY_STRIDE:{value:34340,enumerable:!0},GL_VERTEX_ATTRIB_ARRAY_TYPE:{value:34341,enumerable:!0},GL_VERTEX_ATTRIB_ARRAY_NORMALIZED:{value:34922,enumerable:!0},GL_VERTEX_ATTRIB_ARRAY_POINTER:{value:34373,enumerable:!0},GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING:{value:34975,enumerable:!0},GL_COMPILE_STATUS:{value:35713,enumerable:!0},GL_LOW_FLOAT:{value:36336,enumerable:!0},GL_MEDIUM_FLOAT:{value:36337,enumerable:!0},GL_HIGH_FLOAT:{value:36338,enumerable:!0},GL_LOW_INT:{value:36339,
  enumerable:!0},GL_MEDIUM_INT:{value:36340,enumerable:!0},GL_HIGH_INT:{value:36341,enumerable:!0},GL_FRAMEBUFFER:{value:36160,enumerable:!0},GL_RENDERBUFFER:{value:36161,enumerable:!0},GL_RGBA4:{value:32854,enumerable:!0},GL_RGB5_A1:{value:32855,enumerable:!0},GL_RGB565:{value:36194,enumerable:!0},GL_DEPTH_COMPONENT16:{value:33189,enumerable:!0},GL_STENCIL_INDEX:{value:6401,enumerable:!0},GL_STENCIL_INDEX8:{value:36168,enumerable:!0},GL_DEPTH_STENCIL:{value:34041,enumerable:!0},GL_RENDERBUFFER_WIDTH:{value:36162,
  enumerable:!0},GL_RENDERBUFFER_HEIGHT:{value:36163,enumerable:!0},GL_RENDERBUFFER_INTERNAL_FORMAT:{value:36164,enumerable:!0},GL_RENDERBUFFER_RED_SIZE:{value:36176,enumerable:!0},GL_RENDERBUFFER_GREEN_SIZE:{value:36177,enumerable:!0},GL_RENDERBUFFER_BLUE_SIZE:{value:36178,enumerable:!0},GL_RENDERBUFFER_ALPHA_SIZE:{value:36179,enumerable:!0},GL_RENDERBUFFER_DEPTH_SIZE:{value:36180,enumerable:!0},GL_RENDERBUFFER_STENCIL_SIZE:{value:36181,enumerable:!0},GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE:{value:36048,
  enumerable:!0},GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME:{value:36049,enumerable:!0},GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL:{value:36050,enumerable:!0},GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE:{value:36051,enumerable:!0},GL_COLOR_ATTACHMENT0:{value:36064,enumerable:!0},GL_DEPTH_ATTACHMENT:{value:36096,enumerable:!0},GL_STENCIL_ATTACHMENT:{value:36128,enumerable:!0},GL_DEPTH_STENCIL_ATTACHMENT:{value:33306,enumerable:!0},GL_NONE:{value:0,enumerable:!0},GL_FRAMEBUFFER_COMPLETE:{value:36053,enumerable:!0},
  GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:{value:36054,enumerable:!0},GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:{value:36055,enumerable:!0},GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS:{value:36057,enumerable:!0},GL_FRAMEBUFFER_UNSUPPORTED:{value:36061,enumerable:!0},GL_FRAMEBUFFER_BINDING:{value:36006,enumerable:!0},GL_RENDERBUFFER_BINDING:{value:36007,enumerable:!0},GL_MAX_RENDERBUFFER_SIZE:{value:34024,enumerable:!0},GL_INVALID_FRAMEBUFFER_OPERATION:{value:1286,enumerable:!0},GL_UNPACK_FLIP_Y_WEBGL:{value:37440,
  enumerable:!0},GL_UNPACK_PREMULTIPLY_ALPHA_WEBGL:{value:37441,enumerable:!0},GL_CONTEXT_LOST_WEBGL:{value:37442,enumerable:!0},GL_UNPACK_COLORSPACE_CONVERSION_WEBGL:{value:37443,enumerable:!0},GL_BROWSER_DEFAULT_WEBGL:{value:37444,enumerable:!0}})})();this.exports=this.exports||{};exports.Constants=KICK.core.Constants;KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){KICK.namespace("KICK.material").GLSLConstants={"__error_fs.glsl":"#ifdef GL_ES\nprecision highp float;\n#endif\nvoid main(void)\n{\ngl_FragColor = vec4(1.0,0.5, 0.9, 1.0);\n}","__error_vs.glsl":"attribute vec3 vertex;\nuniform mat4 _mvProj;\nvoid main(void) {\ngl_Position = _mvProj * vec4(vertex, 1.0);\n} ","__pick_fs.glsl":"#ifdef GL_ES\nprecision mediump float;\n#endif\nvarying vec4 gameObjectUID;\nvoid main(void)\n{\ngl_FragColor = gameObjectUID;\n}","__pick_vs.glsl":"attribute vec3 vertex;\nuniform mat4 _mvProj;\nuniform vec4 _gameObjectUID;\nvarying vec4 gameObjectUID;\nvoid main(void) {\n// compute position\ngl_Position = _mvProj * vec4(vertex, 1.0);\ngameObjectUID = _gameObjectUID;\n}",
  "__shadowmap_fs.glsl":"#ifdef GL_ES\nprecision highp float;\n#endif\nvec4 packDepth( const in float depth ) {\nconst vec4 bitShift = vec4( 16777216.0, 65536.0, 256.0, 1.0 );\nconst vec4 bitMask = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );\nvec4 res = fract( depth * bitShift );\nres -= res.xxyz * bitMask;\nreturn res;\n}\nvoid main() {\ngl_FragColor = packDepth( gl_FragCoord.z );\n}\n","__shadowmap_vs.glsl":"attribute vec3 vertex;\nuniform mat4 _mvProj;\nvoid main(void) {\ngl_Position = _mvProj * vec4(vertex, 1.0);\n} ",
  "diffuse_fs.glsl":'precision mediump float;\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec3 vEcPosition;\nuniform vec4 mainColor;\nuniform sampler2D mainTexture;\n#pragma include "light.glsl"\n#pragma include "shadowmap.glsl"\nvoid main(void)\n{\nvec3 normal = normalize(vNormal);\nvec3 directionalLight = getDirectionalLightDiffuse(normal,_dLight);\nvec3 pointLight = getPointLightDiffuse(normal,vEcPosition, _pLights);\nfloat visibility;\nif (SHADOWS){\nvisibility = computeLightVisibility();\n} else {\nvisibility = 1.0;\n}\nvec3 color = max((directionalLight+pointLight)*visibility,_ambient.xyz)*mainColor.xyz;\ngl_FragColor = vec4(texture2D(mainTexture,vUv).xyz*color, 1.0);\n}\n',
  "diffuse_vs.glsl":"attribute vec3 vertex;\nattribute vec3 normal;\nattribute vec2 uv1;\nuniform mat4 _mvProj;\nuniform mat4 _mv;\nuniform mat4 _lightMat;\nuniform mat3 _norm;\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec4 vShadowMapCoord;\nvarying vec3 vEcPosition;\nvoid main(void) {\nvec4 v = vec4(vertex, 1.0);\ngl_Position = _mvProj * v;\nvEcPosition = (_mv * v).xyz;\nvUv = uv1;\nvNormal = _norm * normal;\nvShadowMapCoord = _lightMat * v;\n} ","light.glsl":"vec3 getPointLightDiffuse(vec3 normal, vec3 ecPosition, mat3 pLights[LIGHTS]){\nvec3 diffuse = vec3(0.0);\nfor (int i=0;i<LIGHTS;i++){\nvec3 ecLightPos = pLights[i][0]; // light position in eye coordinates\nvec3 colorIntensity = pLights[i][1];\nvec3 attenuationVector = pLights[i][2];\n// direction from surface to light position\nvec3 VP = ecLightPos - ecPosition;\n// compute distance between surface and light position\nfloat d = length(VP);\n// normalize the vector from surface to light position\nVP = normalize(VP);\n// compute attenuation\nfloat attenuation = 1.0 / dot(vec3(1.0,d,d*d),attenuationVector); // short for constA + liniearA * d + quadraticA * d^2\nfloat nDotVP = max(0.0, dot(normal, VP));\ndiffuse += colorIntensity*nDotVP * attenuation;\n}\nreturn diffuse;\n}\nvoid getPointLight(vec3 normal, vec3 ecPosition, mat3 pLights[LIGHTS],float specularExponent, out vec3 diffuse, out float specular){\ndiffuse = vec3(0.0, 0.0, 0.0);\nspecular = 0.0;\nvec3 eye = vec3(0.0,0.0,1.0);\nfor (int i=0;i<LIGHTS;i++){\nvec3 ecLightPos = pLights[i][0]; // light position in eye coordinates\nvec3 colorIntensity = pLights[i][1];\nvec3 attenuationVector = pLights[i][2];\n// direction from surface to light position\nvec3 VP = ecLightPos - ecPosition;\n// compute distance between surface and light position\nfloat d = length(VP);\n// normalize the vector from surface to light position\nVP = normalize(VP);\n// compute attenuation\nfloat attenuation = 1.0 / dot(vec3(1.0,d,d*d),attenuationVector); // short for constA + liniearA * d + quadraticA * d^2\nvec3 halfVector = normalize(VP + eye);\nfloat nDotVP = max(0.0, dot(normal, VP));\nfloat nDotHV = max(0.0, dot(normal, halfVector));\nfloat pf;\nif (nDotVP == 0.0){\npf = 0.0;\n} else {\npf = pow(nDotHV, specularExponent);\n}\nbool isLightEnabled = (attenuationVector[0]+attenuationVector[1]+attenuationVector[2])>0.0;\nif (isLightEnabled){\ndiffuse += colorIntensity * nDotVP * attenuation;\nspecular += pf * attenuation;\n}\n}\n}\nvec3 getDirectionalLightDiffuse(vec3 normal, mat3 dLight){\nvec3 ecLightDir = dLight[0]; // light direction in eye coordinates\nvec3 colorIntensity = dLight[1];\nfloat diffuseContribution = max(dot(normal, ecLightDir), 0.0);\nreturn (colorIntensity * diffuseContribution);\n}\n// assumes that normal is normalized\nvoid getDirectionalLight(vec3 normal, mat3 dLight, float specularExponent, out vec3 diffuse, out float specular){\nvec3 ecLightDir = dLight[0]; // light direction in eye coordinates\nvec3 colorIntensity = dLight[1];\nvec3 halfVector = dLight[2];\nfloat diffuseContribution = max(dot(normal, ecLightDir), 0.0);\n\tfloat specularContribution = max(dot(normal, halfVector), 0.0);\nspecular = pow(specularContribution, specularExponent);\n\tdiffuse = (colorIntensity * diffuseContribution);\n}\nuniform mat3 _dLight;\nuniform vec3 _ambient;\nuniform mat3 _pLights[LIGHTS];\n",
  "shadowmap.glsl":"varying vec4 vShadowMapCoord;\nuniform sampler2D _shadowMapTexture;\nconst float shadowBias = 0.005;\nfloat unpackDepth( const in vec4 rgba_depth ) {\nconst vec4 bit_shift = vec4( 1.0 / ( 16777216.0 ), 1.0 / ( 65536.0 ), 1.0 / 256.0, 1.0 );\nreturn dot( rgba_depth, bit_shift );\n}\nfloat computeLightVisibility(){\nvec3 shadowCoord = vShadowMapCoord.xyz / vShadowMapCoord.w;\nif (shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0){\nvec4 packedShadowDepth = texture2D(_shadowMapTexture,shadowCoord.xy);\nbool isMaxDepth = dot(packedShadowDepth, vec4(1.0,1.0,1.0,1.0))==4.0;\nif (!isMaxDepth){\nfloat shadowDepth = unpackDepth(packedShadowDepth);\nif (shadowDepth > shadowCoord.z - shadowBias){\nreturn 1.0;\n}\nreturn 0.0;\n}\n}\nreturn 1.0; // if outside shadow map, then not occcluded\n}",
  "specular_fs.glsl":'precision mediump float;\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec3 vEcPosition;\nuniform vec4 mainColor;\nuniform float specularExponent;\nuniform vec4 specularColor;\nuniform sampler2D mainTexture;\n#pragma include "light.glsl"\n#pragma include "shadowmap.glsl"\nvoid main(void)\n{\nvec3 normal = normalize(vNormal);\nvec3 diffuse;\nfloat specular;\ngetDirectionalLight(normal, _dLight, specularExponent, diffuse, specular);\nvec3 diffusePoint;\nfloat specularPoint;\ngetPointLight(normal,vEcPosition, _pLights,specularExponent,diffusePoint,specularPoint);\nfloat visibility;\nif (SHADOWS){\nvisibility = computeLightVisibility();\n} else {\nvisibility = 1.0;\n}\nvec3 color = max((diffuse+diffusePoint)*visibility,_ambient.xyz)*mainColor.xyz;\ngl_FragColor = vec4(texture2D(mainTexture,vUv).xyz*color.xyz, 1.0)+vec4((specular+specularPoint)*specularColor.xyz,0.0);\n}\n',
  "specular_vs.glsl":"attribute vec3 vertex;\nattribute vec3 normal;\nattribute vec2 uv1;\nuniform mat4 _mvProj;\nuniform mat4 _mv;\nuniform mat4 _lightMat;\nuniform mat3 _norm;\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec3 vEcPosition;\nvarying vec4 vShadowMapCoord;\nvoid main(void) {\nvec4 v = vec4(vertex, 1.0);\ngl_Position = _mvProj * v;\nvUv = uv1;\nvEcPosition = (_mv * v).xyz;\nvNormal= _norm * normal;\nvShadowMapCoord = _lightMat * v;\n} ","transparent_diffuse_fs.glsl":'precision mediump float;\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec3 vEcPosition;\nuniform vec4 mainColor;\nuniform float specularExponent;\nuniform vec4 specularColor;\nuniform sampler2D mainTexture;\n#pragma include "light.glsl"\nvoid main(void)\n{\nvec3 normal = normalize(vNormal);\nvec3 diffuseDirectionalLight = getDirectionalLightDiffuse(normal,_dLight);\nvec3 diffusePointLight = getPointLightDiffuse(normal,vEcPosition, _pLights);\nvec4 color = vec4(max(diffuseDirectionalLight+diffusePointLight,_ambient.xyz),1.0)*mainColor;\ngl_FragColor = texture2D(mainTexture,vUv)*color;\n}\n',
  "transparent_diffuse_vs.glsl":"attribute vec3 vertex;\nattribute vec3 normal;\nattribute vec2 uv1;\nuniform mat4 _mvProj;\nuniform mat3 _norm;\nuniform mat4 _mv;\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec3 vEcPosition;\nvoid main(void) {\nvec4 v = vec4(vertex, 1.0);\n// compute position\ngl_Position = _mvProj * v;\nvEcPosition = (_mv * v).xyz;\nvUv = uv1;\n// compute light info\nvNormal= _norm * normal;\n} ","transparent_specular_fs.glsl":'precision mediump float;\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec3 vEcPosition;\nuniform vec4 mainColor;\nuniform float specularExponent;\nuniform vec4 specularColor;\nuniform sampler2D mainTexture;\n#pragma include "light.glsl"\nvoid main(void)\n{\nvec3 normal = normalize(vNormal);\nvec3 diffuse;\nfloat specular;\ngetDirectionalLight(normal, _dLight, specularExponent, diffuse, specular);\nvec3 diffusePoint;\nfloat specularPoint;\ngetPointLight(normal,vEcPosition, _pLights,specularExponent,diffusePoint,specularPoint);\nvec4 color = vec4(max(diffuse+diffusePoint,_ambient.xyz),1.0)*mainColor;\ngl_FragColor = texture2D(mainTexture,vUv)*color+vec4((specular+specularPoint)*specularColor.xyz,0.0);\n}\n',
  "transparent_specular_vs.glsl":"attribute vec3 vertex;\nattribute vec3 normal;\nattribute vec2 uv1;\nuniform mat4 _mvProj;\nuniform mat4 _mv;\nuniform mat3 _norm;\nvarying vec2 vUv;\nvarying vec3 vNormal;\nvarying vec3 vEcPosition;\nvoid main(void) {\nvec4 v = vec4(vertex, 1.0);\n// compute position\ngl_Position = _mvProj * v;\nvEcPosition = (_mv * v).xyz;\nvUv = uv1;\n// compute light info\nvNormal= _norm * normal;\n} ","transparent_unlit_fs.glsl":"precision mediump float;\nvarying vec2 vUv;\nuniform vec4 mainColor;\nuniform sampler2D mainTexture;\nvoid main(void)\n{\ngl_FragColor = texture2D(mainTexture,vUv)*mainColor;\n}\n",
  "transparent_unlit_vs.glsl":"attribute vec3 vertex;\nattribute vec2 uv1;\nuniform mat4 _mvProj;\nvarying vec2 vUv;\nvoid main(void) {\ngl_Position = _mvProj * vec4(vertex, 1.0);\nvUv = uv1;\n}","unlit_fs.glsl":"#ifdef GL_ES\nprecision highp float;\n#endif\nvarying vec2 vUv;\nuniform vec4 mainColor;\nuniform sampler2D mainTexture;\nvoid main(void)\n{\ngl_FragColor = vec4(texture2D(mainTexture,vUv).xyz*mainColor.xyz,1.0);\n}\n","unlit_vertex_color_fs.glsl":"precision mediump float;\nvarying vec2 vUv;\nvarying vec4 vColor;\nuniform vec4 mainColor;\nuniform sampler2D mainTexture;\nvoid main(void)\n{\ngl_FragColor = vec4(texture2D(mainTexture,vUv).xyz*mainColor.xyz*vColor.xyz,1.0);\n}\n",
  "unlit_vertex_color_vs.glsl":"attribute vec3 vertex;\nattribute vec2 uv1;\nattribute vec4 color;\nuniform mat4 _mvProj;\nvarying vec2 vUv;\nvarying vec4 vColor;\nvoid main(void) {\ngl_Position = _mvProj * vec4(vertex, 1.0);\nvUv = uv1;\nvColor = color;\n}","unlit_vs.glsl":"attribute vec3 vertex;\nattribute vec2 uv1;\nuniform mat4 _mvProj;\nvarying vec2 vUv;\nvoid main(void) {\ngl_Position = _mvProj * vec4(vertex, 1.0);\nvUv = uv1;\n}"}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.math"),l=KICK.namespace("KICK.math.vec2"),h=KICK.namespace("KICK.math.vec3"),u=KICK.namespace("KICK.math.vec4"),o=KICK.namespace("KICK.math.mat3"),d=KICK.namespace("KICK.math.mat4"),c=KICK.namespace("KICK.math.quat4"),f=KICK.namespace("KICK.math.aabb"),j=KICK.namespace("KICK.math.frustum"),n=Math.min,A=Math.max,x=Math.cos,w=Math.acos,r=Math.sin,s=Math.asin,y=Math.abs,k=Math.tan,p=Math.atan,t=Math.atan2,m=Math.PI,v=function(a,b){var e,i=0,q=a.length/b,c=[];for(e=
  0;e<q;e++,i+=b)c[e]=a.subarray(i,i+b);return c};g.vec2=l;l.wrapArray=function(a){return v(a,2)};l.array=function(a,b){var e=new Float32Array(2*a);b&&(b.mem=e);return l.wrapArray(e)};l.create=function(a){var b=new Float32Array(2);a&&(b[0]=a[0],b[1]=a[1]);return b};l.set=function(a,b){b[0]=a[0];b[1]=a[1];return b};l.add=function(a,b,e){if(!e||a===e)return a[0]+=b[0],a[1]+=b[1],a;e[0]=a[0]+b[0];e[1]=a[1]+b[1];return e};l.subtract=function(a,b,e){if(!e||a===e)return a[0]-=b[0],a[1]-=b[1],a;e[0]=a[0]-
  b[0];e[1]=a[1]-b[1];return e};l.equal=function(a,b,e){var i;e||(e=1.0E-5);for(i=0;2>i;i++)if(y(a[i]-b[i])>e)return!1;return!0};l.normalize=function(a,b){var e,i,q;b||(b=a);e=a[0];i=a[1];q=Math.sqrt(e*e+i*i);if(!q)return b[0]=0,b[1]=0,b;if(1===q)return b[0]=e,b[1]=i,b;q=1/q;b[0]=e*q;b[1]=i*q;return b};g.vec3=h;h.wrapArray=function(a){return v(a,3)};h.array=function(a,b){var e=new Float32Array(3*a);b&&(b.mem=e);return h.wrapArray(e)};h.create=function(a){var b=new Float32Array(3);a&&(b[0]=a[0],b[1]=
  a[1],b[2]=a[2]);return b};h.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];return b};h.add=function(a,b,e){if(!e||a===e)return a[0]+=b[0],a[1]+=b[1],a[2]+=b[2],a;e[0]=a[0]+b[0];e[1]=a[1]+b[1];e[2]=a[2]+b[2];return e};h.subtract=function(a,b,e){if(!e||a===e)return a[0]-=b[0],a[1]-=b[1],a[2]-=b[2],a;e[0]=a[0]-b[0];e[1]=a[1]-b[1];e[2]=a[2]-b[2];return e};h.equal=function(a,b,e){var i;e||(e=1.0E-5);for(i=0;3>i;i++)if(y(a[i]-b[i])>e)return!1;return!0};h.multiply=function(a,b,e){if(!e||a===e)return a[0]*=
  b[0],a[1]*=b[1],a[2]*=b[2],a;e[0]=a[0]*b[0];e[1]=a[1]*b[1];e[2]=a[2]*b[2];return e};h.negate=function(a,b){b||(b=a);b[0]=-a[0];b[1]=-a[1];b[2]=-a[2];return b};h.scale=function(a,b,e){if(!e||a===e)return a[0]*=b,a[1]*=b,a[2]*=b,a;e[0]=a[0]*b;e[1]=a[1]*b;e[2]=a[2]*b;return e};h.normalize=function(a,b){b||(b=a);var e=a[0],i=a[1],q=a[2],c=Math.sqrt(e*e+i*i+q*q);if(!c)return b[0]=0,b[1]=0,b[2]=0,b;if(1===c)return b[0]=e,b[1]=i,b[2]=q,b;c=1/c;b[0]=e*c;b[1]=i*c;b[2]=q*c;return b};h.cross=function(a,b,e){e||
  (e=a);var i=a[0],q=a[1],a=a[2],c=b[0],z=b[1],b=b[2];e[0]=q*b-a*z;e[1]=a*c-i*b;e[2]=i*z-q*c;return e};h.length=function(a){var b=a[0],e=a[1],a=a[2];return Math.sqrt(b*b+e*e+a*a)};h.lengthSqr=function(a){var b=a[0],e=a[1],a=a[2];return b*b+e*e+a*a};h.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*b[2]};h.direction=function(a,b,e){e||(e=a);var i=a[0]-b[0],q=a[1]-b[1],a=a[2]-b[2],b=Math.sqrt(i*i+q*q+a*a);if(!b)return e[0]=0,e[1]=0,e[2]=0,e;b=1/b;e[0]=i*b;e[1]=q*b;e[2]=a*b;return e};h.lerp=function(a,
  b,e,i){i||(i=a);i[0]=a[0]+e*(b[0]-a[0]);i[1]=a[1]+e*(b[1]-a[1]);i[2]=a[2]+e*(b[2]-a[2]);return i};h.dist=function(a,b){var e=b[0]-a[0],i=b[1]-a[1],q=b[2]-a[2];return Math.sqrt(e*e+i*i+q*q)};h.unproject=function(){var a=new Float32Array(16),b=new Float32Array(4);return function(e,i,q,c,z){z||(z=e);b[0]=2*(e[0]-c[0])/c[2]-1;b[1]=2*(e[1]-c[1])/c[3]-1;b[2]=2*e[2]-1;b[3]=1;d.multiply(q,i,a);if(!d.inverse(a))return null;d.multiplyVec4(a,b);if(0===b[3])return null;z[0]=b[0]/b[3];z[1]=b[1]/b[3];z[2]=b[2]/
  b[3];return z}}();h.sphericalToCarterian=function(a,b){var e=a[0],i=-a[1],q=a[2],c=e*x(q);b||(b=h.create());b[0]=c*x(i);b[1]=e*r(q);b[2]=c*r(i);return b};h.cartesianToSpherical=function(a,b){var e=a[0],i=a[1],q=a[2],c;0===e&&(e=1.0E-5);b||(b=h.create());b[0]=c=Math.sqrt(e*e+i*i+q*q);b[1]=-p(q/e);0>e&&(b[1]+=m);b[2]=s(i/c);return b};h.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+"]"};g.vec4=u;u.wrapArray=function(a){return v(a,4)};u.array=function(a,b){var e=new Float32Array(4*a);b&&(b.mem=e);
  return u.wrapArray(e)};u.create=function(a){var b=new Float32Array(4);a&&(b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3]);return b};u.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];return b};u.add=function(a,b,e){if(!e||a===e)return a[0]+=b[0],a[1]+=b[1],a[2]+=b[2],a[3]+=b[3],a;e[0]=a[0]+b[0];e[1]=a[1]+b[1];e[2]=a[2]+b[2];e[3]=a[3]+b[3];return e};u.subtract=function(a,b,e){if(!e||a===e)return a[0]-=b[0],a[1]-=b[1],a[2]-=b[2],a[3]-=b[3],a;e[0]=a[0]-b[0];e[1]=a[1]-b[1];e[2]=a[2]-b[2];e[3]=a[3]-
  b[3];return e};u.equal=function(a,b,e){var i;e||(e=1.0E-5);for(i=0;2>i;i++)if(y(a[i]-b[i])>e)return!1;return!0};u.multiply=function(a,b,e){if(!e||a===e)return a[0]*=b[0],a[1]*=b[1],a[2]*=b[2],a[3]*=b[3],a;e[0]=a[0]*b[0];e[1]=a[1]*b[1];e[2]=a[2]*b[2];e[3]=a[3]*b[3];return e};u.negate=function(a,b){b||(b=a);b[0]=-a[0];b[1]=-a[1];b[2]=-a[2];b[3]=-a[3];return b};u.length=function(a){var b=a[0],e=a[1],i=a[2],a=a[3];return Math.sqrt(b*b+e*e+i*i+a*a)};u.dot=function(a,b){return a[0]*b[0]+a[1]*b[1]+a[2]*
  b[2]+a[3]*b[3]};u.scale=function(a,b,e){if(!e||a===e)return a[0]*=b,a[1]*=b,a[2]*=b,a[3]*=b,a;e[0]=a[0]*b;e[1]=a[1]*b;e[2]=a[2]*b;e[3]=a[2]*b;return e};u.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+"]"};g.mat3=o;o.create=function(a){var b=new Float32Array(9);a&&(b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8]);return b};o.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];return b};
  o.identity=function(a){a||(a=o.create());a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=1;a[5]=0;a[6]=0;a[7]=0;a[8]=1;return a};o.transpose=function(a,b){if(!b||a===b){var e=a[1],i=a[2],q=a[5];a[1]=a[3];a[2]=a[6];a[3]=e;a[5]=a[7];a[6]=i;a[7]=q;return a}b[0]=a[0];b[1]=a[3];b[2]=a[6];b[3]=a[1];b[4]=a[4];b[5]=a[7];b[6]=a[2];b[7]=a[5];b[8]=a[8];return b};o.toMat4=function(a,b){b||(b=d.create());b[15]=1;b[14]=0;b[13]=0;b[12]=0;b[11]=0;b[10]=a[8];b[9]=a[7];b[8]=a[6];b[7]=0;b[6]=a[5];b[5]=a[4];b[4]=a[3];b[3]=0;b[2]=a[2];
  b[1]=a[1];b[0]=a[0];return b};o.toQuat=function(a,b){var e=a[0],i=a[1],q=a[2],d=a[3],z=a[4],k=a[5],m=a[6],f=a[7],j=a[8],p=e+z+j;b||(b=c.create());0<p?(e=0.5/Math.sqrt(p+1),b[0]=(k-f)*e,b[1]=(m-q)*e,b[2]=(i-d)*e,b[3]=0.25/e):e>z&&e>j?(e=2*Math.sqrt(1+e-z-j),b[0]=0.25*e,b[1]=(d+i)/e,b[2]=(m+q)/e,b[3]=(k-f)/e):z>j?(e=2*Math.sqrt(1+z-e-j),b[0]=(d+i)/e,b[1]=0.25*e,b[2]=(f+k)/e,b[3]=(m-q)/e):(e=2*Math.sqrt(1+j-e-z),b[0]=(m+q)/e,b[1]=(f+k)/e,b[2]=0.25*e,b[3]=(i-d)/e);return b};o.str=function(a){return"["+
  a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+"]"};o.strPretty=function(a){return"["+a[0]+", "+a[3]+", "+a[6]+"\n, "+a[1]+", "+a[4]+", "+a[7]+"\n, "+a[2]+", "+a[5]+", "+a[8]+"]"};g.mat4=d;d.create=function(a){var b=new Float32Array(16);a&&(b[0]=a[0],b[1]=a[1],b[2]=a[2],b[3]=a[3],b[4]=a[4],b[5]=a[5],b[6]=a[6],b[7]=a[7],b[8]=a[8],b[9]=a[9],b[10]=a[10],b[11]=a[11],b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15]);return b};d.set=function(a,b){b[0]=a[0];b[1]=a[1];
  b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};d.setTRS=function(a,b,e,i){i||(i=d.create());var q=e[0],c=e[1],e=e[2],z=b[0],k=b[1],m=b[2],f=b[3],j=z+z,p=k+k,g=m+m,b=z*j,n=z*p,z=z*g,h=k*p,k=k*g,m=m*g,j=f*j,p=f*p,f=f*g;i[0]=(1-(h+m))*q;i[1]=(n+f)*q;i[2]=(z-p)*q;i[3]=0;i[4]=(n-f)*c;i[5]=(1-(b+m))*c;i[6]=(k+j)*c;i[7]=0;i[8]=(z+p)*e;i[9]=(k-j)*e;i[10]=(1-(b+h))*e;i[11]=0;i[12]=a[0];i[13]=
  a[1];i[14]=a[2];i[15]=1;return i};d.setTRSInverse=function(a,b,e,i){i||(i=d.create());var q=e[0],c=e[1],z=e[2],k=b[0],m=b[1],f=b[2],b=b[3],j=k+k,p=m+m,e=f+f,g=k*j,n=k*p,k=k*e,h=m*p,m=m*e,f=f*e,j=b*j,p=b*p,o=b*e,b=(1-(h+f))*q,e=(n+o)*q,q=(k-p)*q,n=(n-o)*c,f=(1-(g+f))*c,c=(m+j)*c,k=(k+p)*z,m=(m-j)*z,z=(1-(g+h))*z,g=a[0],h=a[1],a=a[2],j=b*f-e*n,p=b*c-q*n,o=e*c-q*f,t=k*h-m*g,v=k*a-z*g,s=1*k,x=m*a-z*h,A=1*m,l=1*z,r=j*l-p*A+o*s;if(!r)return null;r=1/r;i[0]=(f*l-c*A)*r;i[1]=(-e*l+q*A)*r;i[2]=1*o*r;i[3]=
  0;i[4]=(-n*l+c*s)*r;i[5]=(b*l-q*s)*r;i[6]=-1*p*r;i[7]=0;i[8]=(n*A-f*s)*r;i[9]=(-b*A+e*s)*r;i[10]=1*j*r;i[11]=0;i[12]=(-n*x+f*v-c*t)*r;i[13]=(b*x-e*v+q*t)*r;i[14]=(-g*o+h*p-a*j)*r;i[15]=(k*o-m*p+z*j)*r;return i};d.identity=function(a){a[0]=1;a[1]=0;a[2]=0;a[3]=0;a[4]=0;a[5]=1;a[6]=0;a[7]=0;a[8]=0;a[9]=0;a[10]=1;a[11]=0;a[12]=0;a[13]=0;a[14]=0;a[15]=1;return a};d.transpose=function(a,b){if(!b||a===b){var e=a[1],i=a[2],q=a[3],c=a[6],z=a[7],d=a[11];a[1]=a[4];a[2]=a[8];a[3]=a[12];a[4]=e;a[6]=a[9];a[7]=
  a[13];a[8]=i;a[9]=c;a[11]=a[14];a[12]=q;a[13]=z;a[14]=d;return a}b[0]=a[0];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=a[1];b[5]=a[5];b[6]=a[9];b[7]=a[13];b[8]=a[2];b[9]=a[6];b[10]=a[10];b[11]=a[14];b[12]=a[3];b[13]=a[7];b[14]=a[11];b[15]=a[15];return b};d.determinant=function(a){var b=a[0],e=a[1],i=a[2],q=a[3],c=a[4],z=a[5],d=a[6],k=a[7],m=a[8],f=a[9],j=a[10],p=a[11],g=a[12],n=a[13],h=a[14],a=a[15];return g*f*d*q-m*n*d*q-g*z*j*q+c*n*j*q+m*z*h*q-c*f*h*q-g*f*i*k+m*n*i*k+g*e*j*k-b*n*j*k-m*e*h*k+b*f*h*k+g*z*
  i*p-c*n*i*p-g*e*d*p+b*n*d*p+c*e*h*p-b*z*h*p-m*z*i*a+c*f*i*a+m*e*d*a-b*f*d*a-c*e*j*a+b*z*j*a};d.inverse=function(a,b){b||(b=a);var e=a[0],i=a[1],q=a[2],c=a[3],z=a[4],d=a[5],k=a[6],m=a[7],f=a[8],j=a[9],p=a[10],g=a[11],n=a[12],h=a[13],o=a[14],t=a[15],s=e*d-i*z,v=e*k-q*z,x=e*m-c*z,A=i*k-q*d,r=i*m-c*d,l=q*m-c*k,y=f*h-j*n,w=f*o-p*n,u=f*t-g*n,N=j*o-p*h,J=j*t-g*h,O=p*t-g*o,C=s*O-v*J+x*N+A*u-r*w+l*y;if(!C)return null;C=1/C;b[0]=(d*O-k*J+m*N)*C;b[1]=(-i*O+q*J-c*N)*C;b[2]=(h*l-o*r+t*A)*C;b[3]=(-j*l+p*r-g*A)*
  C;b[4]=(-z*O+k*u-m*w)*C;b[5]=(e*O-q*u+c*w)*C;b[6]=(-n*l+o*x-t*v)*C;b[7]=(f*l-p*x+g*v)*C;b[8]=(z*J-d*u+m*y)*C;b[9]=(-e*J+i*u-c*y)*C;b[10]=(n*r-h*x+t*s)*C;b[11]=(-f*r+j*x-g*s)*C;b[12]=(-z*N+d*w-k*y)*C;b[13]=(e*N-i*w+q*y)*C;b[14]=(-n*A+h*v-o*s)*C;b[15]=(f*A-j*v+p*s)*C;return b};d.toRotationMat=function(a,b){b||(b=d.create());b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};d.toMat3=function(a,
  b){b||(b=o.create());b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[4];b[4]=a[5];b[5]=a[6];b[6]=a[8];b[7]=a[9];b[8]=a[10];return b};d.toNormalMat3=function(a,b){var e=a[0],i=a[1],q=a[2],c=a[4],z=a[5],d=a[6],k=a[8],m=a[9],f=a[10],j=f*z-d*m,p=-f*c+d*k,g=m*c-z*k,n=e*j+i*p+q*g;if(!n)return null;n=1/n;b||(b=o.create());b[0]=j*n;b[3]=(-f*i+q*m)*n;b[6]=(d*i-q*z)*n;b[1]=p*n;b[4]=(f*e-q*k)*n;b[7]=(-d*e+q*c)*n;b[2]=g*n;b[5]=(-m*e+i*k)*n;b[8]=(z*e-i*c)*n;return b};d.toInverseMat3=function(a,b){var e=a[0],i=a[1],q=a[2],
  c=a[4],z=a[5],d=a[6],k=a[8],m=a[9],f=a[10],j=f*z-d*m,p=-f*c+d*k,g=m*c-z*k,n=e*j+i*p+q*g;if(!n)return null;n=1/n;b||(b=o.create());b[0]=j*n;b[1]=(-f*i+q*m)*n;b[2]=(d*i-q*z)*n;b[3]=p*n;b[4]=(f*e-q*k)*n;b[5]=(-d*e+q*c)*n;b[6]=g*n;b[7]=(-m*e+i*k)*n;b[8]=(z*e-i*c)*n;return b};d.multiply=function(a,b,e){e||(e=a);var i=a[0],q=a[1],c=a[2],d=a[3],k=a[4],m=a[5],f=a[6],j=a[7],p=a[8],g=a[9],n=a[10],h=a[11],o=a[12],t=a[13],s=a[14],a=a[15],v=b[0],x=b[1],A=b[2],r=b[3],l=b[4],y=b[5],w=b[6],u=b[7],P=b[8],N=b[9],J=
  b[10],O=b[11],C=b[12],S=b[13],Z=b[14],b=b[15];e[0]=v*i+x*k+A*p+r*o;e[1]=v*q+x*m+A*g+r*t;e[2]=v*c+x*f+A*n+r*s;e[3]=v*d+x*j+A*h+r*a;e[4]=l*i+y*k+w*p+u*o;e[5]=l*q+y*m+w*g+u*t;e[6]=l*c+y*f+w*n+u*s;e[7]=l*d+y*j+w*h+u*a;e[8]=P*i+N*k+J*p+O*o;e[9]=P*q+N*m+J*g+O*t;e[10]=P*c+N*f+J*n+O*s;e[11]=P*d+N*j+J*h+O*a;e[12]=C*i+S*k+Z*p+b*o;e[13]=C*q+S*m+Z*g+b*t;e[14]=C*c+S*f+Z*n+b*s;e[15]=C*d+S*j+Z*h+b*a;return e};d.multiplyVec3=function(a,b,e){e||(e=b);var i=b[0],q=b[1],b=b[2];e[0]=a[0]*i+a[4]*q+a[8]*b+a[12];e[1]=a[1]*
  i+a[5]*q+a[9]*b+a[13];e[2]=a[2]*i+a[6]*q+a[10]*b+a[14];return e};d.multiplyVec3Vector=function(a,b,e){e||(e=b);var i=b[0],q=b[1],b=b[2];e[0]=a[0]*i+a[4]*q+a[8]*b;e[1]=a[1]*i+a[5]*q+a[9]*b;e[2]=a[2]*i+a[6]*q+a[10]*b;e[3]=a[3]*i+a[7]*q+a[11]*b;return e};d.multiplyVec4=function(a,b,e){e||(e=b);var i=b[0],q=b[1],c=b[2],b=b[3];e[0]=a[0]*i+a[4]*q+a[8]*c+a[12]*b;e[1]=a[1]*i+a[5]*q+a[9]*c+a[13]*b;e[2]=a[2]*i+a[6]*q+a[10]*c+a[14]*b;e[3]=a[3]*i+a[7]*q+a[11]*c+a[15]*b;return e};d.translate=function(a,b,e){var i=
  b[0],q=b[1],b=b[2],c,d,k,m,f,j,p,g,n,h,o,t;if(!e||a===e)return a[12]=a[0]*i+a[4]*q+a[8]*b+a[12],a[13]=a[1]*i+a[5]*q+a[9]*b+a[13],a[14]=a[2]*i+a[6]*q+a[10]*b+a[14],a[15]=a[3]*i+a[7]*q+a[11]*b+a[15],a;c=a[0];d=a[1];k=a[2];m=a[3];f=a[4];j=a[5];p=a[6];g=a[7];n=a[8];h=a[9];o=a[10];t=a[11];e[0]=c;e[1]=d;e[2]=k;e[3]=m;e[4]=f;e[5]=j;e[6]=p;e[7]=g;e[8]=n;e[9]=h;e[10]=o;e[11]=t;e[12]=c*i+f*q+n*b+a[12];e[13]=d*i+j*q+h*b+a[13];e[14]=k*i+p*q+o*b+a[14];e[15]=m*i+g*q+t*b+a[15];return e};d.scale=function(a,b,e){var i=
  b[0],q=b[1],b=b[2];if(!e||a===e)return a[0]*=i,a[1]*=i,a[2]*=i,a[3]*=i,a[4]*=q,a[5]*=q,a[6]*=q,a[7]*=q,a[8]*=b,a[9]*=b,a[10]*=b,a[11]*=b,a;e[0]=a[0]*i;e[1]=a[1]*i;e[2]=a[2]*i;e[3]=a[3]*i;e[4]=a[4]*q;e[5]=a[5]*q;e[6]=a[6]*q;e[7]=a[7]*q;e[8]=a[8]*b;e[9]=a[9]*b;e[10]=a[10]*b;e[11]=a[11]*b;e[12]=a[12];e[13]=a[13];e[14]=a[14];e[15]=a[15];return e};d.rotate=function(a,b,e,i){var q=e[0],c=e[1],e=e[2],d,k,m,f,j,p,g,n,h,o,t,s,v,A,l,y,w,u,W,U,P;f=Math.sqrt(q*q+c*c+e*e);if(!f)return null;1!==f&&(f=1/f,q*=f,
  c*=f,e*=f);d=r(b);k=x(b);m=1-k;b=a[0];f=a[1];j=a[2];p=a[3];g=a[4];n=a[5];h=a[6];o=a[7];t=a[8];s=a[9];v=a[10];A=a[11];l=q*q*m+k;y=c*q*m+e*d;w=e*q*m-c*d;u=q*c*m-e*d;W=c*c*m+k;U=e*c*m+q*d;P=q*e*m+c*d;q=c*e*m-q*d;c=e*e*m+k;i?a!==i&&(i[12]=a[12],i[13]=a[13],i[14]=a[14],i[15]=a[15]):i=a;i[0]=b*l+g*y+t*w;i[1]=f*l+n*y+s*w;i[2]=j*l+h*y+v*w;i[3]=p*l+o*y+A*w;i[4]=b*u+g*W+t*U;i[5]=f*u+n*W+s*U;i[6]=j*u+h*W+v*U;i[7]=p*u+o*W+A*U;i[8]=b*P+g*q+t*c;i[9]=f*P+n*q+s*c;i[10]=j*P+h*q+v*c;i[11]=p*P+o*q+A*c;return i};d.rotateX=
  function(a,b,e){var i=r(b),b=x(b),q=a[4],c=a[5],d=a[6],k=a[7],m=a[8],f=a[9],j=a[10],p=a[11];e?a!==e&&(e[0]=a[0],e[1]=a[1],e[2]=a[2],e[3]=a[3],e[12]=a[12],e[13]=a[13],e[14]=a[14],e[15]=a[15]):e=a;e[4]=q*b+m*i;e[5]=c*b+f*i;e[6]=d*b+j*i;e[7]=k*b+p*i;e[8]=q*-i+m*b;e[9]=c*-i+f*b;e[10]=d*-i+j*b;e[11]=k*-i+p*b;return e};d.rotateY=function(a,b,e){var i=r(b),b=x(b),q=a[0],c=a[1],d=a[2],k=a[3],m=a[8],f=a[9],j=a[10],p=a[11];e?a!==e&&(e[4]=a[4],e[5]=a[5],e[6]=a[6],e[7]=a[7],e[12]=a[12],e[13]=a[13],e[14]=a[14],
  e[15]=a[15]):e=a;e[0]=q*b+m*-i;e[1]=c*b+f*-i;e[2]=d*b+j*-i;e[3]=k*b+p*-i;e[8]=q*i+m*b;e[9]=c*i+f*b;e[10]=d*i+j*b;e[11]=k*i+p*b;return e};d.rotateZ=function(a,b,e){var i=r(b),b=x(b),q=a[0],c=a[1],d=a[2],k=a[3],m=a[4],f=a[5],j=a[6],p=a[7];e?a!==e&&(e[8]=a[8],e[9]=a[9],e[10]=a[10],e[11]=a[11],e[12]=a[12],e[13]=a[13],e[14]=a[14],e[15]=a[15]):e=a;e[0]=q*b+m*i;e[1]=c*b+f*i;e[2]=d*b+j*i;e[3]=k*b+p*i;e[4]=q*-i+m*b;e[5]=c*-i+f*b;e[6]=d*-i+j*b;e[7]=k*-i+p*b;return e};d.frustum=function(a,b,e,i,q,c,k){k||(k=
  d.create());var m=b-a,f=i-e,j=c-q;k[0]=2*q/m;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2*q/f;k[6]=0;k[7]=0;k[8]=(b+a)/m;k[9]=(i+e)/f;k[10]=-(c+q)/j;k[11]=-1;k[12]=0;k[13]=0;k[14]=-(2*c*q)/j;k[15]=0;return k};d.perspective=function(a,b,e,i,q){a=e*k(a*m/360);b*=a;return d.frustum(-b,b,-a,a,e,i,q)};d.ortho=function(a,b,e,i,q,c,k){k||(k=d.create());var m=b-a,f=i-e,j=c-q;k[0]=2/m;k[1]=0;k[2]=0;k[3]=0;k[4]=0;k[5]=2/f;k[6]=0;k[7]=0;k[8]=0;k[9]=0;k[10]=-2/j;k[11]=0;k[12]=-(a+b)/m;k[13]=-(i+e)/f;k[14]=-(c+q)/j;k[15]=
  1;return k};d.lookAt=function(a,b,e,i){i||(i=d.create());var c=a[0],k=a[1],a=a[2],m=e[0],f=e[1],j=e[2],e=b[1],p=b[2],g,n,h,o;if(c===b[0]&&k===e&&a===p)return d.identity(i);e=c-b[0];p=k-b[1];b=a-b[2];o=1/Math.sqrt(e*e+p*p+b*b);e*=o;p*=o;b*=o;g=f*b-j*p;j=j*e-m*b;m=m*p-f*e;(o=Math.sqrt(g*g+j*j+m*m))?(o=1/o,g*=o,j*=o,m*=o):m=j=g=0;f=p*m-b*j;n=b*g-e*m;h=e*j-p*g;(o=Math.sqrt(f*f+n*n+h*h))?(o=1/o,f*=o,n*=o,h*=o):h=n=f=0;i[0]=g;i[1]=f;i[2]=e;i[3]=0;i[4]=j;i[5]=n;i[6]=p;i[7]=0;i[8]=m;i[9]=h;i[10]=b;i[11]=
  0;i[12]=-(g*c+j*k+m*a);i[13]=-(f*c+n*k+h*a);i[14]=-(e*c+p*k+b*a);i[15]=1;return i};d.decompose=function(){var a=d.create();return function(b,e,i,q){var k=[b[0],b[1],b[2]],m=[b[4],b[5],b[6]],f=[b[8],b[9],b[10]];e||(e=h.create());i||(i=c.create());q||(q=h.create());e[0]=b[12];e[1]=b[13];e[2]=b[14];q[0]=k=h.length(k);q[1]=m=h.length(m);q[2]=f=h.length(f);d.set(b,a);a[0]/=k;a[1]/=k;a[2]/=k;a[4]/=m;a[5]/=m;a[6]/=m;a[8]/=f;a[9]/=f;a[10]/=f;c.setFromRotationMatrix(a,i);return[e,i,q]}}();d.fromRotationTranslation=
  function(a,b,e){e||(e=d.create());var i=a[0],c=a[1],k=a[2],m=a[3],f=i+i,j=c+c,p=k+k,a=i*f,g=i*j,i=i*p,n=c*j,c=c*p,k=k*p,f=m*f,j=m*j,m=m*p;e[0]=1-(n+k);e[1]=g+m;e[2]=i-j;e[3]=0;e[4]=g-m;e[5]=1-(a+k);e[6]=c+f;e[7]=0;e[8]=i+j;e[9]=c-f;e[10]=1-(a+n);e[11]=0;e[12]=b[0];e[13]=b[1];e[14]=b[2];e[15]=1;return e};d.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+", "+a[9]+", "+a[10]+", "+a[11]+", "+a[12]+", "+a[13]+", "+a[14]+", "+a[15]+"]"};d.strPretty=
  function(a){return"["+a[0]+", "+a[4]+", "+a[8]+", "+a[12]+"\n, "+a[1]+", "+a[5]+", "+a[9]+", "+a[13]+"\n, "+a[2]+", "+a[6]+", "+a[10]+", "+a[14]+"\n, "+a[3]+", "+a[7]+", "+a[11]+", "+a[15]+"]"};g.quat4=c;c.create=u.create;c.set=u.set;c.calculateW=function(a,b){var e=a[0],i=a[1],c=a[2],k=-Math.sqrt(y(1-e*e-i*i-c*c));if(!b||a===b)return a[3]=k,a;b[0]=e;b[1]=i;b[2]=c;b[3]=k;return b};c.inverse=function(a,b){var e=1/c.dot(a,a);if(!b||a===b)return a[0]*=-e,a[1]*=-e,a[2]*=-e,a[3]*=e,a;b[0]=-a[0]*e;b[1]=
  -a[1]*e;b[2]=-a[2]*e;b[3]=a[3]*e;return b};c.conjugate=function(a,b){if(!b||a===b)return a[0]*=-1,a[1]*=-1,a[2]*=-1,a;b[0]=-a[0];b[1]=-a[1];b[2]=-a[2];b[3]=a[3];return b};c.length=u.length;c.dot=u.dot;c.normalize=function(a,b){b||(b=a);var e=a[0],i=a[1],c=a[2],k=a[3],d=Math.sqrt(e*e+i*i+c*c+k*k);if(0===d)return b[0]=0,b[1]=0,b[2]=0,b[3]=0,b;d=1/d;b[0]=e*d;b[1]=i*d;b[2]=c*d;b[3]=k*d;return b};c.multiply=function(a,b,e){e||(e=a);var i=a[0],c=a[1],k=a[2],a=a[3],d=b[0],m=b[1],f=b[2],b=b[3];e[0]=i*b+a*
  d+c*f-k*m;e[1]=c*b+a*m+k*d-i*f;e[2]=k*b+a*f+i*m-c*d;e[3]=a*b-i*d-c*m-k*f;return e};c.multiplyVec3=function(a,b,e){e||(e=b);var i=b[0],c=b[1],k=b[2],b=a[0],d=a[1],m=a[2],a=a[3],f=a*i+d*k-m*c,j=a*c+m*i-b*k,p=a*k+b*c-d*i,i=-b*i-d*c-m*k;e[0]=f*a+i*-b+j*-m-p*-d;e[1]=j*a+i*-d+p*-b-f*-m;e[2]=p*a+i*-m+f*-d-j*-b;return e};c.identity=function(a){a||(a=c.create());a[0]=0;a[1]=0;a[2]=0;a[3]=1;return a};c.toEuler=function(a,b){var e=a[0],i=a[1],c=a[2],k=a[3],d=i*i;b||(b=h.create());b[0]=57.2957795130824*t(2*(k*
  e+i*c),1-2*(e*e+d));b[1]=57.2957795130824*s(2*(k*i-c*e));b[2]=57.2957795130824*t(2*(k*c+e*i),1-2*(d+c*c));return b};c.angleAxis=function(a,b,e){var a=0.00872664625997*a,i=r(a);e||(e=c.create());e[3]=x(a);e[2]=b[2]*i;e[1]=b[1]*i;e[0]=b[0]*i;return e};c.lookAt=function(){var a=h.create(),b=h.create(),e=h.create(),i=o.create();return function(c,k,d,m){h.subtract(c,k,e);h.normalize(e);h.cross(d,e,b);h.normalize(b);h.cross(e,b,a);h.normalize(a);i[0]=b[0];i[1]=b[1];i[2]=b[2];i[3]=a[0];i[4]=a[1];i[5]=a[2];
  i[6]=e[0];i[7]=e[1];i[8]=e[2];return o.toQuat(i,m)}}();c.setEuler=function(a,b){var e=0.00872664625997*a[0],i=0.00872664625997*a[1],k=0.00872664625997*a[2],d=x(e),m=x(i),f=x(k),e=r(e),i=r(i),k=r(k);b||(b=c.create());b[3]=d*m*f+e*i*k;b[0]=e*m*f-d*i*k;b[1]=d*i*f+e*m*k;b[2]=d*m*k-e*i*f;return b};c.setFromRotationMatrix=function(a,b){var e,i,k,m;k=a[0];var f=a[4],j=a[8],p=a[1],g=a[5],n=a[9],h=a[2],o=a[6],t=a[10],s;s=Math.pow(d.determinant(a),1/3);m=Math.sqrt(Math.max(0,s+k+g+t))/2;e=Math.sqrt(Math.max(0,
  s+k-g-t))/2;i=Math.sqrt(Math.max(0,s-k+g-t))/2;k=Math.sqrt(Math.max(0,s-k-g+t))/2;e=0>o-n?-Math.abs(e):Math.abs(e);i=0>j-h?-Math.abs(i):Math.abs(i);k=0>p-f?-Math.abs(k):Math.abs(k);e=[e,i,k,m];b?c.set(e,b):b=c.create(e);c.normalize(b);return b};c.toMat3=function(a,b){b||(b=o.create());var e=a[0],i=a[1],c=a[2],k=a[3],d=e+e,m=i+i,f=c+c,j=e*d,p=e*m,e=e*f,g=i*m,i=i*f,c=c*f,d=k*d,m=k*m,k=k*f;b[0]=1-(g+c);b[1]=p+k;b[2]=e-m;b[3]=p-k;b[4]=1-(j+c);b[5]=i+d;b[6]=e+m;b[7]=i-d;b[8]=1-(j+g);return b};c.toMat4=
  function(a,b){b||(b=d.create());var e=a[0],i=a[1],c=a[2],k=a[3],m=e+e,f=i+i,j=c+c,p=e*m,g=e*f,e=e*j,n=i*f,i=i*j,c=c*j,m=k*m,f=k*f,k=k*j;b[0]=1-(n+c);b[1]=g+k;b[2]=e-f;b[3]=0;b[4]=g-k;b[5]=1-(p+c);b[6]=i+m;b[7]=0;b[8]=e+f;b[9]=i-m;b[10]=1-(p+n);b[11]=0;b[12]=0;b[13]=0;b[14]=0;b[15]=1;return b};c.slerp=function(a,b,e,i){i||(i=a);var c=a[0]*b[0]+a[1]*b[1]+a[2]*b[2]+a[3]*b[3],k,d;if(1<=y(c))return i!==a&&(i[0]=a[0],i[1]=a[1],i[2]=a[2],i[3]=a[3]),i;k=w(c);d=Math.sqrt(1-c*c);if(0.0010>y(d))return i[0]=
  0.5*a[0]+0.5*b[0],i[1]=0.5*a[1]+0.5*b[1],i[2]=0.5*a[2]+0.5*b[2],i[3]=0.5*a[3]+0.5*b[3],i;c=r((1-e)*k)/d;e=r(e*k)/d;i[0]=a[0]*c+b[0]*e;i[1]=a[1]*c+b[1]*e;i[2]=a[2]*c+b[2]*e;i[3]=a[3]*c+b[3]*e;return i};c.difference=function(a,b,e){e||(e=a);var i=-a[0],c=-a[1],k=-a[2],a=a[3],d=b[0],m=b[1],f=b[2],b=b[3];e[0]=i*b+a*d+c*f-k*m;e[1]=c*b+a*m+k*d-i*f;e[2]=k*b+a*f+i*m-c*d;e[3]=a*b-i*d-c*m-k*f;return e};c.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+"]"};g.aabb=f;f.create=function(a,b){var e=
  new Float32Array(6);a?(e[0]=a[0],e[1]=a[1],e[2]=a[2],6===a.length?(e[3]=a[3],e[4]=a[4],e[5]=a[5]):b?(e[3]=b[0],e[4]=b[1],e[5]=b[2]):(e[3]=e[0],e[4]=e[1],e[5]=e[2])):(e[0]=Number.MAX_VALUE,e[1]=Number.MAX_VALUE,e[2]=Number.MAX_VALUE,e[3]=-Number.MAX_VALUE,e[4]=-Number.MAX_VALUE,e[5]=-Number.MAX_VALUE);return e};f.set=function(a,b){b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];return b};f.transform=function(){var a=h.create();return function(b,e,i){var c=Number.MAX_VALUE,k=-Number.MAX_VALUE,
  m,j;i?f.set([c,c,c,k,k,k],i):i=f.create();for(c=0;2>c;c++)for(k=0;2>k;k++)for(m=0;2>m;m++)a[0]=b[3*c],a[1]=b[3*k+1],a[2]=b[3*m+2],j=d.multiplyVec3(e,a),f.addPoint(i,j);return i}}();f.merge=function(a,b,e){e||(e=a);e[0]=n(a[0],b[0]);e[1]=n(a[1],b[1]);e[2]=n(a[2],b[2]);e[3]=A(a[3],b[3]);e[4]=A(a[4],b[4]);e[5]=A(a[5],b[5]);return e};f.addPoint=function(a,b){var e=b[0],i=b[1],c=b[2];a[0]=n(a[0],e);a[1]=n(a[1],i);a[2]=n(a[2],c);a[3]=A(a[3],e);a[4]=A(a[4],i);a[5]=A(a[5],c);return a};f.center=function(a,
  b){b||(b=h.create());b[0]=0.5*(a[0]+a[3]);b[1]=0.5*(a[1]+a[4]);b[2]=0.5*(a[2]+a[5]);return b};f.halfVec3=function(a,b){b||(b=h.create());b[0]=0.5*(a[3]-a[0]);b[1]=0.5*(a[4]-a[1]);b[2]=0.5*(a[5]-a[2]);return b};f.diagonal=function(a,b){b||(b=h.create());b[0]=a[3]-a[0];b[1]=a[4]-a[1];b[2]=a[5]-a[2];return b};f.str=function(a){return"{("+a[0]+","+a[1]+","+a[2]+"),("+a[3]+","+a[4]+","+a[5]+")}"};g.frustum=j;j.extractPlanes=function(a,b,e){e||(e=new Float32Array(24));var i=a[0],c=a[1],k=a[2],d=a[3],m=
  a[4],f=a[5],j=a[6],p=a[7],g=a[8],n=a[9],h=a[10],o=a[11],t=a[12],s=a[13],v=a[14],a=a[15];e[0]=d+i;e[1]=p+m;e[2]=o+g;e[3]=a+t;e[4]=d-i;e[5]=p-m;e[6]=o-g;e[7]=a-t;e[8]=d-c;e[9]=p-f;e[10]=o-n;e[11]=a-s;e[12]=d+c;e[13]=p+f;e[14]=o+n;e[15]=a+s;e[16]=d+k;e[17]=p+j;e[18]=o+h;e[19]=a+v;e[20]=d-k;e[21]=p-j;e[22]=o-h;e[23]=a-v;if(b)for(b=0;6>b;b++)i=e[4*b],c=e[4*b+1],k=e[4*b+2],i=Math.sqrt(i*i+c*c+k*k),i=1/i,e[4*b]*=i,e[4*b+1]*=i,e[4*b+2]*=i,e[4*b+3]*=i;return e};j.OUTSIDE=0;j.INSIDE=1;j.INTERSECTING=2;j.intersectAabb=
  function(){var a=h.create(),b=h.create();return function(e,i){var c=j.INSIDE,k,d,m,p,g,n,o,h;f.center(i,a);f.halfVec3(i,b);m=a[0];p=a[1];g=a[2];n=b[0];o=b[1];h=b[2];for(k=0;6>k;k++){var t=4*k;d=e[t];var s=e[t+1],v=e[t+2],x=e[t+3],t=n*Math.abs(d)+o*Math.abs(s)+h*Math.abs(v);d=m*d+p*s+g*v+x;d=0<d-t?j.INSIDE:0>d+t?j.OUTSIDE:j.INTERSECTING;if(d===j.OUTSIDE)return d;d===j.INTERSECTING&&(c=j.INTERSECTING)}return c}}()})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.core"),l=KICK.namespace("KICK.scene"),h=new ArrayBuffer(4),u=new Uint32Array(h),o=new Uint8Array(h);g.Engine=function(d,c){var f={},j=null,n="string"===typeof d?document.getElementById(d):d,o=["experimental-webgl","webgl"],h=this,w=(new Date).getTime()-16,r=0,s=new g.Time,y=0,k=0,p=1,t=[],m=[],v,a=new g.Project(this),b=null,e=null,i,q={updateAndRender:function(){}},B={},z=function(a){h._gameLoop(a)},L=KICK.math.vec2;Object.defineProperties(this,{version:{value:"0.4.0"},
  resourceLoader:{value:new g.ResourceLoader(this)},project:{value:a},glState:{get:function(){return f}},gl:{get:function(){return j}},canvas:{value:n},activeScene:{get:function(){return i===q?null:i},set:function(a){i=null===a||"undefined"===typeof a?q:a}},mouseInput:{get:function(){b||(b=new g.MouseInput(h),this.addFrameListener(b));return b}},keyInput:{get:function(){e||(e=new g.KeyInput,this.addFrameListener(e));return e}},eventQueue:{get:function(){return v}},time:{value:s},config:{value:new g.Config(c||
  {})},paused:{get:function(){return null===B},set:function(a){a!==h.paused&&(a?(cancelRequestAnimFrame(B),B=null):(w=(new Date).getTime()-16,B=requestAnimationFrame(z,h.canvas)))}}});this.isFullScreenSupported=function(){return n.requestFullscreen||n.webkitRequestFullScreen||n.mozRequestFullScreen};this.setFullscreen=function(a){h.isFullScreenSupported()&&(a?n.requestFullscreen?n.requestFullscreen():n.webkitRequestFullScreen?(n.onwebkitfullscreenchange=function(){document.webkitIsFullScreen?(n.originalWidth=
  n.width,n.originalHeight=n.height,n.width=screen.width,n.height=screen.height):(n.width=n.originalWidth,n.height=n.originalHeight);h.canvasResized()},n.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)):n.mozRequestFullScreen&&n.mozRequestFullScreen():document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen())};this._gameLoop=function(a){r=a-w;w=a;r*=p;y+=r;k+=1;v.run();
  i.updateAndRender();for(a=m.length-1;0<=a;a--)m[a].frameUpdated();null!==B&&(B=requestAnimationFrame(z,h.canvas))};this.addFrameListener=function(a){m.push(a)};this.removeFrameListener=function(a){return g.Util.removeElementFromArray(m,a)};this.addContextListener=function(a){t.push(a)};this.removeContextListener=function(a){return g.Util.removeElementFromArray(t,a)};this.createUID=function(){return++a.maxUID};this.getUID=function(a){a.uid||(a.uid=h.createUID());return a.uid};this.canvasResized=function(){f.viewportSize=
  L.create([n.width,n.height]);b&&b.updateCanvasElementPosition()};(function(){var a,b,e=function(){for(a=o.length-1;0<=a;a--)try{if(j=n.getContext(o[a],h.config))break}catch(b){alert(b)}if(!j)return!1;h.config.enableDebugContext&&(window.WebGLDebugUtils?j=WebGLDebugUtils.makeDebugContext(j):console.log("webgl-debug.js not included - cannot find WebGLDebugUtils"));Object.freeze(j);j.enable(2929);j.enable(3089);return!0};e()?(n.addEventListener("webglcontextlost",function(e){b=h.paused;h.paused=!0;for(a=
  0;a<t.length;a++)t[a].contextLost();e.preventDefault();j=null},!1),n.addEventListener("webglcontextrestored",function(i){g.Util.removeAllProperties(f);h.canvasResized();e();for(a=0;a<t.length;a++)t[a].contextRestored(j);b||(h.paused=!1);i.preventDefault()},!1),h.canvasResized(),h.config.checkCanvasResizeInterval&&setInterval(function(){(n.height!==f.viewportSize[0]||n.width!==f.viewportSize[1])&&h.canvasResized()},h.config.checkCanvasResizeInterval),Object.defineProperties(s,{time:{get:function(){return y}},
  deltaTime:{get:function(){return r}},frame:{get:function(){return k}},scale:{get:function(){return p},set:function(a){p=a}}}),Object.freeze(s),i=new l.Scene(h),v=new g.EventQueue(h),k=y=0,h._gameLoop(w)):h.config.webglNotFoundFn(n)})()};g.EventQueue=function(d){var c=[],f=function(c,d){return c.timeStart-d.timeStart},j=d.time;this.add=function(d,h,o){var l=j.time+1,d={task:d,timeStart:h+l,timeEnd:(o||h)+l};g.Util.insertSorted(d,c,f);return d};this.cancel=function(d){g.Util.removeElementFromArray(c,
  d)};this.run=function(){var d,f=j.time,g=c.length,h;for(d=0;d<g&&(h=c[d]).timeStart<f;d++)h.task(),h.timeEnd<f&&(c.splice(d,1),g--)};this.clear=function(){c=[]}};g.ResourceTracker=function(d){var c=this;this.resourceReady=function(){d.removeResourceTracker(c)};this.resourceFailed=function(){d.removeResourceTracker(c)}};g.Project=function(d){var c={},f={},j=this,n=0,h=[],o=[],l=function(){var c;for(c=0;c<o.length;c++)o[c].resourceTrackerChanged()},r=function(k,d){if(c[k]instanceof g.ResourceDescriptor){var j=
  f[k];j&&c[k].updateConfig(j,d)}},s=function(c){var d=c.split("/");2<d.length?(d=d[d.length-2],d=d.substring(0,1).toUpperCase()+d.substring(1)):d=c;return d},y=function(c){var j=g.Project,n,m;if(c<=j.ENGINE_SHADER_DEFAULT&&c>=j.ENGINE_SHADER_UNLIT_VERTEX_COLOR){switch(c){case j.ENGINE_SHADER_DEFAULT:m="kickjs://shader/default/";break;case j.ENGINE_SHADER_SPECULAR:m="kickjs://shader/specular/";break;case j.ENGINE_SHADER_DIFFUSE:m="kickjs://shader/diffuse/";break;case j.ENGINE_SHADER_UNLIT:m="kickjs://shader/unlit/";
  break;case j.ENGINE_SHADER_UNLIT_VERTEX_COLOR:m="kickjs://shader/unlit_vertex_color/";break;case j.ENGINE_SHADER_TRANSPARENT_SPECULAR:m="kickjs://shader/transparent_specular/";break;case j.ENGINE_SHADER_TRANSPARENT_DIFFUSE:m="kickjs://shader/transparent_diffuse/";break;case j.ENGINE_SHADER_TRANSPARENT_UNLIT:m="kickjs://shader/transparent_unlit/";break;case j.ENGINE_SHADER___SHADOWMAP:m="kickjs://shader/__shadowmap/";break;case j.ENGINE_SHADER___PICK:m="kickjs://shader/__pick/";break;case j.ENGINE_SHADER___ERROR:m=
  "kickjs://shader/__error/";break;default:return null}n=new KICK.material.Shader(d,{dataURI:m,name:s(m),uid:c})}else if(c<=j.ENGINE_TEXTURE_BLACK&&c>=j.ENGINE_TEXTURE_CUBEMAP_WHITE){n=c===j.ENGINE_TEXTURE_CUBEMAP_WHITE;switch(c){case j.ENGINE_TEXTURE_BLACK:m="kickjs://texture/black/";break;case j.ENGINE_TEXTURE_WHITE:m="kickjs://texture/white/";break;case j.ENGINE_TEXTURE_GRAY:m="kickjs://texture/gray/";break;case j.ENGINE_TEXTURE_LOGO:m="kickjs://texture/logo/";break;case j.ENGINE_TEXTURE_CUBEMAP_WHITE:break;
  default:return null}n?(n=new KICK.texture.Texture(d,{name:"cubemap_white",minFilter:9728,magFilter:9728,generateMipmaps:!1,uid:c,textureType:34067}),j=document.createElement("canvas"),j.width=12,j.height=2,m=j.getContext("2d"),m.fillStyle="rgb(255,255,255)",m.fillRect(0,0,12,2),n.setImage(j,"memory://cubemap_white/")):n=new KICK.texture.Texture(d,{name:s(m),minFilter:9728,magFilter:9728,generateMipmaps:!1,uid:c,textureType:3553,dataURI:m})}else if(c<=j.ENGINE_MESH_TRIANGLE&&c>=j.ENGINE_MESH_CUBE){switch(c){case j.ENGINE_MESH_TRIANGLE:m=
  "kickjs://mesh/triangle/";break;case j.ENGINE_MESH_PLANE:m="kickjs://mesh/plane/";break;case j.ENGINE_MESH_UVSPHERE:m="kickjs://mesh/uvsphere/";break;case j.ENGINE_MESH_CUBE:m="kickjs://mesh/cube/";break;default:return null}n=new KICK.mesh.Mesh(d,{dataURI:m,name:s(m),uid:c})}return f[c]=n};g.Util.copyStaticPropertiesToObject(j,g.Project);Object.defineProperties(this,{maxUID:{get:function(){return n},set:function(c){n=c}},resourceDescriptorUIDs:{get:function(){var d=[],f;for(f in c)c.hasOwnProperty(f)&&
  d.push(f);return d}}});this.newProject=function(){j.loadProject({maxUID:0,resourceDescriptors:[]})};this.loadProjectByURL=function(c,d,f){var m=function(){},g,d=d||m,f=f||m;g=new XMLHttpRequest;g.open("GET",c,!0);g.onreadystatechange=function(){if(4===g.readyState)if(200===g.status){var a=JSON.parse(g.responseText);try{j.loadProject(a,d,f)}catch(b){debugger;f(b)}}else f()};g.send(null)};this.createResourceTracker=function(){var c=new KICK.core.ResourceTracker(j);h.push(c);l();return c};this.removeResourceTracker=
  function(c){KICK.core.Util.removeElementFromArray(h,c)&&l()};this.loadProject=function(k,f,s){0<n&&j.closeProject();var k=k||{},m=k.resourceDescriptors||[],v,a,b,e;n=k.maxUID||0;for(v=0;v<m.length;v++)j.addResourceDescriptor(m[v]);for(a in c)if(c.hasOwnProperty(a))try{j.load(a)}catch(i){s?s(i):g.Util.warn(i)}b=function(){n=k.maxUID||0;d.activeScene=k.activeScene?j.load(k.activeScene):null;f&&f()};e={resourceTrackerChanged:function(){0===h.length&&(KICK.core.Util.removeElementFromArray(o,e),b())}};
  o.push(e);l()};this.closeProject=function(){for(var d in c)c.hasOwnProperty(d)&&j.removeResourceDescriptor(d);c={};f={}};this.load=function(k){var j=f[k];return j?j:(j=c[k])?(j=j.instantiate(d),f[k]=j):y(k)};this.removeCacheReference=function(c){f[c]&&delete f[c]};this.loadByName=function(d,f){var g,m;for(g in c)if(c.hasOwnProperty(g)&&(m=c[g],m.name===d&&(!f||m.type===f)))return j.load(m.uid);return null};this.registerObject=function(k,j){var n=d.getUID(k);f[n]||(f[n]=k,c[n]||(c[n]=new g.ResourceDescriptor({uid:n,
  type:j,config:{name:k.name}})))};this.refreshResourceDescriptors=function(d){var f,d=d||function(){return!0};for(f in c)c.hasOwnProperty(f)&&r(f,d)};this.getEngineResourceDescriptorsByType=function(c){var d=[],f,m,j;"KICK.mesh.Mesh"===c?f="ENGINE_MESH_":"KICK.material.Shader"===c?f="ENGINE_SHADER_":"KICK.texture.Texture"===c&&(f="ENGINE_TEXTURE_");if(f)for(m in g.Project)"number"===typeof g.Project[m]&&(g.Project.hasOwnProperty(m)&&0===m.indexOf(f))&&(j=g.Project[m],m=g.Util.toCamelCase(m.substr(f.length),
  " "),d.push(new g.ResourceDescriptor({type:c,config:{name:m,uid:j}})));return d};this.getResourceDescriptorsByType=function(d){var f=[],j;for(j in c)c.hasOwnProperty(j)&&c[j].type===d&&f.push(c[j]);return f};this.getResourceDescriptorsByName=function(d){var f=[],j;for(j in c)c.hasOwnProperty(j)&&c[j].name===d&&f.push(c[j]);return f};this.getResourceDescriptor=function(d){r(d);return c[d]};this.addResourceDescriptor=function(d){d instanceof g.ResourceDescriptor||(d=new g.ResourceDescriptor(d));return c[d.uid]=
  d};this.removeResourceDescriptor=function(d){var j=f[d];j&&(delete f[d],j.destroy&&j.destroy());delete c[d]};this.toJSON=function(f){var h=[],o,m,f=f||function(){return!0};j.refreshResourceDescriptors(f);for(o in c)c.hasOwnProperty(o)&&0<=o&&(m=c[o],m instanceof g.ResourceDescriptor&&f(m)&&h.push(m.toJSON(f)));return{engineVersion:d.version,maxUID:n,activeScene:d.activeScene?d.activeScene.uid:0,resourceDescriptors:h}}};g.Project.ENGINE_SHADER_DEFAULT=-100;g.Project.ENGINE_SHADER_SPECULAR=-101;g.Project.ENGINE_SHADER_UNLIT=
  -102;g.Project.ENGINE_SHADER_TRANSPARENT_SPECULAR=-103;g.Project.ENGINE_SHADER_TRANSPARENT_UNLIT=-104;g.Project.ENGINE_SHADER___SHADOWMAP=-105;g.Project.ENGINE_SHADER___PICK=-106;g.Project.ENGINE_SHADER___ERROR=-107;g.Project.ENGINE_SHADER_DIFFUSE=-108;g.Project.ENGINE_SHADER_TRANSPARENT_DIFFUSE=-109;g.Project.ENGINE_SHADER_UNLIT_VERTEX_COLOR=-110;g.Project.ENGINE_TEXTURE_BLACK=-200;g.Project.ENGINE_TEXTURE_WHITE=-201;g.Project.ENGINE_TEXTURE_GRAY=-202;g.Project.ENGINE_TEXTURE_LOGO=-203;g.Project.ENGINE_TEXTURE_CUBEMAP_WHITE=
  -204;g.Project.ENGINE_MESH_TRIANGLE=-300;g.Project.ENGINE_MESH_PLANE=-301;g.Project.ENGINE_MESH_UVSPHERE=-302;g.Project.ENGINE_MESH_CUBE=-303;g.ResourceDescriptor=function(d){var d=d||{},c=d.type,f=d.uid,j=d.config,n=g.Util.hasProperty;Object.defineProperties(this,{name:{get:function(){return j.name},set:function(c){j.name=c}},type:{value:c},config:{get:function(){return j}},uid:{value:f}});this.updateConfig=function(c,d){j=c.toJSON?c.toJSON(d):c};this.instantiate=function(d){var g=KICK.namespace(c),
  h=j,o={},s,l,k,p;for(s in h)n(h,s)&&(k=(l=h[s])?l.reftype:null,p=l?l.ref:null,l&&(p&&k)&&("resource"===k?l=d.resourceLoader[l.refMethod](p):"project"===k&&(l=d.project.load(p))),o[s]=l);o.uid=f;d=new g(d,o);"function"===typeof d.init&&d.init();return d};this.toJSON=function(){return{type:c,uid:f,config:j}}};g.Config=function(d){this.shadows=d.shadows||!1;this.shadowDistance=d.shadowDistance||20;this.shadowNearMultiplier=d.shadowNearMultiplier||2;this.shadowMapQuality=d.shadowMapQuality||1;this.maxNumerOfLights=
  "number"===typeof d.maxNumerOfLights?d.maxNumerOfLights:1;this.enableDebugContext="boolean"===typeof d.enableDebugContext?d.enableDebugContext:!1;this.preserveDrawingBuffer=d.preserveDrawingBuffer||!1;this.alpha="boolean"===typeof d.alpha?d.alpha:!0;this.depth="boolean"===typeof d.depth?d.depth:!0;this.stencil="boolean"===typeof d.stencil?d.stencil:!1;this.antialias="boolean"===typeof d.antialias?d.antialias:!0;this.premultipliedAlpha="boolean"===typeof d.premultipliedAlpha?d.premultipliedAlpha:!0;
  this.checkCanvasResizeInterval=d.checkCanvasResizeInterval||0;this.webglNotFoundFn=function(){return d.webglNotFoundFn?"string"===typeof d.webglNotFoundFn?KICK.namespace(d.webglNotFoundFn):d.webglNotFoundFn:function(c){var d;c.innerHTML="";d=document.createElement("div");d.style.cssText=c.style.cssText+";width:"+c.width+"px;height:"+c.height+"px;display: table-cell;vertical-align: middle;background:#ffeeee;";d.innerHTML="<div style='padding:12px;text-align: center;'><img src='http://www.khronos.org/assets/images/api_logos/webgl.png' style='width:74px;35px;margin-bottom: 10px;margin-left: auto;'><br clear='all'>It doesn't appear your computer can support WebGL.<br><br><a href=\"http://get.webgl.org/troubleshooting/\">Click here for more information.</a></div>";
  c.parentNode.replaceChild(d,c)}}()};g.Time=function(){this.scale=this.frame=this.deltaTime=this.time=0};g.MouseInput=function(d){var c=KICK.math.vec2,f=[],j=[],n=[],h=c.create(),o=c.create(),l=null,r=c.create(),s=c.create(),y=!1,k=d.canvas,p=g.Util.removeElementFromArray,t=g.Util.contains,m=!0,v=!0,a=document.body,b=-1!==navigator.userAgent.indexOf("Firefox"),e=-1!==navigator.userAgent.indexOf("Chrome"),i=function(a){a.preventDefault();return!1},q=function(b){h[0]=b.clientX-r[0]+a.scrollLeft;h[1]=
  b.clientY-r[1]+a.scrollTop;l?c.subtract(h,o,l):l=c.create();c.set(h,o)},B=function(a){e?(s[0]+=a.wheelDeltaX,s[1]+=a.wheelDeltaY):1===a.axis?s[0]-=a.detail:s[1]-=a.detail;if(y)return a.preventDefault(),!1},z=function(a){a=a.button;t(f,a)||(n.push(a),f.push(a));m||q()},L=function(a){a=a.button;j.push(a);p(f,a);m||q()},E=function(){var a;if(v)for(a=f.length-1;0<=a;a--)L({button:f[a]})},u=function(){for(var a=k,b=0,e=0;a.offsetParent;)b+=a.offsetLeft,e+=a.offsetTop,a=a.offsetParent;b+=a.offsetLeft;e+=
  a.offsetTop;r[0]=b;r[1]=e};Object.defineProperties(this,{mousePosition:{get:function(){return h}},deltaMovement:{get:function(){return l||c.create()}},deltaWheel:{get:function(){return s}},mouseWheelPreventDefaultAction:{get:function(){return y},set:function(a){y=a}},releaseMouseButtonOnMouseOut:{get:function(){return v},set:function(a){a!==v&&((v=a)?k.addEventListener("mouseout",E,!1):k.removeEventListener("mouseout",E,!1))}},mouseMovementEventsEnabled:{get:function(){return m},set:function(a){m!==
  a&&((m=a)?k.addEventListener("mousemove",q,!1):(k.removeEventListener("mousemove",q,!1),l=null))}}});this.isButtonDown=function(a){return t(n,a)};this.isButtonUp=function(a){return t(j,a)};this.isButton=function(a){return t(f,a)};this.frameUpdated=function(){n.length=0;j.length=0;s[0]=0;s[1]=0;l&&(l[0]=0,l[1]=0)};this.updateCanvasElementPosition=u;(function(){u();var a=d.canvas;a.addEventListener("mousedown",z,!0);a.addEventListener("mouseup",L,!0);a.addEventListener("mousemove",q,!0);a.addEventListener("mouseout",
  E,!0);a.addEventListener("contextmenu",i,!0);b?a.addEventListener("MozMousePixelScroll",B,!0):e?a.addEventListener("mousewheel",B,!0):a.addEventListener("DOMMouseScroll",B,!0)})()};g.KeyInput=function(){var d=[],c=[],f=[],j=g.Util.removeElementFromArray,n=g.Util.contains;this.isKeyDown=function(c){return n(d,c)};this.isKeyUp=function(d){return n(c,d)};this.isKey=function(c){return n(f,c)};this.frameUpdated=function(){d.length=0;c.length=0};document.addEventListener("keydown",function(c){c=c.keyCode;
  n(f,c)||(d.push(c),f.push(c))},!1);document.addEventListener("keyup",function(d){d=d.keyCode;c.push(d);j(f,d)},!1)};g.Util={deserializeConfig:function(d,c,f){var j;if("number"===typeof d)return d;if(Array.isArray(d)){var n=Array(d.length);for(j=0;j<d.length;j++)n[j]=g.Util.deserializeConfig(d[j],c,f);d=n}else if(d&&d&&d.ref&&d.reftype)if("project"===d.reftype)d=c.project.load(d.ref);else if("gameobject"===d.reftype||"component"===d.reftype)d=f.getObjectByUID(d.ref);return d},deepCopy:function(d,c){var f;
  f=!1;var j,c=c||[];for(j=0;j<c.length;j++)if(d instanceof c[j]){f=!0;break}j=typeof d;if(f)f=d;else if(null===d||"undefined"===typeof d)f=null;else if(Array.isArray(d)||d.buffer instanceof ArrayBuffer){f=[];for(j=0;j<d.length;j++)f[j]=g.Util.deepCopy(d[j],c)}else if("object"===j){f={};for(var n in d)d.hasOwnProperty(n)&&(f[n]=g.Util.deepCopy(d[n],c))}else f=d;return f},copyStaticPropertiesToObject:function(d,c){for(var f in c)c.hasOwnProperty(f)&&Object.defineProperty(d,f,{value:c[f]})},hasProperty:function(d,
  c){return Object.prototype.hasOwnProperty.call(d,c)},toCamelCase:function(d,c){c||(c="");var f,j=!0,g,h="",o;for(f=0;f<d.length;f++){g=d.charAt(f);if("_"!==g)break;h+=g}for(;f<d.length;f++)g=d.charAt(f),(o="_"===g)&&(g=c),h+=j?g.toUpperCase():g.toLowerCase(),j=o;return h},getJSONReference:function(d,c){if(null===c)return null;var f=c instanceof KICK.scene.GameObject;return!f&&c.gameObject instanceof KICK.scene.GameObject||f?{ref:d.getUID(c),name:"string"===typeof c.name?c.name:"",reftype:f?"gameobject":
  "component"}:{ref:c.uid,name:c.name,reftype:"project"}},componentToJSON:function(d,c,f){var j,h={},o={},f={type:f||c.constructor.name,uid:d.getUID(c),config:h},l;""===f.type&&g.Util.fail("Cannot serialize object type. Either provide toJSON function or use explicit function name 'function SomeObject(){}' ");var w=function(c){var f,j,k;if(Array.isArray(c)){f=[];for(j=0;j<c.length;j++)k=w(c[j]),f.push(k);return f}f=typeof c;return"function"!==f?c&&c.buffer instanceof ArrayBuffer?g.Util.typedArrayToArray(c):
  "object"===f?g.Util.getJSONReference(d,c):c:o};for(j in c)g.Util.hasProperty(c,j)&&"gameObject"!==j&&(l=c[j],l=w(l),l!==o&&(h[j]=l));return f},applyConfig:function(d,c,f){var j=g.Util.contains,h=g.Util.hasProperty,c=c||{},f=f||[],o;for(o in c)"function"!==typeof c[o]&&(!j(f,o)&&h(d,o))&&(d[o]=c[o]);c.uid&&c.uid!==d.uid&&(d.uid=c.uid)},getParameter:function(d,c){var f=RegExp("[\\?&]"+c+"=([^&#]*)").exec(d);return null===f?null:f[1]},getParameterInt:function(d,c,f){d=g.Util.getParameter(d,c);return null===
  d?f:parseInt(d,10)},getParameterFloat:function(d,c,f){d=g.Util.getParameter(d,c);return null===d?f:parseFloat(d)},scaleImage:function(d,c,f){var j=document.createElement("canvas");j.width=c;j.height=f;j.getContext("2d").drawImage(d,0,0,d.width,d.height,0,0,j.width,j.height);return j},warn:function(d){debugger;console.log(d)},fail:function(d){debugger;console.error(d)},typedArrayToArray:function(d){var c=d.length,f=Array(c),j;for(j=0;j<c;j++)f[j]=d[j];return f},removeElementFromArray:function(d,c,
  f){var j=!1,g;for(g=d.length-1;0<=g&&!(d[g]===c&&(j=!0,d.splice(g,1),!f));g--);return j},removeElementsFromArray:function(d,c){var f,j;for(f=d.length-1;0<=f;f--)for(j=c.length-1;0<=j;j--)d[f]===c[j]&&d.splice(f,1)},insertSorted:function(d,c,f){var j;f||(f=g.Util.numberSortFunction);for(j=c.length-1;0<=j;j--)if(0>=f(c[j],d)){c.splice(j+1,0,d);return}c.unshift(d)},numberSortFunction:function(d,c){return d-c},contains:function(d,c){var f;for(f=d.length-1;0<=f;f--)if(d[f]===c)return!0;return!1},uint32ToVec4:function(d,
  c){var f;c||(c=new Float32Array(4));u[0]=d;for(f=0;4>f;f++)c[f]=o[f]/255;return c},vec4ToUint32:function(d){var c;for(c=0;4>c;c++)o[c]=255*d[c];return u[0]},vec4uint8ToUint32:function(d){var c;for(c=0;4>c;c++)o[c]=d[c];return u[0]},utf8Encode:function(d){var c=[],f,j;for(f=0;f<d.length;f++)j=d.charCodeAt(f),127>j?c.push(j):2047>=j?(c.push(192+(j>>6)),c.push(128+(j&63))):65535>=j&&(c.push(224+(j>>12)),c.push(128+(j>>6&63)),c.push(128+(j&63)));return new Uint8Array(c)},removeAllProperties:function(d){for(var c in d)d.hasOwnProperty(c)&&
  delete d[c]},utf8Decode:function(d){var c="",f,j,g,h;for(f=0;f<d.length;f++)j=d[f],0===(j&128)?c+=String.fromCharCode(j):192===(j&224)?(f++,g=d[f],j=(j&31)<<6,g&=63,j+=g,c+=String.fromCharCode(j)):224===(j&240)&&(f++,g=d[f],f++,h=d[f],j=(j&31)<<12,g=(g&63)<<6,h&=63,j=j+g+h,c+=String.fromCharCode(j));return c}};Object.freeze(g.Util);"undefined"===typeof window.requestAnimationFrame&&(window.requestAnimationFrame=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||
  window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(d){return window.setTimeout(d,16.7,(new Date).getTime())}}(),window.cancelRequestAnimFrame=window.cancelAnimationFrame||window.webkitCancelRequestAnimationFrame||window.mozCancelRequestAnimationFrame||window.oCancelRequestAnimationFrame||window.msCancelRequestAnimationFrame||clearTimeout);"undefined"===typeof window.console&&(window.console={});"undefined"===typeof window.console.log&&(window.console.log=function(d){alert(d)})})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.core"),l=g.Util.utf8Decode,h=g.Util.utf8Encode,u=new Uint8Array(4);g.ChunkData=function(){var g=function(c,d,f,g){var h=this;this.chunkId=c;this.chunkType=d;this.chunkDataLength=f;this.data=g;Object.defineProperties(this,{paddingSize:{get:function(){var c=h.data.length*h.data.BYTES_PER_ELEMENT%8;return c?8-c:0}},paddingData:{get:function(){return u.subarray(0,h.paddingSize)}}})},d=this,c=[],f=function(c){return 1===c?Float32Array:2===c?Float64Array:3===c?Int16Array:
  4===c?Int32Array:5===c?Int8Array:6===c?Uint16Array:8===c?Uint8Array:null};this.getSize=function(){var d=0,f;for(f=0;f<c.length;f++)d+=c[f].chunkDataLength+8+c[f].paddingSize;d=8+d;f=d%8;0!==f&&(d+=8-f);return d};this.serialize=function(){var j=new ArrayBuffer(d.getSize()),g=0,h=new Uint8Array(j,0),o=new Uint16Array(j,g),l;o[0]=61441;o[1]=1;g+=4;o=new Uint32Array(j,g);o[0]=c.length;g+=4;for(l=0;l<c.length;l++)o=new Uint16Array(j,g),o[0]=c[l].chunkId,o[1]=c[l].chunkType,g+=4,o=new Uint32Array(j,g),
  o[0]=c[l].chunkDataLength,g+=4,o=f(c[l].chunkType),o=new o(j),o.set(c[l].data,g/o.BYTES_PER_ELEMENT),g+=c[l].chunkDataLength,h.set(c[l].paddingData,g),g+=c[l].paddingSize;return j};this.get=function(d){var f;for(f=0;f<c.length;f++)if(c[f].chunkId===d)return c[f].data;return null};this.getString=function(c){return(c=d.get(c))?l(c):null};this.getNumber=function(c){return(c=d.get(c))?c[0]:null};this.getArrayBuffer=function(c){var c=d.get(c),f,g;return c?(f=new ArrayBuffer(c.length*c.BYTES_PER_ELEMENT),
  g=new Uint8Array(f),g.set(c),f):null};this.remove=function(d){var f;for(f=0;f<c.length;f++)if(c[f].chunkId===d)return c=c.splice(f,1),!0;return!1};this.setString=function(c,f){var g=h(f);d.set(c,g)};this.setNumber=function(c,f){var g=new Float32Array([f]);d.set(c,g)};this.setArrayBuffer=function(c,f){d.set(c,new Uint8Array(f))};this.set=function(f,h){d.remove(f);var l=h instanceof Float32Array?1:h instanceof Float64Array?2:h instanceof Int16Array?3:h instanceof Int32Array?4:h instanceof Int8Array?
  5:h instanceof Uint16Array?6:h instanceof Uint8Array?8:null,x;l&&(x=h.length*h.BYTES_PER_ELEMENT,c.push(new g(f,l,x,h)))};this.deserialize=function(d){if(!(d instanceof ArrayBuffer))return!1;var h=[],l=0,x=new Uint16Array(d,l),w,r,s,y,k;if(61441!==x[0]||1!==x[1])return!1;l+=4;w=new Uint32Array(d,l);r=w[0];l+=4;for(s=0;s<r;s++)x=new Uint16Array(d,l),y=x[0],x=x[1],l+=4,w=new Uint32Array(d,l),w=w[0],l+=4,k=f(x),k=new k(d,l,w/k.BYTES_PER_ELEMENT),y=new g(y,x,w,k),h.push(y),l+=w,l+=y.paddingSize;c=h;return!0}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.texture"),l=KICK.namespace("KICK.core"),h=KICK.math.vec2,u=function(d){var c;--d;for(c=1;32>c;c<<=1)d|=d>>c;return d+1},o=KICK.core.Util.applyConfig;g.RenderTexture=function(d,c){var f=d.gl,j=d.glState,g=f.createFramebuffer(),l=null,x=h.create(),w=[],r=this,s="",y=function(){var c;for(c=0;c<w.length;c++)f.deleteRenderbuffer(w[c])},k=function(){var c;x=l?l.dimension:x;y();f.bindFramebuffer(36160,g);l?f.framebufferTexture2D(36160,36064,3553,l.textureId,0):(c=f.createRenderbuffer(),
  f.bindRenderbuffer(36161,c),f.renderbufferStorage(36161,32854,x[0],x[1]),f.framebufferRenderbuffer(36160,36064,36161,c),w.push(c));c=f.createRenderbuffer();f.bindRenderbuffer(36161,c);f.renderbufferStorage(36161,33189,x[0],x[1]);f.framebufferRenderbuffer(36160,36096,36161,c);w.push(c);f.bindFramebuffer(36160,null)};this.bind=function(){j.renderTarget=r;f.bindFramebuffer(36160,g)};Object.defineProperties(this,{dimension:{get:function(){return x},set:function(c){(x=c)&&k()}},colorTexture:{get:function(){return l},
  set:function(c){(l=c)&&k()}},name:{get:function(){return s},set:function(c){s=c}}});this.destroy=function(){null!==g&&(y(),f.deleteFramebuffer(g),g=null,d.project.removeResourceDescriptor(r.uid))};this.toJSON=function(){return{uid:r.uid,name:s,colorTexture:KICK.core.Util.getJSONReference(d,l)}};o(r,c);d.project.registerObject(r,"KICK.texture.RenderTexture")};g.Texture=function(d,c){var f=d.gl,j=d.glState,g=f.createTexture(),A="Texture",x=10497,w=10497,r=9729,s=9729,y=!0,k="memory://void",p=!0,t=6408,
  m=3553,v=null,a=this,b=h.create(),e=function(){null!==v&&v!==m&&(f.deleteTexture(g),g=f.createTexture());v=m},i={contextLost:function(){f=null},contextRestored:function(a){f=a;g=f.createTexture()}};this.init=function(){k&&d.resourceLoader.getImageData(k,a)};this.apply=function(){a.bind(0);3553===m&&(f.texParameteri(3553,10242,x),f.texParameteri(3553,10243,w));f.texParameteri(m,10240,s);f.texParameteri(m,10241,r)};this.bind=function(a){f.activeTexture(33984+a);f.bindTexture(m,g)};this.destroy=function(){null!==
  g&&(f.deleteTexture(g),g=null,d.project.removeResourceDescriptor(a.uid));d.removeContextListener(i)};this.setImage=function(c,i){var d,g,o,s,n,v,r,x;k=i;e();a.bind(0);if(3553===m){if(0!==(c.width&c.width-1)||0!==(c.height&c.height-1))d=u(c.width),g=u(c.height),c=l.Util.scaleImage(c,d,g);p?f.pixelStorei(37440,!0):f.pixelStorei(37440,!1);f.pixelStorei(3317,1);f.texImage2D(3553,0,t,t,5121,c);h.set([c.width,c.height],b)}else{o=[34069,34070,34071,34072,34073,34074];s=c.width/6;n=c.height;d=g=u(c.height);
  v=document.createElement("canvas");v.width=d;v.height=g;r=v.getContext("2d");for(x=0;6>x;x++)r.drawImage(c,x*s,0,s,n,0,0,d,g),f.pixelStorei(37440,!1),f.pixelStorei(3317,1),f.texImage2D(o[x],0,t,t,5121,v);h.set([d,g],b)}a.apply();y&&f.generateMipmap(m);j.currentMaterial=null};this.isFPTexturesSupported=function(){var a=f.isTexFloatEnabled;"boolean"!==typeof a&&(a=f.getExtension("OES_texture_float"),f.isTexFloatEnabled=a);return a};this.setImageData=function(c,d,i,g,o,p){var l;e();5126===g&&!f.isTexFloatEnabled&&
  (l=a.isFPTexturesSupported(),l||(KICK.core.Util.fail("OES_texture_float unsupported on the platform. Using 5121 instead of 5126."),g=5121));3553!==m?KICK.core.Util.fail("Texture.setImageData only supported by TEXTURE_2D"):(l=t,h.set([c,d],b),k=p,a.bind(0),f.pixelStorei(3317,1),f.texImage2D(3553,0,t,c,d,i,l,g,o),f.texParameteri(3553,10240,s),f.texParameteri(3553,10241,r),f.texParameteri(3553,10242,x),f.texParameteri(3553,10243,w),y&&f.generateMipmap(3553),j.currentMaterial=null)};this.setTemporaryTexture=
  function(){var a=new Uint8Array([255,255,255,0,0,0,0,0,0,255,255,255]),b=t;t=6407;this.setImageData(2,2,0,5121,a,"tempTexture");t=b};this.setDataURI=function(b,e){b!==k&&(k=b,e&&d.resourceLoader.getImageData(k,a))};Object.defineProperties(this,{engine:{value:d},textureId:{value:g},name:{get:function(){return A},set:function(a){A=a}},dimension:{get:function(){return b}},dataURI:{get:function(){return k},set:function(b){a.setDataURI(b,!0)}},wrapS:{get:function(){return x},set:function(a){x=a}},wrapT:{get:function(){return w},
  set:function(a){w=a}},minFilter:{get:function(){return r},set:function(a){r=a}},magFilter:{get:function(){return s},set:function(a){s=a}},generateMipmaps:{get:function(){return y},set:function(a){y=a}},flipY:{get:function(){return p},set:function(a){p=a}},internalFormat:{get:function(){return t},set:function(a){6406!==a&&(6407!==a&&6408!==a&&6409!==a&&6410!==a)&&KICK.core.Util.fail("Texture.internalFormat should be either 6406, 6407, 6408, 6409, or LUMINANCE_ALPHA");t=a}},textureType:{get:function(){return m},
  set:function(a){3553!==a&&34067!==a&&KICK.core.Util.fail("Texture.textureType should be either 3553 or 34067");m=a}}});this.toJSON=function(){return{uid:a.uid,wrapS:x,wrapT:w,minFilter:r,magFilter:s,name:A,generateMipmaps:y,flipY:p,internalFormat:t,textureType:m,dataURI:k}};d.addContextListener(i);o(a,c,["dataURI"]);c&&c.dataURI&&(a.dataURI=c.dataURI);d.project.registerObject(a,"KICK.texture.Texture")};g.MovieTexture=function(d,c){var f=d.gl,g=d.glState,h="MovieTexture",l=null,x=f.createTexture(),
  w=33071,r=33071,s=9728,y=9728,k=6408,p=0,t=!1,m=d.time,v=this,a=-1;this.bind=function(b){f.activeTexture(33984+b);f.bindTexture(3553,x);a<m.frame&&l&&(a=m.frame+p,f.pixelStorei(f.UNPACK_FLIP_Y_WEBGL,!0),f.texImage2D(f.TEXTURE_2D,0,f.RGBA,f.RGBA,f.UNSIGNED_BYTE,l),t&&f.generateMipmap(3553))};this.destroy=function(){null!==x&&(g.currentMaterial=null,f.deleteTexture(x),x=null,d.project.removeResourceDescriptor(v.uid))};this.setTemporaryTexture=function(){var a=new Uint8Array([255,255,255,0,0,0,0,0,0,
  255,255,255]);v.bind(0);f.pixelStorei(3317,1);f.texImage2D(3553,0,k,2,2,0,6407,5121,a);f.texParameteri(3553,10240,y);f.texParameteri(3553,10241,s);f.texParameteri(3553,10242,w);f.texParameteri(3553,10243,r);g.currentMaterial=null};Object.defineProperties(this,{name:{get:function(){return h},set:function(a){h=a}},skipFrames:{get:function(){return p},set:function(a){p=a}},videoElement:{get:function(){return l},set:function(a){l=a}},generateMipmaps:{get:function(){return t},set:function(a){t=a}},textureId:{value:x},
  wrapS:{get:function(){return w},set:function(a){w=a}},wrapT:{get:function(){return r},set:function(a){r=a}},minFilter:{get:function(){return s},set:function(a){s=a}},magFilter:{get:function(){return y},set:function(a){y=a}},internalFormat:{get:function(){return k},set:function(a){6406!==a&&(6407!==a&&6408!==a&&6409!==a&&6410!==a)&&KICK.core.Util.fail("Texture.internalFormat should be either 6406, 6407, 6408, 6409, or LUMINANCE_ALPHA");k=a}}});this.toJSON=function(){return{uid:v.uid,wrapS:w,wrapT:r,
  minFilter:s,name:h,magFilter:y,internalFormat:k}};o(v,c);d.project.registerObject(v,"KICK.texture.MovieTexture")}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.scene"),l=KICK.namespace("KICK.core");KICK.namespace("KICK.math");var h=KICK.namespace("KICK.math.vec3"),u=KICK.namespace("KICK.math.quat4"),o=KICK.namespace("KICK.math.vec4"),d=KICK.namespace("KICK.math.mat4"),c=KICK.namespace("KICK.math.aabb"),f=KICK.namespace("KICK.math.frustum"),j=KICK.core.Util.applyConfig,n=KICK.core.Util.insertSorted,A=KICK.core.Util.vec4uint8ToUint32;g.GameObject=function(c,d){var f=new KICK.scene.Transform(this),g=[f],h=1,k,o=c.engine.createUID(),
  n=this;Object.defineProperties(this,{scene:{value:c},engine:{value:c.engine},transform:{value:f},layer:{get:function(){return h},set:function(c){"number"!==typeof c&&KICK.core.Util.fail("GameObject.layer must be a Number");h=c}},name:{get:function(){return k},set:function(c){k=c}},uid:{get:function(){return o},set:function(c){o=c}},numberOfComponents:{get:function(){return g.length}},destroyed:{get:function(){return 0===g.length}}});this.getComponent=function(c){return g[c]};this.addComponent=function(d){if(!(d instanceof
  KICK.scene.Transform)){if(d.gameObject)throw{name:"Error",message:"Component "+d+" already added to gameObject "+d.gameObject};d.scriptPriority||(d.scriptPriority=0);d.gameObject=this;g.push(d);c.addComponent(d)}};this.removeComponent=function(d){try{delete d.gameObject}catch(f){}l.Util.removeElementFromArray(g,d);c.removeComponent(d)};this.notifyComponentUpdated=function(d){c.notifyComponentUpdated(d)};this.destroy=function(){var d;for(d=g.length-1;0<=d;d--)n.removeComponent(g[d]);c.destroyObject(n)};
  this.getComponentOfType=function(c){var d,a;for(a=g.length-1;0<=a;a--)if(d=g[a],d instanceof c)return d;return null};this.getComponentsOfType=function(c){var d,a,b=[];for(a=g.length-1;0<=a;a--)d=g[a],d instanceof c&&b.push(d);return b};this.toJSON=function(){var d=[],f,a;for(a=0;a<g.length;a++)f=g[a],f.toJSON?(f=f.toJSON())&&d.push(f):d.push(KICK.core.Util.componentToJSON(c.engine,f));return{name:k,layer:h,uid:o,components:d}};j(n,d,["uid"])};g.Transform=function(c){var f=d.identity(d.create()),g=
  d.identity(d.create()),j=d.identity(d.create()),o=d.identity(d.create()),k=h.create([0,0,0]),p=h.create([0,0,0]),n=u.create([0,0,0,1]),m=u.create([0,0,0,1]),v=h.create([1,1,1]),a=new Int8Array(6),b=[],e=null,i=this,q=function(){var e;a[2]=1;a[3]=1;a[4]=1;a[5]=1;for(e=b.length-1;0<=e;e--)b[e]._markGlobalDirty()},B=function(){a[0]=1;a[1]=1;q()};Object.defineProperties(this,{gameObject:{value:c},position:{get:function(){if(null===e)return h.create(p);a[4]&&(d.multiplyVec3(i.getGlobalMatrix(),[0,0,0],
  k),a[4]=0);return h.create(k)},set:function(a){var b;null===e?i.localPosition=a:(b=i.position,h.set(a,p),i.localPosition=[p[0]+b[0]-a[0],p[1]+b[1]-a[1],p[2]+b[2]-a[2]],B())}},localPosition:{get:function(){return h.create(p)},set:function(a){h.set(a,p);B()}},localRotationEuler:{get:function(){var a=h.create();u.toEuler(m,a);return a},set:function(a){u.setEuler(a,m);B()}},rotationEuler:{get:function(){var a=h.create();u.toEuler(i.rotation,a);return a},set:function(a){var b=u.create();u.setEuler(a,b);
  this.rotation=b}},rotation:{get:function(){var b=null;if(null===e)return u.create(m);if(a[5]){u.set(m,n);for(b=i.parent;null!==b;)u.multiply(b.localRotation,n,n),b=b.parent;a[5]=!1}return n},set:function(a){if(null===e)this.localRotation=a;else{var b=u.create();u.difference(a,i.rotation,b);this.localRotation=u.multiply(m,b)}}},localRotation:{get:function(){return m},set:function(a){u.set(a,m);B()}},localScale:{get:function(){return h.create(v)},set:function(a){h.set(a,v);for(a=0;a<v.length;a++)0===
  v[a]&&(v[a]=1.0E-5);B()}},children:{value:b},parent:{get:function(){return e},set:function(a){a===this&&KICK.core.Util.fail("Cannot assign parent to self");a!==e&&(null===a?(e=null,l.Util.removeElementFromArray(a.children,this)):(e=a,a.children.push(this)),q())}}});this.getLocalMatrix=function(){a[0]&&(d.setTRS(p,m,v,f),a[0]=0);return f};this.getLocalTRSInverse=function(){a[1]&&(d.setTRSInverse(p,m,v,j),a[1]=0);return j};this.getGlobalMatrix=function(){if(a[2]){d.set(i.getLocalMatrix(),g);for(var b=
  i.parent;null!==b;)d.multiply(b.getLocalMatrix(),g,g),b=b.parent;a[2]=0}return g};this.getGlobalTRSInverse=function(){if(a[3]){d.set(i.getLocalTRSInverse(),o);for(var b=i.parent;null!==b;)d.multiply(o,b.getLocalTRSInverse(),o),b=b.parent;a[3]=0}return o};this._markGlobalDirty=q;this.toJSON=function(){var a=KICK.core.Util.typedArrayToArray;return{type:"KICK.scene.Transform",uid:c.engine.getUID(i),config:{localPosition:a(p),localRotation:a(m),localScale:a(v),parent:e?KICK.core.Util.getJSONReference(i.gameObject.engine,
  e):null}}};this.str=function(){return JSON.stringify(i.toJSON())}};g.Scene=function(c,d){var f={},j=[],h=[],k=[],o=[],n=[],m=[],v=[],a=[],b=[],e=[],i=[],q=new KICK.scene.SceneLights(c.config.maxNumerOfLights),B="Scene",z=0,u,E=this,A=function(a,b){return a.scriptPriority-b.scriptPriority},$=function(a,b){return b.cameraIndex-a.cameraIndex},V=function(a){a=new g.GameObject(E,a);k.push(a);j.push(a);return f[a.uid]=a};this.notifyComponentUpdated=function(b){for(u=a.length-1;0<=u;u--)a[u].componentUpdated(b)};
  this.destroy=function(){c.project.removeResourceDescriptor(E.uid);E===c.activeScene&&(c.activeScene=null)};this.addComponentListener=function(e){g.ComponentChangedListener.isComponentListener(e)||KICK.core.Util.fail("Component listener does not have the correct interface. It should contain the two functions: componentsAdded(components) and componentsRemoved(components)");e.componentUpdated||(e.componentUpdated=function(){});a.push(e);e.componentsAdded(b)};this.findComponentsOfType=function(a){var b=
  [],e,c,d;for(e=j.length-1;0<=e;e--){d=j[e].getComponentsOfType(a);for(c=0;c<d.length;c++)b.push(d[c])}return b};this.removeComponentListener=function(b){l.Util.removeElementFromArray(a,b)};this.addComponent=function(a){l.Util.insertSorted(a,m,A);var b=c.getUID(a);f[b]=a};this.getObjectByUID=function(a){return f[a]};this.getGameObjectByName=function(a){var b,e;for(b=j.length-1;0<=b;b--)if(e=j[b],e.name===a)return e};this.removeComponent=function(a){l.Util.removeElementFromArray(m,a);v.push(a);delete f[a.uid]};
  Object.defineProperties(this,{engine:{value:c},name:{get:function(){return B},set:function(a){B=a}},uid:{get:function(){return z},set:function(a){z=a}}});this.createGameObject=function(a){var a=V(a),b=a.transform;f[c.getUID(b)]=b;return a};this.destroyObject=function(a){l.Util.contains(o,a)||(o.push(a),delete f[a.uid]);a.destroyed||a.destroy()};this.getNumberOfGameObjects=function(){return j.length};this.getGameObject=function(a){return j[a]};this.updateAndRender=function(){var d,f,r;0<o.length&&
  (l.Util.removeElementsFromArray(h,o),l.Util.removeElementsFromArray(j,o),o.length=0);if(0<v.length){r=v;v=[];for(d=r.length-1;0<=d;d--)f=r[d],l.Util.removeElementFromArray(b,f),"function"===typeof f.deactivated&&f.deactivated(),"function"===typeof f.update&&l.Util.removeElementFromArray(n,f),f instanceof g.Camera?l.Util.removeElementFromArray(e,f):f instanceof g.Light&&(1===f.type?q.ambientLight=null:2===f.type?q.directionalLight=null:q.removePointLight(f));for(d=a.length-1;0<=d;d--)a[d].componentsRemoved(r)}0<
  k.length&&(h=h.concat(k),k.length=0);if(0<m.length){r=m;m=[];for(d=r.length-1;0<=d;d--)f=r[d],b.push(f),"function"===typeof f.activated&&f.activated(),"function"===typeof f.update&&l.Util.insertSorted(f,n,A),"function"===typeof f.render&&i.push(f),"function"===typeof f.render&&l.Util.removeElementFromArray(i,f),f instanceof g.Camera?KICK.core.Util.insertSorted(f,e,$):f instanceof g.Light&&(1===f.type?q.ambientLight=f:2===f.type?q.directionalLight=f:q.addPointLight(f));for(d=a.length-1;0<=d;d--)a[d].componentsAdded(r)}for(d=
  n.length-1;0<=d;d--)n[d].update();for(d=e.length-1;0<=d;d--)e[d].renderScene(q);c.gl.flush()};this.toJSON=function(a){var b=[],e,c,a=a||function(){return!0};for(e=0;e<j.length;e++)c=j[e],a(c)&&b.push(c.toJSON());return{uid:E.uid,gameObjects:b,name:B}};(function(){var a,b=KICK.core.Util.hasProperty,e=KICK.core.Util.applyConfig,i;if(d){z=d.uid;B=d.name||"Scene";var g=d.gameObjects||[],k={},j=[],m={};for(i=0;i<g.length;i++)a=d.gameObjects[i],j[i]=V(a),k[a.uid]=j[i];var h,o=d.gameObjects||[],q,p,l;for(q=
  0;q<o.length;q++){g=d.gameObjects[q];a=j[q];for(p=0;g.components&&p<g.components.length;p++){i=g.components[p];if("KICK.scene.Transform"===i.type)h=a.transform,h.uid=i.uid,f[h.uid]=h;else if(h=KICK.namespace(i.type),"function"===typeof h)h=new h({uid:i.uid}),h.uid=i.uid,a.addComponent(h);else{KICK.core.Util.warn("Cannot find Class "+i.type);continue}k[i.uid]=h;m[i.uid]=i.config}}for(l in k)if(k.hasOwnProperty(l)&&b(k,l)&&(a=m[l])){j={};g=i=void 0;for(i in a)a.hasOwnProperty(i)&&b(a,i)&&(g=a[i],g=
  KICK.core.Util.deserializeConfig(g,c,E),j[i]=g);a=j;j=k[l];e(j,a)}}c.project.registerObject(E,"KICK.scene.Scene")})()};g.Scene.createDefault=function(c){c=new g.Scene(c);c.createGameObject().addComponent(new g.Camera);return c};g.Camera=function(g){var w,r,s=this,y,k,p=!0,t=!1,m=null,v=60,a=0.1,b=1E3,e=-1,i=1,q=-1,B=1,z=[0,0,0,1],L=!0,E=!0,aa=!0,$=null,V,X=1,M=4294967295,D,F,G=null,Q=null,H=null,I=o.create(),K=d.create(),R=d.create(),Y=d.create(),T=d.create(),W={viewMatrix:R,projectionMatrix:K,viewProjectionMatrix:Y,
  lightMatrix:T},U=!1,P={contextLost:function(){w=null},contextRestored:function(a){w=a}},N=[],J=[],O=[],C=[N,J,O],S=o.create([0,0,1,1]),Z=d.create([0.5,0,0,0,0,0.5,0,0,0,0,0.5,0,0.5,0.5,0.5,1]),ba,ca,da=function(){V=(E?16384:0)|(aa?256:0)},ea=function(a){r.currentClearColor!==a&&(r.currentClearColor=a,w.clearColor(a[0],a[1],a[2],a[3]))},ha=function(){var c=m?m.dimension:r.viewportSize,f=c[0],g=c[1],c=f*S[0],k=g*S[1],f=f*S[2],g=g*S[3];w.viewport(c,k,f,g);w.scissor(c,k,f,g);r.currentMaterial=null;r.renderTarget!==
  m&&(m?m.bind():w.bindFramebuffer(36160,null),r.renderTarget=m);ea(z);w.clear(V);L?d.perspective(v,r.viewportSize[0]/r.viewportSize[1],a,b,K):d.ortho(e,i,q,B,a,b,K);c=y.getGlobalTRSInverse();d.set(c,R);d.multiply(K,R,Y)},ia=function(a,b){var e=a.renderOrder||1E3,c=b.renderOrder||1E3,d,i=function(a,b){var e=["material","shader","uid"],c;for(c=0;c<e.length;c++)if(a=a[e[c]],!a)return b;return a};d=function(a,b){return a.mesh.uid||b};e===c&&(a.material&&b.material)&&(e=i(a,e),c=i(b,e));e===c&&(a.mesh&&
  b.mesh)&&(e=d(a,e),c=d(b,e));return e-c},ja=function(){var a=h.create(),b=y.position,e,c,d;for(e=J.length-1;0<=e;e--)c=J[e],d=c.gameObject.transform.position,c.distanceToCamera=h.lengthSqr(h.subtract(d,b,a));J.sort(function(a,b){return b.distanceToCamera-a.distanceToCamera})},fa=function(){var a=KICK.math.aabb.create(),b=new Float32Array(24);return function(e,d){var i=function(e){var i=e.length,g,k;for(g=0;g<i;g++){k=e[g];var j;j=k.aabb;var m=k.gameObject;j&&m?(c.transform(j,m.transform.getGlobalMatrix(),
  a),j=f.intersectAabb(b,a)===f.OUTSIDE):j=!1;j||k.render(W,d)}};f.extractPlanes(W.viewProjectionMatrix,!1,b);W.sceneLights=e;i(N);i(J);i(O)}}(),ka=function(a){var b=a.directionalLight,e=b.gameObject.transform,b=b.shadowRenderTexture,c=b.dimension,i=c[0],c=c[1];w.viewport(0,0,i,c);w.scissor(0,0,i,c);b.bind();ea([1,1,1,1]);w.clear(16640);d.set(ba,K);b=u.multiplyVec3(y.rotation,[0,0,-ca]);b=h.add(b,y.position);b[0]=Math.round(b[0]);b[1]=Math.round(b[1]);b[2]=Math.round(b[2]);d.setTRSInverse(b,e.localRotation,
  [1,1,1],R);d.multiply(K,R,Y);d.multiply(d.multiply(Z,K,T),R,T);fa(a,D)},ga={componentsAdded:function(a){var b,e,c;for(b=a.length-1;0<=b;b--)e=a[b],"function"===typeof e.render&&e.gameObject.layer&M&&(c=e.renderOrder||1E3,c=2E3>c?N:3E3<=c?O:J,KICK.core.Util.contains(c,e)||n(e,c,ia))},componentsRemoved:function(a){var b=!1,e,c,d;for(e=a.length-1;0<=e;e--)if(d=a[e],"function"===typeof d.render)for(c=C.length-1;0<=c;c--)b|=l.Util.removeElementFromArray(C[c],d);return b},componentUpdated:function(a){a=
  [a];ga.componentsRemoved(a)&&ga.componentsAdded(a)}};this.pick=function(a,b,e,c,d){c=c||1;d=d||1;G||(G=[],Q=k.project.load(k.project.ENGINE_SHADER___PICK),H=new KICK.texture.RenderTexture(k,{dimension:r.viewportSize}),H.name="__pickRenderTexture");G.push({gameObjectPickedFn:a,x:b,y:r.viewportSize[1]-e,width:c,height:d})};this.activated=function(){var a=this.gameObject,b;k=a.engine;U||(U=!0,k.addContextListener(P));y=a.transform;w=k.gl;r=k.glState;F=a.scene;F.addComponentListener(ga);k.config.shadows?
  (D=k.project.load(k.project.ENGINE_SHADER___SHADOWMAP),ca=0.5*k.config.shadowDistance,a=1.55377397403004*ca,b=-a*k.config.shadowNearMultiplier,ba=d.create(),d.ortho(-a,a,-a,a,b,a,ba)):t&&(t=!1)};this.deactivated=function(){F.removeComponentListener(s)};this.renderScene=function(a){var b,e;if(p&&(t&&(a.directionalLight&&a.directionalLight.shadow)&&(r.currentMaterial=null,ka(a)),ha(),a.recomputeLight(R),0<J.length&&ja(),fa(a,$),m&&(m.colorTexture&&m.colorTexture.generateMipmaps)&&(e=m.colorTexture.textureId,
  w.bindTexture(w.TEXTURE_2D,e),w.generateMipmap(w.TEXTURE_2D)),G&&0<G.length)){r.currentMaterial=null;H.bind();ea(I);w.clear(16640);fa(a,Q);for(b=G.length-1;0<=b;b--)(function(){var a=G[b],e=a.width*a.width*4,c=new Uint8Array(e),d=[],i={},f,g,j;w.readPixels(a.x,a.y,a.width,a.height,6408,5121,c);for(f=0;f<e;f=f+4){g=c.subarray(f,f+4);g=A(g);if(g>0)if(i[g])i[g]++;else if(j=F.getObjectByUID(g)){d.push(j);i[g]=1}}d.length&&k.eventQueue.add(function(){var b,e;for(b=0;b<d.length;b++){e=d[b];a.gameObjectPickedFn(e,
  i[e.uid])}},0)})();G.length=0}};Object.defineProperties(this,{replacementShader:{get:function(){return $},set:function(a){$=a}},enabled:{get:function(){return p},set:function(a){p=a}},renderShadow:{get:function(){return t},set:function(a){k?k.config.shadows&&(t=a):t=a}},layerMask:{get:function(){return M},set:function(a){M=a}},renderTarget:{get:function(){return m},set:function(a){m=a}},fieldOfView:{get:function(){return v},set:function(a){v=Math.min(179,Math.max(a,1))}},near:{get:function(){return a},
  set:function(b){a=b}},far:{get:function(){return b},set:function(a){b=a}},perspective:{get:function(){return L},set:function(a){L=a}},left:{get:function(){return e},set:function(a){e=a}},right:{get:function(){return i},set:function(a){i=a}},bottom:{get:function(){return q},set:function(a){q=a}},top:{get:function(){return B},set:function(a){B=a}},cameraIndex:{get:function(){return X},set:function(a){X=a}},clearColor:{get:function(){return o.create(z)},set:function(a){z=o.create(a)}},clearFlagColor:{get:function(){return E},
  set:function(a){da();E=a}},clearFlagDepth:{get:function(){return aa},set:function(a){da();aa=a}},normalizedViewportRect:{get:function(){return S},set:function(a){o.set(a,S)}}});this.destroy=function(){U&&(U=!1,k.removeContextListener(P))};this.toJSON=function(){return{type:"KICK.scene.Camera",uid:s.uid||(k?k.getUID(s):0),config:{enabled:p,renderShadow:t,layerMask:M,renderTarget:KICK.core.Util.getJSONReference(k,m),fieldOfView:v,near:a,far:b,perspective:L,left:e,right:i,bottom:q,top:B,cameraIndex:X,
  clearColor:KICK.core.Util.typedArrayToArray(z),clearFlagColor:E,clearFlagDepth:aa,normalizedViewportRect:KICK.core.Util.typedArrayToArray(S)}}};j(this,g);da()};g.Camera.prototype.setupClearFlags=function(c,d){this.clearColor=c;this.clearDepth=d;delete this._currentClearFlags};g.ComponentChangedListener={isComponentListener:function(c){return c&&"function"===typeof c.componentsAdded&&"function"===typeof c.componentsRemoved}};g.MeshRenderer=function(c){var d,f=[],g,h,k=this;this.activated=function(){d=
  k.gameObject.transform};Object.defineProperties(this,{aabb:{get:function(){return g.aabb}},renderOrder:{get:function(){return h}},material:{get:function(){return 0===f.length?null:f[0]},set:function(c){f[0]=c;h=f[0].renderOrder;k.gameObject&&k.gameObject.notifyComponentUpdated(k)}},materials:{get:function(){return f},set:function(c){var d;f=[];for(d=0;d<c.length;d++)f[d]=c[d],h=f[d].renderOrder;k.gameObject&&k.gameObject.notifyComponentUpdated(k)},enumerable:!0},mesh:{get:function(){return g},set:function(c){g=
  c},enumerable:!0}});this.render=function(c,k){var j=f.length,h,a;for(h=0;h<j;h++)a=k||f[h].shader,g.bind(a),a.bindUniform(f[h],c,d),g.render(h)};this.toJSON=function(){return k.gameObject?KICK.core.Util.componentToJSON(k.gameObject.engine,this,"KICK.scene.MeshRenderer"):null};j(this,c)};g.Light=function(c){var d=this,f=h.create([1,1,1]),o,l=3,k=!1,p=1,n=0.05,m=null,v=null,a=h.create([1,0,0]),b=1,e,i=h.create([1,1,1]),q=function(){h.set([f[0]*b,f[1]*b,f[2]*b],i)},B,z,u=function(){if(k){if(!m){m=new KICK.texture.Texture(o,
  {minFilter:9728,magFilter:9728,wrapS:33071,wrapT:33071,flipY:!1,generateMipmaps:!1});var a=Math.min(o.gl.getParameter(34024),o.gl.getParameter(3379)),a=Math.min(a,4096)*o.config.shadowMapQuality;m.setImageData(a,a,0,5121,null,"");v=new KICK.texture.RenderTexture(o,{colorTexture:m})}}else v&&(v.destroy(),m.destroy(),m=v=null)};Object.defineProperties(this,{transform:{get:function(){return e}},shadowRenderTexture:{get:function(){return v}},shadowTexture:{get:function(){return m}},shadow:{get:function(){return k},
  set:function(a){a!==k&&(k=a,o&&u())},enumerable:!0},shadowStrength:{get:function(){return p},set:function(a){p=a},enumerable:!0},shadowBias:{get:function(){return n},set:function(a){n=a},enumerable:!0},color:{get:function(){return h.create(f)},set:function(a){h.set(a,f);q()},enumerable:!0},type:{get:function(){return l},set:function(a){o||(l=a)},enumerable:!0},intensity:{get:function(){return b},set:function(a){b=a;q()},enumerable:!0},attenuation:{get:function(){return a},set:function(b){h.set(b,
  a)},enumerable:!0},colorIntensity:{get:function(){return i},set:function(a){i=a},enumerable:!0},gameObject:{get:function(){return B},set:function(a){B=a}},scriptPriority:{get:function(){return z},set:function(a){z=a},enumerable:!0}});this.activated=function(){var a=d.gameObject;o=a.engine;e=a.transform;u()};this.toJSON=function(){return KICK.core.Util.componentToJSON(d.gameObject.engine,this,"KICK.scene.Light")};j(this,c);KICK.core.Util.copyStaticPropertiesToObject(this,g.Light)};g.Light.TYPE_AMBIENT=
  1;g.Light.TYPE_DIRECTIONAL=2;g.Light.TYPE_POINT=3;Object.freeze(g.Light);g.SceneLights=function(c){var f=null,g=null,j=KICK.math.mat3.create(),o=j.subarray(0,3),k=j.subarray(3,6),l=j.subarray(6,9),n=null,m=new Float32Array(9*c),v=h.wrapArray(m),a=[],b=[0,0,1],e=function(a){var b;for(b=0;3>b;b++)h.set([0,0,0],v[3*a+b])};Object.defineProperties(this,{ambientLight:{get:function(){return f},set:function(a){f=a}},directionalLight:{get:function(){return g},set:function(a){g=a;null!==a?n=g.gameObject.transform:
  (n=null,KICK.math.mat3.set([0,0,0,0,0,0,0,0,0],j))}},directionalLightData:{get:function(){return j}},pointLightData:{get:function(){return m}}});this.addPointLight=function(b){!KICK.core.Util.contains(a,b)&&a.length!==c&&a.push(b)};this.removePointLight=function(b){b=a.indexOf(b);0<=b&&a.splice(b,1);e(a.length)};this.recomputeLight=function(e){null!==g&&(u.multiplyVec3(n.rotation,b,o),d.multiplyVec3Vector(e,o),h.normalize(o),h.add(b,o,l),h.normalize(l),h.set(g.colorIntensity,k));if(c){var f=0,j,m,
  s;for(j=a.length-1;0<=j;j--)m=a[j],s=m.transform.position,d.multiplyVec3(e,s,v[f]),h.set(m.colorIntensity,v[f+1]),h.set(m.attenuation,v[f+2]),f+=3}};(function(){var a;for(a=0;a<c;a++)e(a)})()}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.mesh");KICK.namespace("KICK.scene");KICK.namespace("KICK.core");KICK.namespace("KICK.math");var l=KICK.namespace("KICK.math.vec3");KICK.namespace("KICK.math.quat4");var h=KICK.namespace("KICK.math.vec4"),u=KICK.namespace("KICK.math.mat4");g.MeshData=function(h){var d={},c=this,f=[],j,n,A,x,w,r=function(){A=n=j=null},s=function(){return d.vertex},y=function(){var c=j.byteLength/A,f,a,b,e,i=0,g;d={};for(f=0;f<c;f++){for(b in n)if(n.hasOwnProperty(b)){e=n[b];a=
  5126===e.type?Float32Array:Int32Array;0===f&&(d[b]=new a(c*e.size));g=new a(j,i+e.pointer);for(a=0;a<e.size;a++)d[b][f*e.size+a]=g[a]}i+=A}},k=function(c,f){if(5126===c||5124===c){var a=5126===c?Float32Array:Int32Array;return{get:function(){!s()&&j&&y();return d[f]},set:function(b){b?d[f]&&d[f].length===b.length?d[f].set(b):d[f]=new a(b):d[f]=null;r()}}}},p=function(){var d=[],f=[],a=[],b=0,e=[],i,g,k=c.vertex,k=k?k.length/3:0,h={};i=function(i,g,k){var j=c[i];j&&(d.push(g),f.push(i),a.push(k),e.push(j),
  h[i]={pointer:4*b,size:g,normalized:!1,type:k,name:i},b+=g)};i("vertex",3,5126);i("normal",3,5126);i("uv1",2,5126);i("uv2",2,5126);i("tangent",4,5126);i("color",4,5126);i("int1",1,5124);i("int2",2,5124);i("int3",3,5124);i("int4",4,5124);var o=new ArrayBuffer(4*b*k);for(g=0;g<k;g++)for(var l=4*g*b,p=0;p<f.length;p++){i=5126===a[p]?new Float32Array(o,l):new Int32Array(o,l);for(var s=e[p],t=d[p],r=0;r<t;r++)i[r]=s[g*t+r],l+=4}j=o;n=h;A=4*b};this.serialize=function(){var d=new KICK.core.ChunkData;d.setArrayBuffer(1,
  c.interleavedArray);d.setString(2,JSON.stringify(c.interleavedArrayFormat));d.setString(3,c.name||"MeshData");var f=c.subMeshes,a=f.length;d.setNumber(4,a);d.setNumber(5,c.vertexAttrLength);for(var b=0;b<a;b++)d.set(10+b,f[b]);return d.serialize()};this.deserialize=function(d){var f=new KICK.core.ChunkData;if(f.deserialize(d)){c.interleavedArray=f.getArrayBuffer(1);c.interleavedArrayFormat=JSON.parse(f.getString(2));c.name=f.getString(3);d=f.getNumber(4);c.vertexAttrLength=f.getNumber(5);for(var a=
  [],b=0;b<d;b++)a[b]=f.get(10+b);c.subMeshes=a;return!0}return!1};Object.defineProperties(this,{aabb:{get:function(){var d=c.vertex;if(!d)return null;for(var f=d.length,a=KICK.math.aabb.create(),b=0;b<f;b+=3){var e=d.subarray(b,b+3);KICK.math.aabb.addPoint(a,e)}return a}},name:{get:function(){return w},set:function(c){w=c}},interleavedArray:{get:function(){!j&&s()&&p();return j},set:function(c){c?j=c:r()}},interleavedArrayFormat:{get:function(){!j&&s()&&p();return n},set:function(c){c?n=c:r()}},vertexAttrLength:{get:function(){!j&&
  s()&&p();return A},set:function(c){c?A=c:r()}},vertex:k(5126,"vertex"),normal:k(5126,"normal"),uv1:k(5126,"uv1"),uv2:k(5126,"uv2"),tangent:k(5126,"tangent"),color:k(5126,"color"),int1:k(5124,"int1"),int2:k(5124,"int2"),int3:k(5124,"int3"),int4:k(5124,"int4"),indices:{get:function(){return 0==f?null:f[0]},set:function(c){c&&!(c instanceof Uint16Array)&&(c=new Uint16Array(c));f[0]&&s()&&r();c&&(f[0]=c)}},subMeshes:{get:function(){return f},set:function(c){for(var d=0;d<c.length;d++)c[d]&&!(c[d]instanceof
  Uint16Array)&&(c[d]=new Uint16Array(c[d]));f=c}},meshType:{get:function(){return x},set:function(c){x=c}}});this.isValid=function(){!s()&&j&&y();for(var c=d.vertex.length/3,g=0;g<f.length;g++)for(var a=f[g].length-1;0<=a;a--)if(f[g][a]>=c){debugger;return!1}return!0};this.isVertexDataInitialized=s;this.isInterleavedDataInitialized=function(){return j};this.transform=function(c){for(var d=new g.MeshData(this),a=l.wrapArray(d.vertex),b=a.length-1;0<=b;b--)u.multiplyVec3(c,a[b]);return d};this.combine=
  function(d,f){if(c.meshType!==d.meshType||6==c.meshType)return null;for(var a="vertex normal uv1 uv2 tangent color int1 int2 int3 int4 indices".split(" "),b=a.length-1;0<=b;b--){var e=a[b];(!c[e]||!d[e])&&a.splice(b,1)}b=function(b,e,c){var d,f,g,k,j;for(d=a.length-1;0<=d;d--)if(g=a[d],b[g]){k=e[g];if(c&&"indices"===g){k=new Uint16Array(k);j=k.length;for(f=0;f<j;f++)k[f]+=c}for(f=0;f<k.length;f++)b[g].push(k[f])}else b[g]=KICK.core.Util.typedArrayToArray(e[g])};e={meshType:c.meshType};f&&(d=d.transform(f));
  b(e,c,0);b(e,d,this.vertex.length/3);5===c.meshType&&e.indices.splice(c.indices,0,e.indices[c.indices.length],e.indices[c.indices.length+1]);return new g.MeshData(e)};h||(h={});var k=function(){c.vertex=h.vertex?new Float32Array(h.vertex):null;c.normal=h.normal?new Float32Array(h.normal):null;c.uv1=h.uv1?new Float32Array(h.uv1):null;c.uv2=h.uv2?new Float32Array(h.uv2):null;c.tangent=h.tangent?new Float32Array(h.tangent):null;c.color=h.color?new Float32Array(h.color):null;c.int1=h.int1?new Int32Array(h.int1):
  null;c.int2=h.int2?new Int32Array(h.int2):null;c.int3=h.int3?new Int32Array(h.int3):null;c.int4=h.int4?new Int32Array(h.int4):null},t=function(){c.interleavedArray=h.interleavedArray;c.interleavedArrayFormat=h.interleavedArrayFormat;c.vertexAttrLength=h.vertexAttrLength};h instanceof g.MeshData?h.isVertexDataInitialized()?k():t():h.vertex?k():h.interleavedArray&&t();c.name=h.name;c.indices=h.indices;c.meshType=h.meshType||4};g.MeshData.prototype.recalculateNormals=function(){var g=this.vertex.length/
  3,d=this.indices.length/3,c=this.indices,f=l.wrapArray(this.vertex),j,h={},u=l.array(g,h),x=l.create(),w=l.create(),r=l.create();for(j=0;j<d;j++){var s=c[3*j+0],y=c[3*j+1],k=c[3*j+2],p=f[s],t=f[k];l.subtract(f[y],p,x);l.subtract(t,p,w);l.cross(x,w,r);l.normalize(r);l.add(u[s],r);l.add(u[y],r);l.add(u[k],r)}for(j=0;j<g;j++)l.normalize(u[j]);this.normal=h.mem};g.MeshData.prototype.recalculateTangents=function(){if(4!=this.meshType)return!1;var g=l.wrapArray(this.vertex),d=g.length,c=l.wrapArray(this.normal),
  f=this.uv1,j=this.indices,n=j.length/3,u=this.tangent,x=l.array(d),w=l.array(d),r,s=l.create(),y=l.create();for(r=0;r<n;r++){var k=j[3*r+0],p=j[3*r+1],t=j[3*r+2],m=g[k],v=g[p],a=g[t],b=f[k],e=f[p],i=f[t],q=v[0]-m[0],B=a[0]-m[0],z=v[1]-m[1],L=a[1]-m[1],v=v[2]-m[2],m=a[2]-m[2],a=e[0]-b[0],E=i[0]-b[0],e=e[1]-b[1],i=i[1]-b[1],b=1/(a*i-E*e),i=l.create([(i*q-e*B)*b,(i*z-e*L)*b,(i*v-e*m)*b]),q=l.create([(a*B-E*q)*b,(a*L-E*z)*b,(a*m-E*v)*b]);l.add(x[k],i);l.add(x[p],i);l.add(x[t],i);l.add(w[k],q);l.add(w[p],
  q);l.add(w[t],q)}u||(this.tangent=u=new Float32Array(4*d));u=h.wrapArray(u);for(r=0;r<d;r++)g=c[r],f=x[r],l.subtract(f,g,s),l.dot(g,f,y),l.set(l.normalize(l.multiply(s,y)),u[r]),u[r][3]=0>l.dot(l.cross(g,f,l.create()),w[r])?-1:1;return!0};g.Mesh=function(g,d){var c=g.gl,f=g.glState,j,h,l=[],u=[],w,r,s="memory://void",y=null,k=this,p=0,t,m=[],v={contextLost:function(){u.length=0;c=j=null},contextRestored:function(a){c=a;b()}},a=function(){for(var a=0;a<u.length;a++)c.deleteBuffer(u[a]);"number"===
  typeof j&&(c.deleteBuffer(j),j=null);m.length=0;u.length=0},b=function(){var b=r.subMeshes;a();h=r.interleavedArrayFormat;var d;l.length=0;for(var f in h)h.hasOwnProperty(f)&&(d=h[f],d.name||(d.name=f),l.push(d));p=r.vertexAttrLength;t=r.meshType;j=c.createBuffer();c.bindBuffer(34962,j);c.bufferData(34962,r.interleavedArray,35044);for(d=0;d<b.length;d++){f=b[d];var g=c.createBuffer();m[d]=f.length;u.push(g);c.bindBuffer(34963,g);c.bufferData(34963,f,35044)}};g.addContextListener(v);Object.defineProperties(this,
  {aabb:{get:function(){!y&&r&&(y=r.aabb);return y}},name:{get:function(){return w},set:function(a){w=a||"Mesh"}},meshData:{get:function(){return r},set:function(a){r=a;y=null;b()}},dataURI:{get:function(){return s},set:function(a){k.setDataURI(a,!0)}}});this.setDataURI=function(a,b){a!==s&&(s=a,b&&g.resourceLoader.getMeshData(a,k))};KICK.core.Util.applyConfig(this,d);g.project.registerObject(this,"KICK.mesh.Mesh");this.verify=function(a){var b=[],c,d;for(d in a.lookupAttribute)"string"===typeof d&&
  ((c=h[d])||b.push(d));return null};this.bind=function(a){var b;a.bind();if(f.meshBuffer!==j||f.meshShader!==a){f.meshBuffer=j;f.meshShader=a;c.bindBuffer(34962,j);for(b=0;b<l.length;b++){var d=l[b],g=a.lookupAttribute[d.name];"undefined"!==typeof g&&(c.enableVertexAttribArray(g),c.vertexAttribPointer(g,d.size,d.type,!1,p,d.pointer))}}};this.render=function(a){c.bindBuffer(34963,u[a]);c.drawElements(t,m[a],5123,0)};this.destroy=function(){null!==j&&(a(),g.removeContextListener(v),g.project.removeResourceDescriptor(k.uid))};
  this.toJSON=function(){return{uid:k.uid,name:w,dataURI:s}}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.material"),l=KICK.namespace("KICK.math"),h=l.mat3,u=l.mat4,o=l.vec4,d=KICK.namespace("KICK.core"),c=d.Util.applyConfig,f=d.Util.fail,j=KICK.core.Util.uint32ToVec4,n=u.create(),A=h.create(),x=o.create(),w=l.vec3.create(),r=function(c,d,f){return(35678===c||35680===c)&&d&&"number"===typeof d.ref?f.project.load(d.ref):Array.isArray(d)||"number"===typeof d?("number"===typeof d&&(d=[d]),5124===c||35667===c||35668===c||35669===c?new Int32Array(d):new Float32Array(d)):
  d};g.UniformDescriptor=function(c,d,f,g){this.name=c;this.type=d;this.size=f;this.location=g;Object.freeze(this)};g.Shader=function(d,j){var k=d.gl,h=d.glState,o=this,m=-1,l=!0,a=1029,b=513,e=!1,i=770,q=771,n=!1,z=2.5,u=10,w=1E3,x="memory://void",A="",V,X=[],M=[],D=[],F={},G=g.GLSLConstants,Q=G["__error_vs.glsl"],H=G["__error_fs.glsl"],I,K=KICK.core.Util.fail,R=function(){V=(i+1E4*q)*(e?-1:1)},Y=function(a,b){var e,a=g.Shader.getPrecompiledSource(d,a);e=b?k.createShader(35632):k.createShader(35633);
  k.shaderSource(e,a);k.compileShader(e);return!k.getShaderParameter(e,35713)?(e=k.getShaderInfoLog(e),"function"===typeof K&&K(e),null):e},T=function(a,b){switch(a){case 5126:return new Float32Array(b);case 35674:return new Float32Array(4*b);case 35675:return new Float32Array(9*b);case 35676:return new Float32Array(16*b);case 35664:return new Float32Array(2*b);case 35665:return new Float32Array(3*b);case 35666:return new Float32Array(4*b);case 5124:return new Int32Array(b);case 35667:return new Int32Array(2*
  b);case 35668:return new Int32Array(3*b);case 35669:return new Int32Array(4*b);case 35680:return 1!==b&&f("Texture arrays not currently supported"),d.project.load(d.project.ENGINE_TEXTURE_CUBEMAP_WHITE);case 35678:return 1!==b&&f("Texture arrays not currently supported"),d.project.load(d.project.ENGINE_TEXTURE_WHITE);default:f("Unknown type")}};this.contextLost=function(){k=null;m=-1;X.length=0;M.length=0;D.length=0};this.contextRestored=function(a){k||(k=a,o.apply())};d.addContextListener(this);
  Object.defineProperties(this,{lookupUniform:{get:function(){return F}},activeUniforms:{get:function(){return X}},engineUniforms:{get:function(){return M}},materialUniforms:{get:function(){return D}},name:{get:function(){return A},set:function(a){A=a}},dataURI:{get:function(){return x},set:function(a){x!==a&&(x=a)&&d.resourceLoader.getShaderData(x,o)}},gl:{value:k},glState:{value:h},defaultUniforms:{get:function(){return I},set:function(a){var b,e;for(b in I)I.hasOwnProperty(b)&&a.hasOwnProperty(b)&&
  (e=F[b].type,I[b]=r(e,a[b],d))}},vertexShaderSrc:{get:function(){return Q},set:function(a){"string"!==typeof a&&KICK.core.Util.fail("Shader.vertexShaderSrc must be a string");Q=a}},fragmentShaderSrc:{get:function(){return H},set:function(a){"string"!==typeof a&&KICK.core.Util.fail("Shader.fragmentShaderSrc must be a string");H=a}},renderOrder:{get:function(){return w},set:function(a){"number"!==typeof a&&KICK.core.Util.fail("Shader.renderOrder must be a number");w=a}},errorLog:{get:function(){return K},
  set:function(a){K=a}},engine:{value:d},shaderProgramId:{get:function(){return m}},polygonOffsetEnabled:{get:function(){return n},set:function(a){n=a}},polygonOffsetFactor:{get:function(){return z},set:function(a){z=a}},polygonOffsetUnits:{get:function(){return u},set:function(a){u=a}},faceCulling:{get:function(){return a},set:function(b){a=b}},depthMask:{get:function(){return l},set:function(a){l=a}},zTest:{get:function(){return b},set:function(a){b=a}},blend:{get:function(){return e},set:function(a){e=
  a;R()}},blendSFactor:{get:function(){return i},set:function(a){i=a;R()}},blendDFactor:{get:function(){return q},set:function(a){q=a;R()}}});this.markUniformUpdated=function(){h.boundShader=-1;h.meshShader=-1};this.apply=function(){var a=K||console.log,b=Y(Q,!1,a),e=Y(H,!0,a),c=null===e||null===b;c&&(b=Y(G["__error_vs.glsl"],!1,a),e=Y(G["__error_fs.glsl"],!0,a));m=k.createProgram();k.attachShader(m,b);k.attachShader(m,e);k.linkProgram(m);k.deleteShader(b);k.deleteShader(e);if(!k.getProgramParameter(m,
  35714))return a("Could not initialise shaders"),!1;k.useProgram(m);h.boundShader=m;var a=k.getProgramParameter(m,35718),d,e=I,f,i;X=[];F={};I={};D.length=0;for(f=M.length=0;f<a;f++)b=k.getActiveUniform(m,f),d=k.getUniformLocation(m,b.name),d=new g.UniformDescriptor(b.name,b.type,b.size,d),Object.freeze(d),X[f]=d,F[b.name]=d,"_"!==b.name.charAt(0)?(i=T(b.type,b.size),I[b.name]=i,D.push(d)):M.push(d);e&&(o.defaultUniforms=e);b=k.getProgramParameter(m,35721);this.activeAttributes=[];this.lookupAttribute=
  {};for(a=0;a<b;a++)e=k.getActiveAttrib(m,a),this.activeAttributes[a]={size:e.size,type:e.type,name:e.name},this.lookupAttribute[e.name]=a;o.markUniformUpdated();return!c};this.destroy=function(){-1!==m&&(d.removeContextListener(o),k.deleteProgram(m),m=-1,d.project.removeResourceDescriptor(o.uid))};this.isValid=function(){return-1!==m};this.bind=function(){if(h.boundShader!==m){h.boundShader=m;k.useProgram(m);var c=h.faceCulling;c!==a&&(0===a?k.disable(2884):((!c||0===c)&&k.enable(2884),k.cullFace(a)),
  h.faceCulling=a);h.zTest!==b&&(k.depthFunc(b),h.zTest=b);h.depthMaskCache!==l&&(k.depthMask(l),h.depthMaskCache=l);h.blendKey!==V&&(h.blendKey=V,e?k.enable(3042):k.disable(3042),k.blendFunc(i,q));h.polygonOffsetEnabled!==n&&((h.polygonOffsetEnabled=n)?k.enable(32823):k.disable(32823));n&&k.polygonOffset(z,u)}};this.toJSON=function(){return x?{uid:o.uid,name:A,dataURI:x}:{uid:o.uid,name:A,blend:e,blendSFactor:i,blendDFactor:q,dataURI:x,depthMask:l,faceCulling:a,fragmentShaderSrc:H,vertexShaderSrc:Q,
  polygonOffsetEnabled:n,polygonOffsetFactor:z,polygonOffsetUnits:u,renderOrder:w,zTest:b,defaultUniforms:I}};c(o,j);d.project.registerObject(o,"KICK.material.Shader");x&&0!==x.indexOf("memory://")?d.resourceLoader.getShaderData(x,o):(R(),o.apply())};g.Shader.getPrecompiledSource=function(c,d){var f,j,h="#version 100",m=1;for(f in g.GLSLConstants)g.GLSLConstants.hasOwnProperty(f)&&"string"===typeof f&&(j=g.GLSLConstants[f],d=d.replace('#pragma include "'+f+'"',j),d=d.replace("#pragma include '"+f+"'",
  j));0===d.indexOf("#version ")&&(f=d.indexOf("\n"),h=d.substring(0,f),d=d.substring(f+1),m=2);return d=h+"\n#define SHADOWS "+(!0===c.config.shadows)+"\n#define LIGHTS "+c.config.maxNumerOfLights+"\n#line "+m+"\n"+d};g.Shader.prototype.bindMaterialUniform=function(c,d){var f=this.gl,g=this.glState,j,h=d.sceneLights,o=h.ambientLight;j=h.directionalLightData;var a=h.pointLightData,b=this.lookupUniform,e=b._proj,i=b._dLight,l=b["_pLights[0]"],h=b._time,n=b._viewport,r=b._ambient,b=c.bind(0);e&&f.uniformMatrix4fv(e.location,
  !1,d.projectionMatrix);r&&(o=null!==o?o.colorIntensity:w,f.uniform3fv(r.location,o));i&&f.uniformMatrix3fv(i.location,!1,j);l&&f.uniformMatrix3fv(l.location,!1,a);h&&(j=this.engine.time,f.uniform1f(h.location,j.time));n&&f.uniform2fv(n.location,g.viewportSize);return b};g.Shader.prototype.bindUniform=function(c,d,f){var g=this.lookupUniform,h=this.gl,m=this.glState,o=g._m,a=g._mv,b=g._mvProj,e=g._norm,i=g._gameObjectUID,l=g._shadowMapTexture,g=g._lightMat,r=d.sceneLights.directionalLight,z,w=0;m.currentMaterial!==
  c&&(m.currentMaterial=c,w=this.bindMaterialUniform(c,d));if(o||a||e)z=f.getGlobalMatrix(),o&&h.uniformMatrix4fv(o.location,!1,z),c=u.multiply(d.viewMatrix,z,n),a&&h.uniformMatrix4fv(a.location,!1,c),e&&(a=u.toNormalMat3(c,A),h.uniformMatrix3fv(e.location,!1,a));b&&(z=z||f.getGlobalMatrix(),h.uniformMatrix4fv(b.location,!1,u.multiply(d.viewProjectionMatrix,z,n)));i&&(b=j(f.gameObject.uid,x),3>this.engine.time.frame&&console.log("transform.gameObject.uid "+f.gameObject.uid),h.uniform4fv(i.location,
  b));l&&(r&&r.shadowTexture)&&(r.shadowTexture.bind(w),h.uniform1i(l.location,w));g&&(z=f.getGlobalMatrix(),h.uniformMatrix4fv(g.location,!1,u.multiply(d.lightMatrix,z,n)))};Object.freeze(g.Shader);g.Material=function(d,j){var h="Material",o=null,l=[],m=this,n=d.gl,a=0,b={contextLost:function(){},contextRestored:function(a){n=a;o&&(o.contextRestored(a),a=o,o=null,m.shader=a)}};Object.defineProperties(this,{engine:{value:d},name:{get:function(){return h},set:function(a){h=a}},shader:{get:function(){return o},
  set:function(b){!b instanceof KICK.material.Shader&&f("KICK.material.Shader expected");if(o!==b&&(o=b)){m.init();a=o.renderOrder;for(var c,d={},g,b=l.length-1;0<=b;b--)(c=o.lookupUniform[l[b].name])?(l[b].type=c.type,l[b].location=c.location,d[l[b].name]=!0):l.splice(b,1);for(b=0;b<o.materialUniforms.length;b++)c=o.materialUniforms[b],g=c.name,d.hasOwnProperty(g)||(g=m.setUniform(g,o.defaultUniforms[g]),g.location=c.location,g.type=c.type)}}},uniforms:{value:null},renderOrder:{get:function(){return a}}});
  this.bind=function(a){var b,c,d;for(b=0;b<l.length;b++)switch(c=l[b].value,d=l[b].location,l[b].type){case 5126:n.uniform1fv(d,c);break;case 35674:n.uniformMatrix2fv(d,!1,c);break;case 35675:n.uniformMatrix3fv(d,!1,c);break;case 35676:n.uniformMatrix4fv(d,!1,c);break;case 35664:n.uniform2fv(d,c);break;case 35665:n.uniform3fv(d,c);break;case 35666:n.uniform4fv(d,c);break;case 5124:n.uniform1iv(d,c);break;case 35667:n.uniform2iv(d,c);break;case 35668:n.uniform3iv(d,c);break;case 35669:n.uniform4iv(d,
  c);break;case 35680:case 35678:c.bind(a),n.uniform1i(d,a),a++}return a};this.setUniform=function(a,b){var c,d;for(d=0;d<l.length&&!c;d++)l[d].name===a&&(c=l[d],c.value=b);c&&o?o.markUniformUpdated():c||(c=new g.MaterialUniform({name:a,value:b}),l.push(c));return c};this.getUniform=function(a){var b;for(b=0;b<l.length;b++)if(l[b].name===a)return l[b].value;return null};this.destroy=function(){d.project.removeResourceDescriptor(m.uid);d.removeContextListener(b)};this.init=function(){o||(KICK.core.Util.fail("Cannot initiate shader in material "+
  h),m._shader=d.project.load(d.project.ENGINE_SHADER___ERROR))};this.toJSON=function(){var a,b={};for(a=0;a<l.length;a++)b[l[a].name]=l[a].toJSON();return{uid:m.uid,name:h,shader:KICK.core.Util.getJSONReference(d,o),uniformData:b}};(function(){var a=j.uniformData,f,g;d.addContextListener(b);a&&delete j.uniformData;j.uniforms&&(console.log("Warn - Material.uniforms is deprecated"),delete j.uniforms);c(m,j);if(a)for(f in a)a.hasOwnProperty(f)&&(g=a[f],g=r(o.lookupUniform[f].type,g,d),m.setUniform(f,
  g));d.project.registerObject(m,"KICK.material.Material")})()};g.MaterialUniform=function(c){var f,g=this,c=c||{};f=c.value;this.type=this.location=null;this.name=c.name;Object.defineProperties(this,{value:{get:function(){return f},set:function(c){f=c}}});this.toJSON=function(){var c=g.value,c=c instanceof Float32Array||c instanceof Int32Array?d.Util.typedArrayToArray(c):KICK.core.Util.getJSONReference(c.engine,c);return{name:g.name,value:c}}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.mesh"),l=KICK.namespace("KICK.math"),h=l.vec3,u=l.vec2;g.MeshFactory={createTriangleData:function(){var h=Math.sqrt(0.75);return new g.MeshData({name:"Triangle",vertex:[0,1,0,-h,-0.5,0,h,-0.5,0],uv1:[0.5,1,0.125,0.25,0.875,0.25],normal:[0,0,1,0,0,1,0,0,1],indices:[0,1,2]})},createPlaneData:function(){return new g.MeshData({name:"Plane",vertex:[1,-1,0,1,1,0,-1,-1,0,-1,1,0],uv1:[1,0,1,1,0,0,0,1],normal:[0,0,1,0,0,1,0,0,1,0,0,1],indices:[0,1,2,2,1,3]})},createUVSphereData:function(o,
  d,c){if(!o||3>o)o=64;if(!d||2>d)d=32;c||(c=1);var f,j;f=2*d*(o+1)+2*(d-1);var l={},A=h.array(f,l),x={},w=h.array(f,x),r={},s=u.array(f,r),y=[],k=Math.PI/d,p=Math.PI/2,t=2*Math.PI,m=0,v,a,b,e,i,q,B,z,L,E;for(f=0;f<d;f++){v=k*f-p;j=k*(f+1)-p;a=Math.sin(v);b=Math.cos(v);v=Math.sin(j);e=Math.cos(j);for(j=0;j<=o;j++)i=t/o*j,q=Math.sin(i),B=Math.cos(i),i=B*b,z=a,E=q*b,B*=e,L=v,q*=e,h.set([i,z,E],A[m]),u.set([1-j/o,f/d],s[m]),h.set([c*i,c*z,c*E],w[m]),y.push(m),0<f&&0===j&&y.push(m),m++,h.set([B,L,q],A[m]),
  u.set([1-j/o,(f+1)/d],s[m]),h.set([c*B,c*L,c*q],w[m]),y.push(m),j===o&&f<d-1&&y.push(m),m++}return new g.MeshData({name:"UVSphere",vertex:x.mem,uv1:r.mem,normal:l.mem,indices:y,meshType:5})},createCubeData:function(h){h||(h=1);return new g.MeshData({name:"Cube",vertex:[h,h,h,-h,h,h,-h,-h,h,h,-h,h,h,h,h,h,-h,h,h,-h,-h,h,h,-h,h,h,h,h,h,-h,-h,h,-h,-h,h,h,-h,h,h,-h,h,-h,-h,-h,-h,-h,-h,h,-h,-h,-h,h,-h,-h,h,-h,h,-h,-h,h,h,-h,-h,-h,-h,-h,-h,h,-h,h,h,-h],uv1:[1,1,0,1,0,0,1,0,0,1,0,0,1,0,1,1,1,0,1,1,0,1,0,
  0,1,1,0,1,0,0,1,0,1,1,0,1,0,0,1,0,0,0,1,0,1,1,0,1],normal:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],color:[1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,0,0,1,1,0,1,1,1,1,1,1,1,0,1,1,1,0,1,0,1,1,1,0,1,1,1,0,1,0,1,0,1,0,0,0,1,1,0,0,1,0,0,0,1,0,0,1,1,1,0,1,1,1,0,0,1,0,0,1,1,0,0,0,1,0,1,0,1,0,1,1,1],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,
  21,22,20,22,23]})}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.importer"),l=KICK.namespace("KICK.math"),h=l.quat4,u=l.mat4,o=function(d,c){return d.querySelector("[id="+c+"]")};g.ColladaImporter={};g.ColladaImporter.import=function(d,c,f,g){"string"===typeof d&&(d=(new DOMParser).parseFromString(d,"text/xml"));var l={},A=[],x=[],w=function(a,b){b||(b=Array);var a=a.replace(/^\s+|\s+$/g,""),a=a.replace(/\s{2,}/g," "),c=a.split(" ").map(Number);return!b||b===Array?c:new b(c)},r=function(a){"#"===a.charAt(0)&&(a=a.substring(1));
  if(l[a])return l[a];var b=o(d,a),b=w(b.textContent,"float_array"===b.tagName?Float32Array:Int32Array);return l[a]=b},s=function(a){a.getAttribute("semantic");var a=o(d,a.getAttribute("source").substring(1)),b,c,f;"vertices"===a.tagName&&(a=a.getElementsByTagName("input")[0],a=o(d,a.getAttribute("source").substring(1)));a=a.getElementsByTagName("technique_common")[0].getElementsByTagName("accessor")[0];a.getAttribute("count");b=Number(a.getAttribute("stride"));(c=Number(a.getAttribute("offset")))||
  (c=0);a=a.getAttribute("source");f=r(a);return function(a,d){return f[c+b*a+d]}},y=function(a,b,c){for(var d=a.firstChild,f,g,h,j=function(){return 3},a=Number(a.getAttribute("count")),k=[],m={},l={},o={},n=[],p=KICK.core.Util.contains,r=c.numberOfVertices||0,u,v,t,x,y;null!==d;){f=d.tagName;if("input"===f)f=d.getAttribute("semantic"),g=Number(d.getAttribute("offset")),l[f]=new s(d),k.push(f),m[f]=g,o[f]="TEXCOORD"===f?2:3,p(n,g)||n.push(g);else if("vcount"===f)u=w(d.textContent,Int32Array),j=function(a){return u[a]};
  else if("p"===f){v=n.length;t=w(d.textContent,Int32Array);x={};for(g=0;g<k.length;g++)x[k[g]]=[];y=function(a,b,d){var e="",f,g,h,i,j=a*v,n,p;for(h=0;h<k.length;h++)g=k[h],f=m[g],f=t[f+j],e+=a+"#"+f+"#";g=c[e];if("number"===typeof g)d.push(g);else{for(h=0;h<k.length;h++){g=k[h];a=l[g];n=o[g];f=m[g];f=t[f+j];for(i=0;i<n;i++)p=a(f,i),b[g].push(p)}b=r;r+=1;d.push(b);c[e]=b}};var A=0;f=[];for(g=0;g<a;g++){var T=j(g);for(h=0;3>h;h++)y(A+h,x,f);for(h=3;h<T;h++)y(A,x,f),y(A+h-1,x,f),y(A+h,x,f);A+=T}for(g=
  0;g<k.length;g++)A=k[g],h=A.toLowerCase(),"texcoord"===h&&(h="uv1"),b[h]&&b[h].length?(T=KICK.core.Util.typedArrayToArray,y=T(b[h]),A=T(x[A]),y.push.apply(y,A),b[h]=y):b[h]=x[A];b.meshType=4;g=b.subMeshes;g.push(f);b.subMeshes=g;console.log("pushing new sub mesh with "+f.length+" as # "+b.subMeshes.length)}d=d.nextSibling}c.numberOfVertices=r},k=function(b,d){var g=f.createGameObject(),j=g.transform,l,o;d&&(j.parent=d);g.name=b.getAttribute("id");v.push(g);for(l=b.firstElementChild;l;){o=l.tagName;
  if("translate"===o||"rotate"===o||"scale"===o||"matrix"===o){o=j;var n=l,p=n.tagName;n.getAttribute("sid");var r=void 0,s=void 0,r=r=s=r=void 0;if("translate"===p)o.localPosition=w(n.textContent);else if("rotate"===p){if(r=w(n.textContent),s=r[3])r=h.angleAxis(s,r),s=o.localRotation,o.localRotation=h.multiply(s,r,r)}else"scale"===p?o.localScale=w(n.textContent):"matrix"===p&&(r=w(n.textContent),r=u.decompose(r),o.localPosition=r[0],o.localRotation=r[1],o.localScale=r[2])}else if("instance_geometry"===
  o){o=g;var p=l.getAttribute("url"),t=s=r=n=void 0;p&&(p=p.substring(1));n=c;r=[];t=s=void 0;if(a[p])r=a[p];else{p&&"#"===p.charAt(0)&&(p=p.substring(1));for(s=0;s<m.length;s++)if(t=m[s],t.getAttribute("id")===p){var M=t,D=void 0,F=void 0,s=M.getAttribute("name")||"MeshData",t=void 0,D=M.getElementsByTagName("mesh");if(0===D.length)s=null;else{M={};D=D[0];for(F=D.firstChild;null!==F;)D=F.tagName,"lines"===D?console.log("lines - unsupported"):"linestrips - unsupported"===D?console.log("linestrips"):
  "polygons"===D?console.log("polygons  - unsupported"):"polylist"===D||"triangles"===D?(t||(t=new KICK.mesh.MeshData({name:s})),y(F,t,M)):"trifans"===D?console.log("trifans unsupported"):"tristrips"===D&&console.log("tristrips - unsupported"),F=F.nextSibling;s=t}s&&(n=new KICK.mesh.Mesh(n,{meshData:s,name:s.name+" mesh"}),A.push(n),r.push(n));break}a[p]=r}for(s=0;s<r.length;s++)n=new KICK.scene.MeshRenderer,n.mesh=r[s],t=new KICK.material.Material(c,{name:"Some material",shader:c.project.load(c.project.ENGINE_SHADER_DEFAULT)}),
  n.material=t,x.push(t),o.addComponent(n)}else"node"===o?k(l,j):console.log("Unknown tagName '"+o+"'");l=l.nextElementSibling}},p=d.firstChild.getElementsByTagName("library_geometries"),t=d.firstChild.getElementsByTagName("visual_scene"),m;f||(f=c.activeScene);p=p[0];m=p.getElementsByTagName("geometry");for(var v=[],a={},p=0;p<t.length;p++)for(var b=t[p].firstElementChild;b;)k(b,null),b=b.nextElementSibling;if(g){g=f.createGameObject({name:"Collada Parent"});t=g.transform;t.localRotationEuler=[-90,
  0,0];for(p=0;p<v.length;p++)b=v[p].transform,b.parent||(b.parent=t);v.push(g)}return{mesh:A,gameObjects:v,materials:x}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.importer"),l=KICK.namespace("KICK.math").mat4;g.ObjImporter={};g.ObjImporter.import=function(g,u,o,d){var g=g.split("\n"),c=g.length,f=[],j=[],n=[],A=[],x=[],w=[A],r=[],s=[],y=[],k="MeshObject",p,t=function(a,b){b||(b=Array);var a=a.replace(/^\s+|\s+$/g,""),a=a.replace(/\s{2,}/g," "),c=a.split(" ").map(Number);return!b||b===Array?c:new b(c)},m=function(a){var b=[],c,d,e;for(c=0;c<a.length;c++)d=a[c],d=d.split("/"),e=parseInt(d[0],10),b.push([e,2<=d.length?parseInt(d[1],
  10):e,3<=d.length?parseInt(d[2],10):e]);return b},v=function(){var a=function(a,b,c){a=a[b-1];for(b=0;b<a.length;b++)c.push(a[b])};if(0!==f.length){var b=o.createGameObject(),c=new KICK.mesh.MeshData,d=new KICK.mesh.Mesh(u),e=[],g=[],h=[],l,p=[],t={},v=0,D,F,G,Q,H,I;y.push(d);for(Q=0;Q<w.length;Q++){A=w[Q];l=[];p.push(l);for(H=0;H<A.length;H++){D=A[H];F=m(D);for(I=0;3>I;I++)G=D[I],"number"===typeof t[G]?l.push(t[G]):(a(f,F[I][0],e),n.length&&a(n,F[I][1],h),j.length&&a(j,F[I][2],g),l.push(v),t[G]=
  v,v++)}}c.vertex=e;g.length&&(c.normal=g);h.length&&(c.uv1=h);c.subMeshes=p;d.meshData=c;d.name=k+" mesh";a=new KICK.scene.MeshRenderer;a.mesh=d;var K=[],d=function(a){a=new KICK.material.Material(u,{name:a,shader:u.project.load(u.project.ENGINE_SHADER_DEFAULT)});K.push(a);s.push(a)};for(H=0;H<p.length;H++)H<x.length?(c=x[H],(e=u.project.loadByName(c,"KICK.material.Material"))?K.push(e):d(c)):d("material");a.materials=K;b.name=k;b.addComponent(a);r.push(b);A=[]}},a=l.identity(l.create());d&&l.rotateX(a,
  -1.5707963267946);for(d=0;d<c;d++){var b=g[d].replace(/^\s+|\s+$/g,""),e=b.indexOf(" ");if(!(0>e))if(p=b.substring(0,e),b=b.substring(e+1),"o"===p)v(),k=b,x.length=0;else if("usemtl"===p)x.push(b),0<A.length&&(A=[],w[w.length]=A);else if("v"===p)p=t(b),l.multiplyVec3(a,p),f.push(p);else if("vn"===p)p=t(b),l.multiplyVec3Vector(a,p),j.push(p);else if("vt"===p)n.push(t(b));else if("f"===p){b=b.split(" ");A.push(b.slice(0,3));for(p=3;p<b.length;p++)A.push([b[p-1],b[p],b[0]])}}v();return{mesh:y,gameObjects:r,
  materials:s}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,h;for(h=0;h<g.length;h+=1)"undefined"===typeof l[g[h]]&&(l[g[h]]={}),l=l[g[h]];return l};
  (function(){var g=KICK.namespace("KICK.core"),l=KICK.namespace("KICK.mesh"),h=g.Util.fail;g.ResourceLoader=function(h){var l=[new g.URLResourceProvider(h),new g.BuiltInResourceProvider(h)],h=function(d){return function(c,f){var g,h,u;for(g=l.length-1;0<=g;g--)if(h=l[g],u=h.protocol,0===c.indexOf(u)){h[d](c,f);break}}};this.getMeshData=h("getMeshData");this.getImageData=h("getImageData");this.getShaderData=h("getShaderData");this.addResourceProvider=function(d){l.push(d)};this.removeResourceProvider=
  function(d){var c;for(c=d.length-1;0<=c;c--)l[c]===d&&l.splice(c,1)}};g.URLResourceProvider=function(g){Object.defineProperties(this,{protocol:{value:""}});this.getMeshData=function(l,d){var c=new XMLHttpRequest,f=g.project.createResourceTracker();c.open("GET",l,!0);c.responseType="arraybuffer";c.onreadystatechange=function(){if(4===c.readyState)if(200===c.status){var g=c.response,n=new KICK.mesh.MeshData;n.deserialize(g)?(d.meshData=n,f.resourceReady()):(h("Cannot deserialize meshdata "+l),f.resourceFailed())}else h("Cannot load meshdata "+
  l+". Server responded "+c.status),f.resourceFailed()};c.send()};this.getImageData=function(l,d){var c=new Image,f=g.project.createResourceTracker();c.onload=function(){try{d.setImage(c,l),f.resourceReady()}catch(g){h("Exception when loading image "+l),f.resourceFailed()}};c.onerror=function(c){h(c);h("Exception when loading image "+l);f.resourceFailed()};c.crossOrigin="anonymous";c.src=l}};g.BuiltInResourceProvider=function(h){Object.defineProperties(this,{protocol:{value:"kickjs://"}});this.getMeshData=
  function(h,d){var c,f,j;f=g.Util.getParameterInt;j=g.Util.getParameterFloat;if(0===h.indexOf("kickjs://mesh/triangle/"))c=l.MeshFactory.createTriangleData();else if(0===h.indexOf("kickjs://mesh/plane/"))c=l.MeshFactory.createPlaneData();else if(0===h.indexOf("kickjs://mesh/uvsphere/"))c=f(h,"slices"),f=f(h,"stacks"),j=j(h,"radius"),c=l.MeshFactory.createUVSphereData(c,f,j);else if(0===h.indexOf("kickjs://mesh/cube/"))c=j(h,"length"),c=l.MeshFactory.createCubeData(c);else{KICK.core.Util.fail("No meshdata found for "+
  h);return}d.meshData=c};this.getShaderData=function(g,d){var c,f,j,l=!1,A=!1,x=!0,w=1E3,r=KICK.material.GLSLConstants,s={},y="specular diffuse __shadowmap __error __pick transparent_specular transparent_diffuse unlit unlit_vertex_color transparent_unlit".split(" ");"kickjs://shader/default/"===g&&(g="kickjs://shader/diffuse/");for(c=0;c<y.length;c++){var k=y[c],p=0===g.indexOf("kickjs://shader/"+k+"/");if(p){f=r[k+"_vs.glsl"];j=r[k+"_fs.glsl"];0===k.indexOf("transparent_")&&(l=!0,x=!1,w=2E3);"__shadowmap"===
  k&&(A=!0);if("specular"===k||"transparent_specular"===k)s={mainColor:[1,1,1,1],mainTexture:h.project.load(h.project.ENGINE_TEXTURE_WHITE),specularColor:[1,1,1,1],specularExponent:50};if("diffuse"===k||"transparent_diffuse"===k||"unlit"===k||"unlit_vertex_color"===k||"transparent_unlit"===k)s={mainColor:[1,1,1,1],mainTexture:h.project.load(h.project.ENGINE_TEXTURE_WHITE)}}if(p)break}KICK.core.Util.applyConfig(d,{blend:l,depthMask:x,renderOrder:w,polygonOffsetEnabled:A,vertexShaderSrc:f,fragmentShaderSrc:j,
  defaultUniforms:s});d.apply()};this.getImageData=function(g,d){var c,f,j;if(0===g.indexOf("kickjs://texture/black/"))c=new Uint8Array([0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255]);else if(0===g.indexOf("kickjs://texture/white/"))c=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]);else if(0===g.indexOf("kickjs://texture/gray/"))c=new Uint8Array([127,127,127,255,127,127,127,255,127,127,127,255,127,127,127,255]);else{if(0===g.indexOf("kickjs://texture/logo/")){d.setTemporaryTexture();
  f=document.createElement("img");j=h.project.createResourceTracker();f.onload=function(){d.generateMipmaps=!0;d.internalFormat=6407;d.magFilter=9729;d.minFilter=9987;d.setImage(f,"kickjs://texture/logo/");j.resourceReady()};f.onerror=function(){j.resourceFailed()};f.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAABACAYAAADS1n9/AAAXgWlDQ1BJQ0MgUHJvZmlsZQAAeAGtWXc8lt/7P/cz8Xisx957Zm+y98jeyXqsx/bYu6wyUiSEKCSSaBohoYVkhKaMFFHRQsT3pvp8P3/8vv/9bi/3/Xad93Wd65zr3Ofc1wUAthueYWFBCDoAgkMiyTZGurxOzi682FcAgn8YgRBg9iRGhOlYWZmD/3n9mIC58DUmuWvrf9L+7wZ6b58IIgCQFdzs5R1BDIbxDQAQt4hh5EgAULv2BGMiw3bxSRgzkmEHYVyzi/1+49Zd7PUbD+5x7Gz0YM40ABTUnp5kPwCol2E5bzTRD7aDpwYAwxDiTQoBgMALY02iv6c3AGweMGdfcHDoLs6FsajXv+z4/Qt7enr9Y9PT0+8f/HsssCbcsT4pIizIM27vj//PW3BQFDxfexczfKcOi9S1gZ+s8LyxkiJN7GDMCGMZ/yhj+z9YP97fznGXC8udQrwsLGHMAGNvYoQePJcAtgNFB4aa7drZ5eR6++gbwBheFVBJRLTtX1wX769n8YfjFOBpuhszGpjT6kmG0e9+74dFWu36sGvzRUiQhfkfvOJLNty1D8sRGJ8IA1sYwz4gOCPJdrty2GeElC/J0ATGcL8I3bCgvTW3y7EhR9n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