{ "errors": [], "warnings": [], "version": "4.35.3", "hash": "22046590d9703027650c", "time": 2040, "builtAt": 1570651177941, "publicPath": "", "outputPath": "C:\\Repos\\Babylon.js\\.temp/testsES6Modules", "assetsByChunkName": { "thinEngineOnly": "thinEngineOnly.js" }, "assets": [ { "name": "thinEngineOnly.js", "size": 370200, "chunks": [ "thinEngineOnly" ], "chunkNames": [ "thinEngineOnly" ], "emitted": true } ], "filteredAssets": 0, "entrypoints": { "thinEngineOnly": { "chunks": [ "thinEngineOnly" ], "assets": [ "thinEngineOnly.js" ], "children": {}, "childAssets": {} } }, "namedChunkGroups": { "thinEngineOnly": { "chunks": [ "thinEngineOnly" ], "assets": [ "thinEngineOnly.js" ], "children": {}, "childAssets": {} } }, "chunks": [ { "id": "thinEngineOnly", "rendered": true, "initial": true, "entry": true, "size": 327856, "names": [ "thinEngineOnly" ], "files": [ "thinEngineOnly.js" ], "hash": "2393fd4e444cf0d2321f", "siblings": [], "parents": [], "children": [], "childrenByOrder": {}, "modules": [ { "id": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineAndOperator.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js", "index": 17, "index2": 13, "size": 695, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } } ], "profile": { "factory": 9, "building": 7, "dependencies": 3 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "./Expressions/Operators/shaderDefineAndOperator", "loc": "7:0-90" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./Expressions/Operators/shaderDefineAndOperator", "loc": "66:38-61" } ], "providedExports": [ "ShaderDefineAndOperator" ], "optimizationBailout": [], "depth": 4, "source": "import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineAndOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineAndOperator, _super);\r\n function ShaderDefineAndOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineAndOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) && this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineAndOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineAndOperator };\r\n//# sourceMappingURL=shaderDefineAndOperator.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineArithmeticOperator.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js", "index": 18, "index2": 14, "size": 1539, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } } ], "profile": { "factory": 9, "building": 7, "dependencies": 3 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "./Expressions/Operators/shaderDefineArithmeticOperator", "loc": "8:0-104" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./Expressions/Operators/shaderDefineArithmeticOperator", "loc": "59:19-49" } ], "providedExports": [ "ShaderDefineArithmeticOperator" ], "optimizationBailout": [], "depth": 4, "source": "import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineArithmeticOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineArithmeticOperator, _super);\r\n function ShaderDefineArithmeticOperator(define, operand, testValue) {\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.operand = operand;\r\n _this.testValue = testValue;\r\n return _this;\r\n }\r\n ShaderDefineArithmeticOperator.prototype.isTrue = function (preprocessors) {\r\n var value = preprocessors[this.define];\r\n if (value === undefined) {\r\n return false;\r\n }\r\n var condition = false;\r\n var left = parseInt(value);\r\n var right = parseInt(this.testValue);\r\n switch (this.operand) {\r\n case \">\":\r\n condition = left > right;\r\n break;\r\n case \"<\":\r\n condition = left < right;\r\n break;\r\n case \"<=\":\r\n condition = left <= right;\r\n break;\r\n case \">=\":\r\n condition = left >= right;\r\n break;\r\n case \"==\":\r\n condition = left === right;\r\n break;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineArithmeticOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineArithmeticOperator };\r\n//# sourceMappingURL=shaderDefineArithmeticOperator.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineIsDefinedOperator.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "index": 14, "index2": 11, "size": 917, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } } ], "profile": { "factory": 9, "building": 7, "dependencies": 3 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "./Expressions/Operators/shaderDefineIsDefinedOperator", "loc": "5:0-102" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./Expressions/Operators/shaderDefineIsDefinedOperator", "loc": "42:23-52" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./Expressions/Operators/shaderDefineIsDefinedOperator", "loc": "55:23-52" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./Expressions/Operators/shaderDefineIsDefinedOperator", "loc": "91:38-67" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./Expressions/Operators/shaderDefineIsDefinedOperator", "loc": "94:38-67" } ], "providedExports": [ "ShaderDefineIsDefinedOperator" ], "optimizationBailout": [], "depth": 4, "source": "import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from \"../shaderDefineExpression\";\r\n/** @hidden */\r\nvar ShaderDefineIsDefinedOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineIsDefinedOperator, _super);\r\n function ShaderDefineIsDefinedOperator(define, not) {\r\n if (not === void 0) { not = false; }\r\n var _this = _super.call(this) || this;\r\n _this.define = define;\r\n _this.not = not;\r\n return _this;\r\n }\r\n ShaderDefineIsDefinedOperator.prototype.isTrue = function (preprocessors) {\r\n var condition = preprocessors[this.define] !== undefined;\r\n if (this.not) {\r\n condition = !condition;\r\n }\r\n return condition;\r\n };\r\n return ShaderDefineIsDefinedOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineIsDefinedOperator };\r\n//# sourceMappingURL=shaderDefineIsDefinedOperator.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineOrOperator.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js", "index": 16, "index2": 12, "size": 688, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } } ], "profile": { "factory": 9, "building": 7, "dependencies": 3 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "./Expressions/Operators/shaderDefineOrOperator", "loc": "6:0-88" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./Expressions/Operators/shaderDefineOrOperator", "loc": "78:33-55" } ], "providedExports": [ "ShaderDefineOrOperator" ], "optimizationBailout": [], "depth": 4, "source": "import { __extends } from \"tslib\";\r\nimport { ShaderDefineExpression } from '../shaderDefineExpression';\r\n/** @hidden */\r\nvar ShaderDefineOrOperator = /** @class */ (function (_super) {\r\n __extends(ShaderDefineOrOperator, _super);\r\n function ShaderDefineOrOperator() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderDefineOrOperator.prototype.isTrue = function (preprocessors) {\r\n return this.leftOperand.isTrue(preprocessors) || this.rightOperand.isTrue(preprocessors);\r\n };\r\n return ShaderDefineOrOperator;\r\n}(ShaderDefineExpression));\r\nexport { ShaderDefineOrOperator };\r\n//# sourceMappingURL=shaderDefineOrOperator.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/shaderDefineExpression.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\shaderDefineExpression.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/shaderDefineExpression.js", "index": 15, "index2": 10, "size": 356, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineIsDefinedOperator.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineIsDefinedOperator.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "profile": { "factory": 9, "building": 7, "dependencies": 3 } } ], "profile": { "factory": 4, "building": 1 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineAndOperator.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js", "type": "harmony side effect evaluation", "userRequest": "../shaderDefineExpression", "loc": "2:0-67" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineAndOperator.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineAndOperator.js", "type": "harmony import specifier", "userRequest": "../shaderDefineExpression", "loc": "13:2-24" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineArithmeticOperator.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js", "type": "harmony side effect evaluation", "userRequest": "../shaderDefineExpression", "loc": "2:0-67" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineArithmeticOperator.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineArithmeticOperator.js", "type": "harmony import specifier", "userRequest": "../shaderDefineExpression", "loc": "41:2-24" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineIsDefinedOperator.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "type": "harmony side effect evaluation", "userRequest": "../shaderDefineExpression", "loc": "2:0-67" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineIsDefinedOperator.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineIsDefinedOperator.js", "type": "harmony import specifier", "userRequest": "../shaderDefineExpression", "loc": "21:2-24" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineOrOperator.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js", "type": "harmony side effect evaluation", "userRequest": "../shaderDefineExpression", "loc": "2:0-67" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\Expressions\\Operators\\shaderDefineOrOperator.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/Expressions/Operators/shaderDefineOrOperator.js", "type": "harmony import specifier", "userRequest": "../shaderDefineExpression", "loc": "13:2-24" } ], "providedExports": [ "ShaderDefineExpression" ], "optimizationBailout": [], "depth": 5, "source": "/** @hidden */\r\nvar ShaderDefineExpression = /** @class */ (function () {\r\n function ShaderDefineExpression() {\r\n }\r\n ShaderDefineExpression.prototype.isTrue = function (preprocessors) {\r\n return true;\r\n };\r\n return ShaderDefineExpression;\r\n}());\r\nexport { ShaderDefineExpression };\r\n//# sourceMappingURL=shaderDefineExpression.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderCodeConditionNode.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderCodeConditionNode.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeConditionNode.js", "index": 11, "index2": 8, "size": 853, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } } ], "profile": { "factory": 9, "building": 7, "dependencies": 3 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "./shaderCodeConditionNode", "loc": "3:0-68" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./shaderCodeConditionNode", "loc": "129:46-69" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./shaderCodeConditionNode", "loc": "142:46-69" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./shaderCodeConditionNode", "loc": "150:46-69" } ], "providedExports": [ "ShaderCodeConditionNode" ], "optimizationBailout": [], "depth": 4, "source": "import { __extends } from \"tslib\";\r\nimport { ShaderCodeNode } from './shaderCodeNode';\r\n/** @hidden */\r\nvar ShaderCodeConditionNode = /** @class */ (function (_super) {\r\n __extends(ShaderCodeConditionNode, _super);\r\n function ShaderCodeConditionNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeConditionNode.prototype.process = function (preprocessors, options) {\r\n for (var index = 0; index < this.children.length; index++) {\r\n var node = this.children[index];\r\n if (node.isValid(preprocessors)) {\r\n return node.process(preprocessors, options);\r\n }\r\n }\r\n return \"\";\r\n };\r\n return ShaderCodeConditionNode;\r\n}(ShaderCodeNode));\r\nexport { ShaderCodeConditionNode };\r\n//# sourceMappingURL=shaderCodeConditionNode.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderCodeCursor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderCodeCursor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeCursor.js", "index": 10, "index2": 6, "size": 1628, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } } ], "profile": { "factory": 9, "building": 7, "dependencies": 3 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "./shaderCodeCursor", "loc": "2:0-54" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./shaderCodeCursor", "loc": "177:25-41" } ], "providedExports": [ "ShaderCodeCursor" ], "optimizationBailout": [], "depth": 4, "source": "/** @hidden */\r\nvar ShaderCodeCursor = /** @class */ (function () {\r\n function ShaderCodeCursor() {\r\n }\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"currentLine\", {\r\n get: function () {\r\n return this._lines[this.lineIndex];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"canRead\", {\r\n get: function () {\r\n return this.lineIndex < this._lines.length - 1;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ShaderCodeCursor.prototype, \"lines\", {\r\n set: function (value) {\r\n this._lines = [];\r\n for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {\r\n var line = value_1[_i];\r\n // Prevent removing line break in macros.\r\n if (line[0] === \"#\") {\r\n this._lines.push(line);\r\n continue;\r\n }\r\n var split = line.split(\";\");\r\n for (var index = 0; index < split.length; index++) {\r\n var subLine = split[index];\r\n subLine = subLine.trim();\r\n if (!subLine) {\r\n continue;\r\n }\r\n this._lines.push(subLine + (index !== split.length - 1 ? \";\" : \"\"));\r\n }\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ShaderCodeCursor;\r\n}());\r\nexport { ShaderCodeCursor };\r\n//# sourceMappingURL=shaderCodeCursor.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderCodeNode.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderCodeNode.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeNode.js", "index": 8, "index2": 5, "size": 2903, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } } ], "profile": { "factory": 9, "building": 7, "dependencies": 3 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderCodeConditionNode.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderCodeConditionNode.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeConditionNode.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeConditionNode.js", "type": "harmony side effect evaluation", "userRequest": "./shaderCodeNode", "loc": "2:0-50" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderCodeConditionNode.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderCodeConditionNode.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeConditionNode.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeConditionNode.js", "type": "harmony import specifier", "userRequest": "./shaderCodeNode", "loc": "19:2-16" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderCodeTestNode.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderCodeTestNode.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeTestNode.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeTestNode.js", "type": "harmony side effect evaluation", "userRequest": "./shaderCodeNode", "loc": "2:0-50" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderCodeTestNode.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderCodeTestNode.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeTestNode.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeTestNode.js", "type": "harmony import specifier", "userRequest": "./shaderCodeNode", "loc": "13:2-16" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "./shaderCodeNode", "loc": "1:0-50" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./shaderCodeNode", "loc": "107:35-49" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./shaderCodeNode", "loc": "160:34-48" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./shaderCodeNode", "loc": "176:27-41" } ], "providedExports": [ "ShaderCodeNode" ], "optimizationBailout": [], "depth": 4, "source": "import { StringTools } from '../../Misc/stringTools';\r\n/** @hidden */\r\nvar ShaderCodeNode = /** @class */ (function () {\r\n function ShaderCodeNode() {\r\n this.children = [];\r\n }\r\n ShaderCodeNode.prototype.isValid = function (preprocessors) {\r\n return true;\r\n };\r\n ShaderCodeNode.prototype.process = function (preprocessors, options) {\r\n var result = \"\";\r\n if (this.line) {\r\n var value = this.line;\r\n var processor = options.processor;\r\n if (processor) {\r\n // This must be done before other replacements to avoid mistakenly changing something that was already changed.\r\n if (processor.lineProcessor) {\r\n value = processor.lineProcessor(value, options.isFragment);\r\n }\r\n if (processor.attributeProcessor && StringTools.StartsWith(this.line, \"attribute\")) {\r\n value = processor.attributeProcessor(this.line);\r\n }\r\n else if (processor.varyingProcessor && StringTools.StartsWith(this.line, \"varying\")) {\r\n value = processor.varyingProcessor(this.line, options.isFragment);\r\n }\r\n else if ((processor.uniformProcessor || processor.uniformBufferProcessor) && StringTools.StartsWith(this.line, \"uniform\")) {\r\n var regex = /uniform (.+) (.+)/;\r\n if (regex.test(this.line)) { // uniform\r\n if (processor.uniformProcessor) {\r\n value = processor.uniformProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n else { // Uniform buffer\r\n if (processor.uniformBufferProcessor) {\r\n value = processor.uniformBufferProcessor(this.line, options.isFragment);\r\n options.lookForClosingBracketForUniformBuffer = true;\r\n }\r\n }\r\n }\r\n if (processor.endOfUniformBufferProcessor) {\r\n if (options.lookForClosingBracketForUniformBuffer && this.line.indexOf(\"}\") !== -1) {\r\n options.lookForClosingBracketForUniformBuffer = false;\r\n value = processor.endOfUniformBufferProcessor(this.line, options.isFragment);\r\n }\r\n }\r\n }\r\n result += value + \"\\r\\n\";\r\n }\r\n this.children.forEach(function (child) {\r\n result += child.process(preprocessors, options);\r\n });\r\n if (this.additionalDefineKey) {\r\n preprocessors[this.additionalDefineKey] = this.additionalDefineValue || \"true\";\r\n }\r\n return result;\r\n };\r\n return ShaderCodeNode;\r\n}());\r\nexport { ShaderCodeNode };\r\n//# sourceMappingURL=shaderCodeNode.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderCodeTestNode.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderCodeTestNode.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderCodeTestNode.js", "index": 13, "index2": 9, "size": 596, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "profile": { "factory": 6, "building": 10, "dependencies": 1 } } ], "profile": { "factory": 9, "building": 7, "dependencies": 3 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "./shaderCodeTestNode", "loc": "4:0-58" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "./shaderCodeTestNode", "loc": "87:23-41" } ], "providedExports": [ "ShaderCodeTestNode" ], "optimizationBailout": [], "depth": 4, "source": "import { __extends } from \"tslib\";\r\nimport { ShaderCodeNode } from './shaderCodeNode';\r\n/** @hidden */\r\nvar ShaderCodeTestNode = /** @class */ (function (_super) {\r\n __extends(ShaderCodeTestNode, _super);\r\n function ShaderCodeTestNode() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ShaderCodeTestNode.prototype.isValid = function (preprocessors) {\r\n return this.testExpression.isTrue(preprocessors);\r\n };\r\n return ShaderCodeTestNode;\r\n}(ShaderCodeNode));\r\nexport { ShaderCodeTestNode };\r\n//# sourceMappingURL=shaderCodeTestNode.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "index": 7, "index2": 20, "size": 14076, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "issuerId": "../../.temp/packageES6Dev/core/Materials/effect.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } } ], "profile": { "factory": 6, "building": 10, "dependencies": 1 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony side effect evaluation", "userRequest": "../Engines/Processors/shaderProcessor", "loc": "4:0-72" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Engines/Processors/shaderProcessor", "loc": "161:16-31" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Engines/Processors/shaderProcessor", "loc": "163:20-35" } ], "providedExports": [ "ShaderProcessor" ], "optimizationBailout": [], "depth": 3, "source": "import { ShaderCodeNode } from './shaderCodeNode';\r\nimport { ShaderCodeCursor } from './shaderCodeCursor';\r\nimport { ShaderCodeConditionNode } from './shaderCodeConditionNode';\r\nimport { ShaderCodeTestNode } from './shaderCodeTestNode';\r\nimport { ShaderDefineIsDefinedOperator } from './Expressions/Operators/shaderDefineIsDefinedOperator';\r\nimport { ShaderDefineOrOperator } from './Expressions/Operators/shaderDefineOrOperator';\r\nimport { ShaderDefineAndOperator } from './Expressions/Operators/shaderDefineAndOperator';\r\nimport { ShaderDefineArithmeticOperator } from './Expressions/Operators/shaderDefineArithmeticOperator';\r\nimport { FileTools } from '../../Misc/fileTools';\r\n/** @hidden */\r\nvar ShaderProcessor = /** @class */ (function () {\r\n function ShaderProcessor() {\r\n }\r\n ShaderProcessor.Process = function (sourceCode, options, callback) {\r\n var _this = this;\r\n this._ProcessIncludes(sourceCode, options, function (codeWithIncludes) {\r\n var migratedCode = _this._ProcessShaderConversion(codeWithIncludes, options);\r\n callback(migratedCode);\r\n });\r\n };\r\n ShaderProcessor._ProcessPrecision = function (source, options) {\r\n var shouldUseHighPrecisionShader = options.shouldUseHighPrecisionShader;\r\n if (source.indexOf(\"precision highp float\") === -1) {\r\n if (!shouldUseHighPrecisionShader) {\r\n source = \"precision mediump float;\\n\" + source;\r\n }\r\n else {\r\n source = \"precision highp float;\\n\" + source;\r\n }\r\n }\r\n else {\r\n if (!shouldUseHighPrecisionShader) { // Moving highp to mediump\r\n source = source.replace(\"precision highp float\", \"precision mediump float\");\r\n }\r\n }\r\n return source;\r\n };\r\n ShaderProcessor._ExtractOperation = function (expression) {\r\n var regex = /defined\\((.+)\\)/;\r\n var match = regex.exec(expression);\r\n if (match && match.length) {\r\n return new ShaderDefineIsDefinedOperator(match[1].trim(), expression[0] === \"!\");\r\n }\r\n var operators = [\"==\", \">=\", \"<=\", \"<\", \">\"];\r\n var operator = \"\";\r\n var indexOperator = 0;\r\n for (var _i = 0, operators_1 = operators; _i < operators_1.length; _i++) {\r\n operator = operators_1[_i];\r\n indexOperator = expression.indexOf(operator);\r\n if (indexOperator > -1) {\r\n break;\r\n }\r\n }\r\n if (indexOperator === -1) {\r\n return new ShaderDefineIsDefinedOperator(expression);\r\n }\r\n var define = expression.substring(0, indexOperator).trim();\r\n var value = expression.substring(indexOperator + operator.length).trim();\r\n return new ShaderDefineArithmeticOperator(define, operator, value);\r\n };\r\n ShaderProcessor._BuildSubExpression = function (expression) {\r\n var indexOr = expression.indexOf(\"||\");\r\n if (indexOr === -1) {\r\n var indexAnd = expression.indexOf(\"&&\");\r\n if (indexAnd > -1) {\r\n var andOperator = new ShaderDefineAndOperator();\r\n var leftPart = expression.substring(0, indexAnd).trim();\r\n var rightPart = expression.substring(indexAnd + 2).trim();\r\n andOperator.leftOperand = this._BuildSubExpression(leftPart);\r\n andOperator.rightOperand = this._BuildSubExpression(rightPart);\r\n return andOperator;\r\n }\r\n else {\r\n return this._ExtractOperation(expression);\r\n }\r\n }\r\n else {\r\n var orOperator = new ShaderDefineOrOperator();\r\n var leftPart = expression.substring(0, indexOr).trim();\r\n var rightPart = expression.substring(indexOr + 2).trim();\r\n orOperator.leftOperand = this._BuildSubExpression(leftPart);\r\n orOperator.rightOperand = this._BuildSubExpression(rightPart);\r\n return orOperator;\r\n }\r\n };\r\n ShaderProcessor._BuildExpression = function (line, start) {\r\n var node = new ShaderCodeTestNode();\r\n var command = line.substring(0, start);\r\n var expression = line.substring(start).trim();\r\n if (command === \"#ifdef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression);\r\n }\r\n else if (command === \"#ifndef\") {\r\n node.testExpression = new ShaderDefineIsDefinedOperator(expression, true);\r\n }\r\n else {\r\n node.testExpression = this._BuildSubExpression(expression);\r\n }\r\n return node;\r\n };\r\n ShaderProcessor._MoveCursorWithinIf = function (cursor, rootNode, ifNode) {\r\n var line = cursor.currentLine;\r\n while (this._MoveCursor(cursor, ifNode)) {\r\n line = cursor.currentLine;\r\n var first5 = line.substring(0, 5).toLowerCase();\r\n if (first5 === \"#else\") {\r\n var elseNode = new ShaderCodeNode();\r\n rootNode.children.push(elseNode);\r\n this._MoveCursor(cursor, elseNode);\r\n return;\r\n }\r\n else if (first5 === \"#elif\") {\r\n var elifNode = this._BuildExpression(line, 5);\r\n rootNode.children.push(elifNode);\r\n ifNode = elifNode;\r\n }\r\n }\r\n };\r\n ShaderProcessor._MoveCursor = function (cursor, rootNode) {\r\n while (cursor.canRead) {\r\n cursor.lineIndex++;\r\n var line = cursor.currentLine;\r\n var keywords = /(#ifdef)|(#else)|(#elif)|(#endif)|(#ifndef)|(#if)/;\r\n var matches = keywords.exec(line);\r\n if (matches && matches.length) {\r\n var keyword = matches[0];\r\n switch (keyword) {\r\n case \"#ifdef\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 6);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#else\":\r\n case \"#elif\":\r\n return true;\r\n case \"#endif\":\r\n return false;\r\n case \"#ifndef\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n rootNode.children.push(newRootNode);\r\n var ifNode = this._BuildExpression(line, 7);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n case \"#if\": {\r\n var newRootNode = new ShaderCodeConditionNode();\r\n var ifNode = this._BuildExpression(line, 3);\r\n rootNode.children.push(newRootNode);\r\n newRootNode.children.push(ifNode);\r\n this._MoveCursorWithinIf(cursor, newRootNode, ifNode);\r\n break;\r\n }\r\n }\r\n }\r\n else {\r\n var newNode = new ShaderCodeNode();\r\n newNode.line = line;\r\n rootNode.children.push(newNode);\r\n // Detect additional defines\r\n if (line[0] === \"#\" && line[1] === \"d\") {\r\n var split = line.replace(\";\", \"\").split(\" \");\r\n newNode.additionalDefineKey = split[1];\r\n if (split.length === 3) {\r\n newNode.additionalDefineValue = split[2];\r\n }\r\n }\r\n }\r\n }\r\n return false;\r\n };\r\n ShaderProcessor._EvaluatePreProcessors = function (sourceCode, preprocessors, options) {\r\n var rootNode = new ShaderCodeNode();\r\n var cursor = new ShaderCodeCursor();\r\n cursor.lineIndex = -1;\r\n cursor.lines = sourceCode.split(\"\\n\");\r\n // Decompose (We keep it in 2 steps so it is easier to maintain and perf hit is insignificant)\r\n this._MoveCursor(cursor, rootNode);\r\n // Recompose\r\n return rootNode.process(preprocessors, options);\r\n };\r\n ShaderProcessor._PreparePreProcessors = function (options) {\r\n var defines = options.defines;\r\n var preprocessors = {};\r\n for (var _i = 0, defines_1 = defines; _i < defines_1.length; _i++) {\r\n var define = defines_1[_i];\r\n var keyValue = define.replace(\"#define\", \"\").replace(\";\", \"\").trim();\r\n var split = keyValue.split(\" \");\r\n preprocessors[split[0]] = split.length > 1 ? split[1] : \"\";\r\n }\r\n preprocessors[\"GL_ES\"] = \"true\";\r\n preprocessors[\"__VERSION__\"] = options.version;\r\n preprocessors[options.platformName] = \"true\";\r\n return preprocessors;\r\n };\r\n ShaderProcessor._ProcessShaderConversion = function (sourceCode, options) {\r\n var preparedSourceCode = this._ProcessPrecision(sourceCode, options);\r\n if (!options.processor) {\r\n return preparedSourceCode;\r\n }\r\n // Already converted\r\n if (preparedSourceCode.indexOf(\"#version 3\") !== -1) {\r\n return preparedSourceCode.replace(\"#version 300 es\", \"\");\r\n }\r\n var defines = options.defines;\r\n var preprocessors = this._PreparePreProcessors(options);\r\n // General pre processing\r\n if (options.processor.preProcessor) {\r\n preparedSourceCode = options.processor.preProcessor(preparedSourceCode, defines, options.isFragment);\r\n }\r\n preparedSourceCode = this._EvaluatePreProcessors(preparedSourceCode, preprocessors, options);\r\n // Post processing\r\n if (options.processor.postProcessor) {\r\n preparedSourceCode = options.processor.postProcessor(preparedSourceCode, defines, options.isFragment);\r\n }\r\n return preparedSourceCode;\r\n };\r\n ShaderProcessor._ProcessIncludes = function (sourceCode, options, callback) {\r\n var _this = this;\r\n var regex = /#include<(.+)>(\\((.*)\\))*(\\[(.*)\\])*/g;\r\n var match = regex.exec(sourceCode);\r\n var returnValue = new String(sourceCode);\r\n while (match != null) {\r\n var includeFile = match[1];\r\n // Uniform declaration\r\n if (includeFile.indexOf(\"__decl__\") !== -1) {\r\n includeFile = includeFile.replace(/__decl__/, \"\");\r\n if (options.supportsUniformBuffers) {\r\n includeFile = includeFile.replace(/Vertex/, \"Ubo\");\r\n includeFile = includeFile.replace(/Fragment/, \"Ubo\");\r\n }\r\n includeFile = includeFile + \"Declaration\";\r\n }\r\n if (options.includesShadersStore[includeFile]) {\r\n // Substitution\r\n var includeContent = options.includesShadersStore[includeFile];\r\n if (match[2]) {\r\n var splits = match[3].split(\",\");\r\n for (var index = 0; index < splits.length; index += 2) {\r\n var source = new RegExp(splits[index], \"g\");\r\n var dest = splits[index + 1];\r\n includeContent = includeContent.replace(source, dest);\r\n }\r\n }\r\n if (match[4]) {\r\n var indexString = match[5];\r\n if (indexString.indexOf(\"..\") !== -1) {\r\n var indexSplits = indexString.split(\"..\");\r\n var minIndex = parseInt(indexSplits[0]);\r\n var maxIndex = parseInt(indexSplits[1]);\r\n var sourceIncludeContent = includeContent.slice(0);\r\n includeContent = \"\";\r\n if (isNaN(maxIndex)) {\r\n maxIndex = options.indexParameters[indexSplits[1]];\r\n }\r\n for (var i = minIndex; i < maxIndex; i++) {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n sourceIncludeContent = sourceIncludeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent += sourceIncludeContent.replace(/\\{X\\}/g, i.toString()) + \"\\n\";\r\n }\r\n }\r\n else {\r\n if (!options.supportsUniformBuffers) {\r\n // Ubo replacement\r\n includeContent = includeContent.replace(/light\\{X\\}.(\\w*)/g, function (str, p1) {\r\n return p1 + \"{X}\";\r\n });\r\n }\r\n includeContent = includeContent.replace(/\\{X\\}/g, indexString);\r\n }\r\n }\r\n // Replace\r\n returnValue = returnValue.replace(match[0], includeContent);\r\n }\r\n else {\r\n var includeShaderUrl = options.shadersRepository + \"ShadersInclude/\" + includeFile + \".fx\";\r\n FileTools.LoadFile(includeShaderUrl, function (fileContent) {\r\n options.includesShadersStore[includeFile] = fileContent;\r\n _this._ProcessIncludes(returnValue, options, callback);\r\n });\r\n return;\r\n }\r\n match = regex.exec(sourceCode);\r\n }\r\n callback(returnValue);\r\n };\r\n return ShaderProcessor;\r\n}());\r\nexport { ShaderProcessor };\r\n//# sourceMappingURL=shaderProcessor.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/WebGL/webGL2ShaderProcessors.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\WebGL\\webGL2ShaderProcessors.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/WebGL/webGL2ShaderProcessors.js", "index": 30, "index2": 28, "size": 1975, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "./WebGL/webGL2ShaderProcessors", "loc": "11:0-71" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "./WebGL/webGL2ShaderProcessors", "loc": "296:40-61" } ], "providedExports": [ "WebGL2ShaderProcessor" ], "optimizationBailout": [], "depth": 2, "source": "/** @hidden */\r\nvar WebGL2ShaderProcessor = /** @class */ (function () {\r\n function WebGL2ShaderProcessor() {\r\n }\r\n WebGL2ShaderProcessor.prototype.attributeProcessor = function (attribute) {\r\n return attribute.replace(\"attribute\", \"in\");\r\n };\r\n WebGL2ShaderProcessor.prototype.varyingProcessor = function (varying, isFragment) {\r\n return varying.replace(\"varying\", isFragment ? \"in\" : \"out\");\r\n };\r\n WebGL2ShaderProcessor.prototype.postProcessor = function (code, defines, isFragment) {\r\n var hasDrawBuffersExtension = code.search(/#extension.+GL_EXT_draw_buffers.+require/) !== -1;\r\n // Remove extensions\r\n var regex = /#extension.+(GL_OVR_multiview2|GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g;\r\n code = code.replace(regex, \"\");\r\n // Replace instructions\r\n code = code.replace(/texture2D\\s*\\(/g, \"texture(\");\r\n if (isFragment) {\r\n code = code.replace(/texture2DLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCubeLodEXT\\s*\\(/g, \"textureLod(\");\r\n code = code.replace(/textureCube\\s*\\(/g, \"texture(\");\r\n code = code.replace(/gl_FragDepthEXT/g, \"gl_FragDepth\");\r\n code = code.replace(/gl_FragColor/g, \"glFragColor\");\r\n code = code.replace(/gl_FragData/g, \"glFragData\");\r\n code = code.replace(/void\\s+?main\\s*\\(/g, (hasDrawBuffersExtension ? \"\" : \"out vec4 glFragColor;\\n\") + \"void main(\");\r\n }\r\n else {\r\n var hasMultiviewExtension = defines.indexOf(\"#define MULTIVIEW\") !== -1;\r\n if (hasMultiviewExtension) {\r\n return \"#extension GL_OVR_multiview2 : require\\nlayout (num_views = 2) in;\\n\" + code;\r\n }\r\n }\r\n return code;\r\n };\r\n return WebGL2ShaderProcessor;\r\n}());\r\nexport { WebGL2ShaderProcessor };\r\n//# sourceMappingURL=webGL2ShaderProcessors.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/WebGL/webGLPipelineContext.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\WebGL\\webGLPipelineContext.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/WebGL/webGLPipelineContext.js", "index": 33, "index2": 31, "size": 1078, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "./WebGL/webGLPipelineContext", "loc": "13:0-68" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "./WebGL/webGLPipelineContext", "loc": "1692:34-54" } ], "providedExports": [ "WebGLPipelineContext" ], "optimizationBailout": [], "depth": 2, "source": "/** @hidden */\r\nvar WebGLPipelineContext = /** @class */ (function () {\r\n function WebGLPipelineContext() {\r\n }\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isAsync\", {\r\n get: function () {\r\n return this.isParallelCompiled;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(WebGLPipelineContext.prototype, \"isReady\", {\r\n get: function () {\r\n if (this.program) {\r\n if (this.isParallelCompiled) {\r\n return this.engine._isRenderingStateCompiled(this);\r\n }\r\n return true;\r\n }\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n WebGLPipelineContext.prototype._handlesSpectorRebuildCallback = function (onCompiled) {\r\n if (onCompiled && this.program) {\r\n onCompiled(this.program);\r\n }\r\n };\r\n return WebGLPipelineContext;\r\n}());\r\nexport { WebGLPipelineContext };\r\n//# sourceMappingURL=webGLPipelineContext.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/engineStore.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\engineStore.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/engineStore.js", "index": 2, "index2": 0, "size": 1486, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "./engineStore", "loc": "1:0-44" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "./engineStore", "loc": "2289:20-31" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "./engineStore", "loc": "2290:40-51" } ], "providedExports": [ "EngineStore" ], "optimizationBailout": [], "depth": 2, "source": "/**\r\n * The engine store class is responsible to hold all the instances of Engine and Scene created\r\n * during the life time of the application.\r\n */\r\nvar EngineStore = /** @class */ (function () {\r\n function EngineStore() {\r\n }\r\n Object.defineProperty(EngineStore, \"LastCreatedEngine\", {\r\n /**\r\n * Gets the latest created engine\r\n */\r\n get: function () {\r\n if (this.Instances.length === 0) {\r\n return null;\r\n }\r\n return this.Instances[this.Instances.length - 1];\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(EngineStore, \"LastCreatedScene\", {\r\n /**\r\n * Gets the latest created scene\r\n */\r\n get: function () {\r\n return this._LastCreatedScene;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** Gets the list of created engines */\r\n EngineStore.Instances = new Array();\r\n /** @hidden */\r\n EngineStore._LastCreatedScene = null;\r\n /**\r\n * Gets or sets a global variable indicating if fallback texture must be used when a texture cannot be loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.UseFallbackTexture = true;\r\n /**\r\n * Texture content used if a texture cannot loaded\r\n * @ignorenaming\r\n */\r\n EngineStore.FallbackTexture = \"\";\r\n return EngineStore;\r\n}());\r\nexport { EngineStore };\r\n//# sourceMappingURL=engineStore.js.map" }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "index": 1, "index2": 33, "size": 158160, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "issuerId": "./thinEngineOnly.ts", "issuerName": "./thinEngineOnly.ts", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } } ], "profile": { "factory": 10, "building": 63 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "./thinEngineOnly.ts", "moduleIdentifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "module": "./thinEngineOnly.ts", "moduleName": "./thinEngineOnly.ts", "type": "harmony side effect evaluation", "userRequest": "@babylonjs/core/Engines/thinEngine", "loc": "1:0-64" }, { "moduleId": "./thinEngineOnly.ts", "moduleIdentifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "module": "./thinEngineOnly.ts", "moduleName": "./thinEngineOnly.ts", "type": "harmony import specifier", "userRequest": "@babylonjs/core/Engines/thinEngine", "loc": "3:4-14" } ], "providedExports": [ "ThinEngine" ], "optimizationBailout": [], "depth": 1, "source": "import { EngineStore } from './engineStore';\r\nimport { Effect } from '../Materials/effect';\r\nimport { _DevTools } from '../Misc/devTools';\r\nimport { Observable } from '../Misc/observable';\r\nimport { DepthCullingState } from '../States/depthCullingState';\r\nimport { StencilState } from '../States/stencilState';\r\nimport { AlphaState } from '../States/alphaCullingState';\r\nimport { InternalTexture, InternalTextureSource } from '../Materials/Textures/internalTexture';\r\nimport { Logger } from '../Misc/logger';\r\nimport { DomManagement } from '../Misc/domManagement';\r\nimport { WebGL2ShaderProcessor } from './WebGL/webGL2ShaderProcessors';\r\nimport { WebGLDataBuffer } from '../Meshes/WebGL/webGLDataBuffer';\r\nimport { WebGLPipelineContext } from './WebGL/webGLPipelineContext';\r\nimport { FileTools } from '../Misc/fileTools';\r\nimport { CanvasGenerator } from '../Misc/canvasGenerator';\r\n/**\r\n * Keeps track of all the buffer info used in engine.\r\n */\r\nvar BufferPointer = /** @class */ (function () {\r\n function BufferPointer() {\r\n }\r\n return BufferPointer;\r\n}());\r\n/**\r\n * The base engine class (root of all engines)\r\n */\r\nvar ThinEngine = /** @class */ (function () {\r\n /**\r\n * Creates a new engine\r\n * @param canvasOrContext defines the canvas or WebGL context to use for rendering. If you provide a WebGL context, Babylon.js will not hook events on the canvas (like pointers, keyboards, etc...) so no event observables will be available. This is mostly used when Babylon.js is used as a plugin on a system which alreay used the WebGL context\r\n * @param antialias defines enable antialiasing (default: false)\r\n * @param options defines further options to be sent to the getContext() function\r\n * @param adaptToDeviceRatio defines whether to adapt to the device's viewport characteristics (default: false)\r\n */\r\n function ThinEngine(canvasOrContext, antialias, options, adaptToDeviceRatio) {\r\n var _this = this;\r\n if (adaptToDeviceRatio === void 0) { adaptToDeviceRatio = false; }\r\n /**\r\n * Gets or sets a boolean that indicates if textures must be forced to power of 2 size even if not required\r\n */\r\n this.forcePOTTextures = false;\r\n /**\r\n * Gets a boolean indicating if the engine is currently rendering in fullscreen mode\r\n */\r\n this.isFullscreen = false;\r\n /**\r\n * Gets or sets a boolean indicating if back faces must be culled (true by default)\r\n */\r\n this.cullBackFaces = true;\r\n /**\r\n * Gets or sets a boolean indicating if the engine must keep rendering even if the window is not in foregroun\r\n */\r\n this.renderEvenInBackground = true;\r\n /**\r\n * Gets or sets a boolean indicating that cache can be kept between frames\r\n */\r\n this.preventCacheWipeBetweenFrames = false;\r\n /** Gets or sets a boolean indicating if the engine should validate programs after compilation */\r\n this.validateShaderPrograms = false;\r\n // Uniform buffers list\r\n /**\r\n * Gets or sets a boolean indicating that uniform buffers must be disabled even if they are supported\r\n */\r\n this.disableUniformBuffers = false;\r\n /** @hidden */\r\n this._uniformBuffers = new Array();\r\n this._windowIsBackground = false;\r\n this._webGLVersion = 1.0;\r\n this._highPrecisionShadersAllowed = true;\r\n /** @hidden */\r\n this._badOS = false;\r\n /** @hidden */\r\n this._badDesktopOS = false;\r\n this._colorWrite = true;\r\n this._renderingQueueLaunched = false;\r\n this._activeRenderLoops = new Array();\r\n // Lost context\r\n /**\r\n * Observable signaled when a context lost event is raised\r\n */\r\n this.onContextLostObservable = new Observable();\r\n /**\r\n * Observable signaled when a context restored event is raised\r\n */\r\n this.onContextRestoredObservable = new Observable();\r\n this._contextWasLost = false;\r\n /** @hidden */\r\n this._doNotHandleContextLost = false;\r\n /**\r\n * Gets or sets a boolean indicating that vertex array object must be disabled even if they are supported\r\n */\r\n this.disableVertexArrayObjects = false;\r\n // States\r\n /** @hidden */\r\n this._depthCullingState = new DepthCullingState();\r\n /** @hidden */\r\n this._stencilState = new StencilState();\r\n /** @hidden */\r\n this._alphaState = new AlphaState();\r\n // Cache\r\n /** @hidden */\r\n this._internalTexturesCache = new Array();\r\n /** @hidden */\r\n this._activeChannel = 0;\r\n this._currentTextureChannel = -1;\r\n /** @hidden */\r\n this._boundTexturesCache = {};\r\n this._compiledEffects = {};\r\n this._vertexAttribArraysEnabled = [];\r\n this._uintIndicesCurrentlySet = false;\r\n this._currentBoundBuffer = new Array();\r\n /** @hidden */\r\n this._currentFramebuffer = null;\r\n this._currentBufferPointers = new Array();\r\n this._currentInstanceLocations = new Array();\r\n this._currentInstanceBuffers = new Array();\r\n this._vaoRecordInProgress = false;\r\n this._mustWipeVertexAttributes = false;\r\n this._nextFreeTextureSlots = new Array();\r\n this._maxSimultaneousTextures = 0;\r\n this._activeRequests = new Array();\r\n // Hardware supported Compressed Textures\r\n this._texturesSupported = new Array();\r\n /**\r\n * Defines whether the engine has been created with the premultipliedAlpha option on or not.\r\n */\r\n this.premultipliedAlpha = true;\r\n /**\r\n * Observable event triggered before each texture is initialized\r\n */\r\n this.onBeforeTextureInitObservable = new Observable();\r\n this._viewportCached = { x: 0, y: 0, z: 0, w: 0 };\r\n this._unpackFlipYCached = null;\r\n /**\r\n * In case you are sharing the context with other applications, it might\r\n * be interested to not cache the unpack flip y state to ensure a consistent\r\n * value would be set.\r\n */\r\n this.enableUnpackFlipYCached = true;\r\n this._boundUniforms = {};\r\n var canvas = null;\r\n if (!canvasOrContext) {\r\n return;\r\n }\r\n options = options || {};\r\n if (canvasOrContext.getContext) {\r\n canvas = canvasOrContext;\r\n this._renderingCanvas = canvas;\r\n if (antialias != null) {\r\n options.antialias = antialias;\r\n }\r\n if (options.deterministicLockstep === undefined) {\r\n options.deterministicLockstep = false;\r\n }\r\n if (options.lockstepMaxSteps === undefined) {\r\n options.lockstepMaxSteps = 4;\r\n }\r\n if (options.preserveDrawingBuffer === undefined) {\r\n options.preserveDrawingBuffer = false;\r\n }\r\n if (options.audioEngine === undefined) {\r\n options.audioEngine = true;\r\n }\r\n if (options.stencil === undefined) {\r\n options.stencil = true;\r\n }\r\n if (options.premultipliedAlpha === false) {\r\n this.premultipliedAlpha = false;\r\n }\r\n this._doNotHandleContextLost = options.doNotHandleContextLost ? true : false;\r\n // Exceptions\r\n if (navigator && navigator.userAgent) {\r\n var ua = navigator.userAgent;\r\n for (var _i = 0, _a = ThinEngine.ExceptionList; _i < _a.length; _i++) {\r\n var exception = _a[_i];\r\n var key = exception.key;\r\n var targets = exception.targets;\r\n var check = new RegExp(key);\r\n if (check.test(ua)) {\r\n if (exception.capture && exception.captureConstraint) {\r\n var capture = exception.capture;\r\n var constraint = exception.captureConstraint;\r\n var regex = new RegExp(capture);\r\n var matches = regex.exec(ua);\r\n if (matches && matches.length > 0) {\r\n var capturedValue = parseInt(matches[matches.length - 1]);\r\n if (capturedValue >= constraint) {\r\n continue;\r\n }\r\n }\r\n }\r\n for (var _b = 0, targets_1 = targets; _b < targets_1.length; _b++) {\r\n var target = targets_1[_b];\r\n switch (target) {\r\n case \"uniformBuffer\":\r\n this.disableUniformBuffers = true;\r\n break;\r\n case \"vao\":\r\n this.disableVertexArrayObjects = true;\r\n break;\r\n }\r\n }\r\n }\r\n }\r\n }\r\n // Context lost\r\n if (!this._doNotHandleContextLost) {\r\n this._onContextLost = function (evt) {\r\n evt.preventDefault();\r\n _this._contextWasLost = true;\r\n Logger.Warn(\"WebGL context lost.\");\r\n _this.onContextLostObservable.notifyObservers(_this);\r\n };\r\n this._onContextRestored = function () {\r\n // Adding a timeout to avoid race condition at browser level\r\n setTimeout(function () {\r\n // Rebuild gl context\r\n _this._initGLContext();\r\n // Rebuild effects\r\n _this._rebuildEffects();\r\n // Rebuild textures\r\n _this._rebuildInternalTextures();\r\n // Rebuild buffers\r\n _this._rebuildBuffers();\r\n // Cache\r\n _this.wipeCaches(true);\r\n Logger.Warn(\"WebGL context successfully restored.\");\r\n _this.onContextRestoredObservable.notifyObservers(_this);\r\n _this._contextWasLost = false;\r\n }, 0);\r\n };\r\n canvas.addEventListener(\"webglcontextlost\", this._onContextLost, false);\r\n canvas.addEventListener(\"webglcontextrestored\", this._onContextRestored, false);\r\n options.powerPreference = \"high-performance\";\r\n }\r\n // GL\r\n if (!options.disableWebGL2Support) {\r\n try {\r\n this._gl = (canvas.getContext(\"webgl2\", options) || canvas.getContext(\"experimental-webgl2\", options));\r\n if (this._gl) {\r\n this._webGLVersion = 2.0;\r\n // Prevent weird browsers to lie :-)\r\n if (!this._gl.deleteQuery) {\r\n this._webGLVersion = 1.0;\r\n }\r\n }\r\n }\r\n catch (e) {\r\n // Do nothing\r\n }\r\n }\r\n if (!this._gl) {\r\n if (!canvas) {\r\n throw new Error(\"The provided canvas is null or undefined.\");\r\n }\r\n try {\r\n this._gl = (canvas.getContext(\"webgl\", options) || canvas.getContext(\"experimental-webgl\", options));\r\n }\r\n catch (e) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n }\r\n if (!this._gl) {\r\n throw new Error(\"WebGL not supported\");\r\n }\r\n }\r\n else {\r\n this._gl = canvasOrContext;\r\n this._renderingCanvas = this._gl.canvas;\r\n if (this._gl.renderbufferStorageMultisample) {\r\n this._webGLVersion = 2.0;\r\n }\r\n var attributes = this._gl.getContextAttributes();\r\n if (attributes) {\r\n options.stencil = attributes.stencil;\r\n }\r\n }\r\n // Ensures a consistent color space unpacking of textures cross browser.\r\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\r\n if (options.useHighPrecisionFloats !== undefined) {\r\n this._highPrecisionShadersAllowed = options.useHighPrecisionFloats;\r\n }\r\n // Viewport\r\n var devicePixelRatio = DomManagement.IsWindowObjectExist() ? (window.devicePixelRatio || 1.0) : 1.0;\r\n var limitDeviceRatio = options.limitDeviceRatio || devicePixelRatio;\r\n this._hardwareScalingLevel = adaptToDeviceRatio ? 1.0 / Math.min(limitDeviceRatio, devicePixelRatio) : 1.0;\r\n this.resize();\r\n this._isStencilEnable = options.stencil ? true : false;\r\n this._initGLContext();\r\n // Prepare buffer pointers\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this._currentBufferPointers[i] = new BufferPointer();\r\n }\r\n // Shader processor\r\n if (this.webGLVersion > 1) {\r\n this._shaderProcessor = new WebGL2ShaderProcessor();\r\n }\r\n // Detect if we are running on a faulty buggy OS.\r\n this._badOS = /iPad/i.test(navigator.userAgent) || /iPhone/i.test(navigator.userAgent);\r\n // Detect if we are running on a faulty buggy desktop OS.\r\n this._badDesktopOS = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);\r\n console.log(\"Babylon.js v\" + ThinEngine.Version + \" - \" + this.description);\r\n }\r\n Object.defineProperty(ThinEngine, \"NpmPackage\", {\r\n /**\r\n * Returns the current npm package of the sdk\r\n */\r\n // Not mixed with Version for tooling purpose.\r\n get: function () {\r\n return \"babylonjs@4.1.0-alpha.24\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine, \"Version\", {\r\n /**\r\n * Returns the current version of the framework\r\n */\r\n get: function () {\r\n return \"4.1.0-alpha.24\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"description\", {\r\n /**\r\n * Returns a string describing the current engine\r\n */\r\n get: function () {\r\n var description = \"WebGL\" + this.webGLVersion;\r\n if (this._caps.parallelShaderCompile) {\r\n description += \" - Parallel shader compilation\";\r\n }\r\n return description;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine, \"ShadersRepository\", {\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n get: function () {\r\n return Effect.ShadersRepository;\r\n },\r\n set: function (value) {\r\n Effect.ShadersRepository = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"supportsUniformBuffers\", {\r\n /**\r\n * Gets a boolean indicating that the engine supports uniform buffers\r\n * @see http://doc.babylonjs.com/features/webgl2#uniform-buffer-objets\r\n */\r\n get: function () {\r\n return this.webGLVersion > 1 && !this.disableUniformBuffers;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"_shouldUseHighPrecisionShader\", {\r\n /** @hidden */\r\n get: function () {\r\n return !!(this._caps.highPrecisionShaderSupported && this._highPrecisionShadersAllowed);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"needPOTTextures\", {\r\n /**\r\n * Gets a boolean indicating that only power of 2 textures are supported\r\n * Please note that you can still use non power of 2 textures but in this case the engine will forcefully convert them\r\n */\r\n get: function () {\r\n return this._webGLVersion < 2 || this.forcePOTTextures;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"doNotHandleContextLost\", {\r\n /**\r\n * Gets or sets a boolean indicating if resources should be retained to be able to handle context lost events\r\n * @see http://doc.babylonjs.com/how_to/optimizing_your_scene#handling-webgl-context-lost\r\n */\r\n get: function () {\r\n return this._doNotHandleContextLost;\r\n },\r\n set: function (value) {\r\n this._doNotHandleContextLost = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"_supportsHardwareTextureRescaling\", {\r\n get: function () {\r\n return false;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"texturesSupported\", {\r\n /**\r\n * Gets the list of texture formats supported\r\n */\r\n get: function () {\r\n return this._texturesSupported;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"textureFormatInUse\", {\r\n /**\r\n * Gets the list of texture formats in use\r\n */\r\n get: function () {\r\n return this._textureFormatInUse;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"currentViewport\", {\r\n /**\r\n * Gets the current viewport\r\n */\r\n get: function () {\r\n return this._cachedViewport;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyTexture\", {\r\n /**\r\n * Gets the default empty texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture) {\r\n this._emptyTexture = this.createRawTexture(new Uint8Array(4), 1, 1, 5, false, false, 1);\r\n }\r\n return this._emptyTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyTexture3D\", {\r\n /**\r\n * Gets the default empty 3D texture\r\n */\r\n get: function () {\r\n if (!this._emptyTexture3D) {\r\n this._emptyTexture3D = this.createRawTexture3D(new Uint8Array(4), 1, 1, 1, 5, false, false, 1);\r\n }\r\n return this._emptyTexture3D;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"emptyCubeTexture\", {\r\n /**\r\n * Gets the default empty cube texture\r\n */\r\n get: function () {\r\n if (!this._emptyCubeTexture) {\r\n var faceData = new Uint8Array(4);\r\n var cubeData = [faceData, faceData, faceData, faceData, faceData, faceData];\r\n this._emptyCubeTexture = this.createRawCubeTexture(cubeData, 1, 5, 0, false, false, 1);\r\n }\r\n return this._emptyCubeTexture;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ThinEngine.prototype._rebuildInternalTextures = function () {\r\n var currentState = this._internalTexturesCache.slice(); // Do a copy because the rebuild will add proxies\r\n for (var _i = 0, currentState_1 = currentState; _i < currentState_1.length; _i++) {\r\n var internalTexture = currentState_1[_i];\r\n internalTexture._rebuild();\r\n }\r\n };\r\n ThinEngine.prototype._rebuildEffects = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n effect._prepareEffect();\r\n }\r\n Effect.ResetCache();\r\n };\r\n /**\r\n * Gets a boolean indicating if all created effects are ready\r\n * @returns true if all effects are ready\r\n */\r\n ThinEngine.prototype.areAllEffectsReady = function () {\r\n for (var key in this._compiledEffects) {\r\n var effect = this._compiledEffects[key];\r\n if (!effect.isReady()) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n };\r\n ThinEngine.prototype._rebuildBuffers = function () {\r\n // Uniforms\r\n for (var _i = 0, _a = this._uniformBuffers; _i < _a.length; _i++) {\r\n var uniformBuffer = _a[_i];\r\n uniformBuffer._rebuild();\r\n }\r\n };\r\n ThinEngine.prototype._initGLContext = function () {\r\n // Caps\r\n this._caps = {\r\n maxTexturesImageUnits: this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),\r\n maxCombinedTexturesImageUnits: this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),\r\n maxVertexTextureImageUnits: this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),\r\n maxTextureSize: this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),\r\n maxCubemapTextureSize: this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),\r\n maxRenderTextureSize: this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),\r\n maxVertexAttribs: this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),\r\n maxVaryingVectors: this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),\r\n maxFragmentUniformVectors: this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),\r\n maxVertexUniformVectors: this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),\r\n parallelShaderCompile: this._gl.getExtension('KHR_parallel_shader_compile'),\r\n standardDerivatives: this._webGLVersion > 1 || (this._gl.getExtension('OES_standard_derivatives') !== null),\r\n maxAnisotropy: 1,\r\n astc: this._gl.getExtension('WEBGL_compressed_texture_astc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_astc'),\r\n s3tc: this._gl.getExtension('WEBGL_compressed_texture_s3tc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_s3tc'),\r\n pvrtc: this._gl.getExtension('WEBGL_compressed_texture_pvrtc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_pvrtc'),\r\n etc1: this._gl.getExtension('WEBGL_compressed_texture_etc1') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc1'),\r\n etc2: this._gl.getExtension('WEBGL_compressed_texture_etc') || this._gl.getExtension('WEBKIT_WEBGL_compressed_texture_etc') ||\r\n this._gl.getExtension('WEBGL_compressed_texture_es3_0'),\r\n textureAnisotropicFilterExtension: this._gl.getExtension('EXT_texture_filter_anisotropic') || this._gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic') || this._gl.getExtension('MOZ_EXT_texture_filter_anisotropic'),\r\n uintIndices: this._webGLVersion > 1 || this._gl.getExtension('OES_element_index_uint') !== null,\r\n fragmentDepthSupported: this._webGLVersion > 1 || this._gl.getExtension('EXT_frag_depth') !== null,\r\n highPrecisionShaderSupported: false,\r\n timerQuery: this._gl.getExtension('EXT_disjoint_timer_query_webgl2') || this._gl.getExtension(\"EXT_disjoint_timer_query\"),\r\n canUseTimestampForTimerQuery: false,\r\n drawBuffersExtension: false,\r\n maxMSAASamples: 1,\r\n colorBufferFloat: this._webGLVersion > 1 && this._gl.getExtension('EXT_color_buffer_float'),\r\n textureFloat: (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_float')) ? true : false,\r\n textureHalfFloat: (this._webGLVersion > 1 || this._gl.getExtension('OES_texture_half_float')) ? true : false,\r\n textureHalfFloatRender: false,\r\n textureFloatLinearFiltering: false,\r\n textureFloatRender: false,\r\n textureHalfFloatLinearFiltering: false,\r\n vertexArrayObject: false,\r\n instancedArrays: false,\r\n textureLOD: (this._webGLVersion > 1 || this._gl.getExtension('EXT_shader_texture_lod')) ? true : false,\r\n blendMinMax: false,\r\n multiview: this._gl.getExtension('OVR_multiview2'),\r\n depthTextureExtension: false\r\n };\r\n // Infos\r\n this._glVersion = this._gl.getParameter(this._gl.VERSION);\r\n var rendererInfo = this._gl.getExtension(\"WEBGL_debug_renderer_info\");\r\n if (rendererInfo != null) {\r\n this._glRenderer = this._gl.getParameter(rendererInfo.UNMASKED_RENDERER_WEBGL);\r\n this._glVendor = this._gl.getParameter(rendererInfo.UNMASKED_VENDOR_WEBGL);\r\n }\r\n if (!this._glVendor) {\r\n this._glVendor = \"Unknown vendor\";\r\n }\r\n if (!this._glRenderer) {\r\n this._glRenderer = \"Unknown renderer\";\r\n }\r\n // Constants\r\n this._gl.HALF_FLOAT_OES = 0x8D61; // Half floating-point type (16-bit).\r\n if (this._gl.RGBA16F !== 0x881A) {\r\n this._gl.RGBA16F = 0x881A; // RGBA 16-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.RGBA32F !== 0x8814) {\r\n this._gl.RGBA32F = 0x8814; // RGBA 32-bit floating-point color-renderable internal sized format.\r\n }\r\n if (this._gl.DEPTH24_STENCIL8 !== 35056) {\r\n this._gl.DEPTH24_STENCIL8 = 35056;\r\n }\r\n // Extensions\r\n if (this._caps.timerQuery) {\r\n if (this._webGLVersion === 1) {\r\n this._gl.getQuery = this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery);\r\n }\r\n this._caps.canUseTimestampForTimerQuery = this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT, this._caps.timerQuery.QUERY_COUNTER_BITS_EXT) > 0;\r\n }\r\n this._caps.maxAnisotropy = this._caps.textureAnisotropicFilterExtension ? this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT) : 0;\r\n this._caps.textureFloatLinearFiltering = this._caps.textureFloat && this._gl.getExtension('OES_texture_float_linear') ? true : false;\r\n this._caps.textureFloatRender = this._caps.textureFloat && this._canRenderToFloatFramebuffer() ? true : false;\r\n this._caps.textureHalfFloatLinearFiltering = (this._webGLVersion > 1 || (this._caps.textureHalfFloat && this._gl.getExtension('OES_texture_half_float_linear'))) ? true : false;\r\n // Checks if some of the format renders first to allow the use of webgl inspector.\r\n if (this._webGLVersion > 1) {\r\n this._gl.HALF_FLOAT_OES = 0x140B;\r\n }\r\n this._caps.textureHalfFloatRender = this._caps.textureHalfFloat && this._canRenderToHalfFloatFramebuffer();\r\n // Draw buffers\r\n if (this._webGLVersion > 1) {\r\n this._caps.drawBuffersExtension = true;\r\n this._caps.maxMSAASamples = this._gl.getParameter(this._gl.MAX_SAMPLES);\r\n }\r\n else {\r\n var drawBuffersExtension = this._gl.getExtension('WEBGL_draw_buffers');\r\n if (drawBuffersExtension !== null) {\r\n this._caps.drawBuffersExtension = true;\r\n this._gl.drawBuffers = drawBuffersExtension.drawBuffersWEBGL.bind(drawBuffersExtension);\r\n this._gl.DRAW_FRAMEBUFFER = this._gl.FRAMEBUFFER;\r\n for (var i = 0; i < 16; i++) {\r\n this._gl[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"] = drawBuffersExtension[\"COLOR_ATTACHMENT\" + i + \"_WEBGL\"];\r\n }\r\n }\r\n }\r\n // Depth Texture\r\n if (this._webGLVersion > 1) {\r\n this._caps.depthTextureExtension = true;\r\n }\r\n else {\r\n var depthTextureExtension = this._gl.getExtension('WEBGL_depth_texture');\r\n if (depthTextureExtension != null) {\r\n this._caps.depthTextureExtension = true;\r\n this._gl.UNSIGNED_INT_24_8 = depthTextureExtension.UNSIGNED_INT_24_8_WEBGL;\r\n }\r\n }\r\n // Vertex array object\r\n if (this.disableVertexArrayObjects) {\r\n this._caps.vertexArrayObject = false;\r\n }\r\n else if (this._webGLVersion > 1) {\r\n this._caps.vertexArrayObject = true;\r\n }\r\n else {\r\n var vertexArrayObjectExtension = this._gl.getExtension('OES_vertex_array_object');\r\n if (vertexArrayObjectExtension != null) {\r\n this._caps.vertexArrayObject = true;\r\n this._gl.createVertexArray = vertexArrayObjectExtension.createVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.bindVertexArray = vertexArrayObjectExtension.bindVertexArrayOES.bind(vertexArrayObjectExtension);\r\n this._gl.deleteVertexArray = vertexArrayObjectExtension.deleteVertexArrayOES.bind(vertexArrayObjectExtension);\r\n }\r\n }\r\n // Instances count\r\n if (this._webGLVersion > 1) {\r\n this._caps.instancedArrays = true;\r\n }\r\n else {\r\n var instanceExtension = this._gl.getExtension('ANGLE_instanced_arrays');\r\n if (instanceExtension != null) {\r\n this._caps.instancedArrays = true;\r\n this._gl.drawArraysInstanced = instanceExtension.drawArraysInstancedANGLE.bind(instanceExtension);\r\n this._gl.drawElementsInstanced = instanceExtension.drawElementsInstancedANGLE.bind(instanceExtension);\r\n this._gl.vertexAttribDivisor = instanceExtension.vertexAttribDivisorANGLE.bind(instanceExtension);\r\n }\r\n else {\r\n this._caps.instancedArrays = false;\r\n }\r\n }\r\n // Intelligently add supported compressed formats in order to check for.\r\n // Check for ASTC support first as it is most powerful and to be very cross platform.\r\n // Next PVRTC & DXT, which are probably superior to ETC1/2.\r\n // Likely no hardware which supports both PVR & DXT, so order matters little.\r\n // ETC2 is newer and handles ETC1 (no alpha capability), so check for first.\r\n if (this._caps.astc) {\r\n this.texturesSupported.push('-astc.ktx');\r\n }\r\n if (this._caps.s3tc) {\r\n this.texturesSupported.push('-dxt.ktx');\r\n }\r\n if (this._caps.pvrtc) {\r\n this.texturesSupported.push('-pvrtc.ktx');\r\n }\r\n if (this._caps.etc2) {\r\n this.texturesSupported.push('-etc2.ktx');\r\n }\r\n if (this._caps.etc1) {\r\n this.texturesSupported.push('-etc1.ktx');\r\n }\r\n if (this._gl.getShaderPrecisionFormat) {\r\n var vertex_highp = this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER, this._gl.HIGH_FLOAT);\r\n var fragment_highp = this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER, this._gl.HIGH_FLOAT);\r\n if (vertex_highp && fragment_highp) {\r\n this._caps.highPrecisionShaderSupported = vertex_highp.precision !== 0 && fragment_highp.precision !== 0;\r\n }\r\n }\r\n if (this._webGLVersion > 1) {\r\n this._caps.blendMinMax = true;\r\n }\r\n else {\r\n var blendMinMaxExtension = this._gl.getExtension('EXT_blend_minmax');\r\n if (blendMinMaxExtension != null) {\r\n this._caps.blendMinMax = true;\r\n this._gl.MAX = blendMinMaxExtension.MAX_EXT;\r\n this._gl.MIN = blendMinMaxExtension.MIN_EXT;\r\n }\r\n }\r\n // Depth buffer\r\n this._depthCullingState.depthTest = true;\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n this._depthCullingState.depthMask = true;\r\n // Texture maps\r\n this._maxSimultaneousTextures = this._caps.maxCombinedTexturesImageUnits;\r\n for (var slot = 0; slot < this._maxSimultaneousTextures; slot++) {\r\n this._nextFreeTextureSlots.push(slot);\r\n }\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"webGLVersion\", {\r\n /**\r\n * Gets version of the current webGL context\r\n */\r\n get: function () {\r\n return this._webGLVersion;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Gets a string idenfifying the name of the class\r\n * @returns \"Engine\" string\r\n */\r\n ThinEngine.prototype.getClassName = function () {\r\n return \"ThinEngine\";\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"isStencilEnable\", {\r\n /**\r\n * Returns true if the stencil buffer has been enabled through the creation option of the context.\r\n */\r\n get: function () {\r\n return this._isStencilEnable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /** @hidden */\r\n ThinEngine.prototype._prepareWorkingCanvas = function () {\r\n if (this._workingCanvas) {\r\n return;\r\n }\r\n this._workingCanvas = CanvasGenerator.CreateCanvas(1, 1);\r\n var context = this._workingCanvas.getContext(\"2d\");\r\n if (context) {\r\n this._workingContext = context;\r\n }\r\n };\r\n /**\r\n * Reset the texture cache to empty state\r\n */\r\n ThinEngine.prototype.resetTextureCache = function () {\r\n for (var key in this._boundTexturesCache) {\r\n if (!this._boundTexturesCache.hasOwnProperty(key)) {\r\n continue;\r\n }\r\n this._boundTexturesCache[key] = null;\r\n }\r\n this._currentTextureChannel = -1;\r\n };\r\n /**\r\n * Gets an object containing information about the current webGL context\r\n * @returns an object containing the vender, the renderer and the version of the current webGL context\r\n */\r\n ThinEngine.prototype.getGlInfo = function () {\r\n return {\r\n vendor: this._glVendor,\r\n renderer: this._glRenderer,\r\n version: this._glVersion\r\n };\r\n };\r\n /**\r\n * Defines the hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @param level defines the level to use\r\n */\r\n ThinEngine.prototype.setHardwareScalingLevel = function (level) {\r\n this._hardwareScalingLevel = level;\r\n this.resize();\r\n };\r\n /**\r\n * Gets the current hardware scaling level.\r\n * By default the hardware scaling level is computed from the window device ratio.\r\n * if level = 1 then the engine will render at the exact resolution of the canvas. If level = 0.5 then the engine will render at twice the size of the canvas.\r\n * @returns a number indicating the current hardware scaling level\r\n */\r\n ThinEngine.prototype.getHardwareScalingLevel = function () {\r\n return this._hardwareScalingLevel;\r\n };\r\n /**\r\n * Gets the list of loaded textures\r\n * @returns an array containing all loaded textures\r\n */\r\n ThinEngine.prototype.getLoadedTexturesCache = function () {\r\n return this._internalTexturesCache;\r\n };\r\n /**\r\n * Gets the object containing all engine capabilities\r\n * @returns the EngineCapabilities object\r\n */\r\n ThinEngine.prototype.getCaps = function () {\r\n return this._caps;\r\n };\r\n /**\r\n * stop executing a render loop function and remove it from the execution array\r\n * @param renderFunction defines the function to be removed. If not provided all functions will be removed.\r\n */\r\n ThinEngine.prototype.stopRenderLoop = function (renderFunction) {\r\n if (!renderFunction) {\r\n this._activeRenderLoops = [];\r\n return;\r\n }\r\n var index = this._activeRenderLoops.indexOf(renderFunction);\r\n if (index >= 0) {\r\n this._activeRenderLoops.splice(index, 1);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._renderLoop = function () {\r\n if (!this._contextWasLost) {\r\n var shouldRender = true;\r\n if (!this.renderEvenInBackground && this._windowIsBackground) {\r\n shouldRender = false;\r\n }\r\n if (shouldRender) {\r\n // Start new frame\r\n this.beginFrame();\r\n for (var index = 0; index < this._activeRenderLoops.length; index++) {\r\n var renderFunction = this._activeRenderLoops[index];\r\n renderFunction();\r\n }\r\n // Present\r\n this.endFrame();\r\n }\r\n }\r\n if (this._activeRenderLoops.length > 0) {\r\n this._frameHandler = this._queueNewFrame(this._bindedRenderFunction, this.getHostWindow());\r\n }\r\n else {\r\n this._renderingQueueLaunched = false;\r\n }\r\n };\r\n /**\r\n * Gets the HTML canvas attached with the current webGL context\r\n * @returns a HTML canvas\r\n */\r\n ThinEngine.prototype.getRenderingCanvas = function () {\r\n return this._renderingCanvas;\r\n };\r\n /**\r\n * Gets host window\r\n * @returns the host window object\r\n */\r\n ThinEngine.prototype.getHostWindow = function () {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n return null;\r\n }\r\n if (this._renderingCanvas && this._renderingCanvas.ownerDocument && this._renderingCanvas.ownerDocument.defaultView) {\r\n return this._renderingCanvas.ownerDocument.defaultView;\r\n }\r\n return window;\r\n };\r\n /**\r\n * Gets the current render width\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render width\r\n */\r\n ThinEngine.prototype.getRenderWidth = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.width;\r\n }\r\n return this._gl.drawingBufferWidth;\r\n };\r\n /**\r\n * Gets the current render height\r\n * @param useScreen defines if screen size must be used (or the current render target if any)\r\n * @returns a number defining the current render height\r\n */\r\n ThinEngine.prototype.getRenderHeight = function (useScreen) {\r\n if (useScreen === void 0) { useScreen = false; }\r\n if (!useScreen && this._currentRenderTarget) {\r\n return this._currentRenderTarget.height;\r\n }\r\n return this._gl.drawingBufferHeight;\r\n };\r\n /**\r\n * Can be used to override the current requestAnimationFrame requester.\r\n * @hidden\r\n */\r\n ThinEngine.prototype._queueNewFrame = function (bindedRenderFunction, requester) {\r\n return ThinEngine.QueueNewFrame(bindedRenderFunction, requester);\r\n };\r\n /**\r\n * Register and execute a render loop. The engine can have more than one render function\r\n * @param renderFunction defines the function to continuously execute\r\n */\r\n ThinEngine.prototype.runRenderLoop = function (renderFunction) {\r\n if (this._activeRenderLoops.indexOf(renderFunction) !== -1) {\r\n return;\r\n }\r\n this._activeRenderLoops.push(renderFunction);\r\n if (!this._renderingQueueLaunched) {\r\n this._renderingQueueLaunched = true;\r\n this._bindedRenderFunction = this._renderLoop.bind(this);\r\n this._frameHandler = this._queueNewFrame(this._bindedRenderFunction, this.getHostWindow());\r\n }\r\n };\r\n /**\r\n * Clear the current render buffer or the current render target (if any is set up)\r\n * @param color defines the color to use\r\n * @param backBuffer defines if the back buffer must be cleared\r\n * @param depth defines if the depth buffer must be cleared\r\n * @param stencil defines if the stencil buffer must be cleared\r\n */\r\n ThinEngine.prototype.clear = function (color, backBuffer, depth, stencil) {\r\n if (stencil === void 0) { stencil = false; }\r\n this.applyStates();\r\n var mode = 0;\r\n if (backBuffer && color) {\r\n this._gl.clearColor(color.r, color.g, color.b, color.a !== undefined ? color.a : 1.0);\r\n mode |= this._gl.COLOR_BUFFER_BIT;\r\n }\r\n if (depth) {\r\n this._gl.clearDepth(1.0);\r\n mode |= this._gl.DEPTH_BUFFER_BIT;\r\n }\r\n if (stencil) {\r\n this._gl.clearStencil(0);\r\n mode |= this._gl.STENCIL_BUFFER_BIT;\r\n }\r\n this._gl.clear(mode);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._viewport = function (x, y, width, height) {\r\n if (x !== this._viewportCached.x ||\r\n y !== this._viewportCached.y ||\r\n width !== this._viewportCached.z ||\r\n height !== this._viewportCached.w) {\r\n this._viewportCached.x = x;\r\n this._viewportCached.y = y;\r\n this._viewportCached.z = width;\r\n this._viewportCached.w = height;\r\n this._gl.viewport(x, y, width, height);\r\n }\r\n };\r\n /**\r\n * Set the WebGL's viewport\r\n * @param viewport defines the viewport element to be used\r\n * @param requiredWidth defines the width required for rendering. If not provided the rendering canvas' width is used\r\n * @param requiredHeight defines the height required for rendering. If not provided the rendering canvas' height is used\r\n */\r\n ThinEngine.prototype.setViewport = function (viewport, requiredWidth, requiredHeight) {\r\n var width = requiredWidth || this.getRenderWidth();\r\n var height = requiredHeight || this.getRenderHeight();\r\n var x = viewport.x || 0;\r\n var y = viewport.y || 0;\r\n this._cachedViewport = viewport;\r\n this._viewport(x * width, y * height, width * viewport.width, height * viewport.height);\r\n };\r\n /**\r\n * Begin a new frame\r\n */\r\n ThinEngine.prototype.beginFrame = function () {\r\n };\r\n /**\r\n * Enf the current frame\r\n */\r\n ThinEngine.prototype.endFrame = function () {\r\n // Force a flush in case we are using a bad OS.\r\n if (this._badOS) {\r\n this.flushFramebuffer();\r\n }\r\n };\r\n /**\r\n * Resize the view according to the canvas' size\r\n */\r\n ThinEngine.prototype.resize = function () {\r\n var width;\r\n var height;\r\n if (DomManagement.IsWindowObjectExist()) {\r\n width = this._renderingCanvas ? this._renderingCanvas.clientWidth : window.innerWidth;\r\n height = this._renderingCanvas ? this._renderingCanvas.clientHeight : window.innerHeight;\r\n }\r\n else {\r\n width = this._renderingCanvas ? this._renderingCanvas.width : 100;\r\n height = this._renderingCanvas ? this._renderingCanvas.height : 100;\r\n }\r\n this.setSize(width / this._hardwareScalingLevel, height / this._hardwareScalingLevel);\r\n };\r\n /**\r\n * Force a specific size of the canvas\r\n * @param width defines the new canvas' width\r\n * @param height defines the new canvas' height\r\n */\r\n ThinEngine.prototype.setSize = function (width, height) {\r\n if (!this._renderingCanvas) {\r\n return;\r\n }\r\n width = width | 0;\r\n height = height | 0;\r\n if (this._renderingCanvas.width === width && this._renderingCanvas.height === height) {\r\n return;\r\n }\r\n this._renderingCanvas.width = width;\r\n this._renderingCanvas.height = height;\r\n };\r\n /**\r\n * Binds the frame buffer to the specified texture.\r\n * @param texture The texture to render to or null for the default canvas\r\n * @param faceIndex The face of the texture to render to in case of cube texture\r\n * @param requiredWidth The width of the target to render to\r\n * @param requiredHeight The height of the target to render to\r\n * @param forceFullscreenViewport Forces the viewport to be the entire texture/screen if true\r\n * @param depthStencilTexture The depth stencil texture to use to render\r\n * @param lodLevel defines le lod level to bind to the frame buffer\r\n */\r\n ThinEngine.prototype.bindFramebuffer = function (texture, faceIndex, requiredWidth, requiredHeight, forceFullscreenViewport, depthStencilTexture, lodLevel) {\r\n if (lodLevel === void 0) { lodLevel = 0; }\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n this._currentRenderTarget = texture;\r\n this._bindUnboundFramebuffer(texture._MSAAFramebuffer ? texture._MSAAFramebuffer : texture._framebuffer);\r\n var gl = this._gl;\r\n if (texture.isCube) {\r\n if (faceIndex === undefined) {\r\n faceIndex = 0;\r\n }\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, lodLevel);\r\n if (depthStencilTexture) {\r\n if (depthStencilTexture._generateStencilBuffer) {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n else {\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, depthStencilTexture._webGLTexture, lodLevel);\r\n }\r\n }\r\n }\r\n if (this._cachedViewport && !forceFullscreenViewport) {\r\n this.setViewport(this._cachedViewport, requiredWidth, requiredHeight);\r\n }\r\n else {\r\n if (!requiredWidth) {\r\n requiredWidth = texture.width;\r\n if (lodLevel) {\r\n requiredWidth = requiredWidth / Math.pow(2, lodLevel);\r\n }\r\n }\r\n if (!requiredHeight) {\r\n requiredHeight = texture.height;\r\n if (lodLevel) {\r\n requiredHeight = requiredHeight / Math.pow(2, lodLevel);\r\n }\r\n }\r\n this._viewport(0, 0, requiredWidth, requiredHeight);\r\n }\r\n this.wipeCaches();\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindUnboundFramebuffer = function (framebuffer) {\r\n if (this._currentFramebuffer !== framebuffer) {\r\n this._gl.bindFramebuffer(this._gl.FRAMEBUFFER, framebuffer);\r\n this._currentFramebuffer = framebuffer;\r\n }\r\n };\r\n /**\r\n * Unbind the current render target texture from the webGL context\r\n * @param texture defines the render target texture to unbind\r\n * @param disableGenerateMipMaps defines a boolean indicating that mipmaps must not be generated\r\n * @param onBeforeUnbind defines a function which will be called before the effective unbind\r\n */\r\n ThinEngine.prototype.unBindFramebuffer = function (texture, disableGenerateMipMaps, onBeforeUnbind) {\r\n if (disableGenerateMipMaps === void 0) { disableGenerateMipMaps = false; }\r\n this._currentRenderTarget = null;\r\n // If MSAA, we need to bitblt back to main texture\r\n var gl = this._gl;\r\n if (texture._MSAAFramebuffer) {\r\n gl.bindFramebuffer(gl.READ_FRAMEBUFFER, texture._MSAAFramebuffer);\r\n gl.bindFramebuffer(gl.DRAW_FRAMEBUFFER, texture._framebuffer);\r\n gl.blitFramebuffer(0, 0, texture.width, texture.height, 0, 0, texture.width, texture.height, gl.COLOR_BUFFER_BIT, gl.NEAREST);\r\n }\r\n if (texture.generateMipMaps && !disableGenerateMipMaps && !texture.isCube) {\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n }\r\n if (onBeforeUnbind) {\r\n if (texture._MSAAFramebuffer) {\r\n // Bind the correct framebuffer\r\n this._bindUnboundFramebuffer(texture._framebuffer);\r\n }\r\n onBeforeUnbind();\r\n }\r\n this._bindUnboundFramebuffer(null);\r\n };\r\n /**\r\n * Force a webGL flush (ie. a flush of all waiting webGL commands)\r\n */\r\n ThinEngine.prototype.flushFramebuffer = function () {\r\n this._gl.flush();\r\n };\r\n /**\r\n * Unbind the current render target and bind the default framebuffer\r\n */\r\n ThinEngine.prototype.restoreDefaultFramebuffer = function () {\r\n if (this._currentRenderTarget) {\r\n this.unBindFramebuffer(this._currentRenderTarget);\r\n }\r\n else {\r\n this._bindUnboundFramebuffer(null);\r\n }\r\n if (this._cachedViewport) {\r\n this.setViewport(this._cachedViewport);\r\n }\r\n this.wipeCaches();\r\n };\r\n // VBOs\r\n /** @hidden */\r\n ThinEngine.prototype._resetVertexBufferBinding = function () {\r\n this.bindArrayBuffer(null);\r\n this._cachedVertexBuffers = null;\r\n };\r\n /**\r\n * Creates a vertex buffer\r\n * @param data the data for the vertex buffer\r\n * @returns the new WebGL static buffer\r\n */\r\n ThinEngine.prototype.createVertexBuffer = function (data) {\r\n return this._createVertexBuffer(data, this._gl.STATIC_DRAW);\r\n };\r\n ThinEngine.prototype._createVertexBuffer = function (data, usage) {\r\n var vbo = this._gl.createBuffer();\r\n if (!vbo) {\r\n throw new Error(\"Unable to create vertex buffer\");\r\n }\r\n var dataBuffer = new WebGLDataBuffer(vbo);\r\n this.bindArrayBuffer(dataBuffer);\r\n if (data instanceof Array) {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, new Float32Array(data), this._gl.STATIC_DRAW);\r\n }\r\n else {\r\n this._gl.bufferData(this._gl.ARRAY_BUFFER, data, this._gl.STATIC_DRAW);\r\n }\r\n this._resetVertexBufferBinding();\r\n dataBuffer.references = 1;\r\n return dataBuffer;\r\n };\r\n /**\r\n * Creates a dynamic vertex buffer\r\n * @param data the data for the dynamic vertex buffer\r\n * @returns the new WebGL dynamic buffer\r\n */\r\n ThinEngine.prototype.createDynamicVertexBuffer = function (data) {\r\n return this._createVertexBuffer(data, this._gl.DYNAMIC_DRAW);\r\n };\r\n ThinEngine.prototype._resetIndexBufferBinding = function () {\r\n this.bindIndexBuffer(null);\r\n this._cachedIndexBuffer = null;\r\n };\r\n /**\r\n * Creates a new index buffer\r\n * @param indices defines the content of the index buffer\r\n * @param updatable defines if the index buffer must be updatable\r\n * @returns a new webGL buffer\r\n */\r\n ThinEngine.prototype.createIndexBuffer = function (indices, updatable) {\r\n var vbo = this._gl.createBuffer();\r\n var dataBuffer = new WebGLDataBuffer(vbo);\r\n if (!vbo) {\r\n throw new Error(\"Unable to create index buffer\");\r\n }\r\n this.bindIndexBuffer(dataBuffer);\r\n var data = this._normalizeIndexData(indices);\r\n this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER, data, updatable ? this._gl.DYNAMIC_DRAW : this._gl.STATIC_DRAW);\r\n this._resetIndexBufferBinding();\r\n dataBuffer.references = 1;\r\n dataBuffer.is32Bits = (data.BYTES_PER_ELEMENT === 4);\r\n return dataBuffer;\r\n };\r\n ThinEngine.prototype._normalizeIndexData = function (indices) {\r\n if (indices instanceof Uint16Array) {\r\n return indices;\r\n }\r\n // Check 32 bit support\r\n if (this._caps.uintIndices) {\r\n if (indices instanceof Uint32Array) {\r\n return indices;\r\n }\r\n else {\r\n // number[] or Int32Array, check if 32 bit is necessary\r\n for (var index = 0; index < indices.length; index++) {\r\n if (indices[index] >= 65535) {\r\n return new Uint32Array(indices);\r\n }\r\n }\r\n return new Uint16Array(indices);\r\n }\r\n }\r\n // No 32 bit support, force conversion to 16 bit (values greater 16 bit are lost)\r\n return new Uint16Array(indices);\r\n };\r\n /**\r\n * Bind a webGL buffer to the webGL context\r\n * @param buffer defines the buffer to bind\r\n */\r\n ThinEngine.prototype.bindArrayBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ARRAY_BUFFER);\r\n };\r\n /**\r\n * Bind a specific block at a given index in a specific shader program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param blockName defines the block name\r\n * @param index defines the index where to bind the block\r\n */\r\n ThinEngine.prototype.bindUniformBlock = function (pipelineContext, blockName, index) {\r\n var program = pipelineContext.program;\r\n var uniformLocation = this._gl.getUniformBlockIndex(program, blockName);\r\n this._gl.uniformBlockBinding(program, uniformLocation, index);\r\n };\r\n ThinEngine.prototype.bindIndexBuffer = function (buffer) {\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.bindBuffer(buffer, this._gl.ELEMENT_ARRAY_BUFFER);\r\n };\r\n ThinEngine.prototype.bindBuffer = function (buffer, target) {\r\n if (this._vaoRecordInProgress || this._currentBoundBuffer[target] !== buffer) {\r\n this._gl.bindBuffer(target, buffer ? buffer.underlyingResource : null);\r\n this._currentBoundBuffer[target] = buffer;\r\n }\r\n };\r\n /**\r\n * update the bound buffer with the given data\r\n * @param data defines the data to update\r\n */\r\n ThinEngine.prototype.updateArrayBuffer = function (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n };\r\n ThinEngine.prototype._vertexAttribPointer = function (buffer, indx, size, type, normalized, stride, offset) {\r\n var pointer = this._currentBufferPointers[indx];\r\n var changed = false;\r\n if (!pointer.active) {\r\n changed = true;\r\n pointer.active = true;\r\n pointer.index = indx;\r\n pointer.size = size;\r\n pointer.type = type;\r\n pointer.normalized = normalized;\r\n pointer.stride = stride;\r\n pointer.offset = offset;\r\n pointer.buffer = buffer;\r\n }\r\n else {\r\n if (pointer.buffer !== buffer) {\r\n pointer.buffer = buffer;\r\n changed = true;\r\n }\r\n if (pointer.size !== size) {\r\n pointer.size = size;\r\n changed = true;\r\n }\r\n if (pointer.type !== type) {\r\n pointer.type = type;\r\n changed = true;\r\n }\r\n if (pointer.normalized !== normalized) {\r\n pointer.normalized = normalized;\r\n changed = true;\r\n }\r\n if (pointer.stride !== stride) {\r\n pointer.stride = stride;\r\n changed = true;\r\n }\r\n if (pointer.offset !== offset) {\r\n pointer.offset = offset;\r\n changed = true;\r\n }\r\n }\r\n if (changed || this._vaoRecordInProgress) {\r\n this.bindArrayBuffer(buffer);\r\n this._gl.vertexAttribPointer(indx, size, type, normalized, stride, offset);\r\n }\r\n };\r\n ThinEngine.prototype._bindIndexBufferWithCache = function (indexBuffer) {\r\n if (indexBuffer == null) {\r\n return;\r\n }\r\n if (this._cachedIndexBuffer !== indexBuffer) {\r\n this._cachedIndexBuffer = indexBuffer;\r\n this.bindIndexBuffer(indexBuffer);\r\n this._uintIndicesCurrentlySet = indexBuffer.is32Bits;\r\n }\r\n };\r\n ThinEngine.prototype._bindVertexBuffersAttributes = function (vertexBuffers, effect) {\r\n var attributes = effect.getAttributesNames();\r\n if (!this._vaoRecordInProgress) {\r\n this._unbindVertexArrayObject();\r\n }\r\n this.unbindAllAttributes();\r\n for (var index = 0; index < attributes.length; index++) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n var vertexBuffer = vertexBuffers[attributes[index]];\r\n if (!vertexBuffer) {\r\n continue;\r\n }\r\n this._gl.enableVertexAttribArray(order);\r\n if (!this._vaoRecordInProgress) {\r\n this._vertexAttribArraysEnabled[order] = true;\r\n }\r\n var buffer = vertexBuffer.getBuffer();\r\n if (buffer) {\r\n this._vertexAttribPointer(buffer, order, vertexBuffer.getSize(), vertexBuffer.type, vertexBuffer.normalized, vertexBuffer.byteStride, vertexBuffer.byteOffset);\r\n if (vertexBuffer.getIsInstanced()) {\r\n this._gl.vertexAttribDivisor(order, vertexBuffer.getInstanceDivisor());\r\n if (!this._vaoRecordInProgress) {\r\n this._currentInstanceLocations.push(order);\r\n this._currentInstanceBuffers.push(buffer);\r\n }\r\n }\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Records a vertex array object\r\n * @see http://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexBuffers defines the list of vertex buffers to store\r\n * @param indexBuffer defines the index buffer to store\r\n * @param effect defines the effect to store\r\n * @returns the new vertex array object\r\n */\r\n ThinEngine.prototype.recordVertexArrayObject = function (vertexBuffers, indexBuffer, effect) {\r\n var vao = this._gl.createVertexArray();\r\n this._vaoRecordInProgress = true;\r\n this._gl.bindVertexArray(vao);\r\n this._mustWipeVertexAttributes = true;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n this.bindIndexBuffer(indexBuffer);\r\n this._vaoRecordInProgress = false;\r\n this._gl.bindVertexArray(null);\r\n return vao;\r\n };\r\n /**\r\n * Bind a specific vertex array object\r\n * @see http://doc.babylonjs.com/features/webgl2#vertex-array-objects\r\n * @param vertexArrayObject defines the vertex array object to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n */\r\n ThinEngine.prototype.bindVertexArrayObject = function (vertexArrayObject, indexBuffer) {\r\n if (this._cachedVertexArrayObject !== vertexArrayObject) {\r\n this._cachedVertexArrayObject = vertexArrayObject;\r\n this._gl.bindVertexArray(vertexArrayObject);\r\n this._cachedVertexBuffers = null;\r\n this._cachedIndexBuffer = null;\r\n this._uintIndicesCurrentlySet = indexBuffer != null && indexBuffer.is32Bits;\r\n this._mustWipeVertexAttributes = true;\r\n }\r\n };\r\n /**\r\n * Bind webGl buffers directly to the webGL context\r\n * @param vertexBuffer defines the vertex buffer to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param vertexDeclaration defines the vertex declaration to use with the vertex buffer\r\n * @param vertexStrideSize defines the vertex stride of the vertex buffer\r\n * @param effect defines the effect associated with the vertex buffer\r\n */\r\n ThinEngine.prototype.bindBuffersDirectly = function (vertexBuffer, indexBuffer, vertexDeclaration, vertexStrideSize, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffer || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffer;\r\n this._cachedEffectForVertexBuffers = effect;\r\n var attributesCount = effect.getAttributesCount();\r\n this._unbindVertexArrayObject();\r\n this.unbindAllAttributes();\r\n var offset = 0;\r\n for (var index = 0; index < attributesCount; index++) {\r\n if (index < vertexDeclaration.length) {\r\n var order = effect.getAttributeLocation(index);\r\n if (order >= 0) {\r\n this._gl.enableVertexAttribArray(order);\r\n this._vertexAttribArraysEnabled[order] = true;\r\n this._vertexAttribPointer(vertexBuffer, order, vertexDeclaration[index], this._gl.FLOAT, false, vertexStrideSize, offset);\r\n }\r\n offset += vertexDeclaration[index] * 4;\r\n }\r\n }\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n ThinEngine.prototype._unbindVertexArrayObject = function () {\r\n if (!this._cachedVertexArrayObject) {\r\n return;\r\n }\r\n this._cachedVertexArrayObject = null;\r\n this._gl.bindVertexArray(null);\r\n };\r\n /**\r\n * Bind a list of vertex buffers to the webGL context\r\n * @param vertexBuffers defines the list of vertex buffers to bind\r\n * @param indexBuffer defines the index buffer to bind\r\n * @param effect defines the effect associated with the vertex buffers\r\n */\r\n ThinEngine.prototype.bindBuffers = function (vertexBuffers, indexBuffer, effect) {\r\n if (this._cachedVertexBuffers !== vertexBuffers || this._cachedEffectForVertexBuffers !== effect) {\r\n this._cachedVertexBuffers = vertexBuffers;\r\n this._cachedEffectForVertexBuffers = effect;\r\n this._bindVertexBuffersAttributes(vertexBuffers, effect);\r\n }\r\n this._bindIndexBufferWithCache(indexBuffer);\r\n };\r\n /**\r\n * Unbind all instance attributes\r\n */\r\n ThinEngine.prototype.unbindInstanceAttributes = function () {\r\n var boundBuffer;\r\n for (var i = 0, ul = this._currentInstanceLocations.length; i < ul; i++) {\r\n var instancesBuffer = this._currentInstanceBuffers[i];\r\n if (boundBuffer != instancesBuffer && instancesBuffer.references) {\r\n boundBuffer = instancesBuffer;\r\n this.bindArrayBuffer(instancesBuffer);\r\n }\r\n var offsetLocation = this._currentInstanceLocations[i];\r\n this._gl.vertexAttribDivisor(offsetLocation, 0);\r\n }\r\n this._currentInstanceBuffers.length = 0;\r\n this._currentInstanceLocations.length = 0;\r\n };\r\n /**\r\n * Release and free the memory of a vertex array object\r\n * @param vao defines the vertex array object to delete\r\n */\r\n ThinEngine.prototype.releaseVertexArrayObject = function (vao) {\r\n this._gl.deleteVertexArray(vao);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseBuffer = function (buffer) {\r\n buffer.references--;\r\n if (buffer.references === 0) {\r\n this._deleteBuffer(buffer);\r\n return true;\r\n }\r\n return false;\r\n };\r\n ThinEngine.prototype._deleteBuffer = function (buffer) {\r\n this._gl.deleteBuffer(buffer.underlyingResource);\r\n };\r\n /**\r\n * Update the content of a webGL buffer used with instanciation and bind it to the webGL context\r\n * @param instancesBuffer defines the webGL buffer to update and bind\r\n * @param data defines the data to store in the buffer\r\n * @param offsetLocations defines the offsets or attributes information used to determine where data must be stored in the buffer\r\n */\r\n ThinEngine.prototype.updateAndBindInstancesBuffer = function (instancesBuffer, data, offsetLocations) {\r\n this.bindArrayBuffer(instancesBuffer);\r\n if (data) {\r\n this._gl.bufferSubData(this._gl.ARRAY_BUFFER, 0, data);\r\n }\r\n if (offsetLocations[0].index !== undefined) {\r\n var stride = 0;\r\n for (var i = 0; i < offsetLocations.length; i++) {\r\n var ai = offsetLocations[i];\r\n stride += ai.attributeSize * 4;\r\n }\r\n for (var i = 0; i < offsetLocations.length; i++) {\r\n var ai = offsetLocations[i];\r\n if (!this._vertexAttribArraysEnabled[ai.index]) {\r\n this._gl.enableVertexAttribArray(ai.index);\r\n this._vertexAttribArraysEnabled[ai.index] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, ai.index, ai.attributeSize, ai.attributeType || this._gl.FLOAT, ai.normalized || false, stride, ai.offset);\r\n this._gl.vertexAttribDivisor(ai.index, 1);\r\n this._currentInstanceLocations.push(ai.index);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n }\r\n else {\r\n for (var index = 0; index < 4; index++) {\r\n var offsetLocation = offsetLocations[index];\r\n if (!this._vertexAttribArraysEnabled[offsetLocation]) {\r\n this._gl.enableVertexAttribArray(offsetLocation);\r\n this._vertexAttribArraysEnabled[offsetLocation] = true;\r\n }\r\n this._vertexAttribPointer(instancesBuffer, offsetLocation, 4, this._gl.FLOAT, false, 64, index * 16);\r\n this._gl.vertexAttribDivisor(offsetLocation, 1);\r\n this._currentInstanceLocations.push(offsetLocation);\r\n this._currentInstanceBuffers.push(instancesBuffer);\r\n }\r\n }\r\n };\r\n /**\r\n * Apply all cached states (depth, culling, stencil and alpha)\r\n */\r\n ThinEngine.prototype.applyStates = function () {\r\n this._depthCullingState.apply(this._gl);\r\n this._stencilState.apply(this._gl);\r\n this._alphaState.apply(this._gl);\r\n };\r\n /**\r\n * Send a draw order\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.draw = function (useTriangles, indexStart, indexCount, instancesCount) {\r\n this.drawElementsType(useTriangles ? 0 : 1, indexStart, indexCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of points\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawPointClouds = function (verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(2, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param useTriangles defines if triangles must be used to draw (else wireframe will be used)\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawUnIndexed = function (useTriangles, verticesStart, verticesCount, instancesCount) {\r\n this.drawArraysType(useTriangles ? 0 : 1, verticesStart, verticesCount, instancesCount);\r\n };\r\n /**\r\n * Draw a list of indexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param indexStart defines the starting index\r\n * @param indexCount defines the number of index to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawElementsType = function (fillMode, indexStart, indexCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._reportDrawCall();\r\n // Render\r\n var drawMode = this._drawMode(fillMode);\r\n var indexFormat = this._uintIndicesCurrentlySet ? this._gl.UNSIGNED_INT : this._gl.UNSIGNED_SHORT;\r\n var mult = this._uintIndicesCurrentlySet ? 4 : 2;\r\n if (instancesCount) {\r\n this._gl.drawElementsInstanced(drawMode, indexCount, indexFormat, indexStart * mult, instancesCount);\r\n }\r\n else {\r\n this._gl.drawElements(drawMode, indexCount, indexFormat, indexStart * mult);\r\n }\r\n };\r\n /**\r\n * Draw a list of unindexed primitives\r\n * @param fillMode defines the primitive to use\r\n * @param verticesStart defines the index of first vertex to draw\r\n * @param verticesCount defines the count of vertices to draw\r\n * @param instancesCount defines the number of instances to draw (if instanciation is enabled)\r\n */\r\n ThinEngine.prototype.drawArraysType = function (fillMode, verticesStart, verticesCount, instancesCount) {\r\n // Apply states\r\n this.applyStates();\r\n this._reportDrawCall();\r\n var drawMode = this._drawMode(fillMode);\r\n if (instancesCount) {\r\n this._gl.drawArraysInstanced(drawMode, verticesStart, verticesCount, instancesCount);\r\n }\r\n else {\r\n this._gl.drawArrays(drawMode, verticesStart, verticesCount);\r\n }\r\n };\r\n ThinEngine.prototype._drawMode = function (fillMode) {\r\n switch (fillMode) {\r\n // Triangle views\r\n case 0:\r\n return this._gl.TRIANGLES;\r\n case 2:\r\n return this._gl.POINTS;\r\n case 1:\r\n return this._gl.LINES;\r\n // Draw modes\r\n case 3:\r\n return this._gl.POINTS;\r\n case 4:\r\n return this._gl.LINES;\r\n case 5:\r\n return this._gl.LINE_LOOP;\r\n case 6:\r\n return this._gl.LINE_STRIP;\r\n case 7:\r\n return this._gl.TRIANGLE_STRIP;\r\n case 8:\r\n return this._gl.TRIANGLE_FAN;\r\n default:\r\n return this._gl.TRIANGLES;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._reportDrawCall = function () {\r\n // Will be implemented by children\r\n };\r\n // Shaders\r\n /** @hidden */\r\n ThinEngine.prototype._releaseEffect = function (effect) {\r\n if (this._compiledEffects[effect._key]) {\r\n delete this._compiledEffects[effect._key];\r\n this._deletePipelineContext(effect.getPipelineContext());\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._deletePipelineContext = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (webGLPipelineContext && webGLPipelineContext.program) {\r\n webGLPipelineContext.program.__SPECTOR_rebuildProgram = null;\r\n this._gl.deleteProgram(webGLPipelineContext.program);\r\n }\r\n };\r\n /**\r\n * Create a new effect (used to store vertex/fragment shaders)\r\n * @param baseName defines the base name of the effect (The name of file without .fragment.fx or .vertex.fx)\r\n * @param attributesNamesOrOptions defines either a list of attribute names or an IEffectCreationOptions object\r\n * @param uniformsNamesOrEngine defines either a list of uniform names or the engine to use\r\n * @param samplers defines an array of string used to represent textures\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param fallbacks defines the list of potential fallbacks to use if shader conmpilation fails\r\n * @param onCompiled defines a function to call when the effect creation is successful\r\n * @param onError defines a function to call when the effect creation has failed\r\n * @param indexParameters defines an object containing the index values to use to compile shaders (like the maximum number of simultaneous lights)\r\n * @returns the new Effect\r\n */\r\n ThinEngine.prototype.createEffect = function (baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName;\r\n var name = vertex + \"+\" + fragment + \"@\" + (defines ? defines : attributesNamesOrOptions.defines);\r\n if (this._compiledEffects[name]) {\r\n var compiledEffect = this._compiledEffects[name];\r\n if (onCompiled && compiledEffect.isReady()) {\r\n onCompiled(compiledEffect);\r\n }\r\n return compiledEffect;\r\n }\r\n var effect = new Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, this, defines, fallbacks, onCompiled, onError, indexParameters);\r\n effect._key = name;\r\n this._compiledEffects[name] = effect;\r\n return effect;\r\n };\r\n ThinEngine._ConcatenateShader = function (source, defines, shaderVersion) {\r\n if (shaderVersion === void 0) { shaderVersion = \"\"; }\r\n return shaderVersion + (defines ? defines + \"\\n\" : \"\") + source;\r\n };\r\n ThinEngine.prototype._compileShader = function (source, type, defines, shaderVersion) {\r\n return this._compileRawShader(ThinEngine._ConcatenateShader(source, defines, shaderVersion), type);\r\n };\r\n ThinEngine.prototype._compileRawShader = function (source, type) {\r\n var gl = this._gl;\r\n var shader = gl.createShader(type === \"vertex\" ? gl.VERTEX_SHADER : gl.FRAGMENT_SHADER);\r\n if (!shader) {\r\n throw new Error(\"Something went wrong while compile the shader.\");\r\n }\r\n gl.shaderSource(shader, source);\r\n gl.compileShader(shader);\r\n return shader;\r\n };\r\n /**\r\n * Directly creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n ThinEngine.prototype.createRawShaderProgram = function (pipelineContext, vertexCode, fragmentCode, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n var vertexShader = this._compileRawShader(vertexCode, \"vertex\");\r\n var fragmentShader = this._compileRawShader(fragmentCode, \"fragment\");\r\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n };\r\n /**\r\n * Creates a webGL program\r\n * @param pipelineContext defines the pipeline context to attach to\r\n * @param vertexCode defines the vertex shader code to use\r\n * @param fragmentCode defines the fragment shader code to use\r\n * @param defines defines the string containing the defines to use to compile the shaders\r\n * @param context defines the webGL context to use (if not set, the current one will be used)\r\n * @param transformFeedbackVaryings defines the list of transform feedback varyings to use\r\n * @returns the new webGL program\r\n */\r\n ThinEngine.prototype.createShaderProgram = function (pipelineContext, vertexCode, fragmentCode, defines, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n context = context || this._gl;\r\n var shaderVersion = (this._webGLVersion > 1) ? \"#version 300 es\\n#define WEBGL2 \\n\" : \"\";\r\n var vertexShader = this._compileShader(vertexCode, \"vertex\", defines, shaderVersion);\r\n var fragmentShader = this._compileShader(fragmentCode, \"fragment\", defines, shaderVersion);\r\n return this._createShaderProgram(pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings);\r\n };\r\n /**\r\n * Creates a new pipeline context\r\n * @returns the new pipeline\r\n */\r\n ThinEngine.prototype.createPipelineContext = function () {\r\n var pipelineContext = new WebGLPipelineContext();\r\n pipelineContext.engine = this;\r\n if (this._caps.parallelShaderCompile) {\r\n pipelineContext.isParallelCompiled = true;\r\n }\r\n return pipelineContext;\r\n };\r\n ThinEngine.prototype._createShaderProgram = function (pipelineContext, vertexShader, fragmentShader, context, transformFeedbackVaryings) {\r\n if (transformFeedbackVaryings === void 0) { transformFeedbackVaryings = null; }\r\n var shaderProgram = context.createProgram();\r\n pipelineContext.program = shaderProgram;\r\n if (!shaderProgram) {\r\n throw new Error(\"Unable to create program\");\r\n }\r\n context.attachShader(shaderProgram, vertexShader);\r\n context.attachShader(shaderProgram, fragmentShader);\r\n context.linkProgram(shaderProgram);\r\n pipelineContext.context = context;\r\n pipelineContext.vertexShader = vertexShader;\r\n pipelineContext.fragmentShader = fragmentShader;\r\n if (!pipelineContext.isParallelCompiled) {\r\n this._finalizePipelineContext(pipelineContext);\r\n }\r\n return shaderProgram;\r\n };\r\n ThinEngine.prototype._finalizePipelineContext = function (pipelineContext) {\r\n var context = pipelineContext.context;\r\n var vertexShader = pipelineContext.vertexShader;\r\n var fragmentShader = pipelineContext.fragmentShader;\r\n var program = pipelineContext.program;\r\n var linked = context.getProgramParameter(program, context.LINK_STATUS);\r\n if (!linked) { // Get more info\r\n // Vertex\r\n if (!this._gl.getShaderParameter(vertexShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(vertexShader);\r\n if (log) {\r\n throw new Error(\"VERTEX SHADER \" + log);\r\n }\r\n }\r\n // Fragment\r\n if (!this._gl.getShaderParameter(fragmentShader, this._gl.COMPILE_STATUS)) {\r\n var log = this._gl.getShaderInfoLog(fragmentShader);\r\n if (log) {\r\n throw new Error(\"FRAGMENT SHADER \" + log);\r\n }\r\n }\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n throw new Error(error);\r\n }\r\n }\r\n if (this.validateShaderPrograms) {\r\n context.validateProgram(program);\r\n var validated = context.getProgramParameter(program, context.VALIDATE_STATUS);\r\n if (!validated) {\r\n var error = context.getProgramInfoLog(program);\r\n if (error) {\r\n throw new Error(error);\r\n }\r\n }\r\n }\r\n context.deleteShader(vertexShader);\r\n context.deleteShader(fragmentShader);\r\n pipelineContext.vertexShader = undefined;\r\n pipelineContext.fragmentShader = undefined;\r\n if (pipelineContext.onCompiled) {\r\n pipelineContext.onCompiled();\r\n pipelineContext.onCompiled = undefined;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._preparePipelineContext = function (pipelineContext, vertexSourceCode, fragmentSourceCode, createAsRaw, rebuildRebind, defines, transformFeedbackVaryings) {\r\n var webGLRenderingState = pipelineContext;\r\n if (createAsRaw) {\r\n webGLRenderingState.program = this.createRawShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, undefined, transformFeedbackVaryings);\r\n }\r\n else {\r\n webGLRenderingState.program = this.createShaderProgram(webGLRenderingState, vertexSourceCode, fragmentSourceCode, defines, undefined, transformFeedbackVaryings);\r\n }\r\n webGLRenderingState.program.__SPECTOR_rebuildProgram = rebuildRebind;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._isRenderingStateCompiled = function (pipelineContext) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (this._gl.getProgramParameter(webGLPipelineContext.program, this._caps.parallelShaderCompile.COMPLETION_STATUS_KHR)) {\r\n this._finalizePipelineContext(webGLPipelineContext);\r\n return true;\r\n }\r\n return false;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._executeWhenRenderingStateIsCompiled = function (pipelineContext, action) {\r\n var webGLPipelineContext = pipelineContext;\r\n if (!webGLPipelineContext.isParallelCompiled) {\r\n action();\r\n return;\r\n }\r\n webGLPipelineContext.onCompiled = action;\r\n };\r\n /**\r\n * Gets the list of webGL uniform locations associated with a specific program based on a list of uniform names\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param uniformsNames defines the list of uniform names\r\n * @returns an array of webGL uniform locations\r\n */\r\n ThinEngine.prototype.getUniforms = function (pipelineContext, uniformsNames) {\r\n var results = new Array();\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < uniformsNames.length; index++) {\r\n results.push(this._gl.getUniformLocation(webGLPipelineContext.program, uniformsNames[index]));\r\n }\r\n return results;\r\n };\r\n /**\r\n * Gets the lsit of active attributes for a given webGL program\r\n * @param pipelineContext defines the pipeline context to use\r\n * @param attributesNames defines the list of attribute names to get\r\n * @returns an array of indices indicating the offset of each attribute\r\n */\r\n ThinEngine.prototype.getAttributes = function (pipelineContext, attributesNames) {\r\n var results = [];\r\n var webGLPipelineContext = pipelineContext;\r\n for (var index = 0; index < attributesNames.length; index++) {\r\n try {\r\n results.push(this._gl.getAttribLocation(webGLPipelineContext.program, attributesNames[index]));\r\n }\r\n catch (e) {\r\n results.push(-1);\r\n }\r\n }\r\n return results;\r\n };\r\n /**\r\n * Activates an effect, mkaing it the current one (ie. the one used for rendering)\r\n * @param effect defines the effect to activate\r\n */\r\n ThinEngine.prototype.enableEffect = function (effect) {\r\n if (!effect || effect === this._currentEffect) {\r\n return;\r\n }\r\n // Use program\r\n this.bindSamplers(effect);\r\n this._currentEffect = effect;\r\n if (effect.onBind) {\r\n effect.onBind(effect);\r\n }\r\n if (effect._onBindObservable) {\r\n effect._onBindObservable.notifyObservers(effect);\r\n }\r\n };\r\n /**\r\n * Set the value of an uniform to a number (int)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the int number to store\r\n */\r\n ThinEngine.prototype.setInt = function (uniform, value) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, value);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n ThinEngine.prototype.setIntArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n ThinEngine.prototype.setIntArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform2iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n ThinEngine.prototype.setIntArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform3iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of int32 (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of int32 to store\r\n */\r\n ThinEngine.prototype.setIntArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform4iv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n ThinEngine.prototype.setArray = function (uniform, array) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n ThinEngine.prototype.setArray2 = function (uniform, array) {\r\n if (!uniform || array.length % 2 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform2fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n ThinEngine.prototype.setArray3 = function (uniform, array) {\r\n if (!uniform || array.length % 3 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform3fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of number (stored as vec4)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param array defines the array of number to store\r\n */\r\n ThinEngine.prototype.setArray4 = function (uniform, array) {\r\n if (!uniform || array.length % 4 !== 0) {\r\n return;\r\n }\r\n this._gl.uniform4fv(uniform, array);\r\n };\r\n /**\r\n * Set the value of an uniform to an array of float32 (stored as matrices)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrices defines the array of float32 to store\r\n */\r\n ThinEngine.prototype.setMatrices = function (uniform, matrices) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix4fv(uniform, false, matrices);\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (3x3)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 3x3 matrix to store\r\n */\r\n ThinEngine.prototype.setMatrix3x3 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix3fv(uniform, false, matrix);\r\n };\r\n /**\r\n * Set the value of an uniform to a matrix (2x2)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param matrix defines the Float32Array representing the 2x2 matrix to store\r\n */\r\n ThinEngine.prototype.setMatrix2x2 = function (uniform, matrix) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniformMatrix2fv(uniform, false, matrix);\r\n };\r\n /**\r\n * Set the value of an uniform to a number (float)\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param value defines the float number to store\r\n */\r\n ThinEngine.prototype.setFloat = function (uniform, value) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform1f(uniform, value);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec2\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n */\r\n ThinEngine.prototype.setFloat2 = function (uniform, x, y) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform2f(uniform, x, y);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec3\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n */\r\n ThinEngine.prototype.setFloat3 = function (uniform, x, y, z) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform3f(uniform, x, y, z);\r\n };\r\n /**\r\n * Set the value of an uniform to a vec4\r\n * @param uniform defines the webGL uniform location where to store the value\r\n * @param x defines the 1st component of the value\r\n * @param y defines the 2nd component of the value\r\n * @param z defines the 3rd component of the value\r\n * @param w defines the 4th component of the value\r\n */\r\n ThinEngine.prototype.setFloat4 = function (uniform, x, y, z, w) {\r\n if (!uniform) {\r\n return;\r\n }\r\n this._gl.uniform4f(uniform, x, y, z, w);\r\n };\r\n Object.defineProperty(ThinEngine.prototype, \"depthCullingState\", {\r\n // States\r\n /**\r\n * Gets the depth culling state manager\r\n */\r\n get: function () {\r\n return this._depthCullingState;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"alphaState\", {\r\n /**\r\n * Gets the alpha state manager\r\n */\r\n get: function () {\r\n return this._alphaState;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ThinEngine.prototype, \"stencilState\", {\r\n /**\r\n * Gets the stencil state manager\r\n */\r\n get: function () {\r\n return this._stencilState;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n // Textures\r\n /**\r\n * Clears the list of texture accessible through engine.\r\n * This can help preventing texture load conflict due to name collision.\r\n */\r\n ThinEngine.prototype.clearInternalTexturesCache = function () {\r\n this._internalTexturesCache = [];\r\n };\r\n /**\r\n * Force the entire cache to be cleared\r\n * You should not have to use this function unless your engine needs to share the webGL context with another engine\r\n * @param bruteForce defines a boolean to force clearing ALL caches (including stencil, detoh and alpha states)\r\n */\r\n ThinEngine.prototype.wipeCaches = function (bruteForce) {\r\n if (this.preventCacheWipeBetweenFrames && !bruteForce) {\r\n return;\r\n }\r\n this._currentEffect = null;\r\n this._viewportCached.x = 0;\r\n this._viewportCached.y = 0;\r\n this._viewportCached.z = 0;\r\n this._viewportCached.w = 0;\r\n if (bruteForce) {\r\n this.resetTextureCache();\r\n this._currentProgram = null;\r\n this._stencilState.reset();\r\n this._depthCullingState.reset();\r\n this._depthCullingState.depthFunc = this._gl.LEQUAL;\r\n this._alphaState.reset();\r\n this._unpackFlipYCached = null;\r\n this._gl.pixelStorei(this._gl.UNPACK_COLORSPACE_CONVERSION_WEBGL, this._gl.NONE);\r\n this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL, 0);\r\n }\r\n this._resetVertexBufferBinding();\r\n this._cachedIndexBuffer = null;\r\n this._cachedEffectForVertexBuffers = null;\r\n this._unbindVertexArrayObject();\r\n this.bindIndexBuffer(null);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getSamplingParameters = function (samplingMode, generateMipMaps) {\r\n var gl = this._gl;\r\n var magFilter = gl.NEAREST;\r\n var minFilter = gl.NEAREST;\r\n switch (samplingMode) {\r\n case 2:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 3:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 1:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 4:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 5:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 6:\r\n magFilter = gl.NEAREST;\r\n if (generateMipMaps) {\r\n minFilter = gl.LINEAR_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.LINEAR;\r\n }\r\n break;\r\n case 7:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case 8:\r\n magFilter = gl.NEAREST;\r\n minFilter = gl.NEAREST;\r\n break;\r\n case 9:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_NEAREST;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 10:\r\n magFilter = gl.LINEAR;\r\n if (generateMipMaps) {\r\n minFilter = gl.NEAREST_MIPMAP_LINEAR;\r\n }\r\n else {\r\n minFilter = gl.NEAREST;\r\n }\r\n break;\r\n case 11:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.LINEAR;\r\n break;\r\n case 12:\r\n magFilter = gl.LINEAR;\r\n minFilter = gl.NEAREST;\r\n break;\r\n }\r\n return {\r\n min: minFilter,\r\n mag: magFilter\r\n };\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._createTexture = function () {\r\n var texture = this._gl.createTexture();\r\n if (!texture) {\r\n throw new Error(\"Unable to create texture\");\r\n }\r\n return texture;\r\n };\r\n /**\r\n * Usually called from Texture.ts.\r\n * Passed information to create a WebGLTexture\r\n * @param urlArg defines a value which contains one of the following:\r\n * * A conventional http URL, e.g. 'http://...' or 'file://...'\r\n * * A base64 string of in-line texture data, e.g. 'data:image/jpg;base64,/...'\r\n * * An indicator that data being passed using the buffer parameter, e.g. 'data:mytexture.jpg'\r\n * @param noMipmap defines a boolean indicating that no mipmaps shall be generated. Ignored for compressed textures. They must be in the file\r\n * @param invertY when true, image is flipped when loaded. You probably want true. Certain compressed textures may invert this if their default is inverted (eg. ktx)\r\n * @param scene needed for loading to the correct scene\r\n * @param samplingMode mode with should be used sample / access the texture (Default: Texture.TRILINEAR_SAMPLINGMODE)\r\n * @param onLoad optional callback to be called upon successful completion\r\n * @param onError optional callback to be called upon failure\r\n * @param buffer a source of a file previously fetched as either a base64 string, an ArrayBuffer (compressed or image format), HTMLImageElement (image format), or a Blob\r\n * @param fallback an internal argument in case the function must be called again, due to etc1 not having alpha capabilities\r\n * @param format internal format. Default: RGB when extension is '.jpg' else RGBA. Ignored for compressed textures\r\n * @param forcedExtension defines the extension to use to pick the right loader\r\n * @param excludeLoaders array of texture loaders that should be excluded when picking a loader for the texture (default: empty array)\r\n * @param mimeType defines an optional mime type\r\n * @returns a InternalTexture for assignment back into BABYLON.Texture\r\n */\r\n ThinEngine.prototype.createTexture = function (urlArg, noMipmap, invertY, scene, samplingMode, onLoad, onError, buffer, fallback, format, forcedExtension, excludeLoaders, mimeType) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n if (onLoad === void 0) { onLoad = null; }\r\n if (onError === void 0) { onError = null; }\r\n if (buffer === void 0) { buffer = null; }\r\n if (fallback === void 0) { fallback = null; }\r\n if (format === void 0) { format = null; }\r\n if (forcedExtension === void 0) { forcedExtension = null; }\r\n if (excludeLoaders === void 0) { excludeLoaders = []; }\r\n var url = String(urlArg); // assign a new string, so that the original is still available in case of fallback\r\n var fromData = url.substr(0, 5) === \"data:\";\r\n var fromBlob = url.substr(0, 5) === \"blob:\";\r\n var isBase64 = fromData && url.indexOf(\";base64,\") !== -1;\r\n var texture = fallback ? fallback : new InternalTexture(this, InternalTextureSource.Url);\r\n // establish the file extension, if possible\r\n var lastDot = url.lastIndexOf('.');\r\n var extension = forcedExtension ? forcedExtension : (lastDot > -1 ? url.substring(lastDot).toLowerCase() : \"\");\r\n var loader = null;\r\n for (var _i = 0, _a = ThinEngine._TextureLoaders; _i < _a.length; _i++) {\r\n var availableLoader = _a[_i];\r\n if (excludeLoaders.indexOf(availableLoader) === -1 && availableLoader.canLoad(extension, this._textureFormatInUse, fallback, isBase64, buffer ? true : false)) {\r\n loader = availableLoader;\r\n break;\r\n }\r\n }\r\n if (loader) {\r\n url = loader.transformUrl(url, this._textureFormatInUse);\r\n }\r\n if (scene) {\r\n scene._addPendingData(texture);\r\n }\r\n texture.url = url;\r\n texture.generateMipMaps = !noMipmap;\r\n texture.samplingMode = samplingMode;\r\n texture.invertY = invertY;\r\n if (!this._doNotHandleContextLost) {\r\n // Keep a link to the buffer only if we plan to handle context lost\r\n texture._buffer = buffer;\r\n }\r\n var onLoadObserver = null;\r\n if (onLoad && !fallback) {\r\n onLoadObserver = texture.onLoadedObservable.add(onLoad);\r\n }\r\n if (!fallback) {\r\n this._internalTexturesCache.push(texture);\r\n }\r\n var onInternalError = function (message, exception) {\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n var customFallback = false;\r\n if (loader) {\r\n var fallbackUrl = loader.getFallbackTextureUrl(url, _this._textureFormatInUse);\r\n if (fallbackUrl) {\r\n // Add Back\r\n customFallback = true;\r\n excludeLoaders.push(loader);\r\n _this.createTexture(urlArg, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture, undefined, undefined, excludeLoaders);\r\n return;\r\n }\r\n }\r\n if (!customFallback) {\r\n if (onLoadObserver) {\r\n texture.onLoadedObservable.remove(onLoadObserver);\r\n }\r\n if (EngineStore.UseFallbackTexture) {\r\n _this.createTexture(EngineStore.FallbackTexture, noMipmap, texture.invertY, scene, samplingMode, null, onError, buffer, texture);\r\n return;\r\n }\r\n }\r\n if (onError) {\r\n onError(message || \"Unknown error\", exception);\r\n }\r\n };\r\n // processing for non-image formats\r\n if (loader) {\r\n var callback = function (data) {\r\n loader.loadData(data, texture, function (width, height, loadMipmap, isCompressed, done, loadFailed) {\r\n if (loadFailed) {\r\n onInternalError(\"TextureLoader failed to load data\");\r\n }\r\n else {\r\n _this._prepareWebGLTexture(texture, scene, width, height, texture.invertY, !loadMipmap, isCompressed, function () {\r\n done();\r\n return false;\r\n }, samplingMode);\r\n }\r\n });\r\n };\r\n if (!buffer) {\r\n this._loadFile(url, callback, undefined, scene ? scene.offlineProvider : undefined, true, function (request, exception) {\r\n onInternalError(\"Unable to load \" + (request ? request.responseURL : url, exception));\r\n });\r\n }\r\n else {\r\n //callback(buffer as ArrayBuffer);\r\n if (buffer instanceof ArrayBuffer) {\r\n callback(buffer);\r\n }\r\n else {\r\n if (onError) {\r\n onError(\"Unable to load: only ArrayBuffer supported here\", null);\r\n }\r\n }\r\n }\r\n }\r\n else {\r\n var onload = function (img) {\r\n if (fromBlob && !_this._doNotHandleContextLost) {\r\n // We need to store the image if we need to rebuild the texture\r\n // in case of a webgl context lost\r\n texture._buffer = img;\r\n }\r\n _this._prepareWebGLTexture(texture, scene, img.width, img.height, texture.invertY, noMipmap, false, function (potWidth, potHeight, continuationCallback) {\r\n var gl = _this._gl;\r\n var isPot = (img.width === potWidth && img.height === potHeight);\r\n var internalFormat = format ? _this._getInternalFormat(format) : ((extension === \".jpg\") ? gl.RGB : gl.RGBA);\r\n if (isPot) {\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n return false;\r\n }\r\n var maxTextureSize = _this._caps.maxTextureSize;\r\n if (img.width > maxTextureSize || img.height > maxTextureSize || !_this._supportsHardwareTextureRescaling) {\r\n _this._prepareWorkingCanvas();\r\n if (!_this._workingCanvas || !_this._workingContext) {\r\n return false;\r\n }\r\n _this._workingCanvas.width = potWidth;\r\n _this._workingCanvas.height = potHeight;\r\n _this._workingContext.drawImage(img, 0, 0, img.width, img.height, 0, 0, potWidth, potHeight);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, _this._workingCanvas);\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n return false;\r\n }\r\n else {\r\n // Using shaders when possible to rescale because canvas.drawImage is lossy\r\n var source_1 = new InternalTexture(_this, InternalTextureSource.Temp);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, source_1, true);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, internalFormat, internalFormat, gl.UNSIGNED_BYTE, img);\r\n _this._rescaleTexture(source_1, texture, scene, internalFormat, function () {\r\n _this._releaseTexture(source_1);\r\n _this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n continuationCallback();\r\n });\r\n }\r\n return true;\r\n }, samplingMode);\r\n };\r\n if (!fromData || isBase64) {\r\n if (buffer && (buffer.decoding || buffer.close)) {\r\n onload(buffer);\r\n }\r\n else {\r\n FileTools.LoadImage(url, onload, onInternalError, scene ? scene.offlineProvider : null, mimeType);\r\n }\r\n }\r\n else if (typeof buffer === \"string\" || buffer instanceof ArrayBuffer || ArrayBuffer.isView(buffer) || buffer instanceof Blob) {\r\n FileTools.LoadImage(buffer, onload, onInternalError, scene ? scene.offlineProvider : null, mimeType);\r\n }\r\n else if (buffer) {\r\n onload(buffer);\r\n }\r\n }\r\n return texture;\r\n };\r\n /**\r\n * @hidden\r\n */\r\n ThinEngine.prototype._rescaleTexture = function (source, destination, scene, internalFormat, onComplete) {\r\n };\r\n /**\r\n * Creates a raw texture\r\n * @param data defines the data to store in the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param format defines the format of the data\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (Texture.NEAREST_SAMPLINGMODE by default)\r\n * @param compression defines the compression used (null by default)\r\n * @param type defines the type fo the data (Engine.TEXTURETYPE_UNSIGNED_INT by default)\r\n * @returns the raw texture inside an InternalTexture\r\n */\r\n ThinEngine.prototype.createRawTexture = function (data, width, height, format, generateMipMaps, invertY, samplingMode, compression, type) {\r\n if (compression === void 0) { compression = null; }\r\n if (type === void 0) { type = 0; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw cube texture\r\n * @param data defines the array of data to use to create each face\r\n * @param size defines the size of the textures\r\n * @param format defines the format of the data\r\n * @param type defines the type of the data (like Engine.TEXTURETYPE_UNSIGNED_INT)\r\n * @param generateMipMaps defines if the engine should generate the mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compression used (null by default)\r\n * @returns the cube texture as an InternalTexture\r\n */\r\n ThinEngine.prototype.createRawCubeTexture = function (data, size, format, type, generateMipMaps, invertY, samplingMode, compression) {\r\n if (compression === void 0) { compression = null; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /**\r\n * Creates a new raw 3D texture\r\n * @param data defines the data used to create the texture\r\n * @param width defines the width of the texture\r\n * @param height defines the height of the texture\r\n * @param depth defines the depth of the texture\r\n * @param format defines the format of the texture\r\n * @param generateMipMaps defines if the engine must generate mip levels\r\n * @param invertY defines if data must be stored with Y axis inverted\r\n * @param samplingMode defines the required sampling mode (like Texture.NEAREST_SAMPLINGMODE)\r\n * @param compression defines the compressed used (can be null)\r\n * @param textureType defines the compressed used (can be null)\r\n * @returns a new raw 3D texture (stored in an InternalTexture)\r\n */\r\n ThinEngine.prototype.createRawTexture3D = function (data, width, height, depth, format, generateMipMaps, invertY, samplingMode, compression, textureType) {\r\n if (compression === void 0) { compression = null; }\r\n if (textureType === void 0) { textureType = 0; }\r\n throw _DevTools.WarnImport(\"Engine.RawTexture\");\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._unpackFlipY = function (value) {\r\n if (this._unpackFlipYCached !== value) {\r\n this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);\r\n if (this.enableUnpackFlipYCached) {\r\n this._unpackFlipYCached = value;\r\n }\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getUnpackAlignement = function () {\r\n return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT);\r\n };\r\n /**\r\n * Update the sampling mode of a given texture\r\n * @param samplingMode defines the required sampling mode\r\n * @param texture defines the texture to update\r\n */\r\n ThinEngine.prototype.updateTextureSamplingMode = function (samplingMode, texture) {\r\n var filters = this._getSamplingParameters(samplingMode, texture.generateMipMaps);\r\n if (texture.isCube) {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n }\r\n else if (texture.is3D) {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n else {\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_MAG_FILTER, filters.mag, texture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_MIN_FILTER, filters.min);\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n }\r\n texture.samplingMode = samplingMode;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setupDepthStencilTexture = function (internalTexture, size, generateStencil, bilinearFiltering, comparisonFunction) {\r\n var width = size.width || size;\r\n var height = size.height || size;\r\n internalTexture.baseWidth = width;\r\n internalTexture.baseHeight = height;\r\n internalTexture.width = width;\r\n internalTexture.height = height;\r\n internalTexture.isReady = true;\r\n internalTexture.samples = 1;\r\n internalTexture.generateMipMaps = false;\r\n internalTexture._generateDepthBuffer = true;\r\n internalTexture._generateStencilBuffer = generateStencil;\r\n internalTexture.samplingMode = bilinearFiltering ? 2 : 1;\r\n internalTexture.type = 0;\r\n internalTexture._comparisonFunction = comparisonFunction;\r\n var gl = this._gl;\r\n var target = internalTexture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n var samplingParameters = this._getSamplingParameters(internalTexture.samplingMode, false);\r\n gl.texParameteri(target, gl.TEXTURE_MAG_FILTER, samplingParameters.mag);\r\n gl.texParameteri(target, gl.TEXTURE_MIN_FILTER, samplingParameters.min);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_S, gl.CLAMP_TO_EDGE);\r\n gl.texParameteri(target, gl.TEXTURE_WRAP_T, gl.CLAMP_TO_EDGE);\r\n if (comparisonFunction === 0) {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, 515);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.NONE);\r\n }\r\n else {\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_FUNC, comparisonFunction);\r\n gl.texParameteri(target, gl.TEXTURE_COMPARE_MODE, gl.COMPARE_REF_TO_TEXTURE);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadCompressedDataToTextureDirectly = function (texture, internalFormat, width, height, data, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n this._gl.compressedTexImage2D(target, lod, internalFormat, width, height, 0, data);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadDataToTextureDirectly = function (texture, imageData, faceIndex, lod, babylonInternalFormat, useTextureWidthAndHeight) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n if (useTextureWidthAndHeight === void 0) { useTextureWidthAndHeight = false; }\r\n var gl = this._gl;\r\n var textureType = this._getWebGLTextureType(texture.type);\r\n var format = this._getInternalFormat(texture.format);\r\n var internalFormat = babylonInternalFormat === undefined ? this._getRGBABufferInternalSizedFormat(texture.type, format) : this._getInternalFormat(babylonInternalFormat);\r\n this._unpackFlipY(texture.invertY);\r\n var target = gl.TEXTURE_2D;\r\n if (texture.isCube) {\r\n target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;\r\n }\r\n var lodMaxWidth = Math.round(Math.log(texture.width) * Math.LOG2E);\r\n var lodMaxHeight = Math.round(Math.log(texture.height) * Math.LOG2E);\r\n var width = useTextureWidthAndHeight ? texture.width : Math.pow(2, Math.max(lodMaxWidth - lod, 0));\r\n var height = useTextureWidthAndHeight ? texture.height : Math.pow(2, Math.max(lodMaxHeight - lod, 0));\r\n gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._uploadArrayBufferViewToTexture = function (texture, imageData, faceIndex, lod) {\r\n if (faceIndex === void 0) { faceIndex = 0; }\r\n if (lod === void 0) { lod = 0; }\r\n var gl = this._gl;\r\n var bindTarget = texture.isCube ? gl.TEXTURE_CUBE_MAP : gl.TEXTURE_2D;\r\n this._bindTextureDirectly(bindTarget, texture, true);\r\n this._uploadDataToTextureDirectly(texture, imageData, faceIndex, lod);\r\n this._bindTextureDirectly(bindTarget, null, true);\r\n };\r\n ThinEngine.prototype._prepareWebGLTextureContinuation = function (texture, scene, noMipmap, isCompressed, samplingMode) {\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n var filters = this._getSamplingParameters(samplingMode, !noMipmap);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, filters.mag);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, filters.min);\r\n if (!noMipmap && !isCompressed) {\r\n gl.generateMipmap(gl.TEXTURE_2D);\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, null);\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n texture.onLoadedObservable.notifyObservers(texture);\r\n texture.onLoadedObservable.clear();\r\n };\r\n ThinEngine.prototype._prepareWebGLTexture = function (texture, scene, width, height, invertY, noMipmap, isCompressed, processFunction, samplingMode) {\r\n var _this = this;\r\n if (samplingMode === void 0) { samplingMode = 3; }\r\n var maxTextureSize = this.getCaps().maxTextureSize;\r\n var potWidth = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(width, maxTextureSize) : width);\r\n var potHeight = Math.min(maxTextureSize, this.needPOTTextures ? ThinEngine.GetExponentOfTwo(height, maxTextureSize) : height);\r\n var gl = this._gl;\r\n if (!gl) {\r\n return;\r\n }\r\n if (!texture._webGLTexture) {\r\n // this.resetTextureCache();\r\n if (scene) {\r\n scene._removePendingData(texture);\r\n }\r\n return;\r\n }\r\n this._bindTextureDirectly(gl.TEXTURE_2D, texture, true);\r\n this._unpackFlipY(invertY === undefined ? true : (invertY ? true : false));\r\n texture.baseWidth = width;\r\n texture.baseHeight = height;\r\n texture.width = potWidth;\r\n texture.height = potHeight;\r\n texture.isReady = true;\r\n if (processFunction(potWidth, potHeight, function () {\r\n _this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n })) {\r\n // Returning as texture needs extra async steps\r\n return;\r\n }\r\n this._prepareWebGLTextureContinuation(texture, scene, noMipmap, isCompressed, samplingMode);\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setupFramebufferDepthAttachments = function (generateStencilBuffer, generateDepthBuffer, width, height, samples) {\r\n if (samples === void 0) { samples = 1; }\r\n var depthStencilBuffer = null;\r\n var gl = this._gl;\r\n // Create the depth/stencil buffer\r\n if (generateStencilBuffer) {\r\n depthStencilBuffer = gl.createRenderbuffer();\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);\r\n if (samples > 1) {\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH24_STENCIL8, width, height);\r\n }\r\n else {\r\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_STENCIL, width, height);\r\n }\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_STENCIL_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);\r\n }\r\n else if (generateDepthBuffer) {\r\n depthStencilBuffer = gl.createRenderbuffer();\r\n gl.bindRenderbuffer(gl.RENDERBUFFER, depthStencilBuffer);\r\n if (samples > 1) {\r\n gl.renderbufferStorageMultisample(gl.RENDERBUFFER, samples, gl.DEPTH_COMPONENT16, width, height);\r\n }\r\n else {\r\n gl.renderbufferStorage(gl.RENDERBUFFER, gl.DEPTH_COMPONENT16, width, height);\r\n }\r\n gl.framebufferRenderbuffer(gl.FRAMEBUFFER, gl.DEPTH_ATTACHMENT, gl.RENDERBUFFER, depthStencilBuffer);\r\n }\r\n return depthStencilBuffer;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseFramebufferObjects = function (texture) {\r\n var gl = this._gl;\r\n if (texture._framebuffer) {\r\n gl.deleteFramebuffer(texture._framebuffer);\r\n texture._framebuffer = null;\r\n }\r\n if (texture._depthStencilBuffer) {\r\n gl.deleteRenderbuffer(texture._depthStencilBuffer);\r\n texture._depthStencilBuffer = null;\r\n }\r\n if (texture._MSAAFramebuffer) {\r\n gl.deleteFramebuffer(texture._MSAAFramebuffer);\r\n texture._MSAAFramebuffer = null;\r\n }\r\n if (texture._MSAARenderBuffer) {\r\n gl.deleteRenderbuffer(texture._MSAARenderBuffer);\r\n texture._MSAARenderBuffer = null;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._releaseTexture = function (texture) {\r\n this._releaseFramebufferObjects(texture);\r\n this._deleteTexture(texture._webGLTexture);\r\n // Unbind channels\r\n this.unbindAllTextures();\r\n var index = this._internalTexturesCache.indexOf(texture);\r\n if (index !== -1) {\r\n this._internalTexturesCache.splice(index, 1);\r\n }\r\n // Integrated fixed lod samplers.\r\n if (texture._lodTextureHigh) {\r\n texture._lodTextureHigh.dispose();\r\n }\r\n if (texture._lodTextureMid) {\r\n texture._lodTextureMid.dispose();\r\n }\r\n if (texture._lodTextureLow) {\r\n texture._lodTextureLow.dispose();\r\n }\r\n // Integrated irradiance map.\r\n if (texture._irradianceTexture) {\r\n texture._irradianceTexture.dispose();\r\n }\r\n };\r\n ThinEngine.prototype._deleteTexture = function (texture) {\r\n this._gl.deleteTexture(texture);\r\n };\r\n ThinEngine.prototype._setProgram = function (program) {\r\n if (this._currentProgram !== program) {\r\n this._gl.useProgram(program);\r\n this._currentProgram = program;\r\n }\r\n };\r\n /**\r\n * Binds an effect to the webGL context\r\n * @param effect defines the effect to bind\r\n */\r\n ThinEngine.prototype.bindSamplers = function (effect) {\r\n var webGLPipelineContext = effect.getPipelineContext();\r\n this._setProgram(webGLPipelineContext.program);\r\n var samplers = effect.getSamplers();\r\n for (var index = 0; index < samplers.length; index++) {\r\n var uniform = effect.getUniform(samplers[index]);\r\n if (uniform) {\r\n this._boundUniforms[index] = uniform;\r\n }\r\n }\r\n this._currentEffect = null;\r\n };\r\n ThinEngine.prototype._activateCurrentTexture = function () {\r\n if (this._currentTextureChannel !== this._activeChannel) {\r\n this._gl.activeTexture(this._gl.TEXTURE0 + this._activeChannel);\r\n this._currentTextureChannel = this._activeChannel;\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindTextureDirectly = function (target, texture, forTextureDataUpdate, force) {\r\n if (forTextureDataUpdate === void 0) { forTextureDataUpdate = false; }\r\n if (force === void 0) { force = false; }\r\n var wasPreviouslyBound = false;\r\n var isTextureForRendering = texture && texture._associatedChannel > -1;\r\n if (forTextureDataUpdate && isTextureForRendering) {\r\n this._activeChannel = texture._associatedChannel;\r\n }\r\n var currentTextureBound = this._boundTexturesCache[this._activeChannel];\r\n if (currentTextureBound !== texture || force) {\r\n this._activateCurrentTexture();\r\n if (texture && texture.isMultiview) {\r\n this._gl.bindTexture(target, texture ? texture._colorTextureArray : null);\r\n }\r\n else {\r\n this._gl.bindTexture(target, texture ? texture._webGLTexture : null);\r\n }\r\n this._boundTexturesCache[this._activeChannel] = texture;\r\n if (texture) {\r\n texture._associatedChannel = this._activeChannel;\r\n }\r\n }\r\n else if (forTextureDataUpdate) {\r\n wasPreviouslyBound = true;\r\n this._activateCurrentTexture();\r\n }\r\n if (isTextureForRendering && !forTextureDataUpdate) {\r\n this._bindSamplerUniformToChannel(texture._associatedChannel, this._activeChannel);\r\n }\r\n return wasPreviouslyBound;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._bindTexture = function (channel, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (texture) {\r\n texture._associatedChannel = channel;\r\n }\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);\r\n };\r\n /**\r\n * Unbind all textures from the webGL context\r\n */\r\n ThinEngine.prototype.unbindAllTextures = function () {\r\n for (var channel = 0; channel < this._maxSimultaneousTextures; channel++) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n }\r\n };\r\n /**\r\n * Sets a texture to the according uniform.\r\n * @param channel The texture channel\r\n * @param uniform The uniform to set\r\n * @param texture The texture to apply\r\n */\r\n ThinEngine.prototype.setTexture = function (channel, uniform, texture) {\r\n if (channel === undefined) {\r\n return;\r\n }\r\n if (uniform) {\r\n this._boundUniforms[channel] = uniform;\r\n }\r\n this._setTexture(channel, texture);\r\n };\r\n ThinEngine.prototype._bindSamplerUniformToChannel = function (sourceSlot, destination) {\r\n var uniform = this._boundUniforms[sourceSlot];\r\n if (!uniform || uniform._currentState === destination) {\r\n return;\r\n }\r\n this._gl.uniform1i(uniform, destination);\r\n uniform._currentState = destination;\r\n };\r\n ThinEngine.prototype._getTextureWrapMode = function (mode) {\r\n switch (mode) {\r\n case 1:\r\n return this._gl.REPEAT;\r\n case 0:\r\n return this._gl.CLAMP_TO_EDGE;\r\n case 2:\r\n return this._gl.MIRRORED_REPEAT;\r\n }\r\n return this._gl.REPEAT;\r\n };\r\n ThinEngine.prototype._setTexture = function (channel, texture, isPartOfTextureArray, depthStencilTexture) {\r\n if (isPartOfTextureArray === void 0) { isPartOfTextureArray = false; }\r\n if (depthStencilTexture === void 0) { depthStencilTexture = false; }\r\n // Not ready?\r\n if (!texture) {\r\n if (this._boundTexturesCache[channel] != null) {\r\n this._activeChannel = channel;\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, null);\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, null);\r\n if (this.webGLVersion > 1) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, null);\r\n }\r\n }\r\n return false;\r\n }\r\n // Video\r\n if (texture.video) {\r\n this._activeChannel = channel;\r\n texture.update();\r\n }\r\n else if (texture.delayLoadState === 4) { // Delay loading\r\n texture.delayLoad();\r\n return false;\r\n }\r\n var internalTexture;\r\n if (depthStencilTexture) {\r\n internalTexture = texture.depthStencilTexture;\r\n }\r\n else if (texture.isReady()) {\r\n internalTexture = texture.getInternalTexture();\r\n }\r\n else if (texture.isCube) {\r\n internalTexture = this.emptyCubeTexture;\r\n }\r\n else if (texture.is3D) {\r\n internalTexture = this.emptyTexture3D;\r\n }\r\n else {\r\n internalTexture = this.emptyTexture;\r\n }\r\n if (!isPartOfTextureArray && internalTexture) {\r\n internalTexture._associatedChannel = channel;\r\n }\r\n var needToBind = true;\r\n if (this._boundTexturesCache[channel] === internalTexture) {\r\n if (!isPartOfTextureArray) {\r\n this._bindSamplerUniformToChannel(internalTexture._associatedChannel, channel);\r\n }\r\n needToBind = false;\r\n }\r\n this._activeChannel = channel;\r\n if (internalTexture && internalTexture.isMultiview) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D_ARRAY, internalTexture, isPartOfTextureArray);\r\n }\r\n }\r\n else if (internalTexture && internalTexture.is3D) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_3D, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {\r\n internalTexture._cachedWrapU = texture.wrapU;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapV !== texture.wrapV) {\r\n internalTexture._cachedWrapV = texture.wrapV;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapR !== texture.wrapR) {\r\n internalTexture._cachedWrapR = texture.wrapR;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_3D, this._gl.TEXTURE_WRAP_R, this._getTextureWrapMode(texture.wrapR), internalTexture);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_3D, texture);\r\n }\r\n else if (internalTexture && internalTexture.isCube) {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture._cachedCoordinatesMode !== texture.coordinatesMode) {\r\n internalTexture._cachedCoordinatesMode = texture.coordinatesMode;\r\n // CUBIC_MODE and SKYBOX_MODE both require CLAMP_TO_EDGE. All other modes use REPEAT.\r\n var textureWrapMode = (texture.coordinatesMode !== 3 && texture.coordinatesMode !== 5) ? this._gl.REPEAT : this._gl.CLAMP_TO_EDGE;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_S, textureWrapMode, internalTexture);\r\n this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP, this._gl.TEXTURE_WRAP_T, textureWrapMode);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP, texture);\r\n }\r\n else {\r\n if (needToBind) {\r\n this._bindTextureDirectly(this._gl.TEXTURE_2D, internalTexture, isPartOfTextureArray);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapU !== texture.wrapU) {\r\n internalTexture._cachedWrapU = texture.wrapU;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_S, this._getTextureWrapMode(texture.wrapU), internalTexture);\r\n }\r\n if (internalTexture && internalTexture._cachedWrapV !== texture.wrapV) {\r\n internalTexture._cachedWrapV = texture.wrapV;\r\n this._setTextureParameterInteger(this._gl.TEXTURE_2D, this._gl.TEXTURE_WRAP_T, this._getTextureWrapMode(texture.wrapV), internalTexture);\r\n }\r\n this._setAnisotropicLevel(this._gl.TEXTURE_2D, texture);\r\n }\r\n return true;\r\n };\r\n /**\r\n * Sets an array of texture to the webGL context\r\n * @param channel defines the channel where the texture array must be set\r\n * @param uniform defines the associated uniform location\r\n * @param textures defines the array of textures to bind\r\n */\r\n ThinEngine.prototype.setTextureArray = function (channel, uniform, textures) {\r\n if (channel === undefined || !uniform) {\r\n return;\r\n }\r\n if (!this._textureUnits || this._textureUnits.length !== textures.length) {\r\n this._textureUnits = new Int32Array(textures.length);\r\n }\r\n for (var i = 0; i < textures.length; i++) {\r\n var texture = textures[i].getInternalTexture();\r\n if (texture) {\r\n this._textureUnits[i] = channel + i;\r\n texture._associatedChannel = channel + i;\r\n }\r\n else {\r\n this._textureUnits[i] = -1;\r\n }\r\n }\r\n this._gl.uniform1iv(uniform, this._textureUnits);\r\n for (var index = 0; index < textures.length; index++) {\r\n this._setTexture(this._textureUnits[index], textures[index], true);\r\n }\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._setAnisotropicLevel = function (target, texture) {\r\n var internalTexture = texture.getInternalTexture();\r\n if (!internalTexture) {\r\n return;\r\n }\r\n var anisotropicFilterExtension = this._caps.textureAnisotropicFilterExtension;\r\n var value = texture.anisotropicFilteringLevel;\r\n if (internalTexture.samplingMode !== 2\r\n && internalTexture.samplingMode !== 3\r\n && internalTexture.samplingMode !== 11) {\r\n value = 1; // Forcing the anisotropic to 1 because else webgl will force filters to linear\r\n }\r\n if (anisotropicFilterExtension && internalTexture._cachedAnisotropicFilteringLevel !== value) {\r\n this._setTextureParameterFloat(target, anisotropicFilterExtension.TEXTURE_MAX_ANISOTROPY_EXT, Math.min(value, this._caps.maxAnisotropy), internalTexture);\r\n internalTexture._cachedAnisotropicFilteringLevel = value;\r\n }\r\n };\r\n ThinEngine.prototype._setTextureParameterFloat = function (target, parameter, value, texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n this._gl.texParameterf(target, parameter, value);\r\n };\r\n ThinEngine.prototype._setTextureParameterInteger = function (target, parameter, value, texture) {\r\n if (texture) {\r\n this._bindTextureDirectly(target, texture, true, true);\r\n }\r\n this._gl.texParameteri(target, parameter, value);\r\n };\r\n /**\r\n * Unbind all vertex attributes from the webGL context\r\n */\r\n ThinEngine.prototype.unbindAllAttributes = function () {\r\n if (this._mustWipeVertexAttributes) {\r\n this._mustWipeVertexAttributes = false;\r\n for (var i = 0; i < this._caps.maxVertexAttribs; i++) {\r\n this._gl.disableVertexAttribArray(i);\r\n this._vertexAttribArraysEnabled[i] = false;\r\n this._currentBufferPointers[i].active = false;\r\n }\r\n return;\r\n }\r\n for (var i = 0, ul = this._vertexAttribArraysEnabled.length; i < ul; i++) {\r\n if (i >= this._caps.maxVertexAttribs || !this._vertexAttribArraysEnabled[i]) {\r\n continue;\r\n }\r\n this._gl.disableVertexAttribArray(i);\r\n this._vertexAttribArraysEnabled[i] = false;\r\n this._currentBufferPointers[i].active = false;\r\n }\r\n };\r\n /**\r\n * Force the engine to release all cached effects. This means that next effect compilation will have to be done completely even if a similar effect was already compiled\r\n */\r\n ThinEngine.prototype.releaseEffects = function () {\r\n for (var name in this._compiledEffects) {\r\n var webGLPipelineContext = this._compiledEffects[name].getPipelineContext();\r\n this._deletePipelineContext(webGLPipelineContext);\r\n }\r\n this._compiledEffects = {};\r\n };\r\n /**\r\n * Dispose and release all associated resources\r\n */\r\n ThinEngine.prototype.dispose = function () {\r\n this.stopRenderLoop();\r\n // Clear observables\r\n if (this.onBeforeTextureInitObservable) {\r\n this.onBeforeTextureInitObservable.clear();\r\n }\r\n // Empty texture\r\n if (this._emptyTexture) {\r\n this._releaseTexture(this._emptyTexture);\r\n this._emptyTexture = null;\r\n }\r\n if (this._emptyCubeTexture) {\r\n this._releaseTexture(this._emptyCubeTexture);\r\n this._emptyCubeTexture = null;\r\n }\r\n // Release effects\r\n this.releaseEffects();\r\n // Unbind\r\n this.unbindAllAttributes();\r\n this._boundUniforms = [];\r\n // Events\r\n if (DomManagement.IsWindowObjectExist()) {\r\n if (this._renderingCanvas) {\r\n if (!this._doNotHandleContextLost) {\r\n this._renderingCanvas.removeEventListener(\"webglcontextlost\", this._onContextLost);\r\n this._renderingCanvas.removeEventListener(\"webglcontextrestored\", this._onContextRestored);\r\n }\r\n }\r\n }\r\n this._workingCanvas = null;\r\n this._workingContext = null;\r\n this._currentBufferPointers = [];\r\n this._renderingCanvas = null;\r\n this._currentProgram = null;\r\n this._bindedRenderFunction = null;\r\n Effect.ResetCache();\r\n // Abort active requests\r\n for (var _i = 0, _a = this._activeRequests; _i < _a.length; _i++) {\r\n var request = _a[_i];\r\n request.abort();\r\n }\r\n };\r\n /**\r\n * Attach a new callback raised when context lost event is fired\r\n * @param callback defines the callback to call\r\n */\r\n ThinEngine.prototype.attachContextLostEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextlost\", callback, false);\r\n }\r\n };\r\n /**\r\n * Attach a new callback raised when context restored event is fired\r\n * @param callback defines the callback to call\r\n */\r\n ThinEngine.prototype.attachContextRestoredEvent = function (callback) {\r\n if (this._renderingCanvas) {\r\n this._renderingCanvas.addEventListener(\"webglcontextrestored\", callback, false);\r\n }\r\n };\r\n /**\r\n * Get the current error code of the webGL context\r\n * @returns the error code\r\n * @see https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getError\r\n */\r\n ThinEngine.prototype.getError = function () {\r\n return this._gl.getError();\r\n };\r\n ThinEngine.prototype._canRenderToFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(1);\r\n };\r\n ThinEngine.prototype._canRenderToHalfFloatFramebuffer = function () {\r\n if (this._webGLVersion > 1) {\r\n return this._caps.colorBufferFloat;\r\n }\r\n return this._canRenderToFramebuffer(2);\r\n };\r\n // Thank you : http://stackoverflow.com/questions/28827511/webgl-ios-render-to-floating-point-texture\r\n ThinEngine.prototype._canRenderToFramebuffer = function (type) {\r\n var gl = this._gl;\r\n //clear existing errors\r\n while (gl.getError() !== gl.NO_ERROR) { }\r\n var successful = true;\r\n var texture = gl.createTexture();\r\n gl.bindTexture(gl.TEXTURE_2D, texture);\r\n gl.texImage2D(gl.TEXTURE_2D, 0, this._getRGBABufferInternalSizedFormat(type), 1, 1, 0, gl.RGBA, this._getWebGLTextureType(type), null);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.NEAREST);\r\n gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.NEAREST);\r\n var fb = gl.createFramebuffer();\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\r\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture, 0);\r\n var status = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\r\n successful = successful && (status === gl.FRAMEBUFFER_COMPLETE);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n //try render by clearing frame buffer's color buffer\r\n if (successful) {\r\n gl.clear(gl.COLOR_BUFFER_BIT);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //try reading from frame to ensure render occurs (just creating the FBO is not sufficient to determine if rendering is supported)\r\n if (successful) {\r\n //in practice it's sufficient to just read from the backbuffer rather than handle potentially issues reading from the texture\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n var readFormat = gl.RGBA;\r\n var readType = gl.UNSIGNED_BYTE;\r\n var buffer = new Uint8Array(4);\r\n gl.readPixels(0, 0, 1, 1, readFormat, readType, buffer);\r\n successful = successful && (gl.getError() === gl.NO_ERROR);\r\n }\r\n //clean up\r\n gl.deleteTexture(texture);\r\n gl.deleteFramebuffer(fb);\r\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\r\n //clear accumulated errors\r\n while (!successful && (gl.getError() !== gl.NO_ERROR)) { }\r\n return successful;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getWebGLTextureType = function (type) {\r\n if (this._webGLVersion === 1) {\r\n switch (type) {\r\n case 1:\r\n return this._gl.FLOAT;\r\n case 2:\r\n return this._gl.HALF_FLOAT_OES;\r\n case 0:\r\n return this._gl.UNSIGNED_BYTE;\r\n case 8:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case 9:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case 10:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n }\r\n switch (type) {\r\n case 3:\r\n return this._gl.BYTE;\r\n case 0:\r\n return this._gl.UNSIGNED_BYTE;\r\n case 4:\r\n return this._gl.SHORT;\r\n case 5:\r\n return this._gl.UNSIGNED_SHORT;\r\n case 6:\r\n return this._gl.INT;\r\n case 7: // Refers to UNSIGNED_INT\r\n return this._gl.UNSIGNED_INT;\r\n case 1:\r\n return this._gl.FLOAT;\r\n case 2:\r\n return this._gl.HALF_FLOAT;\r\n case 8:\r\n return this._gl.UNSIGNED_SHORT_4_4_4_4;\r\n case 9:\r\n return this._gl.UNSIGNED_SHORT_5_5_5_1;\r\n case 10:\r\n return this._gl.UNSIGNED_SHORT_5_6_5;\r\n case 11:\r\n return this._gl.UNSIGNED_INT_2_10_10_10_REV;\r\n case 12:\r\n return this._gl.UNSIGNED_INT_24_8;\r\n case 13:\r\n return this._gl.UNSIGNED_INT_10F_11F_11F_REV;\r\n case 14:\r\n return this._gl.UNSIGNED_INT_5_9_9_9_REV;\r\n case 15:\r\n return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV;\r\n }\r\n return this._gl.UNSIGNED_BYTE;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getInternalFormat = function (format) {\r\n var internalFormat = this._gl.RGBA;\r\n switch (format) {\r\n case 0:\r\n internalFormat = this._gl.ALPHA;\r\n break;\r\n case 1:\r\n internalFormat = this._gl.LUMINANCE;\r\n break;\r\n case 2:\r\n internalFormat = this._gl.LUMINANCE_ALPHA;\r\n break;\r\n case 6:\r\n internalFormat = this._gl.RED;\r\n break;\r\n case 7:\r\n internalFormat = this._gl.RG;\r\n break;\r\n case 4:\r\n internalFormat = this._gl.RGB;\r\n break;\r\n case 5:\r\n internalFormat = this._gl.RGBA;\r\n break;\r\n }\r\n if (this._webGLVersion > 1) {\r\n switch (format) {\r\n case 8:\r\n internalFormat = this._gl.RED_INTEGER;\r\n break;\r\n case 9:\r\n internalFormat = this._gl.RG_INTEGER;\r\n break;\r\n case 10:\r\n internalFormat = this._gl.RGB_INTEGER;\r\n break;\r\n case 11:\r\n internalFormat = this._gl.RGBA_INTEGER;\r\n break;\r\n }\r\n }\r\n return internalFormat;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getRGBABufferInternalSizedFormat = function (type, format) {\r\n if (this._webGLVersion === 1) {\r\n if (format !== undefined) {\r\n switch (format) {\r\n case 0:\r\n return this._gl.ALPHA;\r\n case 1:\r\n return this._gl.LUMINANCE;\r\n case 2:\r\n return this._gl.LUMINANCE_ALPHA;\r\n }\r\n }\r\n return this._gl.RGBA;\r\n }\r\n switch (type) {\r\n case 3:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R8_SNORM;\r\n case 7:\r\n return this._gl.RG8_SNORM;\r\n case 4:\r\n return this._gl.RGB8_SNORM;\r\n case 8:\r\n return this._gl.R8I;\r\n case 9:\r\n return this._gl.RG8I;\r\n case 10:\r\n return this._gl.RGB8I;\r\n case 11:\r\n return this._gl.RGBA8I;\r\n default:\r\n return this._gl.RGBA8_SNORM;\r\n }\r\n case 0:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R8;\r\n case 7:\r\n return this._gl.RG8;\r\n case 4:\r\n return this._gl.RGB8; // By default. Other possibilities are RGB565, SRGB8.\r\n case 5:\r\n return this._gl.RGBA8; // By default. Other possibilities are RGB5_A1, RGBA4, SRGB8_ALPHA8.\r\n case 8:\r\n return this._gl.R8UI;\r\n case 9:\r\n return this._gl.RG8UI;\r\n case 10:\r\n return this._gl.RGB8UI;\r\n case 11:\r\n return this._gl.RGBA8UI;\r\n case 0:\r\n return this._gl.ALPHA;\r\n case 1:\r\n return this._gl.LUMINANCE;\r\n case 2:\r\n return this._gl.LUMINANCE_ALPHA;\r\n default:\r\n return this._gl.RGBA8;\r\n }\r\n case 4:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R16I;\r\n case 9:\r\n return this._gl.RG16I;\r\n case 10:\r\n return this._gl.RGB16I;\r\n case 11:\r\n return this._gl.RGBA16I;\r\n default:\r\n return this._gl.RGBA16I;\r\n }\r\n case 5:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R16UI;\r\n case 9:\r\n return this._gl.RG16UI;\r\n case 10:\r\n return this._gl.RGB16UI;\r\n case 11:\r\n return this._gl.RGBA16UI;\r\n default:\r\n return this._gl.RGBA16UI;\r\n }\r\n case 6:\r\n switch (format) {\r\n case 8:\r\n return this._gl.R32I;\r\n case 9:\r\n return this._gl.RG32I;\r\n case 10:\r\n return this._gl.RGB32I;\r\n case 11:\r\n return this._gl.RGBA32I;\r\n default:\r\n return this._gl.RGBA32I;\r\n }\r\n case 7: // Refers to UNSIGNED_INT\r\n switch (format) {\r\n case 8:\r\n return this._gl.R32UI;\r\n case 9:\r\n return this._gl.RG32UI;\r\n case 10:\r\n return this._gl.RGB32UI;\r\n case 11:\r\n return this._gl.RGBA32UI;\r\n default:\r\n return this._gl.RGBA32UI;\r\n }\r\n case 1:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R32F; // By default. Other possibility is R16F.\r\n case 7:\r\n return this._gl.RG32F; // By default. Other possibility is RG16F.\r\n case 4:\r\n return this._gl.RGB32F; // By default. Other possibilities are RGB16F, R11F_G11F_B10F, RGB9_E5.\r\n case 5:\r\n return this._gl.RGBA32F; // By default. Other possibility is RGBA16F.\r\n default:\r\n return this._gl.RGBA32F;\r\n }\r\n case 2:\r\n switch (format) {\r\n case 6:\r\n return this._gl.R16F;\r\n case 7:\r\n return this._gl.RG16F;\r\n case 4:\r\n return this._gl.RGB16F; // By default. Other possibilities are R11F_G11F_B10F, RGB9_E5.\r\n case 5:\r\n return this._gl.RGBA16F;\r\n default:\r\n return this._gl.RGBA16F;\r\n }\r\n case 10:\r\n return this._gl.RGB565;\r\n case 13:\r\n return this._gl.R11F_G11F_B10F;\r\n case 14:\r\n return this._gl.RGB9_E5;\r\n case 8:\r\n return this._gl.RGBA4;\r\n case 9:\r\n return this._gl.RGB5_A1;\r\n case 11:\r\n switch (format) {\r\n case 5:\r\n return this._gl.RGB10_A2; // By default. Other possibility is RGB5_A1.\r\n case 11:\r\n return this._gl.RGB10_A2UI;\r\n default:\r\n return this._gl.RGB10_A2;\r\n }\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._getRGBAMultiSampleBufferFormat = function (type) {\r\n if (type === 1) {\r\n return this._gl.RGBA32F;\r\n }\r\n else if (type === 2) {\r\n return this._gl.RGBA16F;\r\n }\r\n return this._gl.RGBA8;\r\n };\r\n /** @hidden */\r\n ThinEngine.prototype._loadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n var _this = this;\r\n var request = FileTools.LoadFile(url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError);\r\n this._activeRequests.push(request);\r\n request.onCompleteObservable.add(function (request) {\r\n _this._activeRequests.splice(_this._activeRequests.indexOf(request), 1);\r\n });\r\n return request;\r\n };\r\n // Statics\r\n /**\r\n * Gets a boolean indicating if the engine can be instanciated (ie. if a webGL context can be found)\r\n * @returns true if the engine can be created\r\n * @ignorenaming\r\n */\r\n ThinEngine.isSupported = function () {\r\n try {\r\n var tempcanvas = CanvasGenerator.CreateCanvas(1, 1);\r\n var gl = tempcanvas.getContext(\"webgl\") || tempcanvas.getContext(\"experimental-webgl\");\r\n return gl != null && !!window.WebGLRenderingContext;\r\n }\r\n catch (e) {\r\n return false;\r\n }\r\n };\r\n /**\r\n * Find the next highest power of two.\r\n * @param x Number to start search from.\r\n * @return Next highest power of two.\r\n */\r\n ThinEngine.CeilingPOT = function (x) {\r\n x--;\r\n x |= x >> 1;\r\n x |= x >> 2;\r\n x |= x >> 4;\r\n x |= x >> 8;\r\n x |= x >> 16;\r\n x++;\r\n return x;\r\n };\r\n /**\r\n * Find the next lowest power of two.\r\n * @param x Number to start search from.\r\n * @return Next lowest power of two.\r\n */\r\n ThinEngine.FloorPOT = function (x) {\r\n x = x | (x >> 1);\r\n x = x | (x >> 2);\r\n x = x | (x >> 4);\r\n x = x | (x >> 8);\r\n x = x | (x >> 16);\r\n return x - (x >> 1);\r\n };\r\n /**\r\n * Find the nearest power of two.\r\n * @param x Number to start search from.\r\n * @return Next nearest power of two.\r\n */\r\n ThinEngine.NearestPOT = function (x) {\r\n var c = ThinEngine.CeilingPOT(x);\r\n var f = ThinEngine.FloorPOT(x);\r\n return (c - x) > (x - f) ? f : c;\r\n };\r\n /**\r\n * Get the closest exponent of two\r\n * @param value defines the value to approximate\r\n * @param max defines the maximum value to return\r\n * @param mode defines how to define the closest value\r\n * @returns closest exponent of two of the given value\r\n */\r\n ThinEngine.GetExponentOfTwo = function (value, max, mode) {\r\n if (mode === void 0) { mode = 2; }\r\n var pot;\r\n switch (mode) {\r\n case 1:\r\n pot = ThinEngine.FloorPOT(value);\r\n break;\r\n case 2:\r\n pot = ThinEngine.NearestPOT(value);\r\n break;\r\n case 3:\r\n default:\r\n pot = ThinEngine.CeilingPOT(value);\r\n break;\r\n }\r\n return Math.min(pot, max);\r\n };\r\n /**\r\n * Queue a new function into the requested animation frame pool (ie. this function will be executed byt the browser for the next frame)\r\n * @param func - the function to be called\r\n * @param requester - the object that will request the next frame. Falls back to window.\r\n * @returns frame number\r\n */\r\n ThinEngine.QueueNewFrame = function (func, requester) {\r\n if (!DomManagement.IsWindowObjectExist()) {\r\n if (typeof requestAnimationFrame !== \"undefined\") {\r\n return requestAnimationFrame(func);\r\n }\r\n return setTimeout(func, 16);\r\n }\r\n if (!requester) {\r\n requester = window;\r\n }\r\n if (requester.requestAnimationFrame) {\r\n return requester.requestAnimationFrame(func);\r\n }\r\n else if (requester.msRequestAnimationFrame) {\r\n return requester.msRequestAnimationFrame(func);\r\n }\r\n else if (requester.webkitRequestAnimationFrame) {\r\n return requester.webkitRequestAnimationFrame(func);\r\n }\r\n else if (requester.mozRequestAnimationFrame) {\r\n return requester.mozRequestAnimationFrame(func);\r\n }\r\n else if (requester.oRequestAnimationFrame) {\r\n return requester.oRequestAnimationFrame(func);\r\n }\r\n else {\r\n return window.setTimeout(func, 16);\r\n }\r\n };\r\n /** Use this array to turn off some WebGL2 features on known buggy browsers version */\r\n ThinEngine.ExceptionList = [\r\n { key: \"Chrome\\/63\\.0\", capture: \"63\\\\.0\\\\.3239\\\\.(\\\\d+)\", captureConstraint: 108, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/58\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Firefox\\/59\", capture: null, captureConstraint: null, targets: [\"uniformBuffer\"] },\r\n { key: \"Chrome\\/72.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/73.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Chrome\\/74.+?Mobile\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/71\", capture: null, captureConstraint: null, targets: [\"vao\"] },\r\n { key: \"Mac OS.+Chrome\\/72\", capture: null, captureConstraint: null, targets: [\"vao\"] }\r\n ];\r\n /** @hidden */\r\n ThinEngine._TextureLoaders = [];\r\n // Updatable statics so stick with vars here\r\n /**\r\n * Gets or sets the epsilon value used by collision engine\r\n */\r\n ThinEngine.CollisionsEpsilon = 0.001;\r\n return ThinEngine;\r\n}());\r\nexport { ThinEngine };\r\n//# sourceMappingURL=thinEngine.js.map" }, { "id": "../../.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\Textures\\internalTexture.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "index": 28, "index2": 27, "size": 17052, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "../Materials/Textures/internalTexture", "loc": "8:0-95" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/Textures/internalTexture", "loc": "2237:48-63" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/Textures/internalTexture", "loc": "2237:70-91" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/Textures/internalTexture", "loc": "2361:43-58" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/Textures/internalTexture", "loc": "2361:66-87" } ], "providedExports": [ "InternalTextureSource", "InternalTexture" ], "optimizationBailout": [], "depth": 2, "source": "import { Observable } from \"../../Misc/observable\";\r\nimport { RenderTargetCreationOptions } from \"../../Materials/Textures/renderTargetCreationOptions\";\r\nimport { _DevTools } from '../../Misc/devTools';\r\n/**\r\n * Defines the source of the internal texture\r\n */\r\nexport var InternalTextureSource;\r\n(function (InternalTextureSource) {\r\n /**\r\n * The source of the texture data is unknown\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Unknown\"] = 0] = \"Unknown\";\r\n /**\r\n * Texture data comes from an URL\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Url\"] = 1] = \"Url\";\r\n /**\r\n * Texture data is only used for temporary storage\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Temp\"] = 2] = \"Temp\";\r\n /**\r\n * Texture data comes from raw data (ArrayBuffer)\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Raw\"] = 3] = \"Raw\";\r\n /**\r\n * Texture content is dynamic (video or dynamic texture)\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Dynamic\"] = 4] = \"Dynamic\";\r\n /**\r\n * Texture content is generated by rendering to it\r\n */\r\n InternalTextureSource[InternalTextureSource[\"RenderTarget\"] = 5] = \"RenderTarget\";\r\n /**\r\n * Texture content is part of a multi render target process\r\n */\r\n InternalTextureSource[InternalTextureSource[\"MultiRenderTarget\"] = 6] = \"MultiRenderTarget\";\r\n /**\r\n * Texture data comes from a cube data file\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Cube\"] = 7] = \"Cube\";\r\n /**\r\n * Texture data comes from a raw cube data\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubeRaw\"] = 8] = \"CubeRaw\";\r\n /**\r\n * Texture data come from a prefiltered cube data file\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubePrefiltered\"] = 9] = \"CubePrefiltered\";\r\n /**\r\n * Texture content is raw 3D data\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Raw3D\"] = 10] = \"Raw3D\";\r\n /**\r\n * Texture content is a depth texture\r\n */\r\n InternalTextureSource[InternalTextureSource[\"Depth\"] = 11] = \"Depth\";\r\n /**\r\n * Texture data comes from a raw cube data encoded with RGBD\r\n */\r\n InternalTextureSource[InternalTextureSource[\"CubeRawRGBD\"] = 12] = \"CubeRawRGBD\";\r\n})(InternalTextureSource || (InternalTextureSource = {}));\r\n/**\r\n * Class used to store data associated with WebGL texture data for the engine\r\n * This class should not be used directly\r\n */\r\nvar InternalTexture = /** @class */ (function () {\r\n /**\r\n * Creates a new InternalTexture\r\n * @param engine defines the engine to use\r\n * @param source defines the type of data that will be used\r\n * @param delayAllocation if the texture allocation should be delayed (default: false)\r\n */\r\n function InternalTexture(engine, source, delayAllocation) {\r\n if (delayAllocation === void 0) { delayAllocation = false; }\r\n /**\r\n * Defines if the texture is ready\r\n */\r\n this.isReady = false;\r\n /**\r\n * Defines if the texture is a cube texture\r\n */\r\n this.isCube = false;\r\n /**\r\n * Defines if the texture contains 3D data\r\n */\r\n this.is3D = false;\r\n /**\r\n * Defines if the texture contains multiview data\r\n */\r\n this.isMultiview = false;\r\n /**\r\n * Gets the URL used to load this texture\r\n */\r\n this.url = \"\";\r\n /**\r\n * Gets the sampling mode of the texture\r\n */\r\n this.samplingMode = -1;\r\n /**\r\n * Gets a boolean indicating if the texture needs mipmaps generation\r\n */\r\n this.generateMipMaps = false;\r\n /**\r\n * Gets the number of samples used by the texture (WebGL2+ only)\r\n */\r\n this.samples = 0;\r\n /**\r\n * Gets the type of the texture (int, float...)\r\n */\r\n this.type = -1;\r\n /**\r\n * Gets the format of the texture (RGB, RGBA...)\r\n */\r\n this.format = -1;\r\n /**\r\n * Observable called when the texture is loaded\r\n */\r\n this.onLoadedObservable = new Observable();\r\n /**\r\n * Gets the width of the texture\r\n */\r\n this.width = 0;\r\n /**\r\n * Gets the height of the texture\r\n */\r\n this.height = 0;\r\n /**\r\n * Gets the depth of the texture\r\n */\r\n this.depth = 0;\r\n /**\r\n * Gets the initial width of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseWidth = 0;\r\n /**\r\n * Gets the initial height of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseHeight = 0;\r\n /**\r\n * Gets the initial depth of the texture (It could be rescaled if the current system does not support non power of two textures)\r\n */\r\n this.baseDepth = 0;\r\n /**\r\n * Gets a boolean indicating if the texture is inverted on Y axis\r\n */\r\n this.invertY = false;\r\n // Private\r\n /** @hidden */\r\n this._invertVScale = false;\r\n /** @hidden */\r\n this._associatedChannel = -1;\r\n /** @hidden */\r\n this._source = InternalTextureSource.Unknown;\r\n /** @hidden */\r\n this._buffer = null;\r\n /** @hidden */\r\n this._bufferView = null;\r\n /** @hidden */\r\n this._bufferViewArray = null;\r\n /** @hidden */\r\n this._bufferViewArrayArray = null;\r\n /** @hidden */\r\n this._size = 0;\r\n /** @hidden */\r\n this._extension = \"\";\r\n /** @hidden */\r\n this._files = null;\r\n /** @hidden */\r\n this._workingCanvas = null;\r\n /** @hidden */\r\n this._workingContext = null;\r\n /** @hidden */\r\n this._framebuffer = null;\r\n /** @hidden */\r\n this._depthStencilBuffer = null;\r\n /** @hidden */\r\n this._MSAAFramebuffer = null;\r\n /** @hidden */\r\n this._MSAARenderBuffer = null;\r\n /** @hidden */\r\n this._attachments = null;\r\n /** @hidden */\r\n this._cachedCoordinatesMode = null;\r\n /** @hidden */\r\n this._cachedWrapU = null;\r\n /** @hidden */\r\n this._cachedWrapV = null;\r\n /** @hidden */\r\n this._cachedWrapR = null;\r\n /** @hidden */\r\n this._cachedAnisotropicFilteringLevel = null;\r\n /** @hidden */\r\n this._isDisabled = false;\r\n /** @hidden */\r\n this._compression = null;\r\n /** @hidden */\r\n this._generateStencilBuffer = false;\r\n /** @hidden */\r\n this._generateDepthBuffer = false;\r\n /** @hidden */\r\n this._comparisonFunction = 0;\r\n /** @hidden */\r\n this._sphericalPolynomial = null;\r\n /** @hidden */\r\n this._lodGenerationScale = 0;\r\n /** @hidden */\r\n this._lodGenerationOffset = 0;\r\n // Multiview\r\n /** @hidden */\r\n this._colorTextureArray = null;\r\n /** @hidden */\r\n this._depthStencilTextureArray = null;\r\n // The following three fields helps sharing generated fixed LODs for texture filtering\r\n // In environment not supporting the textureLOD extension like EDGE. They are for internal use only.\r\n // They are at the level of the gl texture to benefit from the cache.\r\n /** @hidden */\r\n this._lodTextureHigh = null;\r\n /** @hidden */\r\n this._lodTextureMid = null;\r\n /** @hidden */\r\n this._lodTextureLow = null;\r\n /** @hidden */\r\n this._isRGBD = false;\r\n /** @hidden */\r\n this._linearSpecularLOD = false;\r\n /** @hidden */\r\n this._irradianceTexture = null;\r\n /** @hidden */\r\n this._webGLTexture = null;\r\n /** @hidden */\r\n this._references = 1;\r\n this._engine = engine;\r\n this._source = source;\r\n if (!delayAllocation) {\r\n this._webGLTexture = engine._createTexture();\r\n }\r\n }\r\n /**\r\n * Gets the Engine the texture belongs to.\r\n * @returns The babylon engine\r\n */\r\n InternalTexture.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n Object.defineProperty(InternalTexture.prototype, \"source\", {\r\n /**\r\n * Gets the data source type of the texture\r\n */\r\n get: function () {\r\n return this._source;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Increments the number of references (ie. the number of Texture that point to it)\r\n */\r\n InternalTexture.prototype.incrementReferences = function () {\r\n this._references++;\r\n };\r\n /**\r\n * Change the size of the texture (not the size of the content)\r\n * @param width defines the new width\r\n * @param height defines the new height\r\n * @param depth defines the new depth (1 by default)\r\n */\r\n InternalTexture.prototype.updateSize = function (width, height, depth) {\r\n if (depth === void 0) { depth = 1; }\r\n this.width = width;\r\n this.height = height;\r\n this.depth = depth;\r\n this.baseWidth = width;\r\n this.baseHeight = height;\r\n this.baseDepth = depth;\r\n this._size = width * height * depth;\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._rebuild = function () {\r\n var _this = this;\r\n var proxy;\r\n this.isReady = false;\r\n this._cachedCoordinatesMode = null;\r\n this._cachedWrapU = null;\r\n this._cachedWrapV = null;\r\n this._cachedAnisotropicFilteringLevel = null;\r\n switch (this.source) {\r\n case InternalTextureSource.Temp:\r\n return;\r\n case InternalTextureSource.Url:\r\n proxy = this._engine.createTexture(this.url, !this.generateMipMaps, this.invertY, null, this.samplingMode, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this._buffer, undefined, this.format);\r\n return;\r\n case InternalTextureSource.Raw:\r\n proxy = this._engine.createRawTexture(this._bufferView, this.baseWidth, this.baseHeight, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Raw3D:\r\n proxy = this._engine.createRawTexture3D(this._bufferView, this.baseWidth, this.baseHeight, this.baseDepth, this.format, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Dynamic:\r\n proxy = this._engine.createDynamicTexture(this.baseWidth, this.baseHeight, this.generateMipMaps, this.samplingMode);\r\n proxy._swapAndDie(this);\r\n this._engine.updateDynamicTexture(this, this._engine.getRenderingCanvas(), this.invertY, undefined, undefined, true);\r\n // The engine will make sure to update content so no need to flag it as isReady = true\r\n return;\r\n case InternalTextureSource.RenderTarget:\r\n var options = new RenderTargetCreationOptions();\r\n options.generateDepthBuffer = this._generateDepthBuffer;\r\n options.generateMipMaps = this.generateMipMaps;\r\n options.generateStencilBuffer = this._generateStencilBuffer;\r\n options.samplingMode = this.samplingMode;\r\n options.type = this.type;\r\n if (this.isCube) {\r\n proxy = this._engine.createRenderTargetCubeTexture(this.width, options);\r\n }\r\n else {\r\n var size = {\r\n width: this.width,\r\n height: this.height\r\n };\r\n proxy = this._engine.createRenderTargetTexture(size, options);\r\n }\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Depth:\r\n var depthTextureOptions = {\r\n bilinearFiltering: this.samplingMode !== 2,\r\n comparisonFunction: this._comparisonFunction,\r\n generateStencil: this._generateStencilBuffer,\r\n isCube: this.isCube\r\n };\r\n proxy = this._engine.createDepthStencilTexture({ width: this.width, height: this.height }, depthTextureOptions);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.Cube:\r\n proxy = this._engine.createCubeTexture(this.url, null, this._files, !this.generateMipMaps, function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n return;\r\n case InternalTextureSource.CubeRaw:\r\n proxy = this._engine.createRawCubeTexture(this._bufferViewArray, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n proxy._swapAndDie(this);\r\n this.isReady = true;\r\n return;\r\n case InternalTextureSource.CubeRawRGBD:\r\n proxy = this._engine.createRawCubeTexture(null, this.width, this.format, this.type, this.generateMipMaps, this.invertY, this.samplingMode, this._compression);\r\n InternalTexture._UpdateRGBDAsync(proxy, this._bufferViewArrayArray, this._sphericalPolynomial, this._lodGenerationScale, this._lodGenerationOffset).then(function () {\r\n proxy._swapAndDie(_this);\r\n _this.isReady = true;\r\n });\r\n return;\r\n case InternalTextureSource.CubePrefiltered:\r\n proxy = this._engine.createPrefilteredCubeTexture(this.url, null, this._lodGenerationScale, this._lodGenerationOffset, function (proxy) {\r\n if (proxy) {\r\n proxy._swapAndDie(_this);\r\n }\r\n _this.isReady = true;\r\n }, null, this.format, this._extension);\r\n proxy._sphericalPolynomial = this._sphericalPolynomial;\r\n return;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture.prototype._swapAndDie = function (target) {\r\n target._webGLTexture = this._webGLTexture;\r\n target._isRGBD = this._isRGBD;\r\n if (this._framebuffer) {\r\n target._framebuffer = this._framebuffer;\r\n }\r\n if (this._depthStencilBuffer) {\r\n target._depthStencilBuffer = this._depthStencilBuffer;\r\n }\r\n if (this._lodTextureHigh) {\r\n if (target._lodTextureHigh) {\r\n target._lodTextureHigh.dispose();\r\n }\r\n target._lodTextureHigh = this._lodTextureHigh;\r\n }\r\n if (this._lodTextureMid) {\r\n if (target._lodTextureMid) {\r\n target._lodTextureMid.dispose();\r\n }\r\n target._lodTextureMid = this._lodTextureMid;\r\n }\r\n if (this._lodTextureLow) {\r\n if (target._lodTextureLow) {\r\n target._lodTextureLow.dispose();\r\n }\r\n target._lodTextureLow = this._lodTextureLow;\r\n }\r\n if (this._irradianceTexture) {\r\n if (target._irradianceTexture) {\r\n target._irradianceTexture.dispose();\r\n }\r\n target._irradianceTexture = this._irradianceTexture;\r\n }\r\n var cache = this._engine.getLoadedTexturesCache();\r\n var index = cache.indexOf(this);\r\n if (index !== -1) {\r\n cache.splice(index, 1);\r\n }\r\n var index = cache.indexOf(target);\r\n if (index === -1) {\r\n cache.push(target);\r\n }\r\n };\r\n /**\r\n * Dispose the current allocated resources\r\n */\r\n InternalTexture.prototype.dispose = function () {\r\n if (!this._webGLTexture) {\r\n return;\r\n }\r\n this._references--;\r\n if (this._references === 0) {\r\n this._engine._releaseTexture(this);\r\n this._webGLTexture = null;\r\n }\r\n };\r\n /** @hidden */\r\n InternalTexture._UpdateRGBDAsync = function (internalTexture, data, sphericalPolynomial, lodScale, lodOffset) {\r\n throw _DevTools.WarnImport(\"environmentTextureTools\");\r\n };\r\n return InternalTexture;\r\n}());\r\nexport { InternalTexture };\r\n//# sourceMappingURL=internalTexture.js.map" }, { "id": "../../.temp/packageES6Dev/core/Materials/Textures/renderTargetCreationOptions.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\Textures\\renderTargetCreationOptions.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/renderTargetCreationOptions.js", "index": 29, "index2": 26, "size": 329, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\Textures\\internalTexture.js", "issuerId": "../../.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\Textures\\internalTexture.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } } ], "profile": { "factory": 15, "building": 6 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\Textures\\internalTexture.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "type": "harmony side effect evaluation", "userRequest": "../../Materials/Textures/renderTargetCreationOptions", "loc": "2:0-99" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\Textures\\internalTexture.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "type": "harmony import specifier", "userRequest": "../../Materials/Textures/renderTargetCreationOptions", "loc": "312:34-61" } ], "providedExports": [ "RenderTargetCreationOptions" ], "optimizationBailout": [], "depth": 3, "source": "/**\r\n * Define options used to create a render target texture\r\n */\r\nvar RenderTargetCreationOptions = /** @class */ (function () {\r\n function RenderTargetCreationOptions() {\r\n }\r\n return RenderTargetCreationOptions;\r\n}());\r\nexport { RenderTargetCreationOptions };\r\n//# sourceMappingURL=renderTargetCreationOptions.js.map" }, { "id": "../../.temp/packageES6Dev/core/Materials/effect.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "index": 3, "index2": 21, "size": 42975, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "../Materials/effect", "loc": "2:0-45" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/effect", "loc": "344:19-25" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/effect", "loc": "347:12-18" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/effect", "loc": "486:8-14" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/effect", "loc": "1631:25-31" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Materials/effect", "loc": "3034:8-14" } ], "providedExports": [ "Effect" ], "optimizationBailout": [], "depth": 2, "source": "import { Observable } from \"../Misc/observable\";\r\nimport { DomManagement } from \"../Misc/domManagement\";\r\nimport { Logger } from \"../Misc/logger\";\r\nimport { ShaderProcessor } from '../Engines/Processors/shaderProcessor';\r\n/**\r\n * Effect containing vertex and fragment shader that can be executed on an object.\r\n */\r\nvar Effect = /** @class */ (function () {\r\n /**\r\n * Instantiates an effect.\r\n * An effect can be used to create/manage/execute vertex and fragment shaders.\r\n * @param baseName Name of the effect.\r\n * @param attributesNamesOrOptions List of attribute names that will be passed to the shader or set of all options to create the effect.\r\n * @param uniformsNamesOrEngine List of uniform variable names that will be passed to the shader or the engine that will be used to render effect.\r\n * @param samplers List of sampler variables that will be passed to the shader.\r\n * @param engine Engine to be used to render the effect\r\n * @param defines Define statements to be added to the shader.\r\n * @param fallbacks Possible fallbacks for this effect to improve performance when needed.\r\n * @param onCompiled Callback that will be called when the shader is compiled.\r\n * @param onError Callback that will be called if an error occurs during shader compilation.\r\n * @param indexParameters Parameters to be used with Babylons include syntax to iterate over an array (eg. {lights: 10})\r\n */\r\n function Effect(baseName, attributesNamesOrOptions, uniformsNamesOrEngine, samplers, engine, defines, fallbacks, onCompiled, onError, indexParameters) {\r\n var _this = this;\r\n if (samplers === void 0) { samplers = null; }\r\n if (defines === void 0) { defines = null; }\r\n if (fallbacks === void 0) { fallbacks = null; }\r\n if (onCompiled === void 0) { onCompiled = null; }\r\n if (onError === void 0) { onError = null; }\r\n /**\r\n * Name of the effect.\r\n */\r\n this.name = null;\r\n /**\r\n * String container all the define statements that should be set on the shader.\r\n */\r\n this.defines = \"\";\r\n /**\r\n * Callback that will be called when the shader is compiled.\r\n */\r\n this.onCompiled = null;\r\n /**\r\n * Callback that will be called if an error occurs during shader compilation.\r\n */\r\n this.onError = null;\r\n /**\r\n * Callback that will be called when effect is bound.\r\n */\r\n this.onBind = null;\r\n /**\r\n * Unique ID of the effect.\r\n */\r\n this.uniqueId = 0;\r\n /**\r\n * Observable that will be called when the shader is compiled.\r\n * It is recommended to use executeWhenCompile() or to make sure that scene.isReady() is called to get this observable raised.\r\n */\r\n this.onCompileObservable = new Observable();\r\n /**\r\n * Observable that will be called if an error occurs during shader compilation.\r\n */\r\n this.onErrorObservable = new Observable();\r\n /** @hidden */\r\n this._onBindObservable = null;\r\n /** @hidden */\r\n this._bonesComputationForcedToCPU = false;\r\n this._uniformBuffersNames = {};\r\n this._samplers = {};\r\n this._isReady = false;\r\n this._compilationError = \"\";\r\n this._allFallbacksProcessed = false;\r\n this._uniforms = {};\r\n /**\r\n * Key for the effect.\r\n * @hidden\r\n */\r\n this._key = \"\";\r\n this._fallbacks = null;\r\n this._vertexSourceCode = \"\";\r\n this._fragmentSourceCode = \"\";\r\n this._vertexSourceCodeOverride = \"\";\r\n this._fragmentSourceCodeOverride = \"\";\r\n this._transformFeedbackVaryings = null;\r\n /**\r\n * Compiled shader to webGL program.\r\n * @hidden\r\n */\r\n this._pipelineContext = null;\r\n this._valueCache = {};\r\n this.name = baseName;\r\n if (attributesNamesOrOptions.attributes) {\r\n var options = attributesNamesOrOptions;\r\n this._engine = uniformsNamesOrEngine;\r\n this._attributesNames = options.attributes;\r\n this._uniformsNames = options.uniformsNames.concat(options.samplers);\r\n this._samplerList = options.samplers.slice();\r\n this.defines = options.defines;\r\n this.onError = options.onError;\r\n this.onCompiled = options.onCompiled;\r\n this._fallbacks = options.fallbacks;\r\n this._indexParameters = options.indexParameters;\r\n this._transformFeedbackVaryings = options.transformFeedbackVaryings || null;\r\n if (options.uniformBuffersNames) {\r\n for (var i = 0; i < options.uniformBuffersNames.length; i++) {\r\n this._uniformBuffersNames[options.uniformBuffersNames[i]] = i;\r\n }\r\n }\r\n }\r\n else {\r\n this._engine = engine;\r\n this.defines = (defines == null ? \"\" : defines);\r\n this._uniformsNames = uniformsNamesOrEngine.concat(samplers);\r\n this._samplerList = samplers ? samplers.slice() : [];\r\n this._attributesNames = attributesNamesOrOptions;\r\n this.onError = onError;\r\n this.onCompiled = onCompiled;\r\n this._indexParameters = indexParameters;\r\n this._fallbacks = fallbacks;\r\n }\r\n this.uniqueId = Effect._uniqueIdSeed++;\r\n var vertexSource;\r\n var fragmentSource;\r\n if (baseName.vertexSource) {\r\n vertexSource = \"source:\" + baseName.vertexSource;\r\n }\r\n else if (baseName.vertexElement) {\r\n vertexSource = document.getElementById(baseName.vertexElement);\r\n if (!vertexSource) {\r\n vertexSource = baseName.vertexElement;\r\n }\r\n }\r\n else {\r\n vertexSource = baseName.vertex || baseName;\r\n }\r\n if (baseName.fragmentSource) {\r\n fragmentSource = \"source:\" + baseName.fragmentSource;\r\n }\r\n else if (baseName.fragmentElement) {\r\n fragmentSource = document.getElementById(baseName.fragmentElement);\r\n if (!fragmentSource) {\r\n fragmentSource = baseName.fragmentElement;\r\n }\r\n }\r\n else {\r\n fragmentSource = baseName.fragment || baseName;\r\n }\r\n var processorOptions = {\r\n defines: this.defines.split(\"\\n\"),\r\n indexParameters: this._indexParameters,\r\n isFragment: false,\r\n shouldUseHighPrecisionShader: this._engine._shouldUseHighPrecisionShader,\r\n processor: this._engine._shaderProcessor,\r\n supportsUniformBuffers: this._engine.supportsUniformBuffers,\r\n shadersRepository: Effect.ShadersRepository,\r\n includesShadersStore: Effect.IncludesShadersStore,\r\n version: (this._engine.webGLVersion * 100).toString(),\r\n platformName: this._engine.webGLVersion >= 2 ? \"WEBGL2\" : \"WEBGL1\"\r\n };\r\n this._loadShader(vertexSource, \"Vertex\", \"\", function (vertexCode) {\r\n _this._loadShader(fragmentSource, \"Fragment\", \"Pixel\", function (fragmentCode) {\r\n ShaderProcessor.Process(vertexCode, processorOptions, function (migratedVertexCode) {\r\n processorOptions.isFragment = true;\r\n ShaderProcessor.Process(fragmentCode, processorOptions, function (migratedFragmentCode) {\r\n _this._useFinalCode(migratedVertexCode, migratedFragmentCode, baseName);\r\n });\r\n });\r\n });\r\n });\r\n }\r\n Object.defineProperty(Effect.prototype, \"onBindObservable\", {\r\n /**\r\n * Observable that will be called when effect is bound.\r\n */\r\n get: function () {\r\n if (!this._onBindObservable) {\r\n this._onBindObservable = new Observable();\r\n }\r\n return this._onBindObservable;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Effect.prototype._useFinalCode = function (migratedVertexCode, migratedFragmentCode, baseName) {\r\n if (baseName) {\r\n var vertex = baseName.vertexElement || baseName.vertex || baseName.spectorName || baseName;\r\n var fragment = baseName.fragmentElement || baseName.fragment || baseName.spectorName || baseName;\r\n this._vertexSourceCode = \"#define SHADER_NAME vertex:\" + vertex + \"\\n\" + migratedVertexCode;\r\n this._fragmentSourceCode = \"#define SHADER_NAME fragment:\" + fragment + \"\\n\" + migratedFragmentCode;\r\n }\r\n else {\r\n this._vertexSourceCode = migratedVertexCode;\r\n this._fragmentSourceCode = migratedFragmentCode;\r\n }\r\n this._prepareEffect();\r\n };\r\n Object.defineProperty(Effect.prototype, \"key\", {\r\n /**\r\n * Unique key for this effect\r\n */\r\n get: function () {\r\n return this._key;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * If the effect has been compiled and prepared.\r\n * @returns if the effect is compiled and prepared.\r\n */\r\n Effect.prototype.isReady = function () {\r\n try {\r\n return this._isReadyInternal();\r\n }\r\n catch (_a) {\r\n return false;\r\n }\r\n };\r\n Effect.prototype._isReadyInternal = function () {\r\n if (this._isReady) {\r\n return true;\r\n }\r\n if (this._pipelineContext) {\r\n return this._pipelineContext.isReady;\r\n }\r\n return false;\r\n };\r\n /**\r\n * The engine the effect was initialized with.\r\n * @returns the engine.\r\n */\r\n Effect.prototype.getEngine = function () {\r\n return this._engine;\r\n };\r\n /**\r\n * The pipeline context for this effect\r\n * @returns the associated pipeline context\r\n */\r\n Effect.prototype.getPipelineContext = function () {\r\n return this._pipelineContext;\r\n };\r\n /**\r\n * The set of names of attribute variables for the shader.\r\n * @returns An array of attribute names.\r\n */\r\n Effect.prototype.getAttributesNames = function () {\r\n return this._attributesNames;\r\n };\r\n /**\r\n * Returns the attribute at the given index.\r\n * @param index The index of the attribute.\r\n * @returns The location of the attribute.\r\n */\r\n Effect.prototype.getAttributeLocation = function (index) {\r\n return this._attributes[index];\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param name of the attribute to look up.\r\n * @returns the attribute location.\r\n */\r\n Effect.prototype.getAttributeLocationByName = function (name) {\r\n var index = this._attributesNames.indexOf(name);\r\n return this._attributes[index];\r\n };\r\n /**\r\n * The number of attributes.\r\n * @returns the numnber of attributes.\r\n */\r\n Effect.prototype.getAttributesCount = function () {\r\n return this._attributes.length;\r\n };\r\n /**\r\n * Gets the index of a uniform variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the index.\r\n */\r\n Effect.prototype.getUniformIndex = function (uniformName) {\r\n return this._uniformsNames.indexOf(uniformName);\r\n };\r\n /**\r\n * Returns the attribute based on the name of the variable.\r\n * @param uniformName of the uniform to look up.\r\n * @returns the location of the uniform.\r\n */\r\n Effect.prototype.getUniform = function (uniformName) {\r\n return this._uniforms[uniformName];\r\n };\r\n /**\r\n * Returns an array of sampler variable names\r\n * @returns The array of sampler variable neames.\r\n */\r\n Effect.prototype.getSamplers = function () {\r\n return this._samplerList;\r\n };\r\n /**\r\n * The error from the last compilation.\r\n * @returns the error string.\r\n */\r\n Effect.prototype.getCompilationError = function () {\r\n return this._compilationError;\r\n };\r\n /**\r\n * Gets a boolean indicating that all fallbacks were used during compilation\r\n * @returns true if all fallbacks were used\r\n */\r\n Effect.prototype.allFallbacksProcessed = function () {\r\n return this._allFallbacksProcessed;\r\n };\r\n /**\r\n * Adds a callback to the onCompiled observable and call the callback imediatly if already ready.\r\n * @param func The callback to be used.\r\n */\r\n Effect.prototype.executeWhenCompiled = function (func) {\r\n var _this = this;\r\n if (this.isReady()) {\r\n func(this);\r\n return;\r\n }\r\n this.onCompileObservable.add(function (effect) {\r\n func(effect);\r\n });\r\n if (!this._pipelineContext || this._pipelineContext.isAsync) {\r\n setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 16);\r\n }\r\n };\r\n Effect.prototype._checkIsReady = function () {\r\n var _this = this;\r\n try {\r\n if (this._isReadyInternal()) {\r\n return;\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e);\r\n return;\r\n }\r\n setTimeout(function () {\r\n _this._checkIsReady();\r\n }, 16);\r\n };\r\n Effect.prototype._loadShader = function (shader, key, optionalKey, callback) {\r\n if (typeof (HTMLElement) !== \"undefined\") {\r\n // DOM element ?\r\n if (shader instanceof HTMLElement) {\r\n var shaderCode = DomManagement.GetDOMTextContent(shader);\r\n callback(shaderCode);\r\n return;\r\n }\r\n }\r\n // Direct source ?\r\n if (shader.substr(0, 7) === \"source:\") {\r\n callback(shader.substr(7));\r\n return;\r\n }\r\n // Base64 encoded ?\r\n if (shader.substr(0, 7) === \"base64:\") {\r\n var shaderBinary = window.atob(shader.substr(7));\r\n callback(shaderBinary);\r\n return;\r\n }\r\n // Is in local store ?\r\n if (Effect.ShadersStore[shader + key + \"Shader\"]) {\r\n callback(Effect.ShadersStore[shader + key + \"Shader\"]);\r\n return;\r\n }\r\n if (optionalKey && Effect.ShadersStore[shader + optionalKey + \"Shader\"]) {\r\n callback(Effect.ShadersStore[shader + optionalKey + \"Shader\"]);\r\n return;\r\n }\r\n var shaderUrl;\r\n if (shader[0] === \".\" || shader[0] === \"/\" || shader.indexOf(\"http\") > -1) {\r\n shaderUrl = shader;\r\n }\r\n else {\r\n shaderUrl = Effect.ShadersRepository + shader;\r\n }\r\n // Vertex shader\r\n this._engine._loadFile(shaderUrl + \".\" + key.toLowerCase() + \".fx\", callback);\r\n };\r\n /**\r\n * Recompiles the webGL program\r\n * @param vertexSourceCode The source code for the vertex shader.\r\n * @param fragmentSourceCode The source code for the fragment shader.\r\n * @param onCompiled Callback called when completed.\r\n * @param onError Callback called on error.\r\n * @hidden\r\n */\r\n Effect.prototype._rebuildProgram = function (vertexSourceCode, fragmentSourceCode, onCompiled, onError) {\r\n var _this = this;\r\n this._isReady = false;\r\n this._vertexSourceCodeOverride = vertexSourceCode;\r\n this._fragmentSourceCodeOverride = fragmentSourceCode;\r\n this.onError = function (effect, error) {\r\n if (onError) {\r\n onError(error);\r\n }\r\n };\r\n this.onCompiled = function () {\r\n var scenes = _this.getEngine().scenes;\r\n for (var i = 0; i < scenes.length; i++) {\r\n scenes[i].markAllMaterialsAsDirty(31);\r\n }\r\n _this._pipelineContext._handlesSpectorRebuildCallback(onCompiled);\r\n };\r\n this._fallbacks = null;\r\n this._prepareEffect();\r\n };\r\n /**\r\n * Prepares the effect\r\n * @hidden\r\n */\r\n Effect.prototype._prepareEffect = function () {\r\n var _this = this;\r\n var attributesNames = this._attributesNames;\r\n var defines = this.defines;\r\n this._valueCache = {};\r\n var previousPipelineContext = this._pipelineContext;\r\n try {\r\n var engine_1 = this._engine;\r\n this._pipelineContext = engine_1.createPipelineContext();\r\n var rebuildRebind = this._rebuildProgram.bind(this);\r\n if (this._vertexSourceCodeOverride && this._fragmentSourceCodeOverride) {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCodeOverride, this._fragmentSourceCodeOverride, true, rebuildRebind, null, this._transformFeedbackVaryings);\r\n }\r\n else {\r\n engine_1._preparePipelineContext(this._pipelineContext, this._vertexSourceCode, this._fragmentSourceCode, false, rebuildRebind, defines, this._transformFeedbackVaryings);\r\n }\r\n engine_1._executeWhenRenderingStateIsCompiled(this._pipelineContext, function () {\r\n if (engine_1.supportsUniformBuffers) {\r\n for (var name in _this._uniformBuffersNames) {\r\n _this.bindUniformBlock(name, _this._uniformBuffersNames[name]);\r\n }\r\n }\r\n var uniforms = engine_1.getUniforms(_this._pipelineContext, _this._uniformsNames);\r\n uniforms.forEach(function (uniform, index) {\r\n _this._uniforms[_this._uniformsNames[index]] = uniform;\r\n });\r\n _this._attributes = engine_1.getAttributes(_this._pipelineContext, attributesNames);\r\n var index;\r\n for (index = 0; index < _this._samplerList.length; index++) {\r\n var sampler = _this.getUniform(_this._samplerList[index]);\r\n if (sampler == null) {\r\n _this._samplerList.splice(index, 1);\r\n index--;\r\n }\r\n }\r\n _this._samplerList.forEach(function (name, index) {\r\n _this._samplers[name] = index;\r\n });\r\n engine_1.bindSamplers(_this);\r\n _this._compilationError = \"\";\r\n _this._isReady = true;\r\n if (_this.onCompiled) {\r\n _this.onCompiled(_this);\r\n }\r\n _this.onCompileObservable.notifyObservers(_this);\r\n _this.onCompileObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (_this._fallbacks) {\r\n _this._fallbacks.unBindMesh();\r\n }\r\n if (previousPipelineContext) {\r\n _this.getEngine()._deletePipelineContext(previousPipelineContext);\r\n }\r\n });\r\n if (this._pipelineContext.isAsync) {\r\n this._checkIsReady();\r\n }\r\n }\r\n catch (e) {\r\n this._processCompilationErrors(e, previousPipelineContext);\r\n }\r\n };\r\n Effect.prototype._processCompilationErrors = function (e, previousPipelineContext) {\r\n if (previousPipelineContext === void 0) { previousPipelineContext = null; }\r\n this._compilationError = e.message;\r\n var attributesNames = this._attributesNames;\r\n var fallbacks = this._fallbacks;\r\n // Let's go through fallbacks then\r\n Logger.Error(\"Unable to compile effect:\");\r\n Logger.Error(\"Uniforms: \" + this._uniformsNames.map(function (uniform) {\r\n return \" \" + uniform;\r\n }));\r\n Logger.Error(\"Attributes: \" + attributesNames.map(function (attribute) {\r\n return \" \" + attribute;\r\n }));\r\n Logger.Error(\"Defines:\\r\\n\" + this.defines);\r\n Logger.Error(\"Error: \" + this._compilationError);\r\n if (previousPipelineContext) {\r\n this._pipelineContext = previousPipelineContext;\r\n this._isReady = true;\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n }\r\n if (fallbacks) {\r\n this._pipelineContext = null;\r\n if (fallbacks.hasMoreFallbacks) {\r\n this._allFallbacksProcessed = false;\r\n Logger.Error(\"Trying next fallback.\");\r\n this.defines = fallbacks.reduce(this.defines, this);\r\n this._prepareEffect();\r\n }\r\n else { // Sorry we did everything we can\r\n this._allFallbacksProcessed = true;\r\n if (this.onError) {\r\n this.onError(this, this._compilationError);\r\n }\r\n this.onErrorObservable.notifyObservers(this);\r\n this.onErrorObservable.clear();\r\n // Unbind mesh reference in fallbacks\r\n if (this._fallbacks) {\r\n this._fallbacks.unBindMesh();\r\n }\r\n }\r\n }\r\n else {\r\n this._allFallbacksProcessed = true;\r\n }\r\n };\r\n Object.defineProperty(Effect.prototype, \"isSupported\", {\r\n /**\r\n * Checks if the effect is supported. (Must be called after compilation)\r\n */\r\n get: function () {\r\n return this._compilationError === \"\";\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Binds a texture to the engine to be used as output of the shader.\r\n * @param channel Name of the output variable.\r\n * @param texture Texture to bind.\r\n * @hidden\r\n */\r\n Effect.prototype._bindTexture = function (channel, texture) {\r\n this._engine._bindTexture(this._samplers[channel], texture);\r\n };\r\n /**\r\n * Sets a texture on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setTexture = function (channel, texture) {\r\n this._engine.setTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets a depth stencil texture from a render target on the engine to be used in the shader.\r\n * @param channel Name of the sampler variable.\r\n * @param texture Texture to set.\r\n */\r\n Effect.prototype.setDepthStencilTexture = function (channel, texture) {\r\n this._engine.setDepthStencilTexture(this._samplers[channel], this._uniforms[channel], texture);\r\n };\r\n /**\r\n * Sets an array of textures on the engine to be used in the shader.\r\n * @param channel Name of the variable.\r\n * @param textures Textures to set.\r\n */\r\n Effect.prototype.setTextureArray = function (channel, textures) {\r\n var exName = channel + \"Ex\";\r\n if (this._samplerList.indexOf(exName + \"0\") === -1) {\r\n var initialPos = this._samplerList.indexOf(channel);\r\n for (var index = 1; index < textures.length; index++) {\r\n var currentExName = exName + (index - 1).toString();\r\n this._samplerList.splice(initialPos + index, 0, currentExName);\r\n }\r\n // Reset every channels\r\n var channelIndex = 0;\r\n for (var _i = 0, _a = this._samplerList; _i < _a.length; _i++) {\r\n var key = _a[_i];\r\n this._samplers[key] = channelIndex;\r\n channelIndex += 1;\r\n }\r\n }\r\n this._engine.setTextureArray(this._samplers[channel], this._uniforms[channel], textures);\r\n };\r\n /**\r\n * Sets a texture to be the input of the specified post process. (To use the output, pass in the next post process in the pipeline)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the input texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcess = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcess(this._samplers[channel], postProcess);\r\n };\r\n /**\r\n * (Warning! setTextureFromPostProcessOutput may be desired instead)\r\n * Sets the input texture of the passed in post process to be input of this effect. (To use the output of the passed in post process use setTextureFromPostProcessOutput)\r\n * @param channel Name of the sampler variable.\r\n * @param postProcess Post process to get the output texture from.\r\n */\r\n Effect.prototype.setTextureFromPostProcessOutput = function (channel, postProcess) {\r\n this._engine.setTextureFromPostProcessOutput(this._samplers[channel], postProcess);\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheMatrix = function (uniformName, matrix) {\r\n var cache = this._valueCache[uniformName];\r\n var flag = matrix.updateFlag;\r\n if (cache !== undefined && cache === flag) {\r\n return false;\r\n }\r\n this._valueCache[uniformName] = flag;\r\n return true;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat2 = function (uniformName, x, y) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat3 = function (uniformName, x, y, z) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y, z];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /** @hidden */\r\n Effect.prototype._cacheFloat4 = function (uniformName, x, y, z, w) {\r\n var cache = this._valueCache[uniformName];\r\n if (!cache) {\r\n cache = [x, y, z, w];\r\n this._valueCache[uniformName] = cache;\r\n return true;\r\n }\r\n var changed = false;\r\n if (cache[0] !== x) {\r\n cache[0] = x;\r\n changed = true;\r\n }\r\n if (cache[1] !== y) {\r\n cache[1] = y;\r\n changed = true;\r\n }\r\n if (cache[2] !== z) {\r\n cache[2] = z;\r\n changed = true;\r\n }\r\n if (cache[3] !== w) {\r\n cache[3] = w;\r\n changed = true;\r\n }\r\n return changed;\r\n };\r\n /**\r\n * Binds a buffer to a uniform.\r\n * @param buffer Buffer to bind.\r\n * @param name Name of the uniform variable to bind to.\r\n */\r\n Effect.prototype.bindUniformBuffer = function (buffer, name) {\r\n var bufferName = this._uniformBuffersNames[name];\r\n if (bufferName === undefined || Effect._baseCache[bufferName] === buffer) {\r\n return;\r\n }\r\n Effect._baseCache[bufferName] = buffer;\r\n this._engine.bindUniformBufferBase(buffer, bufferName);\r\n };\r\n /**\r\n * Binds block to a uniform.\r\n * @param blockName Name of the block to bind.\r\n * @param index Index to bind.\r\n */\r\n Effect.prototype.bindUniformBlock = function (blockName, index) {\r\n this._engine.bindUniformBlock(this._pipelineContext, blockName, index);\r\n };\r\n /**\r\n * Sets an interger value on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setInt = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = value;\r\n this._engine.setInt(this._uniforms[uniformName], value);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an int array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setIntArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setIntArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an float array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloatArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 2 on a uniform variable. (Array is specified as single array eg. [1,2,3,4] will result in [[1,2],[3,4]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray2 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray2(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 3 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6] will result in [[1,2,3],[4,5,6]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray3 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray3(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets an array 4 on a uniform variable. (Array is specified as single array eg. [1,2,3,4,5,6,7,8] will result in [[1,2,3,4],[5,6,7,8]] in the shader)\r\n * @param uniformName Name of the variable.\r\n * @param array array to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setArray4 = function (uniformName, array) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setArray4(this._uniforms[uniformName], array);\r\n return this;\r\n };\r\n /**\r\n * Sets matrices on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrices matrices to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrices = function (uniformName, matrices) {\r\n if (!matrices) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrices(this._uniforms[uniformName], matrices);\r\n return this;\r\n };\r\n /**\r\n * Sets matrix on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix = function (uniformName, matrix) {\r\n if (this._cacheMatrix(uniformName, matrix)) {\r\n this._engine.setMatrices(this._uniforms[uniformName], matrix.toArray());\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a 3x3 matrix on a uniform variable. (Speicified as [1,2,3,4,5,6,7,8,9] will result in [1,2,3][4,5,6][7,8,9] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix3x3 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix3x3(this._uniforms[uniformName], matrix);\r\n return this;\r\n };\r\n /**\r\n * Sets a 2x2 matrix on a uniform variable. (Speicified as [1,2,3,4] will result in [1,2][3,4] matrix)\r\n * @param uniformName Name of the variable.\r\n * @param matrix matrix to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setMatrix2x2 = function (uniformName, matrix) {\r\n this._valueCache[uniformName] = null;\r\n this._engine.setMatrix2x2(this._uniforms[uniformName], matrix);\r\n return this;\r\n };\r\n /**\r\n * Sets a float on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param value value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat = function (uniformName, value) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === value) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = value;\r\n this._engine.setFloat(this._uniforms[uniformName], value);\r\n return this;\r\n };\r\n /**\r\n * Sets a boolean on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param bool value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setBool = function (uniformName, bool) {\r\n var cache = this._valueCache[uniformName];\r\n if (cache !== undefined && cache === bool) {\r\n return this;\r\n }\r\n this._valueCache[uniformName] = bool;\r\n this._engine.setInt(this._uniforms[uniformName], bool ? 1 : 0);\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector2 vector2 to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector2 = function (uniformName, vector2) {\r\n if (this._cacheFloat2(uniformName, vector2.x, vector2.y)) {\r\n this._engine.setFloat2(this._uniforms[uniformName], vector2.x, vector2.y);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float2 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float2.\r\n * @param y Second float in float2.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat2 = function (uniformName, x, y) {\r\n if (this._cacheFloat2(uniformName, x, y)) {\r\n this._engine.setFloat2(this._uniforms[uniformName], x, y);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector3 = function (uniformName, vector3) {\r\n if (this._cacheFloat3(uniformName, vector3.x, vector3.y, vector3.z)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], vector3.x, vector3.y, vector3.z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float3.\r\n * @param y Second float in float3.\r\n * @param z Third float in float3.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat3 = function (uniformName, x, y, z) {\r\n if (this._cacheFloat3(uniformName, x, y, z)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], x, y, z);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Vector4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param vector4 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setVector4 = function (uniformName, vector4) {\r\n if (this._cacheFloat4(uniformName, vector4.x, vector4.y, vector4.z, vector4.w)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], vector4.x, vector4.y, vector4.z, vector4.w);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a float4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param x First float in float4.\r\n * @param y Second float in float4.\r\n * @param z Third float in float4.\r\n * @param w Fourth float in float4.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setFloat4 = function (uniformName, x, y, z, w) {\r\n if (this._cacheFloat4(uniformName, x, y, z, w)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], x, y, z, w);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color3 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor3 = function (uniformName, color3) {\r\n if (this._cacheFloat3(uniformName, color3.r, color3.g, color3.b)) {\r\n this._engine.setFloat3(this._uniforms[uniformName], color3.r, color3.g, color3.b);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable.\r\n * @param uniformName Name of the variable.\r\n * @param color3 Value to be set.\r\n * @param alpha Alpha value to be set.\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setColor4 = function (uniformName, color3, alpha) {\r\n if (this._cacheFloat4(uniformName, color3.r, color3.g, color3.b, alpha)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], color3.r, color3.g, color3.b, alpha);\r\n }\r\n return this;\r\n };\r\n /**\r\n * Sets a Color4 on a uniform variable\r\n * @param uniformName defines the name of the variable\r\n * @param color4 defines the value to be set\r\n * @returns this effect.\r\n */\r\n Effect.prototype.setDirectColor4 = function (uniformName, color4) {\r\n if (this._cacheFloat4(uniformName, color4.r, color4.g, color4.b, color4.a)) {\r\n this._engine.setFloat4(this._uniforms[uniformName], color4.r, color4.g, color4.b, color4.a);\r\n }\r\n return this;\r\n };\r\n /** Release all associated resources */\r\n Effect.prototype.dispose = function () {\r\n this._engine._releaseEffect(this);\r\n };\r\n /**\r\n * This function will add a new shader to the shader store\r\n * @param name the name of the shader\r\n * @param pixelShader optional pixel shader content\r\n * @param vertexShader optional vertex shader content\r\n */\r\n Effect.RegisterShader = function (name, pixelShader, vertexShader) {\r\n if (pixelShader) {\r\n Effect.ShadersStore[name + \"PixelShader\"] = pixelShader;\r\n }\r\n if (vertexShader) {\r\n Effect.ShadersStore[name + \"VertexShader\"] = vertexShader;\r\n }\r\n };\r\n /**\r\n * Resets the cache of effects.\r\n */\r\n Effect.ResetCache = function () {\r\n Effect._baseCache = {};\r\n };\r\n /**\r\n * Gets or sets the relative url used to load shaders if using the engine in non-minified mode\r\n */\r\n Effect.ShadersRepository = \"src/Shaders/\";\r\n Effect._uniqueIdSeed = 0;\r\n Effect._baseCache = {};\r\n /**\r\n * Store of each shader (The can be looked up using effect.key)\r\n */\r\n Effect.ShadersStore = {};\r\n /**\r\n * Store of each included file for a shader (The can be looked up using effect.key)\r\n */\r\n Effect.IncludesShadersStore = {};\r\n return Effect;\r\n}());\r\nexport { Effect };\r\n//# sourceMappingURL=effect.js.map" }, { "id": "../../.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Meshes\\WebGL\\webGLDataBuffer.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "index": 31, "index2": 30, "size": 685, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "../Meshes/WebGL/webGLDataBuffer", "loc": "12:0-66" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Meshes/WebGL/webGLDataBuffer", "loc": "1126:29-44" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Meshes/WebGL/webGLDataBuffer", "loc": "1158:29-44" } ], "providedExports": [ "WebGLDataBuffer" ], "optimizationBailout": [], "depth": 2, "source": "import { __extends } from \"tslib\";\r\nimport { DataBuffer } from '../dataBuffer';\r\n/** @hidden */\r\nvar WebGLDataBuffer = /** @class */ (function (_super) {\r\n __extends(WebGLDataBuffer, _super);\r\n function WebGLDataBuffer(resource) {\r\n var _this = _super.call(this) || this;\r\n _this._buffer = resource;\r\n return _this;\r\n }\r\n Object.defineProperty(WebGLDataBuffer.prototype, \"underlyingResource\", {\r\n get: function () {\r\n return this._buffer;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return WebGLDataBuffer;\r\n}(DataBuffer));\r\nexport { WebGLDataBuffer };\r\n//# sourceMappingURL=webGLDataBuffer.js.map" }, { "id": "../../.temp/packageES6Dev/core/Meshes/dataBuffer.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Meshes\\dataBuffer.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Meshes/dataBuffer.js", "index": 32, "index2": 29, "size": 866, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Meshes\\WebGL\\webGLDataBuffer.js", "issuerId": "../../.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Meshes\\WebGL\\webGLDataBuffer.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } } ], "profile": { "factory": 28, "building": 7 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Meshes\\WebGL\\webGLDataBuffer.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "type": "harmony side effect evaluation", "userRequest": "../dataBuffer", "loc": "2:0-43" }, { "moduleId": "../../.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Meshes\\WebGL\\webGLDataBuffer.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Meshes/WebGL/webGLDataBuffer.js", "type": "harmony import specifier", "userRequest": "../dataBuffer", "loc": "19:2-12" } ], "providedExports": [ "DataBuffer" ], "optimizationBailout": [], "depth": 3, "source": "/**\r\n * Class used to store gfx data (like WebGLBuffer)\r\n */\r\nvar DataBuffer = /** @class */ (function () {\r\n function DataBuffer() {\r\n /**\r\n * Gets or sets the number of objects referencing this buffer\r\n */\r\n this.references = 0;\r\n /** Gets or sets the size of the underlying buffer */\r\n this.capacity = 0;\r\n /**\r\n * Gets or sets a boolean indicating if the buffer contains 32bits indices\r\n */\r\n this.is32Bits = false;\r\n }\r\n Object.defineProperty(DataBuffer.prototype, \"underlyingResource\", {\r\n /**\r\n * Gets the underlying buffer\r\n */\r\n get: function () {\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return DataBuffer;\r\n}());\r\nexport { DataBuffer };\r\n//# sourceMappingURL=dataBuffer.js.map" }, { "id": "../../.temp/packageES6Dev/core/Misc/baseError.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\baseError.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/baseError.js", "index": 23, "index2": 18, "size": 847, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "issuerId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } } ], "profile": { "factory": 33, "building": 7, "dependencies": 10 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony side effect evaluation", "userRequest": "./baseError", "loc": "7:0-40" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./baseError", "loc": "21:8-17" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./baseError", "loc": "31:2-11" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./baseError", "loc": "45:8-17" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./baseError", "loc": "49:2-11" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./baseError", "loc": "63:8-17" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./baseError", "loc": "67:2-11" } ], "providedExports": [ "BaseError" ], "optimizationBailout": [], "depth": 3, "source": "import { __extends } from \"tslib\";\r\n/**\r\n * @ignore\r\n * Application error to support additional information when loading a file\r\n */\r\nvar BaseError = /** @class */ (function (_super) {\r\n __extends(BaseError, _super);\r\n function BaseError() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n // See https://stackoverflow.com/questions/12915412/how-do-i-extend-a-host-object-e-g-error-in-typescript\r\n // and https://github.com/Microsoft/TypeScript/wiki/Breaking-Changes#extending-built-ins-like-error-array-and-map-may-no-longer-work\r\n // Polyfill for Object.setPrototypeOf if necessary.\r\n BaseError._setPrototypeOf = Object.setPrototypeOf || (function (o, proto) { o.__proto__ = proto; return o; });\r\n return BaseError;\r\n}(Error));\r\nexport { BaseError };\r\n//# sourceMappingURL=baseError.js.map" }, { "id": "../../.temp/packageES6Dev/core/Misc/canvasGenerator.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\canvasGenerator.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/canvasGenerator.js", "index": 34, "index2": 32, "size": 845, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "../Misc/canvasGenerator", "loc": "15:0-58" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/canvasGenerator", "loc": "731:30-45" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/canvasGenerator", "loc": "3408:29-44" } ], "providedExports": [ "CanvasGenerator" ], "optimizationBailout": [], "depth": 2, "source": "/**\r\n * Helper class used to generate a canvas to manipulate images\r\n */\r\nvar CanvasGenerator = /** @class */ (function () {\r\n function CanvasGenerator() {\r\n }\r\n /**\r\n * Create a new canvas (or offscreen canvas depending on the context)\r\n * @param width defines the expected width\r\n * @param height defines the expected height\r\n * @return a new canvas or offscreen canvas\r\n */\r\n CanvasGenerator.CreateCanvas = function (width, height) {\r\n if (typeof document === \"undefined\") {\r\n return new OffscreenCanvas(width, height);\r\n }\r\n var canvas = document.createElement(\"canvas\");\r\n canvas.width = width;\r\n canvas.height = height;\r\n return canvas;\r\n };\r\n return CanvasGenerator;\r\n}());\r\nexport { CanvasGenerator };\r\n//# sourceMappingURL=canvasGenerator.js.map" }, { "id": "../../.temp/packageES6Dev/core/Misc/devTools.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\devTools.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/devTools.js", "index": 24, "index2": 22, "size": 347, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "../Misc/devTools", "loc": "3:0-45" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/devTools", "loc": "2411:14-23" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/devTools", "loc": "2427:14-23" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/devTools", "loc": "2446:14-23" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\Textures\\internalTexture.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "type": "harmony side effect evaluation", "userRequest": "../../Misc/devTools", "loc": "3:0-48" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\Textures\\internalTexture.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/Textures/internalTexture.js", "type": "harmony import specifier", "userRequest": "../../Misc/devTools", "loc": "430:14-23" } ], "providedExports": [ "_DevTools" ], "optimizationBailout": [], "depth": 2, "source": "/** @hidden */\r\nvar _DevTools = /** @class */ (function () {\r\n function _DevTools() {\r\n }\r\n _DevTools.WarnImport = function (name) {\r\n return name + \" needs to be imported before as it contains a side-effect required by your code.\";\r\n };\r\n return _DevTools;\r\n}());\r\nexport { _DevTools };\r\n//# sourceMappingURL=devTools.js.map" }, { "id": "../../.temp/packageES6Dev/core/Misc/domManagement.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\domManagement.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/domManagement.js", "index": 5, "index2": 2, "size": 1249, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "../Misc/domManagement", "loc": "10:0-54" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/domManagement", "loc": "284:31-44" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/domManagement", "loc": "844:13-26" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/domManagement", "loc": "970:12-25" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/domManagement", "loc": "3020:12-25" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/domManagement", "loc": "3485:13-26" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony side effect evaluation", "userRequest": "../Misc/domManagement", "loc": "2:0-54" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Misc/domManagement", "loc": "347:33-46" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony side effect evaluation", "userRequest": "./domManagement", "loc": "3:0-48" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./domManagement", "loc": "334:106-119" } ], "providedExports": [ "DomManagement" ], "optimizationBailout": [], "depth": 2, "source": "/**\r\n * Sets of helpers dealing with the DOM and some of the recurrent functions needed in\r\n * Babylon.js\r\n */\r\nvar DomManagement = /** @class */ (function () {\r\n function DomManagement() {\r\n }\r\n /**\r\n * Checks if the window object exists\r\n * @returns true if the window object exists\r\n */\r\n DomManagement.IsWindowObjectExist = function () {\r\n return (typeof window) !== \"undefined\";\r\n };\r\n /**\r\n * Checks if the navigator object exists\r\n * @returns true if the navigator object exists\r\n */\r\n DomManagement.IsNavigatorAvailable = function () {\r\n return (typeof navigator) !== \"undefined\";\r\n };\r\n /**\r\n * Extracts text content from a DOM element hierarchy\r\n * @param element defines the root element\r\n * @returns a string\r\n */\r\n DomManagement.GetDOMTextContent = function (element) {\r\n var result = \"\";\r\n var child = element.firstChild;\r\n while (child) {\r\n if (child.nodeType === 3) {\r\n result += child.textContent;\r\n }\r\n child = (child.nextSibling);\r\n }\r\n return result;\r\n };\r\n return DomManagement;\r\n}());\r\nexport { DomManagement };\r\n//# sourceMappingURL=domManagement.js.map" }, { "id": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "index": 19, "index2": 19, "size": 17892, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony side effect evaluation", "userRequest": "../../Misc/fileTools", "loc": "9:0-49" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\Processors\\shaderProcessor.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/Processors/shaderProcessor.js", "type": "harmony import specifier", "userRequest": "../../Misc/fileTools", "loc": "284:16-25" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "../Misc/fileTools", "loc": "14:0-46" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/fileTools", "loc": "2378:20-29" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/fileTools", "loc": "2382:16-25" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/fileTools", "loc": "3393:22-31" } ], "providedExports": [ "LoadFileError", "RequestFileError", "ReadFileError", "FileTools" ], "optimizationBailout": [], "depth": 2, "source": "import { __extends } from \"tslib\";\r\nimport { WebRequest } from './webRequest';\r\nimport { DomManagement } from './domManagement';\r\nimport { Observable } from './observable';\r\nimport { FilesInputStore } from './filesInputStore';\r\nimport { RetryStrategy } from './retryStrategy';\r\nimport { BaseError } from './baseError';\r\nimport { StringTools } from './stringTools';\r\n/** @ignore */\r\nvar LoadFileError = /** @class */ (function (_super) {\r\n __extends(LoadFileError, _super);\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n * @param file defines the optional file\r\n */\r\n function LoadFileError(message, object) {\r\n var _this = _super.call(this, message) || this;\r\n _this.name = \"LoadFileError\";\r\n BaseError._setPrototypeOf(_this, LoadFileError.prototype);\r\n if (object instanceof WebRequest) {\r\n _this.request = object;\r\n }\r\n else {\r\n _this.file = object;\r\n }\r\n return _this;\r\n }\r\n return LoadFileError;\r\n}(BaseError));\r\nexport { LoadFileError };\r\n/** @ignore */\r\nvar RequestFileError = /** @class */ (function (_super) {\r\n __extends(RequestFileError, _super);\r\n /**\r\n * Creates a new LoadFileError\r\n * @param message defines the message of the error\r\n * @param request defines the optional web request\r\n */\r\n function RequestFileError(message, request) {\r\n var _this = _super.call(this, message) || this;\r\n _this.request = request;\r\n _this.name = \"RequestFileError\";\r\n BaseError._setPrototypeOf(_this, RequestFileError.prototype);\r\n return _this;\r\n }\r\n return RequestFileError;\r\n}(BaseError));\r\nexport { RequestFileError };\r\n/** @ignore */\r\nvar ReadFileError = /** @class */ (function (_super) {\r\n __extends(ReadFileError, _super);\r\n /**\r\n * Creates a new ReadFileError\r\n * @param message defines the message of the error\r\n * @param file defines the optional file\r\n */\r\n function ReadFileError(message, file) {\r\n var _this = _super.call(this, message) || this;\r\n _this.file = file;\r\n _this.name = \"ReadFileError\";\r\n BaseError._setPrototypeOf(_this, ReadFileError.prototype);\r\n return _this;\r\n }\r\n return ReadFileError;\r\n}(BaseError));\r\nexport { ReadFileError };\r\n/**\r\n * @hidden\r\n */\r\nvar FileTools = /** @class */ (function () {\r\n function FileTools() {\r\n }\r\n /**\r\n * Removes unwanted characters from an url\r\n * @param url defines the url to clean\r\n * @returns the cleaned url\r\n */\r\n FileTools._CleanUrl = function (url) {\r\n url = url.replace(/#/mg, \"%23\");\r\n return url;\r\n };\r\n /**\r\n * Sets the cors behavior on a dom element. This will add the required Tools.CorsBehavior to the element.\r\n * @param url define the url we are trying\r\n * @param element define the dom element where to configure the cors policy\r\n */\r\n FileTools.SetCorsBehavior = function (url, element) {\r\n if (url && url.indexOf(\"data:\") === 0) {\r\n return;\r\n }\r\n if (this.CorsBehavior) {\r\n if (typeof (this.CorsBehavior) === 'string' || this.CorsBehavior instanceof String) {\r\n element.crossOrigin = this.CorsBehavior;\r\n }\r\n else {\r\n var result = this.CorsBehavior(url);\r\n if (result) {\r\n element.crossOrigin = result;\r\n }\r\n }\r\n }\r\n };\r\n /**\r\n * Loads an image as an HTMLImageElement.\r\n * @param input url string, ArrayBuffer, or Blob to load\r\n * @param onLoad callback called when the image successfully loads\r\n * @param onError callback called when the image fails to load\r\n * @param offlineProvider offline provider for caching\r\n * @param mimeType optional mime type\r\n * @returns the HTMLImageElement of the loaded image\r\n */\r\n FileTools.LoadImage = function (input, onLoad, onError, offlineProvider, mimeType) {\r\n var url;\r\n var usingObjectURL = false;\r\n if (input instanceof ArrayBuffer || ArrayBuffer.isView(input)) {\r\n if (typeof Blob !== 'undefined') {\r\n url = URL.createObjectURL(new Blob([input]));\r\n usingObjectURL = true;\r\n }\r\n else {\r\n url = \"data:\" + (mimeType || \"image/jpg\") + \";base64,\" + StringTools.EncodeArrayBufferToBase64(input);\r\n }\r\n }\r\n else if (input instanceof Blob) {\r\n url = URL.createObjectURL(input);\r\n usingObjectURL = true;\r\n }\r\n else {\r\n url = this._CleanUrl(input);\r\n url = this.PreprocessUrl(input);\r\n }\r\n if (typeof Image === \"undefined\") {\r\n this.LoadFile(url, function (data) {\r\n createImageBitmap(new Blob([data])).then(function (imgBmp) {\r\n onLoad(imgBmp);\r\n if (usingObjectURL) {\r\n URL.revokeObjectURL(url);\r\n }\r\n }).catch(function (reason) {\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, reason);\r\n }\r\n });\r\n }, undefined, offlineProvider || undefined, true, function (request, exception) {\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, exception);\r\n }\r\n });\r\n return null;\r\n }\r\n var img = new Image();\r\n this.SetCorsBehavior(url, img);\r\n var loadHandler = function () {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n onLoad(img);\r\n // Must revoke the URL after calling onLoad to avoid security exceptions in\r\n // certain scenarios (e.g. when hosted in vscode).\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n var errorHandler = function (err) {\r\n img.removeEventListener(\"load\", loadHandler);\r\n img.removeEventListener(\"error\", errorHandler);\r\n if (onError) {\r\n onError(\"Error while trying to load image: \" + input, err);\r\n }\r\n if (usingObjectURL && img.src) {\r\n URL.revokeObjectURL(img.src);\r\n }\r\n };\r\n img.addEventListener(\"load\", loadHandler);\r\n img.addEventListener(\"error\", errorHandler);\r\n var noOfflineSupport = function () {\r\n img.src = url;\r\n };\r\n var loadFromOfflineSupport = function () {\r\n if (offlineProvider) {\r\n offlineProvider.loadImage(url, img);\r\n }\r\n };\r\n if (url.substr(0, 5) !== \"data:\" && offlineProvider && offlineProvider.enableTexturesOffline) {\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport);\r\n }\r\n else {\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var textureName = decodeURIComponent(url.substring(5).toLowerCase());\r\n if (FilesInputStore.FilesToLoad[textureName]) {\r\n try {\r\n var blobURL;\r\n try {\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n catch (ex) {\r\n // Chrome doesn't support oneTimeOnly parameter\r\n blobURL = URL.createObjectURL(FilesInputStore.FilesToLoad[textureName]);\r\n }\r\n img.src = blobURL;\r\n usingObjectURL = true;\r\n }\r\n catch (e) {\r\n img.src = \"\";\r\n }\r\n return img;\r\n }\r\n }\r\n noOfflineSupport();\r\n }\r\n return img;\r\n };\r\n /**\r\n * Reads a file from a File object\r\n * @param file defines the file to load\r\n * @param onSuccess defines the callback to call when data is loaded\r\n * @param onProgress defines the callback to call during loading process\r\n * @param useArrayBuffer defines a boolean indicating that data must be returned as an ArrayBuffer\r\n * @param onError defines the callback to call when an error occurs\r\n * @returns a file request object\r\n */\r\n FileTools.ReadFile = function (file, onSuccess, onProgress, useArrayBuffer, onError) {\r\n var reader = new FileReader();\r\n var request = {\r\n onCompleteObservable: new Observable(),\r\n abort: function () { return reader.abort(); },\r\n };\r\n reader.onloadend = function (e) { return request.onCompleteObservable.notifyObservers(request); };\r\n if (onError) {\r\n reader.onerror = function (e) {\r\n onError(new ReadFileError(\"Unable to read \" + file.name, file));\r\n };\r\n }\r\n reader.onload = function (e) {\r\n //target doesn't have result from ts 1.3\r\n onSuccess(e.target['result']);\r\n };\r\n if (onProgress) {\r\n reader.onprogress = onProgress;\r\n }\r\n if (!useArrayBuffer) {\r\n // Asynchronous read\r\n reader.readAsText(file);\r\n }\r\n else {\r\n reader.readAsArrayBuffer(file);\r\n }\r\n return request;\r\n };\r\n /**\r\n * Loads a file from a url\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param offlineProvider defines the offline provider for caching\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @returns a file request object\r\n */\r\n FileTools.LoadFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError) {\r\n // If file and file input are set\r\n if (url.indexOf(\"file:\") !== -1) {\r\n var fileName = decodeURIComponent(url.substring(5).toLowerCase());\r\n var file = FilesInputStore.FilesToLoad[fileName];\r\n if (file) {\r\n return this.ReadFile(file, onSuccess, onProgress, useArrayBuffer, onError ? function (error) { return onError(undefined, new LoadFileError(error.message, error.file)); } : undefined);\r\n }\r\n }\r\n return this.RequestFile(url, function (data, request) {\r\n onSuccess(data, request ? request.responseURL : undefined);\r\n }, onProgress, offlineProvider, useArrayBuffer, onError ? function (error) {\r\n onError(error.request, new LoadFileError(error.message, error.request));\r\n } : undefined);\r\n };\r\n /**\r\n * Loads a file\r\n * @param url url to load\r\n * @param onSuccess callback called when the file successfully loads\r\n * @param onProgress callback called while file is loading (if the server supports this mode)\r\n * @param useArrayBuffer defines a boolean indicating that date must be returned as ArrayBuffer\r\n * @param onError callback called when the file fails to load\r\n * @param onOpened callback called when the web request is opened\r\n * @returns a file request object\r\n */\r\n FileTools.RequestFile = function (url, onSuccess, onProgress, offlineProvider, useArrayBuffer, onError, onOpened) {\r\n var _this = this;\r\n url = this._CleanUrl(url);\r\n url = this.PreprocessUrl(url);\r\n var loadUrl = this.BaseUrl + url;\r\n var aborted = false;\r\n var fileRequest = {\r\n onCompleteObservable: new Observable(),\r\n abort: function () { return aborted = true; },\r\n };\r\n var requestFile = function () {\r\n var request = new WebRequest();\r\n var retryHandle = null;\r\n fileRequest.abort = function () {\r\n aborted = true;\r\n if (request.readyState !== (XMLHttpRequest.DONE || 4)) {\r\n request.abort();\r\n }\r\n if (retryHandle !== null) {\r\n clearTimeout(retryHandle);\r\n retryHandle = null;\r\n }\r\n };\r\n var retryLoop = function (retryIndex) {\r\n request.open('GET', loadUrl);\r\n if (onOpened) {\r\n onOpened(request);\r\n }\r\n if (useArrayBuffer) {\r\n request.responseType = \"arraybuffer\";\r\n }\r\n if (onProgress) {\r\n request.addEventListener(\"progress\", onProgress);\r\n }\r\n var onLoadEnd = function () {\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n fileRequest.onCompleteObservable.clear();\r\n };\r\n request.addEventListener(\"loadend\", onLoadEnd);\r\n var onReadyStateChange = function () {\r\n if (aborted) {\r\n return;\r\n }\r\n // In case of undefined state in some browsers.\r\n if (request.readyState === (XMLHttpRequest.DONE || 4)) {\r\n // Some browsers have issues where onreadystatechange can be called multiple times with the same value.\r\n request.removeEventListener(\"readystatechange\", onReadyStateChange);\r\n if ((request.status >= 200 && request.status < 300) || (request.status === 0 && (!DomManagement.IsWindowObjectExist() || _this.IsFileURL()))) {\r\n onSuccess(useArrayBuffer ? request.response : request.responseText, request);\r\n return;\r\n }\r\n var retryStrategy = _this.DefaultRetryStrategy;\r\n if (retryStrategy) {\r\n var waitTime = retryStrategy(loadUrl, request, retryIndex);\r\n if (waitTime !== -1) {\r\n // Prevent the request from completing for retry.\r\n request.removeEventListener(\"loadend\", onLoadEnd);\r\n request = new WebRequest();\r\n retryHandle = setTimeout(function () { return retryLoop(retryIndex + 1); }, waitTime);\r\n return;\r\n }\r\n }\r\n var error = new RequestFileError(\"Error status: \" + request.status + \" \" + request.statusText + \" - Unable to load \" + loadUrl, request);\r\n if (onError) {\r\n onError(error);\r\n }\r\n }\r\n };\r\n request.addEventListener(\"readystatechange\", onReadyStateChange);\r\n request.send();\r\n };\r\n retryLoop(0);\r\n };\r\n // Caching all files\r\n if (offlineProvider && offlineProvider.enableSceneOffline) {\r\n var noOfflineSupport_1 = function (request) {\r\n if (request && request.status > 400) {\r\n if (onError) {\r\n onError(request);\r\n }\r\n }\r\n else {\r\n requestFile();\r\n }\r\n };\r\n var loadFromOfflineSupport = function () {\r\n // TODO: database needs to support aborting and should return a IFileRequest\r\n if (offlineProvider) {\r\n offlineProvider.loadFile(_this.BaseUrl + url, function (data) {\r\n if (!aborted) {\r\n onSuccess(data);\r\n }\r\n fileRequest.onCompleteObservable.notifyObservers(fileRequest);\r\n }, onProgress ? function (event) {\r\n if (!aborted) {\r\n onProgress(event);\r\n }\r\n } : undefined, noOfflineSupport_1, useArrayBuffer);\r\n }\r\n };\r\n offlineProvider.open(loadFromOfflineSupport, noOfflineSupport_1);\r\n }\r\n else {\r\n requestFile();\r\n }\r\n return fileRequest;\r\n };\r\n /**\r\n * Checks if the loaded document was accessed via `file:`-Protocol.\r\n * @returns boolean\r\n */\r\n FileTools.IsFileURL = function () {\r\n return location.protocol === \"file:\";\r\n };\r\n /**\r\n * Gets or sets the retry strategy to apply when an error happens while loading an asset\r\n */\r\n FileTools.DefaultRetryStrategy = RetryStrategy.ExponentialBackoff();\r\n /**\r\n * Gets or sets the base URL to use to load assets\r\n */\r\n FileTools.BaseUrl = \"\";\r\n /**\r\n * Default behaviour for cors in the application.\r\n * It can be a string if the expected behavior is identical in the entire app.\r\n * Or a callback to be able to set it per url or on a group of them (in case of Video source for instance)\r\n */\r\n FileTools.CorsBehavior = \"anonymous\";\r\n /**\r\n * Gets or sets a function used to pre-process url before using them to load assets\r\n */\r\n FileTools.PreprocessUrl = function (url) {\r\n return url;\r\n };\r\n return FileTools;\r\n}());\r\nexport { FileTools };\r\n//# sourceMappingURL=fileTools.js.map" }, { "id": "../../.temp/packageES6Dev/core/Misc/filesInputStore.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\filesInputStore.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/filesInputStore.js", "index": 21, "index2": 16, "size": 387, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "issuerId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } }, { "id": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "profile": { "factory": 6, "building": 38, "dependencies": 28 } } ], "profile": { "factory": 33, "building": 7, "dependencies": 10 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony side effect evaluation", "userRequest": "./filesInputStore", "loc": "5:0-52" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./filesInputStore", "loc": "191:20-35" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./filesInputStore", "loc": "195:58-73" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./filesInputStore", "loc": "199:58-73" }, { "moduleId": "../../.temp/packageES6Dev/core/Misc/fileTools.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\fileTools.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/fileTools.js", "type": "harmony import specifier", "userRequest": "./filesInputStore", "loc": "265:23-38" } ], "providedExports": [ "FilesInputStore" ], "optimizationBailout": [], "depth": 3, "source": "/**\r\n * Class used to help managing file picking and drag'n'drop\r\n * File Storage\r\n */\r\nvar FilesInputStore = /** @class */ (function () {\r\n function FilesInputStore() {\r\n }\r\n /**\r\n * List of files ready to be loaded\r\n */\r\n FilesInputStore.FilesToLoad = {};\r\n return FilesInputStore;\r\n}());\r\nexport { FilesInputStore };\r\n//# sourceMappingURL=filesInputStore.js.map" }, { "id": "../../.temp/packageES6Dev/core/Misc/logger.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Misc\\logger.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Misc/logger.js", "index": 6, "index2": 3, "size": 4161, "cacheable": true, "built": true, "optional": false, "prefetched": false, "chunks": [ "thinEngineOnly" ], "issuer": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "issuerId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "issuerPath": [ { "id": "./thinEngineOnly.ts", "identifier": "C:\\Repos\\Babylon.js\\node_modules\\ts-loader\\index.js!C:\\Repos\\Babylon.js\\tests\\es6Modules\\thinEngineOnly.ts", "name": "./thinEngineOnly.ts", "profile": { "factory": 25, "building": 1793 } }, { "id": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "identifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "name": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "profile": { "factory": 10, "building": 63 } } ], "profile": { "factory": 6, "building": 38, "dependencies": 28 }, "failed": false, "errors": 0, "warnings": 0, "assets": [], "reasons": [ { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony side effect evaluation", "userRequest": "../Misc/logger", "loc": "9:0-40" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/logger", "loc": "211:20-26" }, { "moduleId": "../../.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Engines\\thinEngine.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Engines/thinEngine.js", "type": "harmony import specifier", "userRequest": "../Misc/logger", "loc": "227:24-30" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony side effect evaluation", "userRequest": "../Misc/logger", "loc": "3:0-40" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Misc/logger", "loc": "482:8-14" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Misc/logger", "loc": "483:8-14" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Misc/logger", "loc": "486:8-14" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Misc/logger", "loc": "489:8-14" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Misc/logger", "loc": "490:8-14" }, { "moduleId": "../../.temp/packageES6Dev/core/Materials/effect.js", "moduleIdentifier": "C:\\Repos\\Babylon.js\\.temp\\packageES6Dev\\core\\Materials\\effect.js", "module": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "moduleName": "C:/Repos/Babylon.js/.temp/packageES6Dev/core/Materials/effect.js", "type": "harmony import specifier", "userRequest": "../Misc/logger", "loc": "503:16-22" } ], "providedExports": [ "Logger" ], "optimizationBailout": [], "depth": 2, "source": "/**\r\n * Logger used througouht the application to allow configuration of\r\n * the log level required for the messages.\r\n */\r\nvar Logger = /** @class */ (function () {\r\n function Logger() {\r\n }\r\n Logger._AddLogEntry = function (entry) {\r\n Logger._LogCache = entry + Logger._LogCache;\r\n if (Logger.OnNewCacheEntry) {\r\n Logger.OnNewCacheEntry(entry);\r\n }\r\n };\r\n Logger._FormatMessage = function (message) {\r\n var padStr = function (i) { return (i < 10) ? \"0\" + i : \"\" + i; };\r\n var date = new Date();\r\n return \"[\" + padStr(date.getHours()) + \":\" + padStr(date.getMinutes()) + \":\" + padStr(date.getSeconds()) + \"]: \" + message;\r\n };\r\n Logger._LogDisabled = function (message) {\r\n // nothing to do\r\n };\r\n Logger._LogEnabled = function (message) {\r\n var formattedMessage = Logger._FormatMessage(message);\r\n console.log(\"BJS - \" + formattedMessage);\r\n var entry = \"