mirror of
https://github.com/LucasDower/ObjToSchematic.git
synced 2025-04-12 15:00:22 +08:00
Removed legacy files, renamed tools
to scripts
This commit is contained in:
parent
64b8410aff
commit
b2155aab78
@ -1,37 +0,0 @@
|
||||
import { PALETTE_ALL_RELEASE } from '../../Editor/res/palettes/all';
|
||||
import { Vector3 } from '../src/vector';
|
||||
import { THeadlessConfig } from './headless';
|
||||
|
||||
export const headlessConfig: THeadlessConfig = {
|
||||
import: {
|
||||
file: new File([], '/Users/lucasdower/ObjToSchematic/res/samples/skull.obj'),
|
||||
rotation: new Vector3(0, 0, 0),
|
||||
},
|
||||
voxelise: {
|
||||
constraintAxis: 'y',
|
||||
size: 80,
|
||||
useMultisampleColouring: false,
|
||||
voxelOverlapRule: 'average',
|
||||
enableAmbientOcclusion: false, // Only want true if exporting to .obj
|
||||
},
|
||||
assign: {
|
||||
blockPalette: new Set(PALETTE_ALL_RELEASE), // Must be a palette name that exists in /resources/palettes
|
||||
dithering: 'ordered',
|
||||
ditheringMagnitude: 32,
|
||||
fallable: 'replace-falling',
|
||||
resolution: 32,
|
||||
calculateLighting: false,
|
||||
lightThreshold: 0,
|
||||
contextualAveraging: true,
|
||||
errorWeight: 0.0,
|
||||
atlasJSON: undefined,
|
||||
},
|
||||
export: {
|
||||
exporter: 'litematic', // 'schematic' / 'litematic',
|
||||
},
|
||||
debug: {
|
||||
showLogs: true,
|
||||
showWarnings: true,
|
||||
showTimings: true,
|
||||
},
|
||||
};
|
@ -1,74 +0,0 @@
|
||||
import { StatusHandler } from '../../Editor/src/status';
|
||||
import { LOG_MAJOR, Logger, TIME_END, TIME_START } from '../src/util/log_util';
|
||||
import { WorkerClient } from '../../Editor/src/worker/worker_client';
|
||||
import { AssignParams, ExportParams, ImportParams, VoxeliseParams } from '../../Editor/src/worker/worker_types';
|
||||
|
||||
export type THeadlessConfig = {
|
||||
import: ImportParams.Input,
|
||||
voxelise: VoxeliseParams.Input,
|
||||
assign: AssignParams.Input,
|
||||
export: ExportParams.Input,
|
||||
debug: {
|
||||
showLogs: boolean,
|
||||
showWarnings: boolean,
|
||||
showTimings: boolean,
|
||||
}
|
||||
}
|
||||
|
||||
export function runHeadless(headlessConfig: THeadlessConfig) {
|
||||
if (headlessConfig.debug.showLogs) {
|
||||
Logger.Get.enableLOGMAJOR();
|
||||
}
|
||||
if (headlessConfig.debug.showWarnings) {
|
||||
Logger.Get.enableLOGWARN();
|
||||
}
|
||||
if (headlessConfig.debug.showTimings) {
|
||||
Logger.Get.enableLOGTIME();
|
||||
}
|
||||
|
||||
const worker = WorkerClient.Get;
|
||||
{
|
||||
TIME_START('[TIMER] Importer');
|
||||
LOG_MAJOR('\nImporting...');
|
||||
worker.import(headlessConfig.import);
|
||||
StatusHandler.Get.dump().clear();
|
||||
TIME_END('[TIMER] Importer');
|
||||
}
|
||||
{
|
||||
TIME_START('[TIMER] Voxeliser');
|
||||
LOG_MAJOR('\nVoxelising...');
|
||||
worker.voxelise(headlessConfig.voxelise);
|
||||
StatusHandler.Get.dump().clear();
|
||||
TIME_END('[TIMER] Voxeliser');
|
||||
}
|
||||
{
|
||||
TIME_START('[TIMER] Assigner');
|
||||
LOG_MAJOR('\nAssigning...');
|
||||
worker.assign(headlessConfig.assign);
|
||||
StatusHandler.Get.dump().clear();
|
||||
TIME_END('[TIMER] Assigner');
|
||||
}
|
||||
{
|
||||
TIME_START('[TIMER] Exporter');
|
||||
LOG_MAJOR('\nExporting...');
|
||||
|
||||
/**
|
||||
* The OBJExporter is unique in that it uses the actual render buffer used by WebGL
|
||||
* to create its data, in headless mode this render buffer is not created so we must
|
||||
* generate it manually
|
||||
*/
|
||||
{
|
||||
let result;
|
||||
do {
|
||||
result = worker.renderChunkedVoxelMesh({
|
||||
enableAmbientOcclusion: headlessConfig.voxelise.enableAmbientOcclusion,
|
||||
desiredHeight: headlessConfig.voxelise.size,
|
||||
});
|
||||
} while (result.moreVoxelsToBuffer);
|
||||
}
|
||||
|
||||
worker.export(headlessConfig.export);
|
||||
StatusHandler.Get.dump().clear();
|
||||
TIME_END('[TIMER] Exporter');
|
||||
}
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
structure_block.json
|
||||
structure_block_data.json
|
||||
structure_block_save.json
|
||||
structure_void.json
|
||||
structure_block_corner.json
|
||||
structure_block_load.json
|
||||
spawner.json
|
||||
brown_mushroom_block_inventory.json
|
||||
red_mushroom_block_inventory.json
|
||||
mushroom_stem_inventory.json
|
||||
redstone_lamp_on.json
|
||||
piston_inventory.json
|
||||
sticky_piston_inventory.json
|
||||
barrel_open.json
|
||||
respawn_anchor_0.json
|
||||
respawn_anchor_1.json
|
||||
respawn_anchor_2.json
|
||||
respawn_anchor_3.json
|
||||
respawn_anchor_4.json
|
||||
sculk_catalyst.json
|
||||
sculk_catalyst_bloom.json
|
||||
tnt.json
|
||||
grass_block_snow.json
|
||||
acacia_leaves.json
|
||||
azalea_leaves.json
|
||||
birch_leaves.json
|
||||
dark_oak_leaves.json
|
||||
flowering_azalea_leaves.json
|
||||
jungle_leaves.json
|
||||
mangrove_leaves.json
|
||||
oak_leaves.json
|
||||
spruce_leaves.json
|
@ -1,12 +0,0 @@
|
||||
import { LOG_MAJOR } from '../src/util/log_util';
|
||||
import { AppPaths, PathUtil } from '../src/util/path_util';
|
||||
import { runHeadless } from './headless';
|
||||
import { headlessConfig } from './headless-config';
|
||||
|
||||
void async function main() {
|
||||
AppPaths.Get.setBaseDir(PathUtil.join(__dirname, '../..'));
|
||||
|
||||
runHeadless(headlessConfig);
|
||||
|
||||
LOG_MAJOR('\nFinished!');
|
||||
}();
|
Loading…
x
Reference in New Issue
Block a user