artproject/klein.js

4 lines
25 KiB
JavaScript
Raw Normal View History

2018-02-12 13:51:32 +02:00
/*empire.studio - Design & Strategy*/
/* eslint-disable */
var Ops=Ops||{};Ops.Gl=Ops.Gl||{},Ops.Anim=Ops.Anim||{},Ops.Json3d=Ops.Json3d||{},Ops.Devices=Ops.Devices||{},Ops.Gl.Matrix=Ops.Gl.Matrix||{},Ops.Gl.Meshes=Ops.Gl.Meshes||{},Ops.Gl.Shader=Ops.Gl.Shader||{},Ops.Devices.Mouse=Ops.Devices.Mouse||{},Ops.Gl.MainLoop=function(){function e(){function e(){h&&(h.style.display="block")}function n(){h&&(h.style.display="none")}if(t.patch.cgl.canvas.addEventListener("mouseleave",n),t.patch.cgl.canvas.addEventListener("mouseenter",e),s.get()){if(!h){h=document.createElement("div");var r=t.patch.cgl.canvas.parentElement;r&&r.appendChild(h),h.addEventListener("mouseenter",e),h.addEventListener("click",function(e){CABLES.UI&&!e.shiftKey?gui.cycleRendererSize():c.fullScreen()})}h.style.padding="10px",h.style.position="absolute",h.style.right="5px",h.style.top="5px",h.style.width="20px",h.style.height="20px",h.style.cursor="pointer",h.style["border-radius"]="40px",h.style.background="#444",h.style["z-index"]="9999",h.style.display="none",h.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" viewBox="0 0 490 490" style="width:20px;height:20px;" xml:space="preserve" width="512px" height="512px"><g><path d="M173.792,301.792L21.333,454.251v-80.917c0-5.891-4.776-10.667-10.667-10.667C4.776,362.667,0,367.442,0,373.333V480 c0,5.891,4.776,10.667,10.667,10.667h106.667c5.891,0,10.667-4.776,10.667-10.667s-4.776-10.667-10.667-10.667H36.416 l152.459-152.459c4.093-4.237,3.975-10.99-0.262-15.083C184.479,297.799,177.926,297.799,173.792,301.792z" fill="#FFFFFF"/><path d="M480,0H373.333c-5.891,0-10.667,4.776-10.667,10.667c0,5.891,4.776,10.667,10.667,10.667h80.917L301.792,173.792 c-4.237,4.093-4.354,10.845-0.262,15.083c4.093,4.237,10.845,4.354,15.083,0.262c0.089-0.086,0.176-0.173,0.262-0.262 L469.333,36.416v80.917c0,5.891,4.776,10.667,10.667,10.667s10.667-4.776,10.667-10.667V10.667C490.667,4.776,485.891,0,480,0z" fill="#FFFFFF"/><path d="M36.416,21.333h80.917c5.891,0,10.667-4.776,10.667-10.667C128,4.776,123.224,0,117.333,0H10.667 C4.776,0,0,4.776,0,10.667v106.667C0,123.224,4.776,128,10.667,128c5.891,0,10.667-4.776,10.667-10.667V36.416l152.459,152.459 c4.237,4.093,10.99,3.975,15.083-0.262c3.992-4.134,3.992-10.687,0-14.82L36.416,21.333z" fill="#FFFFFF"/><path d="M480,362.667c-5.891,0-10.667,4.776-10.667,10.667v80.917L316.875,301.792c-4.237-4.093-10.99-3.976-15.083,0.261 c-3.993,4.134-3.993,10.688,0,14.821l152.459,152.459h-80.917c-5.891,0-10.667,4.776-10.667,10.667s4.776,10.667,10.667,10.667 H480c5.891,0,10.667-4.776,10.667-10.667V373.333C490.667,367.442,485.891,362.667,480,362.667z" fill="#FFFFFF"/></g></svg>'}else h&&(h.style.display="none",h.remove(),h=null)}Op.apply(this,arguments);var t=this,n=t.inValue("FPS Limit",0),r=t.outFunction("trigger"),o=t.outValue("width"),a=t.outValue("height"),i=(t.inValueBool("Reduce FPS loading"),t.inValueBool("Clear",!0)),s=t.inValueBool("Fullscreen Button",!1),l=t.inValueBool("Active",!0),d=t.inValueBool("Hires Displays",!1);d.onChange=function(){d.get()?t.patch.cgl.pixelDensity=window.devicePixelRatio:t.patch.cgl.pixelDensity=1,t.patch.cgl.updateSize(),CABLES.UI&&gui.setLayout()};var c=t.patch.cgl,u=0,g=0;t.patch.cgl||t.uiAttr({error:"No webgl cgl context"});var v=vec3.create();vec3.set(v,0,0,0);var P=vec3.create();vec3.set(P,0,0,-2),s.onChange=e,setTimeout(e,100);var h=null;n.onChange=function(){t.patch.config.fpsLimit=n.get()||0},t.onDelete=function(){c.gl.clearColor(0,0,0,0),c.gl.clear(c.gl.COLOR_BUFFER_BIT|c.gl.DEPTH_BUFFER_BIT),t.patch.removeOnAnimFrame(t)},t.patch.loading.setOnFinishedLoading(function(e){t.patch.config.fpsLimit=n.get()}),t.onAnimFrame=function(e){if(l.get()&&!c.aborted&&0!==c.canvas.clientWidth&&0!==c.canvas.clientHeight){if(t.patch.loading.getProgress()<1&&(t.patch.config.fpsLimit=5),-1==c.canvasWidth)return void c.setCanvas(t.patch.config.glCanvasId);(c.canvasWidth!=o.get()||c.canvasHeight!=a.get())&&(o.set(c.canvasWidth),a.set(c.canvasHeight)),CABLES.now()-g>1e3&&(CGL.fpsReport=CGL.fpsReport||[],t.patch.loading.getProgress()>=1&&0!=