|
@@ -31079,6 +31079,59 @@ _thinEngine__WEBPACK_IMPORTED_MODULE_4__["ThinEngine"].prototype.updateRawTextur
|
|
|
|
|
|
/***/ }),
|
|
|
|
|
|
+/***/ "./Engines/Extensions/engine.readTexture.ts":
|
|
|
+/*!**************************************************!*\
|
|
|
+ !*** ./Engines/Extensions/engine.readTexture.ts ***!
|
|
|
+ \**************************************************/
|
|
|
+/*! no exports provided */
|
|
|
+/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
|
+
|
|
|
+"use strict";
|
|
|
+__webpack_require__.r(__webpack_exports__);
|
|
|
+/* harmony import */ var _Engines_thinEngine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../Engines/thinEngine */ "./Engines/thinEngine.ts");
|
|
|
+
|
|
|
+_Engines_thinEngine__WEBPACK_IMPORTED_MODULE_0__["ThinEngine"].prototype._readTexturePixels = function (texture, width, height, faceIndex, level, buffer) {
|
|
|
+ if (faceIndex === void 0) { faceIndex = -1; }
|
|
|
+ if (level === void 0) { level = 0; }
|
|
|
+ if (buffer === void 0) { buffer = null; }
|
|
|
+ var gl = this._gl;
|
|
|
+ if (!this._dummyFramebuffer) {
|
|
|
+ var dummy = gl.createFramebuffer();
|
|
|
+ if (!dummy) {
|
|
|
+ throw new Error("Unable to create dummy framebuffer");
|
|
|
+ }
|
|
|
+ this._dummyFramebuffer = dummy;
|
|
|
+ }
|
|
|
+ gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);
|
|
|
+ if (faceIndex > -1) {
|
|
|
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, level);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, level);
|
|
|
+ }
|
|
|
+ var readType = (texture.type !== undefined) ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;
|
|
|
+ switch (readType) {
|
|
|
+ case gl.UNSIGNED_BYTE:
|
|
|
+ if (!buffer) {
|
|
|
+ buffer = new Uint8Array(4 * width * height);
|
|
|
+ }
|
|
|
+ readType = gl.UNSIGNED_BYTE;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ if (!buffer) {
|
|
|
+ buffer = new Float32Array(4 * width * height);
|
|
|
+ }
|
|
|
+ readType = gl.FLOAT;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ gl.readPixels(0, 0, width, height, gl.RGBA, readType, buffer);
|
|
|
+ gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);
|
|
|
+ return buffer;
|
|
|
+};
|
|
|
+
|
|
|
+
|
|
|
+/***/ }),
|
|
|
+
|
|
|
/***/ "./Engines/Extensions/engine.renderTarget.ts":
|
|
|
/*!***************************************************!*\
|
|
|
!*** ./Engines/Extensions/engine.renderTarget.ts ***!
|
|
@@ -33484,6 +33537,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
/* harmony import */ var _Meshes_WebGL_webGLDataBuffer__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Meshes/WebGL/webGLDataBuffer */ "./Meshes/WebGL/webGLDataBuffer.ts");
|
|
|
/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Misc/logger */ "./Misc/logger.ts");
|
|
|
/* harmony import */ var _Extensions_engine_alpha__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Extensions/engine.alpha */ "./Engines/Extensions/engine.alpha.ts");
|
|
|
+/* harmony import */ var _Extensions_engine_readTexture__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Extensions/engine.readTexture */ "./Engines/Extensions/engine.readTexture.ts");
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -34790,45 +34845,6 @@ var Engine = /** @class */ (function (_super) {
|
|
|
return outputBuffer;
|
|
|
});
|
|
|
};
|
|
|
- /** @hidden */
|
|
|
- Engine.prototype._readTexturePixels = function (texture, width, height, faceIndex, level, buffer) {
|
|
|
- if (faceIndex === void 0) { faceIndex = -1; }
|
|
|
- if (level === void 0) { level = 0; }
|
|
|
- if (buffer === void 0) { buffer = null; }
|
|
|
- var gl = this._gl;
|
|
|
- if (!this._dummyFramebuffer) {
|
|
|
- var dummy = gl.createFramebuffer();
|
|
|
- if (!dummy) {
|
|
|
- throw new Error("Unable to create dummy framebuffer");
|
|
|
- }
|
|
|
- this._dummyFramebuffer = dummy;
|
|
|
- }
|
|
|
- gl.bindFramebuffer(gl.FRAMEBUFFER, this._dummyFramebuffer);
|
|
|
- if (faceIndex > -1) {
|
|
|
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex, texture._webGLTexture, level);
|
|
|
- }
|
|
|
- else {
|
|
|
- gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, texture._webGLTexture, level);
|
|
|
- }
|
|
|
- var readType = (texture.type !== undefined) ? this._getWebGLTextureType(texture.type) : gl.UNSIGNED_BYTE;
|
|
|
- switch (readType) {
|
|
|
- case gl.UNSIGNED_BYTE:
|
|
|
- if (!buffer) {
|
|
|
- buffer = new Uint8Array(4 * width * height);
|
|
|
- }
|
|
|
- readType = gl.UNSIGNED_BYTE;
|
|
|
- break;
|
|
|
- default:
|
|
|
- if (!buffer) {
|
|
|
- buffer = new Float32Array(4 * width * height);
|
|
|
- }
|
|
|
- readType = gl.FLOAT;
|
|
|
- break;
|
|
|
- }
|
|
|
- gl.readPixels(0, 0, width, height, gl.RGBA, readType, buffer);
|
|
|
- gl.bindFramebuffer(gl.FRAMEBUFFER, this._currentFramebuffer);
|
|
|
- return buffer;
|
|
|
- };
|
|
|
Engine.prototype.dispose = function () {
|
|
|
this.hideLoadingUI();
|
|
|
this.onNewSceneAddedObservable.clear();
|
|
@@ -34848,9 +34864,6 @@ var Engine = /** @class */ (function (_super) {
|
|
|
if (Engine.Instances.length === 1 && Engine.audioEngine) {
|
|
|
Engine.audioEngine.dispose();
|
|
|
}
|
|
|
- if (this._dummyFramebuffer) {
|
|
|
- this._gl.deleteFramebuffer(this._dummyFramebuffer);
|
|
|
- }
|
|
|
//WebVR
|
|
|
this.disableVR();
|
|
|
// Events
|
|
@@ -37423,6 +37436,8 @@ var ThinEngine = /** @class */ (function () {
|
|
|
this._currentBoundBuffer = new Array();
|
|
|
/** @hidden */
|
|
|
this._currentFramebuffer = null;
|
|
|
+ /** @hidden */
|
|
|
+ this._dummyFramebuffer = null;
|
|
|
this._currentBufferPointers = new Array();
|
|
|
this._currentInstanceLocations = new Array();
|
|
|
this._currentInstanceBuffers = new Array();
|
|
@@ -37637,7 +37652,7 @@ var ThinEngine = /** @class */ (function () {
|
|
|
*/
|
|
|
// Not mixed with Version for tooling purpose.
|
|
|
get: function () {
|
|
|
- return "babylonjs@4.2.0-alpha.12";
|
|
|
+ return "babylonjs@4.2.0-alpha.13";
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -37647,7 +37662,7 @@ var ThinEngine = /** @class */ (function () {
|
|
|
* Returns the current version of the framework
|
|
|
*/
|
|
|
get: function () {
|
|
|
- return "4.2.0-alpha.12";
|
|
|
+ return "4.2.0-alpha.13";
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -40259,7 +40274,8 @@ var ThinEngine = /** @class */ (function () {
|
|
|
texture._associatedChannel = channel;
|
|
|
}
|
|
|
this._activeChannel = channel;
|
|
|
- this._bindTextureDirectly(this._gl.TEXTURE_2D, texture);
|
|
|
+ var target = texture ? this._getTextureTarget(texture) : this._gl.TEXTURE_2D;
|
|
|
+ this._bindTextureDirectly(target, texture);
|
|
|
};
|
|
|
/**
|
|
|
* Unbind all textures from the webGL context
|
|
@@ -40489,6 +40505,9 @@ var ThinEngine = /** @class */ (function () {
|
|
|
this._releaseTexture(this._emptyCubeTexture);
|
|
|
this._emptyCubeTexture = null;
|
|
|
}
|
|
|
+ if (this._dummyFramebuffer) {
|
|
|
+ this._gl.deleteFramebuffer(this._dummyFramebuffer);
|
|
|
+ }
|
|
|
// Release effects
|
|
|
this.releaseEffects();
|
|
|
// Unbind
|
|
@@ -83754,7 +83773,7 @@ var MultiviewRenderTarget = /** @class */ (function (_super) {
|
|
|
internalTexture.isMultiview = true;
|
|
|
internalTexture.format = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTUREFORMAT_RGBA;
|
|
|
_this._texture = internalTexture;
|
|
|
- _this.samples = _this._engine.getCaps().maxSamples || _this.samples;
|
|
|
+ _this.samples = _this._getEngine().getCaps().maxSamples || _this.samples;
|
|
|
return _this;
|
|
|
}
|
|
|
/**
|
|
@@ -84784,7 +84803,7 @@ var ProceduralTexture = /** @class */ (function (_super) {
|
|
|
scene._addComponent(component);
|
|
|
}
|
|
|
scene.proceduralTextures.push(_this);
|
|
|
- _this._engine = scene.getEngine();
|
|
|
+ _this._fullEngine = scene.getEngine();
|
|
|
_this.name = name;
|
|
|
_this.isRenderTarget = true;
|
|
|
_this._size = size;
|
|
@@ -84792,11 +84811,11 @@ var ProceduralTexture = /** @class */ (function (_super) {
|
|
|
_this.setFragment(fragment);
|
|
|
_this._fallbackTexture = fallbackTexture;
|
|
|
if (isCube) {
|
|
|
- _this._texture = _this._engine.createRenderTargetCubeTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });
|
|
|
+ _this._texture = _this._fullEngine.createRenderTargetCubeTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });
|
|
|
_this.setFloat("face", 0);
|
|
|
}
|
|
|
else {
|
|
|
- _this._texture = _this._engine.createRenderTargetTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });
|
|
|
+ _this._texture = _this._fullEngine.createRenderTargetTexture(size, { generateMipMaps: generateMipMaps, generateDepthBuffer: false, generateStencilBuffer: false });
|
|
|
}
|
|
|
// VBO
|
|
|
var vertices = [];
|
|
@@ -84804,7 +84823,7 @@ var ProceduralTexture = /** @class */ (function (_super) {
|
|
|
vertices.push(-1, 1);
|
|
|
vertices.push(-1, -1);
|
|
|
vertices.push(1, -1);
|
|
|
- _this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__["VertexBuffer"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__["VertexBuffer"](_this._engine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__["VertexBuffer"].PositionKind, false, false, 2);
|
|
|
+ _this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__["VertexBuffer"].PositionKind] = new _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__["VertexBuffer"](_this._fullEngine, vertices, _Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__["VertexBuffer"].PositionKind, false, false, 2);
|
|
|
_this._createIndexBuffer();
|
|
|
return _this;
|
|
|
}
|
|
@@ -84828,7 +84847,7 @@ var ProceduralTexture = /** @class */ (function (_super) {
|
|
|
return this._contentData;
|
|
|
};
|
|
|
ProceduralTexture.prototype._createIndexBuffer = function () {
|
|
|
- var engine = this._engine;
|
|
|
+ var engine = this._fullEngine;
|
|
|
// Indices
|
|
|
var indices = [];
|
|
|
indices.push(0);
|
|
@@ -84869,7 +84888,7 @@ var ProceduralTexture = /** @class */ (function (_super) {
|
|
|
*/
|
|
|
ProceduralTexture.prototype.isReady = function () {
|
|
|
var _this = this;
|
|
|
- var engine = this._engine;
|
|
|
+ var engine = this._fullEngine;
|
|
|
var shaders;
|
|
|
if (!this._fragment) {
|
|
|
return false;
|
|
@@ -84970,7 +84989,7 @@ var ProceduralTexture = /** @class */ (function (_super) {
|
|
|
return;
|
|
|
}
|
|
|
this.releaseInternalTexture();
|
|
|
- this._texture = this._engine.createRenderTargetTexture(size, generateMipMaps);
|
|
|
+ this._texture = this._fullEngine.createRenderTargetTexture(size, generateMipMaps);
|
|
|
// Update properties
|
|
|
this._size = size;
|
|
|
this._generateMipMaps = generateMipMaps;
|
|
@@ -85090,7 +85109,7 @@ var ProceduralTexture = /** @class */ (function (_super) {
|
|
|
if (!scene) {
|
|
|
return;
|
|
|
}
|
|
|
- var engine = this._engine;
|
|
|
+ var engine = this._fullEngine;
|
|
|
// Render
|
|
|
engine.enableEffect(this._effect);
|
|
|
engine.setState(false);
|
|
@@ -85201,7 +85220,7 @@ var ProceduralTexture = /** @class */ (function (_super) {
|
|
|
vertexBuffer.dispose();
|
|
|
this._vertexBuffers[_Meshes_buffer__WEBPACK_IMPORTED_MODULE_3__["VertexBuffer"].PositionKind] = null;
|
|
|
}
|
|
|
- if (this._indexBuffer && this._engine._releaseBuffer(this._indexBuffer)) {
|
|
|
+ if (this._indexBuffer && this._fullEngine._releaseBuffer(this._indexBuffer)) {
|
|
|
this._indexBuffer = null;
|
|
|
}
|
|
|
_super.prototype.dispose.call(this);
|
|
@@ -85319,6 +85338,7 @@ Object.defineProperty(_baseTexture__WEBPACK_IMPORTED_MODULE_1__["BaseTexture"].p
|
|
|
if (this._texture.isReady) {
|
|
|
this._texture._sphericalPolynomial =
|
|
|
_Misc_HighDynamicRange_cubemapToSphericalPolynomial__WEBPACK_IMPORTED_MODULE_0__["CubeMapToSphericalPolynomialTools"].ConvertCubeMapTextureToSphericalPolynomial(this);
|
|
|
+ return this._texture._sphericalPolynomial;
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
@@ -85374,9 +85394,9 @@ var BaseTexture = /** @class */ (function () {
|
|
|
* Base class of all the textures in babylon.
|
|
|
* It groups all the common properties the materials, post process, lights... might need
|
|
|
* in order to make a correct use of the texture.
|
|
|
- * @param scene Define the scene the texture blongs to
|
|
|
+ * @param sceneOrEngine Define the scene or engine the texture blongs to
|
|
|
*/
|
|
|
- function BaseTexture(scene) {
|
|
|
+ function BaseTexture(sceneOrEngine) {
|
|
|
/**
|
|
|
* Gets or sets an object used to store user defined information.
|
|
|
*/
|
|
@@ -85464,11 +85484,27 @@ var BaseTexture = /** @class */ (function () {
|
|
|
*/
|
|
|
this.delayLoadState = _Engines_constants__WEBPACK_IMPORTED_MODULE_5__["Constants"].DELAYLOADSTATE_NONE;
|
|
|
this._scene = null;
|
|
|
+ this._engine = null;
|
|
|
/** @hidden */
|
|
|
this._texture = null;
|
|
|
this._uid = null;
|
|
|
this._cachedSize = _Maths_math_size__WEBPACK_IMPORTED_MODULE_7__["Size"].Zero();
|
|
|
- this._setScene(scene);
|
|
|
+ if (sceneOrEngine) {
|
|
|
+ if (BaseTexture._isScene(sceneOrEngine)) {
|
|
|
+ this._scene = sceneOrEngine;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this._engine = sceneOrEngine;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ this._scene = _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__["EngineStore"].LastCreatedScene;
|
|
|
+ }
|
|
|
+ if (this._scene) {
|
|
|
+ this.uniqueId = this._scene.getUniqueId();
|
|
|
+ this._scene.addTexture(this);
|
|
|
+ this._engine = this._scene.getEngine();
|
|
|
+ }
|
|
|
this._uid = null;
|
|
|
}
|
|
|
Object.defineProperty(BaseTexture.prototype, "hasAlpha", {
|
|
@@ -85732,17 +85768,6 @@ var BaseTexture = /** @class */ (function () {
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
|
});
|
|
|
- /** @hidden */
|
|
|
- BaseTexture.prototype._setScene = function (scene) {
|
|
|
- if (this._scene) {
|
|
|
- this._scene.removeTexture(this);
|
|
|
- }
|
|
|
- this._scene = scene || _Engines_engineStore__WEBPACK_IMPORTED_MODULE_4__["EngineStore"].LastCreatedScene;
|
|
|
- if (this._scene) {
|
|
|
- this.uniqueId = this._scene.getUniqueId();
|
|
|
- this._scene.addTexture(this);
|
|
|
- }
|
|
|
- };
|
|
|
/**
|
|
|
* Get the scene the texture belongs to.
|
|
|
* @returns the scene or null if undefined
|
|
@@ -85750,6 +85775,10 @@ var BaseTexture = /** @class */ (function () {
|
|
|
BaseTexture.prototype.getScene = function () {
|
|
|
return this._scene;
|
|
|
};
|
|
|
+ /** @hidden */
|
|
|
+ BaseTexture.prototype._getEngine = function () {
|
|
|
+ return this._engine;
|
|
|
+ };
|
|
|
/**
|
|
|
* Get the texture transform matrix used to offset tile the texture for istance.
|
|
|
* @returns the transformation matrix
|
|
@@ -85826,38 +85855,38 @@ var BaseTexture = /** @class */ (function () {
|
|
|
return new _Maths_math_size__WEBPACK_IMPORTED_MODULE_7__["Size"](this._texture.baseWidth, this._texture.baseHeight);
|
|
|
};
|
|
|
/**
|
|
|
- * Update the sampling mode of the texture.
|
|
|
- * Default is Trilinear mode.
|
|
|
- *
|
|
|
- * | Value | Type | Description |
|
|
|
- * | ----- | ------------------ | ----------- |
|
|
|
- * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |
|
|
|
- * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
|
|
|
- * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
|
|
|
- * | 4 | NEAREST_NEAREST_MIPNEAREST | |
|
|
|
- * | 5 | NEAREST_LINEAR_MIPNEAREST | |
|
|
|
- * | 6 | NEAREST_LINEAR_MIPLINEAR | |
|
|
|
- * | 7 | NEAREST_LINEAR | |
|
|
|
- * | 8 | NEAREST_NEAREST | |
|
|
|
- * | 9 | LINEAR_NEAREST_MIPNEAREST | |
|
|
|
- * | 10 | LINEAR_NEAREST_MIPLINEAR | |
|
|
|
- * | 11 | LINEAR_LINEAR | |
|
|
|
- * | 12 | LINEAR_NEAREST | |
|
|
|
- *
|
|
|
- * > _mag_: magnification filter (close to the viewer)
|
|
|
- * > _min_: minification filter (far from the viewer)
|
|
|
- * > _mip_: filter used between mip map levels
|
|
|
- *@param samplingMode Define the new sampling mode of the texture
|
|
|
- */
|
|
|
+ * Update the sampling mode of the texture.
|
|
|
+ * Default is Trilinear mode.
|
|
|
+ *
|
|
|
+ * | Value | Type | Description |
|
|
|
+ * | ----- | ------------------ | ----------- |
|
|
|
+ * | 1 | NEAREST_SAMPLINGMODE or NEAREST_NEAREST_MIPLINEAR | Nearest is: mag = nearest, min = nearest, mip = linear |
|
|
|
+ * | 2 | BILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPNEAREST | Bilinear is: mag = linear, min = linear, mip = nearest |
|
|
|
+ * | 3 | TRILINEAR_SAMPLINGMODE or LINEAR_LINEAR_MIPLINEAR | Trilinear is: mag = linear, min = linear, mip = linear |
|
|
|
+ * | 4 | NEAREST_NEAREST_MIPNEAREST | |
|
|
|
+ * | 5 | NEAREST_LINEAR_MIPNEAREST | |
|
|
|
+ * | 6 | NEAREST_LINEAR_MIPLINEAR | |
|
|
|
+ * | 7 | NEAREST_LINEAR | |
|
|
|
+ * | 8 | NEAREST_NEAREST | |
|
|
|
+ * | 9 | LINEAR_NEAREST_MIPNEAREST | |
|
|
|
+ * | 10 | LINEAR_NEAREST_MIPLINEAR | |
|
|
|
+ * | 11 | LINEAR_LINEAR | |
|
|
|
+ * | 12 | LINEAR_NEAREST | |
|
|
|
+ *
|
|
|
+ * > _mag_: magnification filter (close to the viewer)
|
|
|
+ * > _min_: minification filter (far from the viewer)
|
|
|
+ * > _mip_: filter used between mip map levels
|
|
|
+ *@param samplingMode Define the new sampling mode of the texture
|
|
|
+ */
|
|
|
BaseTexture.prototype.updateSamplingMode = function (samplingMode) {
|
|
|
if (!this._texture) {
|
|
|
return;
|
|
|
}
|
|
|
- var scene = this.getScene();
|
|
|
- if (!scene) {
|
|
|
+ var engine = this._getEngine();
|
|
|
+ if (!engine) {
|
|
|
return;
|
|
|
}
|
|
|
- scene.getEngine().updateTextureSamplingMode(samplingMode, this._texture);
|
|
|
+ engine.updateTextureSamplingMode(samplingMode, this._texture);
|
|
|
};
|
|
|
/**
|
|
|
* Scales the texture if is `canRescale()`
|
|
@@ -85877,10 +85906,11 @@ var BaseTexture = /** @class */ (function () {
|
|
|
});
|
|
|
/** @hidden */
|
|
|
BaseTexture.prototype._getFromCache = function (url, noMipmap, sampling, invertY) {
|
|
|
- if (!this._scene) {
|
|
|
+ var engine = this._getEngine();
|
|
|
+ if (!engine) {
|
|
|
return null;
|
|
|
}
|
|
|
- var texturesCache = this._scene.getEngine().getLoadedTexturesCache();
|
|
|
+ var texturesCache = engine.getLoadedTexturesCache();
|
|
|
for (var index = 0; index < texturesCache.length; index++) {
|
|
|
var texturesCacheEntry = texturesCache[index];
|
|
|
if (invertY === undefined || invertY === texturesCacheEntry.invertY) {
|
|
@@ -85964,11 +85994,10 @@ var BaseTexture = /** @class */ (function () {
|
|
|
var size = this.getSize();
|
|
|
var width = size.width;
|
|
|
var height = size.height;
|
|
|
- var scene = this.getScene();
|
|
|
- if (!scene) {
|
|
|
+ var engine = this._getEngine();
|
|
|
+ if (!engine) {
|
|
|
return null;
|
|
|
}
|
|
|
- var engine = scene.getEngine();
|
|
|
if (level != 0) {
|
|
|
width = width / Math.pow(2, level);
|
|
|
height = height / Math.pow(2, level);
|
|
@@ -86038,6 +86067,7 @@ var BaseTexture = /** @class */ (function () {
|
|
|
this._scene.textures.splice(index, 1);
|
|
|
}
|
|
|
this._scene.onTextureRemovedObservable.notifyObservers(this);
|
|
|
+ this._scene = null;
|
|
|
}
|
|
|
if (this._texture === undefined) {
|
|
|
return;
|
|
@@ -86047,6 +86077,7 @@ var BaseTexture = /** @class */ (function () {
|
|
|
// Callback
|
|
|
this.onDisposeObservable.notifyObservers(this);
|
|
|
this.onDisposeObservable.clear();
|
|
|
+ this._engine = null;
|
|
|
};
|
|
|
/**
|
|
|
* Serialize the texture into a JSON representation that can be parsed later on.
|
|
@@ -86097,6 +86128,9 @@ var BaseTexture = /** @class */ (function () {
|
|
|
_loop_1();
|
|
|
}
|
|
|
};
|
|
|
+ BaseTexture._isScene = function (sceneOrEngine) {
|
|
|
+ return sceneOrEngine.getClassName() === "Scene";
|
|
|
+ };
|
|
|
/**
|
|
|
* Default anisotropic filtering level for the application.
|
|
|
* It is set to 4 as a good tradeoff between perf and quality.
|
|
@@ -86221,11 +86255,9 @@ var ColorGradingTexture = /** @class */ (function (_super) {
|
|
|
*/
|
|
|
function ColorGradingTexture(url, sceneOrEngine, onLoad) {
|
|
|
if (onLoad === void 0) { onLoad = null; }
|
|
|
- var _this = this;
|
|
|
- var isScene = ColorGradingTexture._isScene(sceneOrEngine);
|
|
|
- _this = _super.call(this, isScene ? sceneOrEngine : null) || this;
|
|
|
+ var _this = _super.call(this, sceneOrEngine) || this;
|
|
|
if (!url) {
|
|
|
- return;
|
|
|
+ return _this;
|
|
|
}
|
|
|
_this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Matrix"].Identity();
|
|
|
_this.name = url;
|
|
@@ -86233,9 +86265,9 @@ var ColorGradingTexture = /** @class */ (function (_super) {
|
|
|
_this._onLoad = onLoad;
|
|
|
_this._texture = _this._getFromCache(url, true);
|
|
|
if (!_this._texture) {
|
|
|
- if (ColorGradingTexture._isScene(sceneOrEngine)) {
|
|
|
- _this._engine = sceneOrEngine.getEngine();
|
|
|
- if (!sceneOrEngine.useDelayedTextureLoading) {
|
|
|
+ var scene = _this.getScene();
|
|
|
+ if (scene) {
|
|
|
+ if (!scene.useDelayedTextureLoading) {
|
|
|
_this.loadTexture();
|
|
|
}
|
|
|
else {
|
|
@@ -86243,12 +86275,10 @@ var ColorGradingTexture = /** @class */ (function (_super) {
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- _this._engine = sceneOrEngine;
|
|
|
_this.loadTexture();
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- _this._engine = _this._texture.getEngine();
|
|
|
_this._triggerOnLoad();
|
|
|
}
|
|
|
return _this;
|
|
@@ -86273,7 +86303,7 @@ var ColorGradingTexture = /** @class */ (function (_super) {
|
|
|
*/
|
|
|
ColorGradingTexture.prototype.load3dlTexture = function () {
|
|
|
var _this = this;
|
|
|
- var engine = this._engine;
|
|
|
+ var engine = this._getEngine();
|
|
|
var texture;
|
|
|
if (engine.webGLVersion === 1) {
|
|
|
texture = engine.createRawTexture(null, 1, 1, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTUREFORMAT_RGBA, false, false, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTURE_BILINEAR_SAMPLINGMODE, null, _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTURETYPE_UNSIGNED_INT);
|
|
@@ -86284,7 +86314,7 @@ var ColorGradingTexture = /** @class */ (function (_super) {
|
|
|
this._texture = texture;
|
|
|
this._texture.isReady = false;
|
|
|
this.isCube = false;
|
|
|
- this.is3D = this._engine.webGLVersion > 1;
|
|
|
+ this.is3D = engine.webGLVersion > 1;
|
|
|
this.wrapU = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTURE_CLAMP_ADDRESSMODE;
|
|
|
this.wrapV = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTURE_CLAMP_ADDRESSMODE;
|
|
|
this.wrapR = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTURE_CLAMP_ADDRESSMODE;
|
|
@@ -86376,7 +86406,7 @@ var ColorGradingTexture = /** @class */ (function (_super) {
|
|
|
scene._loadFile(this.url, callback);
|
|
|
}
|
|
|
else {
|
|
|
- this._engine._loadFile(this.url, callback);
|
|
|
+ engine._loadFile(this.url, callback);
|
|
|
}
|
|
|
return this._texture;
|
|
|
};
|
|
@@ -86392,7 +86422,7 @@ var ColorGradingTexture = /** @class */ (function (_super) {
|
|
|
* Clones the color gradind texture.
|
|
|
*/
|
|
|
ColorGradingTexture.prototype.clone = function () {
|
|
|
- var newTexture = new ColorGradingTexture(this.url, this.getScene());
|
|
|
+ var newTexture = new ColorGradingTexture(this.url, this.getScene() || this._getEngine());
|
|
|
// Base texture
|
|
|
newTexture.level = this.level;
|
|
|
return newTexture;
|
|
@@ -86440,13 +86470,6 @@ var ColorGradingTexture = /** @class */ (function (_super) {
|
|
|
return serializationObject;
|
|
|
};
|
|
|
/**
|
|
|
- * Returns true if the passed parameter is a scene object (can be use for typings)
|
|
|
- * @param sceneOrEngine The object to test.
|
|
|
- */
|
|
|
- ColorGradingTexture._isScene = function (sceneOrEngine) {
|
|
|
- return sceneOrEngine.getClassName() === "Scene";
|
|
|
- };
|
|
|
- /**
|
|
|
* Empty line regex stored for GC.
|
|
|
*/
|
|
|
ColorGradingTexture._noneEmptyLineRegex = /\S+/;
|
|
@@ -86499,7 +86522,7 @@ var CubeTexture = /** @class */ (function (_super) {
|
|
|
* Creates a cube texture to use with reflection for instance. It can be based upon dds or six images as well
|
|
|
* as prefiltered data.
|
|
|
* @param rootUrl defines the url of the texture or the root name of the six images
|
|
|
- * @param scene defines the scene the texture is attached to
|
|
|
+ * @param null defines the scene or engine the texture is attached to
|
|
|
* @param extensions defines the suffixes add to the picture name in case six images are in use like _px.jpg...
|
|
|
* @param noMipmap defines if mipmaps should be created or not
|
|
|
* @param files defines the six files to load for the different faces in that order: px, py, pz, nx, ny, nz
|
|
@@ -86526,7 +86549,7 @@ var CubeTexture = /** @class */ (function (_super) {
|
|
|
if (lodScale === void 0) { lodScale = 0.8; }
|
|
|
if (lodOffset === void 0) { lodOffset = 0; }
|
|
|
var _a;
|
|
|
- var _this = _super.call(this, null) || this;
|
|
|
+ var _this = _super.call(this, sceneOrEngine) || this;
|
|
|
/**
|
|
|
* Observable triggered once the texture has been loaded.
|
|
|
*/
|
|
@@ -86543,14 +86566,6 @@ var CubeTexture = /** @class */ (function (_super) {
|
|
|
_this._extensions = null;
|
|
|
/** @hidden */
|
|
|
_this._prefiltered = false;
|
|
|
- if (CubeTexture._isScene(sceneOrEngine)) {
|
|
|
- _this._setScene(sceneOrEngine);
|
|
|
- _this._engine = sceneOrEngine.getEngine();
|
|
|
- }
|
|
|
- else {
|
|
|
- _this._setScene(null);
|
|
|
- _this._engine = sceneOrEngine;
|
|
|
- }
|
|
|
_this.name = rootUrl;
|
|
|
_this.url = rootUrl;
|
|
|
_this._noMipmap = noMipmap;
|
|
@@ -86605,10 +86620,10 @@ var CubeTexture = /** @class */ (function (_super) {
|
|
|
var scene = _this.getScene();
|
|
|
if (!(scene === null || scene === void 0 ? void 0 : scene.useDelayedTextureLoading)) {
|
|
|
if (prefiltered) {
|
|
|
- _this._texture = _this._engine.createPrefilteredCubeTexture(rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);
|
|
|
+ _this._texture = _this._getEngine().createPrefilteredCubeTexture(rootUrl, scene, lodScale, lodOffset, onLoad, onError, format, forcedExtension, _this._createPolynomials);
|
|
|
}
|
|
|
else {
|
|
|
- _this._texture = _this._engine.createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension, false, lodScale, lodOffset);
|
|
|
+ _this._texture = _this._getEngine().createCubeTexture(rootUrl, scene, files, noMipmap, onLoad, onError, _this._format, forcedExtension, false, lodScale, lodOffset);
|
|
|
}
|
|
|
(_a = _this._texture) === null || _a === void 0 ? void 0 : _a.onLoadedObservable.add(function () { return _this.onLoadObservable.notifyObservers(_this); });
|
|
|
}
|
|
@@ -86771,10 +86786,10 @@ var CubeTexture = /** @class */ (function (_super) {
|
|
|
if (!this._texture) {
|
|
|
var scene = this.getScene();
|
|
|
if (this._prefiltered) {
|
|
|
- this._texture = this._engine.createPrefilteredCubeTexture(this.url, scene, 0.8, 0, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
|
|
|
+ this._texture = this._getEngine().createPrefilteredCubeTexture(this.url, scene, 0.8, 0, this._delayedOnLoad, undefined, this._format, undefined, this._createPolynomials);
|
|
|
}
|
|
|
else {
|
|
|
- this._texture = this._engine.createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, forcedExtension);
|
|
|
+ this._texture = this._getEngine().createCubeTexture(this.url, scene, this._files, this._noMipmap, this._delayedOnLoad, null, this._format, forcedExtension);
|
|
|
}
|
|
|
(_a = this._texture) === null || _a === void 0 ? void 0 : _a.onLoadedObservable.add(function () { return _this.onLoadObservable.notifyObservers(_this); });
|
|
|
}
|
|
@@ -86843,16 +86858,13 @@ var CubeTexture = /** @class */ (function (_super) {
|
|
|
var _this = this;
|
|
|
var uniqueId = 0;
|
|
|
var newCubeTexture = _Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["SerializationHelper"].Clone(function () {
|
|
|
- var cubeTexture = new CubeTexture(_this.url, _this.getScene() || _this._engine, _this._extensions, _this._noMipmap, _this._files);
|
|
|
+ var cubeTexture = new CubeTexture(_this.url, _this.getScene() || _this._getEngine(), _this._extensions, _this._noMipmap, _this._files);
|
|
|
uniqueId = cubeTexture.uniqueId;
|
|
|
return cubeTexture;
|
|
|
}, this);
|
|
|
newCubeTexture.uniqueId = uniqueId;
|
|
|
return newCubeTexture;
|
|
|
};
|
|
|
- CubeTexture._isScene = function (sceneOrEngine) {
|
|
|
- return sceneOrEngine.getClassName() === "Scene";
|
|
|
- };
|
|
|
Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
|
|
|
Object(_Misc_decorators__WEBPACK_IMPORTED_MODULE_1__["serialize"])()
|
|
|
], CubeTexture.prototype, "url", void 0);
|
|
@@ -86924,21 +86936,24 @@ var DynamicTexture = /** @class */ (function (_super) {
|
|
|
if (format === void 0) { format = _Engines_constants__WEBPACK_IMPORTED_MODULE_3__["Constants"].TEXTUREFORMAT_RGBA; }
|
|
|
var _this = _super.call(this, null, scene, !generateMipMaps, undefined, samplingMode, undefined, undefined, undefined, undefined, format) || this;
|
|
|
_this.name = name;
|
|
|
- _this._engine = _this.getScene().getEngine();
|
|
|
_this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
_this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_2__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
_this._generateMipMaps = generateMipMaps;
|
|
|
+ var engine = _this._getEngine();
|
|
|
+ if (!engine) {
|
|
|
+ return _this;
|
|
|
+ }
|
|
|
if (options.getContext) {
|
|
|
_this._canvas = options;
|
|
|
- _this._texture = _this._engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);
|
|
|
+ _this._texture = engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);
|
|
|
}
|
|
|
else {
|
|
|
_this._canvas = _Misc_canvasGenerator__WEBPACK_IMPORTED_MODULE_5__["CanvasGenerator"].CreateCanvas(1, 1);
|
|
|
if (options.width || options.width === 0) {
|
|
|
- _this._texture = _this._engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);
|
|
|
+ _this._texture = engine.createDynamicTexture(options.width, options.height, generateMipMaps, samplingMode);
|
|
|
}
|
|
|
else {
|
|
|
- _this._texture = _this._engine.createDynamicTexture(options, options, generateMipMaps, samplingMode);
|
|
|
+ _this._texture = engine.createDynamicTexture(options, options, generateMipMaps, samplingMode);
|
|
|
}
|
|
|
}
|
|
|
var textureSize = _this.getSize();
|
|
@@ -86968,7 +86983,7 @@ var DynamicTexture = /** @class */ (function (_super) {
|
|
|
this._canvas.width = textureSize.width;
|
|
|
this._canvas.height = textureSize.height;
|
|
|
this.releaseInternalTexture();
|
|
|
- this._texture = this._engine.createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);
|
|
|
+ this._texture = this._getEngine().createDynamicTexture(textureSize.width, textureSize.height, this._generateMipMaps, this.samplingMode);
|
|
|
};
|
|
|
/**
|
|
|
* Scales the texture
|
|
@@ -87012,7 +87027,7 @@ var DynamicTexture = /** @class */ (function (_super) {
|
|
|
*/
|
|
|
DynamicTexture.prototype.update = function (invertY, premulAlpha) {
|
|
|
if (premulAlpha === void 0) { premulAlpha = false; }
|
|
|
- this._engine.updateDynamicTexture(this._texture, this._canvas, invertY === undefined ? true : invertY, premulAlpha, this._format || undefined);
|
|
|
+ this._getEngine().updateDynamicTexture(this._texture, this._canvas, invertY === undefined ? true : invertY, premulAlpha, this._format || undefined);
|
|
|
};
|
|
|
/**
|
|
|
* Draws text onto the texture
|
|
@@ -87325,7 +87340,7 @@ var HDRCubeTexture = /** @class */ (function (_super) {
|
|
|
* Instantiates an HDRTexture from the following parameters.
|
|
|
*
|
|
|
* @param url The location of the HDR raw data (Panorama stored in RGBE format)
|
|
|
- * @param scene The scene the texture will be used in
|
|
|
+ * @param sceneOrEngine The scene or engine the texture will be used in
|
|
|
* @param size The cubemap desired size (the more it increases the longer the generation will be)
|
|
|
* @param noMipmap Forces to not generate the mipmap if true
|
|
|
* @param generateHarmonics Specifies whether you want to extract the polynomial harmonics during the generation process
|
|
@@ -87340,7 +87355,7 @@ var HDRCubeTexture = /** @class */ (function (_super) {
|
|
|
if (onLoad === void 0) { onLoad = null; }
|
|
|
if (onError === void 0) { onError = null; }
|
|
|
var _a;
|
|
|
- var _this = _super.call(this, null) || this;
|
|
|
+ var _this = _super.call(this, sceneOrEngine) || this;
|
|
|
_this._generateHarmonics = true;
|
|
|
_this._onLoad = null;
|
|
|
_this._onError = null;
|
|
@@ -87355,14 +87370,6 @@ var HDRCubeTexture = /** @class */ (function (_super) {
|
|
|
* It must define where the camera used to render the texture was set
|
|
|
*/
|
|
|
_this.boundingBoxPosition = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_1__["Vector3"].Zero();
|
|
|
- if (HDRCubeTexture._isScene(sceneOrEngine)) {
|
|
|
- _this._setScene(sceneOrEngine);
|
|
|
- _this._engine = sceneOrEngine.getEngine();
|
|
|
- }
|
|
|
- else {
|
|
|
- _this._setScene(null);
|
|
|
- _this._engine = sceneOrEngine;
|
|
|
- }
|
|
|
if (!url) {
|
|
|
return _this;
|
|
|
}
|
|
@@ -87464,6 +87471,7 @@ var HDRCubeTexture = /** @class */ (function (_super) {
|
|
|
*/
|
|
|
HDRCubeTexture.prototype.loadTexture = function () {
|
|
|
var _this = this;
|
|
|
+ var engine = this._getEngine();
|
|
|
var callback = function (buffer) {
|
|
|
_this.lodGenerationOffset = 0.0;
|
|
|
_this.lodGenerationScale = 0.8;
|
|
@@ -87479,7 +87487,7 @@ var HDRCubeTexture = /** @class */ (function (_super) {
|
|
|
// Push each faces.
|
|
|
for (var j = 0; j < 6; j++) {
|
|
|
// Create uintarray fallback.
|
|
|
- if (!_this._engine.getCaps().textureFloat) {
|
|
|
+ if (!engine.getCaps().textureFloat) {
|
|
|
// 3 channels of 1 bytes per pixel in bytes.
|
|
|
var byteBuffer = new ArrayBuffer(_this._size * _this._size * 3);
|
|
|
byteArray = new Uint8Array(byteBuffer);
|
|
@@ -87522,10 +87530,10 @@ var HDRCubeTexture = /** @class */ (function (_super) {
|
|
|
}
|
|
|
return results;
|
|
|
};
|
|
|
- this._texture = this._engine.createRawCubeTextureFromUrl(this.url, this.getScene(), this._size, _Engines_constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTUREFORMAT_RGB, this._engine.getCaps().textureFloat ? _Engines_constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTURETYPE_FLOAT : _Engines_constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTURETYPE_UNSIGNED_INT, this._noMipmap, callback, null, this._onLoad, this._onError);
|
|
|
+ this._texture = engine.createRawCubeTextureFromUrl(this.url, this.getScene(), this._size, _Engines_constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTUREFORMAT_RGB, engine.getCaps().textureFloat ? _Engines_constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTURETYPE_FLOAT : _Engines_constants__WEBPACK_IMPORTED_MODULE_4__["Constants"].TEXTURETYPE_UNSIGNED_INT, this._noMipmap, callback, null, this._onLoad, this._onError);
|
|
|
};
|
|
|
HDRCubeTexture.prototype.clone = function () {
|
|
|
- var newTexture = new HDRCubeTexture(this.url, this.getScene() || this._engine, this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);
|
|
|
+ var newTexture = new HDRCubeTexture(this.url, this.getScene() || this._getEngine(), this._size, this._noMipmap, this._generateHarmonics, this.gammaSpace);
|
|
|
// Base texture
|
|
|
newTexture.level = this.level;
|
|
|
newTexture.wrapU = this.wrapU;
|
|
@@ -87616,9 +87624,6 @@ var HDRCubeTexture = /** @class */ (function (_super) {
|
|
|
serializationObject.rotationY = this._rotationY;
|
|
|
return serializationObject;
|
|
|
};
|
|
|
- HDRCubeTexture._isScene = function (sceneOrEngine) {
|
|
|
- return sceneOrEngine.getClassName() === "Scene";
|
|
|
- };
|
|
|
HDRCubeTexture._facesMapping = [
|
|
|
"right",
|
|
|
"left",
|
|
@@ -87676,12 +87681,11 @@ var HtmlElementTexture = /** @class */ (function (_super) {
|
|
|
* @param options Defines the other none mandatory texture creation options
|
|
|
*/
|
|
|
function HtmlElementTexture(name, element, options) {
|
|
|
- var _this = _super.call(this, options.scene) || this;
|
|
|
+ var _this = _super.call(this, options.scene || options.engine) || this;
|
|
|
if (!element || (!options.engine && !options.scene)) {
|
|
|
return _this;
|
|
|
}
|
|
|
options = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, HtmlElementTexture.DefaultOptions), options);
|
|
|
- _this._engine = options.engine || options.scene.getEngine();
|
|
|
_this._generateMipMaps = options.generateMipMaps;
|
|
|
_this._samplingMode = options.samplingMode;
|
|
|
_this._textureMatrix = _Maths_math_vector__WEBPACK_IMPORTED_MODULE_3__["Matrix"].Identity();
|
|
@@ -87703,7 +87707,10 @@ var HtmlElementTexture = /** @class */ (function (_super) {
|
|
|
width = this.element.width;
|
|
|
height = this.element.height;
|
|
|
}
|
|
|
- this._texture = this._engine.createDynamicTexture(width, height, this._generateMipMaps, this._samplingMode);
|
|
|
+ var engine = this._getEngine();
|
|
|
+ if (engine) {
|
|
|
+ this._texture = engine.createDynamicTexture(width, height, this._generateMipMaps, this._samplingMode);
|
|
|
+ }
|
|
|
this.update();
|
|
|
};
|
|
|
/**
|
|
@@ -87718,7 +87725,8 @@ var HtmlElementTexture = /** @class */ (function (_super) {
|
|
|
*/
|
|
|
HtmlElementTexture.prototype.update = function (invertY) {
|
|
|
if (invertY === void 0) { invertY = null; }
|
|
|
- if (this._texture == null) {
|
|
|
+ var engine = this._getEngine();
|
|
|
+ if (this._texture == null || engine == null) {
|
|
|
return;
|
|
|
}
|
|
|
if (this._isVideo) {
|
|
@@ -87726,11 +87734,11 @@ var HtmlElementTexture = /** @class */ (function (_super) {
|
|
|
if (videoElement.readyState < videoElement.HAVE_CURRENT_DATA) {
|
|
|
return;
|
|
|
}
|
|
|
- this._engine.updateVideoTexture(this._texture, videoElement, invertY === null ? true : invertY);
|
|
|
+ engine.updateVideoTexture(this._texture, videoElement, invertY === null ? true : invertY);
|
|
|
}
|
|
|
else {
|
|
|
var canvasElement = this.element;
|
|
|
- this._engine.updateDynamicTexture(this._texture, canvasElement, invertY === null ? true : invertY, false);
|
|
|
+ engine.updateDynamicTexture(this._texture, canvasElement, invertY === null ? true : invertY, false);
|
|
|
}
|
|
|
};
|
|
|
HtmlElementTexture.DefaultOptions = {
|
|
@@ -88649,7 +88657,6 @@ var MultiRenderTarget = /** @class */ (function (_super) {
|
|
|
var generateDepthTexture = options && options.generateDepthTexture ? options.generateDepthTexture : false;
|
|
|
var doNotChangeAspectRatio = !options || options.doNotChangeAspectRatio === undefined ? true : options.doNotChangeAspectRatio;
|
|
|
_this = _super.call(this, name, size, scene, generateMipMaps, doNotChangeAspectRatio) || this;
|
|
|
- _this._engine = scene.getEngine();
|
|
|
if (!_this.isSupported) {
|
|
|
_this.dispose();
|
|
|
return;
|
|
@@ -88691,7 +88698,7 @@ var MultiRenderTarget = /** @class */ (function (_super) {
|
|
|
* Get if draw buffers are currently supported by the used hardware and browser.
|
|
|
*/
|
|
|
get: function () {
|
|
|
- return this._engine.webGLVersion > 1 || this._engine.getCaps().drawBuffersExtension;
|
|
|
+ return this._getEngine().webGLVersion > 1 || this._getEngine().getCaps().drawBuffersExtension;
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -88758,7 +88765,7 @@ var MultiRenderTarget = /** @class */ (function (_super) {
|
|
|
this._texture = this._internalTextures[0];
|
|
|
};
|
|
|
MultiRenderTarget.prototype._createInternalTextures = function () {
|
|
|
- this._internalTextures = this._engine.createMultipleRenderTarget(this._size, this._multiRenderTargetOptions);
|
|
|
+ this._internalTextures = this._getEngine().createMultipleRenderTarget(this._size, this._multiRenderTargetOptions);
|
|
|
};
|
|
|
MultiRenderTarget.prototype._createTextures = function () {
|
|
|
this._textures = [];
|
|
@@ -88781,7 +88788,7 @@ var MultiRenderTarget = /** @class */ (function (_super) {
|
|
|
if (this._samples === value) {
|
|
|
return;
|
|
|
}
|
|
|
- this._samples = this._engine.updateMultipleRenderTargetTextureSampleCount(this._internalTextures, value);
|
|
|
+ this._samples = this._getEngine().updateMultipleRenderTargetTextureSampleCount(this._internalTextures, value);
|
|
|
},
|
|
|
enumerable: true,
|
|
|
configurable: true
|
|
@@ -88994,7 +89001,6 @@ var RawTexture = /** @class */ (function (_super) {
|
|
|
if (type === void 0) { type = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_UNSIGNED_INT; }
|
|
|
var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
|
|
|
_this.format = format;
|
|
|
- _this._engine = scene.getEngine();
|
|
|
_this._texture = scene.getEngine().createRawTexture(data, width, height, format, generateMipMaps, invertY, samplingMode, null, type);
|
|
|
_this.wrapU = _texture__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
_this.wrapV = _texture__WEBPACK_IMPORTED_MODULE_1__["Texture"].CLAMP_ADDRESSMODE;
|
|
@@ -89005,7 +89011,7 @@ var RawTexture = /** @class */ (function (_super) {
|
|
|
* @param data Define the new data of the texture
|
|
|
*/
|
|
|
RawTexture.prototype.update = function (data) {
|
|
|
- this._engine.updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);
|
|
|
+ this._getEngine().updateRawTexture(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);
|
|
|
};
|
|
|
/**
|
|
|
* Creates a luminance texture from some data.
|
|
@@ -89167,7 +89173,6 @@ var RawTexture2DArray = /** @class */ (function (_super) {
|
|
|
if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_UNSIGNED_INT; }
|
|
|
var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
|
|
|
_this.format = format;
|
|
|
- _this._engine = scene.getEngine();
|
|
|
_this._texture = scene.getEngine().createRawTexture2DArray(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, null, textureType);
|
|
|
_this.is2DArray = true;
|
|
|
return _this;
|
|
@@ -89180,7 +89185,7 @@ var RawTexture2DArray = /** @class */ (function (_super) {
|
|
|
if (!this._texture) {
|
|
|
return;
|
|
|
}
|
|
|
- this._engine.updateRawTexture2DArray(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);
|
|
|
+ this._getEngine().updateRawTexture2DArray(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);
|
|
|
};
|
|
|
return RawTexture2DArray;
|
|
|
}(_texture__WEBPACK_IMPORTED_MODULE_1__["Texture"]));
|
|
@@ -89234,7 +89239,6 @@ var RawTexture3D = /** @class */ (function (_super) {
|
|
|
if (textureType === void 0) { textureType = _Engines_constants__WEBPACK_IMPORTED_MODULE_2__["Constants"].TEXTURETYPE_UNSIGNED_INT; }
|
|
|
var _this = _super.call(this, null, scene, !generateMipMaps, invertY) || this;
|
|
|
_this.format = format;
|
|
|
- _this._engine = scene.getEngine();
|
|
|
_this._texture = scene.getEngine().createRawTexture3D(data, width, height, depth, format, generateMipMaps, invertY, samplingMode, null, textureType);
|
|
|
_this.is3D = true;
|
|
|
return _this;
|
|
@@ -89247,7 +89251,7 @@ var RawTexture3D = /** @class */ (function (_super) {
|
|
|
if (!this._texture) {
|
|
|
return;
|
|
|
}
|
|
|
- this._engine.updateRawTexture3D(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);
|
|
|
+ this._getEngine().updateRawTexture3D(this._texture, data, this._texture.format, this._texture.invertY, null, this._texture.type);
|
|
|
};
|
|
|
return RawTexture3D;
|
|
|
}(_texture__WEBPACK_IMPORTED_MODULE_1__["Texture"]));
|
|
@@ -89494,7 +89498,6 @@ var RenderTargetTexture = /** @class */ (function (_super) {
|
|
|
return _this;
|
|
|
}
|
|
|
_this.renderList = new Array();
|
|
|
- _this._engine = scene.getEngine();
|
|
|
_this.name = name;
|
|
|
_this.isRenderTarget = true;
|
|
|
_this._initialSizeParameter = size;
|
|
@@ -89710,9 +89713,10 @@ var RenderTargetTexture = /** @class */ (function (_super) {
|
|
|
RenderTargetTexture.prototype._processSizeParameter = function (size) {
|
|
|
if (size.ratio) {
|
|
|
this._sizeRatio = size.ratio;
|
|
|
+ var engine = this._getEngine();
|
|
|
this._size = {
|
|
|
- width: this._bestReflectionRenderTargetDimension(this._engine.getRenderWidth(), this._sizeRatio),
|
|
|
- height: this._bestReflectionRenderTargetDimension(this._engine.getRenderHeight(), this._sizeRatio)
|
|
|
+ width: this._bestReflectionRenderTargetDimension(engine.getRenderWidth(), this._sizeRatio),
|
|
|
+ height: this._bestReflectionRenderTargetDimension(engine.getRenderHeight(), this._sizeRatio)
|
|
|
};
|
|
|
}
|
|
|
else {
|
|
@@ -90395,7 +90399,7 @@ var Texture = /** @class */ (function (_super) {
|
|
|
* This represents a texture in babylon. It can be easily loaded from a network, base64 or html input.
|
|
|
* @see http://doc.babylonjs.com/babylon101/materials#texture
|
|
|
* @param url defines the url of the picture to load as a texture
|
|
|
- * @param scene defines the scene or engine the texture will belong to
|
|
|
+ * @param sceneOrEngine defines the scene or engine the texture will belong to
|
|
|
* @param noMipmap defines if the texture will require mip maps or not
|
|
|
* @param invertY defines if the texture needs to be inverted on the y axis during loading
|
|
|
* @param samplingMode defines the sampling mode we want for the texture while fectching from it (Texture.NEAREST_SAMPLINGMODE...)
|
|
@@ -90414,7 +90418,7 @@ var Texture = /** @class */ (function (_super) {
|
|
|
if (onError === void 0) { onError = null; }
|
|
|
if (buffer === void 0) { buffer = null; }
|
|
|
if (deleteBuffer === void 0) { deleteBuffer = false; }
|
|
|
- var _this = _super.call(this, (sceneOrEngine && sceneOrEngine.getClassName() === "Scene") ? sceneOrEngine : null) || this;
|
|
|
+ var _this = _super.call(this, sceneOrEngine) || this;
|
|
|
/**
|
|
|
* Define the url of the texture.
|
|
|
*/
|
|
@@ -90514,7 +90518,7 @@ var Texture = /** @class */ (function (_super) {
|
|
|
_this._format = format;
|
|
|
}
|
|
|
var scene = _this.getScene();
|
|
|
- var engine = (sceneOrEngine && sceneOrEngine.getCaps) ? sceneOrEngine : (scene ? scene.getEngine() : null);
|
|
|
+ var engine = _this._getEngine();
|
|
|
if (!engine) {
|
|
|
return _this;
|
|
|
}
|
|
@@ -91187,7 +91191,7 @@ var VideoTexture = /** @class */ (function (_super) {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- if (!_this._engine.needPOTTextures ||
|
|
|
+ if (!_this._getEngine().needPOTTextures ||
|
|
|
(_Misc_tools__WEBPACK_IMPORTED_MODULE_2__["Tools"].IsExponentOfTwo(_this.video.videoWidth) && _Misc_tools__WEBPACK_IMPORTED_MODULE_2__["Tools"].IsExponentOfTwo(_this.video.videoHeight))) {
|
|
|
_this.wrapU = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__["Texture"].WRAP_ADDRESSMODE;
|
|
|
_this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__["Texture"].WRAP_ADDRESSMODE;
|
|
@@ -91197,7 +91201,7 @@ var VideoTexture = /** @class */ (function (_super) {
|
|
|
_this.wrapV = _Materials_Textures_texture__WEBPACK_IMPORTED_MODULE_4__["Texture"].CLAMP_ADDRESSMODE;
|
|
|
_this._generateMipMaps = false;
|
|
|
}
|
|
|
- _this._texture = _this._engine.createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this.samplingMode);
|
|
|
+ _this._texture = _this._getEngine().createDynamicTexture(_this.video.videoWidth, _this.video.videoHeight, _this._generateMipMaps, _this.samplingMode);
|
|
|
if (!_this.video.autoplay && !_this._settings.poster) {
|
|
|
var oldHandler_1 = _this.video.onplaying;
|
|
|
var error_1 = false;
|
|
@@ -91269,9 +91273,8 @@ var VideoTexture = /** @class */ (function (_super) {
|
|
|
return;
|
|
|
}
|
|
|
_this._frameId = frameId;
|
|
|
- _this._engine.updateVideoTexture(_this._texture, _this.video, _this._invertY);
|
|
|
+ _this._getEngine().updateVideoTexture(_this._texture, _this.video, _this._invertY);
|
|
|
};
|
|
|
- _this._engine = _this.getScene().getEngine();
|
|
|
_this._generateMipMaps = generateMipMaps;
|
|
|
_this._initialSamplingMode = samplingMode;
|
|
|
_this.autoUpdateTexture = settings.autoUpdateTexture;
|
|
@@ -91297,7 +91300,7 @@ var VideoTexture = /** @class */ (function (_super) {
|
|
|
var videoHasEnoughData = (_this.video.readyState >= _this.video.HAVE_CURRENT_DATA);
|
|
|
if (settings.poster &&
|
|
|
(!settings.autoPlay || !videoHasEnoughData)) {
|
|
|
- _this._texture = _this._engine.createTexture(settings.poster, false, !_this.invertY, scene);
|
|
|
+ _this._texture = _this._getEngine().createTexture(settings.poster, false, !_this.invertY, scene);
|
|
|
_this._displayingPosterTexture = true;
|
|
|
}
|
|
|
else if (videoHasEnoughData) {
|
|
@@ -133001,9 +133004,11 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
/* harmony import */ var _PostProcesses_postProcess__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../PostProcesses/postProcess */ "./PostProcesses/postProcess.ts");
|
|
|
/* harmony import */ var _Misc_logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../Misc/logger */ "./Misc/logger.ts");
|
|
|
/* harmony import */ var _Engines_Extensions_engine_renderTargetCube__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../Engines/Extensions/engine.renderTargetCube */ "./Engines/Extensions/engine.renderTargetCube.ts");
|
|
|
-/* harmony import */ var _Materials_Textures_baseTexture_polynomial__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Materials/Textures/baseTexture.polynomial */ "./Materials/Textures/baseTexture.polynomial.ts");
|
|
|
-/* harmony import */ var _Shaders_rgbdEncode_fragment__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Shaders/rgbdEncode.fragment */ "./Shaders/rgbdEncode.fragment.ts");
|
|
|
-/* harmony import */ var _Shaders_rgbdDecode_fragment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Shaders/rgbdDecode.fragment */ "./Shaders/rgbdDecode.fragment.ts");
|
|
|
+/* harmony import */ var _Engines_Extensions_engine_readTexture__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../Engines/Extensions/engine.readTexture */ "./Engines/Extensions/engine.readTexture.ts");
|
|
|
+/* harmony import */ var _Materials_Textures_baseTexture_polynomial__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../Materials/Textures/baseTexture.polynomial */ "./Materials/Textures/baseTexture.polynomial.ts");
|
|
|
+/* harmony import */ var _Shaders_rgbdEncode_fragment__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../Shaders/rgbdEncode.fragment */ "./Shaders/rgbdEncode.fragment.ts");
|
|
|
+/* harmony import */ var _Shaders_rgbdDecode_fragment__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../Shaders/rgbdDecode.fragment */ "./Shaders/rgbdDecode.fragment.ts");
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
@@ -133066,9 +133071,6 @@ var EnvironmentTextureTools = /** @class */ (function () {
|
|
|
if (!internalTexture) {
|
|
|
return Promise.reject("The cube texture is invalid.");
|
|
|
}
|
|
|
- if (!texture._prefiltered) {
|
|
|
- return Promise.reject("The cube texture is invalid (not prefiltered).");
|
|
|
- }
|
|
|
var engine = internalTexture.getEngine();
|
|
|
if (engine && engine.premultipliedAlpha) {
|
|
|
return Promise.reject("Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.");
|