Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change to read compressed cube Texture #4586

Merged
merged 1 commit into from Jun 21, 2018
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.
+3 −3
Diff settings

Always

Just for now

Change to read compressed cube Texture

  • Loading branch information...
Kalpesh Deepak
Kalpesh Deepak committed Jun 21, 2018
commit 6d89229a7b7c4aac68d51728b852097f540af700
@@ -125,13 +125,13 @@ module BABYLON {
var mipmapCount = loadMipmaps ? this.numberOfMipmapLevels : 1;
for (var level = 0; level < mipmapCount; level++) {
var imageSize = new Int32Array(this.arrayBuffer, dataOffset, 1)[0]; // size per face, since not supporting array cubemaps

dataOffset += 4;//image data starts from next multiple of 4 offset. Each face refers to same imagesize field above.
for (var face = 0; face < this.numberOfFaces; face++) {
var sampler = this.numberOfFaces === 1 ? gl.TEXTURE_2D : (gl.TEXTURE_CUBE_MAP_POSITIVE_X + face);
var byteArray = new Uint8Array(this.arrayBuffer, dataOffset + 4, imageSize);
var byteArray = new Uint8Array(this.arrayBuffer, dataOffset, imageSize);
gl.compressedTexImage2D(sampler, level, this.glInternalFormat, width, height, 0, byteArray);

dataOffset += imageSize + 4; // size of the image + 4 for the imageSize field
dataOffset += imageSize; // add size of the image for the next face/mipmap
dataOffset += 3 - ((imageSize + 3) % 4); // add padding for odd sized image
}
width = Math.max(1.0, width * 0.5);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.