62a6c2960240ef0dd651337f92ac13a9f5bd154714c15558fc400dcd0feced24.json 8.4 KB

1
  1. {"ast":null,"code":"import { Scene } from \"../scene.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { GeometryBufferRenderer } from \"./geometryBufferRenderer.js\";\nObject.defineProperty(Scene.prototype, \"geometryBufferRenderer\", {\n get: function () {\n return this._geometryBufferRenderer;\n },\n set: function (value) {\n if (value && value.isSupported) {\n this._geometryBufferRenderer = value;\n }\n },\n enumerable: true,\n configurable: true\n});\nScene.prototype.enableGeometryBufferRenderer = function (ratio = 1, depthFormat = 15, textureTypesAndFormats) {\n if (this._geometryBufferRenderer) {\n return this._geometryBufferRenderer;\n }\n this._geometryBufferRenderer = new GeometryBufferRenderer(this, ratio, depthFormat, textureTypesAndFormats);\n if (!this._geometryBufferRenderer.isSupported) {\n this._geometryBufferRenderer = null;\n }\n return this._geometryBufferRenderer;\n};\nScene.prototype.disableGeometryBufferRenderer = function () {\n if (!this._geometryBufferRenderer) {\n return;\n }\n this._geometryBufferRenderer.dispose();\n this._geometryBufferRenderer = null;\n};\n/**\n * Defines the Geometry Buffer scene component responsible to manage a G-Buffer useful\n * in several rendering techniques.\n */\nexport class GeometryBufferRendererSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpful to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER;\n this.scene = scene;\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n this.scene._gatherRenderTargetsStage.registerStep(SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, this, this._gatherRenderTargets);\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n // Nothing to do for this component\n }\n /**\n * Disposes the component and the associated resources\n */\n dispose() {\n // Nothing to do for this component\n }\n _gatherRenderTargets(renderTargets) {\n if (this.scene._geometryBufferRenderer) {\n renderTargets.push(this.scene._geometryBufferRenderer.getGBuffer());\n }\n }\n}\nGeometryBufferRenderer._SceneComponentInitialization = scene => {\n // Register the G Buffer component to the scene.\n let component = scene._getComponent(SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER);\n if (!component) {\n component = new GeometryBufferRendererSceneComponent(scene);\n scene._addComponent(component);\n }\n};","map":{"version":3,"names":["Scene","SceneComponentConstants","GeometryBufferRenderer","Object","defineProperty","prototype","get","_geometryBufferRenderer","set","value","isSupported","enumerable","configurable","enableGeometryBufferRenderer","ratio","depthFormat","textureTypesAndFormats","disableGeometryBufferRenderer","dispose","GeometryBufferRendererSceneComponent","constructor","scene","name","NAME_GEOMETRYBUFFERRENDERER","register","_gatherRenderTargetsStage","registerStep","STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER","_gatherRenderTargets","rebuild","renderTargets","push","getGBuffer","_SceneComponentInitialization","component","_getComponent","_addComponent"],"sources":["F:/workspace/202226701027/huinongbao-app/node_modules/@babylonjs/core/Rendering/geometryBufferRendererSceneComponent.js"],"sourcesContent":["import { Scene } from \"../scene.js\";\nimport { SceneComponentConstants } from \"../sceneComponent.js\";\nimport { GeometryBufferRenderer } from \"./geometryBufferRenderer.js\";\n\nObject.defineProperty(Scene.prototype, \"geometryBufferRenderer\", {\n get: function () {\n return this._geometryBufferRenderer;\n },\n set: function (value) {\n if (value && value.isSupported) {\n this._geometryBufferRenderer = value;\n }\n },\n enumerable: true,\n configurable: true,\n});\nScene.prototype.enableGeometryBufferRenderer = function (ratio = 1, depthFormat = 15, textureTypesAndFormats) {\n if (this._geometryBufferRenderer) {\n return this._geometryBufferRenderer;\n }\n this._geometryBufferRenderer = new GeometryBufferRenderer(this, ratio, depthFormat, textureTypesAndFormats);\n if (!this._geometryBufferRenderer.isSupported) {\n this._geometryBufferRenderer = null;\n }\n return this._geometryBufferRenderer;\n};\nScene.prototype.disableGeometryBufferRenderer = function () {\n if (!this._geometryBufferRenderer) {\n return;\n }\n this._geometryBufferRenderer.dispose();\n this._geometryBufferRenderer = null;\n};\n/**\n * Defines the Geometry Buffer scene component responsible to manage a G-Buffer useful\n * in several rendering techniques.\n */\nexport class GeometryBufferRendererSceneComponent {\n /**\n * Creates a new instance of the component for the given scene\n * @param scene Defines the scene to register the component in\n */\n constructor(scene) {\n /**\n * The component name helpful to identify the component in the list of scene components.\n */\n this.name = SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER;\n this.scene = scene;\n }\n /**\n * Registers the component in a given scene\n */\n register() {\n this.scene._gatherRenderTargetsStage.registerStep(SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER, this, this._gatherRenderTargets);\n }\n /**\n * Rebuilds the elements related to this component in case of\n * context lost for instance.\n */\n rebuild() {\n // Nothing to do for this component\n }\n /**\n * Disposes the component and the associated resources\n */\n dispose() {\n // Nothing to do for this component\n }\n _gatherRenderTargets(renderTargets) {\n if (this.scene._geometryBufferRenderer) {\n renderTargets.push(this.scene._geometryBufferRenderer.getGBuffer());\n }\n }\n}\nGeometryBufferRenderer._SceneComponentInitialization = (scene) => {\n // Register the G Buffer component to the scene.\n let component = scene._getComponent(SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER);\n if (!component) {\n component = new GeometryBufferRendererSceneComponent(scene);\n scene._addComponent(component);\n }\n};\n"],"mappings":"AAAA,SAASA,KAAK,QAAQ,aAAa;AACnC,SAASC,uBAAuB,QAAQ,sBAAsB;AAC9D,SAASC,sBAAsB,QAAQ,6BAA6B;AAEpEC,MAAM,CAACC,cAAc,CAACJ,KAAK,CAACK,SAAS,EAAE,wBAAwB,EAAE;EAC7DC,GAAG,EAAE,SAAAA,CAAA,EAAY;IACb,OAAO,IAAI,CAACC,uBAAuB;EACvC,CAAC;EACDC,GAAG,EAAE,SAAAA,CAAUC,KAAK,EAAE;IAClB,IAAIA,KAAK,IAAIA,KAAK,CAACC,WAAW,EAAE;MAC5B,IAAI,CAACH,uBAAuB,GAAGE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AAA,EAAG;IACN;EAAA;EAEJU,oBAAoBA,CAACE,aAAa,EAAE;IAChC,IAAI,IAAI,CAACT,KAAK,CAACd,uBAAuB,EAAE;MACpCuB,aAAa,CAACC,IAAI,CAAC,IAAI,CAACV,KAAK,CAACd,uBAAuB,CAACyB,UAAU,CAAC,CAAC,CAAC;IACvE;EACJ;AACJ;AACA9B,sBAAsB,CAAC+B,6BAA6B,GAAIZ,KAAK,IAAK;EAC9D;EACA,IAAIa,SAAS,GAAGb,KAAK,CAACc,aAAa,CAAClC,uBAAuB,CAACsB,2BAA2B,CAAC;EACxF,IAAI,CAACW,SAAS,EAAE;IACZA,SAAS,GAAG,IAAIf,oCAAoC,CAACE,KAAK,CAAC;IAC3DA,KAAK,CAACe,aAAa,CAACF,SAAS,CAAC;EAClC;AACJ,CAAC","ignoreList":[]},"metadata":{},"sourceType":"module","externalDependencies":[]}