armory/tools/sdfgen/krom/krom.js

1 line
630 KiB
JavaScript
Raw Normal View History

2017-08-02 11:46:54 +02:00
function $extend(e,t){function a(){}a.prototype=e;var r=new a;for(var i in t)r[i]=t[i];return t.toString!==Object.prototype.toString&&(r.toString=t.toString),r}function $iterator(e){return e instanceof Array?function(){return HxOverrides.iter(e)}:"function"==typeof e.iterator?$bind(e,e.iterator):e.iterator}function $bind(e,t){if(null==t)return null;null==t.__id__&&(t.__id__=$fid++);var a;return null==e.hx__closures__?e.hx__closures__={}:a=e.hx__closures__[t.__id__],null==a&&((a=function(){return a.method.apply(a.scope,arguments)}).scope=e,a.method=t,e.hx__closures__[t.__id__]=a),a}var $hx_exports="undefined"!=typeof exports?exports:"undefined"!=typeof window?window:"undefined"!=typeof self?self:this;$hx_exports.kha=$hx_exports.kha||{},$hx_exports.kha.input=$hx_exports.kha.input||{},$hx_exports.kha._Color=$hx_exports.kha._Color||{};var $global="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,$hxClasses=$hxClasses||{},$estr=function(){return js_Boot.__string_rec(this,"")},HxOverrides=$hxClasses.HxOverrides=function(){};HxOverrides.__name__=!0,HxOverrides.strDate=function(e){switch(e.length){case 8:var t=e.split(":"),a=new Date;return a.setTime(0),a.setUTCHours(t[0]),a.setUTCMinutes(t[1]),a.setUTCSeconds(t[2]),a;case 10:var r=e.split("-");return new Date(r[0],r[1]-1,r[2],0,0,0);case 19:var i=e.split(" "),s=i[0].split("-"),n=i[1].split(":");return new Date(s[0],s[1]-1,s[2],n[0],n[1],n[2]);default:throw new js__$Boot_HaxeError("Invalid date format : "+e)}},HxOverrides.cca=function(e,t){var a=e.charCodeAt(t);if(a==a)return a},HxOverrides.substr=function(e,t,a){if(null==a)a=e.length;else if(a<0){if(0!=t)return"";a=e.length+a}return e.substr(t,a)},HxOverrides.remove=function(e,t){var a=e.indexOf(t);return-1!=a&&(e.splice(a,1),!0)},HxOverrides.iter=function(e){return{cur:0,arr:e,hasNext:function(){return this.cur<this.arr.length},next:function(){return this.arr[this.cur++]}}};var Lambda=$hxClasses.Lambda=function(){};Lambda.__name__=!0,Lambda.array=function(e){for(var t=[],a=$iterator(e)();a.hasNext();){var r=a.next();t.push(r)}return t};var List=$hxClasses.List=function(){this.length=0};List.__name__=!0,List.prototype={add:function(e){var t=new _$List_ListNode(e,null);null==this.h?this.h=t:this.q.next=t,this.q=t,this.length++},push:function(e){var t=new _$List_ListNode(e,this.h);this.h=t,null==this.q&&(this.q=t),this.length++},first:function(){return null==this.h?null:this.h.item},iterator:function(){return new _$List_ListIterator(this.h)},__class__:List};var _$List_ListNode=$hxClasses["_List.ListNode"]=function(e,t){this.item=e,this.next=t};_$List_ListNode.__name__=!0,_$List_ListNode.prototype={__class__:_$List_ListNode};var _$List_ListIterator=$hxClasses["_List.ListIterator"]=function(e){this.head=e};_$List_ListIterator.__name__=!0,_$List_ListIterator.prototype={hasNext:function(){return null!=this.head},next:function(){var e=this.head.item;return this.head=this.head.next,e},__class__:_$List_ListIterator};var Main=$hxClasses.Main=function(){};Main.__name__=!0,Main.main=function(){kha_System.init({title:"Empty",width:640,height:480},function(){iron_App.init(Main.ready)})},Main.ready=function(){haxe_Log.trace("SDF: Make tex",{fileName:"Main.hx",lineNumber:17,className:"Main",methodName:"ready"}),iron_Scene.setActive("Scene");iron_data_Data.getMesh("mesh","",null,function(e){var t=e.geom.positions,a=(e.geom.uvs,e.geom.indices[0]);Main.numverts=a.length;for(var r=0|Math.min(Main.numverts,16384),i=1+(Main.numverts/16384|0),s=new haxe_io_BytesOutput,n=0,_=Main.numverts;n<_;){var o=n++;s.writeFloat(t[3*a[o]]),s.writeFloat(t[3*a[o]+1]),s.writeFloat(t[3*a[o]+2]),s.writeFloat(0)}for(var h=Main.numverts,l=r*i*4;h<l;){h++;s.writeFloat(0)}Main.meshtex=kha_Image.fromBytes(s.getBytes(),r,i,kha_graphics4_TextureFormat.RGBA64,kha_graphics4_Usage.StaticUsage),iron_object_Uniforms.externalTextureLinks=[Main.externalTextureLink],iron_object_Uniforms.externalIntLinks=[Main.externalIntLink]})},Main.externalTextureLink=function(e){return"_meshtex"==e?Main.meshtex:null},Main.externalIntLink=funct