uil 4.0.0 → 4.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +2 -5
- package/examples/js/BufferGeometryUtils.js +0 -921
- package/examples/js/SimplexNoise.js +0 -324
- package/examples/js/controls/OrbitControls.js +0 -1215
- package/examples/js/controls/OrbitControls_.js +0 -1042
- package/examples/js/libs/sea3d.min.js +0 -373
- package/examples/js/libs/three.min.js +0 -6
- package/examples/js/math.js +0 -447
- package/examples/js/objects/Landscape.js +0 -778
- package/examples/js/objects/Lensflare.js +0 -372
- package/examples/js/objects/SuperSky.js +0 -297
- package/examples/js/objects/Water.js +0 -329
- package/src/Uil.js +0 -6
- package/src/Uil_dev.js +0 -15
- package/src/core/Gui.js +0 -807
- package/src/core/Proto.js +0 -679
- package/src/core/Roots.js +0 -864
- package/src/core/Tools.js +0 -830
- package/src/core/V2.js +0 -131
- package/src/core/add.js +0 -85
- package/src/polyfills.js +0 -85
- package/src/proto/Bool.js +0 -147
- package/src/proto/Button.js +0 -357
- package/src/proto/Circular.js +0 -230
- package/src/proto/Color.js +0 -411
- package/src/proto/Empty.js +0 -15
- package/src/proto/Fps.js +0 -327
- package/src/proto/Graph.js +0 -310
- package/src/proto/Grid.js +0 -297
- package/src/proto/Group.js +0 -430
- package/src/proto/Item.js +0 -120
- package/src/proto/Joystick.js +0 -241
- package/src/proto/Knob.js +0 -262
- package/src/proto/List.js +0 -789
- package/src/proto/Numeric.js +0 -417
- package/src/proto/Pad2D.js +0 -268
- package/src/proto/Rubric.js +0 -0
- package/src/proto/Select.js +0 -178
- package/src/proto/Selector.js +0 -13
- package/src/proto/Slide.js +0 -267
- package/src/proto/TextInput.js +0 -181
- package/src/proto/Title.js +0 -61
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
'use strict';var THREE,TextDecoder,performance;var SEA3D={VERSION:18110,getVersion:function(){var a=SEA3D.VERSION.toString(),b=a.length;return a.substring(0,b-4)+"."+a.substring(b-4,b-3)+"."+a.substring(b-3,b-2)+"."+parseFloat(a.substring(b-2,b)).toString()}};console.log("SEA3D "+SEA3D.getVersion());SEA3D.Stream=function(a){this.position=0;this.buffer=a||new ArrayBuffer};SEA3D.Stream.NONE=0;SEA3D.Stream.BOOLEAN=1;SEA3D.Stream.BYTE=2;SEA3D.Stream.UBYTE=3;SEA3D.Stream.SHORT=4;SEA3D.Stream.USHORT=5;SEA3D.Stream.INT24=6;SEA3D.Stream.UINT24=7;
|
|
2
|
-
SEA3D.Stream.INT=8;SEA3D.Stream.UINT=9;SEA3D.Stream.FLOAT=10;SEA3D.Stream.DOUBLE=11;SEA3D.Stream.DECIMAL=12;SEA3D.Stream.VECTOR3D=74;SEA3D.Stream.VECTOR4D=106;SEA3D.Stream.STRING_TINY=128;SEA3D.Stream.STRING_SHORT=129;SEA3D.Stream.STRING_LONG=130;SEA3D.Stream.ASSET=200;SEA3D.Stream.GROUP=255;SEA3D.Stream.BLEND_MODE="normal add subtract multiply dividing mix alpha screen darken overlay colorburn linearburn lighten colordodge lineardodge softlight hardlight pinlight spotlight spotlightblend hardmix average difference exclusion hue saturation color value linearlight grainextract reflect glow darkercolor lightercolor phoenix negation".split(" ");
|
|
3
|
-
SEA3D.Stream.INTERPOLATION_TABLE="normal linear sine.in sine.out sine.inout cubic.in cubic.out cubic.inout quint.in quint.out quint.inout circ.in circ.out circ.inout back.in back.out back.inout quad.in quad.out quad.inout quart.in quart.out quart.inout expo.in expo.out expo.inout elastic.in elastic.out elastic.inout bounce.in bounce.out bounce.inout".split(" ");SEA3D.Stream.sizeOf=function(a){return 0==a?0:1<=a&&31>=a?1:32<=a&&63>=a?2:64<=a&&95>=a?3:96<=a&&125>=a?4:-1};
|
|
4
|
-
SEA3D.Stream.prototype={constructor:SEA3D.Stream,set buffer(a){this.buf=a;this.data=new DataView(a)},get buffer(){return this.buf},get bytesAvailable(){return this.length-this.position},get length(){return this.buf.byteLength}};SEA3D.Stream.prototype.getByte=function(a){return this.data.getInt8(a)};SEA3D.Stream.prototype.readBytes=function(a){var b=this.buf.slice(this.position,this.position+a);this.position+=a;return b};SEA3D.Stream.prototype.readByte=function(){return this.data.getInt8(this.position++)};
|
|
5
|
-
SEA3D.Stream.prototype.readUByte=function(){return this.data.getUint8(this.position++)};SEA3D.Stream.prototype.readBool=function(){return 0!=this.data.getInt8(this.position++)};SEA3D.Stream.prototype.readShort=function(){var a=this.data.getInt16(this.position,!0);this.position+=2;return a};SEA3D.Stream.prototype.readUShort=function(){var a=this.data.getUint16(this.position,!0);this.position+=2;return a};
|
|
6
|
-
SEA3D.Stream.prototype.readUInt24=function(){var a=this.data.getUint32(this.position,!0)&16777215;this.position+=3;return a};SEA3D.Stream.prototype.readUInt24F=function(){return this.readUShort()|this.readUByte()<<16};SEA3D.Stream.prototype.readInt=function(){var a=this.data.getInt32(this.position,!0);this.position+=4;return a};SEA3D.Stream.prototype.readUInt=function(){var a=this.data.getUint32(this.position,!0);this.position+=4;return a};
|
|
7
|
-
SEA3D.Stream.prototype.readFloat=function(){var a=this.data.getFloat32(this.position,!0);this.position+=4;return a};SEA3D.Stream.prototype.readUInteger=function(){var a=this.readUByte(),b=a&127;0!=(a&128)&&(a=this.readUByte(),b|=(a&127)<<7,0!=(a&128)&&(a=this.readUByte(),b|=(a&127)<<13));return b};SEA3D.Stream.prototype.readVector2=function(){return{x:this.readFloat(),y:this.readFloat()}};SEA3D.Stream.prototype.readVector3=function(){return{x:this.readFloat(),y:this.readFloat(),z:this.readFloat()}};
|
|
8
|
-
SEA3D.Stream.prototype.readVector4=function(){return{x:this.readFloat(),y:this.readFloat(),z:this.readFloat(),w:this.readFloat()}};
|
|
9
|
-
SEA3D.Stream.prototype.readMatrix=function(){var a=new Float32Array(16);a[0]=this.readFloat();a[1]=this.readFloat();a[2]=this.readFloat();a[3]=0;a[4]=this.readFloat();a[5]=this.readFloat();a[6]=this.readFloat();a[7]=0;a[8]=this.readFloat();a[9]=this.readFloat();a[10]=this.readFloat();a[11]=0;a[12]=this.readFloat();a[13]=this.readFloat();a[14]=this.readFloat();a[15]=1;return a};
|
|
10
|
-
SEA3D.decodeText=function(a){if("undefined"!==typeof TextDecoder)return(new TextDecoder).decode(a);for(var b="",c=0,e=a.length;c<e;c++)b+=String.fromCharCode(a[c]);return decodeURIComponent(escape(b))};SEA3D.extractUrlBase=function(a){a=a.split("/");if(1===a.length)return"./";a.pop();return a.join("/")+"/"};SEA3D.Stream.prototype.readUTF8=function(a){a=this.readBytes(a);return SEA3D.decodeText(new Uint8Array(a))};SEA3D.Stream.prototype.readExt=function(){return this.readUTF8(4).replace(/\0/g,"")};
|
|
11
|
-
SEA3D.Stream.prototype.readUTF8Tiny=function(){return this.readUTF8(this.readUByte())};SEA3D.Stream.prototype.readUTF8Short=function(){return this.readUTF8(this.readUShort())};SEA3D.Stream.prototype.readUTF8Long=function(){return this.readUTF8(this.readUInt())};SEA3D.Stream.prototype.readUByteArray=function(a){var b=new Uint8Array(a);SEA3D.Stream.memcpy(b.buffer,0,this.buffer,this.position,a);this.position+=a;return b};
|
|
12
|
-
SEA3D.Stream.prototype.readUShortArray=function(a){var b=new Uint16Array(a);a*=2;SEA3D.Stream.memcpy(b.buffer,0,this.buffer,this.position,a);this.position+=a;return b};SEA3D.Stream.prototype.readUInt24Array=function(a){for(var b=new Uint32Array(a),c=0;c<a;c++)b[c]=this.readUInt24();return b};SEA3D.Stream.prototype.readUIntArray=function(a){var b=new Uint32Array(a);a*=4;SEA3D.Stream.memcpy(b.buffer,0,this.buffer,this.position,a);this.position+=a;return b};
|
|
13
|
-
SEA3D.Stream.prototype.readFloatArray=function(a){var b=new Float32Array(a);a*=4;SEA3D.Stream.memcpy(b.buffer,0,this.buffer,this.position,a);this.position+=a;return b};SEA3D.Stream.prototype.readBlendMode=function(){return SEA3D.Stream.BLEND_MODE[this.readUByte()]};SEA3D.Stream.prototype.readInterpolation=function(){return SEA3D.Stream.INTERPOLATION_TABLE[this.readUByte()]};
|
|
14
|
-
SEA3D.Stream.prototype.readTags=function(a){for(var b=this.readUByte(),c=0;c<b;++c){var e=this.readUShort(),d=this.readUInt(),f=this.position;a(e,this,d);this.position=f+d}};SEA3D.Stream.prototype.readProperties=function(a){var b=this.readUByte(),c={},e={};c.__type=e;for(var d=0;d<b;d++){var f=this.readUTF8Tiny(),q=this.readUByte();e[f]=q;c[f]=q==SEA3D.Stream.GROUP?this.readProperties(a):this.readToken(q,a)}return c};
|
|
15
|
-
SEA3D.Stream.prototype.readAnimationList=function(a){for(var b=[],c=this.readUByte(),e=0;e<c;){var d=this.readUByte(),f={};f.relative=0!=(d&1);d&2&&(f.timeScale=this.readFloat());f.tag=a.getObject(this.readUInt());b[e++]=f}return b};
|
|
16
|
-
SEA3D.Stream.prototype.readScriptList=function(a){for(var b=[],c=this.readUByte(),e=0;e<c;){var d=this.readUByte(),f={};f.priority=d&1|d&2;if(d&4){var q=this.readUByte();f.params={};for(var l=0;l<q;l++){var s=this.readUTF8Tiny();f.params[s]=this.readObject(a)}}d&8&&(f.method=this.readUTF8Tiny());f.tag=a.getObject(this.readUInt());b[e++]=f}return b};SEA3D.Stream.prototype.readObject=function(a){return this.readToken(this.readUByte(),a)};
|
|
17
|
-
SEA3D.Stream.prototype.readToken=function(a,b){switch(a){case SEA3D.Stream.BOOLEAN:return this.readBool();case SEA3D.Stream.UBYTE:return this.readUByte();case SEA3D.Stream.USHORT:return this.readUShort();case SEA3D.Stream.UINT24:return this.readUInt24();case SEA3D.Stream.INT:return this.readInt();case SEA3D.Stream.UINT:return this.readUInt();case SEA3D.Stream.FLOAT:return this.readFloat();case SEA3D.Stream.VECTOR3D:return this.readVector3();case SEA3D.Stream.VECTOR4D:return this.readVector4();case SEA3D.Stream.STRING_TINY:return this.readUTF8Tiny();
|
|
18
|
-
case SEA3D.Stream.STRING_SHORT:return this.readUTF8Short();case SEA3D.Stream.STRING_LONG:return this.readUTF8Long();case SEA3D.Stream.ASSET:var c=this.readUInt();return 0<c?b.getObject(c-1):null;default:console.error("DataType not found!")}return null};
|
|
19
|
-
SEA3D.Stream.prototype.readVector=function(a,b,c){var e=SEA3D.Stream.sizeOf(a);b=c*e+b*e;switch(a){case SEA3D.Stream.BOOLEAN:return this.readUByteArray(b);case SEA3D.Stream.UBYTE:return this.readUByteArray(b);case SEA3D.Stream.USHORT:return this.readUShortArray(b);case SEA3D.Stream.UINT24:return this.readUInt24Array(b);case SEA3D.Stream.UINT:return this.readUIntArray(b);case SEA3D.Stream.FLOAT:return this.readFloatArray(b);case SEA3D.Stream.VECTOR3D:return this.readFloatArray(b);case SEA3D.Stream.VECTOR4D:return this.readFloatArray(b)}};
|
|
20
|
-
SEA3D.Stream.prototype.append=function(a){var b=new ArrayBuffer(this.data.byteLength+a.byteLength);SEA3D.Stream.memcpy(b,0,this.data.buffer,0,this.data.byteLength);SEA3D.Stream.memcpy(b,this.data.byteLength,a,0,a.byteLength);this.buffer=b};SEA3D.Stream.prototype.concat=function(a,b){return new SEA3D.Stream(this.buffer.slice(a,a+b))};SEA3D.Stream.memcpy=function(a,b,c,e,d){a=new Uint8Array(a,b,d);c=new Uint8Array(c,e,d);a.set(c)};SEA3D.UByteArray=function(){this.ubytes=[];this.length=0};
|
|
21
|
-
SEA3D.UByteArray.prototype={constructor:SEA3D.UByteArray,add:function(a){this.ubytes.push(a);this.length+=a.byteLength},toBuffer:function(){for(var a=new Uint8Array(this.length),b=0,c=0;b<this.ubytes.length;b++)a.set(this.ubytes[b],c),c+=this.ubytes[b].byteLength;return a.buffer}};SEA3D.Math={RAD_TO_DEG:180/Math.PI,DEG_TO_RAD:Math.PI/180};SEA3D.Math.angle=function(a){var b=0>a;a=(b?-a:a)%360;180<a&&(a=-180+(a-180));return b?-a:a};
|
|
22
|
-
SEA3D.Math.angleDiff=function(a,b){a*=this.DEG_TO_RAD;b*=this.DEG_TO_RAD;return Math.atan2(Math.sin(a-b),Math.cos(a-b))*this.RAD_TO_DEG};SEA3D.Math.angleArea=function(a,b,c){return Math.abs(this.angleDiff(a,b))<=c};SEA3D.Math.direction=function(a,b,c,e){return Math.atan2(e-b,c-a)};SEA3D.Math.physicalLerp=function(a,b,c,e){c/=e;1<c&&(c=1);return a+(b-a)*c};SEA3D.Math.physicalAngle=function(a,b,c,e){180<Math.abs(a-b)&&(b=a>b?b+360:b-360);c/=e;1<c&&(c=1);return this.angle(a+(b-a)*c)};
|
|
23
|
-
SEA3D.Math.zero=function(a,b){0>(0>a?-a:a)-(b||0.001)&&(a=0);return a};SEA3D.Math.round=function(a,b){b=Math.pow(10,b);return Math.round(a*b)/b};SEA3D.Math.lerpAngle=function(a,b,c){180<Math.abs(a-b)&&(b=a>b?b+360:b-360);return SEA3D.Math.angle(a+(b-a)*c)};SEA3D.Math.lerpColor=function(a,b,c){var e=a>>24&255,d=a>>16&255,f=a>>8&255;a&=255;d+=((b>>16&255)-d)*c;f+=((b>>8&255)-f)*c;a+=((b&255)-a)*c;return e+((b>>24&255)-e)*c<<24|d<<16|f<<8|a};SEA3D.Math.lerp=function(a,b,c){return a+(b-a)*c};
|
|
24
|
-
SEA3D.Timer=function(){this.time=this.start=Date.now()};SEA3D.Timer.prototype={constructor:SEA3D.Timer,get now(){return Date.now()},get deltaTime(){return Date.now()-this.time},get elapsedTime(){return Date.now()-this.start},update:function(){this.time=Date.now()}};SEA3D.Object=function(a,b,c,e){this.name=a;this.data=b;this.type=c;this.sea3d=e};
|
|
25
|
-
SEA3D.GeometryBase=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.attrib=b.readUShort();this.isBig=0!=(this.attrib&1);b.readVInt=this.isBig?b.readUInt:b.readUShort;this.numVertex=b.readVInt();this.length=3*this.numVertex};
|
|
26
|
-
SEA3D.Geometry=function(a,b,c){SEA3D.GeometryBase.call(this,a,b,c);var e;this.attrib&4&&(this.normal=b.readFloatArray(this.length));this.attrib&8&&(this.tangent=b.readFloatArray(this.length));if(this.attrib&32&&(e=b.readUByte()))for(this.uv=[],c=2*this.numVertex,a=0;a<e;)this.uv[a++]=b.readFloatArray(c);this.attrib&64&&(this.jointPerVertex=b.readUByte(),a=this.numVertex*this.jointPerVertex,this.joint=b.readUShortArray(a),this.weight=b.readFloatArray(a));if(this.attrib&128&&(a=b.readUByte(),c=b.readUByte()))for(this.numColor=
|
|
27
|
-
((a&64)>>6|(a&128)>>6)+1,this.color=[],a=0;a<c;a++)this.color.push(b.readFloatArray(this.numVertex*this.numColor));this.vertex=b.readFloatArray(this.length);var d=b.readUByte();this.groups=[];if(this.attrib&1024){for(c=a=0;a<d;a++)e=3*b.readVInt(),this.groups.push({start:c,count:e}),c+=e;this.attrib&2048||(this.indexes=this.isBig?b.readUIntArray(c):b.readUShortArray(c))}else{var f=this.isBig?4:2,q=new SEA3D.UByteArray;for(e=a=0;a<d;a++)c=3*b.readVInt(),this.groups.push({start:e,count:c}),e+=c,q.add(b.readUByteArray(c*
|
|
28
|
-
f));this.indexes=this.isBig?new Uint32Array(q.toBuffer()):new Uint16Array(q.toBuffer())}};SEA3D.Geometry.prototype=Object.create(SEA3D.GeometryBase.prototype);SEA3D.Geometry.prototype.constructor=SEA3D.Geometry;SEA3D.Geometry.prototype.type="geo";
|
|
29
|
-
SEA3D.Object3D=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.isStatic=!1;this.visible=!0;this.attrib=b.readUShort();this.attrib&1&&(this.parent=c.getObject(b.readUInt()));this.attrib&2&&(this.animations=b.readAnimationList(c));this.attrib&4&&(this.scripts=b.readScriptList(c));this.attrib&16&&(this.attributes=c.getObject(b.readUInt()));this.attrib&32&&(a=b.readUByte(),this.isStatic=0!=(a&1),this.visible=0==(a&2))};SEA3D.Object3D.prototype.readTag=function(a,b,c){};
|
|
30
|
-
SEA3D.Entity3D=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.castShadows=!0;this.attrib&64&&(this.castShadows=0==(b.readUByte()&1))};SEA3D.Entity3D.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Entity3D.prototype.constructor=SEA3D.Entity3D;SEA3D.Sound3D=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.autoPlay=0!=(this.attrib&64);this.attrib&128&&(this.mixer=c.getObject(b.readUInt()));this.sound=c.getObject(b.readUInt());this.volume=b.readFloat()};SEA3D.Sound3D.prototype=Object.create(SEA3D.Object3D.prototype);
|
|
31
|
-
SEA3D.Sound3D.prototype.constructor=SEA3D.Sound3D;SEA3D.SoundPoint=function(a,b,c){SEA3D.Sound3D.call(this,a,b,c);this.position=b.readVector3();this.distance=b.readFloat();b.readTags(this.readTag.bind(this))};SEA3D.SoundPoint.prototype=Object.create(SEA3D.Sound3D.prototype);SEA3D.SoundPoint.prototype.constructor=SEA3D.SoundPoint;SEA3D.SoundPoint.prototype.type="sp";SEA3D.Container3D=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.transform=b.readMatrix();b.readTags(this.readTag.bind(this))};
|
|
32
|
-
SEA3D.Container3D.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Container3D.prototype.constructor=SEA3D.Container3D;SEA3D.Container3D.prototype.type="c3d";SEA3D.ScriptURL=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.url=b.readUTF8(b.length)};SEA3D.ScriptURL.prototype.type="src";SEA3D.TextureURL=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.url=c.config.path+b.readUTF8(b.length)};SEA3D.TextureURL.prototype.type="urlT";
|
|
33
|
-
SEA3D.CubeMapURL=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.faces=[];for(a=0;6>a;a++)this.faces[a]=b.readUTF8Tiny()};SEA3D.CubeMapURL.prototype.type="cURL";
|
|
34
|
-
SEA3D.Actions=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.count=b.readUInt();this.actions=[];for(a=0;a<this.count;a++){var e=b.readUByte(),d=b.readUShort(),f=b.readUShort(),q=b.position,l=this.actions[a]={kind:d};e&1&&(l.range=[b.readUInt(),b.readUInt()]);e&2&&(l.time=b.readUInt());e&4&&(l.intrpl=b.readInterpolation(),0==l.intrpl.indexOf("back.")?l.intrplParam0=b.readFloat():0==l.intrpl.indexOf("elastic.")&&(l.intrplParam0=b.readFloat(),l.intrplParam1=b.readFloat()));switch(d){case SEA3D.Actions.RTT_TARGET:l.source=
|
|
35
|
-
c.getObject(b.readUInt());l.target=c.getObject(b.readUInt());break;case SEA3D.Actions.LOOK_AT:l.source=c.getObject(b.readUInt());l.target=c.getObject(b.readUInt());break;case SEA3D.Actions.PLAY_SOUND:l.sound=c.getObject(b.readUInt());l.offset=b.readUInt();break;case SEA3D.Actions.PLAY_ANIMATION:l.object=c.getObject(b.readUInt());l.name=b.readUTF8Tiny();break;case SEA3D.Actions.FOG:l.color=b.readUInt24();l.min=b.readFloat();l.max=b.readFloat();break;case SEA3D.Actions.ENVIRONMENT:l.texture=c.getObject(b.readUInt());
|
|
36
|
-
break;case SEA3D.Actions.ENVIRONMENT_COLOR:l.color=b.readUInt24F();break;case SEA3D.Actions.CAMERA:l.camera=c.getObject(b.readUInt());break;case SEA3D.Actions.SCRIPTS:l.scripts=b.readScriptList(c);break;case SEA3D.Actions.CLASS_OF:l.classof=c.getObject(b.readUInt());break;case SEA3D.Actions.ATTRIBUTES:l.attributes=c.getObject(b.readUInt());break;default:console.log('Action "'+d+'" not found.')}b.position=q+f}};SEA3D.Actions.SCENE=0;SEA3D.Actions.ENVIRONMENT_COLOR=1;SEA3D.Actions.ENVIRONMENT=2;
|
|
37
|
-
SEA3D.Actions.FOG=3;SEA3D.Actions.PLAY_ANIMATION=4;SEA3D.Actions.PLAY_SOUND=5;SEA3D.Actions.ANIMATION_AUDIO_SYNC=6;SEA3D.Actions.LOOK_AT=7;SEA3D.Actions.RTT_TARGET=8;SEA3D.Actions.CAMERA=9;SEA3D.Actions.SCRIPTS=10;SEA3D.Actions.CLASS_OF=11;SEA3D.Actions.ATTRIBUTES=12;SEA3D.Actions.prototype.type="act";SEA3D.Properties=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.props=b.readProperties(c);this.props.__name=a};SEA3D.Properties.prototype.type="prop";
|
|
38
|
-
SEA3D.FileInfo=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.info=b.readProperties(c);this.info.__name=a;c.info=this.info};SEA3D.FileInfo.prototype.type="info";SEA3D.JavaScript=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.src=b.readUTF8(b.length)};SEA3D.JavaScript.prototype.type="js";SEA3D.JavaScriptMethod=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;a=b.readUShort();this.methods={};for(c=0;c<a;c++){b.readUByte();var e=b.readUTF8Tiny();this.methods[e]={src:b.readUTF8Long()}}};
|
|
39
|
-
SEA3D.JavaScriptMethod.prototype.type="jsm";SEA3D.GLSL=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.src=b.readUTF8(b.length)};SEA3D.GLSL.prototype.type="glsl";SEA3D.Dummy=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.transform=b.readMatrix();this.width=b.readFloat();this.height=b.readFloat();this.depth=b.readFloat();b.readTags(this.readTag.bind(this))};SEA3D.Dummy.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Dummy.prototype.constructor=SEA3D.Dummy;
|
|
40
|
-
SEA3D.Dummy.prototype.type="dmy";SEA3D.Line=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.count=3*(this.attrib&64?b.readUInt():b.readUShort());this.closed=0!=(this.attrib&128);this.transform=b.readMatrix();this.vertex=[];for(a=0;a<this.count;)this.vertex[a++]=b.readFloat();b.readTags(this.readTag.bind(this))};SEA3D.Line.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Line.prototype.constructor=SEA3D.Line;SEA3D.Line.prototype.type="line";
|
|
41
|
-
SEA3D.Sprite=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.attrib&256&&(this.material=c.getObject(b.readUInt()));this.position=b.readVector3();this.width=b.readFloat();this.height=b.readFloat();b.readTags(this.readTag.bind(this))};SEA3D.Sprite.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Sprite.prototype.constructor=SEA3D.Sprite;SEA3D.Sprite.prototype.type="m2d";
|
|
42
|
-
SEA3D.Mesh=function(a,b,c){SEA3D.Entity3D.call(this,a,b,c);if(this.attrib&256)if(this.material=[],a=b.readUByte(),1==a)this.material[0]=c.getObject(b.readUInt());else for(var e=0;e<a;){var d=b.readUInt();0<d?this.material[e++]=c.getObject(d-1):this.material[e++]=void 0}if(this.attrib&512)for(this.modifiers=[],a=b.readUByte(),e=0;e<a;e++)this.modifiers[e]=c.getObject(b.readUInt());this.attrib&1024&&(this.reference={type:b.readUByte(),ref:c.getObject(b.readUInt())});this.transform=b.readMatrix();this.geometry=
|
|
43
|
-
c.getObject(b.readUInt());b.readTags(this.readTag.bind(this))};SEA3D.Mesh.prototype=Object.create(SEA3D.Entity3D.prototype);SEA3D.Mesh.prototype.constructor=SEA3D.Mesh;SEA3D.Mesh.prototype.type="m3d";SEA3D.Skeleton=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;a=b.readUShort();this.joint=[];for(c=0;c<a;c++)this.joint[c]={name:b.readUTF8Tiny(),parentIndex:b.readUShort()-1,inverseBindMatrix:b.readMatrix()}};SEA3D.Skeleton.prototype.type="skl";
|
|
44
|
-
SEA3D.SkeletonLocal=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;a=b.readUShort();this.joint=[];for(c=0;c<a;c++)this.joint[c]={name:b.readUTF8Tiny(),parentIndex:b.readUShort()-1,x:b.readFloat(),y:b.readFloat(),z:b.readFloat(),qx:b.readFloat(),qy:b.readFloat(),qz:b.readFloat(),qw:b.readFloat()}};SEA3D.SkeletonLocal.prototype.type="sklq";
|
|
45
|
-
SEA3D.AnimationBase=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;a=b.readUByte();this.sequence=[];if(a&1)for(a=b.readUShort(),c=0;c<a;c++){var e=b.readUByte();this.sequence[c]={name:b.readUTF8Tiny(),start:b.readUInt(),count:b.readUInt(),repeat:0!=(e&1),intrpl:0==(e&2)}}this.frameRate=b.readUByte();this.numFrames=b.readUInt();0==this.sequence.length&&(this.sequence[0]={name:"root",start:0,count:this.numFrames,repeat:!0,intrpl:!0})};
|
|
46
|
-
SEA3D.Animation=function(a,b,c){SEA3D.AnimationBase.call(this,a,b,c);this.dataList=[];a=0;for(c=b.readUByte();a<c;a++){var e=b.readUShort(),d=b.readUByte(),f=b.readVector(d,this.numFrames,0);this.dataList.push({kind:e,type:d,blockSize:SEA3D.Stream.sizeOf(d),data:f})}};SEA3D.Animation.POSITION=0;SEA3D.Animation.ROTATION=1;SEA3D.Animation.SCALE=2;SEA3D.Animation.COLOR=3;SEA3D.Animation.MULTIPLIER=4;SEA3D.Animation.ATTENUATION_START=5;SEA3D.Animation.ATTENUATION_END=6;SEA3D.Animation.FOV=7;
|
|
47
|
-
SEA3D.Animation.OFFSET_U=8;SEA3D.Animation.OFFSET_V=9;SEA3D.Animation.SCALE_U=10;SEA3D.Animation.SCALE_V=11;SEA3D.Animation.ANGLE=12;SEA3D.Animation.ALPHA=13;SEA3D.Animation.VOLUME=14;SEA3D.Animation.MORPH=250;SEA3D.Animation.prototype=Object.create(SEA3D.AnimationBase.prototype);SEA3D.Animation.prototype.constructor=SEA3D.Animation;SEA3D.Animation.prototype.type="anm";
|
|
48
|
-
SEA3D.SkeletonAnimation=function(a,b,c){SEA3D.AnimationBase.call(this,a,b,c);this.name=a;this.data=b;this.sea3d=c;this.numJoints=b.readUShort();this.raw=b.readFloatArray(this.numFrames*this.numJoints*7)};SEA3D.SkeletonAnimation.prototype.type="skla";SEA3D.UVWAnimation=function(a,b,c){SEA3D.Animation.call(this,a,b,c)};SEA3D.UVWAnimation.prototype.type="auvw";
|
|
49
|
-
SEA3D.Morph=function(a,b,c){SEA3D.GeometryBase.call(this,a,b,c);a=0!=(this.attrib&2);c=0!=(this.attrib&4);var e=b.readUShort();this.node=[];for(var d=0;d<e;d++){var f=b.readUTF8Tiny(),q,l;a&&(q=b.readFloatArray(this.length));c&&(l=b.readFloatArray(this.length));this.node[d]={vertex:q,normal:l,name:f}}};SEA3D.Morph.prototype=Object.create(SEA3D.GeometryBase.prototype);SEA3D.Morph.prototype.constructor=SEA3D.Morph;SEA3D.Morph.prototype.type="mph";
|
|
50
|
-
SEA3D.MorphAnimation=function(a,b,c){SEA3D.AnimationBase.call(this,a,b,c);this.dataList=[];a=0;for(c=b.readUByte();a<c;a++)this.dataList.push({kind:SEA3D.Animation.MORPH,type:SEA3D.Stream.FLOAT,name:b.readUTF8Tiny(),blockSize:1,data:b.readVector(SEA3D.Stream.FLOAT,this.numFrames,0)})};SEA3D.MorphAnimation.prototype.type="mpha";
|
|
51
|
-
SEA3D.VertexAnimation=function(a,b,c){SEA3D.AnimationBase.call(this,a,b,c);c=b.readUByte();this.isBig=0!=(c&1);b.readVInt=this.isBig?b.readUInt:b.readUShort;this.numVertex=b.readVInt();this.length=3*this.numVertex;a=0!=(c&2);c=0!=(c&4);this.frame=[];var e,d,f;for(e=0;e<this.numFrames;e++)a&&(d=b.readFloatArray(this.length)),c&&(f=b.readFloatArray(this.length)),this.frame[e]={vertex:d,normal:f}};SEA3D.VertexAnimation.prototype=Object.create(SEA3D.AnimationBase.prototype);
|
|
52
|
-
SEA3D.VertexAnimation.prototype.constructor=SEA3D.VertexAnimation;SEA3D.VertexAnimation.prototype.type="vtxa";SEA3D.Camera=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.attrib&64&&(this.dof={distance:b.readFloat(),range:b.readFloat()});this.transform=b.readMatrix();this.fov=b.readFloat();b.readTags(this.readTag.bind(this))};SEA3D.Camera.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Camera.prototype.constructor=SEA3D.Camera;SEA3D.Camera.prototype.type="cam";
|
|
53
|
-
SEA3D.OrthographicCamera=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.transform=b.readMatrix();this.height=b.readFloat();b.readTags(this.readTag.bind(this))};SEA3D.OrthographicCamera.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.OrthographicCamera.prototype.constructor=SEA3D.OrthographicCamera;SEA3D.OrthographicCamera.prototype.type="camo";SEA3D.JointObject=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.target=c.getObject(b.readUInt());this.joint=b.readUShort();b.readTags(this.readTag.bind(this))};
|
|
54
|
-
SEA3D.JointObject.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.JointObject.prototype.constructor=SEA3D.JointObject;SEA3D.JointObject.prototype.type="jnt";
|
|
55
|
-
SEA3D.Light=function(a,b,c){SEA3D.Object3D.call(this,a,b,c);this.attenEnd=this.attenStart=Number.MAX_VALUE;this.attrib&64&&(a=b.readUByte(),this.shadow={},this.shadow.opacity=a&1?b.readFloat():1,this.shadow.color=a&2?b.readUInt24():0);this.attrib&512&&(this.attenStart=b.readFloat(),this.attenEnd=b.readFloat());this.color=b.readUInt24();this.multiplier=b.readFloat()};SEA3D.Light.prototype=Object.create(SEA3D.Object3D.prototype);SEA3D.Light.prototype.constructor=SEA3D.Light;
|
|
56
|
-
SEA3D.PointLight=function(a,b,c){SEA3D.Light.call(this,a,b,c);this.attrib&128&&(this.attenuation={start:b.readFloat(),end:b.readFloat()});this.position=b.readVector3();b.readTags(this.readTag.bind(this))};SEA3D.PointLight.prototype=Object.create(SEA3D.Light.prototype);SEA3D.PointLight.prototype.constructor=SEA3D.PointLight;SEA3D.PointLight.prototype.type="plht";
|
|
57
|
-
SEA3D.HemisphereLight=function(a,b,c){SEA3D.Light.call(this,a,b,c);this.attrib&128&&(this.attenuation={start:b.readFloat(),end:b.readFloat()});this.secondColor=b.readUInt24();b.readTags(this.readTag.bind(this))};SEA3D.HemisphereLight.prototype=Object.create(SEA3D.Light.prototype);SEA3D.HemisphereLight.prototype.constructor=SEA3D.HemisphereLight;SEA3D.HemisphereLight.prototype.type="hlht";SEA3D.AmbientLight=function(a,b,c){SEA3D.Light.call(this,a,b,c);b.readTags(this.readTag.bind(this))};
|
|
58
|
-
SEA3D.AmbientLight.prototype=Object.create(SEA3D.Light.prototype);SEA3D.AmbientLight.prototype.constructor=SEA3D.AmbientLight;SEA3D.AmbientLight.prototype.type="alht";SEA3D.DirectionalLight=function(a,b,c){SEA3D.Light.call(this,a,b,c);this.transform=b.readMatrix();b.readTags(this.readTag.bind(this))};SEA3D.DirectionalLight.prototype=Object.create(SEA3D.Light.prototype);SEA3D.DirectionalLight.prototype.constructor=SEA3D.DirectionalLight;SEA3D.DirectionalLight.prototype.type="dlht";
|
|
59
|
-
SEA3D.Material=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.technique=[];this.tecniquesDict={};this.attrib=b.readUShort();this.alpha=1;this.blendMode="normal";this.doubleSided=0!=(this.attrib&1);this.receiveLights=0==(this.attrib&2);this.receiveShadows=0==(this.attrib&4);this.receiveFog=0==(this.attrib&8);this.repeat=0==(this.attrib&16);this.attrib&32&&(this.alpha=b.readFloat());this.attrib&64&&(this.blendMode=b.readBlendMode());this.attrib&128&&(this.animations=b.readAnimationList(c));
|
|
60
|
-
this.depthWrite=0==(this.attrib&256);this.depthTest=0==(this.attrib&512);this.premultipliedAlpha=0!=(this.attrib&1024);a=b.readUByte();for(var e=0;e<a;++e){var d=b.readUShort(),f=b.readUShort(),q=b.position,l,s;switch(d){case SEA3D.Material.PHONG:l={ambientColor:b.readUInt24(),diffuseColor:b.readUInt24(),specularColor:b.readUInt24(),specular:b.readFloat(),gloss:b.readFloat()};break;case SEA3D.Material.PHYSICAL:l={color:b.readUInt24(),roughness:b.readFloat(),metalness:b.readFloat()};break;case SEA3D.Material.ANISOTROPIC:break;
|
|
61
|
-
case SEA3D.Material.COMPOSITE_TEXTURE:l={composite:c.getObject(b.readUInt())};break;case SEA3D.Material.DIFFUSE_MAP:case SEA3D.Material.SPECULAR_MAP:case SEA3D.Material.NORMAL_MAP:case SEA3D.Material.AMBIENT_MAP:case SEA3D.Material.ALPHA_MAP:case SEA3D.Material.EMISSIVE_MAP:case SEA3D.Material.ROUGHNESS_MAP:case SEA3D.Material.METALNESS_MAP:l={texture:c.getObject(b.readUInt())};break;case SEA3D.Material.REFLECTION:case SEA3D.Material.FRESNEL_REFLECTION:l={texture:c.getObject(b.readUInt()),alpha:b.readFloat()};
|
|
62
|
-
d==SEA3D.Material.FRESNEL_REFLECTION&&(l.power=b.readFloat(),l.normal=b.readFloat());break;case SEA3D.Material.REFRACTION:l={texture:c.getObject(b.readUInt()),alpha:b.readFloat(),ior:b.readFloat()};break;case SEA3D.Material.RIM:l={color:b.readUInt24(),strength:b.readFloat(),power:b.readFloat(),blendMode:b.readBlendMode()};break;case SEA3D.Material.LIGHT_MAP:l={texture:c.getObject(b.readUInt()),channel:b.readUByte(),blendMode:b.readBlendMode()};break;case SEA3D.Material.DETAIL_MAP:l={texture:c.getObject(b.readUInt()),
|
|
63
|
-
scale:b.readFloat(),blendMode:b.readBlendMode()};break;case SEA3D.Material.CEL:l={color:b.readUInt24(),levels:b.readUByte(),size:b.readFloat(),specularCutOff:b.readFloat(),smoothness:b.readFloat()};break;case SEA3D.Material.TRANSLUCENT:l={translucency:b.readFloat(),scattering:b.readFloat()};break;case SEA3D.Material.BLEND_NORMAL_MAP:s=b.readUByte();l={texture:c.getObject(b.readUInt()),secondaryTexture:c.getObject(b.readUInt())};s&1?(l.offsetX0=b.readFloat(),l.offsetY0=b.readFloat(),l.offsetX1=b.readFloat(),
|
|
64
|
-
l.offsetY1=b.readFloat()):l.offsetX0=l.offsetY0=l.offsetX1=l.offsetY1=0;l.animate=s&2;break;case SEA3D.Material.MIRROR_REFLECTION:l={texture:c.getObject(b.readUInt()),alpha:b.readFloat()};break;case SEA3D.Material.EMISSIVE:l={color:b.readUInt24F()};break;case SEA3D.Material.VERTEX_COLOR:l={blendMode:b.readBlendMode()};break;case SEA3D.Material.WRAP_LIGHTING:l={color:b.readUInt24(),strength:b.readFloat()};break;case SEA3D.Material.COLOR_REPLACE:s=b.readUByte();l={red:b.readUInt24(),green:b.readUInt24(),
|
|
65
|
-
blue:b.readUInt24F()};s&1&&(l.mask=c.getObject(b.readUInt()));s&2&&(l.alpha=b.readFloat());break;case SEA3D.Material.REFLECTION_SPHERICAL:l={texture:c.getObject(b.readUInt()),alpha:b.readFloat()};break;case SEA3D.Material.REFLECTIVITY:s=b.readUByte();l={strength:b.readFloat()};s&1&&(l.mask=c.getObject(b.readUInt()));break;case SEA3D.Material.CLEAR_COAT:l={strength:b.readFloat(),roughness:b.readFloat()};break;case SEA3D.Material.FLACCIDITY:s=b.readUByte();l={target:c.getObject(b.readUInt()),scale:b.readFloat(),
|
|
66
|
-
spring:b.readFloat(),damping:b.readFloat()};s&1&&(l.mask=c.getObject(b.readUInt()));break;default:console.warn("SEA3D: MaterialTechnique not found:",d.toString(16));b.position=q+f;continue}l.kind=d;this.technique.push(l);this.tecniquesDict[d]=l;b.position=q+f}};SEA3D.Material.PHONG=0;SEA3D.Material.COMPOSITE_TEXTURE=1;SEA3D.Material.DIFFUSE_MAP=2;SEA3D.Material.SPECULAR_MAP=3;SEA3D.Material.REFLECTION=4;SEA3D.Material.REFRACTION=5;SEA3D.Material.NORMAL_MAP=6;SEA3D.Material.FRESNEL_REFLECTION=7;
|
|
67
|
-
SEA3D.Material.RIM=8;SEA3D.Material.LIGHT_MAP=9;SEA3D.Material.DETAIL_MAP=10;SEA3D.Material.CEL=11;SEA3D.Material.TRANSLUCENT=12;SEA3D.Material.BLEND_NORMAL_MAP=13;SEA3D.Material.MIRROR_REFLECTION=14;SEA3D.Material.AMBIENT_MAP=15;SEA3D.Material.ALPHA_MAP=16;SEA3D.Material.EMISSIVE_MAP=17;SEA3D.Material.VERTEX_COLOR=18;SEA3D.Material.WRAP_LIGHTING=19;SEA3D.Material.COLOR_REPLACE=20;SEA3D.Material.REFLECTION_SPHERICAL=21;SEA3D.Material.ANISOTROPIC=22;SEA3D.Material.EMISSIVE=23;
|
|
68
|
-
SEA3D.Material.PHYSICAL=24;SEA3D.Material.ROUGHNESS_MAP=25;SEA3D.Material.METALNESS_MAP=26;SEA3D.Material.REFLECTIVITY=27;SEA3D.Material.CLEAR_COAT=28;SEA3D.Material.FLACCIDITY=29;SEA3D.Material.prototype.type="mat";SEA3D.Composite=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;a=b.readUByte();this.layer=[];for(var e=0;e<a;e++)this.layer[e]=new SEA3D.Composite.prototype.Layer(b,c)};
|
|
69
|
-
SEA3D.Composite.prototype.getLayerByName=function(a){for(var b=0;b<this.layer.length;b++)if(this.layer[b].name==a)return this.layer[b]};SEA3D.Composite.prototype.Layer=function(a,b){var c=a.readUShort();c&1?this.texture=new SEA3D.Composite.LayerBitmap(a,b):this.color=a.readUInt24();c&2&&(this.mask=new SEA3D.Composite.LayerBitmap(a,b));c&4&&(this.name=a.readUTF8Tiny());this.blendMode=c&8?a.readBlendMode():"normal";this.opacity=c&16?a.readFloat():1};
|
|
70
|
-
SEA3D.Composite.LayerBitmap=function(a,b){this.map=b.getObject(a.readUInt());var c=a.readUShort();this.channel=c&1?a.readUByte():0;this.repeat=c&0;this.offsetU=c&4?a.readFloat():0;this.offsetV=c&8?a.readFloat():0;this.scaleU=c&16?a.readFloat():1;this.scaleV=c&32?a.readFloat():1;this.rotation=c&64?a.readFloat():0;c&128&&(this.animation=a.readAnimationList(b))};SEA3D.Composite.prototype.type="ctex";
|
|
71
|
-
SEA3D.PlanarRender=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.attrib=b.readUByte();this.quality=this.attrib&1|this.attrib&2;this.transform=b.readMatrix()};SEA3D.PlanarRender.prototype.type="rttp";SEA3D.CubeRender=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.attrib=b.readUByte();this.quality=this.attrib&1|this.attrib&2;this.position=b.readVector3()};SEA3D.CubeRender.prototype.type="rttc";
|
|
72
|
-
SEA3D.CubeMap=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.transparent=!1;this.extension=b.readExt();this.faces=[];for(a=0;6>a;a++)c=b.readUInt(),this.faces[a]=b.concat(b.position,c),b.position+=c};SEA3D.CubeMap.prototype.type="cmap";SEA3D.JPEG=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.transparent=!1};SEA3D.JPEG.prototype.type="jpg";SEA3D.JPEG_XR=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.transparent=!0};SEA3D.JPEG_XR.prototype.type="wdp";
|
|
73
|
-
SEA3D.PNG=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.transparent=6==b.getByte(25)};SEA3D.PNG.prototype.type="png";SEA3D.GIF=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.transparent=0<b.getByte(11)};SEA3D.GIF.prototype.type="gif";SEA3D.OGG=function(a,b,c){this.name=a;this.data=b;this.sea3d=c};SEA3D.OGG.prototype.type="ogg";SEA3D.MP3=function(a,b,c){this.name=a;this.data=b;this.sea3d=c};SEA3D.MP3.prototype.type="mp3";
|
|
74
|
-
SEA3D.TextureUpdate=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.index=b.readUInt();this.bytes=b.concat(b.position,b.length-b.position)};SEA3D.TextureUpdate.prototype.type="uTex";
|
|
75
|
-
SEA3D.File=function(a){this.config={streaming:!0,timeLimit:60,progressive:!1};a&&(void 0!==a.streaming&&(this.config.streaming=a.streaming),void 0!==a.timeLimit&&(this.config.timeLimit=a.timeLimit),void 0!==a.progressive&&(this.config.progressive=a.progressive),void 0!==a.path&&(this.config.path=a.path));this.version=SEA3D.VERSION;this.objects=[];this.typeClass={};this.typeRead={};this.typeUnique={};this.position=this.dataPosition=0;this.scope=this;this.addClass(SEA3D.FileInfo,!0);this.addClass(SEA3D.Geometry,
|
|
76
|
-
!0);this.addClass(SEA3D.Mesh);this.addClass(SEA3D.Sprite);this.addClass(SEA3D.Material);this.addClass(SEA3D.Composite);this.addClass(SEA3D.PointLight);this.addClass(SEA3D.DirectionalLight);this.addClass(SEA3D.HemisphereLight);this.addClass(SEA3D.AmbientLight);this.addClass(SEA3D.Animation,!0);this.addClass(SEA3D.Skeleton,!0);this.addClass(SEA3D.SkeletonLocal,!0);this.addClass(SEA3D.SkeletonAnimation,!0);this.addClass(SEA3D.UVWAnimation,!0);this.addClass(SEA3D.JointObject);this.addClass(SEA3D.Camera);
|
|
77
|
-
this.addClass(SEA3D.OrthographicCamera);this.addClass(SEA3D.Morph,!0);this.addClass(SEA3D.MorphAnimation,!0);this.addClass(SEA3D.VertexAnimation,!0);this.addClass(SEA3D.CubeMap,!0);this.addClass(SEA3D.Dummy);this.addClass(SEA3D.Line);this.addClass(SEA3D.SoundPoint);this.addClass(SEA3D.PlanarRender);this.addClass(SEA3D.CubeRender);this.addClass(SEA3D.Actions);this.addClass(SEA3D.Container3D);this.addClass(SEA3D.Properties);this.addClass(SEA3D.ScriptURL,!0);this.addClass(SEA3D.TextureURL,!0);this.addClass(SEA3D.CubeMapURL,
|
|
78
|
-
!0);this.addClass(SEA3D.JPEG,!0);this.addClass(SEA3D.JPEG_XR,!0);this.addClass(SEA3D.PNG,!0);this.addClass(SEA3D.GIF,!0);this.addClass(SEA3D.OGG,!0);this.addClass(SEA3D.MP3,!0);this.addClass(SEA3D.JavaScript,!0);this.addClass(SEA3D.JavaScriptMethod,!0);this.addClass(SEA3D.GLSL,!0);this.addClass(SEA3D.TextureUpdate,!0);for(a=SEA3D.File.Extensions.length;a--;)SEA3D.File.Extensions[a].call(this)};SEA3D.File.Extensions=[];SEA3D.File.CompressionLibs={};SEA3D.File.DecompressionMethod={};
|
|
79
|
-
SEA3D.File.setExtension=function(a){SEA3D.File.Extensions.push(a)};SEA3D.File.setDecompressionEngine=function(a,b,c){SEA3D.File.CompressionLibs[a]=b;SEA3D.File.DecompressionMethod[a]=c};SEA3D.File.prototype.addClass=function(a,b){this.typeClass[a.prototype.type]=a;this.typeUnique[a.prototype.type]=!0===b};
|
|
80
|
-
SEA3D.File.prototype.readHead=function(){if(16>this.stream.bytesAvailable)return!1;if("SEA"!=this.stream.readUTF8(3))throw Error("Invalid SEA3D format.");this.sign=this.stream.readUTF8(3);this.version=this.stream.readUInt24();if(0!=this.stream.readUByte())throw Error("Protection algorithm not compatible.");this.compressionID=this.stream.readUByte();this.compressionAlgorithm=SEA3D.File.CompressionLibs[this.compressionID];this.decompressionMethod=SEA3D.File.DecompressionMethod[this.compressionID];if(0<
|
|
81
|
-
this.compressionID&&!this.decompressionMethod)throw Error("Compression algorithm not compatible.");this.length=this.stream.readUInt();this.dataPosition=this.stream.position;this.objects.length=0;this.state=this.readBody;if(this.onHead)this.onHead({file:this,sign:this.sign});return!0};SEA3D.File.prototype.getObject=function(a){return this.objects[a]};SEA3D.File.prototype.getObjectByName=function(a){return this.objects[a]};
|
|
82
|
-
SEA3D.File.prototype.readSEAObject=function(){if(4>this.stream.bytesAvailable)return null;var a=this.stream.readUInt(),b=this.stream.position;if(this.stream.bytesAvailable<a)return null;var c=this.stream.readUByte(),e=this.stream.readExt(),d=null,f=c&1?this.stream.readUTF8Tiny():"",q=0!=(c&2),l=0!=(c&4);c&8&&(d=this.stream.readUShort(),c=this.stream.concat(this.stream.position,d),this.stream.position+=d,q&&this.decompressionMethod&&(c.buffer=this.decompressionMethod(c.buffer)),d=c.readProperties(this));
|
|
83
|
-
a-=this.stream.position-b;b=this.stream.position;c=this.stream.concat(b,a);this.typeClass[e]?(q&&this.decompressionMethod&&(c.buffer=this.decompressionMethod(c.buffer)),q=new this.typeClass[e](f,c,this),(this.config.streaming&&l||this.config.forceStreaming)&&this.typeRead[e]&&this.typeRead[e].call(this.scope,q)):(q=new SEA3D.Object(f,c,e,this),console.warn('SEA3D: Unknown format "'+e+'" of file "'+f+'". Add a module referring for this format.'));q.streaming=l;q.metadata=d;this.objects.push(this.objects[q.name+
|
|
84
|
-
"."+q.type]=q);this.dataPosition=b+a;++this.position;return q};SEA3D.File.prototype.isDone=function(){return this.position==this.length};SEA3D.File.prototype.readBody=function(){this.timer.update();if(!this.resume)return!1;for(;this.position<this.length;)if(this.timer.deltaTime<this.config.timeLimit){this.stream.position=this.dataPosition;var a=this.readSEAObject();if(a)this.dispatchCompleteObject(a);else return!1}else return!1;this.state=this.readComplete;return!0};
|
|
85
|
-
SEA3D.File.prototype.initParse=function(){this.timer=new SEA3D.Timer;this.position=0;this.resume=!0};SEA3D.File.prototype.parse=function(){this.initParse();isFinite(this.config.timeLimit)?requestAnimationFrame(this.parseObject.bind(this)):this.parseObject()};
|
|
86
|
-
SEA3D.File.prototype.parseObject=function(){for(this.timer.update();this.position<this.length&&this.timer.deltaTime<this.config.timeLimit;){var a=this.objects[this.position++],b=a.type;this.typeUnique[b]||delete a.tag;(a.streaming||this.config.forceStreaming)&&this.typeRead[b]&&void 0==a.tag&&this.typeRead[b].call(this.scope,a)}if(this.position==this.length)if(a=this.timer.elapsedTime,b=a+"ms, "+this.objects.length+" objects",this.onParseComplete)this.onParseComplete({file:this,timeTotal:a,message:b});
|
|
87
|
-
else console.log("SEA3D Parse Complete:",b);else{if(this.onParseProgress)this.onParseProgress({file:this,loaded:this.position,total:this.length});setTimeout(this.parseObject.bind(this),10)}};SEA3D.File.prototype.readComplete=function(){this.stream.position=this.dataPosition;6202321!=this.stream.readUInt24F()&&console.warn("SEA3D file is corrupted.");delete this.state;return!1};
|
|
88
|
-
SEA3D.File.prototype.readState=function(){for(;this.state(););this.state?(requestAnimationFrame(this.readState.bind(this)),this.dispatchProgress()):this.dispatchComplete()};SEA3D.File.prototype.append=function(a){this.state?this.stream.append(a):this.read(a)};SEA3D.File.prototype.read=function(a){if(!a)throw Error("No data found.");this.initParse();this.stream=new SEA3D.Stream(a);this.state=this.readHead;this.readState()};
|
|
89
|
-
SEA3D.File.prototype.dispatchCompleteObject=function(a){if(this.onCompleteObject)this.onCompleteObject({file:this,object:a})};SEA3D.File.prototype.dispatchProgress=function(){if(this.onProgress)this.onProgress({file:this,loaded:this.position,total:this.length})};SEA3D.File.prototype.dispatchDownloadProgress=function(a,b){if(this.onDownloadProgress)this.onDownloadProgress({file:this,loaded:a,total:b})};
|
|
90
|
-
SEA3D.File.prototype.dispatchComplete=function(){var a=this.timer.elapsedTime,b=a+"ms, "+this.objects.length+" objects";if(this.onComplete)this.onComplete({file:this,timeTotal:a,message:b});else console.log("SEA3D:",b)};SEA3D.File.prototype.dispatchError=function(a,b){if(this.onError)this.onError({file:this,id:a,message:b});else console.error("SEA3D: #"+a,b)};
|
|
91
|
-
SEA3D.File.prototype.load=function(a){var b=this,c=new XMLHttpRequest;c.open("GET",a,!0);this.config.path||(this.config.path=SEA3D.extractUrlBase(a));if(b.config.progressive){var e=0;c.overrideMimeType("text/plain; charset=x-user-defined")}else c.responseType="arraybuffer";c.onprogress=function(a){if(b.config.progressive){for(var f=c.responseText.substring(e),q=new Uint8Array(f.length),l=0;l<f.length;l++)q[l]=f.charCodeAt(l)&255;e+=f.length;b.append(q.buffer)}b.dispatchDownloadProgress(a.loaded,a.total)};
|
|
92
|
-
b.config.progressive||(c.onreadystatechange=function(){4===c.readyState&&(200===c.status||0===c.status?b.read(this.response):this.dispatchError(1001,"Couldn't load ["+a+"] ["+c.status+"]"))});c.send()};SEA3D.LZMA=function(){var a=a||{};a.OutWindow=function(){this._windowSize=0};a.OutWindow.prototype.create=function(a){this._buffer&&this._windowSize===a||(this._buffer=[]);this._windowSize=a;this._streamPos=this._pos=0};a.OutWindow.prototype.flush=function(){var a=this._pos-this._streamPos;if(0!==a){for(;a--;)this._stream.writeByte(this._buffer[this._streamPos++]);this._pos>=this._windowSize&&(this._pos=0);this._streamPos=this._pos}};a.OutWindow.prototype.releaseStream=function(){this.flush();this._stream=
|
|
93
|
-
null};a.OutWindow.prototype.setStream=function(a){this.releaseStream();this._stream=a};a.OutWindow.prototype.init=function(a){a||(this._pos=this._streamPos=0)};a.OutWindow.prototype.copyBlock=function(a,c){var e=this._pos-a-1;for(0>e&&(e+=this._windowSize);c--;)e>=this._windowSize&&(e=0),this._buffer[this._pos++]=this._buffer[e++],this._pos>=this._windowSize&&this.flush()};a.OutWindow.prototype.putByte=function(a){this._buffer[this._pos++]=a;this._pos>=this._windowSize&&this.flush()};a.OutWindow.prototype.getByte=
|
|
94
|
-
function(a){a=this._pos-a-1;0>a&&(a+=this._windowSize);return this._buffer[a]};a.RangeDecoder=function(){};a.RangeDecoder.prototype.setStream=function(a){this._stream=a};a.RangeDecoder.prototype.releaseStream=function(){this._stream=null};a.RangeDecoder.prototype.init=function(){var a=5;this._code=0;for(this._range=-1;a--;)this._code=this._code<<8|this._stream.readByte()};a.RangeDecoder.prototype.decodeDirectBits=function(a){for(var c=0,e;a--;)this._range>>>=1,e=this._code-this._range>>>31,this._code-=
|
|
95
|
-
this._range&e-1,c=c<<1|1-e,0===(this._range&4278190080)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8);return c};a.RangeDecoder.prototype.decodeBit=function(a,c){var e=a[c],d=(this._range>>>11)*e;if((this._code^2147483648)<(d^2147483648))return this._range=d,a[c]+=2048-e>>>5,0===(this._range&4278190080)&&(this._code=this._code<<8|this._stream.readByte(),this._range<<=8),0;this._range-=d;this._code-=d;a[c]-=e>>>5;0===(this._range&4278190080)&&(this._code=this._code<<8|this._stream.readByte(),
|
|
96
|
-
this._range<<=8);return 1};a.initBitModels=function(a,c){for(;c--;)a[c]=1024};a.BitTreeDecoder=function(a){this._models=[];this._numBitLevels=a};a.BitTreeDecoder.prototype.init=function(){a.initBitModels(this._models,1<<this._numBitLevels)};a.BitTreeDecoder.prototype.decode=function(a){for(var c=1,e=this._numBitLevels;e--;)c=c<<1|a.decodeBit(this._models,c);return c-(1<<this._numBitLevels)};a.BitTreeDecoder.prototype.reverseDecode=function(a){for(var c=1,e=0,d=0,f;d<this._numBitLevels;++d)f=a.decodeBit(this._models,
|
|
97
|
-
c),c=c<<1|f,e|=f<<d;return e};a.reverseDecode2=function(a,c,e,d){for(var f=1,q=0,l=0,s;l<d;++l)s=e.decodeBit(a,c+f),f=f<<1|s,q|=s<<l;return q};a.LenDecoder=function(){this._choice=[];this._lowCoder=[];this._midCoder=[];this._highCoder=new a.BitTreeDecoder(8);this._numPosStates=0};a.LenDecoder.prototype.create=function(b){for(;this._numPosStates<b;++this._numPosStates)this._lowCoder[this._numPosStates]=new a.BitTreeDecoder(3),this._midCoder[this._numPosStates]=new a.BitTreeDecoder(3)};a.LenDecoder.prototype.init=
|
|
98
|
-
function(){var b=this._numPosStates;for(a.initBitModels(this._choice,2);b--;)this._lowCoder[b].init(),this._midCoder[b].init();this._highCoder.init()};a.LenDecoder.prototype.decode=function(a,c){return 0===a.decodeBit(this._choice,0)?this._lowCoder[c].decode(a):0===a.decodeBit(this._choice,1)?8+this._midCoder[c].decode(a):16+this._highCoder.decode(a)};a.Decoder2=function(){this._decoders=[]};a.Decoder2.prototype.init=function(){a.initBitModels(this._decoders,768)};a.Decoder2.prototype.decodeNormal=
|
|
99
|
-
function(a){var c=1;do c=c<<1|a.decodeBit(this._decoders,c);while(256>c);return c&255};a.Decoder2.prototype.decodeWithMatchByte=function(a,c){var e=1,d,f;do if(d=c>>7&1,c<<=1,f=a.decodeBit(this._decoders,(1+d<<8)+e),e=e<<1|f,d!==f){for(;256>e;)e=e<<1|a.decodeBit(this._decoders,e);break}while(256>e);return e&255};a.LiteralDecoder=function(){};a.LiteralDecoder.prototype.create=function(b,c){var e;if(!this._coders||this._numPrevBits!==c||this._numPosBits!==b)for(this._numPosBits=b,this._posMask=(1<<
|
|
100
|
-
b)-1,this._numPrevBits=c,this._coders=[],e=1<<this._numPrevBits+this._numPosBits;e--;)this._coders[e]=new a.Decoder2};a.LiteralDecoder.prototype.init=function(){for(var a=1<<this._numPrevBits+this._numPosBits;a--;)this._coders[a].init()};a.LiteralDecoder.prototype.getDecoder=function(a,c){return this._coders[((a&this._posMask)<<this._numPrevBits)+((c&255)>>>8-this._numPrevBits)]};a.Decoder=function(){this._outWindow=new a.OutWindow;this._rangeDecoder=new a.RangeDecoder;this._isMatchDecoders=[];this._isRepDecoders=
|
|
101
|
-
[];this._isRepG0Decoders=[];this._isRepG1Decoders=[];this._isRepG2Decoders=[];this._isRep0LongDecoders=[];this._posSlotDecoder=[];this._posDecoders=[];this._posAlignDecoder=new a.BitTreeDecoder(4);this._lenDecoder=new a.LenDecoder;this._repLenDecoder=new a.LenDecoder;this._literalDecoder=new a.LiteralDecoder;this._dictionarySizeCheck=this._dictionarySize=-1;this._posSlotDecoder[0]=new a.BitTreeDecoder(6);this._posSlotDecoder[1]=new a.BitTreeDecoder(6);this._posSlotDecoder[2]=new a.BitTreeDecoder(6);
|
|
102
|
-
this._posSlotDecoder[3]=new a.BitTreeDecoder(6)};a.Decoder.prototype.setDictionarySize=function(a){if(0>a)return!1;this._dictionarySize!==a&&(this._dictionarySize=a,this._dictionarySizeCheck=Math.max(this._dictionarySize,1),this._outWindow.create(Math.max(this._dictionarySizeCheck,4096)));return!0};a.Decoder.prototype.setLcLpPb=function(a,c,e){var d=1<<e;if(8<a||4<c||4<e)return!1;this._literalDecoder.create(c,a);this._lenDecoder.create(d);this._repLenDecoder.create(d);this._posStateMask=d-1;return!0};
|
|
103
|
-
a.Decoder.prototype.init=function(){var b=4;this._outWindow.init(!1);a.initBitModels(this._isMatchDecoders,192);a.initBitModels(this._isRep0LongDecoders,192);a.initBitModels(this._isRepDecoders,12);a.initBitModels(this._isRepG0Decoders,12);a.initBitModels(this._isRepG1Decoders,12);a.initBitModels(this._isRepG2Decoders,12);a.initBitModels(this._posDecoders,114);for(this._literalDecoder.init();b--;)this._posSlotDecoder[b].init();this._lenDecoder.init();this._repLenDecoder.init();this._posAlignDecoder.init();
|
|
104
|
-
this._rangeDecoder.init()};a.Decoder.prototype.decode=function(b,c,e){var d=0,f=0,q=0,l=0,s=0,u=0,n=0;this._rangeDecoder.setStream(b);this._outWindow.setStream(c);for(this.init();0>e||u<e;)if(b=u&this._posStateMask,0===this._rangeDecoder.decodeBit(this._isMatchDecoders,(d<<4)+b))n=this._literalDecoder.getDecoder(u++,n),n=7<=d?n.decodeWithMatchByte(this._rangeDecoder,this._outWindow.getByte(f)):n.decodeNormal(this._rangeDecoder),this._outWindow.putByte(n),d=4>d?0:d-(10>d?3:6);else{if(1===this._rangeDecoder.decodeBit(this._isRepDecoders,
|
|
105
|
-
d))n=0,0===this._rangeDecoder.decodeBit(this._isRepG0Decoders,d)?0===this._rangeDecoder.decodeBit(this._isRep0LongDecoders,(d<<4)+b)&&(d=7>d?9:11,n=1):(0===this._rangeDecoder.decodeBit(this._isRepG1Decoders,d)?c=q:(0===this._rangeDecoder.decodeBit(this._isRepG2Decoders,d)?c=l:(c=s,s=l),l=q),q=f,f=c),0===n&&(n=2+this._repLenDecoder.decode(this._rangeDecoder,b),d=7>d?8:11);else if(s=l,l=q,q=f,n=2+this._lenDecoder.decode(this._rangeDecoder,b),d=7>d?7:10,b=this._posSlotDecoder[5>=n?n-2:3].decode(this._rangeDecoder),
|
|
106
|
-
4<=b)if(c=(b>>1)-1,f=(2|b&1)<<c,14>b)f+=a.reverseDecode2(this._posDecoders,f-b-1,this._rangeDecoder,c);else{if(f+=this._rangeDecoder.decodeDirectBits(c-4)<<4,f+=this._posAlignDecoder.reverseDecode(this._rangeDecoder),0>f){if(-1===f)break;return!1}}else f=b;if(f>=u||f>=this._dictionarySizeCheck)return!1;this._outWindow.copyBlock(f,n);u+=n;n=this._outWindow.getByte(0)}this._outWindow.flush();this._outWindow.releaseStream();this._rangeDecoder.releaseStream();return!0};a.Decoder.prototype.setDecoderProperties=
|
|
107
|
-
function(a){var c,e;if(5>a.size)return!1;c=a.readByte();e=c%9;c=~~(c/9);if(!this.setLcLpPb(e,c%5,~~(c/5)))return!1;c=a.readByte();c|=a.readByte()<<8;c|=a.readByte()<<16;c+=16777216*a.readByte();return this.setDictionarySize(c)};a.decompress=function(b,c,e,d){var f=new a.Decoder;if(!f.setDecoderProperties(b))throw"Incorrect stream properties";if(!f.decode(c,e,d))throw"Error in data stream";return!0};a.decompressFile=function(b,c){var e=new a.Decoder,d;if(!e.setDecoderProperties(b))throw"Incorrect stream properties";
|
|
108
|
-
d=b.readByte();d|=b.readByte()<<8;d|=b.readByte()<<16;d+=16777216*b.readByte();b.readByte();b.readByte();b.readByte();b.readByte();if(!e.decode(b,c,d))throw"Error in data stream";return!0};return a}();SEA3D.File.LZMAUncompress=function(a){a=new Uint8Array(a);var b={data:[],position:0,writeByte:function(a){this.data[this.position++]=a}};SEA3D.LZMA.decompressFile({data:a,position:0,readByte:function(){return this.data[this.position++]}},b);return(new Uint8Array(b.data)).buffer};
|
|
109
|
-
SEA3D.File.setDecompressionEngine(2,"lzma",SEA3D.File.LZMAUncompress);THREE.SEA3D=function(a){this.config={id:"",scripts:!0,runScripts:!0,autoPlay:!1,dummys:!0,multiplier:1,bounding:!0,audioRolloffFactor:10,lights:!0,useEnvironment:!0,useVertexTexture:!0,forceStatic:!1,streaming:!0,async:!0,paths:{},timeLimit:10};a&&this.loadConfig(a)};void 0===THREE.Float32BufferAttribute&&(THREE.Float32BufferAttribute=THREE.Float32Attribute);THREE.SEA3D.useMultiMaterial=THREE.MultiMaterial.prototype.isMultiMaterial;THREE.SEA3D.MTXBUF=new THREE.Matrix4;THREE.SEA3D.VECBUF=new THREE.Vector3;
|
|
110
|
-
THREE.SEA3D.QUABUF=new THREE.Quaternion;THREE.SEA3D.BACKGROUND_COLOR=3355443;THREE.SEA3D.HELPER_COLOR=10140133;THREE.SEA3D.RTT_SIZE=512;THREE.SEA3D.identityMatrixScale=function(){var a=new THREE.Vector3;return function(b){a.setFromMatrixScale(b);return b.scale(a.set(1/a.x,1/a.y,1/a.z))}}();
|
|
111
|
-
THREE.SEA3D.prototype=Object.assign(Object.create(THREE.EventDispatcher.prototype),{constructor:THREE.SEA3D,setShadowMap:function(a){a.shadow.mapSize.width=2048;a.shadow.mapSize.height=1024;a.castShadow=!0;a.shadow.camera.left=-200;a.shadow.camera.right=200;a.shadow.camera.top=200;a.shadow.camera.bottom=-200;a.shadow.camera.near=1;a.shadow.camera.far=3E3;a.shadow.camera.fov=45;a.shadow.bias=-0.001}});
|
|
112
|
-
Object.defineProperties(THREE.SEA3D.prototype,{container:{set:function(a){this.config.container=a},get:function(){return this.config.container}},elapsedTime:{get:function(){return this.file.timer.elapsedTime}}});THREE.SEA3D.Domain=function(a,b,c){this.id=a;this.objects=b;this.container=c;this.sources=[];this.local={};this.scriptTargets=[];this.events=new THREE.EventDispatcher};THREE.SEA3D.Domain.global={};
|
|
113
|
-
THREE.SEA3D.Domain.prototype=Object.assign(Object.create(THREE.EventDispatcher.prototype),{constructor:THREE.SEA3D.Domain,add:function(a){this.sources.push(a)},remove:function(a){this.sources.splice(this.sources.indexOf(a),1)},contains:function(a){return-1!=this.sources.indexOf(a)},addEventListener:function(a,b){this.events.addEventListener(a,b)},hasEventListener:function(a,b){return this.events.hasEventListener(a,b)},removeEventListener:function(a,b){this.events.removeEventListener(a,b)},print:function(){console.log.apply(console,
|
|
114
|
-
arguments)},watch:function(){console.log.apply(console,"watch:",arguments)},runScripts:function(){for(var a=0;a<this.scriptTargets.length;a++)this.runJSMList(this.scriptTargets[a])},runJSMList:function(a){for(var b=a.scripts,c=0;c<b.length;c++)this.runJSM(a,b[c]);return b},runJSM:function(a,b){var c={print:this.print,watch:this.watch,sea3d:this,scene:this.container,source:new THREE.SEA3D.ScriptDomain(this,a instanceof THREE.SEA3D.Domain)};Object.freeze(c.source);THREE.SEA3D.ScriptHandler.add(c.source);
|
|
115
|
-
try{this.methods[b.method](c,this.getReference,THREE.SEA3D.Domain.global,this.local,a,b.params)}catch(e){console.error('SEA3D JavaScript: Error running method "'+b.method+'".'),console.error(e)}},getReference:function(a){return eval(a)},disposeList:function(a){if(a&&a.length){a=a.concat();for(var b=a.length;b--;)a[b].dispose()}},dispatchEvent:function(a){a.domain=this;for(var b=this.sources.concat(),c=b.length;c--;)b[c].dispatchEvent(a);this.events.dispatchEvent(a)},dispose:function(){for(this.disposeList(this.sources);this.container.children.length;)this.container.remove(this.container.children[0]);
|
|
116
|
-
for(var a=THREE.SEA3D.EXTENSIONS_DOMAIN.length;a--;){var b=THREE.SEA3D.EXTENSIONS_DOMAIN[a];b.dispose&&b.dispose.call(this)}this.disposeList(this.materials);this.disposeList(this.dummys);this.dispatchEvent({type:"dispose"})}});THREE.SEA3D.DomainManager=function(a){this.domains=[];this.autoDisposeRootDomain=void 0!==a?a:!0};
|
|
117
|
-
Object.assign(THREE.SEA3D.DomainManager.prototype,{onDisposeDomain:function(a){this.remove(a.domain);this.autoDisposeRootDomain&&1==this.domains.length&&this.dispose()},add:function(a){this._onDisposeDomain=this._onDisposeDomain||this.onDisposeDomain.bind(this);a.on("dispose",this._onDisposeDomain);this.domains.push(a);this.textures=this.textures||a.textures;this.cubemaps=this.cubemaps||a.cubemaps;this.geometries=this.geometries||a.geometries},remove:function(a){a.removeEvent("dispose",this._onDisposeDomain);
|
|
118
|
-
this.domains.splice(this.domains.indexOf(a),1)},contains:function(a){return-1!=this.domains.indexOf(a)},disposeList:function(a){if(a&&a.length){a=a.concat();for(var b=a.length;b--;)a[b].dispose()}},dispose:function(){this.disposeList(this.domains);this.disposeList(this.textures);this.disposeList(this.cubemaps);this.disposeList(this.geometries)}});
|
|
119
|
-
THREE.SEA3D.ScriptDomain=function(a,b){a=a||new THREE.SEA3D.Domain;a.add(this);var c=new THREE.EventDispatcher;this.getId=function(){return a.id};this.isRoot=function(){return b};this.addEventListener=function(a,b){c.addEventListener(a,b)};this.hasEventListener=function(a,b){return c.hasEventListener(a,b)};this.removeEventListener=function(a,b){c.removeEventListener(a,b)};this.dispatchEvent=function(a){a.script=this;c.dispatchEvent(a)};this.dispose=function(){a.remove(this);b&&a.dispose();this.dispatchEvent({type:"dispose"})}};
|
|
120
|
-
THREE.SEA3D.ScriptManager=function(){this.scripts=[];var a=function(a){this.remove(a.script)}.bind(this);this.add=function(b){b.addEventListener("dispose",a);this.scripts.push(b)};this.remove=function(b){b.removeEventListener("dispose",a);this.scripts.splice(this.scripts.indexOf(b),1)};this.contains=function(a){return-1<this.scripts.indexOf(a)};this.dispatchEvent=function(a){for(var c=this.scripts.concat(),e=c.length;e--;)c[e].dispatchEvent(a)}};THREE.SEA3D.ScriptHandler=new THREE.SEA3D.ScriptManager;
|
|
121
|
-
THREE.SEA3D.ScriptHandler.dispatchUpdate=function(a){this.dispatchEvent({type:"update",delta:a})};THREE.SEA3D.AnimationClip=function(a,b,c,e){THREE.AnimationClip.call(this,a,b,c);this.repeat=void 0!==e?e:!0};THREE.SEA3D.AnimationClip.fromClip=function(a,b){return new THREE.SEA3D.AnimationClip(a.name,a.duration,a.tracks,b)};THREE.SEA3D.AnimationClip.prototype=Object.assign(Object.create(THREE.AnimationClip.prototype),{constructor:THREE.SEA3D.AnimationClip});
|
|
122
|
-
THREE.SEA3D.Animation=function(a,b){this.clip=a;this.timeScale=void 0!==b?b:1};THREE.SEA3D.Animation.COMPLETE="animationComplete";THREE.SEA3D.Animation.prototype=Object.assign(Object.create(THREE.EventDispatcher.prototype),{constructor:THREE.SEA3D.Animation,onComplete:function(a){this.dispatchEvent({type:THREE.SEA3D.Animation.COMPLETE,target:this})}});
|
|
123
|
-
Object.defineProperties(THREE.SEA3D.Animation.prototype,{name:{get:function(){return this.clip.name}},repeat:{get:function(){return this.clip.repeat}},duration:{get:function(){return this.clip.duration}},mixer:{set:function(a){this.mx&&(this.mx.uncacheClip(this.clip),delete this.mx);a&&(this.mx=a,this.mx.clipAction(this.clip))},get:function(){return this.mx}}});THREE.SEA3D.Animator=function(a,b){this.updateAnimations(a,b);this.clone=function(a){return(new this.constructor(this.clips,new THREE.AnimationMixer(a))).copyFrom(this)}.bind(this)};
|
|
124
|
-
Object.assign(THREE.SEA3D.Animator.prototype,{update:function(a){this.mixer.update(a||0);if(this.currentAnimationAction&&this.currentAnimationAction.paused&&(this.pause(),this.currentAnimation))this.currentAnimation.onComplete(this);return this},updateAnimations:function(a,b){this.playing&&this.stop();this.mixer&&THREE.SEA3D.AnimationHandler.remove(this);this.mixer=b;this.paused=this.playing=this.relative=!1;this.timeScale=1;this.animations=[];this.animation={};this.clips=[];if(a)for(var c=0;c<a.length;c++)this.addAnimation(a[c]);
|
|
125
|
-
return this},addAnimation:function(a){a instanceof THREE.AnimationClip&&(this.clips.push(a),a=new THREE.SEA3D.Animation(a));this.animations.push(a);this.animation[a.name]=a;a.mixer=this.mixer;return a},removeAnimation:function(a){a instanceof THREE.AnimationClip&&(a=this.getAnimationByClip(a));this.clips.splice(this.clips.indexOf(a.clip),1);delete this.animation[a.name];this.animations.splice(this.animations.indexOf(a),1);a.mixer=null;return a},getAnimationByClip:function(a){for(var b=0;b<this.animations.length;b++)if(this.animations[b].clip===
|
|
126
|
-
a)return a},getAnimationByName:function(a){return"number"===typeof a?this.animations[a]:this.animation[a]},setAnimationWeight:function(a,b){this.mixer.clipAction(this.getAnimationByName(a).clip).setEffectiveWeight(b)},getAnimationWeight:function(a){return this.mixer.clipAction(this.getAnimationByName(a).clip).getEffectiveWeight()},pause:function(){this.playing&&this.currentAnimation&&(THREE.SEA3D.AnimationHandler.remove(this),this.playing=!1);return this},resume:function(){!this.playing&&this.currentAnimation&&
|
|
127
|
-
(THREE.SEA3D.AnimationHandler.add(this),this.playing=!0);return this},setTimeScale:function(a){this.timeScale=a;this.currentAnimationAction&&this.updateTimeScale();return this},getTimeScale:function(){return this.timeScale},updateTimeScale:function(){this.currentAnimationAction.setEffectiveTimeScale(this.timeScale*(this.currentAnimation?this.currentAnimation.timeScale:1));return this},play:function(a,b,c,e){var d=this.getAnimationByName(a);if(!d)throw Error('Animation "'+a+'" not found.');if(d==this.currentAnimation)return void 0===
|
|
128
|
-
c&&d.repeat||(this.currentAnimationAction.time=void 0!==c?c:0<=this.currentAnimationAction.timeScale?0:this.currentAnimation.duration),this.currentAnimationAction.setEffectiveWeight(void 0!==e?e:1),this.currentAnimationAction.paused=!1,this.resume();this.previousAnimation=this.currentAnimation;this.currentAnimation=d;this.previousAnimationAction=this.currentAnimationAction;this.currentAnimationAction=this.mixer.clipAction(d.clip).setLoop(d.repeat?THREE.LoopRepeat:THREE.LoopOnce,Infinity).reset();
|
|
129
|
-
this.currentAnimationAction.clampWhenFinished=!d.repeat;this.currentAnimationAction.paused=!1;this.updateTimeScale();void 0===c&&d.repeat||(this.currentAnimationAction.time=void 0!==c?c:0<=this.currentAnimationAction.timeScale?0:this.currentAnimation.duration);this.currentAnimationAction.setEffectiveWeight(void 0!==e?e:1);this.currentAnimationAction.play();this.playing||this.mixer.update(0);this.playing=!0;this.previousAnimation&&this.previousAnimationAction.crossFadeTo(this.currentAnimationAction,
|
|
130
|
-
b||0,!1);THREE.SEA3D.AnimationHandler.add(this);return this},stop:function(){this.playing&&THREE.SEA3D.AnimationHandler.remove(this);this.currentAnimation&&(this.currentAnimationAction.stop(),this.previousAnimation=this.currentAnimation,this.previousAnimationAction=this.currentAnimationAction,delete this.currentAnimationAction,delete this.currentAnimation,this.playing=!1);return this},playw:function(a,b){this.playing||this.paused||THREE.SEA3D.AnimationHandler.add(this);var c=this.getAnimationByName(a);
|
|
131
|
-
this.playing=!0;var e=this.mixer.clipAction(c.clip);e.setLoop(c.repeat?THREE.LoopRepeat:THREE.LoopOnce,Infinity).reset();e.clampWhenFinished=!c.repeat;e.paused=!1;e.setEffectiveWeight(b).play();return e},crossFade:function(a,b,c,e){this.mixer.stopAllAction();a=this.playw(a,1);b=this.playw(b,1);a.crossFadeTo(b,c,void 0!==e?e:!1);return this},stopAll:function(){this.stop().mixer.stopAllAction();this.playing=!1;return this},unPauseAll:function(){this.mixer.timeScale=1;this.playing=!0;this.paused=!1;
|
|
132
|
-
return this},pauseAll:function(){this.mixer.timeScale=0;this.playing=!1;this.paused=!0;return this},setRelative:function(a){if(this.relative!=a)return this.stop(),this.relative=a,this},getRelative:function(){return this.relative},copyFrom:function(a){for(var b=0;b<this.animations.length;b++)this.animations[b].timeScale=a.animations[b].timeScale;return this}});
|
|
133
|
-
THREE.SEA3D.Object3DAnimator=function(a,b){this.object3d=b;THREE.SEA3D.Animator.call(this,a,new THREE.AnimationMixer(b));this.clone=function(a){return(new this.constructor(this.clips,a)).copyFrom(this)}.bind(this)};
|
|
134
|
-
THREE.SEA3D.Object3DAnimator.prototype=Object.assign(Object.create(THREE.SEA3D.Animator.prototype),{constructor:THREE.SEA3D.Object3DAnimator,stop:function(){if(this.currentAnimation){var a=this.object3d.animate;a&&this instanceof THREE.SEA3D.Object3DAnimator&&(a.position.set(0,0,0),a.quaternion.set(0,0,0,1),a.scale.set(1,1,1))}THREE.SEA3D.Animator.prototype.stop.call(this)},setRelative:function(a){THREE.SEA3D.Animator.prototype.setRelative.call(this,a);this.object3d.setAnimator(this.relative);this.updateAnimations(this.clips,
|
|
135
|
-
new THREE.AnimationMixer(this.relative?this.object3d.animate:this.object3d))}});THREE.SEA3D.CameraAnimator=function(a,b){THREE.SEA3D.Object3DAnimator.call(this,a,b)};THREE.SEA3D.CameraAnimator.prototype=Object.assign(Object.create(THREE.SEA3D.Object3DAnimator.prototype),{constructor:THREE.SEA3D.CameraAnimator});THREE.SEA3D.SoundAnimator=function(a,b){THREE.SEA3D.Object3DAnimator.call(this,a,b)};
|
|
136
|
-
THREE.SEA3D.SoundAnimator.prototype=Object.assign(Object.create(THREE.SEA3D.Object3DAnimator.prototype),{constructor:THREE.SEA3D.SoundAnimator});THREE.SEA3D.LightAnimator=function(a,b){THREE.SEA3D.Object3DAnimator.call(this,a,b)};THREE.SEA3D.LightAnimator.prototype=Object.assign(Object.create(THREE.SEA3D.Object3DAnimator.prototype),{constructor:THREE.SEA3D.LightAnimator});THREE.SEA3D.Object3D=function(){THREE.Object3D.call(this)};
|
|
137
|
-
THREE.SEA3D.Object3D.prototype=Object.assign(Object.create(THREE.Object3D.prototype),{constructor:THREE.SEA3D.Object3D,updateAnimateMatrix:function(a){!0===this.matrixAutoUpdate&&this.updateMatrix();if(!0===this.matrixWorldNeedsUpdate||!0===a)null===this.parent?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix),this.animate.updateMatrix(),this.matrixWorld.multiplyMatrices(this.matrixWorld,this.animate.matrix),this.matrixWorldNeedsUpdate=!1,a=
|
|
138
|
-
!0;for(var b=0,c=this.children.length;b<c;b++)this.children[b].updateMatrixWorld(a)},setAnimator:function(a){this.getAnimator()!=a&&(a?(this.animate=new THREE.Object3D,this.updateMatrixWorld=THREE.SEA3D.Object3D.prototype.updateAnimateMatrix):(delete this.animate,this.updateMatrixWorld=THREE.Object3D.prototype.updateMatrixWorld),this.matrixWorldNeedsUpdate=!0)},getAnimator:function(){return void 0!=this.animate},copy:function(a){THREE.Object3D.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=
|
|
139
|
-
a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.Dummy=function(a,b,c){this.width=void 0!=a?a:100;this.height=void 0!=b?b:100;this.depth=void 0!=c?c:100;a=new THREE.BoxGeometry(this.width,this.height,this.depth,1,1,1);a.computeBoundingBox();a.computeBoundingSphere();THREE.Mesh.call(this,a,THREE.SEA3D.Dummy.MATERIAL)};THREE.SEA3D.Dummy.MATERIAL=new THREE.MeshBasicMaterial({wireframe:!0,color:THREE.SEA3D.HELPER_COLOR});
|
|
140
|
-
THREE.SEA3D.Dummy.prototype=Object.assign(Object.create(THREE.Mesh.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.Dummy,copy:function(a){THREE.Mesh.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this},dispose:function(){this.geometry.dispose()}});THREE.SEA3D.Mesh=function(a,b){THREE.Mesh.call(this,a,b)};
|
|
141
|
-
THREE.SEA3D.Mesh.prototype=Object.assign(Object.create(THREE.Mesh.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.Mesh,setWeight:function(a,b){this.morphTargetInfluences["number"===typeof a?a:this.morphTargetDictionary[a]]=b},getWeight:function(a){return this.morphTargetInfluences["number"===typeof a?a:this.morphTargetDictionary[a]]},copy:function(a){THREE.Mesh.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));
|
|
142
|
-
return this}});THREE.SEA3D.SkinnedMesh=function(a,b,c){THREE.SkinnedMesh.call(this,a,b,c);this.updateAnimations(a.animations,new THREE.AnimationMixer(this))};
|
|
143
|
-
THREE.SEA3D.SkinnedMesh.prototype=Object.assign(Object.create(THREE.SkinnedMesh.prototype),THREE.SEA3D.Mesh.prototype,THREE.SEA3D.Animator.prototype,{constructor:THREE.SEA3D.SkinnedMesh,boneByName:function(a){for(var b=this.skeleton.bones,c=0,e=b.length;c<e;c++)if(a==b[c].name)return b[c]},copy:function(a){THREE.SkinnedMesh.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});
|
|
144
|
-
THREE.SEA3D.VertexAnimationMesh=function(a,b){THREE.Mesh.call(this,a,b);this.type="MorphAnimMesh";this.updateAnimations(a.animations,new THREE.AnimationMixer(this))};
|
|
145
|
-
THREE.SEA3D.VertexAnimationMesh.prototype=Object.assign(Object.create(THREE.Mesh.prototype),THREE.SEA3D.Mesh.prototype,THREE.SEA3D.Animator.prototype,{constructor:THREE.SEA3D.VertexAnimationMesh,copy:function(a){THREE.Mesh.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.Camera=function(a,b,c,e){THREE.PerspectiveCamera.call(this,a,b,c,e)};
|
|
146
|
-
THREE.SEA3D.Camera.prototype=Object.assign(Object.create(THREE.PerspectiveCamera.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.Camera,copy:function(a){THREE.PerspectiveCamera.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.OrthographicCamera=function(a,b,c,e,d,f){THREE.OrthographicCamera.call(this,a,b,c,e,d,f)};
|
|
147
|
-
THREE.SEA3D.OrthographicCamera.prototype=Object.assign(Object.create(THREE.OrthographicCamera.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.OrthographicCamera,copy:function(a){THREE.OrthographicCamera.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.PointLight=function(a,b,c,e){THREE.PointLight.call(this,a,b,c,e)};
|
|
148
|
-
THREE.SEA3D.PointLight.prototype=Object.assign(Object.create(THREE.PointLight.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.PointLight,copy:function(a){THREE.PointLight.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});THREE.SEA3D.PointSound=function(a,b){THREE.PositionalAudio.call(this,a);this.setSound(b)};
|
|
149
|
-
THREE.SEA3D.PointSound.prototype=Object.assign(Object.create(THREE.PositionalAudio.prototype),THREE.SEA3D.Object3D.prototype,{constructor:THREE.SEA3D.PointSound,setSound:function(a){(this.sound=a)&&(a.buffer?this.setBuffer(a.buffer):a.addEventListener("complete",function(b){this.setBuffer(a.buffer)}.bind(this)));return this},copy:function(a){THREE.PositionalAudio.prototype.copy.call(this,a);this.attribs=a.attribs;this.scripts=a.scripts;a.animator&&(this.animator=a.animator.clone(this));return this}});
|
|
150
|
-
THREE.SEA3D.AnimationHandler={animators:[],update:function(a){for(var b=0;b<this.animators.length;)this.animators[b++].update(a)},add:function(a){-1===this.animators.indexOf(a)&&this.animators.push(a)},remove:function(a){a=this.animators.indexOf(a);-1!==a&&this.animators.splice(a,1)}};THREE.SEA3D.Sound=function(a){this.uuid=THREE.Math.generateUUID();this.src=a;(new THREE.AudioLoader).load(a,function(a){this.buffer=a;this.dispatchEvent({type:"complete"})}.bind(this))};
|
|
151
|
-
THREE.SEA3D.Sound.prototype=Object.assign(Object.create(THREE.EventDispatcher.prototype),{constructor:THREE.SEA3D.Sound});THREE.SEA3D.Domain.prototype.getMesh=THREE.SEA3D.prototype.getMesh=function(a){return this.objects["m3d/"+a]};THREE.SEA3D.Domain.prototype.getDummy=THREE.SEA3D.prototype.getDummy=function(a){return this.objects["dmy/"+a]};THREE.SEA3D.Domain.prototype.getLine=THREE.SEA3D.prototype.getLine=function(a){return this.objects["line/"+a]};
|
|
152
|
-
THREE.SEA3D.Domain.prototype.getSound3D=THREE.SEA3D.prototype.getSound3D=function(a){return this.objects["sn3d/"+a]};THREE.SEA3D.Domain.prototype.getMaterial=THREE.SEA3D.prototype.getMaterial=function(a){return this.objects["mat/"+a]};THREE.SEA3D.Domain.prototype.getLight=THREE.SEA3D.prototype.getLight=function(a){return this.objects["lht/"+a]};THREE.SEA3D.Domain.prototype.getGLSL=THREE.SEA3D.prototype.getGLSL=function(a){return this.objects["glsl/"+a]};
|
|
153
|
-
THREE.SEA3D.Domain.prototype.getCamera=THREE.SEA3D.prototype.getCamera=function(a){return this.objects["cam/"+a]};THREE.SEA3D.Domain.prototype.getTexture=THREE.SEA3D.prototype.getTexture=function(a){return this.objects["tex/"+a]};THREE.SEA3D.Domain.prototype.getCubeMap=THREE.SEA3D.prototype.getCubeMap=function(a){return this.objects["cmap/"+a]};THREE.SEA3D.Domain.prototype.getJointObject=THREE.SEA3D.prototype.getJointObject=function(a){return this.objects["jnt/"+a]};
|
|
154
|
-
THREE.SEA3D.Domain.prototype.getContainer3D=THREE.SEA3D.prototype.getContainer3D=function(a){return this.objects["c3d/"+a]};THREE.SEA3D.Domain.prototype.getSprite=THREE.SEA3D.prototype.getSprite=function(a){return this.objects["m2d/"+a]};THREE.SEA3D.Domain.prototype.getProperties=THREE.SEA3D.prototype.getProperties=function(a){return this.objects["prop/"+a]};THREE.SEA3D.prototype.isPowerOfTwo=function(a){return a?(a&-a)==a:!1};
|
|
155
|
-
THREE.SEA3D.prototype.nearestPowerOfTwo=function(a){return Math.pow(2,Math.round(Math.log(a)/Math.LN2))};THREE.SEA3D.prototype.updateTransform=function(a,b){var c=THREE.SEA3D.MTXBUF;b.transform?c.fromArray(b.transform):c.makeTranslation(b.position.x,b.position.y,b.position.z);a.position.setFromMatrixPosition(c);a.scale.setFromMatrixScale(c);a.rotation.setFromRotationMatrix(THREE.SEA3D.identityMatrixScale(c));if(this.config.forceStatic||b.isStatic)a.updateMatrix(),a.matrixAutoUpdate=!1};
|
|
156
|
-
THREE.SEA3D.prototype.toVector3=function(a){return new THREE.Vector3(a.x,a.y,a.z)};THREE.SEA3D.prototype.toFaces=function(a){var b=[];b[0]=a[1];b[1]=a[0];b[2]=a[3];b[3]=a[2];b[4]=a[5];b[5]=a[4];return b};THREE.SEA3D.prototype.updateScene=function(){if(void 0!=this.materials)for(var a=0,b=this.materials.length;a<b;++a)this.materials[a].needsUpdate=!0};
|
|
157
|
-
THREE.SEA3D.prototype.addSceneObject=function(a,b){b=b||a.tag;b.visible=a.visible;a.parent?a.parent.tag.add(b):this.config.container&&this.config.container.add(b);a.attributes&&(b.attribs=a.attributes.tag);a.scripts&&(b.scripts=this.getJSMList(b,a.scripts),this.config.scripts&&this.config.runScripts&&this.domain.runJSMList(b))};THREE.SEA3D.prototype.createObjectURL=function(a,b){return(window.URL||window.webkitURL).createObjectURL(new Blob([a],{type:b}))};
|
|
158
|
-
THREE.SEA3D.prototype.parsePath=function(a){var b=this.config.paths,c;for(c in b)a=a.replace(RegExp("%"+c+"%","g"),b[c]);return a};
|
|
159
|
-
THREE.SEA3D.prototype.addDefaultAnimation=function(a,b){for(var c=a.tag,e=0,d=a.animations?a.animations.length:0;e<d;e++){var f=a.animations[e];switch(f.tag.type){case SEA3D.Animation.prototype.type:return e=f.tag.tag||this.getModifier({sea:f.tag,scope:c,relative:f.relative}),c.animator=new b(e,c),c.animator.setRelative(f.relative),this.config.autoPlay&&c.animator.play(0),c.animator}}};
|
|
160
|
-
THREE.SEA3D.prototype.readGeometryBuffer=function(a){for(var b=a.tag||new THREE.BufferGeometry,c=0;c<a.groups.length;c++){var e=a.groups[c];b.addGroup(e.start,e.count,c)}a.indexes&&b.setIndex(new THREE.BufferAttribute(a.indexes,1));b.setAttribute("position",new THREE.BufferAttribute(a.vertex,3));a.uv&&(b.setAttribute("uv",new THREE.BufferAttribute(a.uv[0],2)),1<a.uv.length&&b.setAttribute("uv2",new THREE.BufferAttribute(a.uv[1],2)));a.normal?b.setAttribute("normal",new THREE.BufferAttribute(a.normal,
|
|
161
|
-
3)):b.computeVertexNormals();a.tangent4&&b.setAttribute("tangent",new THREE.BufferAttribute(a.tangent4,4));a.color&&b.setAttribute("color",new THREE.BufferAttribute(a.color[0],a.numColor));a.joint&&(b.setAttribute("skinIndex",new THREE.Float32BufferAttribute(a.joint,a.jointPerVertex)),b.setAttribute("skinWeight",new THREE.Float32BufferAttribute(a.weight,a.jointPerVertex)));this.config.bounding&&(b.computeBoundingBox(),b.computeBoundingSphere());b.name=a.name;this.domain.geometries=this.geometries=
|
|
162
|
-
this.geometries||[];this.geometries.push(this.objects["geo/"+a.name]=a.tag=b)};THREE.SEA3D.prototype.readDummy=function(a){var b=new THREE.SEA3D.Dummy(a.width,a.height,a.depth);b.name=a.name;this.domain.dummys=this.dummys=this.dummys||[];this.dummys.push(this.objects["dmy/"+a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,a);this.addDefaultAnimation(a,THREE.SEA3D.Object3DAnimator)};
|
|
163
|
-
THREE.SEA3D.prototype.readLine=function(a){var b=new THREE.BufferGeometry;a.closed&&a.vertex.push(a.vertex[0],a.vertex[1],a.vertex[2]);b.setAttribute("position",new THREE.Float32BufferAttribute(a.vertex,3));b=new THREE.Line(b,new THREE.LineBasicMaterial({color:THREE.SEA3D.HELPER_COLOR,linewidth:3}));b.name=a.name;this.lines=this.lines||[];this.lines.push(this.objects["line/"+a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,a);this.addDefaultAnimation(a,THREE.SEA3D.Object3DAnimator)};
|
|
164
|
-
THREE.SEA3D.prototype.readContainer3D=function(a){var b=new THREE.SEA3D.Object3D;this.domain.containers=this.containers=this.containers||[];this.containers.push(this.objects["c3d/"+a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,a);this.addDefaultAnimation(a,THREE.SEA3D.Object3DAnimator)};
|
|
165
|
-
THREE.SEA3D.prototype.readSprite=function(a){var b;if(a.material)if(a.material.tag.sprite)b=a.material.tag.sprite;else{b=a.material.tag.sprite=new THREE.SpriteMaterial;this.setBlending(b,a.blendMode);var c=a.material.tag.map;c&&(c.flipY=!0,b.map=c);b.color.set(a.material.tag.color);b.opacity=a.material.tag.opacity;b.fog=a.material.receiveFog}b=new THREE.Sprite(b);b.name=a.name;this.domain.sprites=this.sprites=this.sprites||[];this.sprites.push(this.objects["m2d/"+a.name]=a.tag=b);this.addSceneObject(a);
|
|
166
|
-
this.updateTransform(b,a);b.scale.set(a.width,a.height,1)};
|
|
167
|
-
THREE.SEA3D.prototype.readMesh=function(a){var b,c,e=a.geometry.tag,d,f,q,l,s,u,n;b=0;for(c=a.modifiers?a.modifiers.length:0;b<c;b++){var h=a.modifiers[b];switch(h.type){case SEA3D.Skeleton.prototype.type:case SEA3D.SkeletonLocal.prototype.type:f=h;e.bones=f.tag;break;case SEA3D.Morph.prototype.type:q=h.tag||this.getModifier({sea:h,geometry:a.geometry}),e.morphAttributes=q.attribs,e.morphTargets=q.targets}}b=0;for(c=a.animations?a.animations.length:0;b<c;b++)switch(h=a.animations[b].tag,h.type){case SEA3D.SkeletonAnimation.prototype.type:l=
|
|
168
|
-
h;e.animations=l.tag||this.getModifier({sea:l,skeleton:f,relative:!0});break;case SEA3D.VertexAnimation.prototype.type:s=h;e.morphAttributes=s.tag.attribs;e.morphTargets=s.tag.targets;e.animations=s.tag.animations;break;case SEA3D.UVWAnimation.prototype.type:u=h.tag||this.getModifier({sea:h});break;case SEA3D.MorphAnimation.prototype.type:n=h.tag||this.getModifier({sea:h})}c=void 0!=q||void 0!=s;q=q&&void 0!=q.attribs.normal||s&&void 0!=s.tag.attribs.normal;if(a.material)if(1<a.material.length){d=
|
|
169
|
-
[];for(b=0;b<a.material.length;b++)d[b]=a.material[b].tag,d[b].skinning=void 0!=f,d[b].morphTargets=c,d[b].morphNormals=q,d[b].vertexColors=a.geometry.color?THREE.VertexColors:THREE.NoColors;d=THREE.SEA3D.useMultiMaterial?new THREE.MultiMaterial(d):d}else d=a.material[0].tag,d.skinning=void 0!=f,d.morphTargets=c,d.morphNormals=q,d.vertexColors=a.geometry.color?THREE.VertexColors:THREE.NoColors;f?(b=new THREE.SEA3D.SkinnedMesh(e,d,this.config.useVertexTexture),this.config.autoPlay&&l&&b.play(0)):s?
|
|
170
|
-
(b=new THREE.SEA3D.VertexAnimationMesh(e,d),this.config.autoPlay&&b.play(0)):b=new THREE.SEA3D.Mesh(e,d);u&&(b.uvwAnimator=new THREE.SEA3D.Animator(u,new THREE.AnimationMixer(d.map)),this.config.autoPlay&&b.uvwAnimator.play(0));n&&(b.morphAnimator=new THREE.SEA3D.Animator(n,new THREE.AnimationMixer(b)),this.config.autoPlay&&b.morphAnimator.play(0));b.name=a.name;b.castShadow=a.castShadows;b.receiveShadow=a.material?a.material[0].receiveShadows:!0;this.domain.meshes=this.meshes=this.meshes||[];this.meshes.push(this.objects["m3d/"+
|
|
171
|
-
a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,a);this.addDefaultAnimation(a,THREE.SEA3D.Object3DAnimator)};
|
|
172
|
-
THREE.SEA3D.prototype.readSoundPoint=function(a){this.audioListener||(this.audioListener=new THREE.AudioListener,this.config.container&&this.config.container.add(this.audioListener));var b=new THREE.SEA3D.PointSound(this.audioListener);b.autoplay=a.autoPlay;b.setLoop(a.autoPlay);b.setVolume(a.volume);b.setRefDistance(a.distance);b.setRolloffFactor(this.config.audioRolloffFactor);b.setSound(a.sound.tag);b.name=a.name;this.domain.sounds3d=this.sounds3d=this.sounds3d||[];this.sounds3d.push(this.objects["sn3d/"+
|
|
173
|
-
a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,a);this.addDefaultAnimation(a,THREE.SEA3D.SoundAnimator)};THREE.SEA3D.prototype.readCubeRender=function(a){var b=new THREE.CubeCamera(0.1,5E3,THREE.SEA3D.RTT_SIZE);b.renderTarget.cubeCamera=b;a.tag=b.renderTarget;this.domain.cubeRenderers=this.cubeRenderers=this.cubeRenderers||[];this.cubeRenderers.push(this.objects["rttc/"+a.name]=b);this.addSceneObject(a,b);this.updateTransform(b,a)};
|
|
174
|
-
THREE.SEA3D.prototype.readTexture=function(a){var b=new Image,c=new THREE.Texture;c.name=a.name;c.wrapS=c.wrapT=THREE.RepeatWrapping;c.flipY=!1;c.image=b;void 0!==this.config.anisotropy&&(c.anisotropy=this.config.anisotropy);b.onload=function(){c.needsUpdate=!0};b.src=this.createObjectURL(a.data.buffer,"image/"+a.type);this.domain.textures=this.textures=this.textures||[];this.textures.push(this.objects["tex/"+a.name]=a.tag=c)};
|
|
175
|
-
THREE.SEA3D.prototype.readCubeMap=function(a){var b=this.toFaces(a.faces),c=new THREE.CubeTexture([]),e=0;c.name=a.name;c.flipY=!1;c.format=THREE.RGBFormat;for(var d=function(){6==++e&&(c.needsUpdate=!0,this.config.async||(this.file.resume=!0))}.bind(this),f=0;f<b.length;++f){var q=new Image;q.onload=d;q.src=this.createObjectURL(b[f].buffer,"image/"+a.extension);c.images[f]=q}this.config.async||(this.file.resume=!1);this.domain.cubemaps=this.cubemaps=this.cubemaps||[];this.cubemaps.push(this.objects["cmap/"+
|
|
176
|
-
a.name]=a.tag=c)};THREE.SEA3D.prototype.readTextureUpdate=function(a){var b=this.file.objects[a.index],c=b.tag,e=new Image;e.onload=function(){c.image=e;c.needsUpdate=!0};e.src=this.createObjectURL(a.bytes.buffer,"image/"+b.type)};THREE.SEA3D.prototype.readSound=function(a){var b=new THREE.SEA3D.Sound(this.createObjectURL(a.data.buffer,"audio/"+a.type));b.name=a.name;this.domain.sounds=this.sounds=this.sounds||[];this.sounds.push(this.objects["snd/"+a.name]=a.tag=b)};
|
|
177
|
-
THREE.SEA3D.prototype.readScriptURL=function(a){this.file.resume=!1;(new THREE.FileLoader).setResponseType("text").load(a.url,function(b){this.file.resume=!0;this.domain.scripts=this.scripts=this.scripts||[];this.scripts.push(this.objects["src/"+a.name]=a.tag=b)}.bind(this))};
|
|
178
|
-
THREE.SEA3D.prototype.readTextureURL=function(a){var b=(new THREE.TextureLoader).load(this.parsePath(a.url));b.name=a.name;b.wrapS=b.wrapT=THREE.RepeatWrapping;b.flipY=!1;void 0!==this.config.anisotropy&&(b.anisotropy=this.config.anisotropy);this.domain.textures=this.textures=this.textures||[];this.textures.push(this.objects["tex/"+a.name]=a.tag=b)};
|
|
179
|
-
THREE.SEA3D.prototype.readCubeMapURL=function(a){for(var b=this.toFaces(a.faces),c=0;c<b.length;c++)b[c]=this.parsePath(b[c]);if("hdr"==b[0].substr(-3)){var e=null!=THREE.PMREMGenerator;this.file.resume=!e;b=(new THREE.HDRCubeTextureLoader).load(THREE.UnsignedByteType,b,function(b){if(e){var c=new THREE.PMREMGenerator(b);c.update(this.config.renderer);c=new THREE.PMREMCubeUVPacker(c.cubeLods);c.update(this.config.renderer);b.dispose();this.objects["cmap/"+a.name]=a.tag=c.CubeUVRenderTarget.texture;
|
|
180
|
-
this.file.resume=!0}}.bind(this))}else b=(new THREE.CubeTextureLoader).load(b);b.name=a.name;b.wrapS=b.wrapT=THREE.RepeatWrapping;b.flipY=!1;void 0!==this.config.anisotropy&&(b.anisotropy=this.config.anisotropy);this.domain.cubemaps=this.cubemaps=this.cubemaps||[];this.cubemaps.push(this.objects["cmap/"+a.name]=a.tag=b)};
|
|
181
|
-
THREE.SEA3D.prototype.getJSMList=function(a,b){for(var c=[],e=0;e<b.length;e++){var d=b[e];d.tag.type==SEA3D.JavaScriptMethod.prototype.type&&c.push(d)}this.domain.scriptTargets=this.scriptTargets=this.scriptTargets||[];this.scriptTargets.push(a);return c};
|
|
182
|
-
THREE.SEA3D.prototype.readJavaScriptMethod=function(a){try{var b="(function() {\nvar $METHOD = {}\n",c='function($INC, $REF, global, local, self, $PARAM) {\nvar watch = $INC["watch"],\nscene = $INC["scene"],\nsea3d = $INC["sea3d"],\nprint = $INC["print"];\n',c=c+'var $SRC = $INC["source"],\naddEventListener = $SRC.addEventListener.bind( $SRC ),\nhasEventListener = $SRC.hasEventListener.bind( $SRC ),\nremoveEventListener = $SRC.removeEventListener.bind( $SRC ),\ndispatchEvent = $SRC.dispatchEvent.bind( $SRC ),\ndispose = $SRC.dispose.bind( $SRC );\n',
|
|
183
|
-
e;for(e in a.methods)b+='$METHOD["'+e+'"] = '+c+a.methods[e].src+"}\n";this.domain.methods=eval(b+"return $METHOD; })")()}catch(d){console.error('SEA3D JavaScriptMethod: Error running "'+a.name+'".'),console.error(d)}};THREE.SEA3D.prototype.readGLSL=function(a){this.domain.glsl=this.glsl=this.glsl||[];this.glsl.push(this.objects["glsl/"+a.name]=a.tag=a.src)};
|
|
184
|
-
THREE.SEA3D.prototype.materialTechnique=function(){var a={onComplete:function(a,c){if(1>c.alpha||a.blending>THREE.NormalBlending)a.opacity=c.alpha,a.transparent=!0}};a[SEA3D.Material.PHYSICAL]=function(a,c){a.color.setHex(c.color);a.roughness=c.roughness;a.metalness=c.metalness};a[SEA3D.Material.REFLECTIVITY]=function(a,c){a.reflectivity=c.strength};a[SEA3D.Material.CLEAR_COAT]=function(a,c){a.clearCoat=c.strength;a.clearCoatRoughness=c.roughness};a[SEA3D.Material.PHONG]=function(a,c){a.color.setHex(c.diffuseColor);
|
|
185
|
-
a.specular.setHex(c.specularColor).multiplyScalar(c.specular);a.shininess=c.gloss};a[SEA3D.Material.DIFFUSE_MAP]=function(a,c,e){a.map=c.texture.tag;a.color.setHex(16777215);a.map.wrapS=a.map.wrapT=e.repeat?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping;c.texture.transparent&&(a.transparent=!0)};a[SEA3D.Material.ROUGHNESS_MAP]=function(a,c){a.roughnessMap=c.texture.tag};a[SEA3D.Material.METALNESS_MAP]=function(a,c){a.metalnessMap=c.texture.tag};a[SEA3D.Material.SPECULAR_MAP]=function(a,c){a.specular&&
|
|
186
|
-
(a.specularMap=c.texture.tag,a.specular.setHex(16777215))};a[SEA3D.Material.NORMAL_MAP]=function(a,c){a.normalMap=c.texture.tag};a[SEA3D.Material.REFLECTION]=a[SEA3D.Material.FRESNEL_REFLECTION]=function(a,c){a.envMap=c.texture.tag;a.envMap.mapping=THREE.CubeReflectionMapping;a.combine=THREE.MixOperation;a.reflectivity=c.alpha};a[SEA3D.Material.REFLECTION_SPHERICAL]=function(a,c){a.envMap=c.texture.tag;a.envMap.mapping=THREE.SphericalReflectionMapping;a.combine=THREE.MixOperation;a.reflectivity=c.alpha};
|
|
187
|
-
a[SEA3D.Material.REFRACTION_MAP]=function(a,c){a.envMap=c.texture.tag;a.envMap.mapping=THREE.CubeRefractionMapping;a.refractionRatio=c.ior;a.reflectivity=c.alpha};a[SEA3D.Material.LIGHT_MAP]=function(a,c){"multiply"==c.blendMode?a.aoMap=c.texture.tag:a.lightMap=c.texture.tag};a[SEA3D.Material.EMISSIVE]=function(a,c){a.emissive.setHex(c.color)};a[SEA3D.Material.EMISSIVE_MAP]=function(a,c){a.emissiveMap=c.texture.tag};a[SEA3D.Material.ALPHA_MAP]=function(a,c,e){a.alphaMap=c.texture.tag;a.transparent=
|
|
188
|
-
!0;a.alphaMap.wrapS=a.alphaMap.wrapT=e.repeat?THREE.RepeatWrapping:THREE.ClampToEdgeWrapping};return a}();THREE.SEA3D.prototype.createMaterial=function(a){return a.tecniquesDict[SEA3D.Material.REFLECTIVITY]||a.tecniquesDict[SEA3D.Material.CLEAR_COAT]?new THREE.MeshPhysicalMaterial:a.tecniquesDict[SEA3D.Material.PHYSICAL]?new THREE.MeshStandardMaterial:new THREE.MeshPhongMaterial};
|
|
189
|
-
THREE.SEA3D.prototype.setBlending=function(a,b){if("normal"!==b){switch(b){case "add":a.blending=THREE.AdditiveBlending;break;case "subtract":a.blending=THREE.SubtractiveBlending;break;case "multiply":a.blending=THREE.MultiplyBlending;break;case "screen":a.blending=THREE.CustomBlending,a.blendSrc=THREE.OneFactor,a.blendDst=THREE.OneMinusSrcColorFactor,a.blendEquation=THREE.AddEquation}a.transparent=!0}};
|
|
190
|
-
THREE.SEA3D.prototype.readMaterial=function(a){var b=this.createMaterial(a);b.name=a.name;b.lights=a.receiveLights;b.fog=a.receiveFog;b.depthWrite=a.depthWrite;b.depthTest=a.depthTest;b.premultipliedAlpha=a.premultipliedAlpha;b.side=a.doubleSided?THREE.DoubleSide:THREE.FrontSide;this.setBlending(b,a.blendMode);for(var c=0;c<a.technique.length;c++){var e=a.technique[c];this.materialTechnique[e.kind]&&this.materialTechnique[e.kind].call(this,b,e,a)}this.materialTechnique.onComplete&&this.materialTechnique.onComplete.call(this,
|
|
191
|
-
b,a);this.domain.materials=this.materials=this.materials||[];this.materials.push(this.objects["mat/"+a.name]=a.tag=b)};
|
|
192
|
-
THREE.SEA3D.prototype.readPointLight=function(a){var b=new THREE.SEA3D.PointLight(a.color,a.multiplier*this.config.multiplier);b.name=a.name;a.attenuation&&(b.distance=a.attenuation.end);a.shadow&&this.setShadowMap(b);this.domain.lights=this.lights=this.lights||[];this.lights.push(this.objects["lht/"+a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,a);this.addDefaultAnimation(a,THREE.SEA3D.LightAnimator);this.updateScene()};
|
|
193
|
-
THREE.SEA3D.prototype.readHemisphereLight=function(a){var b=new THREE.HemisphereLight(a.color,a.secondColor,a.multiplier*this.config.multiplier);b.position.set(0,500,0);b.name=a.name;this.domain.lights=this.lights=this.lights||[];this.lights.push(this.objects["lht/"+a.name]=a.tag=b);this.addSceneObject(a);this.addDefaultAnimation(a,THREE.SEA3D.LightAnimator);this.updateScene()};
|
|
194
|
-
THREE.SEA3D.prototype.readAmbientLight=function(a){var b=new THREE.AmbientLight(a.color,a.multiplier*this.config.multiplier);b.name=a.name;this.domain.lights=this.lights=this.lights||[];this.lights.push(this.objects["lht/"+a.name]=a.tag=b);this.addSceneObject(a);this.addDefaultAnimation(a,THREE.SEA3D.LightAnimator);this.updateScene()};
|
|
195
|
-
THREE.SEA3D.prototype.readDirectionalLight=function(a){var b=new THREE.DirectionalLight(a.color,a.multiplier*this.config.multiplier);b.name=a.name;a.shadow&&this.setShadowMap(b);this.domain.lights=this.lights=this.lights||[];this.lights.push(this.objects["lht/"+a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,a);this.addDefaultAnimation(a,THREE.SEA3D.LightAnimator);this.updateScene()};
|
|
196
|
-
THREE.SEA3D.prototype.readCamera=function(a){var b=new THREE.SEA3D.Camera(a.fov);b.name=a.name;this.domain.cameras=this.cameras=this.cameras||[];this.cameras.push(this.objects["cam/"+a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,a);this.addDefaultAnimation(a,THREE.SEA3D.CameraAnimator)};
|
|
197
|
-
THREE.SEA3D.prototype.readOrthographicCamera=function(a){var b,c;c=void 0!==this.config.stageWidth?this.config.stageWidth:window?window.innerWidth:1024;var e=void 0!==this.config.stageHeight?this.config.stageHeight:window?window.innerHeight:1024;c>e?(b=c/e*a.height,c=a.height):(b=a.height,c=e/c*a.height);b=new THREE.SEA3D.OrthographicCamera(-b,b,c,-c);b.name=a.name;this.domain.cameras=this.cameras=this.cameras||[];this.cameras.push(this.objects["cam/"+a.name]=a.tag=b);this.addSceneObject(a);this.updateTransform(b,
|
|
198
|
-
a);this.addDefaultAnimation(a,THREE.SEA3D.CameraAnimator)};THREE.SEA3D.prototype.getSkeletonFromBones=function(a){var b=[],c,e,d,f;d=0;for(f=a.length;d<f;d++)e=a[d],c=new THREE.Bone,b.push(c),c.name=e.name,c.position.fromArray(e.pos),c.quaternion.fromArray(e.rotq),void 0!==e.scl&&c.scale.fromArray(e.scl);d=0;for(f=a.length;d<f;d++)e=a[d],-1!==e.parent&&null!==e.parent&&void 0!==b[e.parent]&&b[e.parent].add(b[d]);return new THREE.Skeleton(b)};
|
|
199
|
-
THREE.SEA3D.prototype.readSkeletonLocal=function(a){for(var b=[],c=0;c<a.joint.length;c++){var e=a.joint[c];b[c]={name:e.name,pos:[e.x,e.y,e.z],rotq:[e.qx,e.qy,e.qz,e.qw],parent:e.parentIndex}}this.domain.bones=this.bones=this.bones||[];this.bones.push(this.objects[a.name+".sklq"]=a.tag=b)};THREE.SEA3D.prototype.readJointObject=function(a){var b=a.target.tag.skeleton.bones[a.joint];this.domain.joints=this.joints=this.joints||[];this.joints.push(this.objects["jnt/"+a.name]=a.tag=b)};
|
|
200
|
-
THREE.SEA3D.prototype.readMorph=function(a){for(var b={position:[]},c=[],e=0;e<a.node.length;e++){var d=a.node[e];b.position[e]=new THREE.Float32BufferAttribute(d.vertex,3);b.position[e].name=d.name;d.normal&&(b.normal=b.normal||[],b.normal[e]=new THREE.Float32BufferAttribute(d.normal,3));c[e]={name:d.name}}a.tag={attribs:b,targets:c}};
|
|
201
|
-
THREE.SEA3D.prototype.readAnimation=function(a){for(var b=[],c=1E3/a.frameRate/1E3,e=0;e<a.sequence.length;e++){for(var d=a.sequence[e],f=[],q=0;q<a.dataList.length;q++){var l=a.dataList[q],s,u,n,h=l.data;n=d.start*l.blockSize;s=n+d.count*l.blockSize;var p=d.intrpl?THREE.InterpolateLinear:!1,r=null;switch(l.kind){case SEA3D.Animation.POSITION:r=".position";break;case SEA3D.Animation.ROTATION:r=".quaternion";break;case SEA3D.Animation.SCALE:r=".scale";break;case SEA3D.Animation.COLOR:r=".color";break;
|
|
202
|
-
case SEA3D.Animation.MULTIPLIER:r=".intensity";break;case SEA3D.Animation.FOV:r=".fov";break;case SEA3D.Animation.OFFSET_U:r=".offset[x]";break;case SEA3D.Animation.OFFSET_V:r=".offset[y]";break;case SEA3D.Animation.SCALE_U:r=".repeat[x]";break;case SEA3D.Animation.SCALE_V:r=".repeat[y]";break;case SEA3D.Animation.MORPH:r=".morphTargetInfluences["+l.name+"]"}if(r)switch(l.type){case SEA3D.Stream.BYTE:case SEA3D.Stream.UBYTE:case SEA3D.Stream.INT:case SEA3D.Stream.UINT:case SEA3D.Stream.FLOAT:case SEA3D.Stream.DOUBLE:case SEA3D.Stream.DECIMAL:n=
|
|
203
|
-
h.subarray(n,s);u=new Float32Array(n.length);for(s=l=0;s<u.length;s++)u[s]=l,l+=c;f.push(new THREE.NumberKeyframeTrack(r,u,n,p));break;case SEA3D.Stream.VECTOR3D:n=h.subarray(n,s);u=new Float32Array(n.length/l.blockSize);for(s=l=0;s<u.length;s++)u[s]=l,l+=c;f.push(new THREE.VectorKeyframeTrack(r,u,n,p));break;case SEA3D.Stream.VECTOR4D:n=h.subarray(n,s);u=new Float32Array(n.length/l.blockSize);for(s=l=0;s<u.length;s++)u[s]=l,l+=c;f.push(new THREE.QuaternionKeyframeTrack(r,u,n,p));break;case SEA3D.Stream.INT24:case SEA3D.Stream.UINT24:n=
|
|
204
|
-
new Float32Array(3*(s-n));u=new Float32Array(n.length/3);for(s=l=0;s<u.length;s++)n[3*s]=(h[s]>>16&255)/255,n[3*s+1]=(h[s]>>8&255)/255,n[3*s+2]=(h[s]&255)/255,u[s]=l,l+=c;f.push(new THREE.VectorKeyframeTrack(r,u,n,p))}}b.push(new THREE.SEA3D.AnimationClip(d.name,-1,f,d.repeat))}this.domain.clips=this.clips=this.clips||[];this.clips.push(this.objects[a.name+".anm"]=a.tag=b)};
|
|
205
|
-
THREE.SEA3D.prototype.readSkeletonAnimation=function(a,b){b=!b&&a.metadata&&a.metadata.skeleton?a.metadata.skeleton:b;if(!b||a.tag)return a.tag;for(var c=[],e=1E3/a.frameRate/1E3,d=0;d<a.sequence.length;d++){for(var f=a.sequence[d],q=f.start,l=q+f.count,s={name:f.name,fps:a.frameRate,length:e*f.count,hierarchy:[]},u=a.numJoints,n=a.raw,h=0;h<u;h++){for(var p={parent:b.joint[h].parentIndex,keys:[]},r=p.keys,g=0,k=q;k<l;k++){var m=k*u*7+7*h;r.push({time:g,pos:[n[m],n[m+1],n[m+2]],rot:[n[m+3],n[m+4],
|
|
206
|
-
n[m+5],n[m+6]],scl:[1,1,1]});g+=e}s.hierarchy[h]=p}c.push(THREE.SEA3D.AnimationClip.fromClip(THREE.AnimationClip.parseAnimation(s,b.tag),f.repeat))}this.domain.clips=this.clips=this.clips||[];this.clips.push(this.objects[a.name+".skla"]=a.tag=c)};
|
|
207
|
-
THREE.SEA3D.prototype.readVertexAnimation=function(a){var b={position:[]},c=[],e=[],d,f;d=0;for(f=a.frame.length;d<f;d++){var q=a.frame[d];b.position[d]=new THREE.Float32BufferAttribute(q.vertex,3);q.normal&&(b.normal=b.normal||[],b.normal[d]=new THREE.Float32BufferAttribute(q.normal,3));c[d]={name:d}}for(d=0;d<a.sequence.length;d++){var q=a.sequence[d],l=[];for(f=0;f<q.count;f++)l[f]=c[q.start+f];e.push(THREE.SEA3D.AnimationClip.fromClip(THREE.AnimationClip.CreateFromMorphTargetSequence(q.name,l,
|
|
208
|
-
a.frameRate),q.repeat))}a.tag={attribs:b,targets:c,animations:e};this.domain.clips=this.clips=this.clips||[];this.clips.push(this.objects[a.name+".vtxa"]=a.tag)};
|
|
209
|
-
THREE.SEA3D.prototype.getModifier=function(a){var b=a.sea;switch(b.type){case SEA3D.SkeletonAnimation.prototype.type:this.readSkeletonAnimation(b,a.skeleton);break;case SEA3D.Animation.prototype.type:case SEA3D.MorphAnimation.prototype.type:case SEA3D.UVWAnimation.prototype.type:this.readAnimation(b);break;case SEA3D.Morph.prototype.type:this.readMorph(b,a.geometry)}return b.tag};
|
|
210
|
-
THREE.SEA3D.prototype.applyEnvironment=function(a){for(var b=0,c=this.materials.length;b<c;++b){var e=this.materials[b];e instanceof THREE.MeshStandardMaterial&&!e.envMap&&(e.envMap=a,e.envMap.mapping=THREE.CubeReflectionMapping,e.needsUpdate=!0)}};
|
|
211
|
-
THREE.SEA3D.prototype.readActions=function(a){for(var b=0;b<a.actions.length;b++){var c=a.actions[b];switch(c.kind){case SEA3D.Actions.ATTRIBUTES:this.attribs=this.domain.attribs=c.attributes.tag;break;case SEA3D.Actions.SCRIPTS:this.domain.scripts=this.getJSMList(this.domain,c.scripts);this.config.scripts&&this.config.runScripts&&this.domain.runJSMList(this.domain);break;case SEA3D.Actions.CAMERA:this.domain.camera=this.camera=c.camera.tag;break;case SEA3D.Actions.ENVIRONMENT_COLOR:this.domain.background=
|
|
212
|
-
this.background=this.background||{};this.background.color=new THREE.Color(c.color);break;case SEA3D.Actions.ENVIRONMENT:this.domain.background=this.background=this.background||{},this.background.texture=c.texture.tag,this.config.useEnvironment&&void 0!=this.materials&&this.applyEnvironment(c.texture.tag)}}};
|
|
213
|
-
THREE.SEA3D.prototype.updatePropertiesAssets=function(a,b){for(var c in b)switch(b.__type[c]){case SEA3D.Stream.ASSET:b.__asset||(b.__asset={});b.__asset[c]||(b.__asset[c]=b[c]);b[c]=b.__asset[c].tag;break;case SEA3D.Stream.GROUP:b[c]=this.updatePropertiesAssets(a,b[c])}return b};THREE.SEA3D.prototype.readProperties=function(a){var b=this.updatePropertiesAssets(a,a.props);this.domain.properties=this.properties=this.properties||[];this.properties.push(this.objects["prop/"+a.name]=a.tag=b)};
|
|
214
|
-
THREE.SEA3D.prototype.readFileInfo=function(a){this.domain.info=this.updatePropertiesAssets(a,a.info)};THREE.SEA3D.Event={PROGRESS:"sea3d_progress",LOAD_PROGRESS:"sea3d_load",DOWNLOAD_PROGRESS:"sea3d_download",COMPLETE:"sea3d_complete",OBJECT_COMPLETE:"sea3d_object",PARSE_PROGRESS:"parse_progress",PARSE_COMPLETE:"parse_complete",ERROR:"sea3d_error"};THREE.SEA3D.prototype.onProgress=function(a){a.status=a.type;a.progress=a.loaded/a.total;a.type=THREE.SEA3D.Event.PROGRESS;this.dispatchEvent(a)};
|
|
215
|
-
THREE.SEA3D.prototype.onLoadProgress=function(a){a.type=THREE.SEA3D.Event.LOAD_PROGRESS;this.dispatchEvent(a);this.onProgress(a)};THREE.SEA3D.prototype.onDownloadProgress=function(a){a.type=THREE.SEA3D.Event.DOWNLOAD_PROGRESS;this.dispatchEvent(a);this.onProgress(a)};THREE.SEA3D.prototype.onComplete=function(a){a.type=THREE.SEA3D.Event.COMPLETE;this.dispatchEvent(a)};THREE.SEA3D.prototype.onCompleteObject=function(a){a.type=THREE.SEA3D.Event.OBJECT_COMPLETE;this.dispatchEvent(a)};
|
|
216
|
-
THREE.SEA3D.prototype.onParseProgress=function(a){a.type=THREE.SEA3D.Event.PARSE_PROGRESS;this.dispatchEvent(a)};THREE.SEA3D.prototype.onParseComplete=function(a){a.type=THREE.SEA3D.Event.PARSE_COMPLETE;this.dispatchEvent(a)};THREE.SEA3D.prototype.onError=function(a){a.type=THREE.SEA3D.Event.ERROR;this.dispatchEvent(a)};THREE.SEA3D.prototype.createDomain=function(){return this.domain=new THREE.SEA3D.Domain(this.config.id,this.objects={},this.config.container)};
|
|
217
|
-
THREE.SEA3D.prototype.clone=function(a,b,c){if(!this.file.isDone())throw Error("Previous parse is not completed.");this.config.container=a&&void 0!==a.container?a.container:new THREE.Object3D;a&&this.loadConfig(a);var e=this.config.timeLimit;this.config.timeLimit=a&&void 0!==a.timeLimit?a.timeLimit:Infinity;this.parse(b,c);this.config.timeLimit=e;return this.domain};THREE.SEA3D.prototype.loadConfig=function(a){for(var b in a)this.config[b]=a[b]};
|
|
218
|
-
THREE.SEA3D.prototype.parse=function(a,b){delete this.cameras;delete this.containers;delete this.lights;delete this.joints;delete this.meshes;delete this.materials;delete this.sprites;delete this.sounds3d;delete this.cubeRenderers;delete this.sounds;delete this.glsl;delete this.dummy;delete this.camera;delete this.background;delete this.properties;delete this.scriptTargets;delete this.domain;this.createDomain();this.setTypeRead();this.file.onParseComplete=function(b){this.config.manager&&this.config.manager.add(this.domain);
|
|
219
|
-
(a||this.onParseComplete).call(this,b)}.bind(this);this.file.onParseProgress=b||this.onParseProgress;for(var c=THREE.SEA3D.EXTENSIONS_LOADER.length;c--;){var e=THREE.SEA3D.EXTENSIONS_LOADER[c];e.parse&&e.parse.call(this)}this.file.parse();return this.domain};THREE.SEA3D.prototype.onHead=function(a){if("TJS"!=a.sign)throw Error("Sign '"+a.sign+"' not supported! Use SEA3D Studio to publish or SEA3DLegacy.js");};THREE.SEA3D.EXTENSIONS_LOADER=[];THREE.SEA3D.EXTENSIONS_DOMAIN=[];
|
|
220
|
-
THREE.SEA3D.prototype.setTypeRead=function(){this.file.typeRead={};this.file.typeRead[SEA3D.Geometry.prototype.type]=this.readGeometryBuffer;this.file.typeRead[SEA3D.Mesh.prototype.type]=this.readMesh;this.file.typeRead[SEA3D.Sprite.prototype.type]=this.readSprite;this.file.typeRead[SEA3D.Container3D.prototype.type]=this.readContainer3D;this.file.typeRead[SEA3D.Line.prototype.type]=this.readLine;this.file.typeRead[SEA3D.Material.prototype.type]=this.readMaterial;this.file.typeRead[SEA3D.Camera.prototype.type]=
|
|
221
|
-
this.readCamera;this.file.typeRead[SEA3D.OrthographicCamera.prototype.type]=this.readOrthographicCamera;this.file.typeRead[SEA3D.SkeletonLocal.prototype.type]=this.readSkeletonLocal;this.file.typeRead[SEA3D.SkeletonAnimation.prototype.type]=this.readSkeletonAnimation;this.file.typeRead[SEA3D.JointObject.prototype.type]=this.readJointObject;this.file.typeRead[SEA3D.CubeMap.prototype.type]=this.readCubeMap;this.file.typeRead[SEA3D.CubeRender.prototype.type]=this.readCubeRender;this.file.typeRead[SEA3D.Animation.prototype.type]=
|
|
222
|
-
this.file.typeRead[SEA3D.MorphAnimation.prototype.type]=this.file.typeRead[SEA3D.UVWAnimation.prototype.type]=this.readAnimation;this.file.typeRead[SEA3D.SoundPoint.prototype.type]=this.readSoundPoint;this.file.typeRead[SEA3D.TextureURL.prototype.type]=this.readTextureURL;this.file.typeRead[SEA3D.CubeMapURL.prototype.type]=this.readCubeMapURL;this.file.typeRead[SEA3D.TextureUpdate.prototype.type]=this.readTextureUpdate;this.file.typeRead[SEA3D.Morph.prototype.type]=this.readMorph;this.file.typeRead[SEA3D.VertexAnimation.prototype.type]=
|
|
223
|
-
this.readVertexAnimation;this.file.typeRead[SEA3D.Actions.prototype.type]=this.readActions;this.file.typeRead[SEA3D.FileInfo.prototype.type]=this.readFileInfo;this.file.typeRead[SEA3D.Properties.prototype.type]=this.readProperties;this.config.dummys&&(this.file.typeRead[SEA3D.Dummy.prototype.type]=this.readDummy);this.config.scripts&&(this.file.typeRead[SEA3D.ScriptURL.prototype.type]=this.readScriptURL,this.file.typeRead[SEA3D.JavaScriptMethod.prototype.type]=this.readJavaScriptMethod);this.config.lights&&
|
|
224
|
-
(this.file.typeRead[SEA3D.PointLight.prototype.type]=this.readPointLight,this.file.typeRead[SEA3D.DirectionalLight.prototype.type]=this.readDirectionalLight,this.file.typeRead[SEA3D.HemisphereLight.prototype.type]=this.readHemisphereLight,this.file.typeRead[SEA3D.AmbientLight.prototype.type]=this.readAmbientLight);this.file.typeRead[SEA3D.JPEG.prototype.type]=this.file.typeRead[SEA3D.JPEG_XR.prototype.type]=this.file.typeRead[SEA3D.PNG.prototype.type]=this.file.typeRead[SEA3D.GIF.prototype.type]=
|
|
225
|
-
this.readTexture;this.file.typeRead[SEA3D.MP3.prototype.type]=this.readSound;this.file.typeRead[SEA3D.GLSL.prototype.type]=this.readGLSL;for(var a=THREE.SEA3D.EXTENSIONS_LOADER.length;a--;){var b=THREE.SEA3D.EXTENSIONS_LOADER[a];b.setTypeRead&&b.setTypeRead.call(this)}};
|
|
226
|
-
THREE.SEA3D.prototype.load=function(a){this.file=new SEA3D.File;this.file.scope=this;this.file.config=this.config;this.file.onProgress=this.onLoadProgress.bind(this);this.file.onCompleteObject=this.onCompleteObject.bind(this);this.file.onDownloadProgress=this.onDownloadProgress.bind(this);this.file.onParseProgress=this.onParseProgress.bind(this);this.file.onParseComplete=this.onParseComplete.bind(this);this.file.onError=this.onError.bind(this);this.file.onHead=this.onHead.bind(this);this.file.onComplete=
|
|
227
|
-
function(a){this.config.manager&&this.config.manager.add(this.domain);this.onComplete.call(this,a)}.bind(this);this.createDomain();this.setTypeRead();void 0!==a&&("string"===typeof a?this.file.load(a):this.file.read(a))};Object.assign(THREE.SEA3D.prototype,{_onHead:THREE.SEA3D.prototype.onHead,_updateTransform:THREE.SEA3D.prototype.updateTransform,_readMorph:THREE.SEA3D.prototype.readMorph,_readVertexAnimation:THREE.SEA3D.prototype.readVertexAnimation,_readGeometryBuffer:THREE.SEA3D.prototype.readGeometryBuffer,_readLine:THREE.SEA3D.prototype.readLine,_getModifier:THREE.SEA3D.prototype.getModifier,_readAnimation:THREE.SEA3D.prototype.readAnimation});
|
|
228
|
-
THREE.SEA3D.prototype.isLegacy=function(a){a=a.sea3d;return"S3D"===a.sign?a.config.legacy:!1};THREE.SEA3D.prototype.flipVec3=function(a){if(a){for(var b=2;b<a.length;)a[b]=-a[b],b+=3;return a}};THREE.SEA3D.prototype.addVector=function(a,b){if(a){for(var c=0;c<a.length;c++)a[c]+=b[c];return a}};
|
|
229
|
-
THREE.SEA3D.prototype.expandJoints=function(a){for(var b=4*a.numVertex,c=a.isBig?new Uint32Array(b):new Uint16Array(b),b=new Float32Array(b),e=0,d=a.jointPerVertex,f=0;f<a.numVertex;f++){var q=4*f,e=f*d;c[q]=a.joint[e];1<d&&(c[q+1]=a.joint[e+1]);2<d&&(c[q+2]=a.joint[e+2]);3<d&&(c[q+3]=a.joint[e+3]);b[q]=a.weight[e];1<d&&(b[q+1]=a.weight[e+1]);2<d&&(b[q+2]=a.weight[e+2]);3<d&&(b[q+3]=a.weight[e+3]);e=b[q]+b[q+1]+b[q+2]+b[q+3];b[q]+=1-e}a.joint=c;a.weight=b;a.jointPerVertex=4};
|
|
230
|
-
THREE.SEA3D.prototype.compressJoints=function(a){for(var b=4*a.numVertex,c=a.isBig?new Uint32Array(b):new Uint16Array(b),b=new Float32Array(b),e=0,d=a.jointPerVertex,f=0;f<a.numVertex;f++){var q=4*f,e=f*d;c[q]=a.joint[e];c[q+1]=a.joint[e+1];c[q+2]=a.joint[e+2];c[q+3]=a.joint[e+3];b[q]=a.weight[e];b[q+1]=a.weight[e+1];b[q+2]=a.weight[e+2];b[q+3]=a.weight[e+3];e=b[q]+b[q+1]+b[q+2]+b[q+3];b[q]+=1-e}a.joint=c;a.weight=b;a.jointPerVertex=4};
|
|
231
|
-
THREE.SEA3D.prototype.flipIndexes=function(a){for(var b=1;b<a.length;){var c=a[b+1];a[b+1]=a[b];a[b]=c;b+=3}return a};THREE.SEA3D.prototype.flipBoneMatrix=function(){var a=new THREE.Vector3;return function(b){var c=THREE.SEA3D.VECBUF.setFromMatrixPosition(b);c.z=-c.z;b.setPosition(a);b.multiplyMatrices(THREE.SEA3D.MTXBUF.makeRotationZ(THREE.Math.degToRad(180)),b);b.setPosition(c);return b}}();
|
|
232
|
-
THREE.SEA3D.prototype.flipScaleMatrix=function(){var a=new THREE.Vector3,b=new THREE.Quaternion,c=new THREE.Vector3;return function(e,d,f,q){f&&e.multiplyMatrices(f,e);e.decompose(a,b,c);c.z=-c.z;e.compose(a,b,c);d&&e.multiplyMatrices(e,THREE.SEA3D.MTXBUF.makeRotationZ(THREE.Math.degToRad(180)));f&&(f=f.clone(),this.flipScaleMatrix(f,q),e.multiplyMatrices(f.getInverse(f),e));return e}}();
|
|
233
|
-
THREE.SEA3D.prototype.flipDefaultAnimation=function(){var a=new THREE.Matrix4,b=new THREE.Matrix4,c=new THREE.Vector3,e=new THREE.Quaternion,d=new THREE.Vector3,f=new THREE.Vector3,q=new THREE.Quaternion,l=new THREE.Vector3;return function(s,u,n){if(!s.isFliped){for(var h=s.dataList,p=[],r=0;r<h.length;r++){var g=h[r],k=g.data,m=g.kind,g=k.length/g.blockSize;switch(m){case SEA3D.Animation.POSITION:case SEA3D.Animation.ROTATION:case SEA3D.Animation.SCALE:p.push({kind:m,numFrames:g,raw:k})}}if(0<p.length)for(g=
|
|
234
|
-
p[0].numFrames,k=void 0,n?(a.identity(),this.flipScaleMatrix(b.copy(u.matrixWorld))):(u.parent&&(k=this.flipScaleMatrix(b.copy(u.parent.matrixWorld))),this.flipScaleMatrix(a.copy(u.matrix),!1,k)),a.decompose(c,e,d),u=0;u<g;u++){for(n=0;n<p.length;n++)switch(k=p[n].raw,m=p[n].kind,m){case SEA3D.Animation.POSITION:m=3*u;c.set(k[m],k[m+1],k[m+2]);break;case SEA3D.Animation.ROTATION:m=4*u;e.set(k[m],k[m+1],k[m+2],k[m+3]);break;case SEA3D.Animation.SCALE:m=4*u,d.set(k[m],k[m+1],k[m+2])}a.compose(c,e,d);
|
|
235
|
-
this.flipScaleMatrix(a,!1,b);a.decompose(f,q,l);for(n=0;n<p.length;n++)switch(k=p[n].raw,m=p[n].kind,m){case SEA3D.Animation.POSITION:m=3*u;k[m]=f.x;k[m+1]=f.y;k[m+2]=f.z;break;case SEA3D.Animation.ROTATION:m=4*u;k[m]=q.x;k[m+1]=q.y;k[m+2]=q.z;k[m+3]=q.w;break;case SEA3D.Animation.SCALE:m=3*u,k[m]=l.x,k[m+1]=l.y,k[m+2]=l.z}}s.isFliped=!0}}}();THREE.SEA3D.prototype.readAnimation=function(a){this.isLegacy(a)||this._readAnimation(a)};
|
|
236
|
-
THREE.SEA3D.prototype.getModifier=function(a){var b=a.sea;if(this.isLegacy(b)&&!b.done)switch(b.done=!0,b.type){case SEA3D.SkeletonAnimation.prototype.type:return this.readSkeletonAnimationLegacy(b,a.skeleton),b.tag;case SEA3D.Animation.prototype.type:case SEA3D.MorphAnimation.prototype.type:case SEA3D.UVWAnimation.prototype.type:return a.scope instanceof THREE.Object3D&&this.flipDefaultAnimation(b,a.scope,a.relative),this._readAnimation(b),b.tag;case SEA3D.Morph.prototype.type:this.readMorphLegacy(b,
|
|
237
|
-
a.geometry)}return this._getModifier(a)};
|
|
238
|
-
THREE.SEA3D.prototype.updateTransform=function(){var a=new THREE.Matrix4,b=new THREE.Matrix4;return function(c,e){this.isLegacy(e)?(e.transform?a.fromArray(e.transform):a.makeTranslation(e.position.x,e.position.y,e.position.z),this.flipScaleMatrix(a,!1,c.parent?c.parent.matrixWorld:b,c.parent instanceof THREE.Bone),c.position.setFromMatrixPosition(a),c.scale.setFromMatrixScale(a),a.scale(THREE.SEA3D.VECBUF.set(1/c.scale.x,1/c.scale.y,1/c.scale.z)),c.rotation.setFromRotationMatrix(a),c.updateMatrixWorld()):
|
|
239
|
-
this._updateTransform(c,e)}}();
|
|
240
|
-
THREE.SEA3D.prototype.readSkeleton=function(){var a=new THREE.Matrix4,b=new THREE.Matrix4,c=new THREE.Matrix4,e=new THREE.Vector3,d=new THREE.Quaternion;return function(f){for(var q=[],l=f.sea3d.config.legacy,s=0;s<f.joint.length;s++){var u=f.joint[s];a.fromArray(u.inverseBindMatrix);b.getInverse(a);l&&this.flipBoneMatrix(b);-1<u.parentIndex&&(a.fromArray(f.joint[u.parentIndex].inverseBindMatrix),c.getInverse(a),l&&this.flipBoneMatrix(c),c.getInverse(c),b.multiplyMatrices(c,b));e.setFromMatrixPosition(b);
|
|
241
|
-
d.setFromRotationMatrix(b);q[s]={name:u.name,pos:[e.x,e.y,e.z],rotq:[d.x,d.y,d.z,d.w],parent:u.parentIndex}}this.domain.bones=this.bones=this.bones||[];this.bones.push(this.objects[f.name+".sklq"]=f.tag=q);return q}}();
|
|
242
|
-
THREE.SEA3D.prototype.readSkeletonAnimationLegacy=function(){var a=new THREE.Matrix4,b=new THREE.Matrix4,c=new THREE.Matrix4,e=new THREE.Matrix4;return function(d,f){if(d.tag)return d.tag;for(var q=[],l=1E3/d.frameRate/1E3,s=[1,1,1],u=0;u<d.sequence.length;u++){for(var n=d.sequence[u],h=n.start,p=h+n.count,r={name:n.name,repeat:n.repeat,fps:d.frameRate,JIT:0,length:l*n.count,hierarchy:[]},g=d.numJoints,k=d.raw,m=0;m<g;m++){for(var w=f.joint[m],t={parent:w.parentIndex,keys:[]},y=t.keys,v=0,A=h;A<p;A++){var x=
|
|
243
|
-
A*g*7+7*m;b.makeRotationFromQuaternion(THREE.SEA3D.QUABUF.set(k[x+3],k[x+4],k[x+5],k[x+6]));b.setPosition(THREE.SEA3D.VECBUF.set(k[x],k[x+1],k[x+2]));-1<w.parentIndex?(a.fromArray(f.joint[w.parentIndex].inverseBindMatrix),e.getInverse(a),c.multiplyMatrices(e,b),this.flipBoneMatrix(c),this.flipBoneMatrix(e),e.getInverse(e),b.multiplyMatrices(e,c)):this.flipBoneMatrix(b);var x=THREE.SEA3D.VECBUF.setFromMatrixPosition(b),B=THREE.SEA3D.QUABUF.setFromRotationMatrix(b);y.push({time:v,pos:[x.x,x.y,x.z],
|
|
244
|
-
rot:[B.x,B.y,B.z,B.w],scl:s});v+=l}r.hierarchy[m]=t}q.push(THREE.SEA3D.AnimationClip.fromClip(THREE.AnimationClip.parseAnimation(r,f.tag),n.repeat))}this.domain.clips=this.clips=this.clips||[];this.clips.push(this.objects[d.name+".anm"]=d.tag=q)}}();THREE.SEA3D.prototype.readMorphLegacy=function(a,b){for(var c=0;c<a.node.length;c++){var e=a.node[c];this.flipVec3(e.vertex);this.flipVec3(e.normal);this.addVector(e.vertex,b.vertex);this.addVector(e.normal,b.normal)}this._readMorph(a)};
|
|
245
|
-
THREE.SEA3D.prototype.readMorph=function(a){this.isLegacy(a)||this._readMorph(a)};THREE.SEA3D.prototype.readVertexAnimation=function(a){if(this.isLegacy(a))for(var b=0,c=a.frame.length;b<c;b++){var e=a.frame[b];this.flipVec3(e.vertex);this.flipVec3(e.normal)}this._readVertexAnimation(a)};
|
|
246
|
-
THREE.SEA3D.prototype.readGeometryBuffer=function(a){this.isLegacy(a)&&(this.flipVec3(a.vertex),this.flipVec3(a.normal),this.flipIndexes(a.indexes),4<a.jointPerVertex?this.compressJoints(a):4>a.jointPerVertex&&this.expandJoints(a));this._readGeometryBuffer(a)};THREE.SEA3D.prototype.readLines=function(a){this.isLegacy(a)&&this.flipVec3(a.vertex);this._readLines(a)};THREE.SEA3D.prototype.onHead=function(a){if("S3D"!=a.sign&&"TJS"!=a.sign)throw Error("Sign '"+a.sign+"' unknown.");};
|
|
247
|
-
THREE.SEA3D.EXTENSIONS_LOADER.push({setTypeRead:function(){this.config.legacy=void 0==this.config.legacy?!0:this.config.legacy;this.file.typeRead[SEA3D.Skeleton.prototype.type]=this.readSkeleton}});var o3dgc=function(){function a(a,b,c,d){var e,h,p,r;e=-1;h=!1;r=b.m_value;for(p=0;p<r;++p)if(a.Equal(c[p].m_id)){h=!0;break}else if(a.Less(c[p].m_id)){b.m_value<f.O3DGC_SC3DMC_MAX_PREDICTION_NEIGHBORS&&++b.m_value;for(e=b.m_value-1;e>p;--e)for(c[e].m_id.m_a=c[e-1].m_id.m_a,c[e].m_id.m_b=c[e-1].m_id.m_b,c[e].m_id.m_c=c[e-1].m_id.m_c,h=0;h<d;++h)c[e].m_pred[h]=c[e-1].m_pred[h];c[p].m_id.m_a=a.m_a;c[p].m_id.m_b=a.m_b;c[p].m_id.m_c=a.m_c;e=p;h=!0;break}!h&&b.m_value<f.O3DGC_SC3DMC_MAX_PREDICTION_NEIGHBORS&&
|
|
248
|
-
(e=b.m_value++,c[e].m_id.m_a=a.m_a,c[e].m_id.m_b=a.m_b,c[e].m_id.m_c=a.m_c);return e}function b(a){return a&1?-(a+1>>>1):a>>>1}function c(b,c,s,e,n,f,p,r){var g,k,m,w,t;t=new d.SC3DMCTriplet(-1,-1,-1);for(k=0;3>k;++k)if(g=b[3*c+k],g<s&&(t.m_a=-1,t.m_b=-1,t.m_c=g,m=a(t,e,n,f),-1!==m))for(g*=r,w=0;w<f;++w)n[m].m_pred[w]=p[g+w]}function e(b,c,s,e,f,h,p,r,g,k){var m,w,t,y,v,A,x,B;m=3*c;B=new d.SC3DMCTriplet(-1,-1,-1);b[m]===s?(c=b[m+1],m=b[m+2]):b[m+1]===s?(c=b[m],m=b[m+2]):(c=b[m],m=b[m+1]);if(c<s&&
|
|
249
|
-
m<s)for(x=g.Begin(c),g=g.End(c);x<g;++x){y=k[x];if(0>y)break;w=3*y;y=-1;v=!1;for(A=0;3>A;++A)t=b[w+A],t===m?v=!0:t<s&&t!==c&&(y=t);if(-1!==y&&v&&(c<m?(B.m_a=c,B.m_b=m):(B.m_a=m,B.m_b=c),B.m_c=-y-1,A=a(B,e,f,h),-1!==A))for(w=c*r,t=m*r,y*=r,v=0;v<h;++v)f[A].m_pred[v]=p[w+v]+p[t+v]-p[y+v]}}var d,f;d={};f={O3DGC_BINARY_STREAM_BITS_PER_SYMBOL0:7,O3DGC_BINARY_STREAM_MAX_SYMBOL0:127,O3DGC_BINARY_STREAM_BITS_PER_SYMBOL1:6,O3DGC_BINARY_STREAM_MAX_SYMBOL1:63,O3DGC_BINARY_STREAM_NUM_SYMBOLS_UINT32:5,O3DGC_BIG_ENDIAN:0,
|
|
250
|
-
O3DGC_LITTLE_ENDIAN:1,O3DGC_MAX_DOUBLE:1.79769E308,O3DGC_MIN_LONG:-2147483647,O3DGC_MAX_LONG:2147483647,O3DGC_MAX_UCHAR8:255,O3DGC_MAX_TFAN_SIZE:256,O3DGC_MAX_ULONG:4294967295,O3DGC_SC3DMC_START_CODE:497,O3DGC_DV_START_CODE:498,O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES:256,O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES:256,O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES:32,O3DGC_SC3DMC_MAX_PREDICTION_NEIGHBORS:2,O3DGC_SC3DMC_BINARIZATION_FL:0,O3DGC_SC3DMC_BINARIZATION_BP:1,O3DGC_SC3DMC_BINARIZATION_FC:2,O3DGC_SC3DMC_BINARIZATION_AC:3,
|
|
251
|
-
O3DGC_SC3DMC_BINARIZATION_AC_EGC:4,O3DGC_SC3DMC_BINARIZATION_ASCII:5,O3DGC_STREAM_TYPE_UNKOWN:0,O3DGC_STREAM_TYPE_ASCII:1,O3DGC_STREAM_TYPE_BINARY:2,O3DGC_SC3DMC_NO_PREDICTION:0,O3DGC_SC3DMC_DIFFERENTIAL_PREDICTION:1,O3DGC_SC3DMC_XOR_PREDICTION:2,O3DGC_SC3DMC_ADAPTIVE_DIFFERENTIAL_PREDICTION:3,O3DGC_SC3DMC_CIRCULAR_DIFFERENTIAL_PREDICTION:4,O3DGC_SC3DMC_PARALLELOGRAM_PREDICTION:5,O3DGC_SC3DMC_SURF_NORMALS_PREDICTION:6,O3DGC_SC3DMC_ENCODE_MODE_QBCR:0,O3DGC_SC3DMC_ENCODE_MODE_SVA:1,O3DGC_SC3DMC_ENCODE_MODE_TFAN:2,
|
|
252
|
-
O3DGC_DYNAMIC_VECTOR_ENCODE_MODE_LIFT:0,O3DGC_MIN_NEIGHBORS_SIZE:128,O3DGC_MIN_NUM_NEIGHBORS_SIZE:16,O3DGC_TFANS_MIN_SIZE_ALLOCATED_VERTICES_BUFFER:128,O3DGC_TFANS_MIN_SIZE_TFAN_SIZE_BUFFER:8,O3DGC_DEFAULT_VECTOR_SIZE:32};d.O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_UNKOWN=0;d.O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_POSITION=1;d.O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_NORMAL=2;d.O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_COLOR=3;d.O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_TEXCOORD=4;d.O3DGC_IFS_FLOAT_ATTRIBUTE_TYPE_WEIGHT=5;d.O3DGC_IFS_INT_ATTRIBUTE_TYPE_UNKOWN=
|
|
253
|
-
0;d.O3DGC_IFS_INT_ATTRIBUTE_TYPE_INDEX=1;d.O3DGC_IFS_INT_ATTRIBUTE_TYPE_JOINT_ID=2;d.O3DGC_IFS_INT_ATTRIBUTE_TYPE_INDEX_BUFFER_ID=3;d.O3DGC_OK=0;d.O3DGC_ERROR_BUFFER_FULL=1;d.O3DGC_ERROR_CORRUPTED_STREAM=5;d.O3DGC_ERROR_NON_SUPPORTED_FEATURE=6;d.O3DGC_ERROR_AC=7;d.SC3DMCStats=function(){this.m_timeCoordIndex=this.m_timeNormal=this.m_timeCoord=0;this.m_timeFloatAttribute=new Float32Array(f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);this.m_timeIntAttribute=new Float32Array(f.O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
|
|
254
|
-
this.m_streamSizeCoordIndex=this.m_streamSizeNormal=this.m_streamSizeCoord=this.m_timeReorder=0;this.m_streamSizeFloatAttribute=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);this.m_streamSizeIntAttribute=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES)};d.SC3DMCTriplet=function(a,b,c){this.m_a=a;this.m_b=b;this.m_c=c};d.SC3DMCTriplet.prototype.Less=function(a){return this.m_c!==a.m_c?this.m_c<a.m_c:this.m_b!==a.m_b?this.m_b<a.m_b:this.m_a<a.m_a};d.SC3DMCTriplet.prototype.Equal=function(a){return this.m_c===
|
|
255
|
-
a.m_c&&this.m_b===a.m_b&&this.m_a===a.m_a};d.SC3DMCPredictor=function(){this.m_id=new d.SC3DMCTriplet(-1,-1,-1);this.m_pred=new Float32Array(f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES)};"undefined"===typeof window.performance&&(window.performance={});window.performance.now||(f.nowOffset=Date.now(),performance.timing&&performance.timing.navigationStart&&(f.nowOffset=performance.timing.navigationStart),window.performance.now=function(){return Date.now()-f.nowOffset});d.Timer=function(){this.m_end=this.m_start=
|
|
256
|
-
0};d.Timer.prototype.Tic=function(){this.m_start=window.performance.now()};d.Timer.prototype.Toc=function(){this.m_end=window.performance.now()};d.Timer.prototype.GetElapsedTime=function(){return this.m_end-this.m_start};d.Vec3=function(a,b,c){this.m_x=a;this.m_y=b;this.m_z=c};d.Vec3.prototype.Set=function(a,b,c){this.m_x=a;this.m_y=b;this.m_z=c};d.Vec3.prototype.Sub=function(a,b){this.m_x=a.m_x-b.m_x;this.m_y=a.m_y-b.m_y;this.m_z=a.m_z-b.m_z};d.Vec3.prototype.Add=function(a,b){this.m_x=a.m_x+b.m_x;
|
|
257
|
-
this.m_y=a.m_y+b.m_y;this.m_z=a.m_z+b.m_z};d.Vec3.prototype.SelfAdd=function(a){this.m_x+=a.m_x;this.m_y+=a.m_y;this.m_z+=a.m_z};d.Vec3.prototype.Cross=function(a,b){this.m_x=a.m_y*b.m_z-a.m_z*b.m_y;this.m_y=a.m_z*b.m_x-a.m_x*b.m_z;this.m_z=a.m_x*b.m_y-a.m_y*b.m_x};d.Vec3.prototype.GetNorm=function(){return Math.sqrt(this.m_x*this.m_x+this.m_y*this.m_y+this.m_z*this.m_z)};f.CubeToSphere={0:function(a,b){b.m_x=a.m_x;b.m_y=a.m_y;b.m_z=Math.sqrt(Math.max(0,1-b.m_x*b.m_x-b.m_y*b.m_y))},1:function(a,b){b.m_x=
|
|
258
|
-
-a.m_x;b.m_y=-a.m_y;b.m_z=-Math.sqrt(Math.max(0,1-b.m_x*b.m_x-b.m_y*b.m_y))},2:function(a,b){b.m_z=a.m_x;b.m_x=a.m_y;b.m_y=Math.sqrt(Math.max(0,1-b.m_x*b.m_x-b.m_z*b.m_z))},3:function(a,b){b.m_z=-a.m_x;b.m_x=-a.m_y;b.m_y=-Math.sqrt(Math.max(0,1-b.m_x*b.m_x-b.m_z*b.m_z))},4:function(a,b){b.m_y=a.m_x;b.m_z=a.m_y;b.m_x=Math.sqrt(Math.max(0,1-b.m_y*b.m_y-b.m_z*b.m_z))},5:function(a,b){b.m_y=-a.m_x;b.m_z=-a.m_y;b.m_x=-Math.sqrt(Math.max(0,1-b.m_y*b.m_y-b.m_z*b.m_z))}};d.Iterator=function(){this.m_count=
|
|
259
|
-
0};d.NumberRef=function(){this.m_value=0};d.BinaryStream=function(a){var b;var c;c=new ArrayBuffer(4);b=new Uint32Array(c);c=new Uint8Array(c);b[0]=1;b=1===c[0]?f.O3DGC_LITTLE_ENDIAN:f.O3DGC_BIG_ENDIAN;this.m_endianness=b;this.m_buffer=a;this.m_stream=new Uint8Array(this.m_buffer);this.m_localBuffer=new ArrayBuffer(4);this.m_localBufferViewUChar8=new Uint8Array(this.m_localBuffer);this.m_localBufferViewFloat32=new Float32Array(this.m_localBuffer);this.m_localBufferViewUInt32=new Uint32Array(this.m_localBuffer)};
|
|
260
|
-
d.BinaryStream.prototype.ReadFloat32Bin=function(a){this.m_endianness===f.O3DGC_BIG_ENDIAN?(this.m_localBufferViewUChar8[3]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[2]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[1]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[0]=this.m_stream[a.m_count++]):(this.m_localBufferViewUChar8[0]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[1]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[2]=this.m_stream[a.m_count++],
|
|
261
|
-
this.m_localBufferViewUChar8[3]=this.m_stream[a.m_count++]);return this.m_localBufferViewFloat32[0]};d.BinaryStream.prototype.ReadUInt32Bin=function(a){this.m_endianness===f.O3DGC_BIG_ENDIAN?(this.m_localBufferViewUChar8[3]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[2]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[1]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[0]=this.m_stream[a.m_count++]):(this.m_localBufferViewUChar8[0]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[1]=
|
|
262
|
-
this.m_stream[a.m_count++],this.m_localBufferViewUChar8[2]=this.m_stream[a.m_count++],this.m_localBufferViewUChar8[3]=this.m_stream[a.m_count++]);return this.m_localBufferViewUInt32[0]};d.BinaryStream.prototype.ReadUChar8Bin=function(a){return this.m_stream[a.m_count++]};d.BinaryStream.prototype.ReadUInt32ASCII=function(a){var b,c,d;for(d=c=b=0;d<f.O3DGC_BINARY_STREAM_NUM_SYMBOLS_UINT32;++d)b+=this.m_stream[a.m_count++]<<c>>>0,c+=f.O3DGC_BINARY_STREAM_BITS_PER_SYMBOL0;return b};d.BinaryStream.prototype.ReadFloat32ASCII=
|
|
263
|
-
function(a){a=this.ReadUInt32ASCII(a);this.m_endianness===f.O3DGC_BIG_ENDIAN?(this.m_localBufferViewUChar8[3]=a&f.O3DGC_MAX_UCHAR8,a>>>=8,this.m_localBufferViewUChar8[2]=a&f.O3DGC_MAX_UCHAR8,a>>>=8,this.m_localBufferViewUChar8[1]=a&f.O3DGC_MAX_UCHAR8,this.m_localBufferViewUChar8[0]=a>>>8&f.O3DGC_MAX_UCHAR8):(this.m_localBufferViewUChar8[0]=a&f.O3DGC_MAX_UCHAR8,a>>>=8,this.m_localBufferViewUChar8[1]=a&f.O3DGC_MAX_UCHAR8,a>>>=8,this.m_localBufferViewUChar8[2]=a&f.O3DGC_MAX_UCHAR8,a>>>=8,this.m_localBufferViewUChar8[3]=
|
|
264
|
-
a&f.O3DGC_MAX_UCHAR8);return this.m_localBufferViewFloat32[0]};d.BinaryStream.prototype.ReadIntASCII=function(a){return b(this.ReadUIntASCII(a))};d.BinaryStream.prototype.ReadUIntASCII=function(a){var b,c,d;d=this.m_stream[a.m_count++];if(d===f.O3DGC_BINARY_STREAM_MAX_SYMBOL0){b=0;do c=this.m_stream[a.m_count++],d+=c>>>1<<b>>>0,b+=f.O3DGC_BINARY_STREAM_BITS_PER_SYMBOL1;while(c&1)}return d};d.BinaryStream.prototype.ReadUCharASCII=function(a){return this.m_stream[a.m_count++]};d.BinaryStream.prototype.ReadFloat32=
|
|
265
|
-
function(a,b){return b===f.O3DGC_STREAM_TYPE_ASCII?this.ReadFloat32ASCII(a):this.ReadFloat32Bin(a)};d.BinaryStream.prototype.ReadUInt32=function(a,b){return b===f.O3DGC_STREAM_TYPE_ASCII?this.ReadUInt32ASCII(a):this.ReadUInt32Bin(a)};d.BinaryStream.prototype.ReadUChar=function(a,b){return b===f.O3DGC_STREAM_TYPE_ASCII?this.ReadUCharASCII(a):this.ReadUChar8Bin(a)};d.BinaryStream.prototype.GetBuffer=function(a,b){return new Uint8Array(this.m_buffer,a.m_count,b)};f.O3DGC_AC_MIN_LENGTH=16777216;f.O3DGC_AC_MAX_LENGTH=
|
|
266
|
-
4294967295;f.O3DGC_AC_BM_LENGTH_SHIFT=13;f.O3DGC_AC_BM_MAX_COUNT=1<<f.O3DGC_AC_BM_LENGTH_SHIFT>>>0;f.O3DGC_AC_DM_LENGTH_SHIFT=15;f.O3DGC_AC_DM_MAX_COUNT=1<<f.O3DGC_AC_DM_LENGTH_SHIFT>>>0;d.StaticBitModel=function(){this.m_bit0Prob=1<<f.O3DGC_AC_BM_LENGTH_SHIFT-1>>>0};d.StaticBitModel.prototype.SetProbability=function(a){this.m_bit0Prob=Math.floor(a*(1<<f.O3DGC_AC_BM_LENGTH_SHIFT>>>0))};d.AdaptiveBitModel=function(){this.m_bitsUntilUpdate=this.m_updateCycle=4;this.m_bit0Prob=1<<f.O3DGC_AC_BM_LENGTH_SHIFT-
|
|
267
|
-
1>>>0;this.m_bit0Count=1;this.m_bitCount=2};d.AdaptiveBitModel.prototype.Reset=function(){this.m_bitsUntilUpdate=this.m_updateCycle=4;this.m_bit0Prob=1<<f.O3DGC_AC_BM_LENGTH_SHIFT-1>>>0;this.m_bit0Count=1;this.m_bitCount=2};d.AdaptiveBitModel.prototype.Update=function(){(this.m_bitCount+=this.m_updateCycle)>f.O3DGC_AC_BM_MAX_COUNT&&(this.m_bitCount=this.m_bitCount+1>>>1,this.m_bit0Count=this.m_bit0Count+1>>>1,this.m_bit0Count===this.m_bitCount&&++this.m_bitCount);this.m_bit0Prob=this.m_bit0Count*
|
|
268
|
-
Math.floor(2147483648/this.m_bitCount)>>>31-f.O3DGC_AC_BM_LENGTH_SHIFT;this.m_updateCycle=5*this.m_updateCycle>>>2;64<this.m_updateCycle&&(this.m_updateCycle=64);this.m_bitsUntilUpdate=this.m_updateCycle};d.AdaptiveDataModel=function(){this.m_buffer={};this.m_distribution={};this.m_symbolCount={};this.m_decoderTable={};this.m_tableShift=this.m_tableSize=this.m_lastSymbol=this.m_dataSymbols=this.m_symbolsUntilUpdate=this.m_updateCycle=this.m_totalCount=0};d.AdaptiveDataModel.prototype.Update=function(){var a,
|
|
269
|
-
b,c,d,e;if((this.m_totalCount+=this.m_updateCycle)>f.O3DGC_AC_DM_MAX_COUNT)for(a=this.m_totalCount=0;a<this.m_dataSymbols;++a)this.m_totalCount+=this.m_symbolCount[a]=this.m_symbolCount[a]+1>>>1;b=a=0;c=Math.floor(2147483648/this.m_totalCount);if(0===this.m_tableSize)for(d=0;d<this.m_dataSymbols;++d)this.m_distribution[d]=c*a>>>31-f.O3DGC_AC_DM_LENGTH_SHIFT,a+=this.m_symbolCount[d];else{for(d=0;d<this.m_dataSymbols;++d)for(this.m_distribution[d]=c*a>>>31-f.O3DGC_AC_DM_LENGTH_SHIFT,a+=this.m_symbolCount[d],
|
|
270
|
-
e=this.m_distribution[d]>>>this.m_tableShift;b<e;)this.m_decoderTable[++b]=d-1;for(this.m_decoderTable[0]=0;b<=this.m_tableSize;)this.m_decoderTable[++b]=this.m_dataSymbols-1}this.m_updateCycle=5*this.m_updateCycle>>>2;a=this.m_dataSymbols+6<<3>>>0;this.m_updateCycle>a&&(this.m_updateCycle=a);this.m_symbolsUntilUpdate=this.m_updateCycle};d.AdaptiveDataModel.prototype.Reset=function(){var a;if(0!==this.m_dataSymbols){this.m_totalCount=0;this.m_updateCycle=this.m_dataSymbols;for(a=0;a<this.m_dataSymbols;++a)this.m_symbolCount[a]=
|
|
271
|
-
1;this.Update();this.m_symbolsUntilUpdate=this.m_updateCycle=this.m_dataSymbols+6>>>1}};d.AdaptiveDataModel.prototype.SetAlphabet=function(a){if(2>a||2048<a)return Console.log("invalid number of data symbols"),d.O3DGC_ERROR_AC;if(this.m_dataSymbols!==a)if(this.m_dataSymbols=a,this.m_lastSymbol=this.m_dataSymbols-1,16<this.m_dataSymbols){for(a=3;this.m_dataSymbols>1<<a+2>>>0;)++a;this.m_tableSize=1<<a>>>0;this.m_tableShift=f.O3DGC_AC_DM_LENGTH_SHIFT-a;this.m_buffer=new ArrayBuffer(4*(2*this.m_dataSymbols+
|
|
272
|
-
this.m_tableSize+2));this.m_distribution=new Uint32Array(this.m_buffer,0,this.m_dataSymbols);this.m_symbolCount=new Uint32Array(this.m_buffer,4*this.m_dataSymbols,this.m_dataSymbols);this.m_decoderTable=new Uint32Array(this.m_buffer,8*this.m_dataSymbols,this.m_tableSize+2)}else this.m_tableSize=this.m_tableShift=0,this.m_buffer=new ArrayBuffer(8*this.m_dataSymbols),this.m_distribution=new Uint32Array(this.m_buffer,0,this.m_dataSymbols),this.m_symbolCount=new Uint32Array(this.m_buffer,4*this.m_dataSymbols,
|
|
273
|
-
this.m_dataSymbols),this.m_decoderTable={};this.Reset();return d.O3DGC_OK};d.ArithmeticDecoder=function(){this.m_codeBuffer={};this.m_mode=this.m_bufferSize=this.m_length=this.m_value=this.m_base=this.m_acShift=0};d.ArithmeticDecoder.prototype.SetBuffer=function(a,b){if(0===a)return Console.log("invalid codec buffer size"),d.O3DGC_ERROR_AC;if(0!==this.m_mode)return Console.log("cannot set buffer while encoding or decoding"),d.O3DGC_ERROR_AC;this.m_bufferSize=a;this.m_codeBuffer=b};d.ArithmeticDecoder.prototype.StartDecoder=
|
|
274
|
-
function(){if(0!==this.m_mode)return Console.log("cannot start decoder"),d.O3DGC_ERROR_AC;if(0===this.m_bufferSize)return Console.log("no code buffer set"),d.O3DGC_ERROR_AC;this.m_mode=2;this.m_length=f.O3DGC_AC_MAX_LENGTH;this.m_acShift=3;this.m_value=(this.m_codeBuffer[0]<<24|this.m_codeBuffer[1]<<16|this.m_codeBuffer[2]<<8|this.m_codeBuffer[3])>>>0};d.ArithmeticDecoder.prototype.StopDecoder=function(){if(2!==this.m_mode)return Console.log("invalid to stop decoder"),d.O3DGC_ERROR_AC;this.m_mode=
|
|
275
|
-
0};d.ArithmeticDecoder.prototype.GetBit=function(){this.m_length>>>=1;var a=this.m_value>=this.m_length;a&&(this.m_value-=this.m_length);this.m_length<f.O3DGC_AC_MIN_LENGTH&&this.RenormDecInterval();return a};d.ArithmeticDecoder.prototype.GetBits=function(a){a=Math.floor(this.m_value/(this.m_length>>>=a));this.m_value-=this.m_length*a;this.m_length<f.O3DGC_AC_MIN_LENGTH&&this.RenormDecInterval();return a};d.ArithmeticDecoder.prototype.DecodeStaticBitModel=function(a){var b;a=a.m_bit0Prob*(this.m_length>>>
|
|
276
|
-
f.O3DGC_AC_BM_LENGTH_SHIFT);(b=this.m_value>=a)?(this.m_value-=a,this.m_length-=a):this.m_length=a;this.m_length<f.O3DGC_AC_MIN_LENGTH&&this.RenormDecInterval();return b};d.ArithmeticDecoder.prototype.DecodeAdaptiveBitModel=function(a){var b,c;b=a.m_bit0Prob*(this.m_length>>>f.O3DGC_AC_BM_LENGTH_SHIFT);(c=this.m_value>=b)?(this.m_value-=b,this.m_length-=b):(this.m_length=b,++a.m_bit0Count);this.m_length<f.O3DGC_AC_MIN_LENGTH&&this.RenormDecInterval();0===--a.m_bitsUntilUpdate&&a.Update();return c};
|
|
277
|
-
d.ArithmeticDecoder.prototype.DecodeAdaptiveDataModel=function(a){var b,c,d,e,h,p;e=this.m_length;if(0<a.m_tableSize){d=Math.floor(this.m_value/(this.m_length>>>=f.O3DGC_AC_DM_LENGTH_SHIFT));b=d>>>a.m_tableShift;c=a.m_decoderTable[b];for(b=a.m_decoderTable[b+1]+1;b>c+1;)p=c+b>>>1,a.m_distribution[p]>d?b=p:c=p;d=a.m_distribution[c]*this.m_length;c!==a.m_lastSymbol&&(e=a.m_distribution[c+1]*this.m_length)}else{d=c=0;this.m_length>>>=f.O3DGC_AC_DM_LENGTH_SHIFT;p=(b=a.m_dataSymbols)>>>1;do h=this.m_length*
|
|
278
|
-
a.m_distribution[p],h>this.m_value?(b=p,e=h):(c=p,d=h);while((p=c+b>>>1)!==c)}this.m_value-=d;this.m_length=e-d;this.m_length<f.O3DGC_AC_MIN_LENGTH&&this.RenormDecInterval();++a.m_symbolCount[c];0===--a.m_symbolsUntilUpdate&&a.Update(!1);return c};d.ArithmeticDecoder.prototype.ExpGolombDecode=function(a,b,c){var d,e,f;e=d=0;do if(f=this.DecodeAdaptiveBitModel(c))d+=1<<a>>>0,a++;while(f);for(;a--;)this.DecodeStaticBitModel(b)&&(e=(e|1<<a)>>>0);return d+e};d.ArithmeticDecoder.prototype.RenormDecInterval=
|
|
279
|
-
function(){do this.m_value=(this.m_value<<8|this.m_codeBuffer[++this.m_acShift])>>>0,this.m_length=this.m_length<<8>>>0;while(this.m_length<f.O3DGC_AC_MIN_LENGTH)};d.ArithmeticDecoder.prototype.DecodeIntACEGC=function(a,c,d,e,f){a=this.DecodeAdaptiveDataModel(a);a===f&&(a+=this.ExpGolombDecode(e,c,d));return b(a)};d.ArithmeticDecoder.prototype.DecodeUIntACEGC=function(a,b,c,d,e){a=this.DecodeAdaptiveDataModel(a);a===e&&(a+=this.ExpGolombDecode(d,b,c));return a};d.FIFO=function(){this.m_data={};this.m_end=
|
|
280
|
-
this.m_start=this.m_size=this.m_allocated=0};d.FIFO.prototype.Clear=function(){this.m_start=this.m_end=this.m_size=0};d.FIFO.prototype.GetAllocatedSize=function(){return this.m_allocated};d.FIFO.prototype.GetSize=function(){return this.m_size};d.FIFO.prototype.Allocate=function(a){a>this.m_allocated&&(this.m_allocated=a,this.m_data=new Int32Array(this.m_allocated));this.Clear();return d.O3DGC_OK};d.FIFO.prototype.PopFirst=function(){--this.m_size;var a=this.m_start++;this.m_start===this.m_allocated&&
|
|
281
|
-
(this.m_end=0);return this.m_data[a]};d.FIFO.prototype.PushBack=function(a){--this.m_size;this.m_data[this.m_end]=a;++this.m_size;++this.m_end;this.m_end===this.m_allocated&&(this.m_end=0)};d.IndexedFaceSet=function(){this.m_numIntAttributes=this.m_numFloatAttributes=this.m_nNormal=this.m_nCoord=this.m_nCoordIndex=0;this.m_creaseAngle=30;this.m_isTriangularMesh=this.m_convex=this.m_solid=this.m_ccw=!0;this.m_coordMin=new Float32Array(3);this.m_coordMax=new Float32Array(3);this.m_normalMin=new Float32Array(3);
|
|
282
|
-
this.m_normalMax=new Float32Array(3);this.m_nFloatAttribute=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);this.m_nIntAttribute=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);this.m_dimFloatAttribute=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);this.m_dimIntAttribute=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);this.m_typeFloatAttribute=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);this.m_typeIntAttribute=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);
|
|
283
|
-
this.m_minFloatAttributeBuffer=new ArrayBuffer(4*f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES*f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES);this.m_minFloatAttribute=new Float32Array(this.m_minFloatAttributeBuffer);this.m_maxFloatAttributeBuffer=new ArrayBuffer(4*f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES*f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES);this.m_maxFloatAttribute=new Float32Array(this.m_maxFloatAttributeBuffer);this.m_coordIndex={};this.m_coord={};this.m_normal={};this.m_floatAttribute=[];this.m_intAttribute=[]};d.IndexedFaceSet.prototype.GetNCoordIndex=
|
|
284
|
-
function(){return this.m_nCoordIndex};d.IndexedFaceSet.prototype.GetNCoordIndex=function(){return this.m_nCoordIndex};d.IndexedFaceSet.prototype.GetNCoord=function(){return this.m_nCoord};d.IndexedFaceSet.prototype.GetNNormal=function(){return this.m_nNormal};d.IndexedFaceSet.prototype.GetNFloatAttribute=function(a){return this.m_nFloatAttribute[a]};d.IndexedFaceSet.prototype.GetNIntAttribute=function(a){return this.m_nIntAttribute[a]};d.IndexedFaceSet.prototype.GetNumFloatAttributes=function(){return this.m_numFloatAttributes};
|
|
285
|
-
d.IndexedFaceSet.prototype.GetNumIntAttributes=function(){return this.m_numIntAttributes};d.IndexedFaceSet.prototype.GetCoordMinArray=function(){return this.m_coordMin};d.IndexedFaceSet.prototype.GetCoordMaxArray=function(){return this.m_coordMax};d.IndexedFaceSet.prototype.GetNormalMinArray=function(){return this.m_normalMin};d.IndexedFaceSet.prototype.GetNormalMaxArray=function(){return this.m_normalMax};d.IndexedFaceSet.prototype.GetFloatAttributeMinArray=function(a){return new Float32Array(this.m_minFloatAttributeBuffer,
|
|
286
|
-
a*f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES*4,this.GetFloatAttributeDim(a))};d.IndexedFaceSet.prototype.GetFloatAttributeMaxArray=function(a){return new Float32Array(this.m_maxFloatAttributeBuffer,a*f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES*4,this.GetFloatAttributeDim(a))};d.IndexedFaceSet.prototype.GetFloatAttributeDim=function(a){return this.m_dimFloatAttribute[a]};d.IndexedFaceSet.prototype.GetIntAttributeDim=function(a){return this.m_dimIntAttribute[a]};d.IndexedFaceSet.prototype.GetFloatAttributeType=function(a){return this.m_typeFloatAttribute[a]};
|
|
287
|
-
d.IndexedFaceSet.prototype.GetIntAttributeType=function(a){return this.m_typeIntAttribute[a]};d.IndexedFaceSet.prototype.GetFloatAttributeMax=function(a,b){return this.m_maxFloatAttribute[a*f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES+b]};d.IndexedFaceSet.prototype.GetCreaseAngle=function(){return this.m_creaseAngle};d.IndexedFaceSet.prototype.GetCreaseAngle=function(){return this.m_creaseAngle};d.IndexedFaceSet.prototype.GetCCW=function(){return this.m_ccw};d.IndexedFaceSet.prototype.GetSolid=function(){return this.m_solid};
|
|
288
|
-
d.IndexedFaceSet.prototype.GetConvex=function(){return this.m_convex};d.IndexedFaceSet.prototype.GetIsTriangularMesh=function(){return this.m_isTriangularMesh};d.IndexedFaceSet.prototype.GetCoordIndex=function(){return this.m_coordIndex};d.IndexedFaceSet.prototype.GetCoordIndex=function(){return this.m_coordIndex};d.IndexedFaceSet.prototype.GetCoord=function(){return this.m_coord};d.IndexedFaceSet.prototype.GetNormal=function(){return this.m_normal};d.IndexedFaceSet.prototype.GetFloatAttribute=function(a){return this.m_floatAttribute[a]};
|
|
289
|
-
d.IndexedFaceSet.prototype.GetIntAttribute=function(a){return this.m_intAttribute[a]};d.IndexedFaceSet.prototype.SetNCoordIndex=function(a){this.m_nCoordIndex=a};d.IndexedFaceSet.prototype.SetNNormalIndex=function(a){};d.IndexedFaceSet.prototype.SetNormalPerVertex=function(a){};d.IndexedFaceSet.prototype.SetNFloatAttributeIndex=function(a){};d.IndexedFaceSet.prototype.SetNIntAttributeIndex=function(a){};d.IndexedFaceSet.prototype.SetFloatAttributePerVertex=function(a){};d.IndexedFaceSet.prototype.SetIntAttributePerVertex=
|
|
290
|
-
function(a){};d.IndexedFaceSet.prototype.SetNCoord=function(a){this.m_nCoord=a};d.IndexedFaceSet.prototype.SetNNormal=function(a){this.m_nNormal=a};d.IndexedFaceSet.prototype.SetNumFloatAttributes=function(a){this.m_numFloatAttributes=a};d.IndexedFaceSet.prototype.SetNumIntAttributes=function(a){this.m_numIntAttributes=a};d.IndexedFaceSet.prototype.SetCreaseAngle=function(a){this.m_creaseAngle=a};d.IndexedFaceSet.prototype.SetCCW=function(a){this.m_ccw=a};d.IndexedFaceSet.prototype.SetSolid=function(a){this.m_solid=
|
|
291
|
-
a};d.IndexedFaceSet.prototype.SetConvex=function(a){this.m_convex=a};d.IndexedFaceSet.prototype.SetIsTriangularMesh=function(a){this.m_isTriangularMesh=a};d.IndexedFaceSet.prototype.SetCoordMin=function(a,b){this.m_coordMin[a]=b};d.IndexedFaceSet.prototype.SetCoordMax=function(a,b){this.m_coordMax[a]=b};d.IndexedFaceSet.prototype.SetNormalMin=function(a,b){this.m_normalMin[a]=b};d.IndexedFaceSet.prototype.SetNormalMax=function(a,b){this.m_normalMax[a]=b};d.IndexedFaceSet.prototype.SetNFloatAttribute=
|
|
292
|
-
function(a,b){this.m_nFloatAttribute[a]=b};d.IndexedFaceSet.prototype.SetNIntAttribute=function(a,b){this.m_nIntAttribute[a]=b};d.IndexedFaceSet.prototype.SetFloatAttributeDim=function(a,b){this.m_dimFloatAttribute[a]=b};d.IndexedFaceSet.prototype.SetIntAttributeDim=function(a,b){this.m_dimIntAttribute[a]=b};d.IndexedFaceSet.prototype.SetFloatAttributeType=function(a,b){this.m_typeFloatAttribute[a]=b};d.IndexedFaceSet.prototype.SetIntAttributeType=function(a,b){this.m_typeIntAttribute[a]=b};d.IndexedFaceSet.prototype.SetFloatAttributeMin=
|
|
293
|
-
function(a,b,c){this.m_minFloatAttribute[a*f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES+b]=c};d.IndexedFaceSet.prototype.SetFloatAttributeMax=function(a,b,c){this.m_maxFloatAttribute[a*f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES+b]=c};d.IndexedFaceSet.prototype.SetCoordIndex=function(a){this.m_coordIndex=a};d.IndexedFaceSet.prototype.SetCoord=function(a){this.m_coord=a};d.IndexedFaceSet.prototype.SetNormal=function(a){this.m_normal=a};d.IndexedFaceSet.prototype.SetFloatAttribute=function(a,b){this.m_floatAttribute[a]=
|
|
294
|
-
b};d.IndexedFaceSet.prototype.SetIntAttribute=function(a,b){this.m_intAttribute[a]=b};d.SC3DMCEncodeParams=function(){var a;this.m_numIntAttributes=this.m_numFloatAttributes=0;this.m_floatAttributeQuantBits=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);this.m_floatAttributePredMode=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES);this.m_intAttributePredMode=new Uint32Array(f.O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES);this.m_encodeMode=f.O3DGC_SC3DMC_ENCODE_MODE_TFAN;this.m_streamTypeMode=
|
|
295
|
-
f.O3DGC_STREAM_TYPE_ASCII;this.m_coordQuantBits=14;this.m_normalQuantBits=8;this.m_coordPredMode=f.O3DGC_SC3DMC_PARALLELOGRAM_PREDICTION;this.m_normalPredMode=f.O3DGC_SC3DMC_SURF_NORMALS_PREDICTION;for(a=0;a<f.O3DGC_SC3DMC_MAX_NUM_FLOAT_ATTRIBUTES;++a)this.m_floatAttributePredMode[a]=f.O3DGC_SC3DMC_PARALLELOGRAM_PREDICTION;for(a=0;a<f.O3DGC_SC3DMC_MAX_NUM_INT_ATTRIBUTES;++a)this.m_intAttributePredMode[a]=f.O3DGC_SC3DMC_DIFFERENTIAL_PREDICTION};d.SC3DMCEncodeParams.prototype.GetStreamType=function(){return this.m_streamTypeMode};
|
|
296
|
-
d.SC3DMCEncodeParams.prototype.GetEncodeMode=function(){return this.m_encodeMode};d.SC3DMCEncodeParams.prototype.GetNumFloatAttributes=function(){return this.m_numFloatAttributes};d.SC3DMCEncodeParams.prototype.GetNumIntAttributes=function(){return this.m_numIntAttributes};d.SC3DMCEncodeParams.prototype.GetCoordQuantBits=function(){return this.m_coordQuantBits};d.SC3DMCEncodeParams.prototype.GetNormalQuantBits=function(){return this.m_normalQuantBits};d.SC3DMCEncodeParams.prototype.GetFloatAttributeQuantBits=
|
|
297
|
-
function(a){return this.m_floatAttributeQuantBits[a]};d.SC3DMCEncodeParams.prototype.GetCoordPredMode=function(){return this.m_coordPredMode};d.SC3DMCEncodeParams.prototype.GetNormalPredMode=function(){return this.m_normalPredMode};d.SC3DMCEncodeParams.prototype.GetFloatAttributePredMode=function(a){return this.m_floatAttributePredMode[a]};d.SC3DMCEncodeParams.prototype.GetIntAttributePredMode=function(a){return this.m_intAttributePredMode[a]};d.SC3DMCEncodeParams.prototype.GetCoordPredMode=function(){return this.m_coordPredMode};
|
|
298
|
-
d.SC3DMCEncodeParams.prototype.GetNormalPredMode=function(){return this.m_normalPredMode};d.SC3DMCEncodeParams.prototype.GetFloatAttributePredMode=function(a){return this.m_floatAttributePredMode[a]};d.SC3DMCEncodeParams.prototype.GetIntAttributePredMode=function(a){return this.m_intAttributePredMode[a]};d.SC3DMCEncodeParams.prototype.SetStreamType=function(a){this.m_streamTypeMode=a};d.SC3DMCEncodeParams.prototype.SetEncodeMode=function(a){this.m_encodeMode=a};d.SC3DMCEncodeParams.prototype.SetNumFloatAttributes=
|
|
299
|
-
function(a){this.m_numFloatAttributes=a};d.SC3DMCEncodeParams.prototype.SetNumIntAttributes=function(a){this.m_numIntAttributes=a};d.SC3DMCEncodeParams.prototype.SetCoordQuantBits=function(a){this.m_coordQuantBits=a};d.SC3DMCEncodeParams.prototype.SetNormalQuantBits=function(a){this.m_normalQuantBits=a};d.SC3DMCEncodeParams.prototype.SetFloatAttributeQuantBits=function(a,b){this.m_floatAttributeQuantBits[a]=b};d.SC3DMCEncodeParams.prototype.SetCoordPredMode=function(a){this.m_coordPredMode=a};d.SC3DMCEncodeParams.prototype.SetNormalPredMode=
|
|
300
|
-
function(a){this.m_normalPredMode=a};d.SC3DMCEncodeParams.prototype.SetFloatAttributePredMode=function(a,b){this.m_floatAttributePredMode[a]=b};d.SC3DMCEncodeParams.prototype.SetIntAttributePredMode=function(a,b){this.m_intAttributePredMode[a]=b};d.AdjacencyInfo=function(){this.m_numElements=this.m_numNeighborsSize=this.m_neighborsSize=0;this.m_neighbors={};this.m_numNeighbors={}};d.AdjacencyInfo.prototype.Allocate=function(a,b){this.m_numElements=a;b>this.m_neighborsSize&&(this.m_neighborsSize=b,
|
|
301
|
-
this.m_neighbors=new Int32Array(this.m_neighborsSize));a>this.m_numNeighborsSize&&(this.m_numNeighborsSize=a,this.m_numNeighbors=new Int32Array(this.m_numNeighborsSize));return d.O3DGC_OK};d.AdjacencyInfo.prototype.AllocateNumNeighborsArray=function(a){a>this.m_numNeighborsSize&&(this.m_numNeighborsSize=a,this.m_numNeighbors=new Int32Array(this.m_numNeighborsSize));this.m_numElements=a;return d.O3DGC_OK};d.AdjacencyInfo.prototype.AllocateNeighborsArray=function(){var a;for(a=1;a<this.m_numElements;++a)this.m_numNeighbors[a]+=
|
|
302
|
-
this.m_numNeighbors[a-1];this.m_numNeighbors[this.m_numElements-1]>this.m_neighborsSize&&(this.m_neighborsSize=this.m_numNeighbors[this.m_numElements-1],this.m_neighbors=new Int32Array(this.m_neighborsSize));return d.O3DGC_OK};d.AdjacencyInfo.prototype.ClearNumNeighborsArray=function(){var a;for(a=0;a<this.m_numElements;++a)this.m_numNeighbors[a]=0;return d.O3DGC_OK};d.AdjacencyInfo.prototype.ClearNeighborsArray=function(){var a;for(a=0;a<this.m_neighborsSize;++a)this.m_neighbors[a]=-1;return d.O3DGC_OK};
|
|
303
|
-
d.AdjacencyInfo.prototype.Begin=function(a){return 0<a?this.m_numNeighbors[a-1]:0};d.AdjacencyInfo.prototype.End=function(a){return this.m_numNeighbors[a]};d.AdjacencyInfo.prototype.AddNeighbor=function(a,b){var c,e;c=this.Begin(a);for(e=this.End(a);c<e;++c)if(-1===this.m_neighbors[c])return this.m_neighbors[c]=b,d.O3DGC_OK;return d.O3DGC_ERROR_BUFFER_FULL};d.AdjacencyInfo.prototype.GetNeighbor=function(a){return this.m_neighbors[a]};d.AdjacencyInfo.prototype.GetNumNeighbors=function(a){return this.End(a)-
|
|
304
|
-
this.Begin(a)};d.AdjacencyInfo.prototype.GetNumNeighborsBuffer=function(){return this.m_numNeighbors};d.AdjacencyInfo.prototype.GetNeighborsBuffer=function(){return this.m_neighbors};d.Vector=function(){this.m_data={};this.m_size=this.m_allocated=0};d.Vector.prototype.Clear=function(){this.m_size=0};d.Vector.prototype.Get=function(a){return this.m_data[a]};d.Vector.prototype.GetAllocatedSize=function(){return this.m_allocated};d.Vector.prototype.GetSize=function(){return this.m_size};d.Vector.prototype.GetBuffer=
|
|
305
|
-
function(){return this.m_data};d.Vector.prototype.SetSize=function(a){this.m_size=a};d.Vector.prototype.Allocate=function(a){var b;if(a>this.m_allocated){this.m_allocated=a;b=new Int32Array(this.m_allocated);if(0<this.m_size)for(a=0;a<this.m_size;++a)b[a]=this.m_data[a];this.m_data=b}};d.Vector.prototype.PushBack=function(a){var b,c;if(this.m_size===this.m_allocated){this.m_allocated*=2;this.m_allocated<f.O3DGC_DEFAULT_VECTOR_SIZE&&(this.m_allocated=f.O3DGC_DEFAULT_VECTOR_SIZE);c=new Int32Array(this.m_allocated);
|
|
306
|
-
if(0<this.m_size)for(b=0;b<this.m_size;++b)c[b]=this.m_data[b];this.m_data=c}this.m_data[this.m_size++]=a};d.CompressedTriangleFans=function(){this.m_numTFANs=new d.Vector;this.m_degrees=new d.Vector;this.m_configs=new d.Vector;this.m_operations=new d.Vector;this.m_indices=new d.Vector;this.m_trianglesOrder=new d.Vector;this.m_streamType=f.O3DGC_STREAM_TYPE_UNKOWN};d.CompressedTriangleFans.prototype.GetStreamType=function(){return this.m_streamType};d.CompressedTriangleFans.prototype.SetStreamType=
|
|
307
|
-
function(a){this.m_streamType=a};d.CompressedTriangleFans.prototype.Clear=function(){this.m_numTFANs.Clear();this.m_degrees.Clear();this.m_configs.Clear();this.m_operations.Clear();this.m_indices.Clear();return d.O3DGC_OK};d.CompressedTriangleFans.prototype.Allocate=function(a,b){this.m_numTFANs.Allocate(a);this.m_degrees.Allocate(2*a);this.m_configs.Allocate(2*a);this.m_operations.Allocate(2*a);this.m_indices.Allocate(2*a);this.m_trianglesOrder.Allocate(b);this.Clear();return d.O3DGC_OK};d.CompressedTriangleFans.prototype.PushNumTFans=
|
|
308
|
-
function(a){this.m_numTFANs.PushBack(a)};d.CompressedTriangleFans.prototype.ReadNumTFans=function(a){return this.m_numTFANs.Get(a.m_count++)};d.CompressedTriangleFans.prototype.PushDegree=function(a){this.m_degrees.PushBack(a)};d.CompressedTriangleFans.prototype.ReadDegree=function(a){return this.m_degrees.Get(a.m_count++)};d.CompressedTriangleFans.prototype.PushConfig=function(a){this.m_configs.PushBack(a)};d.CompressedTriangleFans.prototype.ReadConfig=function(a){return this.m_configs.Get(a.m_count++)};
|
|
309
|
-
d.CompressedTriangleFans.prototype.PushOperation=function(a){this.m_operations.PushBack(a)};d.CompressedTriangleFans.prototype.ReadOperation=function(a){return this.m_operations.Get(a.m_count++)};d.CompressedTriangleFans.prototype.PushIndex=function(a){this.m_indices.PushBack(a)};d.CompressedTriangleFans.prototype.ReadIndex=function(a){return this.m_indices.Get(a.m_count++)};d.CompressedTriangleFans.prototype.PushTriangleIndex=function(a){this.m_trianglesOrder.PushBack(0>a?-1-2*a:2*a)};d.CompressedTriangleFans.prototype.ReadTriangleIndex=
|
|
310
|
-
function(a){return b(this.m_trianglesOrder.Get(a.m_count++))};d.CompressedTriangleFans.prototype.LoadUIntData=function(a,b,c){var e,f;b.ReadUInt32ASCII(c);e=b.ReadUInt32ASCII(c);a.Allocate(e);a.Clear();for(f=0;f<e;++f)a.PushBack(b.ReadUIntASCII(c));return d.O3DGC_OK};d.CompressedTriangleFans.prototype.LoadIntData=function(a,b,c){var e,f;b.ReadUInt32ASCII(c);e=b.ReadUInt32ASCII(c);a.Allocate(e);a.Clear();for(f=0;f<e;++f)a.PushBack(b.ReadIntASCII(c));return d.O3DGC_OK};d.CompressedTriangleFans.prototype.LoadBinData=
|
|
311
|
-
function(a,b,c){var e,n,h,p;b.ReadUInt32ASCII(c);e=b.ReadUInt32ASCII(c);a.Allocate(e*f.O3DGC_BINARY_STREAM_BITS_PER_SYMBOL0);a.Clear();for(h=0;h<e;)for(n=b.ReadUCharASCII(c),p=0;p<f.O3DGC_BINARY_STREAM_BITS_PER_SYMBOL0;++p)a.PushBack(n&1),n>>>=1,++h;return d.O3DGC_OK};d.CompressedTriangleFans.prototype.LoadUIntAC=function(a,b,c,e){var f,h,p;f=c.ReadUInt32Bin(e)-12;h=c.ReadUInt32Bin(e);if(0===h)return d.O3DGC_OK;p=c.ReadUInt32Bin(e);c=c.GetBuffer(e,f);e.m_count+=f;a.Allocate(h);e=new d.ArithmeticDecoder;
|
|
312
|
-
e.SetBuffer(f,c);e.StartDecoder();f=new d.AdaptiveDataModel;f.SetAlphabet(b+1);for(b=0;b<h;++b)a.PushBack(e.DecodeAdaptiveDataModel(f)+p);return d.O3DGC_OK};d.CompressedTriangleFans.prototype.LoadIntACEGC=function(a,b,c,e){var n,h,p,r,g,k;n=c.ReadUInt32Bin(e)-12;h=c.ReadUInt32Bin(e);if(0===h)return d.O3DGC_OK;p=c.ReadUInt32Bin(e)-f.O3DGC_MAX_LONG;c=c.GetBuffer(e,n);e.m_count+=n;a.Allocate(h);e=new d.ArithmeticDecoder;e.SetBuffer(n,c);e.StartDecoder();n=new d.AdaptiveDataModel;n.SetAlphabet(b+2);c=
|
|
313
|
-
new d.StaticBitModel;r=new d.AdaptiveBitModel;for(k=0;k<h;++k)g=e.DecodeAdaptiveDataModel(n),g===b&&(g+=e.ExpGolombDecode(0,c,r)),a.PushBack(g+p);return d.O3DGC_OK};d.CompressedTriangleFans.prototype.LoadBinAC=function(a,b,c){var e,f;e=b.ReadUInt32Bin(c)-8;f=b.ReadUInt32Bin(c);if(0===f)return d.O3DGC_OK;b=b.GetBuffer(c,e);c.m_count+=e;a.Allocate(f);c=new d.ArithmeticDecoder;c.SetBuffer(e,b);c.StartDecoder();e=new d.AdaptiveBitModel;for(b=0;b<f;++b)a.PushBack(c.DecodeAdaptiveBitModel(e));return d.O3DGC_OK};
|
|
314
|
-
d.CompressedTriangleFans.prototype.Load=function(a,b,c,e){e===f.O3DGC_STREAM_TYPE_ASCII?(this.LoadUIntData(this.m_numTFANs,a,b),this.LoadUIntData(this.m_degrees,a,b),this.LoadUIntData(this.m_configs,a,b),this.LoadBinData(this.m_operations,a,b),this.LoadIntData(this.m_indices,a,b),c&&this.LoadUIntData(this.m_trianglesOrder,a,b)):(this.LoadIntACEGC(this.m_numTFANs,4,a,b),this.LoadIntACEGC(this.m_degrees,16,a,b),this.LoadUIntAC(this.m_configs,10,a,b),this.LoadBinAC(this.m_operations,a,b),this.LoadIntACEGC(this.m_indices,
|
|
315
|
-
8,a,b),c&&this.LoadIntACEGC(this.m_trianglesOrder,16,a,b));return d.O3DGC_OK};d.TriangleFans=function(){this.m_numVertices=this.m_numTFANs=this.m_sizeTFANAllocatedSize=this.m_verticesAllocatedSize=0;this.m_sizeTFAN={};this.m_vertices={}};d.TriangleFans.prototype.Allocate=function(a,b){this.m_numVertices=this.m_numTFANs=0;this.m_verticesAllocatedSize<b&&(this.m_verticesAllocatedSize=b,this.m_vertices=new Int32Array(this.m_verticesAllocatedSize));this.m_sizeTFANAllocatedSize<a&&(this.m_sizeTFANAllocatedSize=
|
|
316
|
-
a,this.m_sizeTFAN=new Int32Array(this.m_sizeTFANAllocatedSize));return d.O3DGC_OK};d.TriangleFans.prototype.Clear=function(){this.m_numVertices=this.m_numTFANs=0;return d.O3DGC_OK};d.TriangleFans.prototype.AddVertex=function(a){var b,c;++this.m_numVertices;if(this.m_numVertices>this.m_verticesAllocatedSize){this.m_verticesAllocatedSize*=2;c=new Int32Array(this.m_verticesAllocatedSize);for(b=0;b<this.m_numVertices;++b)c[b]=this.m_vertices[b];this.m_vertices=c}this.m_vertices[this.m_numVertices-1]=
|
|
317
|
-
a;++this.m_sizeTFAN[this.m_numTFANs-1];return d.O3DGC_OK};d.TriangleFans.prototype.AddTFAN=function(){var a,b;++this.m_numTFANs;if(this.m_numTFANs>this.m_sizeTFANAllocatedSize){this.m_sizeTFANAllocatedSize*=2;b=new Int32Array(this.m_sizeTFANAllocatedSize);for(a=0;a<this.m_numTFANs;++a)b[a]=this.m_sizeTFAN[a];this.m_sizeTFAN=b}this.m_sizeTFAN[this.m_numTFANs-1]=1<this.m_numTFANs?this.m_sizeTFAN[this.m_numTFANs-2]:0;return d.O3DGC_OK};d.TriangleFans.prototype.Begin=function(a){return 0<a?this.m_sizeTFAN[a-
|
|
318
|
-
1]:0};d.TriangleFans.prototype.End=function(a){return this.m_sizeTFAN[a]};d.TriangleFans.prototype.GetVertex=function(a){return this.m_vertices[a]};d.TriangleFans.prototype.GetTFANSize=function(a){return this.End(a)-this.Begin(a)};d.TriangleFans.prototype.GetNumTFANs=function(){return this.m_numTFANs};d.TriangleFans.prototype.GetNumVertices=function(){return this.m_numVertices};d.TriangleListDecoder=function(){this.m_itNumTFans=new d.Iterator;this.m_itDegree=new d.Iterator;this.m_itConfig=new d.Iterator;
|
|
319
|
-
this.m_itOperation=new d.Iterator;this.m_itIndex=new d.Iterator;this.m_numVisitedVertices=this.m_numConqueredTriangles=this.m_triangleCount=this.m_vertexCount=this.m_tempTrianglesSize=this.m_numVertices=this.m_numTriangles=this.m_maxNumTriangles=this.m_maxNumVertices=0;this.m_triangles={};this.m_tempTriangles={};this.m_visitedVertices={};this.m_visitedVerticesValence={};this.m_vertexToTriangle=new d.AdjacencyInfo;this.m_ctfans=new d.CompressedTriangleFans;this.m_tfans=new d.TriangleFans;this.m_streamType=
|
|
320
|
-
f.O3DGC_STREAM_TYPE_ASCII;this.m_decodeVerticesOrder=this.m_decodeTrianglesOrder=!1;this.m_processConfig={0:function(a,b){var c;a.m_tfans.AddVertex(a.m_visitedVertices[0]);for(c=1;c<b-1;++c)a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++);a.m_tfans.AddVertex(a.m_visitedVertices[1])},1:function(a,b,c){var d,e;a.m_tfans.AddVertex(a.m_visitedVertices[0]);for(d=1;d<b-1;++d)e=a.m_ctfans.ReadOperation(a.m_itOperation),1===e?(e=a.m_ctfans.ReadIndex(a.m_itIndex),
|
|
321
|
-
0>e?a.m_tfans.AddVertex(a.m_visitedVertices[-e-1]):a.m_tfans.AddVertex(e+c)):(a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++));a.m_tfans.AddVertex(a.m_visitedVertices[1])},2:function(a,b){var c;for(c=0;c<b-1;++c)a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++);a.m_tfans.AddVertex(a.m_visitedVertices[0])},3:function(a,b){var c;for(c=0;c<b-1;++c)a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,
|
|
322
|
-
a.m_tfans.AddVertex(a.m_vertexCount++);a.m_tfans.AddVertex(a.m_visitedVertices[1])},4:function(a,b){var c;a.m_tfans.AddVertex(a.m_visitedVertices[0]);for(c=1;c<b;++c)a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++)},5:function(a,b){var c;a.m_tfans.AddVertex(a.m_visitedVertices[1]);for(c=1;c<b;++c)a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++)},6:function(a,b){var c;for(c=0;c<b;++c)a.m_visitedVertices[a.m_numVisitedVertices++]=
|
|
323
|
-
a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++)},7:function(a,b){var c;a.m_tfans.AddVertex(a.m_visitedVertices[1]);for(c=1;c<b-1;++c)a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++);a.m_tfans.AddVertex(a.m_visitedVertices[0])},8:function(a,b,c){var d,e;a.m_tfans.AddVertex(a.m_visitedVertices[1]);for(d=1;d<b-1;++d)e=a.m_ctfans.ReadOperation(a.m_itOperation),1===e?(e=a.m_ctfans.ReadIndex(a.m_itIndex),0>e?a.m_tfans.AddVertex(a.m_visitedVertices[-e-
|
|
324
|
-
1]):a.m_tfans.AddVertex(e+c)):(a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++));a.m_tfans.AddVertex(a.m_visitedVertices[0])},9:function(a,b,c){var d,e;for(d=0;d<b;++d)e=a.m_ctfans.ReadOperation(a.m_itOperation),1===e?(e=a.m_ctfans.ReadIndex(a.m_itIndex),0>e?a.m_tfans.AddVertex(a.m_visitedVertices[-e-1]):a.m_tfans.AddVertex(e+c)):(a.m_visitedVertices[a.m_numVisitedVertices++]=a.m_vertexCount,a.m_tfans.AddVertex(a.m_vertexCount++))}}};d.TriangleListDecoder.prototype.GetStreamType=
|
|
325
|
-
function(){return this.m_streamType};d.TriangleListDecoder.prototype.GetReorderTriangles=function(){return this.m_decodeTrianglesOrder};d.TriangleListDecoder.prototype.GetReorderVertices=function(){return this.m_decodeVerticesOrder};d.TriangleListDecoder.prototype.SetStreamType=function(a){this.m_streamType=a};d.TriangleListDecoder.prototype.GetVertexToTriangle=function(){return this.m_vertexToTriangle};d.TriangleListDecoder.prototype.Reorder=function(){var a,c,e,f,n,h,p;if(this.m_decodeTrianglesOrder)for(a=
|
|
326
|
-
this.m_triangles,c=this.m_numTriangles,e=this.m_ctfans.m_trianglesOrder.m_data,h=this.m_tempTriangles,h.set(a),p=n=f=0;p<c;++p)n=b(e[f++])+n,a[3*n]=h[3*p],a[3*n+1]=h[3*p+1],a[3*n+2]=h[3*p+2],n+=1;return d.O3DGC_OK};d.TriangleListDecoder.prototype.CompueLocalConnectivityInfo=function(a){var b,c,e,f,h,p,r,g,k,m,w,t,y,v;b=this.m_visitedVertices;c=this.m_visitedVerticesValence;e=this.m_triangles;f=this.m_vertexToTriangle;h=f.Begin(a);p=f.End(a);for(t=k=r=0;0<=t&&h<p;++h)if(t=f.GetNeighbor(h),0<=t)for(++r,
|
|
327
|
-
y=3*t,w=0;3>w;++w)if(v=e[y+w],v>a){g=!1;for(m=0;m<k;++m)if(v===b[m]){c[m]++;g=!0;break}else if(v<b[m]){++k;for(g=k-1;g>m;--g)b[g]=b[g-1],c[g]=c[g-1];b[m]=v;c[m]=1;g=!0;break}g||(b[k]=v,c[k]=1,k++)}if(2<k)for(e=1;e<k;++e)if(1===c[e])for(f=e;0<f&&c[f]<c[f-1];)a=c[f],c[f]=c[f-1],c[f-1]=a,a=b[f],b[f]=b[f-1],b[f-1]=a,--f;this.m_numConqueredTriangles=r;this.m_numVisitedVertices=k;return d.O3DGC_OK};d.TriangleListDecoder.prototype.DecompressTFAN=function(a){var b,c,e,f,h,p,r,g,k,m,w,t,y,v,A,x;b=this.m_vertexToTriangle;
|
|
328
|
-
c=this.m_triangles;e=this.m_itDegree;f=this.m_itConfig;h=this.m_tfans;r=this.m_processConfig;g=this.m_ctfans;k=this.m_triangleCount;m=this.m_numConqueredTriangles;p=g.ReadNumTFans(this.m_itNumTFans);if(0<p)for(A=0;A<p;++A)for(h.AddTFAN(),w=g.ReadDegree(e)+2-m,t=g.ReadConfig(f),y=h.GetNumVertices(),h.AddVertex(a),r[t](this,w,a),w=h.GetNumVertices(),t=h.GetVertex(y+1),x=y+2;x<w;++x)y=h.GetVertex(x),v=3*k,c[v++]=a,c[v++]=t,c[v]=y,b.AddNeighbor(a,k),b.AddNeighbor(t,k),b.AddNeighbor(y,k),t=y,k++;this.m_triangleCount=
|
|
329
|
-
k;return d.O3DGC_OK};d.TriangleListDecoder.prototype.Decompress=function(){var a;for(a=0;a<this.m_numVertices;++a)a===this.m_vertexCount&&this.m_vertexCount++,this.CompueLocalConnectivityInfo(a),this.DecompressTFAN(a);return d.O3DGC_OK};d.TriangleListDecoder.prototype.Init=function(a,b,c,e){this.m_numTriangles=b;this.m_numVertices=c;this.m_triangles=a;this.m_triangleCount=this.m_vertexCount=0;this.m_itNumTFans.m_count=0;this.m_itDegree.m_count=0;this.m_itConfig.m_count=0;this.m_itOperation.m_count=
|
|
330
|
-
0;this.m_itIndex.m_count=0;this.m_numVertices>this.m_maxNumVertices&&(this.m_maxNumVertices=this.m_numVertices,this.m_visitedVerticesValence=new Int32Array(this.m_numVertices),this.m_visitedVertices=new Int32Array(this.m_numVertices));this.m_decodeTrianglesOrder&&this.m_tempTrianglesSize<this.m_numTriangles&&(this.m_tempTrianglesSize=this.m_numTriangles,this.m_tempTriangles=new Int32Array(3*this.m_tempTrianglesSize));this.m_ctfans.SetStreamType(this.m_streamType);this.m_ctfans.Allocate(this.m_numVertices,
|
|
331
|
-
this.m_numTriangles);this.m_tfans.Allocate(2*this.m_numVertices,8*this.m_numVertices);this.m_vertexToTriangle.AllocateNumNeighborsArray(c);b=this.m_vertexToTriangle.GetNumNeighborsBuffer();for(a=0;a<c;++a)b[a]=e;this.m_vertexToTriangle.AllocateNeighborsArray();this.m_vertexToTriangle.ClearNeighborsArray();return d.O3DGC_OK};d.TriangleListDecoder.prototype.Decode=function(a,b,c,e,f){var h;h=e.ReadUChar(f,this.m_streamType);this.m_decodeTrianglesOrder=0!==(h&2);if(this.m_decodeVerticesOrder=0!==(h&
|
|
332
|
-
1))return d.O3DGC_ERROR_NON_SUPPORTED_FEATURE;h=e.ReadUInt32(f,this.m_streamType);this.Init(a,b,c,h);this.m_ctfans.Load(e,f,this.m_decodeTrianglesOrder,this.m_streamType);this.Decompress();return d.O3DGC_OK};d.SC3DMCDecoder=function(){var a;this.m_iterator=new d.Iterator;this.m_streamSize=0;this.m_params=new d.SC3DMCEncodeParams;this.m_triangleListDecoder=new d.TriangleListDecoder;this.m_quantFloatArray={};this.m_orientation={};this.m_normals={};this.m_orientationSize=this.m_normalsSize=this.m_quantFloatArraySize=
|
|
333
|
-
0;this.m_stats=new d.SC3DMCStats;this.m_streamType=f.O3DGC_STREAM_TYPE_UNKOWN;this.m_neighbors=[];this.m_idelta=new Float32Array(f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES);this.m_minNormal=new Float32Array(2);this.m_maxNormal=new Float32Array(2);this.m_minNormal[0]=this.m_minNormal[1]=-2;this.m_maxNormal[0]=this.m_maxNormal[1]=2;for(a=0;a<f.O3DGC_SC3DMC_MAX_DIM_ATTRIBUTES;++a)this.m_neighbors[a]=new d.SC3DMCPredictor};d.SC3DMCDecoder.prototype.GetStats=function(){return this.m_stats};d.SC3DMCDecoder.prototype.DecodeHeader=
|
|
334
|
-
function(a,b){var c,e,n;c=this.m_iterator.m_count;e=b.ReadUInt32(this.m_iterator,f.O3DGC_STREAM_TYPE_BINARY);if(e!==f.O3DGC_SC3DMC_START_CODE){this.m_iterator.m_count=c;e=b.ReadUInt32(this.m_iterator,f.O3DGC_STREAM_TYPE_ASCII);if(e!==f.O3DGC_SC3DMC_START_CODE)return d.O3DGC_ERROR_CORRUPTED_STREAM;this.m_streamType=f.O3DGC_STREAM_TYPE_ASCII}else this.m_streamType=f.O3DGC_STREAM_TYPE_BINARY;this.m_streamSize=b.ReadUInt32(this.m_iterator,this.m_streamType);this.m_params.SetEncodeMode(b.ReadUChar(this.m_iterator,
|
|
335
|
-
this.m_streamType));a.SetCreaseAngle(b.ReadFloat32(this.m_iterator,this.m_streamType));c=b.ReadUChar(this.m_iterator,this.m_streamType);a.SetCCW(1===(c&1));a.SetSolid(1===(c&2));a.SetConvex(1===(c&4));a.SetIsTriangularMesh(1===(c&8));a.SetNCoord(b.ReadUInt32(this.m_iterator,this.m_streamType));a.SetNNormal(b.ReadUInt32(this.m_iterator,this.m_streamType));a.SetNumFloatAttributes(b.ReadUInt32(this.m_iterator,this.m_streamType));a.SetNumIntAttributes(b.ReadUInt32(this.m_iterator,this.m_streamType));
|
|
336
|
-
if(0<a.GetNCoord()){a.SetNCoordIndex(b.ReadUInt32(this.m_iterator,this.m_streamType));for(c=0;3>c;++c)a.SetCoordMin(c,b.ReadFloat32(this.m_iterator,this.m_streamType)),a.SetCoordMax(c,b.ReadFloat32(this.m_iterator,this.m_streamType));this.m_params.SetCoordQuantBits(b.ReadUChar(this.m_iterator,this.m_streamType))}if(0<a.GetNNormal()){a.SetNNormalIndex(b.ReadUInt32(this.m_iterator,this.m_streamType));for(c=0;3>c;++c)a.SetNormalMin(c,b.ReadFloat32(this.m_iterator,this.m_streamType)),a.SetNormalMax(c,
|
|
337
|
-
b.ReadFloat32(this.m_iterator,this.m_streamType));a.SetNormalPerVertex(1===b.ReadUChar(this.m_iterator,this.m_streamType));this.m_params.SetNormalQuantBits(b.ReadUChar(this.m_iterator,this.m_streamType))}for(e=0;e<a.GetNumFloatAttributes();++e)if(a.SetNFloatAttribute(e,b.ReadUInt32(this.m_iterator,this.m_streamType)),0<a.GetNFloatAttribute(e)){a.SetNFloatAttributeIndex(e,b.ReadUInt32(this.m_iterator,this.m_streamType));n=b.ReadUChar(this.m_iterator,this.m_streamType);a.SetFloatAttributeDim(e,n);for(c=
|
|
338
|
-
0;c<n;++c)a.SetFloatAttributeMin(e,c,b.ReadFloat32(this.m_iterator,this.m_streamType)),a.SetFloatAttributeMax(e,c,b.ReadFloat32(this.m_iterator,this.m_streamType));a.SetFloatAttributePerVertex(e,1===b.ReadUChar(this.m_iterator,this.m_streamType));a.SetFloatAttributeType(e,b.ReadUChar(this.m_iterator,this.m_streamType));this.m_params.SetFloatAttributeQuantBits(e,b.ReadUChar(this.m_iterator,this.m_streamType))}for(e=0;e<a.GetNumIntAttributes();++e)a.SetNIntAttribute(e,b.ReadUInt32(this.m_iterator,this.m_streamType)),
|
|
339
|
-
0<a.GetNIntAttribute(e)&&(a.SetNIntAttributeIndex(e,b.ReadUInt32(this.m_iterator,this.m_streamType)),a.SetIntAttributeDim(e,b.ReadUChar(this.m_iterator,this.m_streamType)),a.SetIntAttributePerVertex(e,1===b.ReadUChar(this.m_iterator,this.m_streamType)),a.SetIntAttributeType(e,b.ReadUChar(this.m_iterator,this.m_streamType)));return d.O3DGC_OK};d.SC3DMCDecoder.prototype.DecodeIntArrayBinary=function(a,b,e,u,n,h,p){var r,g,k,m,w,t,y,v,A,x,B,E,G,D,z,C,F;m=this.m_iterator;w=this.m_streamType;t=new d.ArithmeticDecoder;
|
|
340
|
-
y=new d.StaticBitModel;v=new d.AdaptiveBitModel;A=new d.AdaptiveDataModel;A.SetAlphabet(f.O3DGC_SC3DMC_MAX_PREDICTION_NEIGHBORS+1);x=this.m_triangleListDecoder.GetVertexToTriangle();B=x.m_neighbors;n=n.GetCoordIndex();E=m.m_count;G=p.ReadUInt32(m,w);D=p.ReadUChar(m,w);w=D>>>4&7;h.m_value=D&7;G-=m.m_count-E;E=new d.Iterator;E.m_count=m.m_count+G;new d.SC3DMCTriplet(-1,-1,-1);if(w!==f.O3DGC_SC3DMC_BINARIZATION_AC_EGC)return d.O3DGC_ERROR_CORRUPTED_STREAM;p=p.GetBuffer(m,G);m.m_count+=G;t.SetBuffer(G,
|
|
341
|
-
p);t.StartDecoder();G=t.ExpGolombDecode(0,y,v);w=t.ExpGolombDecode(0,y,v);D=new d.AdaptiveDataModel;D.SetAlphabet(w+2);z=this.m_neighbors;C=new d.NumberRef;p=h.m_value!==f.O3DGC_SC3DMC_NO_PREDICTION;for(F=0;F<b;++F){C.m_value=0;if(0<x.GetNumNeighbors(F)&&p)for(g=x.Begin(F),r=x.End(F);g<r;++g){k=B[g];if(0>k)break;c(n,k,F,C,z,e,a,u)}if(1<C.m_value)for(r=t.DecodeAdaptiveDataModel(A),g=0;g<e;++g)k=t.DecodeIntACEGC(D,y,v,G,w),a[F*u+g]=k+z[r].m_pred[g];else if(0<F&&h.m_value!==f.O3DGC_SC3DMC_NO_PREDICTION)for(g=
|
|
342
|
-
0;g<e;++g)k=t.DecodeIntACEGC(D,y,v,G,w),a[F*u+g]=k+a[(F-1)*u+g];else for(g=0;g<e;++g)k=t.DecodeUIntACEGC(D,y,v,G,w),a[F*u+g]=k}m.m_count=E.m_count;return d.O3DGC_OK};d.SC3DMCDecoder.prototype.DecodeIntArrayASCII=function(a,b,e,u,n,h,p){var r,g,k,m,w,t,y,v,A,x,B;g=this.m_iterator;r=this.m_streamType;m=this.m_triangleListDecoder.GetVertexToTriangle();w=m.m_neighbors;n=n.GetCoordIndex();t=g.m_count;y=p.ReadUInt32(g,r);v=p.ReadUChar(g,r);A=v>>>4&7;h.m_value=v&7;y-=g.m_count-t;t=new d.Iterator;t.m_count=
|
|
343
|
-
g.m_count+y;new d.SC3DMCTriplet(-1,-1,-1);if(A!==f.O3DGC_SC3DMC_BINARIZATION_ASCII)return d.O3DGC_ERROR_CORRUPTED_STREAM;p.ReadUInt32(t,r);y=this.m_neighbors;A=new d.NumberRef;r=h.m_value!==f.O3DGC_SC3DMC_NO_PREDICTION;for(v=0;v<b;++v){A.m_value=0;if(0<m.GetNumNeighbors(v)&&r)for(x=m.Begin(v),k=m.End(v);x<k;++x){B=w[x];if(0>B)break;c(n,B,v,A,y,e,a,u)}if(1<A.m_value)for(B=p.ReadUCharASCII(t),x=0;x<e;++x)k=p.ReadIntASCII(g),a[v*u+x]=k+y[B].m_pred[x];else if(0<v&&h.m_value!==f.O3DGC_SC3DMC_NO_PREDICTION)for(x=
|
|
344
|
-
0;x<e;++x)k=p.ReadIntASCII(g),a[v*u+x]=k+a[(v-1)*u+x];else for(x=0;x<e;++x)k=p.ReadUIntASCII(g),a[v*u+x]=k}g.m_count=t.m_count;return d.O3DGC_OK};d.SC3DMCDecoder.prototype.DecodeIntArray=function(a,b,c,d,e,h,p){return this.m_streamType===f.O3DGC_STREAM_TYPE_ASCII?this.DecodeIntArrayASCII(a,b,c,d,e,h,p):this.DecodeIntArrayBinary(a,b,c,d,e,h,p)};d.SC3DMCDecoder.prototype.ProcessNormals=function(a){var b,c,e,f,h,p,r,g;e=a.GetNNormal();f=3*a.GetNNormal();this.m_normalsSize<f&&(this.m_normalsSize=f,this.m_normals=
|
|
345
|
-
new Float32Array(this.m_normalsSize));f=this.m_normals;h=this.m_quantFloatArray;p=this.m_orientation;r=a.GetCoordIndex();a=a.GetNCoordIndex();var k,m,w,t;c=new d.Vec3;b=new d.Vec3;g=new d.Vec3;w=3*e;for(m=0;m<w;++m)f[m]=0;for(m=0;m<a;++m)k=3*m,w=3*r[k],t=3*r[k+1],k=3*r[k+2],b.m_x=h[t]-h[w],b.m_y=h[t+1]-h[w+1],b.m_z=h[t+2]-h[w+2],g.m_x=h[k]-h[w],g.m_y=h[k+1]-h[w+1],g.m_z=h[k+2]-h[w+2],c.m_x=b.m_y*g.m_z-b.m_z*g.m_y,c.m_y=b.m_z*g.m_x-b.m_x*g.m_z,c.m_z=b.m_x*g.m_y-b.m_y*g.m_x,f[w]+=c.m_x,f[w+1]+=c.m_y,
|
|
346
|
-
f[w+2]+=c.m_z,f[t]+=c.m_x,f[t+1]+=c.m_y,f[t+2]+=c.m_z,f[k]+=c.m_x,f[k+1]+=c.m_y,f[k+2]+=c.m_z;h=new d.Vec3;r=new d.Vec3;for(a=0;a<e;++a)b=3*a,h.m_x=f[b],h.m_y=f[b+1],h.m_z=f[b+2],b=Math.sqrt(h.m_x*h.m_x+h.m_y*h.m_y+h.m_z*h.m_z),0===b&&(b=1),g=h,c=r,t=w=m=void 0,m=Math.abs(g.m_x),w=Math.abs(g.m_y),t=Math.abs(g.m_z),t>=m&&t>=w?0<=g.m_z?(c.m_z=0,c.m_x=g.m_x,c.m_y=g.m_y):(c.m_z=1,c.m_x=-g.m_x,c.m_y=-g.m_y):w>=m&&w>=t?0<=g.m_y?(c.m_z=2,c.m_x=g.m_z,c.m_y=g.m_x):(c.m_z=3,c.m_x=-g.m_z,c.m_y=-g.m_x):0<=g.m_x?
|
|
347
|
-
(c.m_z=4,c.m_x=g.m_y,c.m_y=g.m_z):(c.m_z=5,c.m_x=-g.m_y,c.m_y=-g.m_z),g=r.m_x/b,b=r.m_y/b,c=r.m_z+p[a],p[a]=c,c>>>1!==r.m_z>>>1&&(b=g=0),c=2*a,f[c]=g,f[c+1]=b;return d.O3DGC_OK};d.SC3DMCDecoder.prototype.IQuantize=function(a,b,c,e,n,h,p,r){var g,k;if(r.m_value===f.O3DGC_SC3DMC_SURF_NORMALS_PREDICTION)for(k=f.CubeToSphere,r=this.m_orientation,g=this.m_normals,n=new d.Vec3(0,0,0),h=new d.Vec3(0,0,0),this.IQuantizeFloatArray(a,b,c,e,this.m_minNormal,this.m_maxNormal,p+1),c=0;c<b;++c)n.m_x=a[e*c]+g[2*
|
|
348
|
-
c],n.m_y=a[e*c+1]+g[2*c+1],n.m_z=r[c],k[n.m_z](n,h),a[e*c]=h.m_x,a[e*c+1]=h.m_y,a[e*c+2]=h.m_z;else this.IQuantizeFloatArray(a,b,c,e,n,h,p)};d.SC3DMCDecoder.prototype.DecodeFloatArrayBinary=function(a,l,s,u,n,h,p,r,g,k){var m,w,t,y,v,A,x,B,E,G,D,z,C,F,H,M,J,L,N,K,I;D=this.m_iterator;w=this.m_orientation;z=this.m_streamType;C=new d.ArithmeticDecoder;F=new d.StaticBitModel;H=new d.AdaptiveBitModel;M=new d.AdaptiveDataModel;m=f.O3DGC_SC3DMC_MAX_PREDICTION_NEIGHBORS;M.SetAlphabet(m+1);J=this.m_triangleListDecoder.GetVertexToTriangle();
|
|
349
|
-
L=J.m_neighbors;N=r.GetCoordIndex();y=l*s;K=D.m_count;I=k.ReadUInt32(D,z);v=k.ReadUChar(D,z);z=v>>>4&7;g.m_value=v&7;I-=D.m_count-K;K=new d.Iterator;K.m_count=D.m_count+I;if(z!==f.O3DGC_SC3DMC_BINARIZATION_AC_EGC)return d.O3DGC_ERROR_CORRUPTED_STREAM;k=k.GetBuffer(D,I);D.m_count+=I;C.SetBuffer(I,k);C.StartDecoder();I=C.ExpGolombDecode(0,F,H);k=C.ExpGolombDecode(0,F,H);z=new d.AdaptiveDataModel;z.SetAlphabet(k+2);if(g.m_value===f.O3DGC_SC3DMC_SURF_NORMALS_PREDICTION){this.m_orientationSize<y&&(this.m_orientationSize=
|
|
350
|
-
y,w=this.m_orientation=new Int8Array(this.m_orientationSize));s=new d.AdaptiveDataModel;s.SetAlphabet(12);for(x=0;x<l;++x)w[x]=b(C.DecodeAdaptiveDataModel(s));this.ProcessNormals(r);s=2}this.m_quantFloatArraySize<y&&(this.m_quantFloatArraySize=y,this.m_quantFloatArray=new Int32Array(this.m_quantFloatArraySize));y=this.m_quantFloatArray;v=this.m_neighbors;A=new d.NumberRef;r=g.m_value!==f.O3DGC_SC3DMC_NO_PREDICTION;w=g.m_value===f.O3DGC_SC3DMC_PARALLELOGRAM_PREDICTION;for(B=0;B<l;++B){A.m_value=0;
|
|
351
|
-
if(0<J.GetNumNeighbors(B)&&r){E=J.Begin(B);G=J.End(B);if(w)for(t=E;t<G;++t){x=L[t];if(0>x)break;e(N,x,B,A,v,s,y,u,J,L)}if(A.m_value<m)for(t=E;t<G;++t){x=L[t];if(0>x)break;c(N,x,B,A,v,s,y,u)}}if(1<A.m_value)for(t=C.DecodeAdaptiveDataModel(M),x=0;x<s;++x)E=C.DecodeIntACEGC(z,F,H,I,k),y[B*u+x]=E+v[t].m_pred[x];else if(0<B&&r)for(x=0;x<s;++x)E=C.DecodeIntACEGC(z,F,H,I,k),y[B*u+x]=E+y[(B-1)*u+x];else for(x=0;x<s;++x)E=C.DecodeUIntACEGC(z,F,H,I,k),y[B*u+x]=E}D.m_count=K.m_count;this.IQuantize(a,l,s,u,n,
|
|
352
|
-
h,p,g);return d.O3DGC_OK};d.SC3DMCDecoder.prototype.DecodeFloatArrayASCII=function(a,b,s,u,n,h,p,r,g,k){var m,w,t,y,v,A,x,B,E,G,D,z,C,F,H;m=f.O3DGC_SC3DMC_MAX_PREDICTION_NEIGHBORS;t=this.m_iterator;w=this.m_orientation;y=this.m_streamType;A=this.m_triangleListDecoder.GetVertexToTriangle();x=A.m_neighbors;B=r.GetCoordIndex();E=b*s;G=t.m_count;D=k.ReadUInt32(t,y);z=k.ReadUChar(t,y);C=z>>>4&7;g.m_value=z&7;D-=t.m_count-G;G=new d.Iterator;G.m_count=t.m_count+D;if(C!==f.O3DGC_SC3DMC_BINARIZATION_ASCII)return d.O3DGC_ERROR_CORRUPTED_STREAM;
|
|
353
|
-
k.ReadUInt32(G,y);if(g.m_value===f.O3DGC_SC3DMC_SURF_NORMALS_PREDICTION){this.m_orientationSize<b&&(this.m_orientationSize=b,w=this.m_orientation=new Int8Array(this.m_orientationSize));for(z=0;z<b;++z)w[z]=k.ReadIntASCII(t);this.ProcessNormals(r);s=2}this.m_quantFloatArraySize<E&&(this.m_quantFloatArraySize=E,this.m_quantFloatArray=new Int32Array(this.m_quantFloatArraySize));E=this.m_quantFloatArray;y=this.m_neighbors;D=new d.NumberRef;r=g.m_value!==f.O3DGC_SC3DMC_NO_PREDICTION;w=g.m_value===f.O3DGC_SC3DMC_PARALLELOGRAM_PREDICTION;
|
|
354
|
-
for(C=0;C<b;++C){D.m_value=0;if(0<A.GetNumNeighbors(C)&&r){v=A.Begin(C);F=A.End(C);if(w)for(z=v;z<F;++z){H=x[z];if(0>H)break;e(B,H,C,D,y,s,E,u,A,x)}if(D.m_value<m)for(z=v;z<F;++z){H=x[z];if(0>H)break;c(B,H,C,D,y,s,E,u)}}if(1<D.m_value)for(F=k.ReadUCharASCII(G),z=0;z<s;++z)v=k.ReadIntASCII(t),E[C*u+z]=v+y[F].m_pred[z];else if(0<C&&g.m_value!==f.O3DGC_SC3DMC_NO_PREDICTION)for(z=0;z<s;++z)v=k.ReadIntASCII(t),E[C*u+z]=v+E[(C-1)*u+z];else for(z=0;z<s;++z)v=k.ReadUIntASCII(t),E[C*u+z]=v}t.m_count=G.m_count;
|
|
355
|
-
this.IQuantize(a,b,s,u,n,h,p,g);return d.O3DGC_OK};d.SC3DMCDecoder.prototype.DecodeFloatArray=function(a,b,c,d,e,h,p,r,g,k){return this.m_streamType===f.O3DGC_STREAM_TYPE_ASCII?this.DecodeFloatArrayASCII(a,b,c,d,e,h,p,r,g,k):this.DecodeFloatArrayBinary(a,b,c,d,e,h,p,r,g,k)};d.SC3DMCDecoder.prototype.IQuantizeFloatArray=function(a,b,c,e,f,h,p){var r,g,k,m;r=this.m_idelta;g=this.m_quantFloatArray;for(k=0;k<c;++k)m=h[k]-f[k],r[k]=0<m?m/((1<<p>>>0)-1):1;for(h=0;h<b;++h)for(k=0;k<c;++k)a[h*e+k]=g[h*e+
|
|
356
|
-
k]*r[k]+f[k];return d.O3DGC_OK};d.SC3DMCDecoder.prototype.DecodePlayload=function(a,b){var c,e,f,h,p,r,g;c=this.m_params;e=this.m_iterator;f=this.m_stats;h=new d.NumberRef;p=new d.Timer;r=d.O3DGC_OK;this.m_triangleListDecoder.SetStreamType(this.m_streamType);f.m_streamSizeCoordIndex=e.m_count;p.Tic();this.m_triangleListDecoder.Decode(a.GetCoordIndex(),a.GetNCoordIndex(),a.GetNCoord(),b,e);p.Toc();f.m_timeCoordIndex=p.GetElapsedTime();f.m_streamSizeCoordIndex=e.m_count-f.m_streamSizeCoordIndex;f.m_streamSizeCoord=
|
|
357
|
-
e.m_count;p.Tic();0<a.GetNCoord()&&(r=this.DecodeFloatArray(a.GetCoord(),a.GetNCoord(),3,3,a.GetCoordMinArray(),a.GetCoordMaxArray(),c.GetCoordQuantBits(),a,h,b),c.SetCoordPredMode(h.m_value));if(r!==d.O3DGC_OK)return r;p.Toc();f.m_timeCoord=p.GetElapsedTime();f.m_streamSizeCoord=e.m_count-f.m_streamSizeCoord;f.m_streamSizeNormal=e.m_count;p.Tic();0<a.GetNNormal()&&(r=this.DecodeFloatArray(a.GetNormal(),a.GetNNormal(),3,3,a.GetNormalMinArray(),a.GetNormalMaxArray(),c.GetNormalQuantBits(),a,h,b),c.SetNormalPredMode(h.m_value));
|
|
358
|
-
if(r!==d.O3DGC_OK)return r;p.Toc();f.m_timeNormal=p.GetElapsedTime();f.m_streamSizeNormal=e.m_count-f.m_streamSizeNormal;for(g=0;g<a.GetNumFloatAttributes();++g)f.m_streamSizeFloatAttribute[g]=e.m_count,p.Tic(),r=this.DecodeFloatArray(a.GetFloatAttribute(g),a.GetNFloatAttribute(g),a.GetFloatAttributeDim(g),a.GetFloatAttributeDim(g),a.GetFloatAttributeMinArray(g),a.GetFloatAttributeMaxArray(g),c.GetFloatAttributeQuantBits(g),a,h,b),c.SetFloatAttributePredMode(g,h.m_value),p.Toc(),f.m_timeFloatAttribute[g]=
|
|
359
|
-
p.GetElapsedTime(),f.m_streamSizeFloatAttribute[g]=e.m_count-f.m_streamSizeFloatAttribute[g];if(r!==d.O3DGC_OK)return r;for(g=0;g<a.GetNumIntAttributes();++g)f.m_streamSizeIntAttribute[g]=e.m_count,p.Tic(),r=this.DecodeIntArray(a.GetIntAttribute(g),a.GetNIntAttribute(g),a.GetIntAttributeDim(g),a.GetIntAttributeDim(g),a,h,b),c.SetIntAttributePredMode(g,h.m_value),p.Toc(),f.m_timeIntAttribute[g]=p.GetElapsedTime(),f.m_streamSizeIntAttribute[g]=e.m_count-f.m_streamSizeIntAttribute[g];if(r!==d.O3DGC_OK)return r;
|
|
360
|
-
p.Tic();this.m_triangleListDecoder.Reorder();p.Toc();f.m_timeReorder=p.GetElapsedTime();return r};d.DVEncodeParams=function(){this.m_encodeMode=f.O3DGC_DYNAMIC_VECTOR_ENCODE_MODE_LIFT;this.m_streamTypeMode=f.O3DGC_STREAM_TYPE_ASCII;this.m_quantBits=10};d.DVEncodeParams.prototype.GetStreamType=function(){return this.m_streamTypeMode};d.DVEncodeParams.prototype.GetEncodeMode=function(){return this.m_encodeMode};d.DVEncodeParams.prototype.GetQuantBits=function(){return this.m_quantBits};d.DVEncodeParams.prototype.SetStreamType=
|
|
361
|
-
function(a){this.m_streamTypeMode=a};d.DVEncodeParams.prototype.SetEncodeMode=function(a){this.m_encodeMode=a};d.DVEncodeParams.prototype.SetQuantBits=function(a){this.m_quantBits=a};d.DynamicVector=function(){this.m_stride=this.m_dim=this.m_num=0;this.m_max={};this.m_min={};this.m_vectors={}};d.DynamicVector.prototype.GetNVector=function(){return this.m_num};d.DynamicVector.prototype.GetDimVector=function(){return this.m_dim};d.DynamicVector.prototype.GetStride=function(){return this.m_stride};d.DynamicVector.prototype.GetMinArray=
|
|
362
|
-
function(){return this.m_min};d.DynamicVector.prototype.GetMaxArray=function(){return this.m_max};d.DynamicVector.prototype.GetVectors=function(){return this.m_vectors};d.DynamicVector.prototype.GetMin=function(a){return this.m_min[a]};d.DynamicVector.prototype.GetMax=function(a){return this.m_max[a]};d.DynamicVector.prototype.SetNVector=function(a){this.m_num=a};d.DynamicVector.prototype.SetDimVector=function(a){this.m_dim=a};d.DynamicVector.prototype.SetStride=function(a){this.m_stride=a};d.DynamicVector.prototype.SetMinArray=
|
|
363
|
-
function(a){this.m_min=a};d.DynamicVector.prototype.SetMaxArray=function(a){this.m_max=a};d.DynamicVector.prototype.SetMin=function(a,b){this.m_min[a]=b};d.DynamicVector.prototype.SetMax=function(a,b){this.m_max[a]=b};d.DynamicVector.prototype.SetVectors=function(a){this.m_vectors=a};d.DynamicVectorDecoder=function(){this.m_dimVectors=this.m_numVectors=this.m_maxNumVectors=this.m_streamSize=0;this.m_quantVectors={};this.m_iterator=new d.Iterator;this.m_streamType=f.O3DGC_STREAM_TYPE_UNKOWN;this.m_params=
|
|
364
|
-
new d.DVEncodeParams};d.DynamicVectorDecoder.prototype.GetStreamType=function(){return this.m_streamType};d.DynamicVectorDecoder.prototype.GetIterator=function(){return this.m_iterator};d.DynamicVectorDecoder.prototype.SetStreamType=function(a){this.m_streamType=a};d.DynamicVectorDecoder.prototype.SetIterator=function(a){this.m_iterator=a};d.DynamicVectorDecoder.prototype.IUpdate=function(a,b,c){var e;e=c-1;c=2;for(a[b]-=a[b+1]>>1;c<e;)a[b+c]-=a[b+c-1]+a[b+c+1]+2>>2,c+=2;c===e&&(a[b+c]-=a[b+c-1]>>
|
|
365
|
-
1);return d.O3DGC_OK};d.DynamicVectorDecoder.prototype.IPredict=function(a,b,c){var e;e=c-1;for(c=1;c<e;)a[b+c]+=a[b+c-1]+a[b+c+1]+1>>1,c+=2;c===e&&(a[b+c]+=a[b+c-1]);return d.O3DGC_OK};d.DynamicVectorDecoder.prototype.Merge=function(a,b,c){var e,f,h;e=(c>>1)+(c&1);c=e-1;for(f=e;0<c;){for(e=c;e<f;e+=2)h=a[b+e],a[b+e]=a[b+e+1],a[b+e+1]=h;--c;++f}return d.O3DGC_OK};d.DynamicVectorDecoder.prototype.ITransform=function(a,b,c){var e,f;f=0;for(e=0+((c&1)<<f++>>>0);1<c;)c=(c>>1)+((c&1)>>>0),e+=(c&1)<<f++>>>
|
|
366
|
-
0;for(f-=2;0<=f;--f)c=(c<<1>>>0)-(e>>>f&1)>>>0,this.Merge(a,b,c),this.IUpdate(a,b,c),this.IPredict(a,b,c);return d.O3DGC_OK};d.DynamicVectorDecoder.prototype.IQuantize=function(a,b,c,e,f,h,p){var r,g,k,m;r=this.m_quantVectors;for(k=0;k<c;++k)for(g=h[k]-f[k],g=0<g?g/((1<<p>>>0)-1):1,m=0;m<b;++m)a[m*e+k]=r[m+k*b]*g+f[k];return d.O3DGC_OK};d.DynamicVectorDecoder.prototype.DecodeHeader=function(a,b){var c,e,n;c=this.m_iterator;e=c.m_count;n=b.ReadUInt32(c,f.O3DGC_STREAM_TYPE_BINARY);if(n!==f.O3DGC_DV_START_CODE){c.m_count=
|
|
367
|
-
e;n=b.ReadUInt32(c,f.O3DGC_STREAM_TYPE_ASCII);if(n!==f.O3DGC_DV_START_CODE)return d.O3DGC_ERROR_CORRUPTED_STREAM;this.m_streamType=f.O3DGC_STREAM_TYPE_ASCII}else this.m_streamType=f.O3DGC_STREAM_TYPE_BINARY;e=this.m_streamType;this.m_streamSize=b.ReadUInt32(c,e);this.m_params.SetEncodeMode(b.ReadUChar(c,e));a.SetNVector(b.ReadUInt32(c,e));0<a.GetNVector()&&(a.SetDimVector(b.ReadUInt32(c,e)),this.m_params.SetQuantBits(b.ReadUChar(c,e)));return d.O3DGC_OK};d.DynamicVectorDecoder.prototype.DecodePlayload=
|
|
368
|
-
function(a,b){var c,e,n,h,p,r,g,k,m,w,t,y,v;e=this.m_iterator;n=this.m_streamType;h=d.O3DGC_OK;p=e.m_count;r=b.ReadUInt32(e,n);g=a.GetDimVector();k=a.GetNVector();c=g*k;for(m=0;m<a.GetDimVector();++m)a.SetMin(m,b.ReadFloat32(e,n)),a.SetMax(m,b.ReadFloat32(e,n));m=new d.ArithmeticDecoder;w=new d.StaticBitModel;t=new d.AdaptiveBitModel;r-=e.m_count-p;y=p=0;n===f.O3DGC_STREAM_TYPE_BINARY&&(p=b.GetBuffer(e,r),e.m_count+=r,m.SetBuffer(r,p),m.StartDecoder(),p=m.ExpGolombDecode(0,w,t),y=m.ExpGolombDecode(0,
|
|
369
|
-
w,t));r=new d.AdaptiveDataModel;r.SetAlphabet(y+2);this.m_maxNumVectors<c&&(this.m_maxNumVectors=c,this.m_quantVectors=new Int32Array(this.m_maxNumVectors));c=this.m_quantVectors;if(n===f.O3DGC_STREAM_TYPE_ASCII)for(n=0;n<k;++n)for(v=0;v<g;++v)c[v*k+n]=b.ReadIntASCII(e);else for(n=0;n<k;++n)for(v=0;v<g;++v)c[v*k+n]=m.DecodeIntACEGC(r,w,t,p,y);for(v=0;v<g;++v)this.ITransform(c,v*k,k);this.IQuantize(a.GetVectors(),k,g,a.GetStride(),a.GetMinArray(),a.GetMaxArray(),this.m_params.GetQuantBits());return h};
|
|
370
|
-
return d}();SEA3D.GeometryGC=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;var e=b.readUShort();a=[];var d,f;this.isBig=0!=(e&1);b.readVInt=this.isBig?b.readUInt:b.readUShort;if(e&2){this.groups=[];var q=b.readUByte(),l=0;for(c=0;c<q;c++){var s=3*b.readVInt();this.groups.push({start:l,count:s});l+=s}}else this.groups=[];if(e&4)for(this.uv=[],q=b.readUByte(),c=0;c<q;c++)a[c]=b.readUByte();e&32&&(d=b.readUByte(),f=b.readUByte());c=b.readUInt();c=b.concat(b.position,c);b=new o3dgc.BinaryStream(c.buffer);
|
|
371
|
-
e=new o3dgc.SC3DMCDecoder;q=new o3dgc.IndexedFaceSet;e.DecodeHeader(q,b);c=q.GetNCoordIndex();l=q.GetNCoord();this.groups.length||this.groups.push({start:0,count:3*c});this.indexes=this.isBig?new Uint32Array(3*c):new Uint16Array(3*c);this.vertex=new Float32Array(3*l);q.SetCoordIndex(this.indexes);q.SetCoord(this.vertex);0<q.GetNNormal()&&(this.normal=new Float32Array(3*l),q.SetNormal(this.normal));for(c=0;c<a.length;c++)this.uv[c]=new Float32Array(2*l),q.SetFloatAttribute(a[c],this.uv[c]);void 0!==
|
|
372
|
-
d&&(this.jointPerVertex=q.GetIntAttributeDim(d),this.joint=new Uint16Array(l*this.jointPerVertex),this.weight=new Float32Array(l*this.jointPerVertex),q.SetIntAttribute(d,this.joint),q.SetFloatAttribute(f,this.weight));e.DecodePlayload(q,b)};SEA3D.GeometryGC.prototype.type="s3D";SEA3D.GeometryUpdateGC=function(a,b,c){this.name=a;this.data=b;this.sea3d=c;this.index=b.readUInt();this.bytes=b.concat(b.position,b.length-b.position)};SEA3D.GeometryUpdateGC.prototype.type="us3D";
|
|
373
|
-
THREE.SEA3D.prototype.readGeometryUpdateGC=function(a){var b=this.file.objects[a.index].tag;a=new SEA3D.GeometryGC("",a.bytes,a.sea3d);a.tag=b;this.readGeometryBuffer(a)};THREE.SEA3D.EXTENSIONS_LOADER.push({setTypeRead:function(){this.file.addClass(SEA3D.GeometryGC,!0);this.file.addClass(SEA3D.GeometryUpdateGC,!0);this.file.typeRead[SEA3D.GeometryGC.prototype.type]=this.readGeometryBuffer;this.file.typeRead[SEA3D.GeometryUpdateGC.prototype.type]=this.readGeometryUpdateGC}});
|