More fixes for web version

This commit is contained in:
Lucas Dower 2023-02-11 21:29:36 +00:00
parent aca30d1f11
commit f27ad6bd1f
No known key found for this signature in database
GPG Key ID: B3EE6B8499593605
30 changed files with 977 additions and 1471 deletions

View File

@ -1,317 +0,0 @@
{
"blocks": [
"acacia_log",
"acacia_planks",
"acacia_wood",
"amethyst_block",
"ancient_debris",
"andesite",
"barrel",
"basalt",
"bedrock",
"birch_log",
"birch_planks",
"birch_wood",
"blackstone",
"black_concrete",
"black_concrete_powder",
"black_glazed_terracotta",
"black_stained_glass",
"black_terracotta",
"black_wool",
"blue_concrete",
"blue_concrete_powder",
"blue_glazed_terracotta",
"blue_ice",
"blue_stained_glass",
"blue_terracotta",
"blue_wool",
"bone_block",
"bookshelf",
"brain_coral_block",
"bricks",
"brown_concrete",
"brown_concrete_powder",
"brown_glazed_terracotta",
"brown_mushroom_block",
"brown_stained_glass",
"brown_terracotta",
"brown_wool",
"bubble_coral_block",
"budding_amethyst",
"calcite",
"cartography_table",
"chiseled_deepslate",
"chiseled_nether_bricks",
"chiseled_polished_blackstone",
"chiseled_quartz_block",
"chiseled_red_sandstone",
"chiseled_sandstone",
"chiseled_stone_bricks",
"clay",
"coal_block",
"coal_ore",
"coarse_dirt",
"cobbled_deepslate",
"cobblestone",
"copper_block",
"copper_ore",
"cracked_deepslate_bricks",
"cracked_deepslate_tiles",
"cracked_nether_bricks",
"cracked_polished_blackstone_bricks",
"cracked_stone_bricks",
"crafting_table",
"crimson_hyphae",
"crimson_nylium",
"crimson_planks",
"crimson_stem",
"crying_obsidian",
"cut_copper",
"cut_red_sandstone",
"cut_sandstone",
"cyan_concrete",
"cyan_concrete_powder",
"cyan_glazed_terracotta",
"cyan_stained_glass",
"cyan_terracotta",
"cyan_wool",
"dark_oak_log",
"dark_oak_planks",
"dark_oak_wood",
"dark_prismarine",
"dead_brain_coral_block",
"dead_bubble_coral_block",
"dead_fire_coral_block",
"dead_horn_coral_block",
"dead_tube_coral_block",
"deepslate",
"deepslate_bricks",
"deepslate_coal_ore",
"deepslate_copper_ore",
"deepslate_diamond_ore",
"deepslate_emerald_ore",
"deepslate_gold_ore",
"deepslate_iron_ore",
"deepslate_lapis_ore",
"deepslate_redstone_ore",
"deepslate_tiles",
"diamond_block",
"diamond_ore",
"diorite",
"dirt",
"dripstone_block",
"emerald_block",
"emerald_ore",
"end_stone",
"end_stone_bricks",
"exposed_copper",
"exposed_cut_copper",
"fire_coral_block",
"fletching_table",
"frosted_ice_0",
"frosted_ice_1",
"frosted_ice_2",
"frosted_ice_3",
"gilded_blackstone",
"glass",
"glowstone",
"gold_block",
"gold_ore",
"granite",
"gravel",
"gray_concrete",
"gray_concrete_powder",
"gray_glazed_terracotta",
"gray_stained_glass",
"gray_terracotta",
"gray_wool",
"green_concrete",
"green_concrete_powder",
"green_glazed_terracotta",
"green_stained_glass",
"green_terracotta",
"green_wool",
"hay_block",
"honeycomb_block",
"horn_coral_block",
"ice",
"iron_block",
"iron_ore",
"jungle_log",
"jungle_planks",
"jungle_wood",
"lapis_block",
"lapis_ore",
"light_blue_concrete",
"light_blue_concrete_powder",
"light_blue_glazed_terracotta",
"light_blue_stained_glass",
"light_blue_terracotta",
"light_blue_wool",
"light_gray_concrete",
"light_gray_concrete_powder",
"light_gray_glazed_terracotta",
"light_gray_stained_glass",
"light_gray_terracotta",
"light_gray_wool",
"lime_concrete",
"lime_concrete_powder",
"lime_glazed_terracotta",
"lime_stained_glass",
"lime_terracotta",
"lime_wool",
"lodestone",
"magenta_concrete",
"magenta_concrete_powder",
"magenta_glazed_terracotta",
"magenta_stained_glass",
"magenta_terracotta",
"magenta_wool",
"magma_block",
"mangrove_log",
"mangrove_planks",
"mangrove_wood",
"melon",
"mossy_cobblestone",
"mossy_stone_bricks",
"moss_block",
"mud",
"muddy_mangrove_roots",
"mud_bricks",
"mushroom_stem",
"mycelium",
"netherite_block",
"netherrack",
"nether_bricks",
"nether_gold_ore",
"nether_quartz_ore",
"nether_wart_block",
"note_block",
"oak_log",
"oak_planks",
"oak_wood",
"obsidian",
"ochre_froglight",
"orange_concrete",
"orange_concrete_powder",
"orange_glazed_terracotta",
"orange_stained_glass",
"orange_terracotta",
"orange_wool",
"oxidized_copper",
"oxidized_cut_copper",
"packed_ice",
"packed_mud",
"pearlescent_froglight",
"pink_concrete",
"pink_concrete_powder",
"pink_glazed_terracotta",
"pink_stained_glass",
"pink_terracotta",
"pink_wool",
"podzol",
"polished_andesite",
"polished_basalt",
"polished_blackstone",
"polished_blackstone_bricks",
"polished_deepslate",
"polished_diorite",
"polished_granite",
"prismarine",
"prismarine_bricks",
"purple_concrete",
"purple_concrete_powder",
"purple_glazed_terracotta",
"purple_stained_glass",
"purple_terracotta",
"purple_wool",
"purpur_block",
"purpur_pillar",
"quartz_block",
"quartz_bricks",
"quartz_pillar",
"raw_copper_block",
"raw_gold_block",
"raw_iron_block",
"redstone_block",
"redstone_lamp",
"redstone_ore",
"red_concrete",
"red_concrete_powder",
"red_glazed_terracotta",
"red_mushroom_block",
"red_nether_bricks",
"red_sand",
"red_sandstone",
"red_stained_glass",
"red_terracotta",
"red_wool",
"reinforced_deepslate",
"rooted_dirt",
"sand",
"sandstone",
"sculk",
"sea_lantern",
"shroomlight",
"smithing_table",
"smooth_basalt",
"smooth_quartz",
"smooth_red_sandstone",
"smooth_sandstone",
"smooth_stone",
"snow_block",
"soul_sand",
"soul_soil",
"sponge",
"spruce_log",
"spruce_planks",
"spruce_wood",
"stone",
"stone_bricks",
"stripped_acacia_log",
"stripped_acacia_wood",
"stripped_birch_log",
"stripped_birch_wood",
"stripped_crimson_hyphae",
"stripped_crimson_stem",
"stripped_dark_oak_log",
"stripped_dark_oak_wood",
"stripped_jungle_log",
"stripped_jungle_wood",
"stripped_mangrove_log",
"stripped_mangrove_wood",
"stripped_oak_log",
"stripped_oak_wood",
"stripped_spruce_log",
"stripped_spruce_wood",
"stripped_warped_hyphae",
"stripped_warped_stem",
"target",
"terracotta",
"tinted_glass",
"tube_coral_block",
"tuff",
"verdant_froglight",
"warped_hyphae",
"warped_nylium",
"warped_planks",
"warped_stem",
"warped_wart_block",
"weathered_copper",
"weathered_cut_copper",
"wet_sponge",
"white_concrete",
"white_concrete_powder",
"white_glazed_terracotta",
"white_stained_glass",
"white_terracotta",
"white_wool",
"yellow_concrete",
"yellow_concrete_powder",
"yellow_glazed_terracotta",
"yellow_stained_glass",
"yellow_terracotta",
"yellow_wool"
]
}

View File

@ -1,299 +0,0 @@
{
"blocks": [
"acacia_log",
"acacia_planks",
"acacia_wood",
"amethyst_block",
"ancient_debris",
"andesite",
"barrel",
"basalt",
"bedrock",
"birch_log",
"birch_planks",
"birch_wood",
"blackstone",
"black_concrete",
"black_concrete_powder",
"black_glazed_terracotta",
"black_terracotta",
"black_wool",
"blue_concrete",
"blue_concrete_powder",
"blue_glazed_terracotta",
"blue_ice",
"blue_terracotta",
"blue_wool",
"bone_block",
"bookshelf",
"brain_coral_block",
"bricks",
"brown_concrete",
"brown_concrete_powder",
"brown_glazed_terracotta",
"brown_mushroom_block",
"brown_terracotta",
"brown_wool",
"bubble_coral_block",
"budding_amethyst",
"calcite",
"cartography_table",
"chiseled_deepslate",
"chiseled_nether_bricks",
"chiseled_polished_blackstone",
"chiseled_quartz_block",
"chiseled_red_sandstone",
"chiseled_sandstone",
"chiseled_stone_bricks",
"clay",
"coal_block",
"coal_ore",
"coarse_dirt",
"cobbled_deepslate",
"cobblestone",
"copper_block",
"copper_ore",
"cracked_deepslate_bricks",
"cracked_deepslate_tiles",
"cracked_nether_bricks",
"cracked_polished_blackstone_bricks",
"cracked_stone_bricks",
"crafting_table",
"crimson_hyphae",
"crimson_nylium",
"crimson_planks",
"crimson_stem",
"crying_obsidian",
"cut_copper",
"cut_red_sandstone",
"cut_sandstone",
"cyan_concrete",
"cyan_concrete_powder",
"cyan_glazed_terracotta",
"cyan_terracotta",
"cyan_wool",
"dark_oak_log",
"dark_oak_planks",
"dark_oak_wood",
"dark_prismarine",
"dead_brain_coral_block",
"dead_bubble_coral_block",
"dead_fire_coral_block",
"dead_horn_coral_block",
"dead_tube_coral_block",
"deepslate",
"deepslate_bricks",
"deepslate_coal_ore",
"deepslate_copper_ore",
"deepslate_diamond_ore",
"deepslate_emerald_ore",
"deepslate_gold_ore",
"deepslate_iron_ore",
"deepslate_lapis_ore",
"deepslate_redstone_ore",
"deepslate_tiles",
"diamond_block",
"diamond_ore",
"diorite",
"dirt",
"dripstone_block",
"emerald_block",
"emerald_ore",
"end_stone",
"end_stone_bricks",
"exposed_copper",
"exposed_cut_copper",
"fire_coral_block",
"fletching_table",
"frosted_ice_0",
"frosted_ice_1",
"frosted_ice_2",
"frosted_ice_3",
"gilded_blackstone",
"glowstone",
"gold_block",
"gold_ore",
"granite",
"gravel",
"gray_concrete",
"gray_concrete_powder",
"gray_glazed_terracotta",
"gray_terracotta",
"gray_wool",
"green_concrete",
"green_concrete_powder",
"green_glazed_terracotta",
"green_terracotta",
"green_wool",
"hay_block",
"honeycomb_block",
"horn_coral_block",
"ice",
"iron_block",
"iron_ore",
"jungle_log",
"jungle_planks",
"jungle_wood",
"lapis_block",
"lapis_ore",
"light_blue_concrete",
"light_blue_concrete_powder",
"light_blue_glazed_terracotta",
"light_blue_terracotta",
"light_blue_wool",
"light_gray_concrete",
"light_gray_concrete_powder",
"light_gray_glazed_terracotta",
"light_gray_terracotta",
"light_gray_wool",
"lime_concrete",
"lime_concrete_powder",
"lime_glazed_terracotta",
"lime_terracotta",
"lime_wool",
"lodestone",
"magenta_concrete",
"magenta_concrete_powder",
"magenta_glazed_terracotta",
"magenta_terracotta",
"magenta_wool",
"magma_block",
"mangrove_log",
"mangrove_planks",
"mangrove_wood",
"melon",
"mossy_cobblestone",
"mossy_stone_bricks",
"moss_block",
"mud",
"muddy_mangrove_roots",
"mud_bricks",
"mushroom_stem",
"mycelium",
"netherite_block",
"netherrack",
"nether_bricks",
"nether_gold_ore",
"nether_quartz_ore",
"nether_wart_block",
"note_block",
"oak_log",
"oak_planks",
"oak_wood",
"obsidian",
"ochre_froglight",
"orange_concrete",
"orange_concrete_powder",
"orange_glazed_terracotta",
"orange_terracotta",
"orange_wool",
"oxidized_copper",
"oxidized_cut_copper",
"packed_ice",
"packed_mud",
"pearlescent_froglight",
"pink_concrete",
"pink_concrete_powder",
"pink_glazed_terracotta",
"pink_terracotta",
"pink_wool",
"podzol",
"polished_andesite",
"polished_basalt",
"polished_blackstone",
"polished_blackstone_bricks",
"polished_deepslate",
"polished_diorite",
"polished_granite",
"prismarine",
"prismarine_bricks",
"purple_concrete",
"purple_concrete_powder",
"purple_glazed_terracotta",
"purple_terracotta",
"purple_wool",
"purpur_block",
"purpur_pillar",
"quartz_block",
"quartz_bricks",
"quartz_pillar",
"raw_copper_block",
"raw_gold_block",
"raw_iron_block",
"redstone_block",
"redstone_lamp",
"redstone_ore",
"red_concrete",
"red_concrete_powder",
"red_glazed_terracotta",
"red_mushroom_block",
"red_nether_bricks",
"red_sand",
"red_sandstone",
"red_terracotta",
"red_wool",
"reinforced_deepslate",
"rooted_dirt",
"sand",
"sandstone",
"sculk",
"sea_lantern",
"shroomlight",
"smithing_table",
"smooth_basalt",
"smooth_quartz",
"smooth_red_sandstone",
"smooth_sandstone",
"smooth_stone",
"snow_block",
"soul_sand",
"soul_soil",
"sponge",
"spruce_log",
"spruce_planks",
"spruce_wood",
"stone",
"stone_bricks",
"stripped_acacia_log",
"stripped_acacia_wood",
"stripped_birch_log",
"stripped_birch_wood",
"stripped_crimson_hyphae",
"stripped_crimson_stem",
"stripped_dark_oak_log",
"stripped_dark_oak_wood",
"stripped_jungle_log",
"stripped_jungle_wood",
"stripped_mangrove_log",
"stripped_mangrove_wood",
"stripped_oak_log",
"stripped_oak_wood",
"stripped_spruce_log",
"stripped_spruce_wood",
"stripped_warped_hyphae",
"stripped_warped_stem",
"target",
"terracotta",
"tube_coral_block",
"tuff",
"verdant_froglight",
"warped_hyphae",
"warped_nylium",
"warped_planks",
"warped_stem",
"warped_wart_block",
"weathered_copper",
"weathered_cut_copper",
"wet_sponge",
"white_concrete",
"white_concrete_powder",
"white_glazed_terracotta",
"white_terracotta",
"white_wool",
"yellow_concrete",
"yellow_concrete_powder",
"yellow_glazed_terracotta",
"yellow_terracotta",
"yellow_wool"
]
}

318
res/palettes/all.ts Normal file
View File

@ -0,0 +1,318 @@
import { Palette } from '../../src/palette';
export const PALETTE_ALL_RELEASE = Palette.create();
PALETTE_ALL_RELEASE.add([
'minecraft:acacia_log',
'minecraft:acacia_planks',
'minecraft:acacia_wood',
'minecraft:amethyst_block',
'minecraft:ancient_debris',
'minecraft:andesite',
'minecraft:barrel',
'minecraft:basalt',
'minecraft:bedrock',
'minecraft:birch_log',
'minecraft:birch_planks',
'minecraft:birch_wood',
'minecraft:blackstone',
'minecraft:black_concrete',
'minecraft:black_concrete_powder',
'minecraft:black_glazed_terracotta',
'minecraft:black_stained_glass',
'minecraft:black_terracotta',
'minecraft:black_wool',
'minecraft:blue_concrete',
'minecraft:blue_concrete_powder',
'minecraft:blue_glazed_terracotta',
'minecraft:blue_ice',
'minecraft:blue_stained_glass',
'minecraft:blue_terracotta',
'minecraft:blue_wool',
'minecraft:bone_block',
'minecraft:bookshelf',
'minecraft:brain_coral_block',
'minecraft:bricks',
'minecraft:brown_concrete',
'minecraft:brown_concrete_powder',
'minecraft:brown_glazed_terracotta',
'minecraft:brown_mushroom_block',
'minecraft:brown_stained_glass',
'minecraft:brown_terracotta',
'minecraft:brown_wool',
'minecraft:bubble_coral_block',
'minecraft:budding_amethyst',
'minecraft:calcite',
'minecraft:cartography_table',
'minecraft:chiseled_deepslate',
'minecraft:chiseled_nether_bricks',
'minecraft:chiseled_polished_blackstone',
'minecraft:chiseled_quartz_block',
'minecraft:chiseled_red_sandstone',
'minecraft:chiseled_sandstone',
'minecraft:chiseled_stone_bricks',
'minecraft:clay',
'minecraft:coal_block',
'minecraft:coal_ore',
'minecraft:coarse_dirt',
'minecraft:cobbled_deepslate',
'minecraft:cobblestone',
'minecraft:copper_block',
'minecraft:copper_ore',
'minecraft:cracked_deepslate_bricks',
'minecraft:cracked_deepslate_tiles',
'minecraft:cracked_nether_bricks',
'minecraft:cracked_polished_blackstone_bricks',
'minecraft:cracked_stone_bricks',
'minecraft:crafting_table',
'minecraft:crimson_hyphae',
'minecraft:crimson_nylium',
'minecraft:crimson_planks',
'minecraft:crimson_stem',
'minecraft:crying_obsidian',
'minecraft:cut_copper',
'minecraft:cut_red_sandstone',
'minecraft:cut_sandstone',
'minecraft:cyan_concrete',
'minecraft:cyan_concrete_powder',
'minecraft:cyan_glazed_terracotta',
'minecraft:cyan_stained_glass',
'minecraft:cyan_terracotta',
'minecraft:cyan_wool',
'minecraft:dark_oak_log',
'minecraft:dark_oak_planks',
'minecraft:dark_oak_wood',
'minecraft:dark_prismarine',
'minecraft:dead_brain_coral_block',
'minecraft:dead_bubble_coral_block',
'minecraft:dead_fire_coral_block',
'minecraft:dead_horn_coral_block',
'minecraft:dead_tube_coral_block',
'minecraft:deepslate',
'minecraft:deepslate_bricks',
'minecraft:deepslate_coal_ore',
'minecraft:deepslate_copper_ore',
'minecraft:deepslate_diamond_ore',
'minecraft:deepslate_emerald_ore',
'minecraft:deepslate_gold_ore',
'minecraft:deepslate_iron_ore',
'minecraft:deepslate_lapis_ore',
'minecraft:deepslate_redstone_ore',
'minecraft:deepslate_tiles',
'minecraft:diamond_block',
'minecraft:diamond_ore',
'minecraft:diorite',
'minecraft:dirt',
'minecraft:dripstone_block',
'minecraft:emerald_block',
'minecraft:emerald_ore',
'minecraft:end_stone',
'minecraft:end_stone_bricks',
'minecraft:exposed_copper',
'minecraft:exposed_cut_copper',
'minecraft:fire_coral_block',
'minecraft:fletching_table',
'minecraft:frosted_ice_0',
'minecraft:frosted_ice_1',
'minecraft:frosted_ice_2',
'minecraft:frosted_ice_3',
'minecraft:gilded_blackstone',
'minecraft:glass',
'minecraft:glowstone',
'minecraft:gold_block',
'minecraft:gold_ore',
'minecraft:granite',
'minecraft:gravel',
'minecraft:gray_concrete',
'minecraft:gray_concrete_powder',
'minecraft:gray_glazed_terracotta',
'minecraft:gray_stained_glass',
'minecraft:gray_terracotta',
'minecraft:gray_wool',
'minecraft:green_concrete',
'minecraft:green_concrete_powder',
'minecraft:green_glazed_terracotta',
'minecraft:green_stained_glass',
'minecraft:green_terracotta',
'minecraft:green_wool',
'minecraft:hay_block',
'minecraft:honeycomb_block',
'minecraft:horn_coral_block',
'minecraft:ice',
'minecraft:iron_block',
'minecraft:iron_ore',
'minecraft:jungle_log',
'minecraft:jungle_planks',
'minecraft:jungle_wood',
'minecraft:lapis_block',
'minecraft:lapis_ore',
'minecraft:light_blue_concrete',
'minecraft:light_blue_concrete_powder',
'minecraft:light_blue_glazed_terracotta',
'minecraft:light_blue_stained_glass',
'minecraft:light_blue_terracotta',
'minecraft:light_blue_wool',
'minecraft:light_gray_concrete',
'minecraft:light_gray_concrete_powder',
'minecraft:light_gray_glazed_terracotta',
'minecraft:light_gray_stained_glass',
'minecraft:light_gray_terracotta',
'minecraft:light_gray_wool',
'minecraft:lime_concrete',
'minecraft:lime_concrete_powder',
'minecraft:lime_glazed_terracotta',
'minecraft:lime_stained_glass',
'minecraft:lime_terracotta',
'minecraft:lime_wool',
'minecraft:lodestone',
'minecraft:magenta_concrete',
'minecraft:magenta_concrete_powder',
'minecraft:magenta_glazed_terracotta',
'minecraft:magenta_stained_glass',
'minecraft:magenta_terracotta',
'minecraft:magenta_wool',
'minecraft:magma_block',
'minecraft:mangrove_log',
'minecraft:mangrove_planks',
'minecraft:mangrove_wood',
'minecraft:melon',
'minecraft:mossy_cobblestone',
'minecraft:mossy_stone_bricks',
'minecraft:moss_block',
'minecraft:mud',
'minecraft:muddy_mangrove_roots',
'minecraft:mud_bricks',
'minecraft:mushroom_stem',
'minecraft:mycelium',
'minecraft:netherite_block',
'minecraft:netherrack',
'minecraft:nether_bricks',
'minecraft:nether_gold_ore',
'minecraft:nether_quartz_ore',
'minecraft:nether_wart_block',
'minecraft:note_block',
'minecraft:oak_log',
'minecraft:oak_planks',
'minecraft:oak_wood',
'minecraft:obsidian',
'minecraft:ochre_froglight',
'minecraft:orange_concrete',
'minecraft:orange_concrete_powder',
'minecraft:orange_glazed_terracotta',
'minecraft:orange_stained_glass',
'minecraft:orange_terracotta',
'minecraft:orange_wool',
'minecraft:oxidized_copper',
'minecraft:oxidized_cut_copper',
'minecraft:packed_ice',
'minecraft:packed_mud',
'minecraft:pearlescent_froglight',
'minecraft:pink_concrete',
'minecraft:pink_concrete_powder',
'minecraft:pink_glazed_terracotta',
'minecraft:pink_stained_glass',
'minecraft:pink_terracotta',
'minecraft:pink_wool',
'minecraft:podzol',
'minecraft:polished_andesite',
'minecraft:polished_basalt',
'minecraft:polished_blackstone',
'minecraft:polished_blackstone_bricks',
'minecraft:polished_deepslate',
'minecraft:polished_diorite',
'minecraft:polished_granite',
'minecraft:prismarine',
'minecraft:prismarine_bricks',
'minecraft:purple_concrete',
'minecraft:purple_concrete_powder',
'minecraft:purple_glazed_terracotta',
'minecraft:purple_stained_glass',
'minecraft:purple_terracotta',
'minecraft:purple_wool',
'minecraft:purpur_block',
'minecraft:purpur_pillar',
'minecraft:quartz_block',
'minecraft:quartz_bricks',
'minecraft:quartz_pillar',
'minecraft:raw_copper_block',
'minecraft:raw_gold_block',
'minecraft:raw_iron_block',
'minecraft:redstone_block',
'minecraft:redstone_lamp',
'minecraft:redstone_ore',
'minecraft:red_concrete',
'minecraft:red_concrete_powder',
'minecraft:red_glazed_terracotta',
'minecraft:red_mushroom_block',
'minecraft:red_nether_bricks',
'minecraft:red_sand',
'minecraft:red_sandstone',
'minecraft:red_stained_glass',
'minecraft:red_terracotta',
'minecraft:red_wool',
'minecraft:reinforced_deepslate',
'minecraft:rooted_dirt',
'minecraft:sand',
'minecraft:sandstone',
'minecraft:sculk',
'minecraft:sea_lantern',
'minecraft:shroomlight',
'minecraft:smithing_table',
'minecraft:smooth_basalt',
'minecraft:smooth_quartz',
'minecraft:smooth_red_sandstone',
'minecraft:smooth_sandstone',
'minecraft:smooth_stone',
'minecraft:snow_block',
'minecraft:soul_sand',
'minecraft:soul_soil',
'minecraft:sponge',
'minecraft:spruce_log',
'minecraft:spruce_planks',
'minecraft:spruce_wood',
'minecraft:stone',
'minecraft:stone_bricks',
'minecraft:stripped_acacia_log',
'minecraft:stripped_acacia_wood',
'minecraft:stripped_birch_log',
'minecraft:stripped_birch_wood',
'minecraft:stripped_crimson_hyphae',
'minecraft:stripped_crimson_stem',
'minecraft:stripped_dark_oak_log',
'minecraft:stripped_dark_oak_wood',
'minecraft:stripped_jungle_log',
'minecraft:stripped_jungle_wood',
'minecraft:stripped_mangrove_log',
'minecraft:stripped_mangrove_wood',
'minecraft:stripped_oak_log',
'minecraft:stripped_oak_wood',
'minecraft:stripped_spruce_log',
'minecraft:stripped_spruce_wood',
'minecraft:stripped_warped_hyphae',
'minecraft:stripped_warped_stem',
'minecraft:target',
'minecraft:terracotta',
'minecraft:tinted_glass',
'minecraft:tube_coral_block',
'minecraft:tuff',
'minecraft:verdant_froglight',
'minecraft:warped_hyphae',
'minecraft:warped_nylium',
'minecraft:warped_planks',
'minecraft:warped_stem',
'minecraft:warped_wart_block',
'minecraft:weathered_copper',
'minecraft:weathered_cut_copper',
'minecraft:wet_sponge',
'minecraft:white_concrete',
'minecraft:white_concrete_powder',
'minecraft:white_glazed_terracotta',
'minecraft:white_stained_glass',
'minecraft:white_terracotta',
'minecraft:white_wool',
'minecraft:yellow_concrete',
'minecraft:yellow_concrete_powder',
'minecraft:yellow_glazed_terracotta',
'minecraft:yellow_stained_glass',
'minecraft:yellow_terracotta',
'minecraft:yellow_wool',
]);

View File

@ -1,84 +0,0 @@
{
"blocks": [
"black_concrete",
"black_concrete_powder",
"black_glazed_terracotta",
"black_terracotta",
"black_wool",
"blue_concrete",
"blue_concrete_powder",
"blue_glazed_terracotta",
"blue_terracotta",
"blue_wool",
"brown_concrete",
"brown_concrete_powder",
"brown_glazed_terracotta",
"brown_terracotta",
"brown_wool",
"cyan_concrete",
"cyan_concrete_powder",
"cyan_glazed_terracotta",
"cyan_terracotta",
"cyan_wool",
"gray_concrete",
"gray_concrete_powder",
"gray_glazed_terracotta",
"gray_terracotta",
"gray_wool",
"green_concrete",
"green_concrete_powder",
"green_glazed_terracotta",
"green_terracotta",
"green_wool",
"light_blue_concrete",
"light_blue_concrete_powder",
"light_blue_glazed_terracotta",
"light_blue_terracotta",
"light_blue_wool",
"light_gray_concrete",
"light_gray_concrete_powder",
"light_gray_glazed_terracotta",
"light_gray_terracotta",
"light_gray_wool",
"lime_concrete",
"lime_concrete_powder",
"lime_glazed_terracotta",
"lime_terracotta",
"lime_wool",
"magenta_concrete",
"magenta_concrete_powder",
"magenta_glazed_terracotta",
"magenta_terracotta",
"magenta_wool",
"orange_concrete",
"orange_concrete_powder",
"orange_glazed_terracotta",
"orange_terracotta",
"orange_wool",
"pink_concrete",
"pink_concrete_powder",
"pink_glazed_terracotta",
"pink_terracotta",
"pink_wool",
"purple_concrete",
"purple_concrete_powder",
"purple_glazed_terracotta",
"purple_terracotta",
"purple_wool",
"red_concrete",
"red_concrete_powder",
"red_glazed_terracotta",
"red_terracotta",
"red_wool",
"white_concrete",
"white_concrete_powder",
"white_glazed_terracotta",
"white_terracotta",
"white_wool",
"yellow_concrete",
"yellow_concrete_powder",
"yellow_glazed_terracotta",
"yellow_terracotta",
"yellow_wool"
]
}

85
res/palettes/colourful.ts Normal file
View File

@ -0,0 +1,85 @@
import { Palette } from '../../src/palette';
export const PALETTE_COLOURFUL = Palette.create();
PALETTE_COLOURFUL.add([
'minecraft:black_concrete',
'minecraft:black_concrete_powder',
'minecraft:black_glazed_terracotta',
'minecraft:black_terracotta',
'minecraft:black_wool',
'minecraft:blue_concrete',
'minecraft:blue_concrete_powder',
'minecraft:blue_glazed_terracotta',
'minecraft:blue_terracotta',
'minecraft:blue_wool',
'minecraft:brown_concrete',
'minecraft:brown_concrete_powder',
'minecraft:brown_glazed_terracotta',
'minecraft:brown_terracotta',
'minecraft:brown_wool',
'minecraft:cyan_concrete',
'minecraft:cyan_concrete_powder',
'minecraft:cyan_glazed_terracotta',
'minecraft:cyan_terracotta',
'minecraft:cyan_wool',
'minecraft:gray_concrete',
'minecraft:gray_concrete_powder',
'minecraft:gray_glazed_terracotta',
'minecraft:gray_terracotta',
'minecraft:gray_wool',
'minecraft:green_concrete',
'minecraft:green_concrete_powder',
'minecraft:green_glazed_terracotta',
'minecraft:green_terracotta',
'minecraft:green_wool',
'minecraft:light_blue_concrete',
'minecraft:light_blue_concrete_powder',
'minecraft:light_blue_glazed_terracotta',
'minecraft:light_blue_terracotta',
'minecraft:light_blue_wool',
'minecraft:light_gray_concrete',
'minecraft:light_gray_concrete_powder',
'minecraft:light_gray_glazed_terracotta',
'minecraft:light_gray_terracotta',
'minecraft:light_gray_wool',
'minecraft:lime_concrete',
'minecraft:lime_concrete_powder',
'minecraft:lime_glazed_terracotta',
'minecraft:lime_terracotta',
'minecraft:lime_wool',
'minecraft:magenta_concrete',
'minecraft:magenta_concrete_powder',
'minecraft:magenta_glazed_terracotta',
'minecraft:magenta_terracotta',
'minecraft:magenta_wool',
'minecraft:orange_concrete',
'minecraft:orange_concrete_powder',
'minecraft:orange_glazed_terracotta',
'minecraft:orange_terracotta',
'minecraft:orange_wool',
'minecraft:pink_concrete',
'minecraft:pink_concrete_powder',
'minecraft:pink_glazed_terracotta',
'minecraft:pink_terracotta',
'minecraft:pink_wool',
'minecraft:purple_concrete',
'minecraft:purple_concrete_powder',
'minecraft:purple_glazed_terracotta',
'minecraft:purple_terracotta',
'minecraft:purple_wool',
'minecraft:red_concrete',
'minecraft:red_concrete_powder',
'minecraft:red_glazed_terracotta',
'minecraft:red_terracotta',
'minecraft:red_wool',
'minecraft:white_concrete',
'minecraft:white_concrete_powder',
'minecraft:white_glazed_terracotta',
'minecraft:white_terracotta',
'minecraft:white_wool',
'minecraft:yellow_concrete',
'minecraft:yellow_concrete_powder',
'minecraft:yellow_glazed_terracotta',
'minecraft:yellow_terracotta',
'minecraft:yellow_wool',
]);

View File

@ -1,53 +0,0 @@
{
"blocks": [
"andesite",
"basalt",
"bedrock",
"blackstone",
"black_concrete",
"black_concrete_powder",
"black_terracotta",
"black_wool",
"bone_block",
"chiseled_polished_blackstone",
"chiseled_quartz_block",
"chiseled_stone_bricks",
"coal_block",
"coal_ore",
"cobblestone",
"cracked_polished_blackstone_bricks",
"cracked_stone_bricks",
"cyan_terracotta",
"dead_brain_coral_block",
"dead_bubble_coral_block",
"dead_fire_coral_block",
"dead_horn_coral_block",
"dead_tube_coral_block",
"diorite",
"gravel",
"gray_concrete",
"gray_concrete_powder",
"gray_wool",
"iron_block",
"light_gray_concrete",
"light_gray_concrete_powder",
"light_gray_wool",
"netherite_block",
"polished_andesite",
"polished_basalt",
"polished_blackstone",
"polished_blackstone_bricks",
"polished_diorite",
"quartz_block",
"quartz_bricks",
"quartz_pillar",
"smooth_quartz",
"smooth_stone",
"snow_block",
"stone",
"stone_bricks",
"white_concrete",
"white_concrete_powder",
"white_wool"
]
}

54
res/palettes/greyscale.ts Normal file
View File

@ -0,0 +1,54 @@
import { Palette } from '../../src/palette';
export const PALETTE_COLOURFUL = Palette.create();
PALETTE_COLOURFUL.add([
'minecraft:andesite',
'minecraft:basalt',
'minecraft:bedrock',
'minecraft:blackstone',
'minecraft:black_concrete',
'minecraft:black_concrete_powder',
'minecraft:black_terracotta',
'minecraft:black_wool',
'minecraft:bone_block',
'minecraft:chiseled_polished_blackstone',
'minecraft:chiseled_quartz_block',
'minecraft:chiseled_stone_bricks',
'minecraft:coal_block',
'minecraft:coal_ore',
'minecraft:cobblestone',
'minecraft:cracked_polished_blackstone_bricks',
'minecraft:cracked_stone_bricks',
'minecraft:cyan_terracotta',
'minecraft:dead_brain_coral_block',
'minecraft:dead_bubble_coral_block',
'minecraft:dead_fire_coral_block',
'minecraft:dead_horn_coral_block',
'minecraft:dead_tube_coral_block',
'minecraft:diorite',
'minecraft:gravel',
'minecraft:gray_concrete',
'minecraft:gray_concrete_powder',
'minecraft:gray_wool',
'minecraft:iron_block',
'minecraft:light_gray_concrete',
'minecraft:light_gray_concrete_powder',
'minecraft:light_gray_wool',
'minecraft:netherite_block',
'minecraft:polished_andesite',
'minecraft:polished_basalt',
'minecraft:polished_blackstone',
'minecraft:polished_blackstone_bricks',
'minecraft:polished_diorite',
'minecraft:quartz_block',
'minecraft:quartz_bricks',
'minecraft:quartz_pillar',
'minecraft:smooth_quartz',
'minecraft:smooth_stone',
'minecraft:snow_block',
'minecraft:stone',
'minecraft:stone_bricks',
'minecraft:white_concrete',
'minecraft:white_concrete_powder',
'minecraft:white_wool',
]);

View File

@ -1,278 +0,0 @@
{
"blocks": [
"air",
"stone",
"granite",
"polished_granite",
"diorite",
"polished_diorite",
"andesite",
"polished_andesite",
"grass_block",
"dirt",
"coarse_dirt",
"podzol",
"cobblestone",
"oak_planks",
"spruce_planks",
"birch_planks",
"jungle_planks",
"acacia_planks",
"dark_oak_planks",
"bedrock",
"sand",
"red_sand",
"gravel",
"gold_ore",
"iron_ore",
"coal_ore",
"oak_log",
"spruce_log",
"birch_log",
"jungle_log",
"sponge",
"wet_sponge",
"glass",
"lapis_ore",
"lapis_block",
"dispenser",
"sandstone",
"chiseled_sandstone",
"cut_sandstone",
"note_block",
"powered_rail",
"detector_rail",
"sticky_piston",
"cobweb",
"fern",
"dead_bush",
"piston",
"white_wool",
"orange_wool",
"magenta_wool",
"light_blue_wool",
"yellow_wool",
"lime_wool",
"pink_wool",
"gray_wool",
"light_gray_wool",
"cyan_wool",
"purple_wool",
"blue_wool",
"brown_wool",
"green_wool",
"red_wool",
"black_wool",
"gold_block",
"iron_block",
"smooth_stone",
"stone_slab",
"sandstone_slab",
"cobblestone_slab",
"brick_slab",
"stone_brick_slab",
"nether_brick_slab",
"quartz_slab",
"bricks",
"tnt",
"bookshelf",
"mossy_cobblestone",
"obsidian",
"monster_spawner",
"oak_stairs",
"diamond_ore",
"diamond_block",
"crafting_table",
"farmland",
"furnace",
"cobblestone_stairs",
"redstone_ore",
"ice",
"snow_block",
"clay",
"jukebox",
"pumpkin",
"netherrack",
"soul_sand",
"glowstone",
"jack_o_lantern",
"white_stained_glass",
"orange_stained_glass",
"magenta_stained_glass",
"light_blue stained_glass",
"yellow_stained_glass",
"lime_stained_glass",
"pink_stained_glass",
"gray_stained_glass",
"light_gray stained_glass",
"cyan_stained_glass",
"purple_stained_glass",
"blue_stained_glass",
"brown_stained_glass",
"green_stained_glass",
"red_stained_glass",
"black_stained_glass",
"stone_bricks",
"mossy_stone_bricks",
"cracked_stone_bricks",
"chiseled_stone_bricks",
"brown_mushroom_block",
"red_mushroom_block",
"iron_bars",
"glass_pane",
"melon_block",
"brick_stairs",
"stone_brick_stairs",
"mycelium",
"nether_bricks",
"nether_brick_stairs",
"end_stone",
"redstone_lamp",
"oak_slab",
"spruce_slab",
"birch_slab",
"jungle_slab",
"acacia_slab",
"dark_oak_slab",
"sandstone_stairs",
"emerald_ore",
"emerald_block",
"spruce_stairs",
"birch_stairs",
"jungle_stairs",
"redstone_block",
"nether_quartz_ore",
"quartz_block",
"chiseled_quartz_block",
"pillar_quartz_block",
"quartz_stairs",
"dropper",
"white_terracotta",
"orange_terracotta",
"magenta_terracotta",
"light_blue_terracotta",
"yellow_terracotta",
"lime_terracotta",
"pink_terracotta",
"gray_terracotta",
"light_gray_terracotta",
"cyan_terracotta",
"purple_terracotta",
"blue_terracotta",
"brown_terracotta",
"green_terracotta",
"red_terracotta",
"black_terracotta",
"white_stained_glass_pane",
"orange_stained_glass_pane",
"magenta_stained_glass_pane",
"light_blue_stained_glass_pane",
"yellow_stained_glass_pane",
"lime_stained_glass_pane",
"pink_stained_glass_pane",
"gray_stained_glass_pane",
"light_gray_stained_glass_pane",
"cyan_stained_glass_pane",
"purple_stained_glass_pane",
"blue_stained_glass_pane",
"brown_stained_glass_pane",
"green_stained_glass_pane",
"red_stained_glass_pane",
"black_stained_glass_pane",
"acacia_log",
"dark_oak_log",
"acacia_stairs",
"dark_oak_stairs",
"slime_block",
"prismarine",
"prismarine_bricks",
"dark_prismarine",
"sea_lantern",
"hay_block",
"terracotta",
"coal_block",
"packed_ice",
"red_sandstone",
"chiseled_red_sandstone",
"smooth_red_sandstone",
"red_sandstone_stairs",
"red_sandstone_slab",
"purpur_block",
"purpur_pillar",
"purpur_stairs",
"purpur_slab",
"end_stone_bricks",
"grass_path",
"frosted_ice",
"magma_block",
"nether_wart_block",
"red_nether_bricks",
"bone_block",
"structure_void",
"observer",
"white_shulker_box",
"orange_shulker_box",
"magenta_shulker_box",
"light_blue_shulker_box",
"yellow_shulker_box",
"lime_shulker_box",
"pink_shulker_box",
"gray_shulker_box",
"light_gray_shulker_box",
"cyan_shulker_box",
"purple_shulker_box",
"blue_shulker_box",
"brown_shulker_box",
"green_shulker_box",
"red_shulker_box",
"black_shulker_box",
"white_glazed_terracotta",
"orange_glazed_terracotta",
"magenta_glazed_terracotta",
"light_blue_glazed_terracotta",
"yellow_glazed_terracotta",
"lime_glazed_terracotta",
"pink_glazed_terracotta",
"gray_glazed_terracotta",
"light_gray glazed_terracotta",
"cyan_glazed_terracotta",
"purple_glazed_terracotta",
"blue_glazed_terracotta",
"brown_glazed_terracotta",
"green_glazed_terracotta",
"red_glazed_terracotta",
"black_glazed_terracotta",
"white_concrete",
"orange_concrete",
"magenta_concrete",
"light_blue_concrete",
"yellow_concrete",
"lime_concrete",
"pink_concrete",
"gray_concrete",
"light_gray_concrete",
"cyan_concrete",
"purple_concrete",
"blue_concrete",
"brown_concrete",
"green_concrete",
"red_concrete",
"black_concrete",
"white_concrete_powder",
"orange_concrete_powder",
"magenta_concrete_powder",
"light_blue_concrete_powder",
"yellow_concrete_powder",
"lime_concrete_powder",
"pink_concrete_powder",
"gray_concrete_powder",
"light_gray_concrete_powder",
"cyan_concrete_powder",
"purple_concrete_powder",
"blue_concrete_powder",
"brown_concrete_powder",
"green_concrete_powder",
"red_concrete_powder",
"black_concrete_powder"
]
}

View File

@ -0,0 +1,279 @@
import { Palette } from '../../src/palette';
export const PALETTE_COLOURFUL = Palette.create();
PALETTE_COLOURFUL.add([
'minecraft:air',
'minecraft:stone',
'minecraft:granite',
'minecraft:polished_granite',
'minecraft:diorite',
'minecraft:polished_diorite',
'minecraft:andesite',
'minecraft:polished_andesite',
'minecraft:grass_block',
'minecraft:dirt',
'minecraft:coarse_dirt',
'minecraft:podzol',
'minecraft:cobblestone',
'minecraft:oak_planks',
'minecraft:spruce_planks',
'minecraft:birch_planks',
'minecraft:jungle_planks',
'minecraft:acacia_planks',
'minecraft:dark_oak_planks',
'minecraft:bedrock',
'minecraft:sand',
'minecraft:red_sand',
'minecraft:gravel',
'minecraft:gold_ore',
'minecraft:iron_ore',
'minecraft:coal_ore',
'minecraft:oak_log',
'minecraft:spruce_log',
'minecraft:birch_log',
'minecraft:jungle_log',
'minecraft:sponge',
'minecraft:wet_sponge',
'minecraft:glass',
'minecraft:lapis_ore',
'minecraft:lapis_block',
'minecraft:dispenser',
'minecraft:sandstone',
'minecraft:chiseled_sandstone',
'minecraft:cut_sandstone',
'minecraft:note_block',
'minecraft:powered_rail',
'minecraft:detector_rail',
'minecraft:sticky_piston',
'minecraft:cobweb',
'minecraft:fern',
'minecraft:dead_bush',
'minecraft:piston',
'minecraft:white_wool',
'minecraft:orange_wool',
'minecraft:magenta_wool',
'minecraft:light_blue_wool',
'minecraft:yellow_wool',
'minecraft:lime_wool',
'minecraft:pink_wool',
'minecraft:gray_wool',
'minecraft:light_gray_wool',
'minecraft:cyan_wool',
'minecraft:purple_wool',
'minecraft:blue_wool',
'minecraft:brown_wool',
'minecraft:green_wool',
'minecraft:red_wool',
'minecraft:black_wool',
'minecraft:gold_block',
'minecraft:iron_block',
'minecraft:smooth_stone',
'minecraft:stone_slab',
'minecraft:sandstone_slab',
'minecraft:cobblestone_slab',
'minecraft:brick_slab',
'minecraft:stone_brick_slab',
'minecraft:nether_brick_slab',
'minecraft:quartz_slab',
'minecraft:bricks',
'minecraft:tnt',
'minecraft:bookshelf',
'minecraft:mossy_cobblestone',
'minecraft:obsidian',
'minecraft:monster_spawner',
'minecraft:oak_stairs',
'minecraft:diamond_ore',
'minecraft:diamond_block',
'minecraft:crafting_table',
'minecraft:farmland',
'minecraft:furnace',
'minecraft:cobblestone_stairs',
'minecraft:redstone_ore',
'minecraft:ice',
'minecraft:snow_block',
'minecraft:clay',
'minecraft:jukebox',
'minecraft:pumpkin',
'minecraft:netherrack',
'minecraft:soul_sand',
'minecraft:glowstone',
'minecraft:jack_o_lantern',
'minecraft:white_stained_glass',
'minecraft:orange_stained_glass',
'minecraft:magenta_stained_glass',
'light_blue minecraft:stained_glass',
'minecraft:yellow_stained_glass',
'minecraft:lime_stained_glass',
'minecraft:pink_stained_glass',
'minecraft:gray_stained_glass',
'light_gray minecraft:stained_glass',
'minecraft:cyan_stained_glass',
'minecraft:purple_stained_glass',
'minecraft:blue_stained_glass',
'minecraft:brown_stained_glass',
'minecraft:green_stained_glass',
'minecraft:red_stained_glass',
'minecraft:black_stained_glass',
'minecraft:stone_bricks',
'minecraft:mossy_stone_bricks',
'minecraft:cracked_stone_bricks',
'minecraft:chiseled_stone_bricks',
'minecraft:brown_mushroom_block',
'minecraft:red_mushroom_block',
'minecraft:iron_bars',
'minecraft:glass_pane',
'minecraft:melon_block',
'minecraft:brick_stairs',
'minecraft:stone_brick_stairs',
'minecraft:mycelium',
'minecraft:nether_bricks',
'minecraft:nether_brick_stairs',
'minecraft:end_stone',
'minecraft:redstone_lamp',
'minecraft:oak_slab',
'minecraft:spruce_slab',
'minecraft:birch_slab',
'minecraft:jungle_slab',
'minecraft:acacia_slab',
'minecraft:dark_oak_slab',
'minecraft:sandstone_stairs',
'minecraft:emerald_ore',
'minecraft:emerald_block',
'minecraft:spruce_stairs',
'minecraft:birch_stairs',
'minecraft:jungle_stairs',
'minecraft:redstone_block',
'minecraft:nether_quartz_ore',
'minecraft:quartz_block',
'minecraft:chiseled_quartz_block',
'minecraft:pillar_quartz_block',
'minecraft:quartz_stairs',
'minecraft:dropper',
'minecraft:white_terracotta',
'minecraft:orange_terracotta',
'minecraft:magenta_terracotta',
'minecraft:light_blue_terracotta',
'minecraft:yellow_terracotta',
'minecraft:lime_terracotta',
'minecraft:pink_terracotta',
'minecraft:gray_terracotta',
'minecraft:light_gray_terracotta',
'minecraft:cyan_terracotta',
'minecraft:purple_terracotta',
'minecraft:blue_terracotta',
'minecraft:brown_terracotta',
'minecraft:green_terracotta',
'minecraft:red_terracotta',
'minecraft:black_terracotta',
'minecraft:white_stained_glass_pane',
'minecraft:orange_stained_glass_pane',
'minecraft:magenta_stained_glass_pane',
'minecraft:light_blue_stained_glass_pane',
'minecraft:yellow_stained_glass_pane',
'minecraft:lime_stained_glass_pane',
'minecraft:pink_stained_glass_pane',
'minecraft:gray_stained_glass_pane',
'minecraft:light_gray_stained_glass_pane',
'minecraft:cyan_stained_glass_pane',
'minecraft:purple_stained_glass_pane',
'minecraft:blue_stained_glass_pane',
'minecraft:brown_stained_glass_pane',
'minecraft:green_stained_glass_pane',
'minecraft:red_stained_glass_pane',
'minecraft:black_stained_glass_pane',
'minecraft:acacia_log',
'minecraft:dark_oak_log',
'minecraft:acacia_stairs',
'minecraft:dark_oak_stairs',
'minecraft:slime_block',
'minecraft:prismarine',
'minecraft:prismarine_bricks',
'minecraft:dark_prismarine',
'minecraft:sea_lantern',
'minecraft:hay_block',
'minecraft:terracotta',
'minecraft:coal_block',
'minecraft:packed_ice',
'minecraft:red_sandstone',
'minecraft:chiseled_red_sandstone',
'minecraft:smooth_red_sandstone',
'minecraft:red_sandstone_stairs',
'minecraft:red_sandstone_slab',
'minecraft:purpur_block',
'minecraft:purpur_pillar',
'minecraft:purpur_stairs',
'minecraft:purpur_slab',
'minecraft:end_stone_bricks',
'minecraft:grass_path',
'minecraft:frosted_ice',
'minecraft:magma_block',
'minecraft:nether_wart_block',
'minecraft:red_nether_bricks',
'minecraft:bone_block',
'minecraft:structure_void',
'minecraft:observer',
'minecraft:white_shulker_box',
'minecraft:orange_shulker_box',
'minecraft:magenta_shulker_box',
'minecraft:light_blue_shulker_box',
'minecraft:yellow_shulker_box',
'minecraft:lime_shulker_box',
'minecraft:pink_shulker_box',
'minecraft:gray_shulker_box',
'minecraft:light_gray_shulker_box',
'minecraft:cyan_shulker_box',
'minecraft:purple_shulker_box',
'minecraft:blue_shulker_box',
'minecraft:brown_shulker_box',
'minecraft:green_shulker_box',
'minecraft:red_shulker_box',
'minecraft:black_shulker_box',
'minecraft:white_glazed_terracotta',
'minecraft:orange_glazed_terracotta',
'minecraft:magenta_glazed_terracotta',
'minecraft:light_blue_glazed_terracotta',
'minecraft:yellow_glazed_terracotta',
'minecraft:lime_glazed_terracotta',
'minecraft:pink_glazed_terracotta',
'minecraft:gray_glazed_terracotta',
'light_gray minecraft:glazed_terracotta',
'minecraft:cyan_glazed_terracotta',
'minecraft:purple_glazed_terracotta',
'minecraft:blue_glazed_terracotta',
'minecraft:brown_glazed_terracotta',
'minecraft:green_glazed_terracotta',
'minecraft:red_glazed_terracotta',
'minecraft:black_glazed_terracotta',
'minecraft:white_concrete',
'minecraft:orange_concrete',
'minecraft:magenta_concrete',
'minecraft:light_blue_concrete',
'minecraft:yellow_concrete',
'minecraft:lime_concrete',
'minecraft:pink_concrete',
'minecraft:gray_concrete',
'minecraft:light_gray_concrete',
'minecraft:cyan_concrete',
'minecraft:purple_concrete',
'minecraft:blue_concrete',
'minecraft:brown_concrete',
'minecraft:green_concrete',
'minecraft:red_concrete',
'minecraft:black_concrete',
'minecraft:white_concrete_powder',
'minecraft:orange_concrete_powder',
'minecraft:magenta_concrete_powder',
'minecraft:light_blue_concrete_powder',
'minecraft:yellow_concrete_powder',
'minecraft:lime_concrete_powder',
'minecraft:pink_concrete_powder',
'minecraft:gray_concrete_powder',
'minecraft:light_gray_concrete_powder',
'minecraft:cyan_concrete_powder',
'minecraft:purple_concrete_powder',
'minecraft:blue_concrete_powder',
'minecraft:brown_concrete_powder',
'minecraft:green_concrete_powder',
'minecraft:red_concrete_powder',
'minecraft:black_concrete_powder',
]);

View File

@ -85,12 +85,12 @@ export class AppContext {
});
}
public do(action: EAction) {
public async do(action: EAction) {
this._ui.cacheValues(action);
this._ui.disable(action);
this._ui.disableAll();
const workerJob = this._getWorkerJob(action);
const workerJob = await this._getWorkerJob(action);
if (workerJob === undefined) {
this._ui.enableTo(action);
return;
@ -161,32 +161,34 @@ export class AppContext {
return { builder: builder, style: hasWarnings ? 'warning' : 'success' };
}
private _getWorkerJob(action: EAction): (TWorkerJob | undefined) {
private _getWorkerJob(action: EAction): (Promise<TWorkerJob | undefined>) {
switch (action) {
case EAction.Import:
return this._import();
case EAction.Materials:
return this._materials();
return Promise.resolve(this._materials());
case EAction.Voxelise:
return this._voxelise();
return Promise.resolve(this._voxelise());
case EAction.Assign:
return this._assign();
return Promise.resolve(this._assign());
case EAction.Export:
return this._export();
return Promise.resolve(this._export());
}
ASSERT(false);
}
private _import(): TWorkerJob {
private async _import(): Promise<TWorkerJob> {
const uiElements = this._ui.layout.import.elements;
this._ui.getActionOutput(EAction.Import)
.setTaskInProgress('action', '[Importer]: Loading...');
const payload: TToWorkerMessage = {
action: 'Import',
params: {
filepath: uiElements.input.getValue(),
importer: 'obj',
fileSource: await uiElements.input.getValue(),
rotation: uiElements.rotation.getValue(),
},
};

View File

@ -26,6 +26,8 @@ addDocumentEvent('mousemove', (e) => {
mouseManager.onMouseMove(e);
});
window.addEventListener('contextmenu', (e) => e.preventDefault());
// Begin draw loop
const context = new AppContext();

2
src/global.d.ts vendored
View File

@ -1,3 +1,5 @@
declare module '*.vs';
declare module '*.fs';
declare module '*.png';

View File

@ -1,6 +1,6 @@
import { Mesh } from '../mesh';
export abstract class IImporter {
abstract parseFile(filePath: string): void;
abstract parse(fileSource: string): void;
abstract toMesh(): Mesh;
}

View File

@ -20,32 +20,9 @@ export class ObjImporter extends IImporter {
private _normals: Vector3[] = [];
private _uvs: UV[] = [];
private _tris: Tri[] = [];
private _materials: Map<string, SolidMaterial | TexturedMaterial>;
public constructor() {
super();
this._materials = new Map();
this._materials.set('DEFAULT_UNASSIGNED', {
type: MaterialType.solid,
colour: RGBAColours.WHITE,
canBeTextured: false,
needsAttention: false,
});
}
private _mtlLibs: string[] = [];
private _currentMaterialName: string = 'DEFAULT_UNASSIGNED';
private _objPath?: path.ParsedPath;
private _objParsers = [
{
// e.g. 'mtllib my_file.mtl'
regex: new RegExpBuilder().add(/^mtllib/).add(/ /).add(REGEX_NZ_ANY, 'path').toRegExp(),
delegate: (match: { [key: string]: string }) => {
this._mtlLibs.push(match.path.trim());
},
},
{
// e.g. 'usemtl my_material'
regex: new RegExpBuilder().add(/^usemtl/).add(/ /).add(REGEX_NZ_ANY, 'name').toRegExp(),
@ -204,136 +181,29 @@ export class ObjImporter extends IImporter {
},
];
private _currentColour: RGBA = RGBAColours.BLACK;
private _currentAlpha?: number;
private _currentTexture: string = '';
private _currentTransparencyTexture: string = '';
private _materialReady: boolean = false;
private _mtlParsers = [
{
// e.g. 'newmtl my_material'
regex: new RegExpBuilder().add(/^newmtl/).add(REGEX_NZ_ANY, 'name').toRegExp(),
delegate: (match: { [key: string]: string }) => {
this._addCurrentMaterial();
this._currentMaterialName = match.name.trim();
this._currentTexture = '';
this._materialReady = false;
},
},
{
// e.g. 'Kd 0.123 0.456 0.789'
regex: new RegExpBuilder()
.add(/^Kd/)
.addNonzeroWhitespace()
.add(REGEX_NUMBER, 'r')
.addNonzeroWhitespace()
.add(REGEX_NUMBER, 'g')
.addNonzeroWhitespace()
.add(REGEX_NUMBER, 'b')
.toRegExp(),
delegate: (match: { [key: string]: string }) => {
const r = parseFloat(match.r);
const g = parseFloat(match.g);
const b = parseFloat(match.b);
checkNaN(r, g, b);
checkFractional(r, g, b);
this._currentColour = { r: r, g: g, b: b, a: this._currentAlpha ?? 1.0 };
this._materialReady = true;
},
},
{
// e.g. 'map_Kd my/path/to/file.png'
regex: new RegExpBuilder().add(/^map_Kd/).add(REGEX_NZ_ANY, 'path').toRegExp(),
delegate: (match: { [key: string]: string }) => {
let mtlPath = match.path.trim();
if (!path.isAbsolute(mtlPath)) {
ASSERT(this._objPath, 'no obj path');
mtlPath = path.join(this._objPath.dir, mtlPath);
}
this._currentTexture = mtlPath;
this._materialReady = true;
},
},
{
// Transparency map
// e.g. 'map_d my/path/to/file.png'
regex: new RegExpBuilder().add(/^map_d/).add(REGEX_NZ_ANY, 'path').toRegExp(),
delegate: (match: { [key: string]: string }) => {
let texturePath = match.path.trim();
if (!path.isAbsolute(texturePath)) {
ASSERT(this._objPath, 'no obj path');
texturePath = path.join(this._objPath.dir, texturePath);
}
this._currentTransparencyTexture = texturePath;
this._materialReady = true;
},
},
{
// Transparency value
// e.g. 'd 0.7500'
regex: new RegExpBuilder()
.add(/^d/)
.addNonzeroWhitespace()
.add(REGEX_NUMBER, 'alpha')
.toRegExp(),
delegate: (match: { [key: string]: string }) => {
const alpha = parseFloat(match.alpha);
checkNaN(alpha);
checkFractional(alpha);
this._currentAlpha = alpha;
},
},
];
override parseFile(filePath: string) {
this._objPath = path.parse(filePath);
this._parseOBJ(filePath);
if (this._mtlLibs.length === 0) {
StatusHandler.Get.add('warning', 'Could not find associated .mtl file');
}
for (let i = 0; i < this._mtlLibs.length; ++i) {
const mtlLib = this._mtlLibs[i];
if (!path.isAbsolute(mtlLib)) {
this._mtlLibs[i] = path.join(this._objPath.dir, mtlLib);
}
ASSERT(path.isAbsolute(this._mtlLibs[i]), 'path not absolute');
}
this._parseMTL();
LOG('Materials', this._materials);
override parse(fileSource: string) {
this._parseOBJ(fileSource);
}
override toMesh(): Mesh {
return new Mesh(this._vertices, this._normals, this._uvs, this._tris, this._materials);
return new Mesh(this._vertices, this._normals, this._uvs, this._tris, new Map());
}
private _parseOBJ(path: string) {
// TODO Unimplemented
/*
if (path === '') {
throw new AppError(`No filepath given`);
}
if (!fs.existsSync(path)) {
throw new AppError(`Could not find '${path}'`);
}
const fileContents = fs.readFileSync(path, 'utf8');
if (fileContents.includes('<27>')) {
private _parseOBJ(fileSource: string) {
if (fileSource.includes('<27>')) {
throw new AppError(`Unrecognised character found, please encode <b>${path}</b> using UTF-8`);
}
fileContents.replace('\r', ''); // Convert Windows carriage return
const fileLines = fileContents.split('\n');
fileSource.replace('\r', ''); // Convert Windows carriage return
const fileLines = fileSource.split('\n');
for (const line of fileLines) {
this.parseOBJLine(line);
}
*/
}
public parseOBJLine(line: string) {
const essentialTokens = ['mtllib ', 'usemtl ', 'v ', 'vt ', 'f ', 'vn '];
const essentialTokens = ['usemtl ', 'v ', 'vt ', 'f ', 'vn '];
for (const parser of this._objParsers) {
const match = parser.regex.exec(line);
@ -357,104 +227,4 @@ export class ObjImporter extends IImporter {
throw new AppError(`Failed to parse essential token for <b>${line}</b>`);
}
}
private _parseMTL() {
//TODO Unimplemented
/*
for (const mtlLib of this._mtlLibs) {
if (!fs.existsSync(mtlLib)) {
StatusHandler.Get.add('warning', `Could not find ${mtlLib}`);
continue;
}
const fileContents = fs.readFileSync(mtlLib, 'utf8');
fileContents.replace('\r', ''); // Convert Windows carriage return
const fileLines = fileContents.split('\n');
for (const line of fileLines) {
this._parseMTLLine(line.trim());
}
this._addCurrentMaterial();
}
*/
}
private _parseMTLLine(line: string) {
const essentialTokens = ['newmtl ', 'Kd ', 'map_Kd '];
for (const parser of this._mtlParsers) {
const match = parser.regex.exec(line);
if (match && match.groups) {
try {
parser.delegate(match.groups);
} catch (error) {
if (error instanceof AppError) {
throw new AppError(`Failed attempt to parse '${line}', because '${error.message}'`);
}
}
return;
}
}
const beginsWithEssentialToken = essentialTokens.some((token) => {
return line.startsWith(token);
});
if (beginsWithEssentialToken) {
throw new AppError(`Failed to parse essential token for ${line}`);
}
}
private _addCurrentMaterial() {
if (this._materialReady && this._currentMaterialName !== '') {
if (this._currentTexture !== '') {
let transparency: TTransparencyOptions;
if (this._currentTransparencyTexture === this._currentTexture) {
transparency = {
type: 'UseDiffuseMapAlphaChannel',
};
} else if (this._currentTransparencyTexture === '') {
if (this._currentAlpha === undefined) {
transparency = {
type: 'None',
};
} else {
transparency = {
type: 'UseAlphaValue',
alpha: this._currentAlpha,
};
}
} else {
transparency = {
type: 'UseAlphaMap',
path: this._currentTransparencyTexture,
channel: EImageChannel.R,
};
}
this._materials.set(this._currentMaterialName, {
type: MaterialType.textured,
path: this._currentTexture,
transparency: transparency,
extension: 'repeat',
interpolation: 'linear',
needsAttention: false,
});
this._currentTransparencyTexture = '';
} else {
this._materials.set(this._currentMaterialName, {
type: MaterialType.solid,
colour: {
r: this._currentColour.r,
g: this._currentColour.g,
b: this._currentColour.b,
a: this._currentAlpha ?? 1.0,
},
canBeTextured: false,
needsAttention: false,
});
}
this._currentAlpha = 1.0;
}
}
}

View File

@ -2,7 +2,6 @@ import { RGBAColours } from './colour';
import { MaterialMap, MaterialType } from './mesh';
import { EImageChannel, TTransparencyTypes } from './texture';
import { ASSERT } from './util/error_util';
import { AppPaths, PathUtil } from './util/path_util';
export class MaterialMapManager {
public materials: MaterialMap;
@ -23,7 +22,7 @@ export class MaterialMapManager {
case 'UseAlphaMap':
currentMaterial.transparency = {
type: 'UseAlphaMap',
path: PathUtil.join(AppPaths.Get.static, 'debug_alpha.png'),
alpha: undefined,
channel: EImageChannel.R,
};
break;
@ -75,7 +74,7 @@ export class MaterialMapManager {
extension: 'repeat',
interpolation: 'linear',
needsAttention: true,
path: PathUtil.join(AppPaths.Get.static, 'debug.png'),
diffuse: undefined,
});
break;
}

View File

@ -4,7 +4,7 @@ import { Bounds } from './bounds';
import { RGBA, RGBAColours, RGBAUtil } from './colour';
import { degreesToRadians } from './math';
import { StatusHandler } from './status';
import { Texture, TextureConverter, TTransparencyOptions } from './texture';
import { Texture, TextureConverter, TImageFiletype, TTransparencyOptions } from './texture';
import { Triangle, UVTriangle } from './triangle';
import { getRandomID, UV } from './util';
import { AppError, ASSERT } from './util/error_util';
@ -39,7 +39,10 @@ export type SolidMaterial = BaseMaterial & {
}
export type TexturedMaterial = BaseMaterial & {
type: MaterialType.textured,
path: string,
diffuse?: {
raw: string,
filetype: TImageFiletype
},
interpolation: TTexelInterpolation,
extension: TTexelExtension,
transparency: TTransparencyOptions,
@ -190,11 +193,6 @@ export class Mesh {
}
private _checkMaterials() {
if (this._materials.size === 0) {
throw new AppError('Loaded mesh has no materials');
}
// Check used materials exist
const usedMaterials = new Set<string>();
const missingMaterials = new Set<string>();
@ -327,7 +325,7 @@ export class Mesh {
this._loadedTextures.clear();
this._materials.forEach((material, materialName) => {
if (material.type === MaterialType.textured && !this._loadedTextures.has(materialName)) {
this._loadedTextures.set(materialName, new Texture(material.path, material.transparency));
this._loadedTextures.set(materialName, new Texture({ diffuse: material.diffuse, transparency: material.transparency }));
}
});
}

View File

@ -1,32 +1,19 @@
import path from 'path';
import { Atlas } from './atlas';
import { StatusHandler } from './status';
import { AppTypes, AppUtil, TOptional } from './util';
import { ASSERT } from './util/error_util';
import { LOG_WARN } from './util/log_util';
import { AppPaths, PathUtil } from './util/path_util';
export type TPalettes = 'all' | 'colourful' | 'greyscale' | 'schematic-friendly';
export class PaletteManager {
public static getPalettesInfo(): { paletteID: string, paletteDisplayName: string }[] {
const palettes: { paletteID: string, paletteDisplayName: string }[] = [];
// TODO Unimplemented
/*
fs.readdirSync(AppPaths.Get.palettes).forEach((file) => {
const paletteFilePath = path.parse(file);
if (paletteFilePath.ext === Palette.PALETTE_FILE_EXT) {
const paletteID = paletteFilePath.name;
let paletteDisplayName = paletteID.replace('-', ' ').toLowerCase();
paletteDisplayName = AppUtil.Text.capitaliseFirstLetter(paletteDisplayName);
palettes.push({ paletteID: paletteID, paletteDisplayName: paletteDisplayName });
}
});
*/
return palettes;
public static getPalettesInfo(): { id: TPalettes, name: string }[] {
return [
{ id: 'all', name: 'All' },
{ id: 'colourful', name: 'Colourful' },
{ id: 'greyscale', name: 'Greyscale' },
{ id: 'schematic-friendly', name: 'Schematic-friendly' },
];
}
}
@ -105,10 +92,12 @@ export class Palette {
*/
}
public add(blockName: AppTypes.TNamespacedBlockName): void {
if (!this._blocks.includes(blockName)) {
this._blocks.push(AppUtil.Text.namespaceBlock(blockName));
}
public add(blockNames: AppTypes.TNamespacedBlockName[]): void {
blockNames.forEach((blockName) => {
if (!this._blocks.includes(blockName)) {
this._blocks.push(AppUtil.Text.namespaceBlock(blockName));
}
});
}
public remove(blockName: string): boolean {

View File

@ -217,19 +217,37 @@ export class Renderer {
colourArray: RGBAUtil.toArray(material.colour),
};
} else {
const diffuseTexture = twgl.createTexture(this._gl, {
src: material.path,
min: material.interpolation === 'linear' ? this._gl.LINEAR : this._gl.NEAREST,
mag: material.interpolation === 'linear' ? this._gl.LINEAR : this._gl.NEAREST,
wrap: material.extension === 'clamp' ? this._gl.CLAMP_TO_EDGE : this._gl.REPEAT,
const blankTexture = twgl.createTexture(this._gl, {
min: this._gl.NEAREST,
mag: this._gl.NEAREST,
src: [
255, 0, 255, 255,
],
});
const alphaTexture = material.transparency.type === 'UseAlphaMap' ? twgl.createTexture(this._gl, {
src: material.transparency.path,
min: material.interpolation === 'linear' ? this._gl.LINEAR : this._gl.NEAREST,
mag: material.interpolation === 'linear' ? this._gl.LINEAR : this._gl.NEAREST,
wrap: material.extension === 'clamp' ? this._gl.CLAMP_TO_EDGE : this._gl.REPEAT,
}) : diffuseTexture;
let diffuseTexture = blankTexture;
let alphaTexture = diffuseTexture;
if (material.diffuse !== undefined && material.diffuse.raw !== '') {
diffuseTexture = twgl.createTexture(this._gl, {
src: material.diffuse?.raw, // TODO Unimplemented
min: material.interpolation === 'linear' ? this._gl.LINEAR : this._gl.NEAREST,
mag: material.interpolation === 'linear' ? this._gl.LINEAR : this._gl.NEAREST,
wrap: material.extension === 'clamp' ? this._gl.CLAMP_TO_EDGE : this._gl.REPEAT,
});
}
if (material.transparency.type === 'UseAlphaMap') {
alphaTexture = blankTexture;
if (material.transparency.alpha !== undefined && material.transparency.alpha.raw !== '') {
alphaTexture = twgl.createTexture(this._gl, {
src: material.transparency.alpha.raw, // TODO Unimplemented
min: material.interpolation === 'linear' ? this._gl.LINEAR : this._gl.NEAREST,
mag: material.interpolation === 'linear' ? this._gl.LINEAR : this._gl.NEAREST,
wrap: material.extension === 'clamp' ? this._gl.CLAMP_TO_EDGE : this._gl.REPEAT,
});
}
}
const alphaValue = material.transparency.type === 'UseAlphaValue' ?
material.transparency.alpha : 1.0;

View File

@ -1,14 +1,10 @@
import * as jpeg from 'jpeg-js';
import path from 'path';
const TGA = require('tga');
import { PNG } from 'pngjs';
import { RGBA, RGBAColours, RGBAUtil } from './colour';
import { AppConfig } from './config';
import { clamp } from './math';
import { UV } from './util';
import { AppError, ASSERT } from './util/error_util';
import { LOG, LOG_ERROR, LOGF } from './util/log_util';
import { AppPaths } from './util/path_util';
import { TOptional, UV } from './util';
import { ASSERT } from './util/error_util';
import { LOG } from './util/log_util';
import { TTexelExtension, TTexelInterpolation } from './util/type_util';
/* eslint-disable */
@ -41,71 +37,40 @@ export enum EImageChannel {
}
/* eslint-enable */
export type TImageFiletype = 'png';
export type TImageRawWrap = {
raw: string,
filetype: TImageFiletype,
}
export type TTransparencyTypes = 'None' | 'UseDiffuseMapAlphaChannel' | 'UseAlphaValue' | 'UseAlphaMap';
export type TTransparencyOptions =
| { type: 'None' }
| { type: 'UseDiffuseMapAlphaChannel' }
| { type: 'UseAlphaValue', alpha: number }
| { type: 'UseAlphaMap', path: string, channel: EImageChannel };
| { type: 'UseAlphaMap', alpha?: TImageRawWrap, channel: EImageChannel };
export class Texture {
private _image: ImageData;
private _alphaImage: ImageData;
private _transparency: TTransparencyOptions;
private _image?: ImageData;
private _alphaImage?: ImageData;
constructor(diffusePath: string, transparency: TTransparencyOptions) {
ASSERT(path.isAbsolute(diffusePath));
constructor(params: { diffuse?: TImageRawWrap, transparency: TTransparencyOptions }) {
this._image = this._readRawData(params.diffuse);
this._image = this._loadImageFile(diffusePath);
this._transparency = transparency;
this._alphaImage = transparency.type === 'UseAlphaMap' ?
this._loadImageFile(transparency.path) :
this._alphaImage = params.transparency.type === 'UseAlphaMap' ?
this._readRawData(params.transparency.alpha) :
this._image;
}
private _loadImageFile(filename: string): ImageData {
// TODO Unimplemented
return {
width: 0,
height: 0,
data: new Buffer(0),
};
// ASSERT(path.isAbsolute(filename));
// const filePath = path.parse(filename);
// try {
// const data = fs.readFileSync(filename);
// switch (filePath.ext.toLowerCase()) {
// case '.png': {
// ASSERT(false); // TODO Unimplemented
// //return PNG.sync.read(data);
// }
// case '.jpg':
// case '.jpeg': {
// this._useAlphaChannelValue = false;
// return jpeg.decode(data, {
// maxMemoryUsageInMB: AppConfig.Get.MAXIMUM_IMAGE_MEM_ALLOC,
// formatAsRGBA: true,
// });
// }
// /*
// case '.tga': {
// const tga = new TGA(data);
// return {
// width: tga.width,
// height: tga.height,
// data: tga.pixels,
// };
// }
// */
// default:
// ASSERT(false, 'Unsupported image format');
// }
// } catch (err) {
// LOG_ERROR(err);
// throw new AppError(`Could not read ${filename}`);
// }
private _readRawData(params?: TImageRawWrap): TOptional<ImageData> {
if (params?.filetype === 'png') {
const png = params.raw.split(',')[1];
if (png !== undefined) {
return PNG.sync.read(Buffer.from(png, 'base64'));
}
}
}
private _correctTexcoord(a: number) {
@ -133,13 +98,13 @@ export class Texture {
ASSERT(uv.v >= 0.0 && uv.v <= 1.0, 'Texcoord UV.v OOB');
uv.v = 1.0 - uv.v;
const diffuse = (interpolation === 'nearest') ?
const diffuse = this._image === undefined ? RGBAColours.MAGENTA : ((interpolation === 'nearest') ?
this._getNearestRGBA(this._image, uv) :
this._getLinearRGBA(this._image, uv);
this._getLinearRGBA(this._image, uv));
const alpha = (interpolation === 'nearest') ?
const alpha = this._alphaImage === undefined ? RGBAColours.MAGENTA : ((interpolation === 'nearest') ?
this._getNearestRGBA(this._alphaImage, uv) :
this._getLinearRGBA(this._alphaImage, uv);
this._getLinearRGBA(this._alphaImage, uv));
return {
r: diffuse.r,
@ -168,12 +133,12 @@ export class Texture {
return RGBAColours.MAGENTA;
}
const A = Texture._sampleImage(this._image, xLeft, yUp);
const B = Texture._sampleImage(this._image, xRight, yUp);
const A = Texture._sampleImage(xLeft, yUp, this._image);
const B = Texture._sampleImage(xRight, yUp, this._image);
const AB = RGBAUtil.lerp(A, B, u);
const C = Texture._sampleImage(this._image, xLeft, yDown);
const D = Texture._sampleImage(this._image, xRight, yDown);
const C = Texture._sampleImage(xLeft, yDown, this._image);
const D = Texture._sampleImage(xRight, yDown, this._image);
const CD = RGBAUtil.lerp(C, D, u);
return RGBAUtil.lerp(AB, CD, v);
@ -186,7 +151,7 @@ export class Texture {
const diffuseX = Math.floor(uv.u * image.width);
const diffuseY = Math.floor(uv.v * image.height);
return Texture._sampleImage(image, diffuseX, diffuseY);
return Texture._sampleImage(diffuseX, diffuseY, image);
}
private _sampleChannel(colour: RGBA, channel: EImageChannel) {
@ -207,7 +172,7 @@ export class Texture {
for (let i = 0; i < this._alphaImage.width; ++i) {
for (let j = 0; j < this._alphaImage.height; ++j) {
const value = Texture._sampleImage(this._alphaImage, i, j);
const value = Texture._sampleImage(i, j, this._alphaImage);
if (value.a != 1.0) {
LOG(`Using alpha channel`);
this._useAlphaChannelValue = true;
@ -221,7 +186,11 @@ export class Texture {
return false;
}
private static _sampleImage(image: ImageData, x: number, y: number) {
private static _sampleImage(x: number, y: number, image?: ImageData) {
if (image === undefined) {
return RGBAColours.MAGENTA;
}
x = clamp(x, 0, image.width - 1);
y = clamp(y, 0, image.height - 1);

View File

@ -1,14 +1,16 @@
import * as path from 'path';
import { ASSERT } from '../../util/error_util';
import { UIUtil } from '../../util/ui_util';
import { ConfigUIElement } from './config_element';
export class FileInputElement extends ConfigUIElement<string, HTMLDivElement> {
export class FileInputElement extends ConfigUIElement<Promise<string>, HTMLDivElement> {
private _fileExtensions: string[];
private _loadedFilePath: string;
private _hovering: boolean;
public constructor() {
super('');
super(Promise.resolve(''));
this._fileExtensions = [];
this._loadedFilePath = '';
this._hovering = false;
@ -25,6 +27,7 @@ export class FileInputElement extends ConfigUIElement<string, HTMLDivElement> {
protected override _generateInnerHTML() {
return `
<div class="input-file" id="${this._getId()}">
<input type="file" accept=".obj" style="display: none;" id="${this._getId()}-input">
${this._loadedFilePath}
</div>
`;
@ -41,28 +44,24 @@ export class FileInputElement extends ConfigUIElement<string, HTMLDivElement> {
this._updateStyle();
});
const inputElement = UIUtil.getElementById(this._getId() + '-input') as HTMLInputElement;
inputElement.addEventListener('change', () => {
const files = inputElement.files;
if (files?.length === 1) {
const file = files.item(0);
ASSERT(file !== null);
this._loadedFilePath = file.name;
this._setValue(file.text());
}
});
this._getElement().addEventListener('click', () => {
// TODO Unimplemented
/*
if (!this.getEnabled()) {
return;
}
const files = remote.dialog.showOpenDialogSync({
title: 'Load file',
buttonLabel: 'Load',
filters: [{
name: 'Model file',
extensions: this._fileExtensions,
}],
});
if (files && files[0] !== undefined) {
const filePath = files[0];
this._loadedFilePath = filePath;
this._setValue(filePath);
}
*/
inputElement.click();
});
this._getElement().addEventListener('mousemove', () => {

View File

@ -1,43 +1,24 @@
import path from 'path';
import { getRandomID } from '../../util';
import { ASSERT } from '../../util/error_util';
import { UIUtil } from '../../util/ui_util';
import { AppIcons } from '../icons';
import { ConfigUIElement } from './config_element';
import { ToolbarItemElement } from './toolbar_item';
export class ImageElement extends ConfigUIElement<string, HTMLDivElement> {
export class ImageElement extends ConfigUIElement<Promise<string>, HTMLImageElement> {
private _switchElement: ToolbarItemElement;
private _openElement: ToolbarItemElement;
private _imageId: string;
public constructor(path: string) {
super(path);
public constructor(source?: string) {
super(Promise.resolve(source ?? ''));
this._switchElement = new ToolbarItemElement({ iconSVG: AppIcons.UPLOAD })
.setSmall()
.setLabel('Choose')
.onClick(() => {
// TODO Unimplemented
/*
const files = remote.dialog.showOpenDialogSync({
title: 'Load',
buttonLabel: 'Load',
filters: [{
name: 'Images',
extensions: ['png', 'jpeg', 'jpg', 'tga'],
}],
});
if (files && files[0]) {
this._setValue(files[0]);
}
*/
});
this._openElement = new ToolbarItemElement({ iconSVG: AppIcons.FOLDER })
.setSmall()
.onClick(() => {
// TODO Unimplemented
//FileUtil.openDir(this.getValue());
const inputElement = UIUtil.getElementById(this._getId() + '-input') as HTMLInputElement;
inputElement.click();
});
this._imageId = getRandomID();
@ -47,16 +28,14 @@ export class ImageElement extends ConfigUIElement<string, HTMLDivElement> {
return `
<div class="row-container">
<div class="row-item">
<img id="${this._imageId}" class="texture-preview" src="${this.getValue()}" loading="lazy"></img>
<img id="${this._imageId}" class="texture-preview" loading="lazy"></img>
</div>
<div class="row-item">
<div class="col-container">
<div class="col-item">
<input type="file" accept="images/png" style="display: none;" id="${this._getId()}-input">
${this._switchElement.generateHTML()}
</div>
<div class="col-item">
${this._openElement.generateHTML()}
</div>
</div>
</div>
</div>
@ -65,21 +44,48 @@ export class ImageElement extends ConfigUIElement<string, HTMLDivElement> {
public override registerEvents(): void {
this._switchElement.registerEvents();
this._openElement.registerEvents();
const inputElement = UIUtil.getElementById(this._getId() + '-input') as HTMLInputElement;
inputElement.addEventListener('change', () => {
const files = inputElement.files;
if (files?.length === 1) {
const file = files.item(0);
ASSERT(file !== null);
this._setValue(new Promise((res, rej) => {
const fileReader = new FileReader();
fileReader.onload = function () {
if (typeof fileReader.result === 'string') {
res(fileReader.result);
} else {
rej(Error());
}
};
fileReader.readAsDataURL(file);
}));
}
});
}
protected override _onEnabledChanged(): void {
}
protected override _onValueChanged(): void {
const newPath = this.getValue();
const parsedPath = path.parse(newPath);
this._openElement.setEnabled(parsedPath.base !== 'debug.png' && parsedPath.base !== 'debug_alpha.png');
this._switchElement.setActive(parsedPath.base === 'debug.png' || parsedPath.base === 'debug_alpha.png');
const imageElement = UIUtil.getElementById(this._imageId) as HTMLImageElement;
imageElement.src = newPath;
const inputElement = UIUtil.getElementById(this._imageId) as HTMLImageElement;
this.getValue()
.then((source) => {
if (source === '') {
throw Error();
}
this._switchElement.setActive(false);
inputElement.src = source;
inputElement.style.display = 'unset';
})
.catch((err) => {
this._switchElement.setActive(true);
inputElement.src = '';
inputElement.style.display = 'none';
});
}
public override finalise(): void {

View File

@ -45,7 +45,7 @@ export class TexturedMaterialElement extends ConfigUIElement<TexturedMaterial, H
.setSmall()
.setDefaultValue(material.transparency.type);
this._imageElement = new ImageElement(material.path);
this._imageElement = new ImageElement(material.diffuse?.raw);
this._typeElement = new MaterialTypeElement(MaterialType.textured);
@ -60,7 +60,7 @@ export class TexturedMaterialElement extends ConfigUIElement<TexturedMaterial, H
.setSmall();
break;
case 'UseAlphaMap':
this._alphaMapElement = new ImageElement(material.transparency.path);
this._alphaMapElement = new ImageElement(material.transparency.alpha?.raw);
this._alphaChannelElement = new ComboBoxElement<EImageChannel>()
.addItem({ payload: EImageChannel.R, displayText: 'Red' })
.addItem({ payload: EImageChannel.G, displayText: 'Green' })
@ -84,7 +84,13 @@ export class TexturedMaterialElement extends ConfigUIElement<TexturedMaterial, H
this._imageElement.addValueChangedListener((newPath) => {
const material = this.getValue();
material.path = newPath;
// TODO Unimplemented, promise should be resolved where it is used
newPath.then((source) => {
material.diffuse = {
filetype: 'png', // TODO Unimplemented other filetypes
raw: source,
};
});
});
this._filteringElement.addValueChangedListener((newFiltering) => {
@ -109,8 +115,14 @@ export class TexturedMaterialElement extends ConfigUIElement<TexturedMaterial, H
this._alphaMapElement?.addValueChangedListener((newPath) => {
const material = this.getValue();
ASSERT(material.transparency.type === 'UseAlphaMap');
material.transparency.path = newPath;
// TODO Unimplemented, promise should be resolved where it is used
newPath.then((source) => {
ASSERT(material.transparency.type === 'UseAlphaMap');
material.transparency.alpha = {
filetype: 'png', // TODO Unimplemented other filetypes
raw: source,
};
});
});
this._alphaChannelElement?.addValueChangedListener((newChannel) => {

View File

@ -2,7 +2,7 @@ import { AppContext } from '../app_context';
import { FallableBehaviour } from '../block_mesh';
import { ArcballCamera } from '../camera';
import { TExporters } from '../exporters/exporters';
import { PaletteManager } from '../palette';
import { PaletteManager, TPalettes } from '../palette';
import { MeshType, Renderer } from '../renderer';
import { EAction } from '../util';
import { ASSERT } from '../util/error_util';
@ -665,14 +665,14 @@ export class UI {
return textureAtlases;
}
private _getBlockPalettes(): ComboBoxItem<string>[] {
const blockPalettes: ComboBoxItem<string>[] = [];
private _getBlockPalettes(): ComboBoxItem<TPalettes>[] {
const blockPalettes: ComboBoxItem<TPalettes>[] = [];
const palettes = PaletteManager.getPalettesInfo();
for (const palette of palettes) {
blockPalettes.push({
payload: palette.paletteID,
displayText: palette.paletteDisplayName,
payload: palette.id,
displayText: palette.name,
});
}

View File

@ -4,6 +4,7 @@ import { BufferGenerator } from './buffer';
import { EAppEvent, EventManager } from './event';
import { IExporter } from './exporters/base_exporter';
import { ExporterFactory } from './exporters/exporters';
import { ImporterFactor } from './importers/importers';
import { ObjImporter } from './importers/obj_importer';
import { Mesh } from './mesh';
import { ProgressManager, TTaskHandle } from './progress';
@ -69,8 +70,9 @@ export class WorkerClient {
}
public import(params: ImportParams.Input): ImportParams.Output {
const importer = new ObjImporter();
importer.parseFile(params.filepath);
const importer = ImporterFactor.GetImporter(params.importer);
importer.parse(params.fileSource);
this._loadedMesh = importer.toMesh();
this._loadedMesh.processMesh(params.rotation.y, params.rotation.x, params.rotation.z);

View File

@ -2,6 +2,7 @@ import { FallableBehaviour } from './block_mesh';
import { TBlockMeshBufferDescription, TMeshBufferDescription, TVoxelMeshBufferDescription } from './buffer';
import { RGBAUtil } from './colour';
import { TExporters } from './exporters/exporters';
import { TImporters } from './importers/importers';
import { MaterialMap } from './mesh';
import { StatusMessage } from './status';
import { ColourSpace } from './util';
@ -22,7 +23,8 @@ export namespace InitParams {
export namespace ImportParams {
export type Input = {
filepath: string,
importer: TImporters,
fileSource: string,
rotation: Vector3,
}

View File

@ -34,6 +34,7 @@ body {
font-family: 'Lexend', sans-serif;
overflow: hidden;
user-select: none;
font-size: 85%;
}
canvas {
@ -94,7 +95,7 @@ canvas {
.prop-key-container {
align-self: center;
padding: 0px 10px 0px 0px;
width: 125px;
width: 150px;
overflow: auto;
}
@ -188,6 +189,7 @@ canvas {
}
input {
font-size: 100%;
user-select: none;
margin-right: 3px;
border-radius: var(--border-radius);
@ -215,6 +217,7 @@ input::-webkit-inner-spin-button {
}
select {
font-size: 100%;
width: 100%;
height: var(--property-height);
padding-left: 5px;

View File

@ -1,10 +1,13 @@
import fs from 'fs';
import { ColourSpace } from '../src/util';
import { Vector3 } from '../src/vector';
import { THeadlessConfig } from './headless';
export const headlessConfig: THeadlessConfig = {
import: {
filepath: '/Users/lucasdower/ObjToSchematic/res/samples/skull.obj', // Must be an absolute path
importer: 'obj',
fileSource: fs.readFileSync('/Users/lucasdower/ObjToSchematic/res/samples/skull.obj', 'utf8'),
rotation: new Vector3(0, 0, 0),
},
voxelise: {

View File

@ -16,6 +16,10 @@ module.exports = {
test: /\.vs|fs$/,
use: 'raw-loader',
},
{
test: /\.png$/,
use: 'file-loader',
},
{
test: /\.tsx?$/,
use: 'ts-loader',

2
webpack/bundle.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,19 @@
/* @license twgl.js 4.24.0 Copyright (c) 2015, Gregg Tavares All Rights Reserved.
Available via the MIT license.
see: http://github.com/greggman/twgl.js for details */
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <https://feross.org>
* @license MIT
*/
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */