Minor code cleanup to filaweb.

This commit is contained in:
prideout
2018-08-28 16:12:56 -07:00
parent fa9f597ca4
commit 86e7afecea
2 changed files with 12 additions and 30 deletions

View File

@@ -76,12 +76,9 @@ add_custom_command(
MAIN_DEPENDENCY ${source_mesh}
DEPENDS filamesh)
# Next build two cubemaps: (1) a single miplevel of a slightly large blurry PNG for the skybox, and
# (2) all miplevels for an RGBM (which is PNG in disguise) for the IBL.
# TODO: invoke cmgen only once and simply use RGBM everywhere. The only reason we're using PNG for
# the skybox is to work around an RGBM coloration issue, probably something wrong in how we're
# decoding the alpha channel for images in the web app.
# Next build two cubemaps:
# (1) single miplevel of blurry skybox (png)
# (2) all miplevels for the IBL (rgbm)
set(source_envmap "${CMAKE_CURRENT_SOURCE_DIR}/../../assets/environments/desert/desert.exr")

View File

@@ -79,7 +79,8 @@ function load_texture(url) {
context2d.canvas.width = img.width;
context2d.canvas.height = img.height;
context2d.width = img.width;
context2d.height = img.height;
context2d.height = img.height
context2d.globalCompositeOperation = 'copy';
context2d.drawImage(img, 0, 0);
var imgdata = context2d.getImageData(0, 0, img.width, img.height).data.buffer;
success({
@@ -99,31 +100,15 @@ function load_cubemap(urlprefix, nmips) {
let name = '';
promises['sh.txt'] = load_rawfile(urlprefix + 'sh.txt');
for (let i = 0; i < nmips; i++) {
name = 'm' + i + '_px.rgbm';
promises[name] = load_texture(urlprefix + name);
name = 'm' + i + '_nx.rgbm';
promises[name] = load_texture(urlprefix + name);
name = 'm' + i + '_py.rgbm';
promises[name] = load_texture(urlprefix + name);
name = 'm' + i + '_ny.rgbm';
promises[name] = load_texture(urlprefix + name);
name = 'm' + i + '_pz.rgbm';
promises[name] = load_texture(urlprefix + name);
name = 'm' + i + '_nz.rgbm';
for (let face of 'px nx py ny pz nz'.split(' ')) {
name = 'm' + i + '_' + face + '.rgbm';
promises[name] = load_texture(urlprefix + name);
}
}
for (let face of 'px nx py ny pz nz'.split(' ')) {
name = face + '.png';
promises[name] = load_texture(urlprefix + name);
}
name = 'px.png';
promises[name] = load_texture(urlprefix + name);
name = 'nx.png';
promises[name] = load_texture(urlprefix + name);
name = 'py.png';
promises[name] = load_texture(urlprefix + name);
name = 'ny.png';
promises[name] = load_texture(urlprefix + name);
name = 'pz.png';
promises[name] = load_texture(urlprefix + name);
name = 'nz.png';
promises[name] = load_texture(urlprefix + name);
let numberRemaining = Object.keys(promises).length;
var promise = new Promise((success) => {
for (let name in promises) {