text: /*!
   * New BSD License
   *
   * Copyright (c) 2011-2012, 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,i;"KICK"===g[0]&&(g=g.slice(1));for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];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:1E-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,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];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,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.math"),l=KICK.namespace("KICK.math.vec2"),i=KICK.namespace("KICK.math.vec3"),x=KICK.namespace("KICK.math.vec4"),j=KICK.namespace("KICK.math.mat3"),b=KICK.namespace("KICK.math.mat4"),c=KICK.namespace("KICK.math.quat4"),e=KICK.namespace("KICK.math.aabb"),h=KICK.namespace("KICK.math.frustum"),p=Math.min,F=Math.max,B=Math.cos,y=Math.acos,s=Math.sin,z=Math.asin,A=Math.abs,m=Math.tan,n=Math.atan,C=Math.atan2,k=Math.PI,r=function(a,d){var f,t=0,b=a.length/d,c=[];for(f=
  0;f<b;f++,t+=d)c[f]=a.subarray(t,t+d);return c};g.vec2=l;l.wrapArray=function(a){return r(a,2)};l.array=function(a,d){var f=new Float32Array(2*a);d&&(d.mem=f);return l.wrapArray(f)};l.create=function(a){var d=new Float32Array(2);a&&(d[0]=a[0],d[1]=a[1]);return d};l.set=function(a,d){d[0]=a[0];d[1]=a[1];return d};l.add=function(a,d,f){if(!f||a===f)return a[0]+=d[0],a[1]+=d[1],a;f[0]=a[0]+d[0];f[1]=a[1]+d[1];return f};l.subtract=function(a,d,f){if(!f||a===f)return a[0]-=d[0],a[1]-=d[1],a;f[0]=a[0]-
  d[0];f[1]=a[1]-d[1];return f};l.equal=function(a,d,f){var t;f||(f=1E-5);for(t=0;2>t;t++)if(A(a[t]-d[t])>f)return!1;return!0};l.normalize=function(a,d){var f,t,b;d||(d=a);f=a[0];t=a[1];if(b=Math.sqrt(f*f+t*t)){if(1===b)return d[0]=f,d[1]=t,d}else return d[0]=0,d[1]=0,d;b=1/b;d[0]=f*b;d[1]=t*b;return d};g.vec3=i;i.wrapArray=function(a){return r(a,3)};i.array=function(a,d){var f=new Float32Array(3*a);d&&(d.mem=f);return i.wrapArray(f)};i.create=function(a){var d=new Float32Array(3);a&&(d[0]=a[0],d[1]=
  a[1],d[2]=a[2]);return d};i.set=function(a,d){d[0]=a[0];d[1]=a[1];d[2]=a[2];return d};i.add=function(a,d,f){if(!f||a===f)return a[0]+=d[0],a[1]+=d[1],a[2]+=d[2],a;f[0]=a[0]+d[0];f[1]=a[1]+d[1];f[2]=a[2]+d[2];return f};i.subtract=function(a,d,f){if(!f||a===f)return a[0]-=d[0],a[1]-=d[1],a[2]-=d[2],a;f[0]=a[0]-d[0];f[1]=a[1]-d[1];f[2]=a[2]-d[2];return f};i.equal=function(a,d,f){var t;f||(f=1E-5);for(t=0;3>t;t++)if(A(a[t]-d[t])>f)return!1;return!0};i.multiply=function(a,d,f){if(!f||a===f)return a[0]*=
  d[0],a[1]*=d[1],a[2]*=d[2],a;f[0]=a[0]*d[0];f[1]=a[1]*d[1];f[2]=a[2]*d[2];return f};i.negate=function(a,d){d||(d=a);d[0]=-a[0];d[1]=-a[1];d[2]=-a[2];return d};i.scale=function(a,d,f){if(!f||a===f)return a[0]*=d,a[1]*=d,a[2]*=d,a;f[0]=a[0]*d;f[1]=a[1]*d;f[2]=a[2]*d;return f};i.normalize=function(a,d){d||(d=a);var f=a[0],t=a[1],b=a[2],c=Math.sqrt(f*f+t*t+b*b);if(c){if(1===c)return d[0]=f,d[1]=t,d[2]=b,d}else return d[0]=0,d[1]=0,d[2]=0,d;c=1/c;d[0]=f*c;d[1]=t*c;d[2]=b*c;return d};i.cross=function(a,
  d,f){f||(f=a);var t=a[0],b=a[1],a=a[2],c=d[0],k=d[1],d=d[2];f[0]=b*d-a*k;f[1]=a*c-t*d;f[2]=t*k-b*c;return f};i.length=function(a){var d=a[0],f=a[1],a=a[2];return Math.sqrt(d*d+f*f+a*a)};i.lengthSqr=function(a){var d=a[0],f=a[1],a=a[2];return d*d+f*f+a*a};i.dot=function(a,d){return a[0]*d[0]+a[1]*d[1]+a[2]*d[2]};i.direction=function(a,d,f){f||(f=a);var t=a[0]-d[0],b=a[1]-d[1],a=a[2]-d[2],d=Math.sqrt(t*t+b*b+a*a);if(!d)return f[0]=0,f[1]=0,f[2]=0,f;d=1/d;f[0]=t*d;f[1]=b*d;f[2]=a*d;return f};i.lerp=
  function(a,d,f,t){t||(t=a);t[0]=a[0]+f*(d[0]-a[0]);t[1]=a[1]+f*(d[1]-a[1]);t[2]=a[2]+f*(d[2]-a[2]);return t};i.dist=function(a,d){var f=d[0]-a[0],t=d[1]-a[1],b=d[2]-a[2];return Math.sqrt(f*f+t*t+b*b)};var q=new Float32Array(16),w=new Float32Array(4);i.unproject=function(a,d,f,t,c){c||(c=a);w[0]=2*(a[0]-t[0])/t[2]-1;w[1]=2*(a[1]-t[1])/t[3]-1;w[2]=2*a[2]-1;w[3]=1;b.multiply(f,d,q);if(!b.inverse(q))return null;b.multiplyVec4(q,w);if(0===w[3])return null;c[0]=w[0]/w[3];c[1]=w[1]/w[3];c[2]=w[2]/w[3];return c};
  i.sphericalToCarterian=function(a,d){var f=a[0],t=-a[1],b=a[2],c=f*B(b);d||(d=i.create());d[0]=c*B(t);d[1]=f*s(b);d[2]=c*s(t);return d};i.cartesianToSpherical=function(a,d){var f=a[0],t=a[1],b=a[2],c;0===f&&(f=1E-5);d||(d=i.create());d[0]=c=Math.sqrt(f*f+t*t+b*b);d[1]=-n(b/f);0>f&&(d[1]+=k);d[2]=z(t/c);return d};i.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+"]"};g.vec4=x;x.wrapArray=function(a){return r(a,4)};x.array=function(a,d){var f=new Float32Array(4*a);d&&(d.mem=f);return x.wrapArray(f)};
  x.create=function(a){var d=new Float32Array(4);a&&(d[0]=a[0],d[1]=a[1],d[2]=a[2],d[3]=a[3]);return d};x.set=function(a,d){d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];return d};x.add=function(a,d,f){if(!f||a===f)return a[0]+=d[0],a[1]+=d[1],a[2]+=d[2],a[3]+=d[3],a;f[0]=a[0]+d[0];f[1]=a[1]+d[1];f[2]=a[2]+d[2];f[3]=a[3]+d[3];return f};x.subtract=function(a,d,f){if(!f||a===f)return a[0]-=d[0],a[1]-=d[1],a[2]-=d[2],a[3]-=d[3],a;f[0]=a[0]-d[0];f[1]=a[1]-d[1];f[2]=a[2]-d[2];f[3]=a[3]-d[3];return f};x.equal=
  function(a,d,f){var t;f||(f=1E-5);for(t=0;2>t;t++)if(A(a[t]-d[t])>f)return!1;return!0};x.multiply=function(a,d,f){if(!f||a===f)return a[0]*=d[0],a[1]*=d[1],a[2]*=d[2],a[3]*=d[3],a;f[0]=a[0]*d[0];f[1]=a[1]*d[1];f[2]=a[2]*d[2];f[3]=a[3]*d[3];return f};x.negate=function(a,d){d||(d=a);d[0]=-a[0];d[1]=-a[1];d[2]=-a[2];d[3]=-a[3];return d};x.length=function(a){var d=a[0],f=a[1],t=a[2],a=a[3];return Math.sqrt(d*d+f*f+t*t+a*a)};x.dot=function(a,d){return a[0]*d[0]+a[1]*d[1]+a[2]*d[2]+a[3]*d[3]};x.scale=function(a,
  d,f){if(!f||a===f)return a[0]*=d,a[1]*=d,a[2]*=d,a[3]*=d,a;f[0]=a[0]*d;f[1]=a[1]*d;f[2]=a[2]*d;f[3]=a[2]*d;return f};x.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+"]"};g.mat3=j;j.create=function(a){var d=new Float32Array(9);a&&(d[0]=a[0],d[1]=a[1],d[2]=a[2],d[3]=a[3],d[4]=a[4],d[5]=a[5],d[6]=a[6],d[7]=a[7],d[8]=a[8]);return d};j.set=function(a,d){d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];d[4]=a[4];d[5]=a[5];d[6]=a[6];d[7]=a[7];d[8]=a[8];return d};j.identity=function(a){a||(a=j.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};j.transpose=function(a,d){if(!d||a===d){var f=a[1],t=a[2],b=a[5];a[1]=a[3];a[2]=a[6];a[3]=f;a[5]=a[7];a[6]=t;a[7]=b;return a}d[0]=a[0];d[1]=a[3];d[2]=a[6];d[3]=a[1];d[4]=a[4];d[5]=a[7];d[6]=a[2];d[7]=a[5];d[8]=a[8];return d};j.toMat4=function(a,d){d||(d=b.create());d[15]=1;d[14]=0;d[13]=0;d[12]=0;d[11]=0;d[10]=a[8];d[9]=a[7];d[8]=a[6];d[7]=0;d[6]=a[5];d[5]=a[4];d[4]=a[3];d[3]=0;d[2]=a[2];d[1]=a[1];d[0]=a[0];return d};j.toQuat=
  function(a,d){var f=a[0],t=a[1],b=a[2],k=a[3],e=a[4],h=a[5],n=a[6],g=a[7],m=a[8],r=f+e+m;d||(d=c.create());0<r?(f=0.5/Math.sqrt(r+1),d[0]=(h-g)*f,d[1]=(n-b)*f,d[2]=(t-k)*f,d[3]=0.25/f):f>e&&f>m?(f=2*Math.sqrt(1+f-e-m),d[0]=0.25*f,d[1]=(k+t)/f,d[2]=(n+b)/f,d[3]=(h-g)/f):e>m?(f=2*Math.sqrt(1+e-f-m),d[0]=(k+t)/f,d[1]=0.25*f,d[2]=(g+h)/f,d[3]=(n-b)/f):(f=2*Math.sqrt(1+m-f-e),d[0]=(n+b)/f,d[1]=(g+h)/f,d[2]=0.25*f,d[3]=(t-k)/f);return d};j.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+
  a[4]+", "+a[5]+", "+a[6]+", "+a[7]+", "+a[8]+"]"};j.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=b;b.create=function(a){var d=new Float32Array(16);a&&(d[0]=a[0],d[1]=a[1],d[2]=a[2],d[3]=a[3],d[4]=a[4],d[5]=a[5],d[6]=a[6],d[7]=a[7],d[8]=a[8],d[9]=a[9],d[10]=a[10],d[11]=a[11],d[12]=a[12],d[13]=a[13],d[14]=a[14],d[15]=a[15]);return d};b.set=function(a,d){d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];d[4]=a[4];d[5]=a[5];
  d[6]=a[6];d[7]=a[7];d[8]=a[8];d[9]=a[9];d[10]=a[10];d[11]=a[11];d[12]=a[12];d[13]=a[13];d[14]=a[14];d[15]=a[15];return d};b.setTRS=function(a,d,f,t){t||(t=b.create());var c=f[0],k=f[1],f=f[2],e=d[0],h=d[1],n=d[2],g=d[3],m=e+e,r=h+h,v=n+n,d=e*m,p=e*r,e=e*v,q=h*r,h=h*v,n=n*v,m=g*m,r=g*r,g=g*v;t[0]=(1-(q+n))*c;t[1]=(p+g)*c;t[2]=(e-r)*c;t[3]=0;t[4]=(p-g)*k;t[5]=(1-(d+n))*k;t[6]=(h+m)*k;t[7]=0;t[8]=(e+r)*f;t[9]=(h-m)*f;t[10]=(1-(d+q))*f;t[11]=0;t[12]=a[0];t[13]=a[1];t[14]=a[2];t[15]=1;return t};b.setTRSInverse=
  function(a,d,f,t){t||(t=b.create());var c=f[0],k=f[1],e=f[2],h=d[0],n=d[1],g=d[2],d=d[3],m=h+h,r=n+n,f=g+g,v=h*m,p=h*r,h=h*f,q=n*r,n=n*f,g=g*f,m=d*m,r=d*r,w=d*f,d=(1-(q+g))*c,f=(p+w)*c,c=(h-r)*c,p=(p-w)*k,g=(1-(v+g))*k,k=(n+m)*k,h=(h+r)*e,n=(n-m)*e,e=(1-(v+q))*e,v=a[0],q=a[1],a=a[2],m=d*g-f*p,r=d*k-c*p,w=f*k-c*g,u=h*q-n*v,j=h*a-e*v,i=1*h,B=n*a-e*q,C=1*n,F=1*e,H=m*F-r*C+w*i;if(!H)return null;H=1/H;t[0]=(g*F-k*C)*H;t[1]=(-f*F+c*C)*H;t[2]=1*w*H;t[3]=0;t[4]=(-p*F+k*i)*H;t[5]=(d*F-c*i)*H;t[6]=-1*r*H;t[7]=
  0;t[8]=(p*C-g*i)*H;t[9]=(-d*C+f*i)*H;t[10]=1*m*H;t[11]=0;t[12]=(-p*B+g*j-k*u)*H;t[13]=(d*B-f*j+c*u)*H;t[14]=(-v*w+q*r-a*m)*H;t[15]=(h*w-n*r+e*m)*H;return t};b.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};b.transpose=function(a,d){if(!d||a===d){var f=a[1],t=a[2],b=a[3],c=a[6],k=a[7],e=a[11];a[1]=a[4];a[2]=a[8];a[3]=a[12];a[4]=f;a[6]=a[9];a[7]=a[13];a[8]=t;a[9]=c;a[11]=a[14];a[12]=b;a[13]=k;a[14]=
  e;return a}d[0]=a[0];d[1]=a[4];d[2]=a[8];d[3]=a[12];d[4]=a[1];d[5]=a[5];d[6]=a[9];d[7]=a[13];d[8]=a[2];d[9]=a[6];d[10]=a[10];d[11]=a[14];d[12]=a[3];d[13]=a[7];d[14]=a[11];d[15]=a[15];return d};b.determinant=function(a){var d=a[0],f=a[1],t=a[2],b=a[3],c=a[4],k=a[5],e=a[6],h=a[7],n=a[8],g=a[9],m=a[10],r=a[11],v=a[12],p=a[13],q=a[14],a=a[15];return v*g*e*b-n*p*e*b-v*k*m*b+c*p*m*b+n*k*q*b-c*g*q*b-v*g*t*h+n*p*t*h+v*f*m*h-d*p*m*h-n*f*q*h+d*g*q*h+v*k*t*r-c*p*t*r-v*f*e*r+d*p*e*r+c*f*q*r-d*k*q*r-n*k*t*a+c*
  g*t*a+n*f*e*a-d*g*e*a-c*f*m*a+d*k*m*a};b.inverse=function(a,d){d||(d=a);var f=a[0],b=a[1],c=a[2],k=a[3],e=a[4],h=a[5],n=a[6],g=a[7],m=a[8],r=a[9],v=a[10],p=a[11],q=a[12],w=a[13],u=a[14],i=a[15],j=f*h-b*e,B=f*n-c*e,C=f*g-k*e,H=b*n-c*h,F=b*g-k*h,l=c*g-k*n,s=m*w-r*q,E=m*u-v*q,y=m*i-p*q,z=r*u-v*w,G=r*i-p*w,I=v*i-p*u,D=j*I-B*G+C*z+H*y-F*E+l*s;if(!D)return null;D=1/D;d[0]=(h*I-n*G+g*z)*D;d[1]=(-b*I+c*G-k*z)*D;d[2]=(w*l-u*F+i*H)*D;d[3]=(-r*l+v*F-p*H)*D;d[4]=(-e*I+n*y-g*E)*D;d[5]=(f*I-c*y+k*E)*D;d[6]=(-q*
  l+u*C-i*B)*D;d[7]=(m*l-v*C+p*B)*D;d[8]=(e*G-h*y+g*s)*D;d[9]=(-f*G+b*y-k*s)*D;d[10]=(q*F-w*C+i*j)*D;d[11]=(-m*F+r*C-p*j)*D;d[12]=(-e*z+h*E-n*s)*D;d[13]=(f*z-b*E+c*s)*D;d[14]=(-q*H+w*B-u*j)*D;d[15]=(m*H-r*B+v*j)*D;return d};b.toRotationMat=function(a,d){d||(d=b.create());d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];d[4]=a[4];d[5]=a[5];d[6]=a[6];d[7]=a[7];d[8]=a[8];d[9]=a[9];d[10]=a[10];d[11]=a[11];d[12]=0;d[13]=0;d[14]=0;d[15]=1;return d};b.toMat3=function(a,d){d||(d=j.create());d[0]=a[0];d[1]=a[1];d[2]=
  a[2];d[3]=a[4];d[4]=a[5];d[5]=a[6];d[6]=a[8];d[7]=a[9];d[8]=a[10];return d};b.toNormalMat3=function(a,d){var f=a[0],b=a[1],c=a[2],k=a[4],e=a[5],h=a[6],n=a[8],g=a[9],m=a[10],r=m*e-h*g,v=-m*k+h*n,p=g*k-e*n,q=f*r+b*v+c*p;if(!q)return null;q=1/q;d||(d=j.create());d[0]=r*q;d[3]=(-m*b+c*g)*q;d[6]=(h*b-c*e)*q;d[1]=v*q;d[4]=(m*f-c*n)*q;d[7]=(-h*f+c*k)*q;d[2]=p*q;d[5]=(-g*f+b*n)*q;d[8]=(e*f-b*k)*q;return d};b.toInverseMat3=function(a,d){var f=a[0],b=a[1],c=a[2],k=a[4],e=a[5],h=a[6],n=a[8],g=a[9],m=a[10],r=
  m*e-h*g,q=-m*k+h*n,v=g*k-e*n,p=f*r+b*q+c*v;if(!p)return null;p=1/p;d||(d=j.create());d[0]=r*p;d[1]=(-m*b+c*g)*p;d[2]=(h*b-c*e)*p;d[3]=q*p;d[4]=(m*f-c*n)*p;d[5]=(-h*f+c*k)*p;d[6]=v*p;d[7]=(-g*f+b*n)*p;d[8]=(e*f-b*k)*p;return d};b.multiply=function(a,d,f){f||(f=a);var b=a[0],c=a[1],k=a[2],e=a[3],h=a[4],n=a[5],g=a[6],m=a[7],r=a[8],p=a[9],q=a[10],v=a[11],w=a[12],u=a[13],i=a[14],a=a[15],j=d[0],B=d[1],C=d[2],H=d[3],F=d[4],l=d[5],s=d[6],E=d[7],y=d[8],D=d[9],z=d[10],G=d[11],I=d[12],J=d[13],A=d[14],d=d[15];
  f[0]=j*b+B*h+C*r+H*w;f[1]=j*c+B*n+C*p+H*u;f[2]=j*k+B*g+C*q+H*i;f[3]=j*e+B*m+C*v+H*a;f[4]=F*b+l*h+s*r+E*w;f[5]=F*c+l*n+s*p+E*u;f[6]=F*k+l*g+s*q+E*i;f[7]=F*e+l*m+s*v+E*a;f[8]=y*b+D*h+z*r+G*w;f[9]=y*c+D*n+z*p+G*u;f[10]=y*k+D*g+z*q+G*i;f[11]=y*e+D*m+z*v+G*a;f[12]=I*b+J*h+A*r+d*w;f[13]=I*c+J*n+A*p+d*u;f[14]=I*k+J*g+A*q+d*i;f[15]=I*e+J*m+A*v+d*a;return f};b.multiplyVec3=function(a,d,f){f||(f=d);var b=d[0],c=d[1],d=d[2];f[0]=a[0]*b+a[4]*c+a[8]*d+a[12];f[1]=a[1]*b+a[5]*c+a[9]*d+a[13];f[2]=a[2]*b+a[6]*c+a[10]*
  d+a[14];return f};b.multiplyVec3Vector=function(a,d,f){f||(f=d);var b=d[0],c=d[1],d=d[2];f[0]=a[0]*b+a[4]*c+a[8]*d;f[1]=a[1]*b+a[5]*c+a[9]*d;f[2]=a[2]*b+a[6]*c+a[10]*d;f[3]=a[3]*b+a[7]*c+a[11]*d;return f};b.multiplyVec4=function(a,d,f){f||(f=d);var b=d[0],c=d[1],k=d[2],d=d[3];f[0]=a[0]*b+a[4]*c+a[8]*k+a[12]*d;f[1]=a[1]*b+a[5]*c+a[9]*k+a[13]*d;f[2]=a[2]*b+a[6]*c+a[10]*k+a[14]*d;f[3]=a[3]*b+a[7]*c+a[11]*k+a[15]*d;return f};b.translate=function(a,d,f){var b=d[0],c=d[1],d=d[2],k,e,h,n,g,m,r,p,q,v,w,u;
  if(!f||a===f)return a[12]=a[0]*b+a[4]*c+a[8]*d+a[12],a[13]=a[1]*b+a[5]*c+a[9]*d+a[13],a[14]=a[2]*b+a[6]*c+a[10]*d+a[14],a[15]=a[3]*b+a[7]*c+a[11]*d+a[15],a;k=a[0];e=a[1];h=a[2];n=a[3];g=a[4];m=a[5];r=a[6];p=a[7];q=a[8];v=a[9];w=a[10];u=a[11];f[0]=k;f[1]=e;f[2]=h;f[3]=n;f[4]=g;f[5]=m;f[6]=r;f[7]=p;f[8]=q;f[9]=v;f[10]=w;f[11]=u;f[12]=k*b+g*c+q*d+a[12];f[13]=e*b+m*c+v*d+a[13];f[14]=h*b+r*c+w*d+a[14];f[15]=n*b+p*c+u*d+a[15];return f};b.scale=function(a,d,f){var b=d[0],c=d[1],d=d[2];if(!f||a===f)return a[0]*=
  b,a[1]*=b,a[2]*=b,a[3]*=b,a[4]*=c,a[5]*=c,a[6]*=c,a[7]*=c,a[8]*=d,a[9]*=d,a[10]*=d,a[11]*=d,a;f[0]=a[0]*b;f[1]=a[1]*b;f[2]=a[2]*b;f[3]=a[3]*b;f[4]=a[4]*c;f[5]=a[5]*c;f[6]=a[6]*c;f[7]=a[7]*c;f[8]=a[8]*d;f[9]=a[9]*d;f[10]=a[10]*d;f[11]=a[11]*d;f[12]=a[12];f[13]=a[13];f[14]=a[14];f[15]=a[15];return f};b.rotate=function(a,d,f,b){var c=f[0],k=f[1],f=f[2],e,h,n,g,m,r,p,q,v,w,u,i,j,C,H,F,l,E,y,D,z;g=Math.sqrt(c*c+k*k+f*f);if(!g)return null;1!==g&&(g=1/g,c*=g,k*=g,f*=g);e=s(d);h=B(d);n=1-h;d=a[0];g=a[1];
  m=a[2];r=a[3];p=a[4];q=a[5];v=a[6];w=a[7];u=a[8];i=a[9];j=a[10];C=a[11];H=c*c*n+h;F=k*c*n+f*e;l=f*c*n-k*e;E=c*k*n-f*e;y=k*k*n+h;D=f*k*n+c*e;z=c*f*n+k*e;c=k*f*n-c*e;k=f*f*n+h;b?a!==b&&(b[12]=a[12],b[13]=a[13],b[14]=a[14],b[15]=a[15]):b=a;b[0]=d*H+p*F+u*l;b[1]=g*H+q*F+i*l;b[2]=m*H+v*F+j*l;b[3]=r*H+w*F+C*l;b[4]=d*E+p*y+u*D;b[5]=g*E+q*y+i*D;b[6]=m*E+v*y+j*D;b[7]=r*E+w*y+C*D;b[8]=d*z+p*c+u*k;b[9]=g*z+q*c+i*k;b[10]=m*z+v*c+j*k;b[11]=r*z+w*c+C*k;return b};b.rotateX=function(a,d,f){var b=s(d),d=B(d),c=a[4],
  k=a[5],e=a[6],h=a[7],n=a[8],g=a[9],m=a[10],r=a[11];f?a!==f&&(f[0]=a[0],f[1]=a[1],f[2]=a[2],f[3]=a[3],f[12]=a[12],f[13]=a[13],f[14]=a[14],f[15]=a[15]):f=a;f[4]=c*d+n*b;f[5]=k*d+g*b;f[6]=e*d+m*b;f[7]=h*d+r*b;f[8]=c*-b+n*d;f[9]=k*-b+g*d;f[10]=e*-b+m*d;f[11]=h*-b+r*d;return f};b.rotateY=function(a,d,f){var b=s(d),d=B(d),c=a[0],k=a[1],e=a[2],h=a[3],n=a[8],g=a[9],m=a[10],r=a[11];f?a!==f&&(f[4]=a[4],f[5]=a[5],f[6]=a[6],f[7]=a[7],f[12]=a[12],f[13]=a[13],f[14]=a[14],f[15]=a[15]):f=a;f[0]=c*d+n*-b;f[1]=k*d+
  g*-b;f[2]=e*d+m*-b;f[3]=h*d+r*-b;f[8]=c*b+n*d;f[9]=k*b+g*d;f[10]=e*b+m*d;f[11]=h*b+r*d;return f};b.rotateZ=function(a,d,f){var b=s(d),d=B(d),c=a[0],k=a[1],e=a[2],h=a[3],n=a[4],g=a[5],m=a[6],r=a[7];f?a!==f&&(f[8]=a[8],f[9]=a[9],f[10]=a[10],f[11]=a[11],f[12]=a[12],f[13]=a[13],f[14]=a[14],f[15]=a[15]):f=a;f[0]=c*d+n*b;f[1]=k*d+g*b;f[2]=e*d+m*b;f[3]=h*d+r*b;f[4]=c*-b+n*d;f[5]=k*-b+g*d;f[6]=e*-b+m*d;f[7]=h*-b+r*d;return f};b.frustum=function(a,d,f,c,k,e,h){h||(h=b.create());var n=d-a,g=c-f,m=e-k;h[0]=
  2*k/n;h[1]=0;h[2]=0;h[3]=0;h[4]=0;h[5]=2*k/g;h[6]=0;h[7]=0;h[8]=(d+a)/n;h[9]=(c+f)/g;h[10]=-(e+k)/m;h[11]=-1;h[12]=0;h[13]=0;h[14]=-(2*e*k)/m;h[15]=0;return h};b.perspective=function(a,d,f,c,h){a=f*m(a*k/360);d*=a;return b.frustum(-d,d,-a,a,f,c,h)};b.ortho=function(a,d,f,c,k,h,e){e||(e=b.create());var n=d-a,g=c-f,m=h-k;e[0]=2/n;e[1]=0;e[2]=0;e[3]=0;e[4]=0;e[5]=2/g;e[6]=0;e[7]=0;e[8]=0;e[9]=0;e[10]=-2/m;e[11]=0;e[12]=-(a+d)/n;e[13]=-(c+f)/g;e[14]=-(h+k)/m;e[15]=1;return e};b.lookAt=function(a,d,f,
  c){c||(c=b.create());var k=a[0],e=a[1],a=a[2],h=f[0],n=f[1],g=f[2],f=d[1],m=d[2],r,p,q,v;if(k===d[0]&&e===f&&a===m)return b.identity(c);f=k-d[0];m=e-d[1];d=a-d[2];v=1/Math.sqrt(f*f+m*m+d*d);f*=v;m*=v;d*=v;r=n*d-g*m;g=g*f-h*d;h=h*m-n*f;(v=Math.sqrt(r*r+g*g+h*h))?(v=1/v,r*=v,g*=v,h*=v):h=g=r=0;n=m*h-d*g;p=d*r-f*h;q=f*g-m*r;(v=Math.sqrt(n*n+p*p+q*q))?(v=1/v,n*=v,p*=v,q*=v):q=p=n=0;c[0]=r;c[1]=n;c[2]=f;c[3]=0;c[4]=g;c[5]=p;c[6]=m;c[7]=0;c[8]=h;c[9]=q;c[10]=d;c[11]=0;c[12]=-(r*k+g*e+h*a);c[13]=-(n*k+p*
  e+q*a);c[14]=-(f*k+m*e+d*a);c[15]=1;return c};var u=b.create();b.decompose=function(a,d,f,k){var e=[a[0],a[1],a[2]],h=[a[4],a[5],a[6]],n=[a[8],a[9],a[10]];d||(d=i.create());f||(f=c.create());k||(k=i.create());d[0]=a[12];d[1]=a[13];d[2]=a[14];k[0]=e=i.length(e);k[1]=h=i.length(h);k[2]=n=i.length(n);b.set(a,u);u[0]/=e;u[1]/=e;u[2]/=e;u[4]/=h;u[5]/=h;u[6]/=h;u[8]/=n;u[9]/=n;u[10]/=n;c.setFromRotationMatrix(u,f);return[d,f,k]};b.fromRotationTranslation=function(a,d,f){f||(f=b.create());var c=a[0],k=a[1],
  e=a[2],h=a[3],n=c+c,g=k+k,m=e+e,a=c*n,r=c*g,c=c*m,v=k*g,k=k*m,e=e*m,n=h*n,g=h*g,h=h*m;f[0]=1-(v+e);f[1]=r+h;f[2]=c-g;f[3]=0;f[4]=r-h;f[5]=1-(a+e);f[6]=k+n;f[7]=0;f[8]=c+g;f[9]=k-n;f[10]=1-(a+v);f[11]=0;f[12]=d[0];f[13]=d[1];f[14]=d[2];f[15]=1;return f};b.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]+"]"};b.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=x.create;c.set=x.set;c.calculateW=function(a,d){var f=a[0],c=a[1],b=a[2],k=-Math.sqrt(A(1-f*f-c*c-b*b));if(!d||a===d)return a[3]=k,a;d[0]=f;d[1]=c;d[2]=b;d[3]=k;return d};c.inverse=function(a,d){var f=1/c.dot(a,a);if(!d||a===d)return a[0]*=-f,a[1]*=-f,a[2]*=-f,a[3]*=f,a;d[0]=-a[0]*f;d[1]=-a[1]*f;d[2]=-a[2]*f;d[3]=a[3]*f;return d};
  c.conjugate=function(a,d){if(!d||a===d)return a[0]*=-1,a[1]*=-1,a[2]*=-1,a;d[0]=-a[0];d[1]=-a[1];d[2]=-a[2];d[3]=a[3];return d};c.length=x.length;c.dot=x.dot;c.normalize=function(a,d){d||(d=a);var f=a[0],c=a[1],b=a[2],k=a[3],e=Math.sqrt(f*f+c*c+b*b+k*k);if(0===e)return d[0]=0,d[1]=0,d[2]=0,d[3]=0,d;e=1/e;d[0]=f*e;d[1]=c*e;d[2]=b*e;d[3]=k*e;return d};c.multiply=function(a,d,f){f||(f=a);var c=a[0],b=a[1],k=a[2],a=a[3],e=d[0],h=d[1],n=d[2],d=d[3];f[0]=c*d+a*e+b*n-k*h;f[1]=b*d+a*h+k*e-c*n;f[2]=k*d+a*
  n+c*h-b*e;f[3]=a*d-c*e-b*h-k*n;return f};c.multiplyVec3=function(a,d,f){f||(f=d);var c=d[0],b=d[1],k=d[2],d=a[0],e=a[1],h=a[2],a=a[3],n=a*c+e*k-h*b,g=a*b+h*c-d*k,m=a*k+d*b-e*c,c=-d*c-e*b-h*k;f[0]=n*a+c*-d+g*-h-m*-e;f[1]=g*a+c*-e+m*-d-n*-h;f[2]=m*a+c*-h+n*-e-g*-d;return f};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,d){var f=a[0],c=a[1],b=a[2],k=a[3],e=c*c;d||(d=i.create());d[0]=57.2957795130824*C(2*(k*f+c*b),1-2*(f*f+e));d[1]=57.2957795130824*
  z(2*(k*c-b*f));d[2]=57.2957795130824*C(2*(k*b+f*c),1-2*(e+b*b));return d};c.angleAxis=function(a,d,f){var a=0.00872664625997*a,b=s(a);f||(f=c.create());f[3]=B(a);f[2]=d[2]*b;f[1]=d[1]*b;f[0]=d[0]*b;return f};var E=i.create(),D=i.create(),G=i.create(),v=j.create();c.lookAt=function(a,d,f,c){i.subtract(a,d,G);i.normalize(G);i.cross(f,G,D);i.normalize(D);i.cross(G,D,E);i.normalize(E);v[0]=D[0];v[1]=D[1];v[2]=D[2];v[3]=E[0];v[4]=E[1];v[5]=E[2];v[6]=G[0];v[7]=G[1];v[8]=G[2];return j.toQuat(v,c)};c.setEuler=
  function(a,d){var f=0.00872664625997*a[0],b=0.00872664625997*a[1],k=0.00872664625997*a[2],e=B(f),h=B(b),n=B(k),f=s(f),b=s(b),k=s(k);d||(d=c.create());d[3]=e*h*n+f*b*k;d[0]=f*h*n-e*b*k;d[1]=e*b*n+f*h*k;d[2]=e*h*k-f*b*n;return d};c.setFromRotationMatrix=function(a,d){var f,k,e,h;e=a[0];var n=a[4],g=a[8],m=a[1],r=a[5],v=a[9],p=a[2],q=a[6],w=a[10],u;u=Math.pow(b.determinant(a),1/3);h=Math.sqrt(Math.max(0,u+e+r+w))/2;f=Math.sqrt(Math.max(0,u+e-r-w))/2;k=Math.sqrt(Math.max(0,u-e+r-w))/2;e=Math.sqrt(Math.max(0,
  u-e-r+w))/2;f=0>q-v?-Math.abs(f):Math.abs(f);k=0>g-p?-Math.abs(k):Math.abs(k);e=0>m-n?-Math.abs(e):Math.abs(e);f=[f,k,e,h];d?c.set(f,d):d=c.create(f);c.normalize(d);return d};c.toMat3=function(a,d){d||(d=j.create());var f=a[0],c=a[1],b=a[2],k=a[3],e=f+f,h=c+c,n=b+b,g=f*e,m=f*h,f=f*n,r=c*h,c=c*n,b=b*n,e=k*e,h=k*h,k=k*n;d[0]=1-(r+b);d[1]=m+k;d[2]=f-h;d[3]=m-k;d[4]=1-(g+b);d[5]=c+e;d[6]=f+h;d[7]=c-e;d[8]=1-(g+r);return d};c.toMat4=function(a,d){d||(d=b.create());var f=a[0],c=a[1],k=a[2],e=a[3],h=f+f,
  n=c+c,g=k+k,m=f*h,r=f*n,f=f*g,v=c*n,c=c*g,k=k*g,h=e*h,n=e*n,e=e*g;d[0]=1-(v+k);d[1]=r+e;d[2]=f-n;d[3]=0;d[4]=r-e;d[5]=1-(m+k);d[6]=c+h;d[7]=0;d[8]=f+n;d[9]=c-h;d[10]=1-(m+v);d[11]=0;d[12]=0;d[13]=0;d[14]=0;d[15]=1;return d};c.slerp=function(a,d,f,c){c||(c=a);var b=a[0]*d[0]+a[1]*d[1]+a[2]*d[2]+a[3]*d[3],k,e;if(1<=A(b))return c!==a&&(c[0]=a[0],c[1]=a[1],c[2]=a[2],c[3]=a[3]),c;k=y(b);e=Math.sqrt(1-b*b);if(0.0010>A(e))return c[0]=0.5*a[0]+0.5*d[0],c[1]=0.5*a[1]+0.5*d[1],c[2]=0.5*a[2]+0.5*d[2],c[3]=0.5*
  a[3]+0.5*d[3],c;b=s((1-f)*k)/e;f=s(f*k)/e;c[0]=a[0]*b+d[0]*f;c[1]=a[1]*b+d[1]*f;c[2]=a[2]*b+d[2]*f;c[3]=a[3]*b+d[3]*f;return c};c.difference=function(a,d,f){f||(f=a);var c=-a[0],b=-a[1],k=-a[2],a=a[3],e=d[0],h=d[1],n=d[2],d=d[3];f[0]=c*d+a*e+b*n-k*h;f[1]=b*d+a*h+k*e-c*n;f[2]=k*d+a*n+c*h-b*e;f[3]=a*d-c*e-b*h-k*n;return f};c.str=function(a){return"["+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+"]"};g.aabb=e;e.create=function(a,d){var f=new Float32Array(6);a?(f[0]=a[0],f[1]=a[1],f[2]=a[2],6===a.length?(f[3]=
  a[3],f[4]=a[4],f[5]=a[5]):d?(f[3]=d[0],f[4]=d[1],f[5]=d[2]):(f[3]=f[0],f[4]=f[1],f[5]=f[2])):(f[0]=Number.MAX_VALUE,f[1]=Number.MAX_VALUE,f[2]=Number.MAX_VALUE,f[3]=-Number.MAX_VALUE,f[4]=-Number.MAX_VALUE,f[5]=-Number.MAX_VALUE);return f};e.set=function(a,d){d[0]=a[0];d[1]=a[1];d[2]=a[2];d[3]=a[3];d[4]=a[4];d[5]=a[5];return d};var J=i.create();e.transform=function(a,d,f){var c=Number.MAX_VALUE,k=-Number.MAX_VALUE,h,n;f?e.set([c,c,c,k,k,k],f):f=e.create();for(c=0;2>c;c++)for(k=0;2>k;k++)for(h=0;2>
  h;h++)J[0]=a[3*c],J[1]=a[3*k+1],J[2]=a[3*h+2],n=b.multiplyVec3(d,J),e.addPoint(f,n);return f};e.merge=function(a,d,f){f||(f=a);f[0]=p(a[0],d[0]);f[1]=p(a[1],d[1]);f[2]=p(a[2],d[2]);f[3]=F(a[3],d[3]);f[4]=F(a[4],d[4]);f[5]=F(a[5],d[5]);return f};e.addPoint=function(a,d){var f=d[0],c=d[1],b=d[2];a[0]=p(a[0],f);a[1]=p(a[1],c);a[2]=p(a[2],b);a[3]=F(a[3],f);a[4]=F(a[4],c);a[5]=F(a[5],b);return a};e.center=function(a,d){d||(d=i.create());d[0]=0.5*(a[0]+a[3]);d[1]=0.5*(a[1]+a[4]);d[2]=0.5*(a[2]+a[5]);return d};
  e.halfVec3=function(a,d){d||(d=i.create());d[0]=0.5*(a[3]-a[0]);d[1]=0.5*(a[4]-a[1]);d[2]=0.5*(a[5]-a[2]);return d};e.diagonal=function(a,d){d||(d=i.create());d[0]=a[3]-a[0];d[1]=a[4]-a[1];d[2]=a[5]-a[2];return d};e.str=function(a){return"{("+a[0]+","+a[1]+","+a[2]+"),("+a[3]+","+a[4]+","+a[5]+")}"};g.frustum=h;h.extractPlanes=function(a,d,f){f||(f=new Float32Array(24));var c=a[0],b=a[1],k=a[2],e=a[3],h=a[4],n=a[5],g=a[6],m=a[7],r=a[8],v=a[9],p=a[10],q=a[11],w=a[12],u=a[13],i=a[14],a=a[15];f[0]=e+
  c;f[1]=m+h;f[2]=q+r;f[3]=a+w;f[4]=e-c;f[5]=m-h;f[6]=q-r;f[7]=a-w;f[8]=e-b;f[9]=m-n;f[10]=q-v;f[11]=a-u;f[12]=e+b;f[13]=m+n;f[14]=q+v;f[15]=a+u;f[16]=e+k;f[17]=m+g;f[18]=q+p;f[19]=a+i;f[20]=e-k;f[21]=m-g;f[22]=q-p;f[23]=a-i;if(d)for(d=0;6>d;d++)c=f[4*d],b=f[4*d+1],k=f[4*d+2],c=Math.sqrt(c*c+b*b+k*k),c=1/c,f[4*d]*=c,f[4*d+1]*=c,f[4*d+2]*=c,f[4*d+3]*=c;return f};h.OUTSIDE=0;h.INSIDE=1;h.INTERSECTING=2;var I=i.create(),H=i.create();h.intersectAabb=function(a,d){var f=h.INSIDE,c,b,k,n,g,m,r,v;e.center(d,
  I);e.halfVec3(d,H);k=I[0];n=I[1];g=I[2];m=H[0];r=H[1];v=H[2];for(c=0;6>c;c++){var p=4*c;b=a[p];var q=a[p+1],w=a[p+2],u=a[p+3],p=m*Math.abs(b)+r*Math.abs(q)+v*Math.abs(w);b=k*b+n*q+g*w+u;b=0<b-p?h.INSIDE:0>b+p?h.OUTSIDE:h.INTERSECTING;if(b===h.OUTSIDE)return b;b===h.INTERSECTING&&(f=h.INTERSECTING)}return f}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.core"),l=KICK.namespace("KICK.scene"),i=new ArrayBuffer(4),x=new Uint32Array(i),j=new Uint8Array(i);g.Engine=function(b,c){var e=new g.GLState,h=null,p="string"===typeof b?document.getElementById(b):b,i=["experimental-webgl","webgl"],j=this,y=(new Date).getTime()-16,s=0,z=new g.Time,A=0,m=0,n=1,C=[],k=[],r,q=new g.Project(this),w=null,u=null,E,D={updateAndRender:function(){}},G={},v=function(a){j._gameLoop(a)},J=KICK.math.vec2;Object.defineProperties(this,{version:{value:"0.4.2"},
  resourceLoader:{value:new g.ResourceLoader(this)},project:{value:q},glState:{get:function(){return e}},gl:{get:function(){return h}},canvas:{value:p},activeScene:{get:function(){return E===D?null:E},set:function(a){E=null===a||"undefined"===typeof a?D:a}},mouseInput:{get:function(){w||(w=new g.MouseInput(j),this.addFrameListener(w));return w}},keyInput:{get:function(){u||(u=new g.KeyInput,this.addFrameListener(u));return u}},eventQueue:{get:function(){return r}},time:{value:z},config:{value:new g.Config(c||
  {})},paused:{get:function(){return null===G},set:function(a){a!==j.paused&&(a?(cancelRequestAnimFrame(G),G=null):(y=(new Date).getTime()-16,G=requestAnimationFrame(v,j.canvas)))}}});this.isFullScreenSupported=function(){return p.requestFullscreen||p.webkitRequestFullScreen||p.mozRequestFullScreen};this.setFullscreen=function(a){j.isFullScreenSupported()&&(a?p.requestFullscreen?p.requestFullscreen():p.webkitRequestFullScreen?(p.onwebkitfullscreenchange=function(){document.webkitIsFullScreen?(p.originalWidth=
  p.width,p.originalHeight=p.height,p.width=screen.width,p.height=screen.height):(p.width=p.originalWidth,p.height=p.originalHeight);j.canvasResized()},p.webkitRequestFullScreen(Element.ALLOW_KEYBOARD_INPUT)):p.mozRequestFullScreen&&p.mozRequestFullScreen():document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitCancelFullScreen&&document.webkitCancelFullScreen())};this._gameLoop=function(a){s=a-y;y=a;s*=n;A+=s;m+=1;r.run();
  E.updateAndRender();for(a=k.length-1;0<=a;a--)k[a].frameUpdated();null!==G&&(G=requestAnimationFrame(v,j.canvas))};this.addFrameListener=function(a){k.push(a)};this.removeFrameListener=function(a){return g.Util.removeElementFromArray(k,a)};this.addContextListener=function(a){C.push(a)};this.removeContextListener=function(a){return g.Util.removeElementFromArray(C,a)};this.createUID=function(){return++q.maxUID};this.getUID=function(a){a.uid||(a.uid=j.createUID());return a.uid};this.canvasResized=function(){e.viewportSize=
  J.create([p.width,p.height]);w&&w.updateCanvasElementPosition()};var I,H,a=function(){if(j.config.highDPISupport){var a=window.devicePixelRatio||1;p.width=p.clientWidth*a;p.height=p.clientHeight*a}for(I=i.length-1;0<=I;I--)try{if(h=p.getContext(i[I],j.config))break}catch(f){alert(f)}if(!h)return!1;j.config.enableDebugContext&&(window.WebGLDebugUtils?h=window.WebGLDebugUtils.makeDebugContext(h,void 0,function(a,d){var f;for(f=0;f<d.length;++f)void 0===d[f]&&console.error("undefined passed to gl."+
  a+"("+window.WebGLDebugUtils.glFunctionArgsToString(a,d)+")")}):console.log("webgl-debug.js not included - cannot find WebGLDebugUtils"));Object.freeze(h);h.enable(2929);h.enable(3089);return!0};a()?(p.addEventListener("webglcontextlost",function(a){H=j.paused;j.paused=!0;for(I=0;I<C.length;I++)C[I].contextLost();a.preventDefault();h=null},!1),p.addEventListener("webglcontextrestored",function(d){e.clear();j.canvasResized();a();for(I=0;I<C.length;I++)C[I].contextRestored(h);H||(j.paused=!1);d.preventDefault()},
  !1),j.canvasResized(),j.config.checkCanvasResizeInterval&&setInterval(function(){(p.height!==e.viewportSize[0]||p.width!==e.viewportSize[1])&&j.canvasResized()},j.config.checkCanvasResizeInterval),Object.defineProperties(z,{time:{get:function(){return A}},deltaTime:{get:function(){return s}},frame:{get:function(){return m}},scale:{get:function(){return n},set:function(a){n=a}}}),Object.freeze(z),E=new l.Scene(j),r=new g.EventQueue(j),m=A=0,j._gameLoop(y)):j.config.webglNotFoundFn(p)};g.GLState=function(){var b=
  this;this.viewportSize=this.polygonOffsetEnabled=this.blendKey=this.depthMaskCache=this.zTest=this.faceCulling=this.currentMaterial=this.boundShader=this.renderTarget=this.meshShader=this.meshBuffer=this.currentClearColor=null;this.clear=function(){for(var c in b)b.hasOwnProperty(c)&&"clear"!==c&&(b[c]=null)}};g.EventQueue=function(b){var c=[],e=function(c,b){return c.timeStart-b.timeStart},h=b.time;this.add=function(b,j,i){var l=h.time+1,b={task:b,timeStart:j+l,timeEnd:(i||j)+l};g.Util.insertSorted(b,
  c,e);return b};this.cancel=function(b){g.Util.removeElementFromArray(c,b)};this.run=function(){var b,e=h.time,g=c.length,j;for(b=0;b<g&&(j=c[b]).timeStart<e;b++)j.task(),j.timeEnd<e&&(c.splice(b,1),g--)};this.clear=function(){c=[]}};g.ResourceTracker=function(b){var c=this;this.resourceReady=function(){b.removeResourceTracker(c)};this.resourceFailed=function(){b.removeResourceTracker(c)}};g.ProjectAsset=function(b){var c=0;Object.defineProperty(b,"uid",{get:function(){return c},set:function(b){c=
  b}})};g.Project=function(b){var c={},e={},h=this,p=0,j=[],i=[],l=function(){var c;for(c=0;c<i.length;c++)i[c].resourceTrackerChanged()},s=function(b,h){if(c[b]instanceof g.ResourceDescriptor){var p=e[b];p&&c[b].updateConfig(p,h)}},z=function(c){var b=c.split("/");2<b.length?(b=b[b.length-2],b=b.substring(0,1).toUpperCase()+b.substring(1)):b=c;return b},A=function(c){var h=g.Project,p,k;if(c<=h.ENGINE_SHADER_DEFAULT&&c>=h.ENGINE_SHADER_UNLIT_VERTEX_COLOR){switch(c){case h.ENGINE_SHADER_DEFAULT:k="kickjs://shader/default/";
  break;case h.ENGINE_SHADER_SPECULAR:k="kickjs://shader/specular/";break;case h.ENGINE_SHADER_DIFFUSE:k="kickjs://shader/diffuse/";break;case h.ENGINE_SHADER_UNLIT:k="kickjs://shader/unlit/";break;case h.ENGINE_SHADER_UNLIT_VERTEX_COLOR:k="kickjs://shader/unlit_vertex_color/";break;case h.ENGINE_SHADER_TRANSPARENT_SPECULAR:k="kickjs://shader/transparent_specular/";break;case h.ENGINE_SHADER_TRANSPARENT_DIFFUSE:k="kickjs://shader/transparent_diffuse/";break;case h.ENGINE_SHADER_TRANSPARENT_UNLIT:k=
  "kickjs://shader/transparent_unlit/";break;case h.ENGINE_SHADER___SHADOWMAP:k="kickjs://shader/__shadowmap/";break;case h.ENGINE_SHADER___PICK:k="kickjs://shader/__pick/";break;case h.ENGINE_SHADER___ERROR:k="kickjs://shader/__error/";break;default:return null}p=new KICK.material.Shader(b,{dataURI:k,name:z(k),uid:c})}else if(c<=h.ENGINE_TEXTURE_BLACK&&c>=h.ENGINE_TEXTURE_CUBEMAP_WHITE){p=c===h.ENGINE_TEXTURE_CUBEMAP_WHITE;switch(c){case h.ENGINE_TEXTURE_BLACK:k="kickjs://texture/black/";break;case h.ENGINE_TEXTURE_WHITE:k=
  "kickjs://texture/white/";break;case h.ENGINE_TEXTURE_GRAY:k="kickjs://texture/gray/";break;case h.ENGINE_TEXTURE_LOGO:k="kickjs://texture/logo/";break;case h.ENGINE_TEXTURE_CUBEMAP_WHITE:break;default:return null}p?(p=new KICK.texture.Texture(b,{name:"cubemap_white",minFilter:9728,magFilter:9728,generateMipmaps:!1,uid:c,textureType:34067}),h=document.createElement("canvas"),h.width=12,h.height=2,k=h.getContext("2d"),k.fillStyle="rgb(255,255,255)",k.fillRect(0,0,12,2),p.setImage(h,"memory://cubemap_white/")):
  p=new KICK.texture.Texture(b,{name:z(k),minFilter:9728,magFilter:9728,generateMipmaps:!1,uid:c,textureType:3553,dataURI:k})}else if(c<=h.ENGINE_MESH_TRIANGLE&&c>=h.ENGINE_MESH_CUBE){switch(c){case h.ENGINE_MESH_TRIANGLE:k="kickjs://mesh/triangle/";break;case h.ENGINE_MESH_PLANE:k="kickjs://mesh/plane/";break;case h.ENGINE_MESH_UVSPHERE:k="kickjs://mesh/uvsphere/";break;case h.ENGINE_MESH_CUBE:k="kickjs://mesh/cube/";break;default:return null}p=new KICK.mesh.Mesh(b,{dataURI:k,name:z(k),uid:c})}else c<=
  h.ENGINE_MATERIAL_DEFAULT&&(p=A(h.ENGINE_SHADER_UNLIT),p=new KICK.material.Material(b,{shader:p,name:"Default material"}));return e[c]=p};g.Util.copyStaticPropertiesToObject(h,g.Project);Object.defineProperties(this,{maxUID:{get:function(){return p},set:function(c){p=c}},resourceDescriptorUIDs:{get:function(){var b=[],h;for(h in c)c.hasOwnProperty(h)&&b.push(h);return b}}});this.newProject=function(){h.loadProject({maxUID:0,resourceDescriptors:[]})};this.loadProjectByURL=function(c,b,e){var k=function(){},
  g,b=b||k,e=e||k;g=new XMLHttpRequest;g.open("GET",c,!0);g.onreadystatechange=function(){if(4===g.readyState)if(200===g.status){var c=JSON.parse(g.responseText);try{h.loadProject(c,b,e)}catch(k){debugger;e(k)}}else e()};g.send(null)};this.createResourceTracker=function(){var c=new KICK.core.ResourceTracker(h);j.push(c);l();return c};this.removeResourceTracker=function(c){KICK.core.Util.removeElementFromArray(j,c)&&l()};this.loadProject=function(e,n,C){0<p&&h.closeProject();var e=e||{},k=e.resourceDescriptors||
  [],r,q,w,u;p=e.maxUID||0;for(r=0;r<k.length;r++)h.addResourceDescriptor(k[r]);for(q in c)if(c.hasOwnProperty(q))try{h.load(q)}catch(s){C?C(s):g.Util.warn(s)}w=function(){p=e.maxUID||0;b.activeScene=e.activeScene?h.load(e.activeScene):null;n&&n()};u={resourceTrackerChanged:function(){0===j.length&&(KICK.core.Util.removeElementFromArray(i,u),w())}};i.push(u);l()};this.closeProject=function(){for(var b in c)c.hasOwnProperty(b)&&h.removeResourceDescriptor(b);c={};e={}};this.load=function(h){var g=e[h];
  return g?g:(g=c[h])?(g=g.instantiate(b),e[h]=g):A(h)};this.removeCacheReference=function(c){e[c]&&delete e[c]};this.loadByName=function(b,e){var g,k;for(g in c)if(c.hasOwnProperty(g)&&(k=c[g],k.name===b&&(!e||k.type===e)))return h.load(k.uid);return null};this.registerObject=function(h,n){var p=b.getUID(h);e[p]||(e[p]=h,c[p]||(c[p]=new g.ResourceDescriptor({uid:p,type:n,config:{name:h.name}})))};this.refreshResourceDescriptors=function(b){var h,b=b||function(){return!0};for(h in c)c.hasOwnProperty(h)&&
  s(h,b)};this.getEngineResourceDescriptorsByType=function(c){var b=[],h,k,e;"KICK.mesh.Mesh"===c?h="ENGINE_MESH_":"KICK.material.Shader"===c?h="ENGINE_SHADER_":"KICK.texture.Texture"===c&&(h="ENGINE_TEXTURE_");if(h)for(k in g.Project)"number"===typeof g.Project[k]&&(g.Project.hasOwnProperty(k)&&0===k.indexOf(h))&&(e=g.Project[k],k=g.Util.toCamelCase(k.substr(h.length)," "),b.push(new g.ResourceDescriptor({type:c,config:{name:k,uid:e}})));return b};this.getResourceDescriptorsByType=function(b){var h=
  [],e;for(e in c)c.hasOwnProperty(e)&&c[e].type===b&&h.push(c[e]);return h};this.getResourceDescriptorsByName=function(b){var h=[],e;for(e in c)c.hasOwnProperty(e)&&c[e].name===b&&h.push(c[e]);return h};this.getResourceDescriptor=function(b){s(b);return c[b]};this.addResourceDescriptor=function(b){b instanceof g.ResourceDescriptor||(b=new g.ResourceDescriptor(b));return c[b.uid]=b};this.removeResourceDescriptor=function(b){var h=e[b];h&&(delete e[b],h.destroy&&h.destroy());delete c[b]};this.toJSON=
  function(e){var n=[],j,k,e=e||function(){return!0};h.refreshResourceDescriptors(e);for(j in c)c.hasOwnProperty(j)&&0<=j&&(k=c[j],k instanceof g.ResourceDescriptor&&e(k)&&n.push(k.toJSON(e)));return{engineVersion:b.version,maxUID:p,activeScene:b.activeScene?b.activeScene.uid:0,resourceDescriptors:n}}};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.Project.ENGINE_MATERIAL_DEFAULT=-400;g.ResourceDescriptor=function(b){var b=b||{},c=b.type,e=b.uid,h=b.config,p=g.Util.hasProperty;Object.defineProperties(this,{name:{get:function(){return h.name},set:function(c){h.name=c}},type:{value:c},config:{get:function(){return h}},uid:{value:e}});this.updateConfig=function(c,b){h=c.toJSON?c.toJSON(b):c};this.instantiate=function(b){var g=KICK.namespace(c),j=h,i={},l,A,m,n;for(l in j)p(j,
  l)&&(m=(A=j[l])?A.reftype:null,n=A?A.ref:null,A&&(n&&m)&&("resource"===m?A=b.resourceLoader[A.refMethod](n):"project"===m&&(A=b.project.load(n))),i[l]=A);i.uid=e;b=new g(b,i);"function"===typeof b.init&&b.init();return b};this.toJSON=function(){return{type:c,uid:e,config:h}}};g.Config=function(b){this.highDPISupport=b.highDPISupport||!0;this.shadows=b.shadows||!1;this.shadowDistance=b.shadowDistance||20;this.shadowNearMultiplier=b.shadowNearMultiplier||2;this.shadowMapQuality=b.shadowMapQuality||
  1;this.maxNumerOfLights="number"===typeof b.maxNumerOfLights?b.maxNumerOfLights:1;this.enableDebugContext="boolean"===typeof b.enableDebugContext?b.enableDebugContext:!1;this.preserveDrawingBuffer=b.preserveDrawingBuffer||!1;this.alpha="boolean"===typeof b.alpha?b.alpha:!0;this.depth="boolean"===typeof b.depth?b.depth:!0;this.stencil="boolean"===typeof b.stencil?b.stencil:!1;this.antialias="boolean"===typeof b.antialias?b.antialias:!0;this.premultipliedAlpha="boolean"===typeof b.premultipliedAlpha?
  b.premultipliedAlpha:!0;this.checkCanvasResizeInterval=b.checkCanvasResizeInterval||0;this.webglNotFoundFn=b.webglNotFoundFn?"string"===typeof b.webglNotFoundFn?KICK.namespace(b.webglNotFoundFn):b.webglNotFoundFn:function(c){var b;c.innerHTML="";b=document.createElement("div");b.style.cssText=c.style.cssText+";width:"+c.width+"px;height:"+c.height+"px;display: table-cell;vertical-align: middle;background:#ffeeee;";b.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(b,c)}};g.Time=function(){this.scale=this.frame=this.deltaTime=this.time=0};g.MouseInput=function(b){var c=KICK.math.vec2,e=[],h=[],p=[],j=c.create(),i=c.create(),l=null,s=c.create(),z=c.create(),A=!1,m=b.canvas,n=b.config.highDPISupport?window.devicePixelRatio||1:1,C=g.Util.removeElementFromArray,k=g.Util.contains,r=!0,q=!0,w=document.body,u=-1!==navigator.userAgent.indexOf("Firefox"),E=-1!==navigator.userAgent.indexOf("Chrome"),D=function(b){j[0]=(b.clientX-s[0]+w.scrollLeft)*
  n;j[1]=(b.clientY-s[1]+w.scrollTop)*n;l?c.subtract(j,i,l):l=c.create();c.set(j,i)},G=function(b){E?(z[0]+=b.wheelDeltaX,z[1]+=b.wheelDeltaY):1===b.axis?z[0]-=b.detail:z[1]-=b.detail;if(A)return b.preventDefault(),!1},v=function(b){b=b.button;h.push(b);C(e,b);r||D()},J=function(){var b;if(q)for(b=e.length-1;0<=b;b--)v({button:e[b]})},I=function(){for(var b=m,a=0,d=0;b.offsetParent;)a+=b.offsetLeft,d+=b.offsetTop,b=b.offsetParent;a+=b.offsetLeft;d+=b.offsetTop;s[0]=a;s[1]=d};Object.defineProperties(this,
  {mousePosition:{get:function(){return j}},deltaMovement:{get:function(){return l||c.create()}},deltaWheel:{get:function(){return z}},mouseWheelPreventDefaultAction:{get:function(){return A},set:function(b){A=b}},releaseMouseButtonOnMouseOut:{get:function(){return q},set:function(b){b!==q&&((q=b)?m.addEventListener("mouseout",J,!1):m.removeEventListener("mouseout",J,!1))}},mouseMovementEventsEnabled:{get:function(){return r},set:function(b){r!==b&&((r=b)?m.addEventListener("mousemove",D,!1):(m.removeEventListener("mousemove",
  D,!1),l=null))}}});this.isButtonDown=function(b){return k(p,b)};this.isButtonUp=function(b){return k(h,b)};this.isButton=function(b){return k(e,b)};this.frameUpdated=function(){p.length=0;h.length=0;z[0]=0;z[1]=0;l&&(l[0]=0,l[1]=0)};this.updateCanvasElementPosition=I;I();b=b.canvas;b.addEventListener("mousedown",function(b){b=b.button;k(e,b)||(p.push(b),e.push(b));r||D()},!0);b.addEventListener("mouseup",v,!0);b.addEventListener("mousemove",D,!0);b.addEventListener("mouseout",J,!0);b.addEventListener("contextmenu",
  function(b){b.preventDefault();return!1},!0);u?b.addEventListener("MozMousePixelScroll",G,!0):E?b.addEventListener("mousewheel",G,!0):b.addEventListener("DOMMouseScroll",G,!0)};g.KeyInput=function(){var b=[],c=[],e=[],h=g.Util.removeElementFromArray,p=g.Util.contains;this.isKeyDown=function(c){return p(b,c)};this.isKeyUp=function(b){return p(c,b)};this.isKey=function(b){return p(e,b)};this.frameUpdated=function(){b.length=0;c.length=0};document.addEventListener("keydown",function(c){c=c.keyCode;p(e,
  c)||(b.push(c),e.push(c))},!1);document.addEventListener("keyup",function(b){b=b.keyCode;c.push(b);h(e,b)},!1)};g.Util={deserializeConfig:function(b,c,e){var h;if("number"===typeof b)return b;if(Array.isArray(b)){var p=Array(b.length);for(h=0;h<b.length;h++)p[h]=g.Util.deserializeConfig(b[h],c,e);b=p}else if(b&&b&&b.ref&&b.reftype)if("project"===b.reftype)b=c.project.load(b.ref);else if("gameobject"===b.reftype||"component"===b.reftype)b=e.getObjectByUID(b.ref);return b},deepCopy:function(b,c){var e;
  e=!1;var h,c=c||[];for(h=0;h<c.length;h++)if(b instanceof c[h]){e=!0;break}h=typeof b;if(e)e=b;else if(null===b||"undefined"===typeof b)e=null;else if(Array.isArray(b)||b.buffer instanceof ArrayBuffer){e=[];for(h=0;h<b.length;h++)e[h]=g.Util.deepCopy(b[h],c)}else if("object"===h){e={};for(var p in b)b.hasOwnProperty(p)&&(e[p]=g.Util.deepCopy(b[p],c))}else e=b;return e},copyStaticPropertiesToObject:function(b,c){for(var e in c)c.hasOwnProperty(e)&&Object.defineProperty(b,e,{value:c[e]})},hasProperty:function(b,
  c){return Object.prototype.hasOwnProperty.call(b,c)},toCamelCase:function(b,c){c||(c="");var e,h=!0,g,j="",i;for(e=0;e<b.length;e++){g=b.charAt(e);if("_"!==g)break;j+=g}for(;e<b.length;e++)g=b.charAt(e),(i="_"===g)&&(g=c),j+=h?g.toUpperCase():g.toLowerCase(),h=i;return j},getJSONReference:function(b,c){if(null===c)return null;var e=c instanceof KICK.scene.GameObject;return!e&&c.gameObject instanceof KICK.scene.GameObject||e?{ref:b.getUID(c),name:"string"===typeof c.name?c.name:"",reftype:e?"gameobject":
  "component"}:{ref:c.uid,name:c.name,reftype:"project"}},componentToJSON:function(b,c,e){var h,p={},j={},e={type:e||c.constructor.name,uid:b.getUID(c),config:p},i;""===e.type&&g.Util.fail("Cannot serialize object type. Either provide toJSON function or use explicit function name 'function SomeObject(){}' ");var l=function(c){var h,e,p;if(Array.isArray(c)){h=[];for(e=0;e<c.length;e++)p=l(c[e]),h.push(p);return h}h=typeof c;return"function"!==h?c&&c.buffer instanceof ArrayBuffer?g.Util.typedArrayToArray(c):
  "object"===h?g.Util.getJSONReference(b,c):c:j};for(h in c)g.Util.hasProperty(c,h)&&"gameObject"!==h&&(i=c[h],i=l(i),i!==j&&(p[h]=i));return e},applyConfig:function(b,c,e){var h=g.Util.contains,p=g.Util.hasProperty,c=c||{},e=e||[],j;for(j in c)"function"!==typeof c[j]&&(!h(e,j)&&p(b,j))&&(b[j]=c[j]);c.uid&&c.uid!==b.uid&&(b.uid=c.uid)},getParameter:function(b,c){var e=RegExp("[\\?&]"+c+"=([^&#]*)").exec(b);return null===e?null:e[1]},getParameterInt:function(b,c,e){b=g.Util.getParameter(b,c);return null===
  b?e:parseInt(b,10)},getParameterFloat:function(b,c,e){b=g.Util.getParameter(b,c);return null===b?e:parseFloat(b)},scaleImage:function(b,c,e){var h=document.createElement("canvas");h.width=c;h.height=e;h.getContext("2d").drawImage(b,0,0,b.width,b.height,0,0,h.width,h.height);return h},warn:function(b){debugger;console.log(b)},fail:function(b){debugger;console.error(b)},typedArrayToArray:function(b){var c=b.length,e=Array(c),h;for(h=0;h<c;h++)e[h]=b[h];return e},removeElementFromArray:function(b,c,
  e){var h=!1,g;for(g=b.length-1;0<=g&&!(b[g]===c&&(h=!0,b.splice(g,1),!e));g--);return h},removeElementsFromArray:function(b,c){var e,h;for(e=b.length-1;0<=e;e--)for(h=c.length-1;0<=h;h--)b[e]===c[h]&&b.splice(e,1)},insertSorted:function(b,c,e){var h;e||(e=g.Util.numberSortFunction);for(h=c.length-1;0<=h;h--)if(0>=e(c[h],b)){c.splice(h+1,0,b);return}c.unshift(b)},numberSortFunction:function(b,c){return b-c},contains:function(b,c){var e;for(e=b.length-1;0<=e;e--)if(b[e]===c)return!0;return!1},uint32ToVec4:function(b,
  c){var e;c||(c=new Float32Array(4));x[0]=b;for(e=0;4>e;e++)c[e]=j[e]/255;return c},vec4ToUint32:function(b){var c;for(c=0;4>c;c++)j[c]=255*b[c];return x[0]},vec4uint8ToUint32:function(b){var c;for(c=0;4>c;c++)j[c]=b[c];return x[0]},utf8Encode:function(b){var c=[],e,h;for(e=0;e<b.length;e++)h=b.charCodeAt(e),127>h?c.push(h):2047>=h?(c.push(192+(h>>6)),c.push(128+(h&63))):65535>=h&&(c.push(224+(h>>12)),c.push(128+(h>>6&63)),c.push(128+(h&63)));return new Uint8Array(c)},removeAllProperties:function(b){for(var c in b)b.hasOwnProperty(c)&&
  delete b[c]},utf8Decode:function(b){var c="",e,h,g,j;for(e=0;e<b.length;e++)h=b[e],0===(h&128)?c+=String.fromCharCode(h):192===(h&224)?(e++,g=b[e],h=(h&31)<<6,g&=63,h+=g,c+=String.fromCharCode(h)):224===(h&240)&&(e++,g=b[e],e++,j=b[e],h=(h&31)<<12,g=(g&63)<<6,j&=63,h=h+g+j,c+=String.fromCharCode(h));return c}};Object.freeze(g.Util);"undefined"===typeof window.requestAnimationFrame&&(window.requestAnimationFrame=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||
  window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(b){return window.setTimeout(b,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(b){alert(b)})})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.core"),l=g.Util.utf8Decode,i=g.Util.utf8Encode,x=new Uint8Array(4);g.ChunkData=function(){var g=function(b,c,e,g){var j=this;this.chunkId=b;this.chunkType=c;this.chunkDataLength=e;this.data=g;Object.defineProperties(this,{paddingSize:{get:function(){var b=j.data.length*j.data.BYTES_PER_ELEMENT%8;return b?8-b:0}},paddingData:{get:function(){return x.subarray(0,j.paddingSize)}}})},b=this,c=[],e=function(b){return 1===b?Float32Array:2===b?Float64Array:3===b?Int16Array:
  4===b?Int32Array:5===b?Int8Array:6===b?Uint16Array:8===b?Uint8Array:null};this.getSize=function(){var b=0,e;for(e=0;e<c.length;e++)b+=c[e].chunkDataLength+8+c[e].paddingSize;b=8+b;e=b%8;0!==e&&(b+=8-e);return b};this.serialize=function(){var h=new ArrayBuffer(b.getSize()),g=0,j=new Uint8Array(h,0),i=new Uint16Array(h,g),l;i[0]=61441;i[1]=1;g+=4;i=new Uint32Array(h,g);i[0]=c.length;g+=4;for(l=0;l<c.length;l++)i=new Uint16Array(h,g),i[0]=c[l].chunkId,i[1]=c[l].chunkType,g+=4,i=new Uint32Array(h,g),
  i[0]=c[l].chunkDataLength,g+=4,i=e(c[l].chunkType),i=new i(h),i.set(c[l].data,g/i.BYTES_PER_ELEMENT),g+=c[l].chunkDataLength,j.set(c[l].paddingData,g),g+=c[l].paddingSize;return h};this.get=function(b){var e;for(e=0;e<c.length;e++)if(c[e].chunkId===b)return c[e].data;return null};this.getString=function(c){return(c=b.get(c))?l(c):null};this.getNumber=function(c){return(c=b.get(c))?c[0]:null};this.getArrayBuffer=function(c){var c=b.get(c),e,g;return c?(e=new ArrayBuffer(c.length*c.BYTES_PER_ELEMENT),
  g=new Uint8Array(e),g.set(c),e):null};this.remove=function(b){var e;for(e=0;e<c.length;e++)if(c[e].chunkId===b)return c=c.splice(e,1),!0;return!1};this.setString=function(c,e){var g=i(e);b.set(c,g)};this.setNumber=function(c,e){var g=new Float32Array([e]);b.set(c,g)};this.setArrayBuffer=function(c,e){b.set(c,new Uint8Array(e))};this.set=function(e,i){b.remove(e);var l=i instanceof Float32Array?1:i instanceof Float64Array?2:i instanceof Int16Array?3:i instanceof Int32Array?4:i instanceof Int8Array?
  5:i instanceof Uint16Array?6:i instanceof Uint8Array?8:null,B;l&&(B=i.length*i.BYTES_PER_ELEMENT,c.push(new g(e,l,B,i)))};this.deserialize=function(b){if(!(b instanceof ArrayBuffer))return!1;var i=[],l=0,B=new Uint16Array(b,l),y,s,z,A,m;if(61441!==B[0]||1!==B[1])return!1;l+=4;y=new Uint32Array(b,l);s=y[0];l+=4;for(z=0;z<s;z++)B=new Uint16Array(b,l),A=B[0],B=B[1],l+=4,y=new Uint32Array(b,l),y=y[0],l+=4,m=e(B),m=new m(b,l,y/m.BYTES_PER_ELEMENT),A=new g(A,B,y,m),i.push(A),l+=y,l+=A.paddingSize;c=i;return!0}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.texture"),l=KICK.namespace("KICK.core"),i=KICK.math.vec2,x=function(b){var c;--b;for(c=1;32>c;c<<=1)b|=b>>c;return b+1},j=KICK.core.Util.applyConfig;g.RenderTexture=function(b,c){KICK.core.ProjectAsset(this);var e=b.gl,h=b.glState,g=e.createFramebuffer(),l=null,B=i.create(),y=[],s=this,z="",A=function(){var b;for(b=0;b<y.length;b++)e.deleteRenderbuffer(y[b])},m=function(){var b;B=l?l.dimension:B;A();e.bindFramebuffer(36160,g);l?e.framebufferTexture2D(36160,36064,
  3553,l.textureId,0):(b=e.createRenderbuffer(),e.bindRenderbuffer(36161,b),e.renderbufferStorage(36161,32854,B[0],B[1]),e.framebufferRenderbuffer(36160,36064,36161,b),y.push(b));b=e.createRenderbuffer();e.bindRenderbuffer(36161,b);e.renderbufferStorage(36161,33189,B[0],B[1]);e.framebufferRenderbuffer(36160,36096,36161,b);y.push(b);e.bindFramebuffer(36160,null)};this.bind=function(){h.renderTarget=s;e.bindFramebuffer(36160,g)};Object.defineProperties(this,{dimension:{get:function(){return B},set:function(b){(B=
  b)&&m()}},colorTexture:{get:function(){return l},set:function(b){(l=b)&&m()}},name:{get:function(){return z},set:function(b){z=b}}});this.destroy=function(){null!==g&&(A(),e.deleteFramebuffer(g),g=null,b.project.removeResourceDescriptor(s.uid))};this.toJSON=function(){return{uid:s.uid,name:z,colorTexture:KICK.core.Util.getJSONReference(b,l)}};j(s,c);b.project.registerObject(s,"KICK.texture.RenderTexture")};g.Texture=function(b,c){KICK.core.ProjectAsset(this);var e=b.gl,h=b.glState,g,F,B=e.createTexture(),
  y="Texture",s=10497,z=10497,A=9729,m=9729,n=!0,C="memory://void",k=!0,r=6408,q=3553,w=null,u=this,E=i.create(),D=function(){null!==w&&w!==q&&(e.deleteTexture(B),B=e.createTexture());w=q},G={contextLost:function(){console.log("_textureId ",B,e);e=null},contextRestored:function(b){var c=e!==b;e=b;B=e.createTexture();console.log("_textureId ",B,c);g&&g.apply(u,F)}};this.init=function(){C&&b.resourceLoader.getImageData(C,u)};this.apply=function(){u.bind(0);3553===q&&(e.texParameteri(3553,10242,s),e.texParameteri(3553,
  10243,z));e.texParameteri(q,10240,m);e.texParameteri(q,10241,A)};this.bind=function(b){e.activeTexture(33984+b);e.bindTexture(q,B)};this.destroy=function(){null!==B&&(e.deleteTexture(B),B=null,b.project.removeResourceDescriptor(u.uid));F=g=null;b.removeContextListener(G)};this.setImage=function(b,c){g=u.setImage;F=arguments;var j,m,a,d,f,w,s,G;C=c;D();u.bind(0);if(3553===q){if(0!==(b.width&b.width-1)||0!==(b.height&b.height-1))j=x(b.width),m=x(b.height),b=l.Util.scaleImage(b,j,m);k?e.pixelStorei(37440,
  !0):e.pixelStorei(37440,!1);e.pixelStorei(3317,1);e.texImage2D(3553,0,r,r,5121,b);i.set([b.width,b.height],E)}else{a=[34069,34070,34071,34072,34073,34074];d=b.width/6;f=b.height;j=m=x(b.height);w=document.createElement("canvas");w.width=j;w.height=m;s=w.getContext("2d");for(G=0;6>G;G++)s.drawImage(b,G*d,0,d,f,0,0,j,m),e.pixelStorei(37440,!1),e.pixelStorei(3317,1),e.texImage2D(a[G],0,r,r,5121,w);i.set([j,m],E)}u.apply();n&&e.generateMipmap(q);h.currentMaterial=null};this.isFPTexturesSupported=function(){var b=
  e.isTexFloatEnabled;"boolean"!==typeof b&&(b=e.getExtension("OES_texture_float"),e.isTexFloatEnabled=b);return b};this.setImageData=function(b,c,k,j,a,d){g=u.setImageData;F=arguments;var f;D();5126===j&&!e.isTexFloatEnabled&&(f=u.isFPTexturesSupported(),f||(KICK.core.Util.fail("OES_texture_float unsupported on the platform. Using 5121 instead of 5126."),j=5121));3553!==q?KICK.core.Util.fail("Texture.setImageData only supported by TEXTURE_2D"):(f=r,i.set([b,c],E),C=d,u.bind(0),e.pixelStorei(3317,1),
  e.texImage2D(3553,0,r,b,c,k,f,j,a),e.texParameteri(3553,10240,m),e.texParameteri(3553,10241,A),e.texParameteri(3553,10242,s),e.texParameteri(3553,10243,z),n&&e.generateMipmap(3553),h.currentMaterial=null)};this.setTemporaryTexture=function(){var b=new Uint8Array([255,255,255,0,0,0,0,0,0,255,255,255]),c=r;r=6407;this.setImageData(2,2,0,5121,b,"kickjs://texture/checkerboard/");r=c};this.setDataURI=function(c,e){c!==C&&(C=c,e&&b.resourceLoader.getImageData(C,u))};Object.defineProperties(this,{engine:{value:b},
  textureId:{value:B},name:{get:function(){return y},set:function(b){y=b}},dimension:{get:function(){return E}},dataURI:{get:function(){return C},set:function(b){u.setDataURI(b,!0)}},wrapS:{get:function(){return s},set:function(b){s=b}},wrapT:{get:function(){return z},set:function(b){z=b}},minFilter:{get:function(){return A},set:function(b){A=b}},magFilter:{get:function(){return m},set:function(b){m=b}},generateMipmaps:{get:function(){return n},set:function(b){n=b}},flipY:{get:function(){return k},
  set:function(b){k=b}},internalFormat:{get:function(){return r},set:function(b){6406!==b&&(6407!==b&&6408!==b&&6409!==b&&6410!==b)&&KICK.core.Util.fail("Texture.internalFormat should be either 6406, 6407, 6408, 6409, or LUMINANCE_ALPHA");r=b}},textureType:{get:function(){return q},set:function(b){3553!==b&&34067!==b&&KICK.core.Util.fail("Texture.textureType should be either 3553 or 34067");q=b}}});this.toJSON=function(){return{uid:u.uid,wrapS:s,wrapT:z,minFilter:A,magFilter:m,name:y,generateMipmaps:n,
  flipY:k,internalFormat:r,textureType:q,dataURI:C}};b.addContextListener(G);j(u,c,["dataURI"]);c&&c.dataURI&&(u.dataURI=c.dataURI);b.project.registerObject(u,"KICK.texture.Texture")};g.MovieTexture=function(b,c){KICK.core.ProjectAsset(this);var e=b.gl,h=b.glState,g="MovieTexture",i=null,l=e.createTexture(),y=33071,s=33071,z=9728,A=9728,m=6408,n=0,C=!1,k=b.time,r=this,q=-1;this.bind=function(b){e.activeTexture(33984+b);e.bindTexture(3553,l);q<k.frame&&i&&(q=k.frame+n,e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,
  !0),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,i),C&&e.generateMipmap(3553))};this.destroy=function(){null!==l&&(h.currentMaterial=null,e.deleteTexture(l),l=null,b.project.removeResourceDescriptor(r.uid))};this.setTemporaryTexture=function(){var b=new Uint8Array([255,255,255,0,0,0,0,0,0,255,255,255]);r.bind(0);e.pixelStorei(3317,1);e.texImage2D(3553,0,m,2,2,0,6407,5121,b);e.texParameteri(3553,10240,A);e.texParameteri(3553,10241,z);e.texParameteri(3553,10242,y);e.texParameteri(3553,
  10243,s);h.currentMaterial=null};Object.defineProperties(this,{name:{get:function(){return g},set:function(b){g=b}},skipFrames:{get:function(){return n},set:function(b){n=b}},videoElement:{get:function(){return i},set:function(b){i=b}},generateMipmaps:{get:function(){return C},set:function(b){C=b}},textureId:{value:l},wrapS:{get:function(){return y},set:function(b){y=b}},wrapT:{get:function(){return s},set:function(b){s=b}},minFilter:{get:function(){return z},set:function(b){z=b}},magFilter:{get:function(){return A},
  set:function(b){A=b}},internalFormat:{get:function(){return m},set:function(b){6406!==b&&(6407!==b&&6408!==b&&6409!==b&&6410!==b)&&KICK.core.Util.fail("Texture.internalFormat should be either 6406, 6407, 6408, 6409, or LUMINANCE_ALPHA");m=b}}});this.toJSON=function(){return{uid:r.uid,wrapS:y,wrapT:s,minFilter:z,name:g,magFilter:A,internalFormat:m}};j(r,c);b.project.registerObject(r,"KICK.texture.MovieTexture")}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.scene"),l=KICK.namespace("KICK.core");KICK.namespace("KICK.math");var i=KICK.namespace("KICK.math.vec3"),x=KICK.namespace("KICK.math.quat4"),j=KICK.namespace("KICK.math.vec4"),b=KICK.namespace("KICK.math.mat4"),c=KICK.namespace("KICK.math.aabb"),e=KICK.namespace("KICK.math.frustum"),h=KICK.core.Util.applyConfig,p=KICK.core.Util.insertSorted,F=KICK.core.Util.vec4uint8ToUint32;g.GameObject=function(b,c){var e=new KICK.scene.Transform(this),g=[e],j=1,i,n=b.engine.createUID(),
  p=this;Object.defineProperties(this,{scene:{value:b},engine:{value:b.engine},transform:{value:e},layer:{get:function(){return j},set:function(b){"number"!==typeof b&&KICK.core.Util.fail("GameObject.layer must be a Number");j=b}},name:{get:function(){return i},set:function(b){i=b}},uid:{get:function(){return n},set:function(b){n=b}},numberOfComponents:{get:function(){return g.length}},destroyed:{get:function(){return 0===g.length}}});this.getComponent=function(b){return g[b]};this.addComponent=function(c){if(!(c instanceof
  KICK.scene.Transform)){if(c.gameObject)throw{name:"Error",message:"Component "+c+" already added to gameObject "+c.gameObject};c.scriptPriority||(c.scriptPriority=0);c.gameObject=this;g.push(c);b.addComponent(c)}};this.removeComponent=function(c){try{delete c.gameObject}catch(e){}l.Util.removeElementFromArray(g,c);b.removeComponent(c)};this.notifyComponentUpdated=function(c){b.notifyComponentUpdated(c)};this.destroy=function(){var c;for(c=g.length-1;0<=c;c--)p.removeComponent(g[c]);b.destroyObject(p)};
  this.getComponentOfType=function(b){var c,e;for(e=g.length-1;0<=e;e--)if(c=g[e],c instanceof b)return c;return null};this.getComponentsOfType=function(b){var c,e,h=[];for(e=g.length-1;0<=e;e--)c=g[e],c instanceof b&&h.push(c);return h};this.toJSON=function(){var c=[],e,h;for(h=0;h<g.length;h++)e=g[h],e.toJSON?(e=e.toJSON())&&c.push(e):c.push(KICK.core.Util.componentToJSON(b.engine,e));return{name:i,layer:j,uid:n,components:c}};h(p,c,["uid"])};g.Transform=function(c){var e=b.identity(b.create()),h=
  b.identity(b.create()),g=b.identity(b.create()),j=b.identity(b.create()),m=i.create([0,0,0]),n=i.create([0,0,0]),p=x.create([0,0,0,1]),k=x.create([0,0,0,1]),r=i.create([1,1,1]),q=new Int8Array(6),w=[],u=null,E=this,D=function(){var b;q[2]=1;q[3]=1;q[4]=1;q[5]=1;for(b=w.length-1;0<=b;b--)w[b]._markGlobalDirty()},G=function(){q[0]=1;q[1]=1;D()};Object.defineProperties(this,{gameObject:{value:c},position:{get:function(){if(null===u)return i.create(n);q[4]&&(b.multiplyVec3(E.getGlobalMatrix(),[0,0,0],
  m),q[4]=0);return i.create(m)},set:function(b){var c;null===u?E.localPosition=b:(c=E.position,i.set(b,n),E.localPosition=[n[0]+c[0]-b[0],n[1]+c[1]-b[1],n[2]+c[2]-b[2]],G())}},localPosition:{get:function(){return i.create(n)},set:function(b){i.set(b,n);G()}},localRotationEuler:{get:function(){var b=i.create();x.toEuler(k,b);return b},set:function(b){x.setEuler(b,k);G()}},rotationEuler:{get:function(){var b=i.create();x.toEuler(E.rotation,b);return b},set:function(b){var c=x.create();x.setEuler(b,c);
  this.rotation=c}},rotation:{get:function(){var b=null;if(null===u)return x.create(k);if(q[5]){x.set(k,p);for(b=E.parent;null!==b;)x.multiply(b.localRotation,p,p),b=b.parent;q[5]=!1}return p},set:function(b){if(null===u)this.localRotation=b;else{var c=x.create();x.difference(b,E.rotation,c);this.localRotation=x.multiply(k,c)}}},localRotation:{get:function(){return k},set:function(b){x.set(b,k);G()}},localScale:{get:function(){return i.create(r)},set:function(b){i.set(b,r);for(b=0;b<r.length;b++)0===
  r[b]&&(r[b]=1E-5);G()}},children:{value:w},parent:{get:function(){return u},set:function(b){b===this&&KICK.core.Util.fail("Cannot assign parent to self");b!==u&&(null===b?(u=null,l.Util.removeElementFromArray(b.children,this)):(u=b,b.children.push(this)),D())}}});this.getLocalMatrix=function(){q[0]&&(b.setTRS(n,k,r,e),q[0]=0);return e};this.getLocalTRSInverse=function(){q[1]&&(b.setTRSInverse(n,k,r,g),q[1]=0);return g};this.getGlobalMatrix=function(){if(q[2]){b.set(E.getLocalMatrix(),h);for(var c=
  E.parent;null!==c;)b.multiply(c.getLocalMatrix(),h,h),c=c.parent;q[2]=0}return h};this.getGlobalTRSInverse=function(){if(q[3]){b.set(E.getLocalTRSInverse(),j);for(var c=E.parent;null!==c;)b.multiply(j,c.getLocalTRSInverse(),j),c=c.parent;q[3]=0}return j};this._markGlobalDirty=D;this.toJSON=function(){var b=KICK.core.Util.typedArrayToArray;return{type:"KICK.scene.Transform",uid:c.engine.getUID(E),config:{localPosition:b(n),localRotation:b(k),localScale:b(r),parent:u?KICK.core.Util.getJSONReference(E.gameObject.engine,
  u):null}}};this.str=function(){return JSON.stringify(E.toJSON())}};g.Scene=function(b,c){KICK.core.ProjectAsset(this);var e={},h=[],j=[],i=[],n=[],p=[],k=[],r=[],q=[],w=[],u=[],E=[],D=new KICK.scene.SceneLights(b.config.maxNumerOfLights),G="Scene",v,J=this,I=function(a,b){return a.scriptPriority-b.scriptPriority},H=function(a,b){return b.cameraIndex-a.cameraIndex},a=function(a){a=new g.GameObject(J,a);i.push(a);h.push(a);return e[a.uid]=a};this.notifyComponentUpdated=function(a){for(v=q.length-1;0<=
  v;v--)q[v].componentUpdated(a)};this.destroy=function(){b.project.removeResourceDescriptor(J.uid);J===b.activeScene&&(b.activeScene=null)};this.addComponentListener=function(a){g.ComponentChangedListener.isComponentListener(a)||KICK.core.Util.fail("Component listener does not have the correct interface. It should contain the two functions: componentsAdded(components) and componentsRemoved(components)");a.componentUpdated||(a.componentUpdated=function(){});q.push(a);a.componentsAdded(w)};this.findComponentsOfType=
  function(a){var b=[],d,c,f;for(d=h.length-1;0<=d;d--){f=h[d].getComponentsOfType(a);for(c=0;c<f.length;c++)b.push(f[c])}return b};this.removeComponentListener=function(a){l.Util.removeElementFromArray(q,a)};this.addComponent=function(a){l.Util.insertSorted(a,k,I);var d=b.getUID(a);e[d]=a};this.getObjectByUID=function(a){return e[a]};this.getGameObjectByName=function(a){var b,d;for(b=h.length-1;0<=b;b--)if(d=h[b],d.name===a)return d};this.removeComponent=function(a){l.Util.removeElementFromArray(k,
  a);r.push(a);delete e[a.uid]};Object.defineProperties(this,{engine:{value:b},name:{get:function(){return G},set:function(a){G=a}}});this.createGameObject=function(d){var d=a(d),c=d.transform;e[b.getUID(c)]=c;return d};this.destroyObject=function(a){l.Util.contains(n,a)||(n.push(a),delete e[a.uid]);a.destroyed||a.destroy()};this.getNumberOfGameObjects=function(){return h.length};this.getGameObject=function(a){return h[a]};this.updateAndRender=function(){var a,d,c;0<n.length&&(l.Util.removeElementsFromArray(j,
  n),l.Util.removeElementsFromArray(h,n),n.length=0);if(0<r.length){c=r;r=[];for(a=c.length-1;0<=a;a--)d=c[a],l.Util.removeElementFromArray(w,d),"function"===typeof d.deactivated&&d.deactivated(),"function"===typeof d.update&&l.Util.removeElementFromArray(p,d),d instanceof g.Camera?l.Util.removeElementFromArray(u,d):d instanceof g.Light&&(1===d.type?D.ambientLight=null:2===d.type?D.directionalLight=null:D.removePointLight(d));for(a=q.length-1;0<=a;a--)q[a].componentsRemoved(c)}0<i.length&&(j=j.concat(i),
  i.length=0);if(0<k.length){c=k;k=[];for(a=c.length-1;0<=a;a--)d=c[a],w.push(d),"function"===typeof d.activated&&d.activated(),"function"===typeof d.update&&l.Util.insertSorted(d,p,I),"function"===typeof d.render&&E.push(d),"function"===typeof d.render&&l.Util.removeElementFromArray(E,d),d instanceof g.Camera?KICK.core.Util.insertSorted(d,u,H):d instanceof g.Light&&(1===d.type?D.ambientLight=d:2===d.type?D.directionalLight=d:D.addPointLight(d));for(a=q.length-1;0<=a;a--)q[a].componentsAdded(c)}for(a=
  p.length-1;0<=a;a--)p[a].update();for(a=u.length-1;0<=a;a--)u[a].renderScene(D);b.gl.flush()};this.toJSON=function(a){var b=[],d,c,a=a||function(){return!0};for(d=0;d<h.length;d++)c=h[d],a(c)&&b.push(c.toJSON());return{uid:J.uid,gameObjects:b,name:G}};var d,f=KICK.core.Util.hasProperty,t=KICK.core.Util.applyConfig,x;if(c){var G=c.name||"Scene",F=c.gameObjects||[],M={},L=[],N={};for(x=0;x<F.length;x++)d=c.gameObjects[x],L[x]=a(d),M[d.uid]=L[x];var K,P=c.gameObjects||[],O,R,Q;for(O=0;O<P.length;O++){F=
  c.gameObjects[O];d=L[O];for(R=0;F.components&&R<F.components.length;R++){x=F.components[R];if("KICK.scene.Transform"===x.type)K=d.transform,K.uid=x.uid,e[K.uid]=K;else if(K=KICK.namespace(x.type),"function"===typeof K)K=new K({uid:x.uid}),K.uid=x.uid,d.addComponent(K);else{KICK.core.Util.warn("Cannot find Class "+x.type);continue}M[x.uid]=K;N[x.uid]=x.config}}for(Q in M)if(M.hasOwnProperty(Q)&&f(M,Q)&&(d=N[Q])){L={};F=x=void 0;for(x in d)d.hasOwnProperty(x)&&f(d,x)&&(F=d[x],F=KICK.core.Util.deserializeConfig(F,
  b,J),L[x]=F);d=L;L=M[Q];t(L,d)}}b.project.registerObject(J,"KICK.scene.Scene")};g.Scene.createDefault=function(b){b=new g.Scene(b);b.createGameObject().addComponent(new g.Camera);return b};g.Camera=function(g){var y,s,z=this,A,m,n=!0,C=!1,k=null,r=60,q=0.1,w=1E3,u=-1,E=1,D=-1,G=1,v=[0,0,0,1],J=!0,I=!0,H=!0,a=null,d,f=1,t=4294967295,fa,Y,M=null,L=null,N=null,K=j.create(),P=b.create(),O=b.create(),R=b.create(),Q=b.create(),S={viewMatrix:O,projectionMatrix:P,viewProjectionMatrix:R,lightMatrix:Q,currentCamera:z,
  currentCameraTransform:null},V=!1,W={contextLost:function(){y=null},contextRestored:function(a){y=a}},U=[],T=[],$=[],ga=[U,T,$],X=j.create([0,0,1,1]),ja=b.create([0.5,0,0,0,0,0.5,0,0,0,0,0.5,0,0.5,0.5,0.5,1]),aa,ba,ca=function(){d=(I?16384:0)|(H?256:0)},da=function(a){s.currentClearColor!==a&&(s.currentClearColor=a,y.clearColor(a[0],a[1],a[2],a[3]))},ka=function(a,b){var d=a.renderOrder||1E3,c=b.renderOrder||1E3,f,e=function(a,b){var d=["material","shader","uid"],c;for(c=0;c<d.length;c++)if(a=a[d[c]],
  !a)return b;return a};f=function(a,b){return a.mesh.uid||b};d===c&&(a.material&&b.material)&&(d=e(a,d),c=e(b,d));d===c&&(a.mesh&&b.mesh)&&(d=f(a,d),c=f(b,d));return d-c},Z,ha=KICK.math.aabb.create(),ia=new Float32Array(24);Z=function(a,b){var d=function(a){var d=a.length,f,h;for(f=0;f<d;f++){h=a[f];var g;g=h.aabb;var k=h.gameObject;g&&k?(c.transform(g,k.transform.getGlobalMatrix(),ha),g=e.intersectAabb(ia,ha)===e.OUTSIDE):g=!1;g||h.render(S,b)}};e.extractPlanes(S.viewProjectionMatrix,!1,ia);S.sceneLights=
  a;d(U);d(T);d($)};var ea={componentsAdded:function(a){var b,d,c;for(b=a.length-1;0<=b;b--)d=a[b],"function"===typeof d.render&&d.gameObject.layer&t&&(c=d.renderOrder||1E3,c=2E3>c?U:3E3<=c?$:T,KICK.core.Util.contains(c,d)||p(d,c,ka))},componentsRemoved:function(a){var b=!1,d,c,f;for(d=a.length-1;0<=d;d--)if(f=a[d],"function"===typeof f.render)for(c=ga.length-1;0<=c;c--)b|=l.Util.removeElementFromArray(ga[c],f);return b},componentUpdated:function(a){a=[a];ea.componentsRemoved(a)&&ea.componentsAdded(a)}};
  this.pick=function(a,b,d,c,f){c=c||1;f=f||1;M||(M=[],L=new KICK.material.Material(m,{shader:m.project.load(m.project.ENGINE_SHADER___PICK),name:"Picking material"}),N=new KICK.texture.RenderTexture(m,{dimension:s.viewportSize}),N.name="__pickRenderTexture");M.push({gameObjectPickedFn:a,x:b,y:s.viewportSize[1]-d,width:c,height:f})};this.activated=function(){var a=this.gameObject,d;S.currentCameraTransform=a.transform;m=a.engine;V||(V=!0,m.addContextListener(W));A=a.transform;y=m.gl;s=m.glState;Y=a.scene;
  Y.addComponentListener(ea);m.config.shadows?(a={name:"Shadow map material",shader:m.project.load(m.project.ENGINE_SHADER___SHADOWMAP)},fa=new KICK.material.Material(m,a),ba=0.5*m.config.shadowDistance,a=1.55377397403004*ba,d=-a*m.config.shadowNearMultiplier,aa=b.create(),b.ortho(-a,a,-a,a,d,a,aa)):C&&(C=!1)};this.deactivated=function(){Y.removeComponentListener(z)};this.renderScene=function(c){var f,e;if(n){if(C&&c.directionalLight&&c.directionalLight.shadow){s.currentMaterial=null;var h=c.directionalLight;
  e=h.gameObject.transform;var h=h.shadowRenderTexture,g=h.dimension,j=g[0],g=g[1];y.viewport(0,0,j,g);y.scissor(0,0,j,g);h.bind();da([1,1,1,1]);y.clear(16640);b.set(aa,P);h=x.multiplyVec3(A.rotation,[0,0,-ba]);h=i.add(h,A.position);h[0]=Math.round(h[0]);h[1]=Math.round(h[1]);h[2]=Math.round(h[2]);b.setTRSInverse(h,e.localRotation,[1,1,1],O);b.multiply(P,O,R);b.multiply(b.multiply(ja,P,Q),O,Q);Z(c,fa)}e=k?k.dimension:s.viewportSize;j=e[0];g=e[1];e=j*X[0];h=g*X[1];j*=X[2];g*=X[3];y.viewport(e,h,j,g);
  y.scissor(e,h,j,g);s.currentMaterial=null;s.renderTarget!==k&&(k?k.bind():y.bindFramebuffer(36160,null),s.renderTarget=k);da(v);y.clear(d);J?b.perspective(r,s.viewportSize[0]/s.viewportSize[1],q,w,P):b.ortho(u,E,D,G,q,w,P);e=A.getGlobalTRSInverse();b.set(e,O);b.multiply(P,O,R);c.recomputeLight(O);if(0<T.length){e=i.create();for(var h=A.position,l,j=T.length-1;0<=j;j--)g=T[j],l=g.gameObject.transform.position,g.distanceToCamera=i.lengthSqr(i.subtract(l,h,e));T.sort(function(a,b){return b.distanceToCamera-
  a.distanceToCamera})}Z(c,a);k&&(k.colorTexture&&k.colorTexture.generateMipmaps)&&(e=k.colorTexture.textureId,y.bindTexture(y.TEXTURE_2D,e),y.generateMipmap(y.TEXTURE_2D));if(M&&0<M.length){s.currentMaterial=null;N.bind();da(K);y.clear(16640);Z(c,L);for(f=M.length-1;0<=f;f--)(function(){var a=M[f],b=4*a.width*a.width,d=new Uint8Array(b),c=[],e={},h,g,k;y.readPixels(a.x,a.y,a.width,a.height,6408,5121,d);for(h=0;h<b;h+=4)if(g=d.subarray(h,h+4),g=F(g),0<g)if(e[g])e[g]++;else if(k=Y.getObjectByUID(g))c.push(k),
  e[g]=1;c.length&&m.eventQueue.add(function(){var b,d;for(b=0;b<c.length;b++)d=c[b],a.gameObjectPickedFn(d,e[d.uid])},0)})();M.length=0}}};Object.defineProperties(this,{replacementShader:{get:function(){KICK.core.Util.fail("KICK.scene.Camera.replacementShader is replaced with KICK.scene.Camera.replacementShader replacementMaterial")},set:function(){KICK.core.Util.fail("KICK.scene.Camera.replacementShader is replaced with KICK.scene.Camera.replacementShader replacementMaterial")}},replacementMaterial:{get:function(){return a},
  set:function(b){a=b}},enabled:{get:function(){return n},set:function(a){n=a}},renderShadow:{get:function(){return C},set:function(a){m?m.config.shadows&&(C=a):C=a}},layerMask:{get:function(){return t},set:function(a){t=a}},renderTarget:{get:function(){return k},set:function(a){k=a}},fieldOfView:{get:function(){return r},set:function(a){r=Math.min(179,Math.max(a,1))}},near:{get:function(){return q},set:function(a){q=a}},far:{get:function(){return w},set:function(a){w=a}},perspective:{get:function(){return J},
  set:function(a){J=a}},left:{get:function(){return u},set:function(a){u=a}},right:{get:function(){return E},set:function(a){E=a}},bottom:{get:function(){return D},set:function(a){D=a}},top:{get:function(){return G},set:function(a){G=a}},cameraIndex:{get:function(){return f},set:function(a){f=a}},clearColor:{get:function(){return j.create(v)},set:function(a){v=j.create(a)}},clearFlagColor:{get:function(){return I},set:function(a){ca();I=a}},clearFlagDepth:{get:function(){return H},set:function(a){ca();
  H=a}},normalizedViewportRect:{get:function(){return X},set:function(a){j.set(a,X)}}});this.destroy=function(){V&&(V=!1,m.removeContextListener(W))};this.toJSON=function(){return{type:"KICK.scene.Camera",uid:z.uid||(m?m.getUID(z):0),config:{enabled:n,renderShadow:C,layerMask:t,renderTarget:KICK.core.Util.getJSONReference(m,k),fieldOfView:r,near:q,far:w,perspective:J,left:u,right:E,bottom:D,top:G,cameraIndex:f,clearColor:KICK.core.Util.typedArrayToArray(v),clearFlagColor:I,clearFlagDepth:H,normalizedViewportRect:KICK.core.Util.typedArrayToArray(X)}}};
  h(this,g);ca()};g.Camera.prototype.setupClearFlags=function(b,c){this.clearColor=b;this.clearDepth=c;delete this._currentClearFlags};g.ComponentChangedListener={isComponentListener:function(b){return b&&"function"===typeof b.componentsAdded&&"function"===typeof b.componentsRemoved}};g.MeshRenderer=function(b){var c,e=[],g,j,i=this;this.activated=function(){c=i.gameObject.transform;if(0===e.length){var b=i.gameObject.engine.project;i.material=b.load(b.ENGINE_MATERIAL_DEFAULT)}};Object.defineProperties(this,
  {aabb:{get:function(){return g.aabb}},renderOrder:{get:function(){return j}},material:{get:function(){return 0===e.length?null:e[0]},set:function(b){e[0]=b;j=e[0].renderOrder;i.gameObject&&i.gameObject.notifyComponentUpdated(i)}},materials:{get:function(){return e},set:function(b){var c;e=[];for(c=0;c<b.length;c++)e[c]=b[c],j=e[c].renderOrder;i.gameObject&&i.gameObject.notifyComponentUpdated(i)},enumerable:!0},mesh:{get:function(){return g},set:function(b){g=b},enumerable:!0}});this.render=function(b,
  h){var k=e.length,j,i;if(h){i=h.shader;for(j=0;j<k;j++)g.bind(i),i.bindUniform(h,b,c),g.render(j)}else for(j=0;j<k;j++)i=e[j].shader,g.bind(i),i.bindUniform(e[j],b,c),g.render(j)};this.toJSON=function(){return i.gameObject?KICK.core.Util.componentToJSON(i.gameObject.engine,this,"KICK.scene.MeshRenderer"):null};h(this,b)};g.Light=function(b){var c=this,e=i.create([1,1,1]),j,l=3,m=!1,n=1,p=0.05,k=null,r=null,q=i.create([1,0,0]),w=1,u,E=i.create([1,1,1]),D=function(){i.set([e[0]*w,e[1]*w,e[2]*w],E)},
  G,v,J=function(){if(m){if(!k){k=new KICK.texture.Texture(j,{minFilter:9728,magFilter:9728,wrapS:33071,wrapT:33071,flipY:!1,generateMipmaps:!1});var b=Math.min(j.gl.getParameter(34024),j.gl.getParameter(3379)),b=Math.min(b,4096)*j.config.shadowMapQuality;k.setImageData(b,b,0,5121,null,"");r=new KICK.texture.RenderTexture(j,{colorTexture:k})}}else r&&(r.destroy(),k.destroy(),k=r=null)};Object.defineProperties(this,{transform:{get:function(){return u}},shadowRenderTexture:{get:function(){return r}},
  shadowTexture:{get:function(){return k}},shadow:{get:function(){return m},set:function(b){b!==m&&(m=b,j&&J())},enumerable:!0},shadowStrength:{get:function(){return n},set:function(b){n=b},enumerable:!0},shadowBias:{get:function(){return p},set:function(b){p=b},enumerable:!0},color:{get:function(){return i.create(e)},set:function(b){i.set(b,e);D()},enumerable:!0},type:{get:function(){return l},set:function(b){j||(l=b)},enumerable:!0},intensity:{get:function(){return w},set:function(b){w=b;D()},enumerable:!0},
  attenuation:{get:function(){return q},set:function(b){i.set(b,q)},enumerable:!0},colorIntensity:{get:function(){return E},set:function(b){E=b},enumerable:!0},gameObject:{get:function(){return G},set:function(b){G=b}},scriptPriority:{get:function(){return v},set:function(b){v=b},enumerable:!0}});this.activated=function(){var b=c.gameObject;j=b.engine;u=b.transform;J()};this.toJSON=function(){return KICK.core.Util.componentToJSON(c.gameObject.engine,this,"KICK.scene.Light")};h(this,b);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 e=null,h=null,g=KICK.math.mat3.create(),j=g.subarray(0,3),l=g.subarray(3,6),n=g.subarray(6,9),p=i.create([1,0,0]),k=null,r=new Float32Array(9*c),q=i.wrapArray(r),w=[],u=[0,0,1],E=function(b){var c;for(c=0;3>c;c++)i.set([0,0,0],q[3*b+c])};Object.defineProperties(this,{ambientLight:{get:function(){return e},set:function(b){e=b}},directionalLight:{get:function(){return h},
  set:function(b){h=b;null!==b?k=h.gameObject.transform:(k=null,KICK.math.mat3.set([0,0,0,0,0,0,0,0,0],g))}},directionalLightData:{get:function(){return g}},directionalLightWorld:{get:function(){return p}},pointLightData:{get:function(){return r}}});this.addPointLight=function(b){!KICK.core.Util.contains(w,b)&&w.length!==c&&w.push(b)};this.removePointLight=function(b){b=w.indexOf(b);0<=b&&w.splice(b,1);E(w.length)};this.recomputeLight=function(e){null!==h&&(x.multiplyVec3(k.rotation,u,p),b.multiplyVec3Vector(e,
  p,j),i.normalize(j),i.add(u,j,n),i.normalize(n),i.set(h.colorIntensity,l));if(c){var g=0,r,E,D;for(r=w.length-1;0<=r;r--)E=w[r],D=E.transform.position,b.multiplyVec3(e,D,q[g]),i.set(E.colorIntensity,q[g+1]),i.set(E.attenuation,q[g+2]),g+=3}};var D;for(D=0;D<c;D++)E(D)}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];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 i=KICK.namespace("KICK.math.vec4"),x=KICK.namespace("KICK.math.mat4");g.MeshData=function(j){var b={},c=this,e=[],h,i,F,B,y,s=function(){F=i=h=null},z=function(){return b.vertex},A=function(){var c=h.byteLength/F,e,g,j,n,l=0,m;b={};for(e=0;e<c;e++){for(j in i)if(i.hasOwnProperty(j)){n=i[j];g=
  5126===n.type?Float32Array:Int32Array;0===e&&(b[j]=new g(c*n.size));m=new g(h,l+n.pointer);for(g=0;g<n.size;g++)b[j][e*n.size+g]=m[g]}l+=F}},m=function(c,e){if(5126===c||5124===c){var g=5126===c?Float32Array:Int32Array;return{get:function(){!z()&&h&&A();return b[e]},set:function(c){c?b[e]&&b[e].length===c.length?b[e].set(c):b[e]=new g(c):b[e]=null;s()}}}},n=function(){var b=[],e=[],g=[],j=0,n=[],l,m,G=c.vertex,G=G?G.length/3:0,v={};l=function(a,d,f){var h=c[a];h&&(b.push(d),e.push(a),g.push(f),n.push(h),
  v[a]={pointer:4*j,size:d,normalized:!1,type:f,name:a},j+=d)};l("vertex",3,5126);l("normal",3,5126);l("uv1",2,5126);l("uv2",2,5126);l("tangent",4,5126);l("color",4,5126);l("int1",1,5124);l("int2",2,5124);l("int3",3,5124);l("int4",4,5124);var C=new ArrayBuffer(4*j*G);for(m=0;m<G;m++)for(var s=4*m*j,H=0;H<e.length;H++){l=5126===g[H]?new Float32Array(C,s):new Int32Array(C,s);for(var a=n[H],d=b[H],f=0;f<d;f++)l[f]=a[m*d+f],s+=4}h=C;i=v;F=4*j};this.serialize=function(){var b=new KICK.core.ChunkData;b.setArrayBuffer(1,
  c.interleavedArray);b.setString(2,JSON.stringify(c.interleavedArrayFormat));b.setString(3,c.name||"MeshData");var e=c.subMeshes,g=e.length;b.setNumber(4,g);b.setNumber(5,c.vertexAttrLength);for(var h=0;h<g;h++)b.set(10+h,e[h]);return b.serialize()};this.deserialize=function(b){var e=new KICK.core.ChunkData;if(e.deserialize(b)){c.interleavedArray=e.getArrayBuffer(1);c.interleavedArrayFormat=JSON.parse(e.getString(2));c.name=e.getString(3);b=e.getNumber(4);c.vertexAttrLength=e.getNumber(5);for(var g=
  [],h=0;h<b;h++)g[h]=e.get(10+h);c.subMeshes=g;return!0}return!1};Object.defineProperties(this,{aabb:{get:function(){var b=c.vertex;if(!b)return null;for(var e=b.length,h=KICK.math.aabb.create(),g=0;g<e;g+=3){var j=b.subarray(g,g+3);KICK.math.aabb.addPoint(h,j)}return h}},name:{get:function(){return y},set:function(b){y=b}},interleavedArray:{get:function(){!h&&z()&&n();return h},set:function(b){b?h=b:s()}},interleavedArrayFormat:{get:function(){!h&&z()&&n();return i},set:function(b){b?i=b:s()}},vertexAttrLength:{get:function(){!h&&
  z()&&n();return F},set:function(b){b?F=b:s()}},vertex:m(5126,"vertex"),normal:m(5126,"normal"),uv1:m(5126,"uv1"),uv2:m(5126,"uv2"),tangent:m(5126,"tangent"),color:m(5126,"color"),int1:m(5124,"int1"),int2:m(5124,"int2"),int3:m(5124,"int3"),int4:m(5124,"int4"),indices:{get:function(){return 0==e?null:e[0]},set:function(b){b&&!(b instanceof Uint16Array)&&(b=new Uint16Array(b));e[0]&&z()&&s();b&&(e[0]=b)}},subMeshes:{get:function(){return e},set:function(b){for(var c=0;c<b.length;c++)b[c]&&!(b[c]instanceof
  Uint16Array)&&(b[c]=new Uint16Array(b[c]));e=b}},meshType:{get:function(){return B},set:function(b){B=b}}});this.isValid=function(){!z()&&h&&A();for(var c=b.vertex.length/3,g=0;g<e.length;g++)for(var j=e[g].length-1;0<=j;j--)if(e[g][j]>=c){debugger;return!1}return!0};this.isVertexDataInitialized=z;this.isInterleavedDataInitialized=function(){return h};this.transform=function(b){for(var c=new g.MeshData(this),e=l.wrapArray(c.vertex),h=e.length-1;0<=h;h--)x.multiplyVec3(b,e[h]);return c};this.combine=
  function(b,e){if(c.meshType!==b.meshType||6==c.meshType)return null;for(var h="vertex normal uv1 uv2 tangent color int1 int2 int3 int4 indices".split(" "),j=h.length-1;0<=j;j--){var i=h[j];(!c[i]||!b[i])&&h.splice(j,1)}j=function(b,c,e){var g,k,j,i,a;for(g=h.length-1;0<=g;g--)if(j=h[g],b[j]){i=c[j];if(e&&"indices"===j){i=new Uint16Array(i);a=i.length;for(k=0;k<a;k++)i[k]+=e}for(k=0;k<i.length;k++)b[j].push(i[k])}else b[j]=KICK.core.Util.typedArrayToArray(c[j])};i={meshType:c.meshType};e&&(b=b.transform(e));
  j(i,c,0);j(i,b,this.vertex.length/3);5===c.meshType&&i.indices.splice(c.indices,0,i.indices[c.indices.length],i.indices[c.indices.length+1]);return new g.MeshData(i)};j||(j={});var m=function(){c.vertex=j.vertex?new Float32Array(j.vertex):null;c.normal=j.normal?new Float32Array(j.normal):null;c.uv1=j.uv1?new Float32Array(j.uv1):null;c.uv2=j.uv2?new Float32Array(j.uv2):null;c.tangent=j.tangent?new Float32Array(j.tangent):null;c.color=j.color?new Float32Array(j.color):null;c.int1=j.int1?new Int32Array(j.int1):
  null;c.int2=j.int2?new Int32Array(j.int2):null;c.int3=j.int3?new Int32Array(j.int3):null;c.int4=j.int4?new Int32Array(j.int4):null},C=function(){c.interleavedArray=j.interleavedArray;c.interleavedArrayFormat=j.interleavedArrayFormat;c.vertexAttrLength=j.vertexAttrLength};j instanceof g.MeshData?j.isVertexDataInitialized()?m():C():j.vertex?m():j.interleavedArray&&C();c.name=j.name;c.indices=j.indices;c.meshType=j.meshType||4};g.MeshData.prototype.recalculateNormals=function(){var g=this.vertex.length/
  3,b=this.indices.length/3,c=this.indices,e=l.wrapArray(this.vertex),h,i={},x=l.array(g,i),B=l.create(),y=l.create(),s,z,A=l.create();for(h=0;h<b;h++){var m=c[3*h+0],n=c[3*h+1],C=c[3*h+2];s=e[m];z=e[n];var k=e[C];l.subtract(z,s,B);l.subtract(k,s,y);l.normalize(B);l.normalize(y);l.cross(B,y,A);l.normalize(A);s=Math.acos(Math.max(-1,Math.min(1,l.dot(B,y))));l.subtract(k,z,y);l.normalize(y);z=Math.PI-Math.max(-1,Math.min(1,Math.acos(l.dot(B,y))));l.add(x[m],l.scale(A,s,B));l.add(x[n],l.scale(A,z,B));
  l.add(x[C],l.scale(A,Math.PI-s-z,B))}for(h=0;h<g;h++)l.normalize(x[h]);this.normal=i.mem};g.MeshData.prototype.recalculateTangents=function(){if(4!=this.meshType)return!1;var g=l.wrapArray(this.vertex),b=g.length,c=l.wrapArray(this.normal),e=this.uv1,h=this.indices,p=h.length/3,x=this.tangent,B=l.array(b),y=l.array(b),s,z=l.create(),A=l.create();for(s=0;s<p;s++){var m=h[3*s+0],n=h[3*s+1],C=h[3*s+2],k=g[m],r=g[n],q=g[C],w=e[m],u=e[n],E=e[C],D=r[0]-k[0],G=q[0]-k[0],v=r[1]-k[1],J=q[1]-k[1],r=r[2]-k[2],
  k=q[2]-k[2],q=u[0]-w[0],I=E[0]-w[0],u=u[1]-w[1],E=E[1]-w[1],w=1/(q*E-I*u),E=l.create([(E*D-u*G)*w,(E*v-u*J)*w,(E*r-u*k)*w]),D=l.create([(q*G-I*D)*w,(q*J-I*v)*w,(q*k-I*r)*w]);l.add(B[m],E);l.add(B[n],E);l.add(B[C],E);l.add(y[m],D);l.add(y[n],D);l.add(y[C],D)}x||(this.tangent=x=new Float32Array(4*b));x=i.wrapArray(x);for(s=0;s<b;s++)g=c[s],e=B[s],l.subtract(e,g,z),l.dot(g,e,A),l.set(l.normalize(l.multiply(z,A)),x[s]),x[s][3]=0>l.dot(l.cross(g,e,l.create()),y[s])?-1:1;return!0};g.Mesh=function(g,b){KICK.core.ProjectAsset(this);
  var c=g.gl,e=g.glState,h,i,l=[],x=[],y,s,z="memory://void",A=null,m=this,n=0,C,k=[],r={contextLost:function(){x.length=0;c=h=null},contextRestored:function(b){c=b;w()}},q=function(){for(var b=0;b<x.length;b++)c.deleteBuffer(x[b]);"number"===typeof h&&(c.deleteBuffer(h),h=null);k.length=0;x.length=0},w=function(){var b=s.subMeshes;q();i=s.interleavedArrayFormat;var e;l.length=0;for(var g in i)i.hasOwnProperty(g)&&(e=i[g],e.name||(e.name=g),l.push(e));n=s.vertexAttrLength;C=s.meshType;h=c.createBuffer();
  c.bindBuffer(34962,h);c.bufferData(34962,s.interleavedArray,35044);for(e=0;e<b.length;e++){g=b[e];var j=c.createBuffer();k[e]=g.length;x.push(j);c.bindBuffer(34963,j);c.bufferData(34963,g,35044)}};g.addContextListener(r);Object.defineProperties(this,{aabb:{get:function(){!A&&s&&(A=s.aabb);return A}},name:{get:function(){return y},set:function(b){y=b||"Mesh"}},meshData:{get:function(){return s},set:function(b){s=b;A=null;w()}},dataURI:{get:function(){return z},set:function(b){m.setDataURI(b,!0)}}});
  this.setDataURI=function(b,c){b!==z&&(z=b,c&&g.resourceLoader.getMeshData(b,m))};KICK.core.Util.applyConfig(this,b);g.project.registerObject(this,"KICK.mesh.Mesh");this.verify=function(b){var c=[],e;for(e in b.lookupAttribute)"string"===typeof e&&((b=i[e])||c.push(e));return null};this.bind=function(b){var g;b.bind();if(e.meshBuffer!==h||e.meshShader!==b){e.meshBuffer=h;e.meshShader=b;c.bindBuffer(34962,h);for(g=0;g<l.length;g++){var k=l[g],j=b.lookupAttribute[k.name];"undefined"!==typeof j&&(c.enableVertexAttribArray(j),
  c.vertexAttribPointer(j,k.size,k.type,!1,n,k.pointer))}}};this.render=function(b){c.bindBuffer(34963,x[b]);c.drawElements(C,k[b],5123,0)};this.destroy=function(){null!==h&&(q(),g.removeContextListener(r),g.project.removeResourceDescriptor(m.uid))};this.toJSON=function(){return{uid:m.uid,name:y,dataURI:z}}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.material"),l=KICK.namespace("KICK.math"),i=l.mat3,x=l.mat4,j=l.vec4,b=KICK.namespace("KICK.core"),c=b.Util.applyConfig,e=b.Util.fail,h=b.Util.warn,p=KICK.core.Util.uint32ToVec4,F=x.create(),B=i.create(),y=j.create(),s=l.vec3.create(),z=0,A=0,m=function(b,c,e){return(35678===b||35680===b)&&c&&"number"===typeof c.ref?e.project.load(c.ref):Array.isArray(c)||"number"===typeof c?("number"===typeof c&&(c=[c]),5124===b||35667===b||35668===b||35669===b?new Int32Array(c):
  new Float32Array(c)):c};g.UniformDescriptor=function(b,c,e,g){this.name=b;this.type=c;this.size=e;this.location=g;Object.freeze(this)};g.Shader=function(b,h){KICK.core.ProjectAsset(this);var k=b.gl,j=b.glState,i=this,l=[],p=-1,E=!0,D=1029,s=513,v=!1,x=770,y=771,H=!1,a=2.5,d=10,f=1E3,t="memory://void",B="",F,M=[],L=[],N=[],K={},P=g.GLSLConstants,O=P["__error_vs.glsl"],R=P["__error_fs.glsl"],Q,S=KICK.core.Util.fail,V=-1,W=function(){F=(x+1E4*y)*(v?-1:1)},U=function(a,d){var c,a=g.Shader.getPrecompiledSource(b,
  a);c=d?k.createShader(35632):k.createShader(35633);k.shaderSource(c,a);k.compileShader(c);return!k.getShaderParameter(c,35713)?(c=k.getShaderInfoLog(c),"function"===typeof S&&S(c),null):c},T=function(a,d){switch(a){case 5126:return new Float32Array(d);case 35674:return new Float32Array(4*d);case 35675:return new Float32Array(9*d);case 35676:return new Float32Array(16*d);case 35664:return new Float32Array(2*d);case 35665:return new Float32Array(3*d);case 35666:return new Float32Array(4*d);case 5124:return new Int32Array(d);
  case 35667:return new Int32Array(2*d);case 35668:return new Int32Array(3*d);case 35669:return new Int32Array(4*d);case 35680:return 1!==d&&e("Texture arrays not currently supported"),b.project.load(b.project.ENGINE_TEXTURE_CUBEMAP_WHITE);case 35678:return 1!==d&&e("Texture arrays not currently supported"),b.project.load(b.project.ENGINE_TEXTURE_WHITE);default:e("Unknown type")}};this.addListener=function(a){l.push(a)};this.removeListener=function(a){KICK.core.Util.removeElementFromArray(l,a,!0)};
  this.contextLost=function(){k=null;p=-1;M.length=0;L.length=0;N.length=0};this.contextRestored=function(a){k||(k=a,i.apply())};b.addContextListener(this);Object.defineProperties(this,{lookupUniform:{get:function(){return K}},activeUniforms:{get:function(){return M}},engineUniforms:{get:function(){return L}},materialUniforms:{get:function(){return N}},name:{get:function(){return B},set:function(a){B=a}},dataURI:{get:function(){return t},set:function(a){t!==a&&(t=a)&&b.resourceLoader.getShaderData(t,
  i)}},gl:{value:k},glState:{value:j},defaultUniforms:{get:function(){return Q},set:function(a){var d,c;for(d in Q)Q.hasOwnProperty(d)&&a.hasOwnProperty(d)&&(c=K[d].type,Q[d]=m(c,a[d],b))}},vertexShaderSrc:{get:function(){return O},set:function(a){"string"!==typeof a&&KICK.core.Util.fail("Shader.vertexShaderSrc must be a string");O=a}},fragmentShaderSrc:{get:function(){return R},set:function(a){"string"!==typeof a&&KICK.core.Util.fail("Shader.fragmentShaderSrc must be a string");R=a}},renderOrder:{get:function(){return f},
  set:function(a){"number"!==typeof a&&KICK.core.Util.fail("Shader.renderOrder must be a number");f=a}},errorLog:{get:function(){return S},set:function(a){S=a}},engine:{value:b},shaderProgramId:{get:function(){return p}},polygonOffsetEnabled:{get:function(){return H},set:function(a){H=a}},polygonOffsetFactor:{get:function(){return a},set:function(b){a=b}},polygonOffsetUnits:{get:function(){return d},set:function(a){d=a}},faceCulling:{get:function(){return D},set:function(a){D=a}},depthMask:{get:function(){return E},
  set:function(a){E=a}},zTest:{get:function(){return s},set:function(a){s=a}},blend:{get:function(){return v},set:function(a){v=a;W()}},blendSFactor:{get:function(){return x},set:function(a){x=a;W()}},blendDFactor:{get:function(){return y},set:function(a){y=a;W()}},shaderVersion:{get:function(){return V}}});this.markUniformUpdated=function(){j.boundShader=-1;j.meshShader=-1};this.apply=function(){var a=S||console.log,b=U(O,!1,a),d=U(R,!0,a),c=null===d||null===b;c&&(b=U(P["__error_vs.glsl"],!1,a),d=
  U(P["__error_fs.glsl"],!0,a));p=k.createProgram();k.attachShader(p,b);k.attachShader(p,d);k.linkProgram(p);k.deleteShader(b);k.deleteShader(d);if(!k.getProgramParameter(p,35714))return a("Could not initialise shaders"),!1;V=A++;k.useProgram(p);j.boundShader=p;var a=k.getProgramParameter(p,35718),f,d=Q,e,h;M=[];K={};Q={};N.length=0;for(e=L.length=0;e<a;e++)b=k.getActiveUniform(p,e),f=k.getUniformLocation(p,b.name),f=new g.UniformDescriptor(b.name,b.type,b.size,f),Object.freeze(f),M[e]=f,K[b.name]=
  f,"_"!==b.name.charAt(0)?(h=T(b.type,b.size),Q[b.name]=h,N.push(f)):L.push(f);d&&(i.defaultUniforms=d);b=k.getProgramParameter(p,35721);i.activeAttributes=[];i.lookupAttribute={};for(a=0;a<b;a++)d=k.getActiveAttrib(p,a),i.activeAttributes[a]={size:d.size,type:d.type,name:d.name},i.lookupAttribute[d.name]=a;i.markUniformUpdated();for(a=0;a<l.length;a++)l[a]();return!c};this.destroy=function(){-1!==p&&(b.removeContextListener(i),k.deleteProgram(p),p=-1,b.project.removeResourceDescriptor(i.uid))};this.isValid=
  function(){return-1!==p};this.bind=function(){if(j.boundShader!==p){j.boundShader=p;k.useProgram(p);var b=j.faceCulling;b!==D&&(0===D?k.disable(2884):((!b||0===b)&&k.enable(2884),k.cullFace(D)),j.faceCulling=D);j.zTest!==s&&(k.depthFunc(s),j.zTest=s);j.depthMaskCache!==E&&(k.depthMask(E),j.depthMaskCache=E);j.blendKey!==F&&(j.blendKey=F,v?k.enable(3042):k.disable(3042),k.blendFunc(x,y));j.polygonOffsetEnabled!==H&&((j.polygonOffsetEnabled=H)?k.enable(32823):k.disable(32823));H&&k.polygonOffset(a,
  d)}};this.toJSON=function(){return t?{uid:i.uid,name:B,dataURI:t}:{uid:i.uid,name:B,blend:v,blendSFactor:x,blendDFactor:y,dataURI:t,depthMask:E,faceCulling:D,fragmentShaderSrc:R,vertexShaderSrc:O,polygonOffsetEnabled:H,polygonOffsetFactor:a,polygonOffsetUnits:d,renderOrder:f,zTest:s,defaultUniforms:Q}};c(i,h);b.project.registerObject(i,"KICK.material.Shader");t&&0!==t.indexOf("memory://")?b.resourceLoader.getShaderData(t,i):(W(),i.apply());""===B&&(B="Shader_"+z,z++)};g.Shader.getPrecompiledSource=
  function(b,c){var e,h,j="#version 100",i=1;for(e in g.GLSLConstants)g.GLSLConstants.hasOwnProperty(e)&&"string"===typeof e&&(h=g.GLSLConstants[e],c=c.replace('#pragma include "'+e+'"',h),c=c.replace("#pragma include '"+e+"'",h));0===c.indexOf("#version ")&&(e=c.indexOf("\n"),j=c.substring(0,e),c=c.substring(e+1),i=2);return c=j+"\n#define SHADOWS "+(!0===b.config.shadows)+"\n#define LIGHTS "+b.config.maxNumerOfLights+"\n#line "+i+"\n"+c};g.Shader.prototype.bindMaterialUniform=function(b,c){var e=
  this.gl,g=this.glState,h;h=c.sceneLights;var j,i=this.lookupUniform;j=i._proj;var l=i._dLight,m=i._dLightWorldDir,p=i["_pLights[0]"],v=i._time,x=i._viewport,y=i._ambient,i=b.bind(0);j&&e.uniformMatrix4fv(j.location,!1,c.projectionMatrix);y&&(j=h.ambientLight,j=null!==j?j.colorIntensity:s,e.uniform3fv(y.location,j));l&&e.uniformMatrix3fv(l.location,!1,h.directionalLightData);m&&e.uniform3fv(m.location,h.directionalLightWorld);p&&e.uniformMatrix3fv(p.location,!1,h.pointLightData);v&&(h=this.engine.time,
  e.uniform1f(v.location,h.time));x&&e.uniform2fv(x.location,g.viewportSize);return i};g.Shader.prototype.bindUniform=function(b,c,e){var g=this.lookupUniform,h=this.gl,j=this.glState,i=g._m,l=g._mv,m=g._worldCamPos,s=g._world2object,v=g._mvProj,z=g._norm,A=g._gameObjectUID,H=g._shadowMapTexture,g=g._lightMat,a=c.sceneLights.directionalLight,d,f=0;j.currentMaterial!==b&&(j.currentMaterial=b,f=this.bindMaterialUniform(b,c));if(i||l||z)d=e.getGlobalMatrix(),i&&h.uniformMatrix4fv(i.location,!1,d),b=x.multiply(c.viewMatrix,
  d,F),l&&h.uniformMatrix4fv(l.location,!1,b),z&&(l=x.toNormalMat3(b,B),h.uniformMatrix3fv(z.location,!1,l));m&&h.uniform3fv(m.location,c.currentCameraTransform.position);s&&h.uniformMatrix4fv(s.location,!1,e.getGlobalTRSInverse());v&&(d=d||e.getGlobalMatrix(),h.uniformMatrix4fv(v.location,!1,x.multiply(c.viewProjectionMatrix,d,F)));A&&(m=p(e.gameObject.uid,y),3>this.engine.time.frame&&console.log("transform.gameObject.uid "+e.gameObject.uid),h.uniform4fv(A.location,m));H&&(a&&a.shadowTexture)&&(a.shadowTexture.bind(f),
  h.uniform1i(H.location,f));g&&(d=e.getGlobalMatrix(),h.uniformMatrix4fv(g.location,!1,x.multiply(c.lightMatrix,d,F)))};Object.freeze(g.Shader);g.Material=function(b,j){KICK.core.ProjectAsset(this);var k="Material",i=null,l=[],p=this,u=b.gl,s=0,x={contextLost:function(){},contextRestored:function(b){u=b;i&&(i.contextRestored(b),b=i,i=null,p.shader=b)}},G=function(){var b,a,d={},c;for(b=l.length-1;0<=b;b--)(a=i.lookupUniform[l[b].name])?(l[b].type=a.type,l[b].location=a.location,d[l[b].name]=!0):l.splice(b,
  1);for(b=0;b<i.materialUniforms.length;b++)a=i.materialUniforms[b],c=a.name,d.hasOwnProperty(c)||(c=p.setUniform(c,i.defaultUniforms[c]),c.location=a.location,c.type=a.type)};Object.defineProperties(this,{engine:{value:b},name:{get:function(){return k},set:function(b){k=b}},shader:{get:function(){return i},set:function(b){!b instanceof KICK.material.Shader&&e("KICK.material.Shader expected");if(i!==b&&(i&&i.removeListener(G),i=b))s=i.renderOrder,G(),i.addListener(G)}},uniforms:{value:null},renderOrder:{get:function(){return s}}});
  this.bind=function(b){var a,d,c;for(a=0;a<l.length;a++)switch(d=l[a].value,c=l[a].location,l[a].type){case 5126:u.uniform1fv(c,d);break;case 35674:u.uniformMatrix2fv(c,!1,d);break;case 35675:u.uniformMatrix3fv(c,!1,d);break;case 35676:u.uniformMatrix4fv(c,!1,d);break;case 35664:u.uniform2fv(c,d);break;case 35665:u.uniform3fv(c,d);break;case 35666:u.uniform4fv(c,d);break;case 5124:u.uniform1iv(c,d);break;case 35667:u.uniform2iv(c,d);break;case 35668:u.uniform3iv(c,d);break;case 35669:u.uniform4iv(c,
  d);break;case 35680:case 35678:d.bind(b),u.uniform1i(c,b),b++}return b};this.setUniform=function(b,a){if(void 0===a||null===a)return null;var d,c;for(c=0;c<l.length&&!d;c++)l[c].name===b&&(d=l[c],d.value=a);d&&i?i.markUniformUpdated():d||(d=new g.MaterialUniform({name:b,value:a}),l.push(d));return d};this.getUniform=function(b){var a;for(a=0;a<l.length;a++)if(l[a].name===b)return l[a].value;return null};this.destroy=function(){p.shader=null;b.project.removeResourceDescriptor(p.uid);b.removeContextListener(x)};
  this.toJSON=function(){var c,a={};for(c=0;c<l.length;c++)a[l[c].name]=l[c].toJSON().value;return{uid:p.uid,name:k,shader:KICK.core.Util.getJSONReference(b,i),uniformData:a}};var v=j.uniformData,y,z;z={uid:j.uid||0,name:j.name,shader:j.shader};b.addContextListener(x);j.uniforms&&h("Warn - Material.uniforms is deprecated");c(p,z);if(!i||!i.isValid())j.shader&&h("Problem using shader in material. ",j.shader),p._shader=b.project.load(b.project.ENGINE_SHADER___ERROR);if(v)for(y in v)v.hasOwnProperty(y)&&
  (i.lookupUniform[y]?(z=v[y],z=m(i.lookupUniform[y].type,z,b),p.setUniform(y,z)):h("Cannot find uniform "+y+" in shader. "));G();b.project.registerObject(p,"KICK.material.Material")};g.MaterialUniform=function(c){var e,g=this,c=c||{};e=c.value;this.type=this.location=null;this.name=c.name;Object.defineProperties(this,{value:{get:function(){return e},set:function(b){e=b}}});this.toJSON=function(){var c=g.value,c=c instanceof Float32Array||c instanceof Int32Array?b.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,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.mesh"),l=KICK.namespace("KICK.math"),i=l.vec3,x=l.vec2;g.MeshFactory={createTriangleData:function(){var j=Math.sqrt(0.75);return new g.MeshData({name:"Triangle",vertex:[0,1,0,-j,-0.5,0,j,-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(j,
  b,c){if(!j||3>j)j=64;if(!b||2>b)b=32;c||(c=1);var e,h;e=2*b*(j+1)+2*(b-1);var l={},F=i.array(e,l),B={},y=i.array(e,B),s={},z=x.array(e,s),A=[],m=Math.PI/b,n=Math.PI/2,C=2*Math.PI,k=0,r,q,w,u,E,D,G,v,J,I;for(e=0;e<b;e++){r=m*e-n;h=m*(e+1)-n;q=Math.sin(r);w=Math.cos(r);r=Math.sin(h);u=Math.cos(h);for(h=0;h<=j;h++)E=C/j*h,D=Math.sin(E),G=Math.cos(E),E=G*w,v=q,I=D*w,G*=u,J=r,D*=u,i.set([E,v,I],F[k]),x.set([1-h/j,e/b],z[k]),i.set([c*E,c*v,c*I],y[k]),A.push(k),0<e&&0===h&&A.push(k),k++,i.set([G,J,D],F[k]),
  x.set([1-h/j,(e+1)/b],z[k]),i.set([c*G,c*J,c*D],y[k]),A.push(k),h===j&&e<b-1&&A.push(k),k++}return new g.MeshData({name:"UVSphere",vertex:B.mem,uv1:s.mem,normal:l.mem,indices:A,meshType:5})},createCubeData:function(j){j||(j=1);return new g.MeshData({name:"Cube",vertex:[j,j,j,-j,j,j,-j,-j,j,j,-j,j,j,j,j,j,-j,j,j,-j,-j,j,j,-j,j,j,j,j,j,-j,-j,j,-j,-j,j,j,-j,j,j,-j,j,-j,-j,-j,-j,-j,-j,j,-j,-j,-j,j,-j,-j,j,-j,j,-j,-j,j,j,-j,-j,-j,-j,-j,-j,j,-j,j,j,-j],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,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.importer"),l=KICK.namespace("KICK.math"),i=l.quat4,x=l.mat4,j=function(b,c){return b.querySelector("[id="+c+"]")};g.ColladaImporter={};g.ColladaImporter.import=function(b,c,e,g){"string"===typeof b&&(b=(new window.DOMParser).parseFromString(b,"text/xml"));var l={},F=[],B=[],y=function(b,c){c||(c=Array);var b=b.replace(/^\s+|\s+$/g,""),b=b.replace(/\s{2,}/g," "),e=b.split(" ").map(Number);return!c||c===Array?e:new c(e)},s=function(c){c.getAttribute("semantic");
  var c=j(b,c.getAttribute("source").substring(1)),e,g,h;"vertices"===c.tagName&&(c=c.getElementsByTagName("input")[0],c=j(b,c.getAttribute("source").substring(1)));c=c.getElementsByTagName("technique_common")[0].getElementsByTagName("accessor")[0];c.getAttribute("count");e=Number(c.getAttribute("stride"));(g=Number(c.getAttribute("offset")))||(g=0);c=c.getAttribute("source");"#"===c.charAt(0)&&(c=c.substring(1));if(l[c])h=l[c];else{var i=j(b,c),i=y(i.textContent,"float_array"===i.tagName?Float32Array:
  Int32Array);h=l[c]=i}return function(b,c){return h[g+e*b+c]}},z=function(b,c,e){for(var g=b.firstChild,h,j,i,k=function(){return 3},b=Number(b.getAttribute("count")),l=[],a={},d={},f={},m=[],n=KICK.core.Util.contains,p=e.numberOfVertices||0,r,q,x,z,B;null!==g;){h=g.tagName;if("input"===h)h=g.getAttribute("semantic"),j=Number(g.getAttribute("offset")),d[h]=new s(g),l.push(h),a[h]=j,f[h]="TEXCOORD"===h?2:3,n(m,j)||m.push(j);else if("vcount"===h)r=y(g.textContent,Int32Array),k=function(a){return r[a]};
  else if("p"===h){q=m.length;x=y(g.textContent,Int32Array);z={};for(j=0;j<l.length;j++)z[l[j]]=[];B=function(b,c,g){var h="",j,i,k,m,n=b*q,r,v;for(k=0;k<l.length;k++)i=l[k],j=a[i],j=x[j+n],h+=b+"#"+j+"#";i=e[h];if("number"===typeof i)g.push(i);else{for(k=0;k<l.length;k++){i=l[k];b=d[i];r=f[i];j=a[i];j=x[j+n];for(m=0;m<r;m++)v=b(j,m),c[i].push(v)}c=p;p+=1;g.push(c);e[h]=c}};var A=0;h=[];for(j=0;j<b;j++){var C=k(j);for(i=0;3>i;i++)B(A+i,z,h);for(i=3;i<C;i++)B(A,z,h),B(A+i-1,z,h),B(A+i,z,h);A+=C}for(j=
  0;j<l.length;j++)A=l[j],i=A.toLowerCase(),"texcoord"===i&&(i="uv1"),c[i]&&c[i].length?(C=KICK.core.Util.typedArrayToArray,B=C(c[i]),A=C(z[A]),B.push.apply(B,A),c[i]=B):c[i]=z[A];c.meshType=4;j=c.subMeshes;j.push(h);c.subMeshes=j;console.log("pushing new sub mesh with "+h.length+" as # "+c.subMeshes.length)}g=g.nextSibling}e.numberOfVertices=p},A=function(b,g){var h=e.createGameObject(),j=h.transform,l,m;g&&(j.parent=g);h.name=b.getAttribute("id");k.push(h);for(l=b.firstElementChild;l;){m=l.tagName;
  if("translate"===m||"rotate"===m||"scale"===m||"matrix"===m)a:{m=j;var n=l,p=n.tagName;n.getAttribute("sid");var q=void 0,a=void 0,d=q=void 0,d=m.getLocalMatrix(),f=x.identity(x.create());if("translate"===p)x.translate(f,y(n.textContent),f);else if("rotate"===p)if(q=y(n.textContent),a=q[3])q=i.angleAxis(a,q),i.toMat4(q,f);else break a;else if("scale"===p)x.scale(f,y(n.textContent),f);else if("matrix"===p)x.transpose(y(n.textContent),f);else{console.log(p+" - unsupported");break a}x.multiply(d,f,f);
  d=x.decompose(f);m.localPosition=d[0];m.localRotation=d[1];m.localScale=d[2]}else if("instance_geometry"===m){m=h;p=l.getAttribute("url");q=f=d=n=void 0;p&&(p=p.substring(1));n=c;d=[];q=f=void 0;if(r[p])d=r[p];else{p&&"#"===p.charAt(0)&&(p=p.substring(1));for(f=0;f<C.length;f++)if(q=C[f],q.getAttribute("id")===p){var t=q,s=a=void 0,f=t.getAttribute("name")||"MeshData",q=void 0,a=t.getElementsByTagName("mesh");if(0===a.length)f=null;else{t={};a=a[0];for(s=a.firstChild;null!==s;)a=s.tagName,"lines"===
  a?console.log("lines - unsupported"):"linestrips - unsupported"===a?console.log("linestrips"):"polygons"===a?console.log("polygons  - unsupported"):"polylist"===a||"triangles"===a?(q||(q=new KICK.mesh.MeshData({name:f})),z(s,q,t)):"trifans"===a?console.log("trifans unsupported"):"tristrips"===a&&console.log("tristrips - unsupported"),s=s.nextSibling;f=q}f&&(n=new KICK.mesh.Mesh(n,{meshData:f,name:f.name+" mesh"}),F.push(n),d.push(n));break}r[p]=d}for(f=0;f<d.length;f++)n=new KICK.scene.MeshRenderer,
  n.mesh=d[f],q=new KICK.material.Material(c,{name:"Some material",shader:c.project.load(c.project.ENGINE_SHADER_DEFAULT)}),n.material=q,B.push(q),m.addComponent(n)}else"node"===m?A(l,j):console.log("Unknown tagName '"+m+"'");l=l.nextElementSibling}},m=b.firstChild.getElementsByTagName("library_geometries"),n=b.firstChild.getElementsByTagName("visual_scene"),C;e||(e=c.activeScene);m=m[0];C=m.getElementsByTagName("geometry");for(var k=[],r={},m=0;m<n.length;m++)for(var q=n[m].firstElementChild;q;)A(q,
  null),q=q.nextElementSibling;if(g){g=e.createGameObject({name:"Collada Parent"});n=g.transform;n.localRotationEuler=[-90,0,0];for(m=0;m<k.length;m++)q=k[m].transform,q.parent||(q.parent=n);k.push(g)}return{mesh:F,gameObjects:k,materials:B}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.importer"),l=KICK.namespace("KICK.math").mat4;g.ObjImporter={};g.ObjImporter.import=function(g,x,j,b){var g=g.split("\n"),c=g.length,e=[],h=[],p=[],F=[],B=[],y=[F],s=[],z=[],A=[],m="MeshObject",n,C=function(b,c){c||(c=Array);var b=b.replace(/^\s+|\s+$/g,""),b=b.replace(/\s{2,}/g," "),e=b.split(" ").map(Number);return!c||c===Array?e:new c(e)},k=function(){var b=function(a,b,c){a=a[b-1];for(b=0;b<a.length;b++)c.push(a[b])};if(0!==e.length){var c=j.createGameObject(),
  g=new KICK.mesh.MeshData,i=new KICK.mesh.Mesh(x),k=[],l=[],n=[],q,a=[],d={},f=0,r,w,C,M,L,N;A.push(i);for(M=0;M<y.length;M++){F=y[M];q=[];a.push(q);for(L=0;L<F.length;L++){w=r=F[L];C=[];var K=N=void 0,P=K=void 0;for(N=0;N<w.length;N++)K=w[N],K=K.split("/"),P=parseInt(K[0],10),C.push([P,2<=K.length?parseInt(K[1],10):P,3<=K.length?parseInt(K[2],10):P]);w=C;for(N=0;3>N;N++)C=r[N],"number"===typeof d[C]?q.push(d[C]):(b(e,w[N][0],k),p.length&&b(p,w[N][1],n),h.length&&b(h,w[N][2],l),q.push(f),d[C]=f,f++)}}g.vertex=
  k;l.length&&(g.normal=l);n.length&&(g.uv1=n);g.subMeshes=a;i.meshData=g;i.name=m+" mesh";b=new KICK.scene.MeshRenderer;b.mesh=i;var O=[],i=function(a){a=new KICK.material.Material(x,{name:a,shader:x.project.load(x.project.ENGINE_SHADER_DEFAULT)});O.push(a);z.push(a)};for(L=0;L<a.length;L++)L<B.length?(g=B[L],(k=x.project.loadByName(g,"KICK.material.Material"))?O.push(k):i(g)):i("material");b.materials=O;c.name=m;c.addComponent(b);s.push(c);F=[]}},r=l.identity(l.create());b&&l.rotateX(r,-1.5707963267946);
  for(b=0;b<c;b++){var q=g[b].replace(/^\s+|\s+$/g,""),w=q.indexOf(" ");if(!(0>w))if(n=q.substring(0,w),q=q.substring(w+1),"o"===n)k(),m=q,B.length=0;else if("usemtl"===n)B.push(q),0<F.length&&(F=[],y[y.length]=F);else if("v"===n)n=C(q),l.multiplyVec3(r,n),e.push(n);else if("vn"===n)n=C(q),l.multiplyVec3(r,n),h.push(n);else if("vt"===n)p.push(C(q));else if("f"===n){q=q.split(" ");F.push(q.slice(0,3));for(n=3;n<q.length;n++)F.push([q[n-1],q[n],q[0]])}}k();return{mesh:A,gameObjects:s,materials:z}}})();KICK=KICK||{};KICK.namespace=function(g){var g=g.split("."),l=window,i;for(i=0;i<g.length;i+=1)"undefined"===typeof l[g[i]]&&(l[g[i]]={}),l=l[g[i]];return l};
  (function(){var g=KICK.namespace("KICK.core"),l=KICK.namespace("KICK.mesh"),i=g.Util.fail;g.ResourceLoader=function(i){var j=[new g.URLResourceProvider(i),new g.BuiltInResourceProvider(i)],i=function(b){return function(c,e){var g,i,l;for(g=j.length-1;0<=g;g--)if(i=j[g],l=i.protocol,0===c.indexOf(l)){i[b](c,e);break}}};this.getMeshData=i("getMeshData");this.getImageData=i("getImageData");this.getShaderData=i("getShaderData");this.addResourceProvider=function(b){j.push(b)};this.removeResourceProvider=
  function(b){var c;for(c=b.length-1;0<=c;c--)j[c]===b&&j.splice(c,1)}};g.URLResourceProvider=function(g){Object.defineProperties(this,{protocol:{value:""}});this.getMeshData=function(j,b){var c=new XMLHttpRequest,e=g.project.createResourceTracker();c.open("GET",j,!0);c.responseType="arraybuffer";c.onreadystatechange=function(){if(4===c.readyState)if(200===c.status){var g=c.response,l=new KICK.mesh.MeshData;l.deserialize(g)?(b.meshData=l,e.resourceReady()):(i("Cannot deserialize meshdata "+j),e.resourceFailed())}else i("Cannot load meshdata "+
  j+". Server responded "+c.status),e.resourceFailed()};c.send()};this.getImageData=function(j,b){var c=new Image,e=g.project.createResourceTracker();c.onload=function(){try{b.setImage(c,j),e.resourceReady()}catch(g){i("Exception when loading image "+j),e.resourceFailed()}};c.onerror=function(b){i(b);i("Exception when loading image "+j);e.resourceFailed()};0!==j.indexOf("data:")&&(c.crossOrigin="anonymous");c.src=j}};g.BuiltInResourceProvider=function(i){Object.defineProperties(this,{protocol:{value:"kickjs://"}});
  this.getMeshData=function(i,b){var c,e,h;e=g.Util.getParameterInt;h=g.Util.getParameterFloat;if(0===i.indexOf("kickjs://mesh/triangle/"))c=l.MeshFactory.createTriangleData();else if(0===i.indexOf("kickjs://mesh/plane/"))c=l.MeshFactory.createPlaneData();else if(0===i.indexOf("kickjs://mesh/uvsphere/"))c=e(i,"slices"),e=e(i,"stacks"),h=h(i,"radius"),c=l.MeshFactory.createUVSphereData(c,e,h);else if(0===i.indexOf("kickjs://mesh/cube/"))c=h(i,"length"),c=l.MeshFactory.createCubeData(c);else{KICK.core.Util.fail("No meshdata found for "+
  i);return}b.meshData=c};this.getShaderData=function(g,b){var c,e,h,l=!1,F=!1,B=!0,y=1E3,s=KICK.material.GLSLConstants,z={},A="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<A.length;c++){var m=A[c],n=0===g.indexOf("kickjs://shader/"+m+"/");if(n){e=s[m+"_vs.glsl"];h=s[m+"_fs.glsl"];0===m.indexOf("transparent_")&&(l=!0,B=!1,y=2E3);"__shadowmap"===
  m&&(F=!0);if("specular"===m||"transparent_specular"===m)z={mainColor:[1,1,1,1],mainTexture:i.project.load(i.project.ENGINE_TEXTURE_WHITE),specularColor:[1,1,1,1],specularExponent:50};if("diffuse"===m||"transparent_diffuse"===m||"unlit"===m||"unlit_vertex_color"===m||"transparent_unlit"===m)z={mainColor:[1,1,1,1],mainTexture:i.project.load(i.project.ENGINE_TEXTURE_WHITE)}}if(n)break}KICK.core.Util.applyConfig(b,{blend:l,depthMask:B,renderOrder:y,polygonOffsetEnabled:F,vertexShaderSrc:e,fragmentShaderSrc:h,
  defaultUniforms:z});b.apply()};this.getImageData=function(g,b){var c,e,h;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/checkerboard/"))c=new Uint8Array([255,
  255,255,255,0,0,0,255,0,0,0,255,255,255,255,255]);else{if(0===g.indexOf("kickjs://texture/logo/")){b.setTemporaryTexture();e=document.createElement("img");h=i.project.createResourceTracker();e.onload=function(){b.generateMipmaps=!0;b.internalFormat=6408;b.magFilter=9729;b.minFilter=9987;b.setImage(e,g);h.resourceReady()};e.onerror=function(){h.resourceFailed()};e.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAABACAYAAADS1n9/AAAXgWlDQ1BJQ0MgUHJvZmlsZQAAeAGtWXc8lt/7P/cz8Xisx957Zm+y98jeyXqsx/bYu6wyUiSEK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