mirror of
https://github.com/storytold/texturecraft.git
synced 2026-11-29 09:34:33 +01:00
- Global blur, balance and contrast on every generator (GeneratorGlobal). The blur blurs only the generator's own value, up to a 64-texel radius at 2K, weighted by mesh coverage; balance picks the input range that is stretched to 0..1 and contrast narrows it; invert stays last. - Output resolution (OutputResolution, ResolutionMode): Auto or UV tile, Texture set or a custom size, times a factor from 1/8 to x8, never coarser than one value per 64 texels. Below the UV tile's resolution the generator is averaged over cells and read back bilinearly. - Image inputs: each mesh map a generator reads can read an image, a uniform value or an anchor point instead. Generator inputs count as anchor and image readers (compositing order, paste, remove unused). - Blur and resolution run as a neighbourhood stage of the mask, listed the same way by every caller and only in masks. - Commands: blur, balance, contrast, resolution, customResolution, resolutionFactor on effect.add.generator / effect.set, and input with inputImage / inputValue / inputAnchor / inputBaked on effect.set. New fields are skipped when they hold their defaults and neutral settings return the value untouched, so saved projects load, save and render as before.
52 lines
2.5 KiB
Rust
52 lines
2.5 KiB
Rust
//! # texturecraft-core
|
|
//!
|
|
//! The TextureCraft document model: a [`Project`] holds texture sets (one per mesh material),
|
|
//! each with a stack of [`Layer`]s (paint, fill, group) whose channels blend with one of
|
|
//! the [`BlendMode`]s. Pure data with serde; pixels live in `texturecraft-texel` images
|
|
//! owned by the engine. [`blend`] is the CPU reference for every blend mode.
|
|
#![forbid(unsafe_code)]
|
|
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
|
|
|
|
pub mod bake;
|
|
pub mod blend;
|
|
mod block_scales;
|
|
pub mod channel;
|
|
pub mod layer;
|
|
pub mod project;
|
|
|
|
pub use bake::{
|
|
AmbientOcclusionAttenuation, AmbientOcclusionSettings, BackfaceMode, BakeAntialiasing, BakePaintTarget, BakeResolution, BakeSettings, BakedMap,
|
|
BentNormalSettings, CageSettings, CageType, CommonBakeSettings, CurvatureMethod, CurvatureSettings, GroundPlaneSettings, HeightNormalization,
|
|
HeightSettings, HighPolySettings, IdColorGenerator, IdColorSource, IdSettings, MapSettings, MeshCurvatureSettings, MeshMapSettings, MeshMatchMode,
|
|
NormalMapCurvatureSettings, PositionAxis, PositionMode, PositionNormalizationScale, PositionSettings, RayDistribution, RaySettings, SelfOcclusion,
|
|
SkewCorrectionMethod, SkewSettings, ThicknessNormalization, ThicknessSettings,
|
|
};
|
|
pub use blend::{BlendMode, blend1, blend3, lum, mix3};
|
|
pub use channel::{Channel, ChannelFormat, ChannelKind};
|
|
pub use layer::{
|
|
ChannelBlend, CompareOp, CurvatureDetail, CurvatureMode, Decal, Effect, EffectKind, Fill, Filter, Generator, GeneratorGlobal, GeneratorKind, HeightMask,
|
|
Layer, LayerId, LayerKind, Levels, LinkParam, LinkPreset, Mask, MaskBackground, MaterialLink, OutputResolution, PathShape, Procedural, ProceduralKind,
|
|
Projection, ResolutionMode, Source, gradient, hsl_adjust, per_unit,
|
|
};
|
|
pub use project::{
|
|
AoMixing, BlockScales, Camera, DepthOfField, DisplaySettings, FORMAT_VERSION, MAX_RESOLUTION, MIN_RESOLUTION, NormalFormat, NormalMixing, Project,
|
|
TextureSet, TileGrid, ToneMapping, UDIM_RANGE, udim_at,
|
|
};
|
|
|
|
#[derive(Debug, thiserror::Error, Clone, PartialEq)]
|
|
pub enum CoreError {
|
|
#[error("no layer with id {}", .0.0)]
|
|
NoLayer(LayerId),
|
|
#[error("no texture set {0}")]
|
|
NoTextureSet(usize),
|
|
#[error("{0}")]
|
|
Invalid(String),
|
|
}
|
|
|
|
pub type Result<T> = std::result::Result<T, CoreError>;
|
|
|
|
/// Product name for user-facing text.
|
|
pub const APP_NAME: &str = "TextureCraft";
|
|
/// Native project file extension.
|
|
pub const PROJECT_EXT: &str = "tcraft";
|