mx3d 0.0.11 → 0.0.15

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.
@@ -1,4 +1,4 @@
1
- !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("h337")):"function"==typeof define&&define.amd?define(["h337"],t):"object"==typeof exports?exports.Dazzle=t(require("h337")):e.Dazzle=t(e.h337)}(window,function(i){return n=[function(e,t){e.exports=i},function(e,t,i){"use strict";i.r(t);var n={};i.r(n),i.d(n,"SceneLoader",function(){return l}),i.d(n,"Global",function(){return s}),i.d(n,"Builder",function(){return o}),i.d(n,"IconFromMesh",function(){return c}),i.d(n,"Icon",function(){return a}),i.d(n,"GUID",function(){return r}),i.d(n,"HeatMap",function(){return M});class r{static getGUID(e){var t,i,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),o=[],s=n.length;if(e)for(t=0;t<e;t++)o[t]=n[0|Math.random()*s];else for(o[8]=o[13]=o[18]=o[23]="-",o[14]="4",t=0;t<36;t++)o[t]||(i=0|16*Math.random(),o[t]=n[19==t?3&i|8:i]);return o.join("")}}class M{constructor(){this.id=r.getGUID(12),this.texts=new Array}isEnabled(e){}set displayValues(t){this.texts.forEach(e=>e.isVisible=t)}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh&&this.mesh.dispose();for(let e=0;e<this.texts.length;e++)this.texts[e].linkedMesh&&this.texts[e].linkedMesh.dispose(),this.texts[e].dispose();this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}var b=i(0);class o{static createMatrixHeatMap(o,e,t,s,r,i=!0,n=.5,a=!0,c=!0,l=2.8,d={max:30,min:16}){let u;if(!(r||r.maxX||r.maxY||r.data||o))return u;o._scene.blockfreeActiveMeshesAndRenderingGroups=!0,u=new M;var h=o.getBoundingInfo();u.mesh=o[0].instance.clone(u.id),u.mesh.position.y+=n;var m=h.maximum.x-h.minimum.x,x=m/(2*r.maxX),p=h.maximum.z-h.minimum.z,f=p/(2*r.maxY);let v=new Array;for(let n=0;n<2*r.maxX;n++)for(let i=0;i<2*r.maxY;i++){let t={x:n,y:i,value:d.min};for(let e=0;e<r.data.length;e++){var g=r.data[e];2*g.x+1==n&&2*g.y+1==i&&(t.value=g.value,g=new BABYLON.Vector3(h.boundingSphere.center.x-(m/2-x*n),u.mesh.position.y,h.boundingSphere.center.z-(p/2-f*i)),u.texts.push(this.createTempVlaue(t.value+"℃",g,o._scene,s)))}v.push(t)}u.displayValues=i;let B=b.create({width:2*r.maxX,height:2*r.maxY,radius:l});B.setData({min:d.min,max:d.max,data:v});let A=new BABYLON.StandardMaterial(u.id,o._scene);return A.diffuseTexture=new BABYLON.Texture(B.getDataURL(),o._scene,!1,!1),A.specularColor=new BABYLON.Color3(0,0,0),A.alpha=.5,a&&(A.diffuseTexture.hasAlpha=!0),c&&(this._getMatrixParticleTex(e,t,A.diffuseTexture,u.mesh,o._scene),u.mesh.isVisible=!1),u.mesh.renderingGroupId=1,u.mesh.material=A,u.mesh.alwaysSelectAsActiveMesh=!0,u.mesh.freezeWorldMatrix(),o._scene.blockfreeActiveMeshesAndRenderingGroups=!1,u}static _getMatrixParticleTex(e,t,i,n,o){let s;let r=t.clone(),a=n.getBoundingInfo().boundingBox;var c=(a.extendSizeWorld.x+a.extendSizeWorld.z)/9,l=1500*c*c,d=a.minimumWorld.subtract(new BABYLON.Vector3(-0,0,-0)),t=a.maximumWorld.subtract(new BABYLON.Vector3(0,0,0));s&&s.dispose(),s=new BABYLON.ParticleSystem("particles",l,o),s.manualEmitCount=s.getCapacity(),s.minEmitBox=d,s.maxEmitBox=t,s.particleTexture=r,s.emitter=n,s.renderingGroupId=1,s.isLocal=!0;let u=new BABYLON.NodeMaterial("nm_heatmapBox_"+n.id,o);u.loadAsync(e+"resources/horizontalNodeMat.json").then(()=>{u.build(!1),u.getBlockByName("boxTex").texture=i,u.getBlockByName("emitXMin").value=s.minEmitBox.x,u.getBlockByName("emitXMax").value=s.maxEmitBox.x,u.getBlockByName("emitYMin").value=s.minEmitBox.z,u.getBlockByName("emitYMax").value=s.maxEmitBox.z,u.createEffectForParticles(s)}),n.onDispose=()=>{s&&s.dispose()},s.onDispose=()=>{u&&u.dispose(),r&&r.dispose()},s.color1=new BABYLON.Color4(.8,.8,.8,.1),s.color2=new BABYLON.Color4(.95,.95,.95,.15),s.colorDead=new BABYLON.Color4(.9,.9,.9,.1),s.minSize=1.4,s.maxSize=2,s.minLifeTime=Number.MAX_SAFE_INTEGER,s.emitRate=5e4*c,s.blendMode=BABYLON.ParticleSystem.BLENDMODE_STANDARD,s.gravity=new BABYLON.Vector3(0,0,0),s.direction1=new BABYLON.Vector3(0,0,0),s.direction2=new BABYLON.Vector3(0,0,0),s.minAngularSpeed=-2,s.maxAngularSpeed=2,s.minEmitPower=.5,s.maxEmitPower=1,s.updateSpeed=.005,s.start()}static createColumnarHeatMap(t,e,i,o,n=!0,s=!0,r=!0,a=4,c={max:30,min:16}){if(!o&&o.length<1&&!t)return null;let l;t._scene.blockfreeActiveMeshesAndRenderingGroups=!0,l=new M;var d=t.getBoundingInfo(),u=(d.maximum.y-d.minimum.y)*t.scaling.y*.98;l.mesh=BABYLON.MeshBuilder.CreatePlane(l.id,{width:(d.maximum.x-d.minimum.x)*t.scaling.x*.98,height:u,sideOrientation:2},t._scene),l.mesh.alwaysSelectAsActiveMesh=!0,l.mesh.enablePointerMoveEvents=!1,l.mesh.position=t.position.clone(),l.mesh.rotation.z=Math.PI,l.mesh.rotation.y=t.rotation.y,l.mesh.renderingGroupId=1;let h=[];for(let n=0;n<4;n++)for(let i=0;i<3*o.length;i++){let t={x:n,y:i,value:c.min};for(let e=0;e<o.length;e++){var m=o[e];2==n&&3*e+2==i&&(t.value=m.value)}h.push(t)}var x=u/o.length;for(let e=0;e<o.length;e++){var p=new BABYLON.Vector3(l.mesh.position.x,u-x*e-x/2,l.mesh.position.z);l.texts.push(this.createTempVlaue(o[e].value+"℃",p,t._scene,i))}l.displayValues=n;let f=b.create({width:4,height:3*o.length,radius:a});f.setData({min:c.min,max:c.max,data:h});let v=new BABYLON.StandardMaterial(l.id,t._scene);return v.diffuseTexture=new BABYLON.Texture(f.getDataURL(),t._scene,!1,!1),v.specularColor=new BABYLON.Color3(0,0,0),v.alpha=.5,s&&(v.diffuseTexture.hasAlpha=!0),r&&(this._getColumnarParticleTex(v.diffuseTexture,l.mesh,t._scene,e),l.mesh.isVisible=!1),l.mesh.renderingGroupId=1,l.mesh.material=v,t._scene.blockfreeActiveMeshesAndRenderingGroups=!1,l}static _getColumnarParticleTex(e,t,i,n){let o;let s=n.clone();n=t.getBoundingInfo().boundingBox,n.extendSizeWorld.x,n.extendSizeWorld.z;BABYLON.Effect.ShadersStore.particlesVertexShader=`
1
+ !function(e,i){"object"==typeof exports&&"object"==typeof module?module.exports=i(require("h337")):"function"==typeof define&&define.amd?define(["h337"],i):"object"==typeof exports?exports.Dazzle=i(require("h337")):e.Dazzle=i(e.h337)}(window,function(t){return n=[function(e,i){e.exports=t},function(e,i,t){"use strict";t.r(i);var n={};t.r(n),t.d(n,"SceneLoader",function(){return h}),t.d(n,"Global",function(){return o}),t.d(n,"Builder",function(){return s}),t.d(n,"IconFromMesh",function(){return l}),t.d(n,"Icon",function(){return a}),t.d(n,"GUID",function(){return r}),t.d(n,"HeatMap",function(){return u}),t.d(n,"Capacity",function(){return c});class r{static getGUID(e){var i,t,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),s=[],o=n.length;if(e)for(i=0;i<e;i++)s[i]=n[0|Math.random()*o];else for(s[8]=s[13]=s[18]=s[23]="-",s[14]="4",i=0;i<36;i++)s[i]||(t=0|16*Math.random(),s[i]=n[19==i?3&t|8:t]);return s.join("")}}class u{constructor(e){this.anchor=e,this.id=r.getGUID(12),this.texts=new Array}isEnabled(e){}set displayValues(i){this.texts.forEach(e=>e.isVisible=i)}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh&&this.mesh.dispose();for(let e=0;e<this.texts.length;e++)this.texts[e].linkedMesh&&this.texts[e].linkedMesh.dispose(),this.texts[e].dispose();this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}var m=t(0);class c{constructor(e,i){this.anchor=e,this.ratio=i}dispose(){this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.mesh&&this.mesh.dispose(),this.textMesh&&this.textMesh.dispose(),this.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class s{static createMatrixHeatMap(s){s.displayValues=null==s.displayValues||s.displayValues,s.isAlpha=null==s.isAlpha||s.isAlpha,s.isParticle=null==s.isParticle||s.isParticle,s.height=s.height||.5,s.radius=s.radius||2.8,s.isLevelRender=null==s.isLevelRender||s.isLevelRender,s.range=s.range||{max:30,min:16};let o;if(!(s.config||s.config.maxX||s.config.maxY||s.config.data||s.anchor))return o;s.anchor._scene.blockfreeActiveMeshesAndRenderingGroups=!0,o=new u(s.anchor.id);var r=s.anchor.getBoundingInfo();o.mesh=s.anchor.clone(o.id),o.mesh.position.y+=s.height;var a=r.maximum.x-r.minimum.x,c=a/(2*s.config.maxX),l=r.maximum.z-r.minimum.z,h=l/(2*s.config.maxY);let e=new Array;for(let n=0;n<2*s.config.maxX;n++)for(let t=0;t<2*s.config.maxY;t++){let i={x:n,y:t,value:s.range.min};for(let e=0;e<s.config.data.length;e++){var d=s.config.data[e];2*d.x+1==n&&2*d.y+1==t&&(i.value=d.value,d=new BABYLON.Vector3(r.boundingSphere.center.x-(a/2-c*n),o.mesh.position.y,r.boundingSphere.center.z-(l/2-h*t)),o.texts.push(this.createTempVlaue(i.value+"℃",d,s.anchor._scene,s.container)))}e.push(i)}o.displayValues=s.displayValues;let i=m.create({width:2*s.config.maxX,height:2*s.config.maxY,radius:s.radius});i.setData({min:s.range.min,max:s.range.max,data:e});let t=new BABYLON.StandardMaterial(o.id,s.anchor._scene);return t.diffuseTexture=new BABYLON.Texture(i.getDataURL(),s.anchor._scene,!1,!1),t.specularColor=new BABYLON.Color3(0,0,0),t.alpha=.5,s.isAlpha&&(t.diffuseTexture.hasAlpha=!0),s.isParticle&&(this._getMatrixParticleTex(s.rootUrl,s.FogTex,t.diffuseTexture,o.mesh,s.anchor._scene,s.isLevelRender),o.mesh.isVisible=!1),s.isLevelRender&&(o.mesh.renderingGroupId=1),o.mesh.material=t,o.mesh.alwaysSelectAsActiveMesh=!0,o.mesh.freezeWorldMatrix(),s.anchor._scene.blockfreeActiveMeshesAndRenderingGroups=!1,o}static _getMatrixParticleTex(e,i,t,n,s,o){let r;let a=i.clone(),c=n.getBoundingInfo().boundingBox;var l=(c.extendSizeWorld.x+c.extendSizeWorld.z)/9,h=1500*l*l,d=c.minimumWorld.subtract(new BABYLON.Vector3(-0,0,-0)),i=c.maximumWorld.subtract(new BABYLON.Vector3(0,0,0));r&&r.dispose(),r=new BABYLON.ParticleSystem("particles",h,s),r.manualEmitCount=r.getCapacity(),r.minEmitBox=d,r.maxEmitBox=i,r.particleTexture=a,r.emitter=n,o&&(r.renderingGroupId=1),r.isLocal=!0;let u=new BABYLON.NodeMaterial("nm_heatmapBox_"+n.id,s);u.loadAsync(e+"resources/horizontalNodeMat.json").then(()=>{u.build(!1),u.getBlockByName("boxTex").texture=t,u.getBlockByName("emitXMin").value=r.minEmitBox.x,u.getBlockByName("emitXMax").value=r.maxEmitBox.x,u.getBlockByName("emitYMin").value=r.minEmitBox.z,u.getBlockByName("emitYMax").value=r.maxEmitBox.z,u.createEffectForParticles(r)}),n.onDispose=()=>{r&&r.dispose()},r.onDispose=()=>{u&&u.dispose(),a&&a.dispose()},r.color1=new BABYLON.Color4(.8,.8,.8,.1),r.color2=new BABYLON.Color4(.95,.95,.95,.15),r.colorDead=new BABYLON.Color4(.9,.9,.9,.1),r.minSize=1.4,r.maxSize=2,r.minLifeTime=Number.MAX_SAFE_INTEGER,r.emitRate=5e4*l,r.blendMode=BABYLON.ParticleSystem.BLENDMODE_STANDARD,r.gravity=new BABYLON.Vector3(0,0,0),r.direction1=new BABYLON.Vector3(0,0,0),r.direction2=new BABYLON.Vector3(0,0,0),r.minAngularSpeed=-2,r.maxAngularSpeed=2,r.minEmitPower=.5,r.maxEmitPower=1,r.updateSpeed=.005,r.start()}static createColumnarHeatMap(s){if(s.displayValues=null==s.displayValues||s.displayValues,s.isAlpha=null==s.isAlpha||s.isAlpha,s.isParticle=null==s.isParticle||s.isParticle,s.radius=s.radius||4,s.isLevelRender=null==s.isLevelRender||s.isLevelRender,s.range=s.range||{max:30,min:16},!s.config&&s.config.length<1&&!s.anchor)return null;let i;s.anchor._scene.blockfreeActiveMeshesAndRenderingGroups=!0,i=new u(s.anchor.id),i.scene=s.anchor._scene;var t=.98*s.anchor.scaling.y;i.mesh=BABYLON.MeshBuilder.CreatePlane(i.id,{width:.98*s.anchor.scaling.x,height:t,sideOrientation:2},s.anchor._scene),i.mesh.alwaysSelectAsActiveMesh=!0,i.mesh.enablePointerMoveEvents=!1,i.mesh.position=s.anchor.position.clone(),i.mesh.rotation.z=Math.PI,i.mesh.rotation.y=s.anchor.rotation.y,s.isLevelRender&&(i.mesh.renderingGroupId=1);let e=[];for(let n=0;n<4;n++)for(let t=0;t<3*s.config.length;t++){let i={x:n,y:t,value:s.range.min};for(let e=0;e<s.config.length;e++){var o=s.config[e];2==n&&3*e+2==t&&(i.value=o.value)}e.push(i)}var n=t/s.config.length;for(let e=0;e<s.config.length;e++){var r=new BABYLON.Vector3(i.mesh.position.x,t-n*e-n/2,i.mesh.position.z);i.texts.push(this.createTempVlaue(s.config[e].value+"℃",r,s.anchor._scene,s.container))}i.displayValues=s.displayValues;let a=m.create({width:4,height:3*s.config.length,radius:s.radius});a.setData({min:s.range.min,max:s.range.max,data:e});let c=new BABYLON.StandardMaterial(i.id,s.anchor._scene);return c.diffuseTexture=new BABYLON.Texture(a.getDataURL(),s.anchor._scene,!1,!1),c.specularColor=new BABYLON.Color3(0,0,0),c.alpha=.5,s.isAlpha&&(c.diffuseTexture.hasAlpha=!0),s.isParticle&&(this._getColumnarParticleTex(c.diffuseTexture,i.mesh,s.anchor._scene,s.FogTex,s.isLevelRender),i.mesh.isVisible=!1),i.mesh.material=c,s.anchor._scene.blockfreeActiveMeshesAndRenderingGroups=!1,i}static _getColumnarParticleTex(e,i,t,n,s){let o;let r=n.clone();n=i.getBoundingInfo().boundingBox,n.extendSizeWorld.x,n.extendSizeWorld.z;BABYLON.Effect.ShadersStore.particlesVertexShader=`
2
2
  precision highp float;
3
3
  in vec3 position;
4
4
  in vec4 color;
@@ -41,7 +41,7 @@
41
41
  vUV=offset;
42
42
  }
43
43
 
44
- `,BABYLON.Effect.ShadersStore[t.id+"myParticleFragmentShader"]=`
44
+ `,BABYLON.Effect.ShadersStore[i.id+"myParticleFragmentShader"]=`
45
45
  #ifdef GL_ES
46
46
  precision highp float;
47
47
  #endif
@@ -82,4 +82,4 @@
82
82
 
83
83
  gl_FragColor = vec4(baseTex.xyz, resAlpha.a);
84
84
  }
85
- `;var r=i.getEngine().createEffectForParticles(t.id+"myParticle",["time","u_emitXMin","u_emitYMin","u_emitXMax","u_emitYMax","emitBox_WorldM"],["boxTexSampler"],"");return t.onAfterWorldMatrixUpdateObservable.add(()=>{r.setMatrix("emitBox_WorldM",t.getWorldMatrix())}),r.onCompileObservable.add(()=>{r.setMatrix("emitBox_WorldM",t.getWorldMatrix()),r.setFloat("u_emitXMin",o.minEmitBox.x),r.setFloat("u_emitYMin",o.minEmitBox.y),r.setFloat("u_emitXMax",o.maxEmitBox.x),r.setFloat("u_emitYMax",o.maxEmitBox.y)}),r.onBind=function(){r.setTexture("boxTexSampler",e)},o&&o.dispose(),o=new BABYLON.ParticleSystem("particles",200,i,r),o.manualEmitCount=o.getCapacity(),o.minEmitBox=n.minimum,o.maxEmitBox=n.maximum,t.onDispose=()=>{o&&o.dispose()},o.onDispose=()=>{s&&s.dispose()},o.particleTexture=s.clone(),o.emitter=t,o.renderingGroupId=1,o.isLocal=!0,o.color1=new BABYLON.Color4(.8,.8,.8,.1),o.color2=new BABYLON.Color4(.95,.95,.95,.15),o.colorDead=new BABYLON.Color4(.9,.9,.9,.1),o.minSize=.7,o.maxSize=1,o.minLifeTime=Number.MAX_SAFE_INTEGER,o.emitRate=50,o.blendMode=BABYLON.ParticleSystem.BLENDMODE_STANDARD,o.gravity=new BABYLON.Vector3(0,0,0),o.direction1=new BABYLON.Vector3(0,0,0),o.direction2=new BABYLON.Vector3(0,0,0),o.minAngularSpeed=-2,o.maxAngularSpeed=2,o.minEmitPower=.5,o.maxEmitPower=1,o.updateSpeed=.005,o.start(),o}static createTempVlaue(e,t,i,n){let o=new BABYLON.Mesh("temp_"+r.getGUID(12),i);o.position=t;let s=new BABYLON.GUI.TextBlock;return s.isPointerBlocker=!1,s.text="默认提示",s.color="white",s.resizeToFit=!0,s.fontSize=9,s.text=e,n.addControl(s),s.linkWithMesh(o),s}}class s{}class a{constructor(e){this.textDics=new Array,this.id=e}set background(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this._background&&this._background.dispose(),this._background=new BABYLON.GUI.Image(r.getGUID(12)+"_Image",e),this._background.width=this.size.width+"px",this._background.height=this.size.height+"px",this.rect.addControl(this._background),this.onPointerClick&&(this._background.isPointerBlocker=!1,this._background.onPointerClickObservable.add(()=>{this.onPointerClick()})),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setTexts(i){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.textDics.forEach(e=>e.dispose());for(let t=this.textDics.length=0;t<i.length;t++){let e=new BABYLON.GUI.TextBlock;e.text=i[t].text,e.fontSize=i[t].fontSize||"20px",e.color=i[t].color||"white",e.top=i[t].top||0,e.left=i[t].left||0,this.rect.addControl(e),this.textDics.push(e)}this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}line(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this._line&&this._line.dispose(),this._line=new BABYLON.GUI.Line,this._line.lineWidth=e.width||1.5,this._line.color=e.color||"green",this._line.y2=this.size.height/2,this.container.addControl(this._line),this._line.linkWithMesh(this.pint),this._line.connectedControl=this.rect,this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.rect&&this.rect.dispose(),this._line&&this._line.dispose(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.rect&&(this.rect.isVisible=e),this._line&&(this._line.isVisible=e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class c{constructor(e,t,i,n,o,s){this.id=e,this.scene=s,this.anchor=t,this.url=i,this.scaling=n,this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance=BABYLON.Mesh.CreatePlane(this.id,n,this.scene,!0,BABYLON.Mesh.DOUBLESIDE),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.position=this.anchor.position.clone();n=this.anchor.getBoundingInfo();this.instance.position.y=n.maximum.y-n.minimum.y+this.anchor.position.y+o,this.instance.billboardMode=BABYLON.Mesh.BILLBOARDMODE_Y}setContents(n){let o=new Image;o.src=this.url,o.onload=()=>{this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.scaling.y=this.scaling/(o.width/o.height)/this.scaling;let t=new BABYLON.DynamicTexture(this.id,{width:o.width,height:o.height},this.scene,!1),e=new BABYLON.StandardMaterial("Mat_"+this.id,this.scene);e.diffuseTexture=t,e.opacityTexture=t;let i=t.getContext();i.drawImage(o,0,0),n.forEach(e=>t.drawText(e.text,e.left,e.top,"bold "+e.fontSize+" monospace",e.color,"",!0,!0)),t.update(),this.instance.material=e,this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.dispose(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class l{static create(e){let t=new s;return t.canvas=document.createElement("canvas"),t.canvas.style.cssText="width: 100%;height: 100%;background-color: transparent;outline-width: 0;",e.appendChild(t.canvas),t.engine=new BABYLON.Engine(t.canvas,!0,{premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0}),t.engine.enableOfflineSupport=!1,t.scene=new BABYLON.Scene(t.engine,{useGeometryUniqueIdsMap:!0,useClonedMeshMap:!0,useMaterialMeshMap:!0}),t.scene.useRightHandedSystem=!0,t.scene.getBoundingBoxRenderer().frontColor=BABYLON.Color3.Green(),t.scene.getBoundingBoxRenderer().showBackLines=!1,t}static load(){}}t.default=n}],s={},o.m=n,o.c=s,o.d=function(e,t,i){o.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},o.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e&&(t=o(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(o.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(i,n,function(e){return t[e]}.bind(null,n));return i},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=1).default;function o(e){if(s[e])return s[e].exports;var t=s[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}var n,s});
85
+ `;var a=t.getEngine().createEffectForParticles(i.id+"myParticle",["time","u_emitXMin","u_emitYMin","u_emitXMax","u_emitYMax","emitBox_WorldM"],["boxTexSampler"],"");return i.onAfterWorldMatrixUpdateObservable.add(()=>{a.setMatrix("emitBox_WorldM",i.getWorldMatrix())}),a.onCompileObservable.add(()=>{a.setMatrix("emitBox_WorldM",i.getWorldMatrix()),a.setFloat("u_emitXMin",o.minEmitBox.x),a.setFloat("u_emitYMin",o.minEmitBox.y),a.setFloat("u_emitXMax",o.maxEmitBox.x),a.setFloat("u_emitYMax",o.maxEmitBox.y)}),a.onBind=function(){a.setTexture("boxTexSampler",e)},o&&o.dispose(),o=new BABYLON.ParticleSystem("particles",200,t,a),o.manualEmitCount=o.getCapacity(),o.minEmitBox=n.minimum,o.maxEmitBox=n.maximum,i.onDispose=()=>{o&&o.dispose()},o.onDispose=()=>{r&&r.dispose()},o.particleTexture=r.clone(),o.emitter=i,s&&(o.renderingGroupId=1),o.isLocal=!0,o.color1=new BABYLON.Color4(.8,.8,.8,.1),o.color2=new BABYLON.Color4(.95,.95,.95,.15),o.colorDead=new BABYLON.Color4(.9,.9,.9,.1),o.minSize=.7,o.maxSize=1,o.minLifeTime=Number.MAX_SAFE_INTEGER,o.emitRate=50,o.blendMode=BABYLON.ParticleSystem.BLENDMODE_STANDARD,o.gravity=new BABYLON.Vector3(0,0,0),o.direction1=new BABYLON.Vector3(0,0,0),o.direction2=new BABYLON.Vector3(0,0,0),o.minAngularSpeed=-2,o.maxAngularSpeed=2,o.minEmitPower=.5,o.maxEmitPower=1,o.updateSpeed=.005,o.start(),o}static createTempVlaue(e,i,t,n){let s=new BABYLON.Mesh("temp_"+r.getGUID(12),t);s.position=i;let o=new BABYLON.GUI.TextBlock;return o.isPointerBlocker=!1,o.text="默认提示",o.color="white",o.resizeToFit=!0,o.fontSize="20px",o.text=e,n.addControl(o),o.linkWithMesh(s),o}static createCapacity(e,i,t,n="200px"){let s=new c(e,i);s.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0,s.mesh=BABYLON.MeshBuilder.CreateBox("RATIO_"+s.anchor.id,{size:1}),s.mesh.position=s.anchor.instance.position.clone(),s.mesh.position.y-=s.mesh.scaling.y/2,s.mesh.scaling=s.anchor.instance.scaling.clone(),s.mesh.scaling.x=.98*s.mesh.scaling.x,s.mesh.scaling.z=.98*s.mesh.scaling.z,s.mesh.rotation=s.anchor.instance.rotation.clone(),s.mesh.alwaysSelectAsActiveMesh=!0,s.mesh.visibility=1;var o=i<.25?BABYLON.Color3.Blue():.25<=i&&i<.5?BABYLON.Color3.Green():.5<=i&&i<.75?BABYLON.Color3.Yellow():BABYLON.Color3.Red();i*=s.mesh.scaling.y;var r=new BABYLON.Vector3(0,-.5,0);s.mesh.setPivotPoint(r);let a=new BABYLON.StandardMaterial(s.mesh.id,s.anchor.instance._scene);return a.diffuseColor=o,s.mesh.material=a,BABYLON.Animation.CreateAndStartAnimation(s.mesh.id,s.mesh,"scaling.y",15,30,.02,i,0,null),s.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,t&&this.createTextMesh(e,t,n,"#02c3fd"),s}static createTextMesh(e,i,t="200px",n="white"){e.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let s=BABYLON.Mesh.CreatePlane("text_"+e.id,e.instance.scaling.x,e.app.scene,!0,BABYLON.Mesh.DOUBLESIDE);s.alwaysSelectAsActiveMesh=!0,s.position=e.instance.position.clone(),s.position.addInPlace(e.instance.forward.scale(e.instance.scaling.z/2+.01)),s.rotation.y=Math.PI-e.instance.rotation.y;let o=new BABYLON.StandardMaterial("text_mat_"+e.id,e.app.scene);o.diffuseColor=BABYLON.Color3.White(),o.emissiveColor=BABYLON.Color3.White();let r=new BABYLON.DynamicTexture("text_tex_"+e.id,{width:1e3*e.instance.scaling.x,height:500*e.instance.scaling.x},e.app.scene,!1);return r.hasAlpha=!0,o.diffuseTexture=r,o.opacityTexture=r,r.drawText(i,1e3*e.instance.scaling.x/4,500*e.instance.scaling.x/2,"bold "+t+" monospace",n,"",!0,!0),r.update(),s.material=o,e.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,s}}class o{}class a{constructor(e){this.textDics=new Array,this.id=e}set background(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this._background&&this._background.dispose(),this._background=new BABYLON.GUI.Image(r.getGUID(12)+"_Image",e),this._background.width=this.size.width+"px",this._background.height=this.size.height+"px",this.rect.addControl(this._background),this.onPointerClick&&(this._background.isPointerBlocker=!1,this._background.onPointerClickObservable.add(()=>{this.onPointerClick()})),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setTexts(t){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.textDics.forEach(e=>e.dispose());for(let i=this.textDics.length=0;i<t.length;i++){let e=new BABYLON.GUI.TextBlock;e.text=t[i].text,e.fontSize=t[i].fontSize||"20px",e.color=t[i].color||"white",e.top=t[i].top||0,e.left=t[i].left||0,this.rect.addControl(e),this.textDics.push(e)}this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}line(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this._line&&this._line.dispose(),this._line=new BABYLON.GUI.Line,this._line.lineWidth=e.width||1.5,this._line.color=e.color||"green",this._line.y2=this.size.height/2,this.container.addControl(this._line),this._line.linkWithMesh(this.pint),this._line.connectedControl=this.rect,this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.rect&&this.rect.dispose(),this._line&&this._line.dispose(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.rect&&(this.rect.isVisible=e),this._line&&(this._line.isVisible=e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class l{constructor(e,i,t,n,s,o){this.id=e,this.scene=o,this.anchor=i,this.url=t,this.scaling=n,this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance=BABYLON.Mesh.CreatePlane(this.id,n,this.scene,!0,BABYLON.Mesh.DOUBLESIDE),this.instance.alwaysSelectAsActiveMesh=!0,this.instance.position=this.anchor.position.clone();n=this.anchor.getBoundingInfo();this.instance.position.y+=(n.maximum.y-n.minimum.y)/2+s,this.instance.billboardMode=BABYLON.Mesh.BILLBOARDMODE_Y;let r=new BABYLON.StandardMaterial("Mat_"+this.id,this.scene);r.diffuseColor=BABYLON.Color3.White(),r.emissiveColor=BABYLON.Color3.White(),this.instance.material=r,this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setBackground(){let t=new Image;t.src=this.url,t.onload=()=>{this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.scaling.y=this.scaling/(t.width/t.height)/this.scaling;let e=new BABYLON.DynamicTexture(this.id,{width:t.width,height:t.height},this.scene,!1);e.hasAlpha=!0,this.instance.material.diffuseTexture=e;let i=e.getContext();i.drawImage(t,0,0),e.update(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}setColor(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.material.diffuseColor=BABYLON.Color3.FromHexString(e),this.instance.material.emissiveColor=BABYLON.Color3.FromHexString(e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}setContents(t){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let n=new Image;n.src=this.url,n.onload=()=>{this.instance.scaling.y=this.scaling/(n.width/n.height)/this.scaling;let i=new BABYLON.DynamicTexture(this.id,{width:n.width,height:n.height},this.scene,!1);i.hasAlpha=!0,this.instance.material.diffuseTexture=i;let e=i.getContext();e.drawImage(n,0,0),t.forEach(e=>i.drawText(e.text,e.left,e.top,"bold "+e.fontSize+" monospace",e.color||"#fffffb","",!0,!0)),i.update(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}dispose(){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.dispose(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}isEnabled(e){this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.setEnabled(e),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}class h{static create(e){let i=new o;return i.canvas=document.createElement("canvas"),i.canvas.style.cssText="width: 100%;height: 100%;background-color: transparent;outline-width: 0;",e.appendChild(i.canvas),i.engine=new BABYLON.Engine(i.canvas,!0,{premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0}),i.engine.setHardwareScalingLevel(.5),i.engine.enableOfflineSupport=!1,i.scene=new BABYLON.Scene(i.engine,{useGeometryUniqueIdsMap:!0,useClonedMeshMap:!0,useMaterialMeshMap:!0}),i.scene.useRightHandedSystem=!0,i.scene.getBoundingBoxRenderer().frontColor=BABYLON.Color3.Green(),i.scene.getBoundingBoxRenderer().showBackLines=!1,i}static load(){}}i.default=n}],o={},s.m=n,s.c=o,s.d=function(e,i,t){s.o(e,i)||Object.defineProperty(e,i,{enumerable:!0,get:t})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(i,e){if(1&e&&(i=s(i)),8&e)return i;if(4&e&&"object"==typeof i&&i&&i.__esModule)return i;var t=Object.create(null);if(s.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:i}),2&e&&"string"!=typeof i)for(var n in i)s.d(t,n,function(e){return i[e]}.bind(null,n));return t},s.n=function(e){var i=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(i,"a",i),i},s.o=function(e,i){return Object.prototype.hasOwnProperty.call(e,i)},s.p="",s(s.s=1).default;function s(e){if(o[e])return o[e].exports;var i=o[e]={i:e,l:!1,exports:{}};return n[e].call(i.exports,i,i.exports,s),i.l=!0,i.exports}var n,o});
package/index.d.ts CHANGED
@@ -9,14 +9,18 @@ import EffectMgr from "./lib/EffectMgr";
9
9
  import { EffectType } from "./lib/EffectType";
10
10
  import { EventType } from "./lib/EventType";
11
11
  import Dictionary from "./lib/Dictionary";
12
- import HeatMapMgr from "./lib/HeatMapMgr";
12
+ import EffectControls from "./lib/EffectControls";
13
+ import UI from "./lib/UI";
14
+ import { ObjectType } from "./lib/components/ObjectType";
13
15
  declare const MX3D: {
14
16
  App: typeof App;
15
17
  Tools: typeof Tools;
18
+ UI: typeof UI;
19
+ ObjectType: typeof ObjectType;
16
20
  EffectMgr: EffectMgr;
17
21
  EffectType: typeof EffectType;
18
22
  EventType: typeof EventType;
19
- HeatMapMgr: typeof HeatMapMgr;
23
+ EffectControls: typeof EffectControls;
20
24
  Dictionary: typeof Dictionary;
21
25
  };
22
26
  export default MX3D;
package/lib/App.d.ts CHANGED
@@ -2,6 +2,7 @@ import Camera from "./Camera";
2
2
  import Environment from "./Environment";
3
3
  import Project from "./components/Project";
4
4
  import Resources from "./Resources";
5
+ import TipsTool from "./TipsTool";
5
6
  export default class App {
6
7
  canvas: HTMLCanvasElement;
7
8
  engine: BABYLON.Engine;
@@ -17,11 +18,12 @@ export default class App {
17
18
  Environment: Environment;
18
19
  camera: Camera;
19
20
  project: Project;
21
+ tipsTool: TipsTool;
20
22
  constructor(_canvas: HTMLElement, _rootUrl?: string);
21
23
  create(_config: {
22
24
  fileUrl: string;
23
25
  libraryUrl?: string;
24
- highQualityMode: boolean;
26
+ highQualityMode?: boolean;
25
27
  complete?: Function;
26
28
  progress?: Function;
27
29
  }): Promise<unknown>;
@@ -34,7 +36,9 @@ export default class App {
34
36
  progress?: Function;
35
37
  }): Promise<unknown>;
36
38
  outGltf(call?: Function): Promise<void>;
39
+ showTips(): void;
37
40
  showFps(cssText?: string): void;
38
41
  hideFps(): void;
39
42
  dispose(): void;
43
+ showDebug(): void;
40
44
  }
@@ -0,0 +1,42 @@
1
+ import IObject from "./components/IObject";
2
+ import * as Dazzle from '../dazzle/Module';
3
+ export default class EffectControls {
4
+ static createCapacity(_object: IObject, RATIO: number, _text?: string, _fontSize?: string): Dazzle.Capacity;
5
+ static createMatrixHeatMap(_anchor: IObject, //地板对象
6
+ _data: {
7
+ config: {
8
+ maxX: number;
9
+ maxY: number;
10
+ data: Array<{
11
+ x: number;
12
+ y: number;
13
+ value: number;
14
+ }>;
15
+ };
16
+ displayValues?: boolean;
17
+ height?: number;
18
+ isAlpha?: boolean;
19
+ isLevelRender?: boolean;
20
+ isParticle?: boolean;
21
+ radius?: number;
22
+ range: {
23
+ max: number;
24
+ min: number;
25
+ };
26
+ }): Dazzle.HeatMap;
27
+ static createColumnarHeatMap(_anchor: IObject, _data: {
28
+ config: Array<{
29
+ index: number;
30
+ value: number;
31
+ }>;
32
+ displayValues: boolean;
33
+ isAlpha: boolean;
34
+ isLevelRender?: boolean;
35
+ isParticle: boolean;
36
+ radius: number;
37
+ range: {
38
+ max: number;
39
+ min: number;
40
+ };
41
+ }): Dazzle.HeatMap;
42
+ }
@@ -1,23 +1,2 @@
1
- import * as Dazzle from '../dazzle/Module';
2
- import IObject from './components/IObject';
3
1
  export default class HeatMapMgr {
4
- static createMatrixHeatMap(_anchor: IObject, _config: {
5
- maxX: number;
6
- maxY: number;
7
- data: Array<{
8
- x: number;
9
- y: number;
10
- value: number;
11
- }>;
12
- }, _displayValues?: boolean, _height?: number, _isAlpha?: boolean, _isParticle?: boolean, _radius?: number, _range?: {
13
- max: number;
14
- min: number;
15
- }): Dazzle.HeatMap;
16
- static createColumnarHeatMap(_anchor: IObject, _config: Array<{
17
- index: number;
18
- value: number;
19
- }>, _displayValues?: boolean, _isAlpha?: boolean, _isParticle?: boolean, _radius?: number, _range?: {
20
- max: number;
21
- min: number;
22
- }): Dazzle.HeatMap;
23
2
  }
@@ -0,0 +1,15 @@
1
+ import App from "./App";
2
+ export default class TipsTool {
3
+ app: App;
4
+ url: string;
5
+ ele: HTMLDivElement;
6
+ time: number;
7
+ id: string;
8
+ isOK: boolean;
9
+ _text: string;
10
+ private set text(value);
11
+ constructor(parent: HTMLElement, _app: App);
12
+ update(e: BABYLON.PointerInfo): void;
13
+ close(): void;
14
+ setBackground(_url: string): void;
15
+ }
package/lib/Tools.d.ts CHANGED
@@ -15,4 +15,5 @@ export default class Tools {
15
15
  static createTube(id: string, paths: Array<BABYLON.Vector3>, radius: number, app: App): BABYLON.Mesh;
16
16
  static getAngleFromVector2(startV: BABYLON.Vector2, coreV: BABYLON.Vector2, endV: BABYLON.Vector2): number;
17
17
  static getAngleFromVector3(startV: BABYLON.Vector3, coreV: BABYLON.Vector3, endV: BABYLON.Vector3): number;
18
+ static RandomNumBoth(Min: any, Max: any): any;
18
19
  }
@@ -0,0 +1,9 @@
1
+ import DefaultObject from "./DefaultObject";
2
+ export default class AirFlowObject extends DefaultObject {
3
+ bind(_m: any): void;
4
+ setFlash(_level: number): void;
5
+ setTransparent(_alpha?: number): void;
6
+ setOpaque(): void;
7
+ play(): void;
8
+ stop(): void;
9
+ }
@@ -5,6 +5,7 @@ export default interface IObject extends IBase {
5
5
  modelId: string;
6
6
  instance: BABYLON.Mesh | BABYLON.InstancedMesh;
7
7
  modelType: string;
8
+ isVisible: boolean;
8
9
  isMonitor: boolean;
9
10
  isEnabled: boolean;
10
11
  visualAngle: VisualAngle;
@@ -1,6 +1,7 @@
1
1
  import Dictionary from "../Dictionary";
2
2
  import IObject from "./IObject";
3
3
  import App from "../App";
4
+ import { ObjectType } from "./ObjectType";
4
5
  export default class Project {
5
6
  app: App;
6
7
  id: string;
@@ -12,5 +13,6 @@ export default class Project {
12
13
  optimization(): void;
13
14
  getChildNodes(_id: string): IObject[];
14
15
  find(_id: string): IObject;
16
+ findFormObjectType(_type: ObjectType, isCurent?: boolean): IObject[];
15
17
  show(): void;
16
18
  }