Fix the studio's 3D terrain: blank views, grey blocks, pale colours
The 3D views looked for tiles across the world's whole build height. In a pack with a tall sky most of a tile's box is air, so once the camera came close to the ground the planner drew sixteen far tiles and none under the camera. Tiles are now looked for between the lowest and highest ground drawn so far, and ranked by how far they lie from the ground in the middle of the view instead of by their centre point. Saved tiles named blocks without their properties, which matched no model variant, so grass and every plugin block drew as flat grey. Saved and generated tiles now carry the state players see, which for a plugin block is the vanilla state it borrows. Colours went through three.js colour management as if they were linear light and came out pale with flat shading. They are drawn as given now, as v3e does. Gaps in cut-out textures such as leaves take the texture's own colour instead of black. Also in the studio: - Right click or Ctrl+click on 3D terrain teleports there, as on the map. - The land, sea and cave biome layer views are gone. - New icons for the views and the map tools that shared one or said something else. - A saved world with nothing finished says so instead of reading forever.
No files matched your search
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.core.studio.bridge;
|
||||
|
||||
import art.arcane.iris.core.link.CustomBlockLook;
|
||||
import art.arcane.iris.core.studio.map.MapLabel;
|
||||
import art.arcane.iris.core.studio.map.MapTile;
|
||||
import com.google.gson.Gson;
|
||||
@@ -26,6 +27,8 @@ import java.nio.ByteBuffer;
|
||||
import java.nio.ByteOrder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
|
||||
/**
|
||||
* A {@link MapTile} as the studio reads it, little endian:
|
||||
@@ -36,7 +39,7 @@ import java.util.List;
|
||||
* i16 ground[grid²] | padding to 4 | i16 cover[grid²], when the header names blocks
|
||||
* </pre>
|
||||
* The header holds the size, the scale, the subject kind, the labels the grids index, and the blocks the ground and
|
||||
* cover grids index when the tile carries the tops of its columns. Every array starts on a
|
||||
* cover grids index when the tile carries the tops of its columns, each as the state players see. Every array starts on a
|
||||
* multiple of 4 bytes, so the studio views them in place.
|
||||
*/
|
||||
final class MapTileEncoding {
|
||||
@@ -45,12 +48,16 @@ final class MapTileEncoding {
|
||||
private MapTileEncoding() {
|
||||
}
|
||||
|
||||
static byte[] encode(MapTile tile, Gson gson) {
|
||||
/**
|
||||
* @param pluginLooks the plugin block a server state is with the vanilla state players see in its place; empty for
|
||||
* every state that is no plugin's block
|
||||
*/
|
||||
static byte[] encode(MapTile tile, Gson gson, Function<String, Optional<CustomBlockLook>> pluginLooks) {
|
||||
boolean hasHeights = tile.heights() != null;
|
||||
boolean hasPickNoise = tile.pickNoise() != null;
|
||||
MapTile.Blocks blocks = tile.blocks();
|
||||
byte[] header = gson.toJson(new Header(tile.size(), tile.blocksPerPixel(), tile.subjectKind(), tile.labels(),
|
||||
hasHeights, hasPickNoise, blocks == null ? null : blocks.names()))
|
||||
hasHeights, hasPickNoise, blocks == null ? null : statesPlayersSee(blocks.names(), pluginLooks)))
|
||||
.getBytes(StandardCharsets.UTF_8);
|
||||
int cells = tile.gridSize() * tile.gridSize();
|
||||
int length = aligned(Integer.BYTES + header.length)
|
||||
@@ -91,6 +98,12 @@ final class MapTileEncoding {
|
||||
buffer.position(aligned(buffer.position()));
|
||||
}
|
||||
|
||||
private static List<String> statesPlayersSee(List<String> serverStates, Function<String, Optional<CustomBlockLook>> pluginLooks) {
|
||||
return serverStates.stream()
|
||||
.map(state -> pluginLooks.apply(state).map(CustomBlockLook::shownAs).orElse(state))
|
||||
.toList();
|
||||
}
|
||||
|
||||
private record Header(int size, double blocksPerPixel, MapLabel.Kind subjectKind, List<MapLabel> labels,
|
||||
boolean heights, boolean pickNoise, List<String> blocks) {
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package art.arcane.iris.core.studio.bridge;
|
||||
|
||||
import art.arcane.iris.core.studio.map.MapLabel;
|
||||
import art.arcane.iris.core.studio.saved.SavedBlock;
|
||||
import art.arcane.iris.core.studio.saved.SavedTile;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
@@ -34,7 +35,7 @@ import java.util.List;
|
||||
* i16 groundY[size²] | padding to 4 | i16 waterSurfaceY[size²] | padding to 4
|
||||
* i16 blocks[size²] | padding to 4 | i16 biomes[size²]
|
||||
* </pre>
|
||||
* The header holds the size, the scale, the block names and the biome labels the grids index, and the values that mean
|
||||
* The header holds the size, the scale, the blocks and the biome labels the grids index, and the values that mean
|
||||
* no ground and no water.
|
||||
*/
|
||||
final class SavedTileEncoding {
|
||||
@@ -44,7 +45,7 @@ final class SavedTileEncoding {
|
||||
}
|
||||
|
||||
static byte[] encode(SavedTile tile, List<MapLabel> biomes, Gson gson) {
|
||||
byte[] header = gson.toJson(new Header(tile.size(), tile.blocksPerPixel(), tile.blockNames(), biomes,
|
||||
byte[] header = gson.toJson(new Header(tile.size(), tile.blocksPerPixel(), tile.savedBlocks(), biomes,
|
||||
SavedTile.NO_GROUND, SavedTile.NO_WATER)).getBytes(StandardCharsets.UTF_8);
|
||||
List<short[]> grids = List.of(tile.groundY(), tile.waterSurfaceY(), tile.blocks(), tile.biomes());
|
||||
int gridBytes = aligned(tile.size() * tile.size() * Short.BYTES);
|
||||
@@ -63,6 +64,6 @@ final class SavedTileEncoding {
|
||||
return (bytes + ALIGNMENT_BYTES - 1) / ALIGNMENT_BYTES * ALIGNMENT_BYTES;
|
||||
}
|
||||
|
||||
private record Header(int size, int blocksPerPixel, List<String> blocks, List<MapLabel> biomes, int noGround, int noWater) {
|
||||
private record Header(int size, int blocksPerPixel, List<SavedBlock> blocks, List<MapLabel> biomes, int noGround, int noWater) {
|
||||
}
|
||||
}
|
||||
@@ -335,9 +335,6 @@ public final class StudioBridge implements AutoCloseable {
|
||||
|
||||
private static MapPickInspection.Inspection picks(Engine engine, Query query) {
|
||||
MapLayer layer = layer(engine, query);
|
||||
if (!layer.hasPickNoise()) {
|
||||
throw new RequestError(STATUS_BAD_REQUEST, "The " + layer.view().label() + " view has no picks to inspect");
|
||||
}
|
||||
try {
|
||||
MapPickInspection.Area area = new MapPickInspection.Area(
|
||||
query.number("minX"), query.number("minZ"), query.number("maxX"), query.number("maxZ"));
|
||||
@@ -609,7 +606,7 @@ public final class StudioBridge implements AutoCloseable {
|
||||
if (query.has("blocks")) {
|
||||
tile = withBlocks(session, tile, startX, startZ, blockSource(query), cancelled);
|
||||
}
|
||||
return MapTileEncoding.encode(tile, gson);
|
||||
return MapTileEncoding.encode(tile, gson, StudioBridge::pluginLookOf);
|
||||
}
|
||||
|
||||
private static MapTile withBlocks(StudioWorld.Session session, MapTile tile, double startX, double startZ, BlockSource source,
|
||||
|
||||
@@ -49,11 +49,6 @@ public record MapLayer(MapView view, IrisRegion previewRegion) {
|
||||
return previewRegion != null;
|
||||
}
|
||||
|
||||
/** Whether the layer can show the noise that picked each spot: the region view, its previews and the biome view. */
|
||||
public boolean hasPickNoise() {
|
||||
return view == MapView.BIOMES || view == MapView.REGIONS;
|
||||
}
|
||||
|
||||
/** Whether each spot is labelled with its region rather than a biome; a preview labels the biomes. */
|
||||
boolean labelsRegions() {
|
||||
return view.labelsRegions() && !previews();
|
||||
|
||||
@@ -46,7 +46,6 @@ public final class MapPickInspection {
|
||||
private MapPickInspection() {
|
||||
}
|
||||
|
||||
/** @throws IllegalArgumentException for a view whose spots no noise picks, such as a biome layer's */
|
||||
public static Inspection measure(Engine engine, MapLayer layer, Area area) {
|
||||
if (layer.previews()) {
|
||||
return measurePreview(engine, layer.previewRegion(), area);
|
||||
@@ -54,7 +53,6 @@ public final class MapPickInspection {
|
||||
return switch (layer.view()) {
|
||||
case REGIONS -> measureRegions(engine, area);
|
||||
case BIOMES -> measureBiomes(engine, area);
|
||||
default -> throw new IllegalArgumentException("The " + layer.view().label() + " view has no picks to inspect");
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -51,13 +51,7 @@ public final class MapPickPath {
|
||||
return path;
|
||||
}
|
||||
path.add(regionStep(engine, region, x, z));
|
||||
MapView view = layer.view();
|
||||
switch (view) {
|
||||
case LAND_BIOMES -> addListStep(path, engine, view, region, InferredType.LAND, x, z);
|
||||
case SEA_BIOMES -> addListStep(path, engine, view, region, InferredType.SEA, x, z);
|
||||
case CAVE_BIOMES -> addListStep(path, engine, view, region, InferredType.CAVE, x, z);
|
||||
case BIOMES, REGIONS -> addBaseBiomeSteps(path, engine, view, region, x, z);
|
||||
}
|
||||
addBaseBiomeSteps(path, engine, layer.view(), region, x, z);
|
||||
return path;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,8 +49,7 @@ public final class MapTileRenderer {
|
||||
/**
|
||||
* The square of {@code size} pixels whose top left pixel samples ({@code startX}, {@code startZ}).
|
||||
*
|
||||
* @param extras what to sample besides the labels; the height view always has heights, and only a layer that
|
||||
* {@linkplain MapLayer#hasPickNoise() has pick noise} gets it
|
||||
* @param extras what to sample besides the labels; the height view always has heights
|
||||
* @throws CancellationException as soon as {@code cancelled} answers true
|
||||
*/
|
||||
public MapTile render(MapLayer layer, double startX, double startZ, double blocksPerPixel, int size,
|
||||
@@ -120,12 +119,10 @@ public final class MapTileRenderer {
|
||||
IrisComplex complex = engine.getComplex();
|
||||
ProceduralStream<IrisRegion> regionStream = complex.getRegionStream();
|
||||
short[] regions = everyCell(grid, (x, z) -> labels.indexOf(regionStream.get(x, z)));
|
||||
ProceduralStream<IrisBiome> biomeStream = layer.view().biomeStream(complex);
|
||||
short[] subjects = layer.labelsRegions() ? regions : everyCell(grid, (x, z) -> labels.indexOf(biomeStream.get(x, z)));
|
||||
ProceduralStream<IrisBiome> baseBiomes = complex.getBaseBiomeStream();
|
||||
short[] subjects = layer.labelsRegions() ? regions : everyCell(grid, (x, z) -> labels.indexOf(baseBiomes.get(x, z)));
|
||||
float[] heights = extras.contains(MapTile.Extra.HEIGHTS) ? latticeHeights(grid) : null;
|
||||
float[] pickNoise = extras.contains(MapTile.Extra.PICK_NOISE) && layer.hasPickNoise()
|
||||
? MapPickNoise.sample(engine, layer, grid)
|
||||
: null;
|
||||
float[] pickNoise = extras.contains(MapTile.Extra.PICK_NOISE) ? MapPickNoise.sample(engine, layer, grid) : null;
|
||||
MapLabel.Kind subjectKind = layer.labelsRegions() ? MapLabel.Kind.REGION : MapLabel.Kind.BIOME;
|
||||
return new MapTile(grid.size() - 2, blocksPerPixel, subjectKind, labels.labels(), subjects, regions, heights, pickNoise, null);
|
||||
}
|
||||
|
||||
@@ -18,10 +18,7 @@
|
||||
|
||||
package art.arcane.iris.core.studio.map;
|
||||
|
||||
import art.arcane.iris.engine.IrisComplex;
|
||||
import art.arcane.iris.engine.framework.render.RenderType;
|
||||
import art.arcane.iris.engine.object.world.biome.IrisBiome;
|
||||
import art.arcane.iris.util.project.stream.ProceduralStream;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Optional;
|
||||
@@ -29,12 +26,7 @@ import java.util.Optional;
|
||||
/** The studio map's views of a world drawn from its engine streams, one tile at a time. */
|
||||
public enum MapView {
|
||||
BIOMES("biomes", "Biomes", "The biome at each spot, in the biome's colour", Group.WORLD, RenderType.BIOME),
|
||||
REGIONS("regions", "Regions", "The region each spot belongs to", Group.WORLD, RenderType.REGION),
|
||||
LAND_BIOMES("landBiomes", "Land biomes", "The land biome each spot would get, also where the sea is",
|
||||
Group.BIOME_LAYERS, RenderType.BIOME_LAND),
|
||||
SEA_BIOMES("seaBiomes", "Sea biomes", "The sea biome each spot would get, also where the land is",
|
||||
Group.BIOME_LAYERS, RenderType.BIOME_SEA),
|
||||
CAVE_BIOMES("caveBiomes", "Cave biomes", "The cave biome under each spot", Group.BIOME_LAYERS, RenderType.CAVE_LAND);
|
||||
REGIONS("regions", "Regions", "The region each spot belongs to", Group.WORLD, RenderType.REGION);
|
||||
|
||||
private final String id;
|
||||
private final String label;
|
||||
@@ -80,19 +72,8 @@ public enum MapView {
|
||||
return colorType;
|
||||
}
|
||||
|
||||
/** The biome each spot is labelled with: the base biome, before the height corrects it near coasts. */
|
||||
ProceduralStream<IrisBiome> biomeStream(IrisComplex complex) {
|
||||
return switch (this) {
|
||||
case LAND_BIOMES -> complex.getLandBiomeStream();
|
||||
case SEA_BIOMES -> complex.getSeaBiomeStream();
|
||||
case CAVE_BIOMES -> complex.getCaveBiomeStream();
|
||||
case BIOMES, REGIONS -> complex.getBaseBiomeStream();
|
||||
};
|
||||
}
|
||||
|
||||
public enum Group {
|
||||
WORLD("World"),
|
||||
BIOME_LAYERS("Biome layers");
|
||||
WORLD("World");
|
||||
|
||||
private final String label;
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Iris is a World Generator for Minecraft Servers
|
||||
* Copyright (c) 2026 Arcane Arts (Volmit Software)
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package art.arcane.iris.core.studio.saved;
|
||||
|
||||
/**
|
||||
* A block as a region file holds it.
|
||||
*
|
||||
* @param name such as {@code minecraft:stone}, without its properties; a plugin's block is named as its plugin does
|
||||
* @param drawnAs the state it was saved as, such as {@code minecraft:grass_block[snowy=false]}, which is what players see
|
||||
*/
|
||||
public record SavedBlock(String name, String drawnAs) {
|
||||
}
|
||||
@@ -28,6 +28,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -91,14 +92,24 @@ final class SavedChunk {
|
||||
|
||||
/** The block's name, such as {@code minecraft:stone}, without its properties; a plugin's block is named as its plugin does. */
|
||||
String blockAt(int x, int y, int z) {
|
||||
return nameOf(paletteBlockAt(x, y, z));
|
||||
}
|
||||
|
||||
/** The block with the state it was saved as, which is what players see of it. */
|
||||
SavedBlock savedBlockAt(int x, int y, int z) {
|
||||
Tag<?> block = paletteBlockAt(x, y, z);
|
||||
return new SavedBlock(nameOf(block), savedStateOf(block));
|
||||
}
|
||||
|
||||
private Tag<?> paletteBlockAt(int x, int y, int z) {
|
||||
CompoundTag section = sectionsByY.get(Math.floorDiv(y, BLOCKS_ACROSS));
|
||||
if (section == null || !section.containsKey("block_states")) {
|
||||
return AIR;
|
||||
return new StringTag(AIR);
|
||||
}
|
||||
CompoundTag states = section.getCompoundTag("block_states");
|
||||
ListTag<?> palette = states.getListTag("palette");
|
||||
int index = (Math.floorMod(y, BLOCKS_ACROSS) * BLOCKS_ACROSS + z) * BLOCKS_ACROSS + x;
|
||||
return nameOf(paletteEntry(palette, states.getLongArray("data"), Math.max(SMALLEST_BLOCK_INDEX_BITS, bitsFor(palette.size())), index));
|
||||
return paletteEntry(palette, states.getLongArray("data"), Math.max(SMALLEST_BLOCK_INDEX_BITS, bitsFor(palette.size())), index);
|
||||
}
|
||||
|
||||
/** The biome's key, such as {@code minecraft:plains}; biomes are stored once per 4 blocks across. */
|
||||
@@ -126,15 +137,28 @@ final class SavedChunk {
|
||||
return entry < palette.size() ? palette.get(entry) : null;
|
||||
}
|
||||
|
||||
// A block with properties is a compound naming it under Name; since 26.1 a block without them may be its bare name.
|
||||
private String nameOf(Tag<?> block) {
|
||||
String name = switch (block) {
|
||||
return customBlocks.nameSavedAs(vanillaNameOf(block), () -> propertiesOf(block));
|
||||
}
|
||||
|
||||
private static String savedStateOf(Tag<?> block) {
|
||||
Map<String, String> properties = new TreeMap<>(propertiesOf(block));
|
||||
if (properties.isEmpty()) {
|
||||
return vanillaNameOf(block);
|
||||
}
|
||||
return vanillaNameOf(block) + properties.entrySet().stream()
|
||||
.map(property -> property.getKey() + "=" + property.getValue())
|
||||
.collect(Collectors.joining(",", "[", "]"));
|
||||
}
|
||||
|
||||
// A block with properties is a compound naming it under Name; since 26.1 a block without them may be its bare name.
|
||||
private static String vanillaNameOf(Tag<?> block) {
|
||||
return switch (block) {
|
||||
case StringTag text -> text.getValue();
|
||||
case CompoundTag compound when !compound.getString("Name").isEmpty() -> compound.getString("Name");
|
||||
case CompoundTag compound when !compound.getString("").isEmpty() -> compound.getString("");
|
||||
case null, default -> UNKNOWN;
|
||||
};
|
||||
return customBlocks.nameSavedAs(name, () -> propertiesOf(block));
|
||||
}
|
||||
|
||||
private static Map<String, String> propertiesOf(Tag<?> block) {
|
||||
|
||||
@@ -54,9 +54,9 @@ final class SavedRegion {
|
||||
private final short[] waterSurfaceY = new short[BLOCKS_ACROSS * BLOCKS_ACROSS];
|
||||
private final short[] blockIds = new short[BLOCKS_ACROSS * BLOCKS_ACROSS];
|
||||
private final short[] biomeIds = new short[BLOCKS_ACROSS * BLOCKS_ACROSS];
|
||||
private final List<String> blocks = new CopyOnWriteArrayList<>();
|
||||
private final List<SavedBlock> blocks = new CopyOnWriteArrayList<>();
|
||||
private final List<String> biomes = new CopyOnWriteArrayList<>();
|
||||
private final Map<String, Short> blockIndex = new HashMap<>();
|
||||
private final Map<SavedBlock, Short> blockIndex = new HashMap<>();
|
||||
private final Map<String, Short> biomeIndex = new HashMap<>();
|
||||
private final Map<Integer, Integer> waterColumnsBySurface = new HashMap<>();
|
||||
private int minY = Integer.MAX_VALUE;
|
||||
@@ -135,7 +135,7 @@ final class SavedRegion {
|
||||
}
|
||||
}
|
||||
|
||||
private static short idOf(String name, Map<String, Short> index, List<String> names) {
|
||||
private static <Named> short idOf(Named name, Map<Named, Short> index, List<Named> names) {
|
||||
return index.computeIfAbsent(name, added -> {
|
||||
names.add(added);
|
||||
return (short) (names.size() - 1);
|
||||
@@ -173,14 +173,14 @@ final class SavedRegion {
|
||||
* @param groundY the top block of the ground, under any water
|
||||
* @param waterSurfaceY the top water block over it, or {@link #NO_WATER}
|
||||
*/
|
||||
record SavedColumn(int groundY, int waterSurfaceY, String block, String biome) {
|
||||
record SavedColumn(int groundY, int waterSurfaceY, SavedBlock block, String biome) {
|
||||
}
|
||||
|
||||
/** One chunk's columns, read without holding the region so other chunks can be read meanwhile. */
|
||||
private record ChunkColumns(int minY, short[] groundY, short[] waterSurfaceY, String[] blocks, String[] biomes) {
|
||||
private record ChunkColumns(int minY, short[] groundY, short[] waterSurfaceY, SavedBlock[] blocks, String[] biomes) {
|
||||
static ChunkColumns of(SavedChunk chunk, SavedGround ground) {
|
||||
ChunkColumns columns = new ChunkColumns(chunk.minY(), new short[CHUNK_COLUMNS], new short[CHUNK_COLUMNS],
|
||||
new String[CHUNK_COLUMNS], new String[CHUNK_COLUMNS]);
|
||||
new SavedBlock[CHUNK_COLUMNS], new String[CHUNK_COLUMNS]);
|
||||
for (int z = 0; z < SavedChunk.BLOCKS_ACROSS; z++) {
|
||||
for (int x = 0; x < SavedChunk.BLOCKS_ACROSS; x++) {
|
||||
columns.read(chunk, ground, x, z);
|
||||
@@ -204,7 +204,7 @@ final class SavedRegion {
|
||||
}
|
||||
groundY[column] = (short) y;
|
||||
waterSurfaceY[column] = (short) waterTop;
|
||||
blocks[column] = block;
|
||||
blocks[column] = chunk.savedBlockAt(x, y, z);
|
||||
biomes[column] = chunk.biomeAt(x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.Map;
|
||||
* @param waterSurfaceY per pixel, the top water block over the ground, or {@link #NO_WATER}
|
||||
*/
|
||||
public record SavedTile(int size, int blocksPerPixel, short[] groundY, short[] waterSurfaceY, short[] blocks, short[] biomes,
|
||||
List<String> blockNames, List<String> biomeNames) {
|
||||
List<SavedBlock> savedBlocks, List<String> biomeNames) {
|
||||
public static final short NO_GROUND = Short.MIN_VALUE;
|
||||
public static final short NO_WATER = (short) SavedRegion.NO_WATER;
|
||||
|
||||
@@ -43,7 +43,7 @@ public record SavedTile(int size, int blocksPerPixel, short[] groundY, short[] w
|
||||
int pixels = size * size;
|
||||
SavedTile tile = new SavedTile(size, blocksPerPixel, new short[pixels], new short[pixels], new short[pixels], new short[pixels],
|
||||
new ArrayList<>(), new ArrayList<>());
|
||||
Map<String, Short> blockIds = new HashMap<>();
|
||||
Map<SavedBlock, Short> blockIds = new HashMap<>();
|
||||
Map<String, Short> biomeIds = new HashMap<>();
|
||||
long originX = (long) tileX * size * blocksPerPixel;
|
||||
long originZ = (long) tileZ * size * blocksPerPixel;
|
||||
@@ -59,14 +59,14 @@ public record SavedTile(int size, int blocksPerPixel, short[] groundY, short[] w
|
||||
}
|
||||
tile.groundY[pixel] = (short) saved.groundY();
|
||||
tile.waterSurfaceY[pixel] = (short) saved.waterSurfaceY();
|
||||
tile.blocks[pixel] = idOf(saved.block(), blockIds, tile.blockNames);
|
||||
tile.blocks[pixel] = idOf(saved.block(), blockIds, tile.savedBlocks);
|
||||
tile.biomes[pixel] = idOf(saved.biome(), biomeIds, tile.biomeNames);
|
||||
}
|
||||
}
|
||||
return tile;
|
||||
}
|
||||
|
||||
private static short idOf(String name, Map<String, Short> ids, List<String> names) {
|
||||
private static <Named> short idOf(Named name, Map<Named, Short> ids, List<Named> names) {
|
||||
return ids.computeIfAbsent(name, added -> {
|
||||
names.add(added);
|
||||
return (short) (names.size() - 1);
|
||||
|
||||
@@ -183,11 +183,6 @@ public class StudioBridgeTest {
|
||||
assertEquals(400, get("hover?view=regions&preview=nowhere&x=0&z=0").statusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aBiomeLayerViewHasNoPicksToInspect() throws Exception {
|
||||
assertEquals(400, get("picks?view=landBiomes&minX=0&minZ=0&maxX=10&maxZ=10").statusCode());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aWorldWithoutAnEngineIsUnavailableUntilItHasOneAgain() throws Exception {
|
||||
Engine engine = running.getAndSet(null);
|
||||
|
||||
@@ -67,11 +67,6 @@ public class MapPickInspectionTest {
|
||||
assertEquals(SPOTS, section.spreads().getFirst().samples());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aBiomeLayerViewHasNoPicks() {
|
||||
assertThrows(IllegalArgumentException.class, () -> measure(MapLayer.of(MapView.LAND_BIOMES)));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void anAreaNeedsItsSecondCornerBeyondItsFirst() {
|
||||
assertThrows(IllegalArgumentException.class, () -> new MapPickInspection.Area(0D, 0D, 0D, 10D));
|
||||
|
||||
@@ -45,11 +45,6 @@ public class MapPickPathTest {
|
||||
assertBand(bands.get(1), "plains", 0.25D, 1D);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void theLandViewStopsAtTheListPickBecauseItsStreamHasNoChildren() {
|
||||
assertEquals(List.of(MapPickPath.Kind.REGION, MapPickPath.Kind.BIOME), kinds(explain(MapLayer.of(MapView.LAND_BIOMES))));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void anImageMappedRegionWasChosenNotPicked() {
|
||||
when(world.imageMap.sampleRegion(X, Z)).thenReturn(world.dry);
|
||||
|
||||
@@ -87,14 +87,6 @@ public class MapTileRendererTest {
|
||||
assertEquals(Color.RED.getRGB() & 0xFFFFFF, tile.subjectAt(0, 0).color());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void biomeLayersLabelWithTheirOwnStreamAndColouring() {
|
||||
MapTile tile = render(MapView.CAVE_BIOMES, -4D, 0D, 1D, false);
|
||||
|
||||
assertEquals("cavern", tile.subjectAt(0, 0).key());
|
||||
assertEquals("warm", tile.regionAt(0, 0).key());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void aFlatWorldStaysFlat() {
|
||||
heights((x, z) -> 70D);
|
||||
@@ -199,12 +191,9 @@ public class MapTileRendererTest {
|
||||
MapTile plain = render(MapView.REGIONS, 0D, 0D, 1D, false);
|
||||
MapTile withNoise = new MapTileRenderer(engine).render(MapLayer.of(MapView.REGIONS), 0D, 0D, 1D, SIZE,
|
||||
Set.of(MapTile.Extra.PICK_NOISE), () -> false);
|
||||
MapTile caves = new MapTileRenderer(engine).render(MapLayer.of(MapView.CAVE_BIOMES), 0D, 0D, 1D, SIZE,
|
||||
Set.of(MapTile.Extra.PICK_NOISE), () -> false);
|
||||
|
||||
assertNull(plain.pickNoise());
|
||||
assertEquals(0.13F, withNoise.pickNoise()[withNoise.gridIndex(3, 5)], 1e-6F);
|
||||
assertNull("no noise picks the cave biome layer here", caves.pickNoise());
|
||||
}
|
||||
|
||||
private MapTile render(MapView view, double startX, double startZ, double blocksPerPixel, boolean withHeights) {
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SavedWorldTest {
|
||||
SavedRegion.SavedColumn underTree = world.columnAt(0, 0);
|
||||
assertEquals(TREE_GROUND_TOP, underTree.groundY());
|
||||
assertEquals(SavedRegion.NO_WATER, underTree.waterSurfaceY());
|
||||
assertEquals("minecraft:stone", underTree.block());
|
||||
assertEquals(new SavedBlock("minecraft:stone", "minecraft:stone"), underTree.block());
|
||||
assertEquals("test:meadow", underTree.biome());
|
||||
|
||||
SavedRegion.SavedColumn pond = world.columnAt(1, 0);
|
||||
@@ -96,7 +96,7 @@ public class SavedWorldTest {
|
||||
assertEquals(TREE_GROUND_TOP, world.columnAt(0, 0).groundY());
|
||||
SavedRegion.SavedColumn snowyGround = world.columnAt(2, 0);
|
||||
assertEquals(PLAIN_GROUND_TOP + 1, snowyGround.groundY());
|
||||
assertEquals("minecraft:snow", snowyGround.block());
|
||||
assertEquals("minecraft:snow", snowyGround.block().name());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -105,11 +105,11 @@ public class SavedWorldTest {
|
||||
|
||||
SavedRegion.SavedColumn plugin = world.columnAt(3, 0);
|
||||
assertEquals(PLAIN_GROUND_TOP + 1, plugin.groundY());
|
||||
assertEquals("etopia:grass_block", plugin.block());
|
||||
assertEquals(new SavedBlock("etopia:grass_block", "minecraft:tripwire[attached=true]"), plugin.block());
|
||||
|
||||
SavedRegion.SavedColumn otherState = world.columnAt(5, 0);
|
||||
assertEquals(PLAIN_GROUND_TOP, otherState.groundY());
|
||||
assertEquals("minecraft:stone", otherState.block());
|
||||
assertEquals("minecraft:stone", otherState.block().name());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -118,7 +118,7 @@ public class SavedWorldTest {
|
||||
|
||||
SavedRegion.SavedColumn borrowed = world.columnAt(3, 0);
|
||||
assertEquals(PLAIN_GROUND_TOP, borrowed.groundY());
|
||||
assertEquals("minecraft:stone", borrowed.block());
|
||||
assertEquals("minecraft:stone", borrowed.block().name());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -151,7 +151,7 @@ public class SavedWorldTest {
|
||||
assertEquals(PLAIN_GROUND_TOP + 1, tile.groundY()[1]);
|
||||
assertEquals(PLAIN_GROUND_TOP, tile.groundY()[2]);
|
||||
assertEquals(SavedTile.NO_GROUND, tile.groundY()[8]);
|
||||
assertEquals(List.of("minecraft:stone", "minecraft:snow"), tile.blockNames());
|
||||
assertEquals(List.of("minecraft:stone", "minecraft:snow"), tile.savedBlocks().stream().map(SavedBlock::name).toList());
|
||||
assertEquals(List.of("test:meadow"), tile.biomeNames());
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ const ALIGNMENT_BYTES = 4
|
||||
interface SavedTileHeader {
|
||||
size: number
|
||||
blocksPerPixel: number
|
||||
blocks: string[]
|
||||
blocks: { name: string; drawnAs: string }[]
|
||||
biomes: MapLabel[]
|
||||
noGround: number
|
||||
noWater: number
|
||||
@@ -32,7 +32,8 @@ export function decodeSavedTile(buffer: ArrayBuffer): SavedTile {
|
||||
waterSurfaceY: gridAt(1),
|
||||
blocks: gridAt(2),
|
||||
biomes: gridAt(3),
|
||||
blockNames: header.blocks,
|
||||
blockNames: header.blocks.map((block) => block.name),
|
||||
blocksDrawnAs: header.blocks.map((block) => block.drawnAs),
|
||||
biomeLabels: header.biomes,
|
||||
noGround: header.noGround,
|
||||
noWater: header.noWater
|
||||
|
||||
@@ -205,10 +205,13 @@ export interface SavedTile {
|
||||
groundY: Int16Array
|
||||
/** The top water block over the ground; {@link noWater} where it is dry. */
|
||||
waterSurfaceY: Int16Array
|
||||
/** Indices into {@link blockNames} and {@link biomes}. */
|
||||
/** Indices into {@link blockNames}, {@link blocksDrawnAs} and {@link biomeLabels}. */
|
||||
blocks: Int16Array
|
||||
biomes: Int16Array
|
||||
/** Each block without its properties; a plugin's block by the name its plugin gives it. */
|
||||
blockNames: string[]
|
||||
/** Per block, the state it was saved as, which players see and the studio draws; a plugin block's is the vanilla state it borrows. */
|
||||
blocksDrawnAs: string[]
|
||||
biomeLabels: MapLabel[]
|
||||
noGround: number
|
||||
noWater: number
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
// IntelliJ's expui icons (see icons/NOTICE.txt): each has a light file and a "_dark" twin in its own colours.
|
||||
// IntelliJ's expui icons and the studio's own drawn to match (see icons/NOTICE.txt): each has a light file and a "_dark" twin in its own colours.
|
||||
const ICON_URLS = import.meta.glob<string>('../icons/**/*.svg', { eager: true, query: '?url', import: 'default' })
|
||||
const DARK_SUFFIX = '_dark'
|
||||
|
||||
export type IdeIconName =
|
||||
| 'actualZoom'
|
||||
| 'add'
|
||||
| 'blocks'
|
||||
| 'borders'
|
||||
| 'checked'
|
||||
| 'closeSmall'
|
||||
| 'chevronLeft'
|
||||
| 'chevronRight'
|
||||
| 'decoration'
|
||||
| 'delete'
|
||||
| 'exit'
|
||||
| 'grid'
|
||||
@@ -20,6 +23,7 @@ export type IdeIconName =
|
||||
| 'locate'
|
||||
| 'locked'
|
||||
| 'memory'
|
||||
| 'mob'
|
||||
| 'redo'
|
||||
| 'refresh'
|
||||
| 'reset'
|
||||
@@ -30,19 +34,14 @@ export type IdeIconName =
|
||||
| 'symlink'
|
||||
| 'theme'
|
||||
| 'undo'
|
||||
| 'user'
|
||||
| 'web'
|
||||
| 'zoomIn'
|
||||
| 'views/biomes'
|
||||
| 'views/cave-biomes'
|
||||
| 'views/land-biomes'
|
||||
| 'views/noise'
|
||||
| 'views/objects'
|
||||
| 'views/palettes'
|
||||
| 'views/procedural'
|
||||
| 'views/regions'
|
||||
| 'views/saved-world'
|
||||
| 'views/sea-biomes'
|
||||
| 'views/world-3d'
|
||||
|
||||
function iconUrl(name: string): string {
|
||||
|
||||
@@ -2,4 +2,5 @@ The icons in this folder and its subfolders come from the IntelliJ Platform (htt
|
||||
platform/icons/src/expui, Copyright 2000-2023 JetBrains s.r.o. and contributors,
|
||||
used under the Apache License 2.0 (LICENSE-APACHE-2.0.txt).
|
||||
memory.svg is profileMemory.svg with its profiling badge removed.
|
||||
theme.svg and blocks.svg are the studio's own, drawn to match.
|
||||
theme.svg, blocks.svg, borders.svg, shading.svg, mob.svg, actualZoom.svg, decoration.svg, and in views/ biomes.svg, regions.svg,
|
||||
world-3d.svg, saved-world.svg, noise.svg and objects.svg are the studio's own, drawn to match.
|
||||
@@ -0,0 +1,5 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 5.5L4.5 4V12M10.5 5.5L12.5 4V12" stroke="#6C707E" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<circle cx="7.75" cy="6.5" r="0.75" fill="#6C707E"/>
|
||||
<circle cx="7.75" cy="10.5" r="0.75" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 323 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 5.5L4.5 4V12M10.5 5.5L12.5 4V12" stroke="#CED0D6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<circle cx="7.75" cy="6.5" r="0.75" fill="#CED0D6"/>
|
||||
<circle cx="7.75" cy="10.5" r="0.75" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 323 B |
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 5V3.5C2.5 2.95 2.95 2.5 3.5 2.5H5M7 2.5H9M11 2.5H12.5C13.05 2.5 13.5 2.95 13.5 3.5V5M13.5 7V9M13.5 11V12.5C13.5 13.05 13.05 13.5 12.5 13.5H11M9 13.5H7M5 13.5H3.5C2.95 13.5 2.5 13.05 2.5 12.5V11M2.5 9V7" stroke="#6C707E" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 362 B |
@@ -0,0 +1,3 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M2.5 5V3.5C2.5 2.95 2.95 2.5 3.5 2.5H5M7 2.5H9M11 2.5H12.5C13.05 2.5 13.5 2.95 13.5 3.5V5M13.5 7V9M13.5 11V12.5C13.5 13.05 13.05 13.5 12.5 13.5H11M9 13.5H7M5 13.5H3.5C2.95 13.5 2.5 13.05 2.5 12.5V11M2.5 9V7" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 362 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 14.5V8" stroke="#6C707E" stroke-linecap="round"/>
|
||||
<path d="M8 10C8 7.5 6 6 3 6C3 8.5 5 10 8 10Z" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
<path d="M8 8C8 5 10 3 13 3C13 6 11 8 8 8Z" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,5 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 14.5V8" stroke="#CED0D6" stroke-linecap="round"/>
|
||||
<path d="M8 10C8 7.5 6 6 3 6C3 8.5 5 10 8 10Z" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
<path d="M8 8C8 5 10 3 13 3C13 6 11 8 8 8Z" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 342 B |
@@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" stroke="#6C707E"/>
|
||||
<rect x="5" y="6" width="2" height="2" fill="#6C707E"/>
|
||||
<rect x="9" y="6" width="2" height="2" fill="#6C707E"/>
|
||||
<rect x="6" y="10" width="4" height="1" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 345 B |
@@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" stroke="#CED0D6"/>
|
||||
<rect x="5" y="6" width="2" height="2" fill="#CED0D6"/>
|
||||
<rect x="9" y="6" width="2" height="2" fill="#CED0D6"/>
|
||||
<rect x="6" y="10" width="4" height="1" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 345 B |
@@ -1,7 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 6H14C14.5523 6 15 6.44772 15 7V13C15 13.5523 14.5523 14 14 14H3C2.44772 14 2 13.5523 2 13V5C2 4.44772 2.44772 4 3 4H6V3C6 2.44772 6.44772 2 7 2H10C10.5523 2 11 2.44772 11 3V6ZM10 3H7V13H10V3ZM11 7V13H14V7H11ZM6 5V13H3L3 5H6Z" fill="#6C707E"/>
|
||||
<path d="M7 3H10V13H7V3Z" fill="#EBECF0"/>
|
||||
<path d="M11 13V7H14V13H11Z" fill="#EBECF0"/>
|
||||
<path d="M6 13V5H3V13H6Z" fill="#EBECF0"/>
|
||||
<path d="M8 3L14.5 13.5H8V3Z" fill="#6C707E"/>
|
||||
<path d="M8 3L1.5 13.5H14.5L8 3Z" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 227 B |
@@ -1,7 +1,4 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M11 6H14C14.5523 6 15 6.44772 15 7V13C15 13.5523 14.5523 14 14 14H3C2.44772 14 2 13.5523 2 13V5C2 4.44772 2.44772 4 3 4H6V3C6 2.44772 6.44772 2 7 2H10C10.5523 2 11 2.44772 11 3V6ZM10 3H7V13H10V3ZM11 7V13H14V7H11ZM6 5V13H3L3 5H6Z" fill="#CED0D6"/>
|
||||
<path d="M7 3H10V13H7V3Z" fill="#43454A"/>
|
||||
<path d="M11 13V7H14V13H11Z" fill="#43454A"/>
|
||||
<path d="M6 13V5H3V13H6Z" fill="#43454A"/>
|
||||
<path d="M8 3L14.5 13.5H8V3Z" fill="#CED0D6"/>
|
||||
<path d="M8 3L1.5 13.5H14.5L8 3Z" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 227 B |
@@ -1,7 +0,0 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M7.99951 7C9.65637 7 10.9995 5.65685 10.9995 4C10.9995 2.34315 9.65637 1 7.99951 1C6.34266 1 4.99951 2.34315 4.99951 4C4.99951 5.65685 6.34266 7 7.99951 7Z" fill="#EBECF0"/>
|
||||
<path d="M2.10272 13.008C2.39906 11.3034 3.54766 8 7.99969 8C12.4517 8 13.6003 11.3034 13.8967 13.008C13.9912 13.5521 13.552 14 12.9997 14H2.99969C2.4474 14 2.00813 13.5521 2.10272 13.008Z" fill="#EBECF0"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.9995 4C10.9995 5.65685 9.65637 7 7.99951 7C6.34266 7 4.99951 5.65685 4.99951 4C4.99951 2.34315 6.34266 1 7.99951 1C9.65637 1 10.9995 2.34315 10.9995 4ZM9.99951 4C9.99951 5.10457 9.10408 6 7.99951 6C6.89494 6 5.99951 5.10457 5.99951 4C5.99951 2.89543 6.89494 2 7.99951 2C9.10408 2 9.99951 2.89543 9.99951 4Z" fill="#6C707E"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.99969 8C3.54766 8 2.39906 11.3034 2.10272 13.008C2.00813 13.5521 2.4474 14 2.99969 14H12.9997C13.552 14 13.9912 13.5521 13.8967 13.008C13.6003 11.3034 12.4517 8 7.99969 8ZM11.7438 10.5114C12.4081 11.2951 12.7281 12.2552 12.8778 13H3.12154C3.27126 12.2552 3.59131 11.2951 4.25563 10.5114C4.94028 9.70375 6.05804 9 7.99969 9C9.94134 9 11.0591 9.70375 11.7438 10.5114Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,7 +0,0 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M7.99951 7C9.65637 7 10.9995 5.65685 10.9995 4C10.9995 2.34315 9.65637 1 7.99951 1C6.34266 1 4.99951 2.34315 4.99951 4C4.99951 5.65685 6.34266 7 7.99951 7Z" fill="#43454A"/>
|
||||
<path d="M2.10272 13.008C2.39906 11.3034 3.54766 8 7.99969 8C12.4517 8 13.6003 11.3034 13.8967 13.008C13.9912 13.5521 13.552 14 12.9997 14H2.99969C2.4474 14 2.00813 13.5521 2.10272 13.008Z" fill="#43454A"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10.9995 4C10.9995 5.65685 9.65637 7 7.99951 7C6.34266 7 4.99951 5.65685 4.99951 4C4.99951 2.34315 6.34266 1 7.99951 1C9.65637 1 10.9995 2.34315 10.9995 4ZM9.99951 4C9.99951 5.10457 9.10408 6 7.99951 6C6.89494 6 5.99951 5.10457 5.99951 4C5.99951 2.89543 6.89494 2 7.99951 2C9.10408 2 9.99951 2.89543 9.99951 4Z" fill="#CED0D6"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.99969 8C3.54766 8 2.39906 11.3034 2.10272 13.008C2.00813 13.5521 2.4474 14 2.99969 14H12.9997C13.552 14 13.9912 13.5521 13.8967 13.008C13.6003 11.3034 12.4517 8 7.99969 8ZM11.7438 10.5114C12.4081 11.2951 12.7281 12.2552 12.8778 13H3.12154C3.27126 12.2552 3.59131 11.2951 4.25563 10.5114C4.94028 9.70375 6.05804 9 7.99969 9C9.94134 9 11.0591 9.70375 11.7438 10.5114Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.4 KiB |
@@ -1,7 +1,8 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 1C0 0.447715 0.447715 0 1 0H5C5.55228 0 6 0.447715 6 1V5C6 5.55228 5.55228 6 5 6H1C0.447715 6 0 5.55228 0 5V1Z" fill="#55A76A"/>
|
||||
<path d="M7 1C7 0.447715 7.44772 0 8 0H12C12.5523 0 13 0.447715 13 1V5C13 5.55228 12.5523 6 12 6H8C7.44772 6 7 5.55228 7 5V1Z" fill="#FFAF0F"/>
|
||||
<path d="M0 8C0 7.44772 0.447715 7 1 7H5C5.55228 7 6 7.44772 6 8V12C6 12.5523 5.55228 13 5 13H1C0.447715 13 0 12.5523 0 12V8Z" fill="#4682FA"/>
|
||||
<path d="M7 8C7 7.44772 7.44772 7 8 7H12C12.5523 7 13 7.44772 13 8V12C13 12.5523 12.5523 13 12 13H8C7.44772 13 7 12.5523 7 12V8Z" fill="#E55765"/>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<clipPath id="map"><rect x="1.5" y="1.5" width="13" height="13" rx="2.5"/></clipPath>
|
||||
<g clip-path="url(#map)">
|
||||
<path d="M1 1H9.5L6 8.2L1 7Z" fill="#55A76A"/>
|
||||
<path d="M10.6 1H15V9.4L7.1 8.3Z" fill="#FFAF0F"/>
|
||||
<path d="M1 8.1L6.3 9.3L15 10.5V15H1Z" fill="#4682FA"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 374 B |
@@ -1,7 +1,8 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 1C0 0.447715 0.447715 0 1 0H5C5.55228 0 6 0.447715 6 1V5C6 5.55228 5.55228 6 5 6H1C0.447715 6 0 5.55228 0 5V1Z" fill="#57965C"/>
|
||||
<path d="M7 1C7 0.447715 7.44772 0 8 0H12C12.5523 0 13 0.447715 13 1V5C13 5.55228 12.5523 6 12 6H8C7.44772 6 7 5.55228 7 5V1Z" fill="#F2C55C"/>
|
||||
<path d="M0 8C0 7.44772 0.447715 7 1 7H5C5.55228 7 6 7.44772 6 8V12C6 12.5523 5.55228 13 5 13H1C0.447715 13 0 12.5523 0 12V8Z" fill="#548AF7"/>
|
||||
<path d="M7 8C7 7.44772 7.44772 7 8 7H12C12.5523 7 13 7.44772 13 8V12C13 12.5523 12.5523 13 12 13H8C7.44772 13 7 12.5523 7 12V8Z" fill="#DB5C5C"/>
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<clipPath id="map"><rect x="1.5" y="1.5" width="13" height="13" rx="2.5"/></clipPath>
|
||||
<g clip-path="url(#map)">
|
||||
<path d="M1 1H9.5L6 8.2L1 7Z" fill="#57965C"/>
|
||||
<path d="M10.6 1H15V9.4L7.1 8.3Z" fill="#F2C55C"/>
|
||||
<path d="M1 8.1L6.3 9.3L15 10.5V15H1Z" fill="#548AF7"/>
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 374 B |
@@ -1,4 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.8536 3.14645C11.6583 2.95118 11.3417 2.95118 11.1464 3.14645L8.14645 6.14645C7.95118 6.34171 7.95118 6.65829 8.14645 6.85355C8.34171 7.04882 8.65829 7.04882 8.85355 6.85355L11 4.70711V12.5C11 12.7761 11.2239 13 11.5 13C11.7761 13 12 12.7761 12 12.5V4.70711L14.1464 6.85355C14.3417 7.04882 14.6583 7.04882 14.8536 6.85355C15.0488 6.65829 15.0488 6.34171 14.8536 6.14645L11.8536 3.14645Z" fill="#6C707E"/>
|
||||
<path d="M5 3.5C5 3.22386 4.77614 3 4.5 3C4.22386 3 4 3.22386 4 3.5V11.2929L1.85355 9.14645C1.65829 8.95118 1.34171 8.95118 1.14645 9.14645C0.951184 9.34171 0.951184 9.65829 1.14645 9.85355L4.14645 12.8536C4.34171 13.0488 4.65829 13.0488 4.85355 12.8536L7.85355 9.85355C8.04882 9.65829 8.04882 9.34171 7.85355 9.14645C7.65829 8.95118 7.34171 8.95118 7.14645 9.14645L5 11.2929V3.5Z" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 919 B |
@@ -1,4 +0,0 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M11.8536 3.14645C11.6583 2.95118 11.3417 2.95118 11.1464 3.14645L8.14645 6.14645C7.95118 6.34171 7.95118 6.65829 8.14645 6.85355C8.34171 7.04882 8.65829 7.04882 8.85355 6.85355L11 4.70711V12.5C11 12.7761 11.2239 13 11.5 13C11.7761 13 12 12.7761 12 12.5V4.70711L14.1464 6.85355C14.3417 7.04882 14.6583 7.04882 14.8536 6.85355C15.0488 6.65829 15.0488 6.34171 14.8536 6.14645L11.8536 3.14645Z" fill="#CED0D6"/>
|
||||
<path d="M5 3.5C5 3.22386 4.77614 3 4.5 3C4.22386 3 4 3.22386 4 3.5V11.2929L1.85355 9.14645C1.65829 8.95118 1.34171 8.95118 1.14645 9.14645C0.951184 9.34171 0.951184 9.65829 1.14645 9.85355L4.14645 12.8536C4.34171 13.0488 4.65829 13.0488 4.85355 12.8536L7.85355 9.85355C8.04882 9.65829 8.04882 9.34171 7.85355 9.14645C7.65829 8.95118 7.34171 8.95118 7.14645 9.14645L5 11.2929V3.5Z" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 919 B |
@@ -1,6 +0,0 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="#E7EFFD" stroke="#3574F0"/>
|
||||
<path d="M2.5 9.33566L4.1822 7.66899C4.56052 7.29415 5.16625 7.28159 5.55979 7.64043L11.9861 13.5" stroke="#3574F0"/>
|
||||
<circle cx="10" cy="6" r="1.5" stroke="#3574F0"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 486 B |
@@ -1,6 +0,0 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2.5" y="2.5" width="11" height="11" rx="1.5" fill="#25324D" stroke="#548AF7"/>
|
||||
<path d="M2.5 9.33566L4.1822 7.66899C4.56052 7.29415 5.16625 7.28159 5.55979 7.64043L11.9861 13.5" stroke="#548AF7"/>
|
||||
<circle cx="10" cy="6" r="1.5" stroke="#548AF7"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 486 B |
@@ -1,5 +1,3 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="8" cy="8" r="6.5" fill="#FFF7F7" stroke="#DB3B4B"/>
|
||||
<path d="M7.25726 12H8.2744V7.32741H9.82869V6.43027H8.2744V5.48C8.2744 5.12 8.52012 4.87429 8.8744 4.87429H9.88012V4H8.77726C7.8744 4 7.25726 4.57143 7.25726 5.40571V6.43027H6.12012V7.32741H7.25726V12Z" fill="#DB3B4B"/>
|
||||
<path d="M1.5 9C2.5 4.5 4 4.5 5 8.5C5.8 11.7 6.9 12.3 7.8 9C8.6 6 9.4 2.5 10.6 7.5C11.4 10.8 12.6 11.5 14.5 6.5" stroke="#6C707E" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 282 B |
@@ -1,5 +1,3 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="8" cy="8" r="6.5" fill="#402929" stroke="#DB5C5C"/>
|
||||
<path d="M7.25726 12H8.2744V7.32741H9.82869V6.43027H8.2744V5.48C8.2744 5.12 8.52012 4.87429 8.8744 4.87429H9.88012V4H8.77726C7.8744 4 7.25726 4.57143 7.25726 5.40571V6.43027H6.12012V7.32741H7.25726V12Z" fill="#DB5C5C"/>
|
||||
<path d="M1.5 9C2.5 4.5 4 4.5 5 8.5C5.8 11.7 6.9 12.3 7.8 9C8.6 6 9.4 2.5 10.6 7.5C11.4 10.8 12.6 11.5 14.5 6.5" stroke="#CED0D6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 282 B |
@@ -1,7 +1,4 @@
|
||||
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 7.5L14.5 4.5V11.5199L8 14.5V7.5Z" fill="#E7EFFD"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 7.5L1.5 4.5V11.5199L8 14.5V7.5Z" fill="#E7EFFD"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.5 4.5L7.99998 1.5L1.5 4.5L8 7.5L14.5 4.5Z" fill="#E7EFFD"/>
|
||||
<path d="M8 7.5L14.5 4.5M8 7.5V14.5M8 7.5L1.5 4.5M14.5 4.5V11.5199L8 14.5M14.5 4.5L7.99998 1.5L1.5 4.5M8 14.5L1.5 11.5199V4.5" stroke="#3574F0" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M8 1.5C5.5 1.5 3.5 3.5 3.5 6C3.5 8.5 5.5 10.5 8 10.5C10.5 10.5 12.5 8.5 12.5 6C12.5 3.5 10.5 1.5 8 1.5Z" fill="#F2FCF3" stroke="#55A76A"/>
|
||||
<path d="M8 6V14.5M8 8.5L10 6.5M5.5 14.5H10.5" stroke="#55A76A" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 364 B |
@@ -1,7 +1,4 @@
|
||||
<!-- Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 7.5L14.5 4.5V11.5199L8 14.5V7.5Z" fill="#25324D"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 7.5L1.5 4.5V11.5199L8 14.5V7.5Z" fill="#25324D"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.5 4.5L7.99998 1.5L1.5 4.5L8 7.5L14.5 4.5Z" fill="#25324D"/>
|
||||
<path d="M8 7.5L14.5 4.5M8 7.5V14.5M8 7.5L1.5 4.5M14.5 4.5V11.5199L8 14.5M14.5 4.5L7.99998 1.5L1.5 4.5M8 14.5L1.5 11.5199V4.5" stroke="#548AF7" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M8 1.5C5.5 1.5 3.5 3.5 3.5 6C3.5 8.5 5.5 10.5 8 10.5C10.5 10.5 12.5 8.5 12.5 6C12.5 3.5 10.5 1.5 8 1.5Z" fill="#253627" stroke="#57965C"/>
|
||||
<path d="M8 6V14.5M8 8.5L10 6.5M5.5 14.5H10.5" stroke="#57965C" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 741 B After Width: | Height: | Size: 364 B |
@@ -1,7 +1,4 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="1.5" y="1.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
|
||||
<rect x="1.5" y="8.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
|
||||
<rect x="8.5" y="8.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
|
||||
<rect x="8.5" y="1.5" width="5" height="5" rx="0.5" stroke="#6C707E"/>
|
||||
<rect x="1.5" y="1.5" width="13" height="13" rx="2.5" stroke="#6C707E"/>
|
||||
<path d="M10 1.5L6.5 8.7M1.5 7.5L6.5 8.7L14.5 9.9" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 270 B |
@@ -1,7 +1,4 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="1.5" y="1.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
|
||||
<rect x="1.5" y="8.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
|
||||
<rect x="8.5" y="8.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
|
||||
<rect x="8.5" y="1.5" width="5" height="5" rx="0.5" stroke="#CED0D6"/>
|
||||
<rect x="1.5" y="1.5" width="13" height="13" rx="2.5" stroke="#CED0D6"/>
|
||||
<path d="M10 1.5L6.5 8.7M1.5 7.5L6.5 8.7L14.5 9.9" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 514 B After Width: | Height: | Size: 270 B |
@@ -1,7 +0,0 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2" y="12" width="8" height="1" rx="0.5" fill="#6C707E"/>
|
||||
<rect x="2" y="6" width="8" height="1" rx="0.5" fill="#6C707E"/>
|
||||
<rect x="2" y="9" width="12" height="1" rx="0.5" fill="#6C707E"/>
|
||||
<rect x="2" y="3" width="12" height="1" rx="0.5" fill="#6C707E"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 493 B |
@@ -1,7 +0,0 @@
|
||||
<!-- Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="2" y="12" width="8" height="1" rx="0.5" fill="#CED0D6"/>
|
||||
<rect x="2" y="6" width="8" height="1" rx="0.5" fill="#CED0D6"/>
|
||||
<rect x="2" y="9" width="12" height="1" rx="0.5" fill="#CED0D6"/>
|
||||
<rect x="2" y="3" width="12" height="1" rx="0.5" fill="#CED0D6"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 493 B |
@@ -1,4 +1,4 @@
|
||||
<!-- Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM6.3125 11C6.44266 11.5858 6.60701 12.1103 6.79785 12.5557C7.03754 13.1149 7.29769 13.5039 7.53516 13.7383C7.76816 13.9681 7.92398 14 8 14C8.07602 14 8.23184 13.9681 8.46484 13.7383C8.70231 13.5039 8.96246 13.1149 9.20215 12.5557C9.39299 12.1103 9.55734 11.5858 9.6875 11H6.3125ZM2.80469 11C3.56455 12.3131 4.80678 13.3106 6.29004 13.751C5.86191 13.0564 5.51476 12.1085 5.28906 11H2.80469ZM10.7109 11C10.4852 12.1088 10.1372 13.0564 9.70898 13.751C11.1926 13.3108 12.4353 12.3133 13.1953 11H10.7109ZM2.34277 6C2.12157 6.62568 2 7.29857 2 8C2 8.70143 2.12157 9.37432 2.34277 10H5.125C5.04416 9.36626 5 8.69501 5 8C5 7.30499 5.04416 6.63374 5.125 6H2.34277ZM6.13379 6C6.04822 6.62358 6 7.29538 6 8C6 8.70462 6.04822 9.37642 6.13379 10H9.86621C9.95178 9.37642 10 8.70462 10 8C10 7.29538 9.95178 6.62358 9.86621 6H6.13379ZM10.875 6C10.9558 6.63374 11 7.30499 11 8C11 8.69501 10.9558 9.36626 10.875 10H13.6572C13.8784 9.37432 14 8.70143 14 8C14 7.29857 13.8784 6.62568 13.6572 6H10.875ZM6.29004 2.24805C4.80666 2.68836 3.56459 3.68685 2.80469 5H5.28906C5.51484 3.89108 5.86171 2.94268 6.29004 2.24805ZM8 2C7.92398 2 7.76816 2.03186 7.53516 2.26172C7.29769 2.49608 7.03754 2.88507 6.79785 3.44434C6.60701 3.88966 6.44266 4.41423 6.3125 5H9.6875C9.55734 4.41423 9.39299 3.88966 9.20215 3.44434C8.96246 2.88507 8.70231 2.49608 8.46484 2.26172C8.23184 2.03186 8.07602 2 8 2ZM9.70898 2.24805C10.1374 2.94272 10.4851 3.89085 10.7109 5H13.1953C12.4353 3.68659 11.1928 2.68823 9.70898 2.24805Z" fill="#6C707E"/>
|
||||
<path d="M1.5 13.5L6 4.5L8.9 10.3L10.5 7.5L14.5 13.5H1.5Z" stroke="#6C707E" stroke-linejoin="round"/>
|
||||
<path d="M4.6 7.3L6 8.5L7.4 7.3" stroke="#6C707E" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 304 B |
@@ -1,4 +1,4 @@
|
||||
<!-- Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1C11.866 1 15 4.13401 15 8C15 11.866 11.866 15 8 15C4.13401 15 1 11.866 1 8C1 4.13401 4.13401 1 8 1ZM6.3125 11C6.44266 11.5858 6.60701 12.1103 6.79785 12.5557C7.03754 13.1149 7.29769 13.5039 7.53516 13.7383C7.76816 13.9681 7.92398 14 8 14C8.07602 14 8.23184 13.9681 8.46484 13.7383C8.70231 13.5039 8.96246 13.1149 9.20215 12.5557C9.39299 12.1103 9.55734 11.5858 9.6875 11H6.3125ZM2.80469 11C3.56455 12.3131 4.80678 13.3106 6.29004 13.751C5.86191 13.0564 5.51476 12.1085 5.28906 11H2.80469ZM10.7109 11C10.4852 12.1088 10.1372 13.0564 9.70898 13.751C11.1926 13.3108 12.4353 12.3133 13.1953 11H10.7109ZM2.34277 6C2.12157 6.62568 2 7.29857 2 8C2 8.70143 2.12157 9.37432 2.34277 10H5.125C5.04416 9.36626 5 8.69501 5 8C5 7.30499 5.04416 6.63374 5.125 6H2.34277ZM6.13379 6C6.04822 6.62358 6 7.29538 6 8C6 8.70462 6.04822 9.37642 6.13379 10H9.86621C9.95178 9.37642 10 8.70462 10 8C10 7.29538 9.95178 6.62358 9.86621 6H6.13379ZM10.875 6C10.9558 6.63374 11 7.30499 11 8C11 8.69501 10.9558 9.36626 10.875 10H13.6572C13.8784 9.37432 14 8.70143 14 8C14 7.29857 13.8784 6.62568 13.6572 6H10.875ZM6.29004 2.24805C4.80666 2.68836 3.56459 3.68685 2.80469 5H5.28906C5.51484 3.89108 5.86171 2.94268 6.29004 2.24805ZM8 2C7.92398 2 7.76816 2.03186 7.53516 2.26172C7.29769 2.49608 7.03754 2.88507 6.79785 3.44434C6.60701 3.88966 6.44266 4.41423 6.3125 5H9.6875C9.55734 4.41423 9.39299 3.88966 9.20215 3.44434C8.96246 2.88507 8.70231 2.49608 8.46484 2.26172C8.23184 2.03186 8.07602 2 8 2ZM9.70898 2.24805C10.1374 2.94272 10.4851 3.89085 10.7109 5H13.1953C12.4353 3.68659 11.1928 2.68823 9.70898 2.24805Z" fill="#CED0D6"/>
|
||||
<path d="M1.5 13.5L6 4.5L8.9 10.3L10.5 7.5L14.5 13.5H1.5Z" stroke="#CED0D6" stroke-linejoin="round"/>
|
||||
<path d="M4.6 7.3L6 8.5L7.4 7.3" stroke="#CED0D6" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 304 B |
@@ -1,6 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="7.5" y="4" width="1" height="8" rx="0.5" fill="#6C707E"/>
|
||||
<rect x="12" y="7.5" width="1" height="8" rx="0.5" transform="rotate(90 12 7.5)" fill="#6C707E"/>
|
||||
<circle cx="8" cy="8" r="6.5" stroke="#6C707E"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 444 B |
@@ -1,6 +0,0 @@
|
||||
<!-- Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. -->
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect x="7.5" y="4" width="1" height="8" rx="0.5" fill="#CED0D6"/>
|
||||
<rect x="12" y="7.5" width="0.8" height="8" rx="0.4" transform="rotate(90 12 7.5)" fill="#CED0D6"/>
|
||||
<circle cx="8" cy="8" r="6.5" stroke="#CED0D6"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 446 B |
@@ -10,8 +10,6 @@ export interface SightView {
|
||||
}
|
||||
|
||||
const NDC_MIDDLE_DEPTH = 0.5
|
||||
const NOT_BEHIND_THE_CAMERA = 0
|
||||
const BEHIND_THE_CAMERA = 1e9
|
||||
|
||||
/**
|
||||
* What the camera sees of ground that lies between {@code floorY} and {@code topY}: which terrain tiles land in the
|
||||
@@ -20,6 +18,7 @@ const BEHIND_THE_CAMERA = 1e9
|
||||
export class CameraSight {
|
||||
private readonly frustums = new Map<number, Frustum>()
|
||||
private readonly position = new Vector3()
|
||||
private readonly lookedAt: Vector3
|
||||
|
||||
constructor(
|
||||
private readonly view: SightView,
|
||||
@@ -28,6 +27,7 @@ export class CameraSight {
|
||||
) {
|
||||
view.camera.updateMatrixWorld()
|
||||
view.camera.getWorldPosition(this.position)
|
||||
this.lookedAt = this.groundInMiddleOfView()
|
||||
}
|
||||
|
||||
get orbitDistance(): number {
|
||||
@@ -52,15 +52,24 @@ export class CameraSight {
|
||||
return blocksPerColumn(tile.level) * pixelsPerBlock
|
||||
}
|
||||
|
||||
/** How far the tile's middle lies from the middle of the view on the screen; tiles behind the camera lie furthest. */
|
||||
distanceFromMiddle(tile: TerrainTile): number {
|
||||
const middle = new Vector3(originXOf(tile) + tileBlocks(tile.level) / 2, (this.floorY + this.topY) / 2, originZOf(tile) + tileBlocks(tile.level) / 2)
|
||||
const behind = middle.clone().applyMatrix4(this.view.camera.matrixWorldInverse).z > NOT_BEHIND_THE_CAMERA
|
||||
if (behind) {
|
||||
return BEHIND_THE_CAMERA + middle.distanceTo(this.position)
|
||||
/** How many blocks the tile lies from the ground in the middle of the view; nothing for the tile that ground is in. */
|
||||
distanceFromLookedAt(tile: TerrainTile): number {
|
||||
const size = tileBlocks(tile.level)
|
||||
const x = originXOf(tile)
|
||||
const z = originZOf(tile)
|
||||
const pastX = Math.max(x - this.lookedAt.x, 0, this.lookedAt.x - (x + size))
|
||||
const pastZ = Math.max(z - this.lookedAt.z, 0, this.lookedAt.z - (z + size))
|
||||
return Math.hypot(pastX, pastZ)
|
||||
}
|
||||
|
||||
// Where the line of sight comes down to the middle height of the ground, or under the camera when it never does.
|
||||
private groundInMiddleOfView(): Vector3 {
|
||||
const direction = this.view.camera.getWorldDirection(new Vector3())
|
||||
const distance = ((this.floorY + this.topY) / 2 - this.position.y) / direction.y
|
||||
if (!Number.isFinite(distance) || distance < 0) {
|
||||
return this.position.clone()
|
||||
}
|
||||
const onScreen = middle.project(this.view.camera)
|
||||
return Math.hypot(onScreen.x, onScreen.y)
|
||||
return direction.multiplyScalar(Math.min(distance, this.view.camera.far)).add(this.position)
|
||||
}
|
||||
|
||||
/** The tiles of {@code level} in sight, widened by {@code margin}. */
|
||||
|
||||
@@ -23,6 +23,8 @@ export class ColumnField {
|
||||
readonly looks: (BlockLook | null)[]
|
||||
/** The atlas of the looks, or null where no column has one. */
|
||||
readonly pictures: TerrainPictures | null
|
||||
/** How low and high the top faces stand, ground and water alike; null where no column has ground. */
|
||||
readonly topRange: { lowest: number; highest: number } | null
|
||||
|
||||
constructor(surface: TerrainSurface, holes: readonly ColumnArea[] = []) {
|
||||
this.columns = surface.columns
|
||||
@@ -37,6 +39,7 @@ export class ColumnField {
|
||||
this.looks = new Array<BlockLook | null>(count).fill(null)
|
||||
const hasPictures = surface.pictures !== undefined
|
||||
let anyLook = false
|
||||
let [lowestTop, highestTop] = [Infinity, -Infinity]
|
||||
const inHole = this.holeMask(holes)
|
||||
for (let row = 0; row < this.rows; row++) {
|
||||
for (let column = 0; column < this.columns; column++) {
|
||||
@@ -52,9 +55,12 @@ export class ColumnField {
|
||||
const look = hasPictures ? (surface.lookAt?.(column, row) ?? null) : null
|
||||
this.looks[index] = look
|
||||
anyLook ||= look !== null
|
||||
lowestTop = Math.min(lowestTop, ground + 1)
|
||||
highestTop = Math.max(highestTop, ground + 1, water === null ? ground : water + 1)
|
||||
}
|
||||
}
|
||||
this.pictures = anyLook ? (surface.pictures ?? null) : null
|
||||
this.topRange = lowestTop === Infinity ? null : { lowest: lowestTop, highest: highestTop }
|
||||
}
|
||||
|
||||
indexOf(column: number, row: number): number {
|
||||
|
||||
@@ -5,7 +5,7 @@ import type { BlockLook } from './blockLooks'
|
||||
import { SavedTerrain, type ReadSavedTile, type SavedTerrainColoring } from './savedTerrain'
|
||||
import { cellAt, type TerrainPictures } from './terrainAtlas'
|
||||
|
||||
const GRASS = 'minecraft:grass_block'
|
||||
const GRASS = 'minecraft:grass_block[snowy=false]'
|
||||
const STONE = 'minecraft:stone'
|
||||
const FACE = { cell: cellAt(1, 0x808080), tint: 0xffffff, color: 0x808080 }
|
||||
const LOOK: BlockLook = { top: FACE, side: FACE, below: FACE }
|
||||
@@ -19,7 +19,8 @@ const tile = {
|
||||
waterSurfaceY: Int16Array.of(-1, -1, -1, -1),
|
||||
blocks: Int16Array.of(0, 1, 1, 1),
|
||||
biomes: Int16Array.of(0, 0, 0, 0),
|
||||
blockNames: [GRASS, STONE],
|
||||
blockNames: ['minecraft:grass_block', STONE],
|
||||
blocksDrawnAs: [GRASS, STONE],
|
||||
biomeLabels: [{ color: 0x00ff00 }],
|
||||
noGround: -32768,
|
||||
noWater: -1
|
||||
|
||||
@@ -7,7 +7,7 @@ import { blocksPerColumn, originXOf, originZOf, type TerrainTile } from './terra
|
||||
|
||||
export type SavedTerrainColoring = 'biomes' | 'blocks' | 'height'
|
||||
|
||||
/** A saved tile, the colour of every block it holds, and the look of each where the tile is fine enough to show textures. */
|
||||
/** A saved tile, the colour of every state its blocks are drawn as, and the look of each where the tile is fine enough to show textures. */
|
||||
export interface ReadSavedTile {
|
||||
tile: SavedTile
|
||||
blockColors: Map<string, number>
|
||||
@@ -59,7 +59,7 @@ export class SavedTerrain implements TerrainSurface {
|
||||
return null
|
||||
}
|
||||
const { tile, blockLooks } = this.read
|
||||
return blockLooks.get(tile.blockNames[tile.blocks[this.pixelAt(column, row)]]) ?? null
|
||||
return blockLooks.get(tile.blocksDrawnAs[tile.blocks[this.pixelAt(column, row)]]) ?? null
|
||||
}
|
||||
|
||||
colorAt(column: number, row: number): number {
|
||||
@@ -69,7 +69,7 @@ export class SavedTerrain implements TerrainSurface {
|
||||
case 'height':
|
||||
return heightColor(tile.groundY[pixel], this.seaLevel ?? VANILLA_SEA_LEVEL)
|
||||
case 'blocks':
|
||||
return blockColors.get(tile.blockNames[tile.blocks[pixel]]) ?? UNKNOWN_BLOCK_COLOR
|
||||
return blockColors.get(tile.blocksDrawnAs[tile.blocks[pixel]]) ?? UNKNOWN_BLOCK_COLOR
|
||||
case 'biomes':
|
||||
return tile.biomeLabels[tile.biomes[pixel]].color
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ export function savedTileSource(client: BridgeClient, blockColors: BlockColors,
|
||||
fetch: async (address, layer, signal) => {
|
||||
const tile = await client.savedTile(layer.worldId, address.tileX, address.tileZ, address.blocksPerPixel, TILE_COLUMNS, signal)
|
||||
const textured = address.blocksPerPixel === FINEST_BLOCKS_PER_COLUMN
|
||||
const [colors, looks] = await Promise.all([blockColors.colorsOf(tile.blockNames), textured ? blockLooks.looksOf(tile.blockNames) : new Map<string, BlockLook | null>()])
|
||||
const [colors, looks] = await Promise.all([blockColors.colorsOf(tile.blocksDrawnAs), textured ? blockLooks.looksOf(tile.blocksDrawnAs) : new Map<string, BlockLook | null>()])
|
||||
return { tile, blockColors: colors, blockLooks: looks }
|
||||
},
|
||||
bytesOf: ({ tile }) =>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CanvasTexture, NearestFilter, SRGBColorSpace, type Texture } from 'three'
|
||||
import { CanvasTexture, NearestFilter, type Texture } from 'three'
|
||||
import { averageColor } from './blockColors'
|
||||
import { texturePath, type ImageSource } from './textureAtlas'
|
||||
|
||||
@@ -30,6 +30,10 @@ const ATLAS_PIXELS = CELLS_PER_SIDE * CELL_PIXELS
|
||||
const PLAIN_CELL = 0
|
||||
const WHITE = '#ffffff'
|
||||
const WHITE_COLOR = 0xffffff
|
||||
const OPAQUE_ALPHA = 255
|
||||
// The same line blockColors draws between a pixel that counts toward a picture's colour and one that does not.
|
||||
const OPAQUE_ENOUGH_ALPHA = 128
|
||||
const GAP_SHADE = 0.6
|
||||
|
||||
/** The cell with this number, counted row by row from the top left. */
|
||||
export function cellAt(index: number, average: number): UvCell {
|
||||
@@ -70,7 +74,6 @@ export class TerrainAtlas implements TerrainPictures, PictureSource {
|
||||
this.texture.minFilter = NearestFilter
|
||||
this.texture.generateMipmaps = false
|
||||
this.texture.flipY = false
|
||||
this.texture.colorSpace = SRGBColorSpace
|
||||
}
|
||||
|
||||
cellOf(textureId: string): Promise<UvCell | null> {
|
||||
@@ -96,7 +99,26 @@ export class TerrainAtlas implements TerrainPictures, PictureSource {
|
||||
const left = placed.u * ATLAS_PIXELS
|
||||
const top = placed.v * ATLAS_PIXELS
|
||||
this.drawing.drawImage(bitmap, 0, 0, bitmap.width, Math.min(bitmap.width, bitmap.height), left, top, CELL_PIXELS, CELL_PIXELS)
|
||||
const picture = this.drawing.getImageData(left, top, CELL_PIXELS, CELL_PIXELS)
|
||||
const average = averageColor(picture)
|
||||
this.drawing.putImageData(withGapsFilled(picture, average), left, top)
|
||||
this.texture.needsUpdate = true
|
||||
return { ...placed, average: averageColor(this.drawing.getImageData(left, top, CELL_PIXELS, CELL_PIXELS)) }
|
||||
return { ...placed, average }
|
||||
}
|
||||
}
|
||||
|
||||
// The terrain draws whole faces, so what a picture leaves open, as leaves do between their twigs, would show as black:
|
||||
// it takes the picture's own colour instead, darker, as the shade seen through the gaps.
|
||||
function withGapsFilled(picture: ImageData, average: number): ImageData {
|
||||
const pixels = picture.data
|
||||
const gap = [(average >> 16) & 0xff, (average >> 8) & 0xff, average & 0xff].map((channel) => Math.round(channel * GAP_SHADE))
|
||||
for (let offset = 0; offset < pixels.length; offset += 4) {
|
||||
if (pixels[offset + 3] < OPAQUE_ENOUGH_ALPHA) {
|
||||
pixels[offset] = gap[0]
|
||||
pixels[offset + 1] = gap[1]
|
||||
pixels[offset + 2] = gap[2]
|
||||
}
|
||||
pixels[offset + 3] = OPAQUE_ALPHA
|
||||
}
|
||||
return picture
|
||||
}
|
||||
@@ -134,5 +134,5 @@ function wantedInOrder(sight: CameraSight, backdrop: TerrainTile[], detail: Terr
|
||||
}
|
||||
|
||||
function nearestFirst(sight: CameraSight): (first: TerrainTile, second: TerrainTile) => number {
|
||||
return (first, second) => sight.distanceFromMiddle(first) - sight.distanceFromMiddle(second)
|
||||
return (first, second) => sight.distanceFromLookedAt(first) - sight.distanceFromLookedAt(second)
|
||||
}
|
||||
@@ -16,6 +16,8 @@ interface FlatLayer {
|
||||
}
|
||||
|
||||
const COARSEST_LEVEL = 8
|
||||
// A source that cannot sample coarser has more tiles in sight than it may draw, so it has to pick the right ones.
|
||||
const COARSEST_SAVED_LEVEL = 4
|
||||
const LOOKED_AT = new Vector3(0, 64, 0)
|
||||
const open = Promise.resolve()
|
||||
|
||||
@@ -34,7 +36,7 @@ const flatStyle: TerrainStyle<FlatTile> = {
|
||||
topY: 128
|
||||
}
|
||||
|
||||
function setUp(): {
|
||||
function setUp(coarsestLevel = COARSEST_LEVEL): {
|
||||
stream: TerrainStream<FlatTile, FlatLayer>
|
||||
camera: PerspectiveCamera
|
||||
moved(): void
|
||||
@@ -55,7 +57,7 @@ function setUp(): {
|
||||
}
|
||||
const stream = new TerrainStream({
|
||||
source,
|
||||
coarsestLevel: COARSEST_LEVEL,
|
||||
coarsestLevel,
|
||||
focus: focusAround(0, 0, 0, 128),
|
||||
onPending: (pending) => pendingCounts.push(pending),
|
||||
onError: (message) => {
|
||||
@@ -183,6 +185,18 @@ describe('terrain stream', () => {
|
||||
expect(stream.groundInView()!.area.minX).toBeGreaterThan(seen.area.maxX)
|
||||
})
|
||||
|
||||
it('draws the ground under a camera that is close to it in a world with a tall sky', async () => {
|
||||
const { stream, camera, moved } = setUp(COARSEST_SAVED_LEVEL)
|
||||
stream.restyle({ ...flatStyle, floorY: -64, topY: 1024 })
|
||||
stream.showLayer({ name: 'one', height: 70, gate: open })
|
||||
camera.position.set(250, 260, 300)
|
||||
camera.lookAt(new Vector3(36, 71, 47))
|
||||
moved()
|
||||
await settle()
|
||||
const sight = new Ray(camera.position.clone(), camera.getWorldDirection(new Vector3()))
|
||||
expect(stream.content.surfaceAlong!(sight, 2000)!.y).toBeCloseTo(71, 1)
|
||||
})
|
||||
|
||||
it('stops drawing when it is let go', async () => {
|
||||
const { stream, stopFollowing, requested } = setUp()
|
||||
stream.restyle(flatStyle)
|
||||
|
||||
@@ -20,7 +20,7 @@ export interface TerrainStreamOptions<Tile, Layer> {
|
||||
source: TileSource<Tile, Layer, never>
|
||||
/** The coarsest level the source samples: tiles of level n have columns 2^n blocks wide. */
|
||||
coarsestLevel: number
|
||||
/** The box the camera frames when the terrain is first shown. */
|
||||
/** The box the camera frames when the terrain is first shown; ground is looked for between its heights until tiles show where it really stands. */
|
||||
focus: Box3
|
||||
/** Told how many tiles are still on their way, whenever that changes. */
|
||||
onPending(pending: number): void
|
||||
@@ -66,8 +66,15 @@ export class TerrainStream<Tile, Layer> {
|
||||
private reportedPending = -1
|
||||
private continuation: ReturnType<typeof setTimeout> | null = null
|
||||
private disposed = false
|
||||
// Tiles are looked for where ground stands, not across the world's whole height: under a tall sky most of a tile's
|
||||
// box is air, which lands in the view where its ground does not.
|
||||
private lowestGround: number
|
||||
private highestGround: number
|
||||
private groundRangeGrew = false
|
||||
|
||||
constructor(private readonly options: TerrainStreamOptions<Tile, Layer>) {
|
||||
this.lowestGround = options.focus.min.y
|
||||
this.highestGround = options.focus.max.y
|
||||
this.store = new TileStore(options.source, () => this.replan(), options.onError)
|
||||
this.content = {
|
||||
object: this.group,
|
||||
@@ -139,7 +146,7 @@ export class TerrainStream<Tile, Layer> {
|
||||
if (this.disposed || this.layer === null || this.style === null || this.camera === null) {
|
||||
return
|
||||
}
|
||||
const sight = new CameraSight(this.camera.view(), this.style.floorY, this.style.topY)
|
||||
const sight = new CameraSight(this.camera.view(), this.lowestGround, this.highestGround)
|
||||
const layer = this.layer
|
||||
const cover = planCover(sight, (tile) => this.stateOf(tile, layer), this.options.coarsestLevel)
|
||||
this.store.want(cover.wanted.map(addressOf), layer)
|
||||
@@ -184,6 +191,10 @@ export class TerrainStream<Tile, Layer> {
|
||||
this.show(key, draw, data, style)
|
||||
}
|
||||
this.camera?.redraw()
|
||||
if (this.groundRangeGrew) {
|
||||
this.groundRangeGrew = false
|
||||
this.continueLater()
|
||||
}
|
||||
if (behind) {
|
||||
this.continueLater()
|
||||
return
|
||||
@@ -212,6 +223,17 @@ export class TerrainStream<Tile, Layer> {
|
||||
const mesh = buildTerrainMesh(style.surfaceOf(data, draw.tile), style.floorY, draw.holes)
|
||||
this.group.add(mesh.object)
|
||||
this.drawn.set(key, { tile: draw.tile, data, signature: this.signatureOf(draw), mesh })
|
||||
this.growGroundRangeOver(mesh.field)
|
||||
}
|
||||
|
||||
private growGroundRangeOver(field: ColumnField): void {
|
||||
const tops = field.topRange
|
||||
if (tops === null || (tops.lowest >= this.lowestGround && tops.highest <= this.highestGround)) {
|
||||
return
|
||||
}
|
||||
this.lowestGround = Math.min(this.lowestGround, tops.lowest)
|
||||
this.highestGround = Math.max(this.highestGround, tops.highest)
|
||||
this.groundRangeGrew = true
|
||||
}
|
||||
|
||||
private hide(key: string, drawn: DrawnMesh<Tile>): void {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { CanvasTexture, NearestFilter, SRGBColorSpace } from 'three'
|
||||
import { CanvasTexture, NearestFilter } from 'three'
|
||||
|
||||
/** Where block textures come from: the bridge's copy of the client's assets. */
|
||||
export interface ImageSource {
|
||||
@@ -37,7 +37,6 @@ export class TextureAtlas {
|
||||
this.texture.minFilter = NearestFilter
|
||||
this.texture.generateMipmaps = false
|
||||
this.texture.flipY = false
|
||||
this.texture.colorSpace = SRGBColorSpace
|
||||
}
|
||||
|
||||
static async of(textureIds: string[], images: ImageSource): Promise<TextureAtlas> {
|
||||
|
||||
@@ -46,8 +46,8 @@ export function HoverCard({ hover, point, viewId, previewing, detailed, minY }:
|
||||
}, [point, hover, detailed])
|
||||
|
||||
const labelsRegions = viewId === 'regions' && !previewing
|
||||
const subject = viewId === 'caveBiomes' ? hover.caveBiome : labelsRegions ? hover.region : hover.biome
|
||||
const groups = detailed ? detailGroups(hover, viewId) : []
|
||||
const subject = labelsRegions ? hover.region : hover.biome
|
||||
const groups = detailed ? detailGroups(hover) : []
|
||||
const parent = replacedParent(hover.pickPath)
|
||||
return (
|
||||
<div
|
||||
@@ -109,12 +109,10 @@ function ground(hover: MapHover, minY: number): string {
|
||||
return `Y ${Math.round(hover.height + minY)} · ${signed} from water · ${Math.round(hover.slopeDegrees)}°`
|
||||
}
|
||||
|
||||
function detailGroups(hover: MapHover, viewId: string): { title: string; rows: Row[] }[] {
|
||||
function detailGroups(hover: MapHover): { title: string; rows: Row[] }[] {
|
||||
const groups: { title: string; rows: Row[] }[] = []
|
||||
const terrain: Row[] = []
|
||||
if (viewId === 'caveBiomes' && hover.biome !== null) {
|
||||
terrain.push({ label: 'Surface biome', value: hover.biome.name })
|
||||
} else if (hover.caveBiome !== null && hover.caveBiome.key !== hover.biome?.key) {
|
||||
if (hover.caveBiome !== null && hover.caveBiome.key !== hover.biome?.key) {
|
||||
terrain.push({ label: 'Cave biome', value: hover.caveBiome.name })
|
||||
}
|
||||
if (hover.vanillaBiome !== null) {
|
||||
|
||||
@@ -16,7 +16,7 @@ const KIND_ICONS: Record<string, IdeIconName> = {
|
||||
Group: 'groups',
|
||||
'Shared part': 'symlink',
|
||||
Material: 'views/palettes',
|
||||
Decoration: 'views/land-biomes'
|
||||
Decoration: 'decoration'
|
||||
}
|
||||
const FIT_MARGIN = 24
|
||||
const LARGEST_FIT_SCALE = 1
|
||||
|
||||
@@ -18,6 +18,7 @@ import { focusAround, type TerrainStyle } from '../scene/terrainStream'
|
||||
import { SceneViewport } from './SceneViewport'
|
||||
import { Separator } from '@/components/ui/separator'
|
||||
import { HEADER_CHOICE, SidebarPanel, ViewIsland } from './Sidebar'
|
||||
import { useSpotActions } from './useSpotActions'
|
||||
import { useTerrainStream } from './useTerrainStream'
|
||||
|
||||
const NUMBER = new Intl.NumberFormat('en-US')
|
||||
@@ -69,6 +70,8 @@ export function SavedWorldStudio({ title, client, world, onSummary, onProgress,
|
||||
const { content, pending } = useTerrainStream(tileSource, COARSEST_SAVED_LEVEL, focus, layer, style, tell)
|
||||
const reading = looking || pending > 0
|
||||
const tileWork = useRef(new PendingWork())
|
||||
const showsStudioWorld = chosen !== null && chosen.id === ownWorldAmong(worlds, world)?.id
|
||||
const spotActions = useSpotActions(client, tell, showsStudioWorld)
|
||||
|
||||
useEffect(() => {
|
||||
const completion = tileWork.current.completion(pending)
|
||||
@@ -109,7 +112,7 @@ export function SavedWorldStudio({ title, client, world, onSummary, onProgress,
|
||||
</>
|
||||
}
|
||||
>
|
||||
<SceneViewport content={content} framing={content} />
|
||||
<SceneViewport content={content} framing={content} spotActions={spotActions} />
|
||||
{reading && chosen !== null && <div className={PILL}>Reading {chosen.name}</div>}
|
||||
{!reading && chosen !== null && start === null && <div className={PILL}>Nothing finished is saved in {chosen.name}</div>}
|
||||
</ViewIsland>
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import { useEffect, useRef } from 'react'
|
||||
import { Box3, MOUSE, PerspectiveCamera, Ray, Raycaster, Scene, Sphere, Vector2, Vector3, WebGLRenderer, type Object3D } from 'three'
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { ContextMenu, ContextMenuContent, ContextMenuTrigger } from '@/components/ui/context-menu'
|
||||
import { Box3, ColorManagement, LinearSRGBColorSpace, MOUSE, PerspectiveCamera, Ray, Raycaster, Scene, Sphere, Vector2, Vector3, WebGLRenderer, type Object3D } from 'three'
|
||||
import { OrbitControls } from 'three/examples/jsm/controls/OrbitControls.js'
|
||||
import type { SightView } from '../scene/cameraSight'
|
||||
import { surfaceAlong } from '../scene/surfacePick'
|
||||
|
||||
// Colours are worked out as Minecraft and v3e do, on the values a screen shows: a texture times its tint times the light
|
||||
// on its face. Left to manage colours, three.js would take those values for linear light and encode them again, which
|
||||
// pales every colour and flattens the shading.
|
||||
ColorManagement.enabled = false
|
||||
|
||||
const FIELD_OF_VIEW_DEGREES = 45
|
||||
// Looking down at the scene from the south east, as v3e's object view opens.
|
||||
const VIEW_DIRECTION = new Vector3(1, 0.8, 1.2).normalize()
|
||||
@@ -22,8 +28,16 @@ const LOWEST_OVER_GROUND_RADIANS = Math.PI / 2 - 0.05
|
||||
const TURNS_ON_DRAG = { LEFT: MOUSE.ROTATE, MIDDLE: MOUSE.PAN, RIGHT: MOUSE.PAN }
|
||||
const MOVES_ON_DRAG = { LEFT: MOUSE.PAN, MIDDLE: MOUSE.ROTATE, RIGHT: MOUSE.ROTATE }
|
||||
|
||||
const LEFT_BUTTON = 0
|
||||
const RIGHT_BUTTON = 2
|
||||
|
||||
function picks(event: PointerEvent): boolean {
|
||||
return event.button === 0 && !event.shiftKey && !event.ctrlKey && !event.metaKey
|
||||
return event.button === LEFT_BUTTON && !event.shiftKey && !event.ctrlKey && !event.metaKey
|
||||
}
|
||||
|
||||
// As on the map: a right click, or a click while holding Ctrl.
|
||||
function asksAboutSpot(event: PointerEvent): boolean {
|
||||
return event.button === RIGHT_BUTTON || (event.button === LEFT_BUTTON && (event.ctrlKey || event.metaKey))
|
||||
}
|
||||
|
||||
/** The camera of a viewport, for content that draws only what the camera looks at. */
|
||||
@@ -57,6 +71,23 @@ interface SceneViewportProps {
|
||||
framing?: unknown
|
||||
/** Called when the content is clicked, not dragged. */
|
||||
onPick?(picked: PickedSurface): void
|
||||
/** What a spot on the content offers, as the map does for a spot on it. */
|
||||
spotActions?: SpotActions
|
||||
}
|
||||
|
||||
export interface SpotActions {
|
||||
/** Called when a spot is clicked while holding Ctrl. */
|
||||
onCtrlClick(spot: Vector3): void
|
||||
/** The items of the menu a right click on a spot opens. */
|
||||
menuItems(spot: Vector3): React.ReactNode
|
||||
}
|
||||
|
||||
/** A spot the user asked about, and where on the screen they did. */
|
||||
interface AskedSpot {
|
||||
spot: Vector3
|
||||
gesture: 'ctrlClick' | 'rightClick'
|
||||
clientX: number
|
||||
clientY: number
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -64,9 +95,12 @@ interface SceneViewportProps {
|
||||
* turns on a right drag. Either turns around what is in the middle, and scrolling comes closer to the cursor. The
|
||||
* camera stops with the mouse, and the view is drawn only when it changes.
|
||||
*/
|
||||
export function SceneViewport({ content, framing, onPick }: SceneViewportProps): React.JSX.Element {
|
||||
export function SceneViewport({ content, framing, onPick, spotActions }: SceneViewportProps): React.JSX.Element {
|
||||
const host = useRef<HTMLDivElement>(null)
|
||||
const stage = useRef<Stage | null>(null)
|
||||
const [menuSpot, setMenuSpot] = useState<Vector3 | null>(null)
|
||||
const latestSpotActions = useRef(spotActions)
|
||||
latestSpotActions.current = spotActions
|
||||
|
||||
useEffect(() => {
|
||||
const created = new Stage(host.current!)
|
||||
@@ -81,7 +115,48 @@ export function SceneViewport({ content, framing, onPick }: SceneViewportProps):
|
||||
useEffect(() => stage.current?.frameShown(), [framing])
|
||||
useEffect(() => stage.current?.onPick(onPick ?? null), [onPick])
|
||||
|
||||
return <div ref={host} className="absolute inset-0 bg-map-background" />
|
||||
const offersSpotActions = spotActions !== undefined
|
||||
useEffect(() => {
|
||||
if (!offersSpotActions) {
|
||||
return
|
||||
}
|
||||
stage.current?.onSpotAsked((asked) => {
|
||||
if (asked.gesture === 'ctrlClick') {
|
||||
latestSpotActions.current?.onCtrlClick(asked.spot)
|
||||
return
|
||||
}
|
||||
setMenuSpot(asked.spot)
|
||||
openMenuAt(host.current!, asked.clientX, asked.clientY)
|
||||
})
|
||||
return () => stage.current?.onSpotAsked(null)
|
||||
}, [offersSpotActions])
|
||||
useEffect(() => keepPressFromOpeningMenu(host.current!), [])
|
||||
|
||||
return (
|
||||
<ContextMenu onOpenChange={(open) => !open && setMenuSpot(null)}>
|
||||
<ContextMenuTrigger asChild>
|
||||
<div ref={host} className="absolute inset-0 bg-map-background" />
|
||||
</ContextMenuTrigger>
|
||||
<ContextMenuContent className="min-w-56">{menuSpot !== null && spotActions?.menuItems(menuSpot)}</ContextMenuContent>
|
||||
</ContextMenu>
|
||||
)
|
||||
}
|
||||
|
||||
// A right press turns the view, so the menu waits for a right click that did not: the browser's own request for a menu,
|
||||
// which comes with the press, is kept from the menu, and the viewport asks for it itself.
|
||||
function keepPressFromOpeningMenu(host: HTMLElement): () => void {
|
||||
const swallow = (event: MouseEvent): void => {
|
||||
if (event.isTrusted) {
|
||||
event.preventDefault()
|
||||
event.stopPropagation()
|
||||
}
|
||||
}
|
||||
host.addEventListener('contextmenu', swallow, { capture: true })
|
||||
return () => host.removeEventListener('contextmenu', swallow, { capture: true })
|
||||
}
|
||||
|
||||
function openMenuAt(host: HTMLElement, clientX: number, clientY: number): void {
|
||||
host.dispatchEvent(new MouseEvent('contextmenu', { bubbles: true, cancelable: true, clientX, clientY }))
|
||||
}
|
||||
|
||||
/** The renderer, camera and controls of one viewport. What it shows belongs to whoever built it, who frees it. */
|
||||
@@ -99,8 +174,11 @@ class Stage {
|
||||
private frameRequested = false
|
||||
private pickListener: ((picked: PickedSurface) => void) | null = null
|
||||
private pressedAt: { x: number; y: number } | null = null
|
||||
private spotListener: ((asked: AskedSpot) => void) | null = null
|
||||
private spotPressedAt: { x: number; y: number } | null = null
|
||||
|
||||
constructor(private readonly host: HTMLDivElement) {
|
||||
this.renderer.outputColorSpace = LinearSRGBColorSpace
|
||||
this.renderer.setPixelRatio(window.devicePixelRatio)
|
||||
this.renderer.setClearAlpha(0)
|
||||
host.appendChild(this.renderer.domElement)
|
||||
@@ -109,9 +187,13 @@ class Stage {
|
||||
this.navigateAs(false)
|
||||
this.renderer.domElement.addEventListener('pointerdown', (event) => {
|
||||
this.pressedAt = picks(event) ? { x: event.clientX, y: event.clientY } : null
|
||||
this.spotPressedAt = asksAboutSpot(event) ? { x: event.clientX, y: event.clientY } : null
|
||||
this.pivotOnSurfaceInMiddle()
|
||||
})
|
||||
this.renderer.domElement.addEventListener('pointerup', (event) => this.pickIfClicked(event))
|
||||
this.renderer.domElement.addEventListener('pointerup', (event) => {
|
||||
this.pickIfClicked(event)
|
||||
this.askAboutSpotIfClicked(event)
|
||||
})
|
||||
this.controls.addEventListener('change', () => {
|
||||
this.fitClipToOrbit()
|
||||
this.notifyMoved()
|
||||
@@ -205,13 +287,41 @@ class Stage {
|
||||
if (Math.hypot(event.clientX - pressed.x, event.clientY - pressed.y) > CLICK_SLOP_PIXELS) {
|
||||
return
|
||||
}
|
||||
this.pickListener(this.surfaceUnder(event))
|
||||
}
|
||||
|
||||
onSpotAsked(listener: ((asked: AskedSpot) => void) | null): void {
|
||||
this.spotListener = listener
|
||||
}
|
||||
|
||||
private askAboutSpotIfClicked(event: PointerEvent): void {
|
||||
const pressed = this.spotPressedAt
|
||||
this.spotPressedAt = null
|
||||
if (pressed === null || this.spotListener === null) {
|
||||
return
|
||||
}
|
||||
if (Math.hypot(event.clientX - pressed.x, event.clientY - pressed.y) > CLICK_SLOP_PIXELS) {
|
||||
return
|
||||
}
|
||||
const surface = this.surfaceUnder(event)
|
||||
if (surface === null) {
|
||||
return
|
||||
}
|
||||
const gesture = event.button === RIGHT_BUTTON ? 'rightClick' : 'ctrlClick'
|
||||
this.spotListener({ spot: surface.point, gesture, clientX: event.clientX, clientY: event.clientY })
|
||||
}
|
||||
|
||||
private surfaceUnder(event: PointerEvent): PickedSurface {
|
||||
if (this.shown === null) {
|
||||
return null
|
||||
}
|
||||
const bounds = this.renderer.domElement.getBoundingClientRect()
|
||||
const pointer = new Vector2(((event.clientX - bounds.left) / bounds.width) * 2 - 1, -((event.clientY - bounds.top) / bounds.height) * 2 + 1)
|
||||
const caster = new Raycaster()
|
||||
this.camera.updateMatrixWorld()
|
||||
caster.setFromCamera(pointer, this.camera)
|
||||
const point = surfaceAlong(this.shown, caster.ray, this.camera.far)
|
||||
this.pickListener(point === null ? null : { point, direction: caster.ray.direction.clone() })
|
||||
return point === null ? null : { point, direction: caster.ray.direction.clone() }
|
||||
}
|
||||
|
||||
// The pivot slides along the line of sight, so the picture stays put while turning now goes around what is there,
|
||||
|
||||
@@ -69,7 +69,7 @@ export function MapTools({ toggles, hasPlayers, onToggle, onRefresh, onResetZoom
|
||||
<IdeIcon name="grid" />
|
||||
</ToolToggle>
|
||||
<ToolToggle action="borders" hint="Outline the regions on every view" pressed={toggles.regionBorders} onPressed={() => onToggle('regionBorders')}>
|
||||
<IdeIcon name="views/regions" />
|
||||
<IdeIcon name="borders" />
|
||||
</ToolToggle>
|
||||
<ToolToggle action="shading" hint="Shade hills and valleys" pressed={toggles.shading} onPressed={() => onToggle('shading')}>
|
||||
<IdeIcon name="shading" />
|
||||
@@ -79,14 +79,14 @@ export function MapTools({ toggles, hasPlayers, onToggle, onRefresh, onResetZoom
|
||||
</ToolToggle>
|
||||
<Separator orientation="vertical" className="mx-1 h-4!" />
|
||||
<ToolToggle action="entities" hint="Show mobs and other entities" pressed={toggles.entities} disabled={!hasPlayers} onPressed={() => onToggle('entities')}>
|
||||
<IdeIcon name="user" />
|
||||
<IdeIcon name="mob" />
|
||||
</ToolToggle>
|
||||
<ToolToggle action="follow" hint="Keep your player in the middle" pressed={toggles.follow} disabled={!hasPlayers} onPressed={() => onToggle('follow')}>
|
||||
<IdeIcon name="locate" />
|
||||
</ToolToggle>
|
||||
<Separator orientation="vertical" className="mx-1 h-4!" />
|
||||
<ToolButton action="resetZoom" hint="Go back to the default zoom" onClick={onResetZoom}>
|
||||
<IdeIcon name="zoomIn" />
|
||||
<IdeIcon name="actualZoom" />
|
||||
</ToolButton>
|
||||
<ToolButton action="refresh" hint="Redraw the map with the latest pack files" onClick={onRefresh}>
|
||||
<IdeIcon name="refresh" />
|
||||
|
||||
@@ -13,15 +13,12 @@ const VIEW_ICONS: Record<string, IdeIconName> = {
|
||||
regions: 'views/regions',
|
||||
world3d: 'views/world-3d',
|
||||
savedWorld: 'views/saved-world',
|
||||
landBiomes: 'views/land-biomes',
|
||||
seaBiomes: 'views/sea-biomes',
|
||||
caveBiomes: 'views/cave-biomes',
|
||||
'iris:terrain/palettes': 'views/palettes',
|
||||
'iris:objects': 'views/objects',
|
||||
'iris:objects/procedural': 'views/procedural',
|
||||
noise: 'views/noise'
|
||||
}
|
||||
const FALLBACK_ICON: IdeIconName = 'views/regions'
|
||||
const FALLBACK_ICON: IdeIconName = 'blocks'
|
||||
/** Inset, because the stripe scrolls and so clips anything drawn outside its buttons. */
|
||||
const STRIPE_BUTTON = 'flex size-8 shrink-0 items-center justify-center rounded-lg outline-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-inset'
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ import { Legend } from './Legend'
|
||||
import { PickInspector } from './PickInspector'
|
||||
import { SceneViewport } from './SceneViewport'
|
||||
import { usePickInspection } from './usePickInspection'
|
||||
import { useSpotActions } from './useSpotActions'
|
||||
import { HEADER_CHOICE, Panel, ViewIsland } from './Sidebar'
|
||||
import { useGroundInView, useLongPending, useTerrainStream } from './useTerrainStream'
|
||||
|
||||
@@ -69,6 +70,7 @@ export function WorldStudio3D({ title, client, world, mapArea, packRevision, onS
|
||||
const pickLayer = useMemo<MapLayerQuery>(() => ({ view: pickView, preview: null }), [pickView])
|
||||
const area = useAreaOf(ground)
|
||||
const inspection = usePickInspection(client, pickLayer, area, inspectsPicks, packRevision)
|
||||
const spotActions = useSpotActions(client, tell, true)
|
||||
|
||||
useEffect(() => {
|
||||
onSummary(`Around ${NUMBER.format(centre.x)}, ${NUMBER.format(centre.z)}`)
|
||||
@@ -96,7 +98,7 @@ export function WorldStudio3D({ title, client, world, mapArea, packRevision, onS
|
||||
</ToggleGroup>
|
||||
}
|
||||
>
|
||||
<SceneViewport content={content} framing={content} />
|
||||
<SceneViewport content={content} framing={content} spotActions={spotActions} />
|
||||
{sampling && (
|
||||
<div className="pointer-events-none absolute top-3 left-1/2 -translate-x-1/2 rounded-md border border-overlay-border bg-card px-3 py-1.5 text-[12px] text-secondary-text">
|
||||
Sampling the terrain
|
||||
|
||||
@@ -16,7 +16,7 @@ import {
|
||||
type KeyPress
|
||||
} from './shortcuts'
|
||||
|
||||
const DEFAULT_VIEWS = ['biomes', 'regions', 'landBiomes', 'seaBiomes', 'caveBiomes'].map((id) => ({ id, label: id }))
|
||||
const DEFAULT_VIEWS = ['biomes', 'regions', 'world3d', 'savedWorld', 'noise'].map((id) => ({ id, label: id }))
|
||||
const ROWS = shortcutRows(DEFAULT_VIEWS)
|
||||
|
||||
function press(key: string, modifiers: Partial<Omit<KeyPress, 'key'>> = {}): KeyPress {
|
||||
|
||||
@@ -71,9 +71,6 @@ const VIEW_KEYS: Record<string, Chord> = {
|
||||
biomes: '1',
|
||||
regions: '2',
|
||||
world3d: '4',
|
||||
landBiomes: '5',
|
||||
seaBiomes: '6',
|
||||
caveBiomes: '7',
|
||||
'iris:terrain/palettes': 'p',
|
||||
'iris:objects': 'o',
|
||||
'iris:objects/procedural': 't',
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { useMemo } from 'react'
|
||||
import type { Vector3 } from 'three'
|
||||
import { ContextMenuItem, ContextMenuSeparator } from '@/components/ui/context-menu'
|
||||
import type { BridgeClient } from '../bridge/BridgeClient'
|
||||
import type { SpotActions } from './SceneViewport'
|
||||
|
||||
/**
|
||||
* What a spot of terrain in 3D offers, as a spot on the map does: teleporting there and copying where it is.
|
||||
*
|
||||
* @param inStudioWorld whether the terrain is the studio's own world, the only one the server teleports into
|
||||
*/
|
||||
export function useSpotActions(client: BridgeClient, tell: (message: string) => void, inStudioWorld: boolean): SpotActions {
|
||||
return useMemo(() => {
|
||||
const teleportTo = (spot: Vector3): void => {
|
||||
const [blockX, blockZ] = [Math.floor(spot.x), Math.floor(spot.z)]
|
||||
client
|
||||
.teleport(blockX, blockZ)
|
||||
.then(() => tell(`Teleporting to ${blockX}, ${blockZ}`))
|
||||
.catch((failure: Error) => tell(failure.message))
|
||||
}
|
||||
const copy = (spot: Vector3): void => {
|
||||
const coordinates = coordinatesOf(spot)
|
||||
window.studio.copyText(coordinates)
|
||||
tell(`Copied ${coordinates}`)
|
||||
}
|
||||
return {
|
||||
onCtrlClick: (spot) => inStudioWorld && teleportTo(spot),
|
||||
menuItems: (spot) => (
|
||||
<>
|
||||
{inStudioWorld && (
|
||||
<>
|
||||
<ContextMenuItem onSelect={() => teleportTo(spot)}>Teleport here</ContextMenuItem>
|
||||
<ContextMenuSeparator />
|
||||
</>
|
||||
)}
|
||||
<ContextMenuItem onSelect={() => copy(spot)}>Copy coordinates ({coordinatesOf(spot)})</ContextMenuItem>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}, [client, tell, inStudioWorld])
|
||||
}
|
||||
|
||||
// A top face stands where a player's feet do, so its height is the Y to stand at.
|
||||
function coordinatesOf(spot: Vector3): string {
|
||||
return `${Math.floor(spot.x)}, ${Math.round(spot.y)}, ${Math.floor(spot.z)}`
|
||||
}
|
||||
@@ -30,6 +30,7 @@ export function useTerrainStream<Tile, Layer>(
|
||||
return () => {
|
||||
created.dispose()
|
||||
setStream(null)
|
||||
setPending(0)
|
||||
}
|
||||
}, [source, coarsestLevel, focus])
|
||||
useEffect(() => {
|
||||
|
||||