forked from mirror/ObjToSchematic
Removed various status handling to future rework
This commit is contained in:
parent
ec3743a4c9
commit
66d9619b9b
@ -3,7 +3,6 @@ import * as twgl from 'twgl.js';
|
||||
import { Bounds } from './bounds';
|
||||
import { RGBA } from '../runtime/colour';
|
||||
import { Mesh } from './mesh';
|
||||
import { AttributeData, MergeAttributeData, RenderBuffer } from '../editor/renderer/render_buffer';
|
||||
import { Triangle, UVTriangle } from './triangle';
|
||||
import { ASSERT } from './util/error_util';
|
||||
import { Vector3 } from './vector';
|
||||
|
@ -2,9 +2,7 @@ import { parse } from '@loaders.gl/core';
|
||||
import { GLTFLoader } from '@loaders.gl/gltf';
|
||||
|
||||
import { RGBAColours, RGBAUtil } from '../colour';
|
||||
import { LOC } from '../../editor/localiser';
|
||||
import { MaterialMap, MaterialType, Mesh, Tri } from '../mesh';
|
||||
import { StatusHandler } from '../../editor/status';
|
||||
import { UV } from '../util';
|
||||
import { Vector3 } from '../vector';
|
||||
import { IImporter } from './base_importer';
|
||||
@ -24,7 +22,8 @@ export class GltfImporterError extends Error {
|
||||
|
||||
export class GltfLoader extends IImporter {
|
||||
public override async import(file: File): Promise<Mesh> {
|
||||
StatusHandler.warning(LOC('import.gltf_experimental'));
|
||||
// TODO: StatusRework
|
||||
//StatusHandler.warning(LOC('import.gltf_experimental'));
|
||||
|
||||
let gltf;
|
||||
try {
|
||||
@ -99,7 +98,8 @@ export class GltfLoader extends IImporter {
|
||||
|
||||
try {
|
||||
if (mimeType !== 'image/png' && mimeType !== 'image/jpeg') {
|
||||
StatusHandler.warning(LOC('import.unsupported_image_type', { file_name: diffuseTexture.texture.source.id, file_type: mimeType }));
|
||||
// TODO: StatusRework
|
||||
//StatusHandler.warning(LOC('import.unsupported_image_type', { file_name: diffuseTexture.texture.source.id, file_type: mimeType }));
|
||||
throw new GltfImporterError({ type: 'unsupported-image-format' })
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { ProgressManager } from '../../editor/progress';
|
||||
import { anyNaN } from '../math';
|
||||
import { Mesh, Tri } from '../mesh';
|
||||
import { UV } from '../util';
|
||||
@ -233,14 +232,16 @@ export class ObjImporter extends IImporter {
|
||||
const fileLines = fileSource.split(/\r?\n/);
|
||||
const numLines = fileLines.length;
|
||||
|
||||
const progressHandle = ProgressManager.Get.start('VoxelMeshBuffer');
|
||||
// TODO: ProgressRework
|
||||
//const progressHandle = ProgressManager.Get.start('VoxelMeshBuffer');
|
||||
fileLines.forEach((line, index) => {
|
||||
const { err } = this.parseOBJLine(line);
|
||||
const { err } = this.parseOBJLine(line);
|
||||
if (err !== null) {
|
||||
throw new ObjImporterError(err);
|
||||
}
|
||||
ProgressManager.Get.progress(progressHandle, index / numLines);
|
||||
})
|
||||
//ProgressManager.Get.progress(progressHandle, index / numLines);
|
||||
});
|
||||
// BUG: Maybe end the progress??? Regression?
|
||||
|
||||
return new Mesh(this._vertices, this._normals, this._uvs, this._tris, new Map());
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
import { Bounds } from './bounds';
|
||||
import { RGBA, RGBAUtil } from '../runtime/colour';
|
||||
import { LOC } from '../editor/localiser';
|
||||
import { degreesToRadians } from './math';
|
||||
import { StatusHandler } from '../editor/status';
|
||||
import { Texture, TImageRawWrap, TTransparencyOptions } from './texture';
|
||||
import { Triangle, UVTriangle } from './triangle';
|
||||
import { getRandomID, UV } from './util';
|
||||
@ -164,11 +162,15 @@ export class Mesh {
|
||||
return 'no-triangles-loaded';
|
||||
}
|
||||
|
||||
// TODO: StatusRework
|
||||
/*
|
||||
if (this._tris.length >= 100_000) {
|
||||
StatusHandler.warning(LOC('import.too_many_triangles', { count: this._tris.length }));
|
||||
}
|
||||
*/
|
||||
|
||||
StatusHandler.info(LOC('import.vertex_triangle_count', { vertex_count: this._vertices.length, triangle_count: this._tris.length }));
|
||||
// TODO: StatusRework
|
||||
//StatusHandler.info(LOC('import.vertex_triangle_count', { vertex_count: this._vertices.length, triangle_count: this._tris.length }));
|
||||
|
||||
// Give warning if normals are not defined
|
||||
let giveNormalsWarning = false;
|
||||
@ -188,9 +190,13 @@ export class Mesh {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: StatusRework
|
||||
/*
|
||||
if (giveNormalsWarning) {
|
||||
StatusHandler.warning(LOC('import.missing_normals'));
|
||||
};
|
||||
*/
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { AppConfig } from '../editor/config';
|
||||
import { ASSERT } from './util/error_util';
|
||||
import { Vector3 } from './vector';
|
||||
import { VoxelMesh } from './voxel_mesh';
|
||||
@ -51,7 +50,8 @@ export class OcclusionManager {
|
||||
// If both edge blocks along this vertex exist,
|
||||
// assume corner exists (even if it doesnt)
|
||||
// (This is a stylistic choice)
|
||||
if (numNeighbours == 2 && AppConfig.Get.AMBIENT_OCCLUSION_OVERRIDE_CORNER) {
|
||||
//if (numNeighbours == 2 && AppConfig.Get.AMBIENT_OCCLUSION_OVERRIDE_CORNER) {
|
||||
if (numNeighbours == 2) {
|
||||
++numNeighbours;
|
||||
} else {
|
||||
const neighbourIndex = this._occlusionNeighboursIndices[this._getOcclusionMapIndex(f, v, 2)];
|
||||
|
@ -2,11 +2,9 @@ import { PALETTE_ALL_RELEASE } from '../../res/palettes/all';
|
||||
import { PALETTE_COLOURFUL } from '../../res/palettes/colourful';
|
||||
import { PALETTE_GREYSCALE } from '../../res/palettes/greyscale';
|
||||
import { PALETTE_SCHEMATIC_FRIENDLY } from '../../res/palettes/schematic-friendly';
|
||||
|
||||
import { Atlas } from '../runtime/atlas';
|
||||
import { LOC } from '../editor/localiser';
|
||||
import { StatusHandler } from '../editor/status';
|
||||
import { AppTypes, AppUtil, TOptional } from './util';
|
||||
import { LOG_WARN } from './util/log_util';
|
||||
import { AppPaths, PathUtil } from './util/path_util';
|
||||
|
||||
export type TPalettes = 'all' | 'colourful' | 'greyscale' | 'schematic-friendly';
|
||||
@ -161,10 +159,13 @@ export class Palette {
|
||||
}
|
||||
}
|
||||
|
||||
// This shouldn't happen with future changes anyway
|
||||
/*
|
||||
if (missingBlocks.length > 0) {
|
||||
StatusHandler.warning(LOC('assign.blocks_missing_textures', { count: missingBlocks }));
|
||||
LOG_WARN('Blocks missing atlas textures', missingBlocks);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
private static _isValidPaletteName(paletteName: string): boolean {
|
||||
|
@ -2,7 +2,6 @@ import * as jpeg from 'jpeg-js';
|
||||
import { PNG } from 'pngjs';
|
||||
|
||||
import { RGBA, RGBAColours, RGBAUtil } from '../runtime/colour';
|
||||
import { AppConfig } from '../editor/config';
|
||||
import { clamp } from './math';
|
||||
import { TOptional, UV } from './util';
|
||||
import { ASSERT } from './util/error_util';
|
||||
@ -77,7 +76,7 @@ export class Texture {
|
||||
const jpg = params.raw.split(',')[1];
|
||||
if (jpg !== undefined) {
|
||||
return jpeg.decode(Buffer.from(jpg, 'base64'), {
|
||||
maxMemoryUsageInMB: AppConfig.Get.MAXIMUM_IMAGE_MEM_ALLOC,
|
||||
maxMemoryUsageInMB: 2048, //AppConfig.Get.MAXIMUM_IMAGE_MEM_ALLOC,
|
||||
formatAsRGBA: true,
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user