|
@@ -25,7 +25,7 @@
|
|
return count;
|
|
return count;
|
|
};
|
|
};
|
|
|
|
|
|
- var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, processFunction) {
|
|
|
|
|
|
+ var prepareWebGLTexture = function (texture, gl, scene, width, height, invertY, noMipmap, isCompressed, processFunction) {
|
|
var engine = scene.getEngine();
|
|
var engine = scene.getEngine();
|
|
var potWidth = getExponantOfTwo(width, engine.getCaps().maxTextureSize);
|
|
var potWidth = getExponantOfTwo(width, engine.getCaps().maxTextureSize);
|
|
var potHeight = getExponantOfTwo(height, engine.getCaps().maxTextureSize);
|
|
var potHeight = getExponantOfTwo(height, engine.getCaps().maxTextureSize);
|
|
@@ -41,7 +41,10 @@
|
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR);
|
|
} else {
|
|
} else {
|
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
|
|
gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, gl.LINEAR_MIPMAP_LINEAR);
|
|
- gl.generateMipmap(gl.TEXTURE_2D);
|
|
|
|
|
|
+
|
|
|
|
+ if (!isCompressed) {
|
|
|
|
+ gl.generateMipmap(gl.TEXTURE_2D);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
gl.bindTexture(gl.TEXTURE_2D, null);
|
|
|
|
|
|
@@ -498,8 +501,6 @@
|
|
|
|
|
|
Engine.prototype.draw = function (useTriangles, indexStart, indexCount) {
|
|
Engine.prototype.draw = function (useTriangles, indexStart, indexCount) {
|
|
this._gl.drawElements(useTriangles ? this._gl.TRIANGLES : this._gl.LINES, indexCount, this._gl.UNSIGNED_SHORT, indexStart * 2);
|
|
this._gl.drawElements(useTriangles ? this._gl.TRIANGLES : this._gl.LINES, indexCount, this._gl.UNSIGNED_SHORT, indexStart * 2);
|
|
-
|
|
|
|
- this._gl.getError();
|
|
|
|
};
|
|
};
|
|
|
|
|
|
// Shaders
|
|
// Shaders
|
|
@@ -763,13 +764,13 @@
|
|
|
|
|
|
var loadMipmap = info.mipmapCount > 1 && !noMipmap;
|
|
var loadMipmap = info.mipmapCount > 1 && !noMipmap;
|
|
|
|
|
|
- prepareWebGLTexture(texture, _this._gl, scene, info.width, info.height, invertY, !loadMipmap, function () {
|
|
|
|
|
|
+ prepareWebGLTexture(texture, _this._gl, scene, info.width, info.height, invertY, !loadMipmap, true, function () {
|
|
BABYLON.Internals.DDSTools.UploadDDSLevels(_this._gl, _this.getCaps().s3tc, data, loadMipmap);
|
|
BABYLON.Internals.DDSTools.UploadDDSLevels(_this._gl, _this.getCaps().s3tc, data, loadMipmap);
|
|
});
|
|
});
|
|
}, null, scene.database, true);
|
|
}, null, scene.database, true);
|
|
} else {
|
|
} else {
|
|
var onload = function (img) {
|
|
var onload = function (img) {
|
|
- prepareWebGLTexture(texture, _this._gl, scene, img.width, img.height, invertY, noMipmap, function (potWidth, potHeight) {
|
|
|
|
|
|
+ prepareWebGLTexture(texture, _this._gl, scene, img.width, img.height, invertY, noMipmap, false, function (potWidth, potHeight) {
|
|
var isPot = (img.width == potWidth && img.height == potHeight);
|
|
var isPot = (img.width == potWidth && img.height == potHeight);
|
|
if (!isPot) {
|
|
if (!isPot) {
|
|
_this._workingCanvas.width = potWidth;
|
|
_this._workingCanvas.width = potWidth;
|
|
@@ -1145,6 +1146,8 @@
|
|
|
|
|
|
// Dispose
|
|
// Dispose
|
|
Engine.prototype.dispose = function () {
|
|
Engine.prototype.dispose = function () {
|
|
|
|
+ this.stopRenderLoop();
|
|
|
|
+
|
|
while (this.scenes.length) {
|
|
while (this.scenes.length) {
|
|
this.scenes[0].dispose();
|
|
this.scenes[0].dispose();
|
|
}
|
|
}
|