Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonDanisch committed Oct 13, 2023
1 parent bc6e4e8 commit 4829984
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 5 deletions.
13 changes: 10 additions & 3 deletions WGLMakie/src/Serialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ function convert_RGB_to_RGBA(rgbArray) {
return rgbaArray;
}


function create_texture(data) {
const buffer = data.data;
if (data.size.length == 3) {
Expand All @@ -267,16 +268,22 @@ function create_texture(data) {
return tex;
} else {
// a little optimization to not send the texture atlas over & over again
let tex_data =
buffer == "texture_atlas" ? TEXTURE_ATLAS[0].value : buffer;
let tex_data;
if (buffer == "texture_atlas") {
tex_data = TEXTURE_ATLAS[0].value;
} else {
tex_data = buffer;
}
let format = THREE[data.three_format];
if (data.three_format == "RGBFormat") {
tex_data = convert_RGB_to_RGBA(tex_data);
format = THREE.RGBAFormat;
}
return new THREE.DataTexture(
tex_data,
data.size[0],
data.size[1],
THREE.RGBAFormat,
format,
THREE[data.three_type]
);
}
Expand Down
11 changes: 9 additions & 2 deletions WGLMakie/src/wglmakie.bundled.js
Original file line number Diff line number Diff line change
Expand Up @@ -20680,11 +20680,18 @@ function create_texture(data) {
tex.type = mod[data.three_type];
return tex;
} else {
let tex_data = buffer == "texture_atlas" ? TEXTURE_ATLAS[0].value : buffer;
let tex_data;
if (buffer == "texture_atlas") {
tex_data = TEXTURE_ATLAS[0].value;
} else {
tex_data = buffer;
}
let format = mod[data.three_format];
if (data.three_format == "RGBFormat") {
tex_data = convert_RGB_to_RGBA(tex_data);
format = mod.RGBAFormat;
}
return new mod.DataTexture(tex_data, data.size[0], data.size[1], mod.RGBAFormat, mod[data.three_type]);
return new mod.DataTexture(tex_data, data.size[0], data.size[1], format, mod[data.three_type]);
}
}
function re_create_texture(old_texture, buffer, size) {
Expand Down

0 comments on commit 4829984

Please sign in to comment.