|
@@ -332,7 +332,7 @@
|
|
|
}
|
|
|
|
|
|
private static _ExtractLongWordOrder(value: number): number {
|
|
|
- if (value === 0 ||value === 255 || value === -16777216) {
|
|
|
+ if (value === 0 || value === 255 || value === -16777216) {
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -373,8 +373,8 @@
|
|
|
}
|
|
|
|
|
|
public static UploadDDSLevels(engine: Engine, gl: WebGLRenderingContext, arrayBuffer: any, info: DDSInfo, loadMipmaps: boolean, faces: number, lodIndex = -1, currentFace?: number) {
|
|
|
- var sphericalPolynomialFaces:Nullable<Array<ArrayBufferView>> = null;
|
|
|
- if(info.sphericalPolynomial){
|
|
|
+ var sphericalPolynomialFaces: Nullable<Array<ArrayBufferView>> = null;
|
|
|
+ if (info.sphericalPolynomial) {
|
|
|
sphericalPolynomialFaces = new Array<ArrayBufferView>();
|
|
|
}
|
|
|
var ext = engine.getCaps().s3tc;
|
|
@@ -457,7 +457,7 @@
|
|
|
let rOffset = DDSTools._ExtractLongWordOrder(header[off_RMask]);
|
|
|
let gOffset = DDSTools._ExtractLongWordOrder(header[off_GMask]);
|
|
|
let bOffset = DDSTools._ExtractLongWordOrder(header[off_BMask]);
|
|
|
- let aOffset = DDSTools._ExtractLongWordOrder(header[off_AMask]);
|
|
|
+ let aOffset = DDSTools._ExtractLongWordOrder(header[off_AMask]);
|
|
|
|
|
|
if (computeFormats) {
|
|
|
format = engine._getWebGLTextureType(info.textureType);
|
|
@@ -487,13 +487,13 @@
|
|
|
if (engine._badOS || engine._badDesktopOS || (!engine.getCaps().textureHalfFloat && !engine.getCaps().textureFloat)) { // Required because iOS has many issues with float and half float generation
|
|
|
if (bpp === 128) {
|
|
|
floatArray = DDSTools._GetFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
|
|
|
- if(sphericalPolynomialFaces && i == 0){
|
|
|
+ if (sphericalPolynomialFaces && i == 0) {
|
|
|
sphericalPolynomialFaces.push(DDSTools._GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));
|
|
|
}
|
|
|
}
|
|
|
else if (bpp === 64) {
|
|
|
floatArray = DDSTools._GetHalfFloatAsUIntRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
|
|
|
- if(sphericalPolynomialFaces && i == 0){
|
|
|
+ if (sphericalPolynomialFaces && i == 0) {
|
|
|
sphericalPolynomialFaces.push(DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));
|
|
|
}
|
|
|
}
|
|
@@ -505,12 +505,12 @@
|
|
|
else {
|
|
|
if (bpp === 128) {
|
|
|
floatArray = DDSTools._GetFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
|
|
|
- if(sphericalPolynomialFaces && i == 0){
|
|
|
+ if (sphericalPolynomialFaces && i == 0) {
|
|
|
sphericalPolynomialFaces.push(floatArray);
|
|
|
}
|
|
|
} else if (bpp === 64 && !engine.getCaps().textureHalfFloat) {
|
|
|
floatArray = DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
|
|
|
- if(sphericalPolynomialFaces && i == 0){
|
|
|
+ if (sphericalPolynomialFaces && i == 0) {
|
|
|
sphericalPolynomialFaces.push(floatArray);
|
|
|
}
|
|
|
|
|
@@ -519,7 +519,7 @@
|
|
|
internalFormat = engine._getRGBABufferInternalSizedFormat(info.textureType);
|
|
|
} else { // 64
|
|
|
floatArray = DDSTools._GetHalfFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i);
|
|
|
- if(sphericalPolynomialFaces && i == 0){
|
|
|
+ if (sphericalPolynomialFaces && i == 0) {
|
|
|
sphericalPolynomialFaces.push(DDSTools._GetHalfFloatAsFloatRGBAArrayBuffer(width, height, dataOffset, dataLength, arrayBuffer, i));
|
|
|
}
|
|
|
}
|
|
@@ -565,7 +565,7 @@
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- if(sphericalPolynomialFaces){
|
|
|
+ if (sphericalPolynomialFaces && sphericalPolynomialFaces.length > 0) {
|
|
|
info.sphericalPolynomial = CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial({
|
|
|
size: header[off_width],
|
|
|
right: sphericalPolynomialFaces[0],
|
|
@@ -578,6 +578,8 @@
|
|
|
type: Engine.TEXTURETYPE_FLOAT,
|
|
|
gammaSpace: false,
|
|
|
});
|
|
|
+ } else {
|
|
|
+ info.sphericalPolynomial = undefined;
|
|
|
}
|
|
|
}
|
|
|
}
|