aa0022a0c6ebf4357c6d0442c856dc7107ad8bd5c25195cd243ab9117477a1ea.json 17 KB

1
  1. {"ast":null,"code":"import { Logger } from \"../Misc/logger.js\";\nimport { Scene } from \"../scene.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { StandardMaterial } from \"../Materials/standardMaterial.js\";\nimport { PBRMaterial } from \"../Materials/PBR/pbrMaterial.js\";\nimport { HemisphericLight } from \"../Lights/hemisphericLight.js\";\nimport { EnvironmentHelper } from \"./environmentHelper.js\";\nimport { FreeCamera } from \"../Cameras/freeCamera.js\";\nimport { ArcRotateCamera } from \"../Cameras/arcRotateCamera.js\";\nimport { VRExperienceHelper } from \"../Cameras/VR/vrExperienceHelper.js\";\nimport \"../Materials/Textures/Loaders/ddsTextureLoader.js\";\nimport \"../Materials/Textures/Loaders/envTextureLoader.js\";\nimport \"../Materials/Textures/Loaders/ktxTextureLoader.js\";\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder.js\";\nimport { WebXRDefaultExperience } from \"../XR/webXRDefaultExperience.js\";\n/** @internal */\n// eslint-disable-next-line no-var\nexport var _forceSceneHelpersToBundle = true;\nScene.prototype.createDefaultLight = function (replace = false) {\n // Dispose existing light in replace mode.\n if (replace) {\n if (this.lights) {\n for (let i = 0; i < this.lights.length; i++) {\n this.lights[i].dispose();\n }\n }\n }\n // Light\n if (this.lights.length === 0) {\n new HemisphericLight(\"default light\", Vector3.Up(), this);\n }\n};\nScene.prototype.createDefaultCamera = function (createArcRotateCamera = false, replace = false, attachCameraControls = false) {\n // Dispose existing camera in replace mode.\n if (replace) {\n if (this.activeCamera) {\n this.activeCamera.dispose();\n this.activeCamera = null;\n }\n }\n // Camera\n if (!this.activeCamera) {\n const worldExtends = this.getWorldExtends(mesh => mesh.isVisible && mesh.isEnabled());\n const worldSize = worldExtends.max.subtract(worldExtends.min);\n const worldCenter = worldExtends.min.add(worldSize.scale(0.5));\n let camera;\n let radius = worldSize.length() * 1.5;\n // empty scene scenario!\n if (!isFinite(radius)) {\n radius = 1;\n worldCenter.copyFromFloats(0, 0, 0);\n }\n if (createArcRotateCamera) {\n const arcRotateCamera = new ArcRotateCamera(\"default camera\", -(Math.PI / 2), Math.PI / 2, radius, worldCenter, this);\n arcRotateCamera.lowerRadiusLimit = radius * 0.01;\n arcRotateCamera.wheelPrecision = 100 / radius;\n camera = arcRotateCamera;\n } else {\n const freeCamera = new FreeCamera(\"default camera\", new Vector3(worldCenter.x, worldCenter.y, -radius), this);\n freeCamera.setTarget(worldCenter);\n camera = freeCamera;\n }\n camera.minZ = radius * 0.01;\n camera.maxZ = radius * 1000;\n camera.speed = radius * 0.2;\n this.activeCamera = camera;\n if (attachCameraControls) {\n camera.attachControl();\n }\n }\n};\nScene.prototype.createDefaultCameraOrLight = function (createArcRotateCamera = false, replace = false, attachCameraControls = false) {\n this.createDefaultLight(replace);\n this.createDefaultCamera(createArcRotateCamera, replace, attachCameraControls);\n};\nScene.prototype.createDefaultSkybox = function (environmentTexture, pbr = false, scale = 1000, blur = 0, setGlobalEnvTexture = true) {\n if (!environmentTexture) {\n Logger.Warn(\"Can not create default skybox without environment texture.\");\n return null;\n }\n if (setGlobalEnvTexture) {\n if (environmentTexture) {\n this.environmentTexture = environmentTexture;\n }\n }\n // Skybox\n const hdrSkybox = CreateBox(\"hdrSkyBox\", {\n size: scale\n }, this);\n if (pbr) {\n const hdrSkyboxMaterial = new PBRMaterial(\"skyBox\", this);\n hdrSkyboxMaterial.backFaceCulling = false;\n hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();\n if (hdrSkyboxMaterial.reflectionTexture) {\n hdrSkyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;\n }\n hdrSkyboxMaterial.microSurface = 1.0 - blur;\n hdrSkyboxMaterial.disableLighting = true;\n hdrSkyboxMaterial.twoSidedLighting = true;\n hdrSkybox.material = hdrSkyboxMaterial;\n } else {\n const skyboxMaterial = new StandardMaterial(\"skyBox\", this);\n skyboxMaterial.backFaceCulling = false;\n skyboxMaterial.reflectionTexture = environmentTexture.clone();\n if (skyboxMaterial.reflectionTexture) {\n skyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;\n }\n skyboxMaterial.disableLighting = true;\n hdrSkybox.material = skyboxMaterial;\n }\n hdrSkybox.isPickable = false;\n hdrSkybox.infiniteDistance = true;\n hdrSkybox.ignoreCameraMaxZ = true;\n return hdrSkybox;\n};\nScene.prototype.createDefaultEnvironment = function (options) {\n if (EnvironmentHelper) {\n return new EnvironmentHelper(options, this);\n }\n return null;\n};\nScene.prototype.createDefaultVRExperience = function (webVROptions = {}) {\n return new VRExperienceHelper(this, webVROptions);\n};\nScene.prototype.createDefaultXRExperienceAsync = function (options = {}) {\n return WebXRDefaultExperience.CreateAsync(this, options).then(helper => {\n return helper;\n });\n};","map":{"version":3,"names":["Logger","Scene","Vector3","Texture","StandardMaterial","PBRMaterial","HemisphericLight","EnvironmentHelper","FreeCamera","ArcRotateCamera","VRExperienceHelper","CreateBox","WebXRDefaultExperience","_forceSceneHelpersToBundle","prototype","createDefaultLight","replace","lights","i","length","dispose","Up","createDefaultCamera","createArcRotateCamera","attachCameraControls","activeCamera","worldExtends","getWorldExtends","mesh","isVisible","isEnabled","worldSize","max","subtract","min","worldCenter","add","scale","camera","radius","isFinite","copyFromFloats","arcRotateCamera","Math","PI","lowerRadiusLimit","wheelPrecision","freeCamera","x","y","setTarget","minZ","maxZ","speed","attachControl","createDefaultCameraOrLight","createDefaultSkybox","environmentTexture","pbr","blur","setGlobalEnvTexture","Warn","hdrSkybox","size","hdrSkyboxMaterial","backFaceCulling","reflectionTexture","clone","coordinatesMode","SKYBOX_MODE","microSurface","disableLighting","twoSidedLighting","material","skyboxMaterial","isPickable","infiniteDistance","ignoreCameraMaxZ","createDefaultEnvironment","options","createDefaultVRExperience","webVROptions","createDefaultXRExperienceAsync","CreateAsync","then","helper"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Helpers/sceneHelpers.js"],"sourcesContent":["import { Logger } from \"../Misc/logger.js\";\nimport { Scene } from \"../scene.js\";\nimport { Vector3 } from \"../Maths/math.vector.js\";\nimport { Texture } from \"../Materials/Textures/texture.js\";\nimport { StandardMaterial } from \"../Materials/standardMaterial.js\";\nimport { PBRMaterial } from \"../Materials/PBR/pbrMaterial.js\";\nimport { HemisphericLight } from \"../Lights/hemisphericLight.js\";\nimport { EnvironmentHelper } from \"./environmentHelper.js\";\nimport { FreeCamera } from \"../Cameras/freeCamera.js\";\nimport { ArcRotateCamera } from \"../Cameras/arcRotateCamera.js\";\nimport { VRExperienceHelper } from \"../Cameras/VR/vrExperienceHelper.js\";\nimport \"../Materials/Textures/Loaders/ddsTextureLoader.js\";\nimport \"../Materials/Textures/Loaders/envTextureLoader.js\";\nimport \"../Materials/Textures/Loaders/ktxTextureLoader.js\";\nimport { CreateBox } from \"../Meshes/Builders/boxBuilder.js\";\nimport { WebXRDefaultExperience } from \"../XR/webXRDefaultExperience.js\";\n/** @internal */\n// eslint-disable-next-line no-var\nexport var _forceSceneHelpersToBundle = true;\nScene.prototype.createDefaultLight = function (replace = false) {\n // Dispose existing light in replace mode.\n if (replace) {\n if (this.lights) {\n for (let i = 0; i < this.lights.length; i++) {\n this.lights[i].dispose();\n }\n }\n }\n // Light\n if (this.lights.length === 0) {\n new HemisphericLight(\"default light\", Vector3.Up(), this);\n }\n};\nScene.prototype.createDefaultCamera = function (createArcRotateCamera = false, replace = false, attachCameraControls = false) {\n // Dispose existing camera in replace mode.\n if (replace) {\n if (this.activeCamera) {\n this.activeCamera.dispose();\n this.activeCamera = null;\n }\n }\n // Camera\n if (!this.activeCamera) {\n const worldExtends = this.getWorldExtends((mesh) => mesh.isVisible && mesh.isEnabled());\n const worldSize = worldExtends.max.subtract(worldExtends.min);\n const worldCenter = worldExtends.min.add(worldSize.scale(0.5));\n let camera;\n let radius = worldSize.length() * 1.5;\n // empty scene scenario!\n if (!isFinite(radius)) {\n radius = 1;\n worldCenter.copyFromFloats(0, 0, 0);\n }\n if (createArcRotateCamera) {\n const arcRotateCamera = new ArcRotateCamera(\"default camera\", -(Math.PI / 2), Math.PI / 2, radius, worldCenter, this);\n arcRotateCamera.lowerRadiusLimit = radius * 0.01;\n arcRotateCamera.wheelPrecision = 100 / radius;\n camera = arcRotateCamera;\n }\n else {\n const freeCamera = new FreeCamera(\"default camera\", new Vector3(worldCenter.x, worldCenter.y, -radius), this);\n freeCamera.setTarget(worldCenter);\n camera = freeCamera;\n }\n camera.minZ = radius * 0.01;\n camera.maxZ = radius * 1000;\n camera.speed = radius * 0.2;\n this.activeCamera = camera;\n if (attachCameraControls) {\n camera.attachControl();\n }\n }\n};\nScene.prototype.createDefaultCameraOrLight = function (createArcRotateCamera = false, replace = false, attachCameraControls = false) {\n this.createDefaultLight(replace);\n this.createDefaultCamera(createArcRotateCamera, replace, attachCameraControls);\n};\nScene.prototype.createDefaultSkybox = function (environmentTexture, pbr = false, scale = 1000, blur = 0, setGlobalEnvTexture = true) {\n if (!environmentTexture) {\n Logger.Warn(\"Can not create default skybox without environment texture.\");\n return null;\n }\n if (setGlobalEnvTexture) {\n if (environmentTexture) {\n this.environmentTexture = environmentTexture;\n }\n }\n // Skybox\n const hdrSkybox = CreateBox(\"hdrSkyBox\", { size: scale }, this);\n if (pbr) {\n const hdrSkyboxMaterial = new PBRMaterial(\"skyBox\", this);\n hdrSkyboxMaterial.backFaceCulling = false;\n hdrSkyboxMaterial.reflectionTexture = environmentTexture.clone();\n if (hdrSkyboxMaterial.reflectionTexture) {\n hdrSkyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;\n }\n hdrSkyboxMaterial.microSurface = 1.0 - blur;\n hdrSkyboxMaterial.disableLighting = true;\n hdrSkyboxMaterial.twoSidedLighting = true;\n hdrSkybox.material = hdrSkyboxMaterial;\n }\n else {\n const skyboxMaterial = new StandardMaterial(\"skyBox\", this);\n skyboxMaterial.backFaceCulling = false;\n skyboxMaterial.reflectionTexture = environmentTexture.clone();\n if (skyboxMaterial.reflectionTexture) {\n skyboxMaterial.reflectionTexture.coordinatesMode = Texture.SKYBOX_MODE;\n }\n skyboxMaterial.disableLighting = true;\n hdrSkybox.material = skyboxMaterial;\n }\n hdrSkybox.isPickable = false;\n hdrSkybox.infiniteDistance = true;\n hdrSkybox.ignoreCameraMaxZ = true;\n return hdrSkybox;\n};\nScene.prototype.createDefaultEnvironment = function (options) {\n if (EnvironmentHelper) {\n return new EnvironmentHelper(options, this);\n }\n return null;\n};\nScene.prototype.createDefaultVRExperience = function (webVROptions = {}) {\n return new VRExperienceHelper(this, webVROptions);\n};\nScene.prototype.createDefaultXRExperienceAsync = function (options = {}) {\n return WebXRDefaultExperience.CreateAsync(this, options).then((helper) => {\n return helper;\n });\n};\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,mBAAmB;AAC1C,SAASC,KAAK,QAAQ,aAAa;AACnC,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,OAAO,QAAQ,kCAAkC;AAC1D,SAASC,gBAAgB,QAAQ,kCAAkC;AACnE,SAASC,WAAW,QAAQ,iCAAiC;AAC7D,SAASC,gBAAgB,QAAQ,+BAA+B;AAChE,SAASC,iBAAiB,QAAQ,wBAAwB;AAC1D,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,eAAe,QAAQ,+BAA+B;AAC/D,SAASC,kBAAkB,QAAQ,qCAAqC;AACxE,OAAO,mDAAmD;AAC1D,OAAO,mDAAmD;AAC1D,OAAO,mDAAmD;AAC1D,SAASC,SAAS,QAAQ,kCAAkC;AAC5D,SAASC,sBAAsB,QAAQ,iCAAiC;AACxE;AACA;AACA,OAAO,IAAIC,0BAA0B,GAAG,IAAI;AAC5CZ,KAAK,CAACa,SAAS,CAACC,kBAAkB,GAAG,UAAUC,OAAO,GAAG,KAAK,EAAE;EAC5D;EACA,IAAIA,OAAO,EAAE;IACT,IAAI,IAAI,CAACC,MAAM,EAA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