mx3d 0.0.38 → 0.0.41
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/{docs/README.md → README.md} +3 -3
- package/core/mx3d.kernel.min.js +2 -16
- package/core/mx3d.loaders.min.js +7 -49
- package/index.d.ts +2304 -26
- package/mx3d.js +230 -10268
- package/mx3d.min.js +25 -25
- package/package.json +2 -2
- package/core/mx3d.dazzle.min.js +0 -85
- package/docs/.nojekyll +0 -0
- package/docs/_sidebar.md +0 -18
- package/docs/camera.md +0 -24
- package/docs/css/dark.css +0 -979
- package/docs/css/local.google.fonts.css +0 -295
- package/docs/css/vue.css +0 -1025
- package/docs/fonts/6xK3dSBYKcSV-LCoeQqfX1RYOo3qOK7l.woff2 +0 -0
- package/docs/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3i54rwlxdu.woff2 +0 -0
- package/docs/fonts/6xKydSBYKcSV-LCoeQqfX1RYOo3ik4zwlxdu.woff2 +0 -0
- package/docs/gui/2D.md +0 -53
- package/docs/gui/3D.md +0 -46
- package/docs/gui/test1.png +0 -0
- package/docs/gui/test2.png +0 -0
- package/docs/gui/test3.png +0 -0
- package/docs/heatMap/heatMap.md +0 -115
- package/docs/heatMap/test1.png +0 -0
- package/docs/heatMap/test2.png +0 -0
- package/docs/index.html +0 -50
- package/docs/js/docsify@4.min.js +0 -1
- package/docs/models/modelmgr.md +0 -251
- package/docs/project/projectmgr.md +0 -73
- package/docs/project/scenetree.jpg +0 -0
- package/docs/started/environment.md +0 -42
- package/docs/started/quickstart.md +0 -89
- package/lib/App.d.ts +0 -45
- package/lib/ArrayEx.d.ts +0 -3
- package/lib/Builder/BaseNode.d.ts +0 -9
- package/lib/Builder/Builder.d.ts +0 -0
- package/lib/Builder/HeatMap.d.ts +0 -0
- package/lib/Builder/Icon.d.ts +0 -0
- package/lib/Builder/IconFromMesh.d.ts +0 -0
- package/lib/Camera.d.ts +0 -18
- package/lib/Cryptojs.d.ts +0 -3
- package/lib/Dictionary.d.ts +0 -13
- package/lib/EffectControls.d.ts +0 -42
- package/lib/EffectMgr.d.ts +0 -11
- package/lib/EffectType.d.ts +0 -5
- package/lib/Environment.d.ts +0 -22
- package/lib/EventType.d.ts +0 -8
- package/lib/GUID.d.ts +0 -3
- package/lib/HeatMapMgr.d.ts +0 -2
- package/lib/Optimized/OptimizedRegion.d.ts +0 -11
- package/lib/ReadJSON.d.ts +0 -3
- package/lib/Resources.d.ts +0 -23
- package/lib/TipsTool.d.ts +0 -15
- package/lib/ToolTip.d.ts +0 -0
- package/lib/Tools.d.ts +0 -19
- package/lib/UI.d.ts +0 -9
- package/lib/VisualAngle.d.ts +0 -13
- package/lib/components/AirFlowObject.d.ts +0 -10
- package/lib/components/BuildingObject.d.ts +0 -5
- package/lib/components/CabinetObject.d.ts +0 -3
- package/lib/components/ConduitObject.d.ts +0 -12
- package/lib/components/CornerObject.d.ts +0 -5
- package/lib/components/DefaultObject.d.ts +0 -46
- package/lib/components/DoorObject.d.ts +0 -5
- package/lib/components/FloorObject.d.ts +0 -5
- package/lib/components/IObject.d.ts +0 -27
- package/lib/components/Ibase.d.ts +0 -8
- package/lib/components/LeakWaterObject.d.ts +0 -7
- package/lib/components/ObjectType.d.ts +0 -47
- package/lib/components/OptimizedWallObject.d.ts +0 -5
- package/lib/components/Project.d.ts +0 -29
- package/lib/components/Region.d.ts +0 -14
- package/lib/components/UI3DTextObject.d.ts +0 -4
- package/lib/components/VirtualBoxObject.d.ts +0 -4
- package/lib/components/WallObject.d.ts +0 -7
- package/lib/components/WindowObject.d.ts +0 -5
- package/lib/lights/Directional.d.ts +0 -7
- package/lib/lights/Hemispheric.d.ts +0 -6
- package/lib/lights/ILightObject.d.ts +0 -10
- package/lib/lights/LightObject.d.ts +0 -15
- package/lib/lights/LightType.d.ts +0 -8
- package/lib/lights/Point.d.ts +0 -7
- package/lib/lights/Spot.d.ts +0 -10
package/package.json
CHANGED
package/core/mx3d.dazzle.min.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
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 h}),i.d(n,"Global",function(){return o}),i.d(n,"Builder",function(){return s}),i.d(n,"IconFromMesh",function(){return l}),i.d(n,"Icon",function(){return a}),i.d(n,"GUID",function(){return r}),i.d(n,"HeatMap",function(){return u}),i.d(n,"Capacity",function(){return c});class r{static getGUID(e){var t,i,n="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split(""),s=[],o=n.length;if(e)for(t=0;t<e;t++)s[t]=n[0|Math.random()*o];else for(s[8]=s[13]=s[18]=s[23]="-",s[14]="4",t=0;t<36;t++)s[t]||(i=0|16*Math.random(),s[t]=n[19==t?3&i|8:i]);return s.join("")}}class u{constructor(e){this.anchor=e,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 m=i(0);class c{constructor(e,t){this.anchor=e,this.ratio=t}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 i=0;i<2*s.config.maxY;i++){let t={x:n,y:i,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==i&&(t.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*i)),o.texts.push(this.createTempVlaue(t.value+"℃",d,s.anchor._scene,s.container)))}e.push(t)}o.displayValues=s.displayValues;let t=m.create({width:2*s.config.maxX,height:2*s.config.maxY,radius:s.radius});t.setData({min:s.range.min,max:s.range.max,data:e});let i=new BABYLON.StandardMaterial(o.id,s.anchor._scene);return i.diffuseTexture=new BABYLON.Texture(t.getDataURL(),s.anchor._scene,!1,!1),i.specularColor=new BABYLON.Color3(0,0,0),i.alpha=.5,s.isAlpha&&(i.diffuseTexture.hasAlpha=!0),s.isParticle&&(this._getMatrixParticleTex(s.rootUrl,s.FogTex,i.diffuseTexture,o.mesh,s.anchor._scene,s.isLevelRender),o.mesh.isVisible=!1),s.isLevelRender&&(o.mesh.renderingGroupId=1),o.mesh.material=i,o.mesh.alwaysSelectAsActiveMesh=!0,o.mesh.freezeWorldMatrix(),s.anchor._scene.blockfreeActiveMeshesAndRenderingGroups=!1,o}static _getMatrixParticleTex(e,t,i,n,s,o){let r;let a=t.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)),t=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=t,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=i,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 t;s.anchor._scene.blockfreeActiveMeshesAndRenderingGroups=!0,t=new u(s.anchor.id),t.scene=s.anchor._scene;var i=.98*s.anchor.scaling.y;t.mesh=BABYLON.MeshBuilder.CreatePlane(t.id,{width:.98*s.anchor.scaling.x,height:i,sideOrientation:2},s.anchor._scene),t.mesh.alwaysSelectAsActiveMesh=!0,t.mesh.enablePointerMoveEvents=!1,t.mesh.position=s.anchor.position.clone(),t.mesh.rotation.z=Math.PI,t.mesh.rotation.y=s.anchor.rotation.y,s.isLevelRender&&(t.mesh.renderingGroupId=1);let e=[];for(let n=0;n<4;n++)for(let i=0;i<3*s.config.length;i++){let t={x:n,y:i,value:s.range.min};for(let e=0;e<s.config.length;e++){var o=s.config[e];2==n&&3*e+2==i&&(t.value=o.value)}e.push(t)}var n=i/s.config.length;for(let e=0;e<s.config.length;e++){var r=new BABYLON.Vector3(t.mesh.position.x,i-n*e-n/2,t.mesh.position.z);t.texts.push(this.createTempVlaue(s.config[e].value+"℃",r,s.anchor._scene,s.container))}t.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(t.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,t.mesh,s.anchor._scene,s.FogTex,s.isLevelRender),t.mesh.isVisible=!1),t.mesh.material=c,s.anchor._scene.blockfreeActiveMeshesAndRenderingGroups=!1,t}static _getColumnarParticleTex(e,t,i,n,s){let o;let r=n.clone();n=t.getBoundingInfo().boundingBox,n.extendSizeWorld.x,n.extendSizeWorld.z;BABYLON.Effect.ShadersStore.particlesVertexShader=`
|
|
2
|
-
precision highp float;
|
|
3
|
-
in vec3 position;
|
|
4
|
-
in vec4 color;
|
|
5
|
-
in float angle;
|
|
6
|
-
in vec2 size;
|
|
7
|
-
in vec2 offset;
|
|
8
|
-
uniform mat4 view;
|
|
9
|
-
uniform mat4 projection;
|
|
10
|
-
uniform vec2 translationPivot;
|
|
11
|
-
out vec2 vUV;
|
|
12
|
-
out vec4 vColor;
|
|
13
|
-
out vec3 vPositionW;
|
|
14
|
-
out vec3 vPosition;
|
|
15
|
-
uniform mat4 invView;
|
|
16
|
-
uniform vec3 eyePosition;
|
|
17
|
-
|
|
18
|
-
vec3 rotate(vec3 yaxis,vec3 rotatedCorner) {
|
|
19
|
-
vec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));
|
|
20
|
-
vec3 zaxis=normalize(cross(yaxis,xaxis));
|
|
21
|
-
vec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);
|
|
22
|
-
vec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);
|
|
23
|
-
vec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);
|
|
24
|
-
mat3 rotMatrix=mat3(row0,row1,row2);
|
|
25
|
-
vec3 alignedCorner=rotMatrix*rotatedCorner;
|
|
26
|
-
return position+alignedCorner;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
void main(void) {
|
|
30
|
-
vec2 cornerPos;
|
|
31
|
-
cornerPos=(vec2(offset.x-0.5,offset.y-0.5)-translationPivot)*size+translationPivot;
|
|
32
|
-
vec3 rotatedCorner;
|
|
33
|
-
rotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);
|
|
34
|
-
rotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);
|
|
35
|
-
rotatedCorner.z=0.;
|
|
36
|
-
vec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner;
|
|
37
|
-
vPositionW=(invView*vec4(viewPos,1)).xyz;
|
|
38
|
-
vPosition = position;
|
|
39
|
-
gl_Position=projection*vec4(viewPos,1.0);
|
|
40
|
-
vColor=color;
|
|
41
|
-
vUV=offset;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
`,BABYLON.Effect.ShadersStore[t.id+"myParticleFragmentShader"]=`
|
|
45
|
-
#ifdef GL_ES
|
|
46
|
-
precision highp float;
|
|
47
|
-
#endif
|
|
48
|
-
|
|
49
|
-
attribute vec3 position;
|
|
50
|
-
|
|
51
|
-
varying vec2 vUV; // Provided by babylon.js
|
|
52
|
-
varying vec4 vColor; // Provided by babylon.js
|
|
53
|
-
|
|
54
|
-
varying vec3 vPosition;
|
|
55
|
-
|
|
56
|
-
uniform sampler2D diffuseSampler; // Provided by babylon.js
|
|
57
|
-
uniform float time; // This one is custom so we need to declare it to the effect
|
|
58
|
-
|
|
59
|
-
uniform float u_emitXMin;
|
|
60
|
-
uniform float u_emitXMax;
|
|
61
|
-
uniform float u_emitYMin;
|
|
62
|
-
uniform float u_emitYMax;
|
|
63
|
-
|
|
64
|
-
uniform sampler2D boxTexSampler;
|
|
65
|
-
|
|
66
|
-
uniform mat4 emitBox_WorldM;
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
void main(void) {
|
|
70
|
-
vec4 position = inverse(emitBox_WorldM) * vec4(vPosition, 1.0);
|
|
71
|
-
|
|
72
|
-
float x = position.x;
|
|
73
|
-
float z = position.y;
|
|
74
|
-
float output0 = 0.0 + (x - u_emitXMin) * (1.0 - 0.0) / (u_emitXMax - u_emitXMin);
|
|
75
|
-
float output1 = 0.0 + (z - u_emitYMin) * (1.0 - 0.0) / (u_emitYMax - u_emitYMin);
|
|
76
|
-
vec2 xy = vec2(output0, output1);
|
|
77
|
-
vec4 baseTex = texture2D(boxTexSampler, xy);
|
|
78
|
-
|
|
79
|
-
vec4 baseColor = texture2D(diffuseSampler, vUV);
|
|
80
|
-
|
|
81
|
-
vec4 resAlpha = baseColor * vColor ;
|
|
82
|
-
|
|
83
|
-
gl_FragColor = vec4(baseTex.xyz, resAlpha.a);
|
|
84
|
-
}
|
|
85
|
-
`;var a=i.getEngine().createEffectForParticles(t.id+"myParticle",["time","u_emitXMin","u_emitYMin","u_emitXMax","u_emitYMax","emitBox_WorldM"],["boxTexSampler"],"");return t.onAfterWorldMatrixUpdateObservable.add(()=>{a.setMatrix("emitBox_WorldM",t.getWorldMatrix())}),a.onCompileObservable.add(()=>{a.setMatrix("emitBox_WorldM",t.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,i,a),o.manualEmitCount=o.getCapacity(),o.minEmitBox=n.minimum,o.maxEmitBox=n.maximum,t.onDispose=()=>{o&&o.dispose()},o.onDispose=()=>{r&&r.dispose()},o.particleTexture=r.clone(),o.emitter=t,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,t,i,n){let s=new BABYLON.Mesh("temp_"+r.getGUID(12),i);s.position=t;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,t,i,n="200px"){let s=new c(e,t);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;let o=t<.25?BABYLON.Color3.Blue():.25<=t&&t<.5?BABYLON.Color3.Green():.5<=t&&t<.75?BABYLON.Color3.Yellow():BABYLON.Color3.Red();s.color=o.toHexString(),t*=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,t,0,null),s.anchor.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,i&&(s.textMesh=this.createTextMesh(e,i,t,n,"#fff")),s}static createTextMesh(e,t,i,n="200px",s="white"){e.app.scene.blockfreeActiveMeshesAndRenderingGroups=!0;let o=BABYLON.Mesh.CreatePlane("text_"+e.id,e.instance.scaling.x,e.app.scene,!0,BABYLON.Mesh.DOUBLESIDE);o.alwaysSelectAsActiveMesh=!0,o.position=e.instance.position.clone(),o.position.y=i+.05,o.rotation.y=Math.PI-e.instance.rotation.y,o.rotation.x=-Math.PI/2;let r=new BABYLON.StandardMaterial("text_mat_"+e.id,e.app.scene);r.diffuseColor=BABYLON.Color3.White(),r.emissiveColor=BABYLON.Color3.White();let a=new BABYLON.DynamicTexture("text_tex_"+e.id,{width:1e3*e.instance.scaling.x,height:500*e.instance.scaling.x},e.app.scene,!1);return a.hasAlpha=!0,r.diffuseTexture=a,r.opacityTexture=a,a.drawText(t,1e3*e.instance.scaling.x/4,500*e.instance.scaling.x/2,"bold "+n+" NexaBold",s,"",!0,!0),a.update(),o.material=r,e.app.scene.blockfreeActiveMeshesAndRenderingGroups=!1,o}}class o{}class a{constructor(e,t){this.textDics=new Array,this.id=e,this.scene=t}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 l{constructor(e,t,i,n,s,o){this.id=e,this.scene=o,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=t.clone(),this.instance.position.y+=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 i=new Image;i.src=this.url,i.onload=()=>{this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.scaling.y=this.scaling/(i.width/i.height)/this.scaling;let e=new BABYLON.DynamicTexture(this.id,{width:i.width,height:i.height},this.scene,!1);e.hasAlpha=!0,this.instance.material.diffuseTexture=e;let t=e.getContext();t.drawImage(i,0,0),e.update(),this.scene.blockfreeActiveMeshesAndRenderingGroups=!1}}addEventListener(t){if(this.scene.blockfreeActiveMeshesAndRenderingGroups=!0,this.instance.actionManager&&this.instance.actionManager.dispose(),this.instance.isPickable=!1,this.instance.enablePointerMoveEvents=!1,t){this.instance.isPickable=!0,this.instance.enablePointerMoveEvents=!0;let e=new BABYLON.ActionManager(this.scene);e.registerAction(new BABYLON.ExecuteCodeAction(BABYLON.ActionManager.OnPickTrigger,e=>t(this.id))),this.instance.actionManager=e}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(i){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 t=new BABYLON.DynamicTexture(this.id,{width:n.width,height:n.height},this.scene,!1);t.hasAlpha=!0,this.instance.material.diffuseTexture=t;let e=t.getContext();e.drawImage(n,0,0),i.forEach(e=>t.drawText(e.text,e.left,e.top,"bold "+e.fontSize+" monospace",e.color||"#fffffb","",!0,!0)),t.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 t=new o;return t.canvas=document.createElement("canvas"),t.canvas.style.cssText="width: 100%;height: 100%;background-color: transparent;outline-width: 0;-webkit-tap-highlight-color:transparent;",e.appendChild(t.canvas),t.engine=new BABYLON.Engine(t.canvas,!0,{premultipliedAlpha:!0,preserveDrawingBuffer:!0,stencil:!0}),t.engine.setHardwareScalingLevel(.5),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}],o={},s.m=n,s.c=o,s.d=function(e,t,i){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},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(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var i=Object.create(null);if(s.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)s.d(i,n,function(e){return t[e]}.bind(null,n));return i},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=1).default;function s(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,s),t.l=!0,t.exports}var n,o});
|
package/docs/.nojekyll
DELETED
|
File without changes
|
package/docs/_sidebar.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
- [说明](/)
|
|
2
|
-
|
|
3
|
-
- [快速开始](/started/quickstart)
|
|
4
|
-
|
|
5
|
-
- [环境](/started/environment.md)
|
|
6
|
-
|
|
7
|
-
- [场景](/project/projectmgr.md)
|
|
8
|
-
|
|
9
|
-
- [相机](/camera.md)
|
|
10
|
-
|
|
11
|
-
- [对象](/models/modelmgr.md)
|
|
12
|
-
|
|
13
|
-
- UI
|
|
14
|
-
|
|
15
|
-
- [2D 跟随 UI](/gui/2D.md)
|
|
16
|
-
- [3D 网格 UI](/gui/3D.md)
|
|
17
|
-
|
|
18
|
-
- [云图](/heatMap/heatMap.md)
|
package/docs/camera.md
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
## 2d 视角
|
|
2
|
-
|
|
3
|
-
```javascript
|
|
4
|
-
app.Camera.orthographic()
|
|
5
|
-
```
|
|
6
|
-
|
|
7
|
-
## 3d 聚焦
|
|
8
|
-
|
|
9
|
-
```javascript
|
|
10
|
-
app.Camera.perspective()
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
## 指定层级聚焦视角
|
|
14
|
-
|
|
15
|
-
```javascript
|
|
16
|
-
children[0].setVisualAngle('{"alpha":2.1038092987808326,"focus":{"x":11.526,"y":1.948,"z":-12.331},"radius":107.58319272047535,"beta":0.9597050684905495}',5,200);
|
|
17
|
-
//第一个参数为视角参数F获取
|
|
18
|
-
//第二个参数为缩放最小限制距离,可为空
|
|
19
|
-
//第三个参数为缩放最大限制距离,可为空
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
### 视角获取
|
|
23
|
-
|
|
24
|
-
在鼠标旋转到最佳视角时按键盘 F 键立即弹出视角参数
|