|
@@ -3213,6 +3213,34 @@ export class ThinEngine {
|
|
|
gl.texImage2D(target, lod, internalFormat, width, height, 0, format, textureType, imageData);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * Update a portion of an internal texture
|
|
|
+ * @param texture defines the texture to update
|
|
|
+ * @param imageData defines the data to store into the texture
|
|
|
+ * @param xOffset defines the x coordinates of the update rectangle
|
|
|
+ * @param yOffset defines the y coordinates of the update rectangle
|
|
|
+ * @param width defines the width of the update rectangle
|
|
|
+ * @param height defines the height of the update rectangle
|
|
|
+ * @param faceIndex defines the face index if texture is a cube (0 by default)
|
|
|
+ * @param lod defines the lod level to update (0 by default)
|
|
|
+ */
|
|
|
+ public updateTextureData(texture: InternalTexture, imageData: ArrayBufferView, xOffset: number, yOffset: number, width: number, height: number, faceIndex: number = 0, lod: number = 0): void {
|
|
|
+ var gl = this._gl;
|
|
|
+
|
|
|
+ var textureType = this._getWebGLTextureType(texture.type);
|
|
|
+ var format = this._getInternalFormat(texture.format);
|
|
|
+
|
|
|
+ this._unpackFlipY(texture.invertY);
|
|
|
+
|
|
|
+ var target = gl.TEXTURE_2D;
|
|
|
+ if (texture.isCube) {
|
|
|
+ target = gl.TEXTURE_CUBE_MAP_POSITIVE_X + faceIndex;
|
|
|
+ }
|
|
|
+
|
|
|
+ gl.texSubImage2D(target, lod, xOffset, yOffset, width, height, format, textureType, imageData);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
/** @hidden */
|
|
|
public _uploadArrayBufferViewToTexture(texture: InternalTexture, imageData: ArrayBufferView, faceIndex: number = 0, lod: number = 0): void {
|
|
|
var gl = this._gl;
|