mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-28 17:19:24 +01:00
A Tile Generator pattern kind lays shapes out in a grid of tiles: 15 shapes and image inputs, tile counts, row or column offset, middle size, interstice, size modes, scale, free and quarter-turn rotation, mirroring, per-tile random scale, position, rotation and luminance, masks, Add/Max/Add sub blending, background, opacity and a position/contrast window. Its settings are a TileGenerator on Procedural (saved only for that kind). Every pattern gets an output resolution like generators: below the UV tile's resolution it is read from an image of that size, bilinearly. Patterns saved before keep their form and render unchanged.
68 lines
1.8 KiB
Rust
68 lines
1.8 KiB
Rust
use serde::{Deserialize, Serialize};
|
|
|
|
/// The shape a Tile Generator draws in each tile
|
|
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
|
pub enum TileShape {
|
|
/// One of the pattern's input images
|
|
Image,
|
|
Square,
|
|
Disc,
|
|
Paraboloid,
|
|
Bell,
|
|
Gaussian,
|
|
Thorn,
|
|
Pyramid,
|
|
#[default]
|
|
Brick,
|
|
Gradation,
|
|
Waves,
|
|
HalfBell,
|
|
RidgedBell,
|
|
Crescent,
|
|
Capsule,
|
|
Cone,
|
|
}
|
|
|
|
impl TileShape {
|
|
/// In the reference app's menu order
|
|
pub const ALL: [TileShape; 16] = [
|
|
TileShape::Image,
|
|
TileShape::Square,
|
|
TileShape::Disc,
|
|
TileShape::Paraboloid,
|
|
TileShape::Bell,
|
|
TileShape::Gaussian,
|
|
TileShape::Thorn,
|
|
TileShape::Pyramid,
|
|
TileShape::Brick,
|
|
TileShape::Gradation,
|
|
TileShape::Waves,
|
|
TileShape::HalfBell,
|
|
TileShape::RidgedBell,
|
|
TileShape::Crescent,
|
|
TileShape::Capsule,
|
|
TileShape::Cone,
|
|
];
|
|
|
|
pub fn label(self) -> &'static str {
|
|
match self {
|
|
TileShape::Image => "Custom image input",
|
|
TileShape::Square => "Square",
|
|
TileShape::Disc => "Disc",
|
|
TileShape::Paraboloid => "Paraboloid",
|
|
TileShape::Bell => "Bell",
|
|
TileShape::Gaussian => "Gaussian",
|
|
TileShape::Thorn => "Thorn",
|
|
TileShape::Pyramid => "Pyramid",
|
|
TileShape::Brick => "Brick",
|
|
TileShape::Gradation => "Gradation",
|
|
TileShape::Waves => "Waves",
|
|
TileShape::HalfBell => "Half bell",
|
|
TileShape::RidgedBell => "Ridged bell",
|
|
TileShape::Crescent => "Crescent",
|
|
TileShape::Capsule => "Capsule",
|
|
TileShape::Cone => "Cone",
|
|
}
|
|
}
|
|
}
|