var kvg=kvg||{};(function(){var a=kvg.createNS("kvg.assets"),b={};a.register=function(a,c,e){if("png"===c||"jpg"===c){var f=new Image;f.src="data:image/"+("jpg"===c?"jpeg":c)+"base64,"+e;b[a]=f}};a.preload=function(){};a.get=function(a){b[a]||console.log("Asset "+a+" not found");return b[a]}})();kvg=kvg||{};LightNS.inject(kvg,"kvg");(function(){var a=kvg.createNS("kvg.core.demo");a.scene=null;a.camera=null;a.initialize=function(){this.initializeScene();this.initializeParts()};a.start=function(){};a.end=function(){}})();kvg=kvg||{};
(function(){var a=kvg.createNS("kvg.core.graphics");a.container=null;a.camera=null;a.scene=null;a.renderer=null;a.initWebGL=function(b){console.log("initializing WegGL context");a.clearColor=b.clearColor?b.clearColor:0;a.container=$("#demo");a.renderer=new THREE.WebGLRenderer;a.renderer.setClearColor(b.clearColor);console.log("Setting viewport size",b.width,b.height);a.renderer.setSize(b.width,b.height);a.container.append(a.renderer.domElement);a.renderer.domElement.width=b.width;a.renderer.domElement.height=b.height;
a.viewport={width:b.width,height:b.height};a.layerEffect={};a.frameCount=0;a.renderer.setClearColor(a.clearColor,1);a.renderer.autoClear=!0};a.initializeComposer=function(){a.composerRT=new THREE.WebGLRenderTarget(a.viewport.width,a.viewport.height,{minFilter:THREE.LinearFilter,magFilter:THREE.NearestFilter,format:THREE.RGBAFormat});a.layerEffect.bloom=new THREE.BloomPass(1.85,20,18,512);var b=new THREE.RenderPass(kvg.core.demo.scene,kvg.core.demo.camera,null,0,0);a.composer=new THREE.EffectComposer(a.renderer,
a.composerRT);a.composer.renderTarget1.format=THREE.RGBAFormat;a.composer.renderTarget2.format=THREE.RGBAFormat;a.composer.addPass(b);a.composer.addPass(a.layerEffect.bloom);a.layerEffect.rgbShift=new kvg.graphics.post.RGBShift(.002,-.002,0);a.layerEffect.renderToScreen=!1;a.composer.addPass(a.layerEffect.rgbShift);b=new THREE.ShaderPass(THREE.CopyShader);b.renderToScreen=!0;a.composer.addPass(b)}})();var LightNS=window.LightNS=LightNS={};LightNS.inject=function(a,b){a.createNS=function(d){d=d.split(".");var c=a;d[0]===b&&(d=d.slice(1));for(var e=0;e<d.length;e++){var f=d[e];"undefined"===typeof c[f]&&(c[f]={});c=c[f]}return c}};kvg=kvg||{};(function(){kvg.createNS("kvg.loader")})();kvg=kvg||{};
(function(){function a(a){$("#setup").hide();BigScreen.enabled?BigScreen.request($("#demo")[0],b,d,c):console.log("BigScreen not enabled!")}function b(){kvg.graphics.initWebGL({width:screen.width,height:screen.height,clearColor:2105376})}function d(){}function c(){console.log("Could not start fullscreen")}function e(a){$("#setup").hide();$("#demo").css("transform","").css("-webkit-transform","");a="on"===$("#aspectLock input").val();var b=$("#resolution .active input[name='options']").val(),c=1280,
d=720;"b"===b?(c=1920,d=1080):"c"===b&&(c=window.innerWidth,d=window.innerHeight,b=1280/720,a&&1*c/b<d?d=720*window.innerWidth/1280:a&&d<1*c/b&&(c=1280*window.innerHeight/720));$("#demo").css("width",c).css("height",d);kvg.graphics.initWebGL({width:c,height:d,clearColor:2105376});kvg.core.demo.initialize();kvg.core.graphics.initializeComposer();kvg.core.demo.start()}kvg.createNS("kvg.setup").init=function(){var b=$("#setup");b.find("#resolution");var c=b.find("#fullscreen"),b=b.find("#start");c.click(a);
b.click(e);console.log("Setup initialized")}})();kvg=kvg||{};(function(){kvg.createNS("kvg.sound").init=function(){console.log("sound init")}})();
