Files
texturecraft/crates/engine/src/lib.rs
T
Rebornim 59fd1bc705 Polygon fill: the triangle grouping moves to geom, for generators to share
TrianglePartition and the UV edge key (with its corner grid) move from the engine into texturecraft-geom unchanged, beside the mesh they group, with a uv_islands constructor polygon fill now uses for its UV island mode. The compositor can then group texels by UV island for the UV island generators without depending on the engine.
2026-11-24 12:09:41 +00:00

136 lines
3.8 KiB
Rust

//! # texturecraft-engine
//!
//! The TextureCraft session: a [`Session`] owns the document (project + copy-on-write pixels +
//! baked maps), the mesh with its BVH and per-texture-set caches (UV G-buffer, padding map,
//! composite), snapshot-based undo, the tool state and the active stroke. Every user-visible
//! action is a command in the [`commands`] registry, dispatched by id from the UI, the CLI,
//! the control channel and the MCP server alike.
#![forbid(unsafe_code)]
#![deny(clippy::unwrap_used, clippy::expect_used, clippy::panic, clippy::unimplemented, clippy::todo, clippy::unreachable)]
pub mod add_mask_cmds;
mod anchored_micro_edit;
pub mod bake;
pub mod bake_preview;
pub mod brush_preset_cmds;
pub mod camera_cmds;
pub mod color_selection_cmds;
pub mod commands;
pub mod decal_cmds;
pub mod distance_params;
pub mod effect_blending_cmds;
pub mod effect_clipboard;
pub mod file_cmds;
pub mod fill_alpha;
pub mod fill_hit_test;
pub mod fill_material_cmds;
pub mod fill_mode;
pub mod fill_reset_cmds;
pub mod filter_about;
pub mod filter_lib;
pub mod folder_cmds;
mod frame_target;
pub mod id_mask_view;
pub mod inspect;
pub mod instance_cmds;
pub mod layer_cmds;
pub mod layer_ops;
pub mod layer_selection;
pub mod link_cmds;
pub mod log;
mod log_entry;
mod log_level;
mod mask_bitmap;
pub mod mask_cmds;
pub mod mask_export;
mod mask_owner;
mod mask_preview_pixel;
pub mod material_lib;
mod material_preview_pixel;
pub mod materials;
pub mod materialx_cmds;
pub mod meshmap_cmds;
mod meshmap_file_name;
pub mod meshmap_import_cmds;
pub mod micro_params;
mod orb_camera;
pub mod orb_preview;
pub mod painting;
mod path_draft;
pub mod path_tool;
pub mod pbr_cmds;
mod polygon_fill;
mod polygon_fill_drag;
mod polygon_fill_mirror;
mod stencil_look;
// Mesh reimport reads files on native targets only
#[cfg(not(target_arch = "wasm32"))]
mod preserve;
pub mod preset_cmds;
pub mod preview;
mod procedural_params;
pub mod project_cmds;
pub mod quick_mask;
pub mod resource_cmds;
pub mod session;
mod session_log;
pub mod set_cmds;
pub mod smart_masks;
mod solo;
mod stylized_lighting_params;
pub mod swatch_cmds;
pub mod template_cmds;
pub mod text_cmds;
pub mod thumbs;
mod tile_transform_params;
mod tool_availability;
pub mod tool_cmds;
pub mod tool_settings;
mod uv_stroke_state;
mod uv_symmetry;
pub mod uv_tile_cmds;
pub mod view_cmds;
pub mod warp_cmds;
pub use bake::{BakeMesh, BakeMeshes, BakeTask, StreamedBake, StreamedMap};
pub use bake_preview::{BakePreview, PreviewShow};
pub use commands::{CommandSpec, check_enabled, command_specs, execute, find};
pub use fill_hit_test::FillHitTest;
pub use fill_mode::FillMode;
pub use log::{LogEntry, LogLevel, SessionLog};
pub use path_tool::PathState;
pub use project_cmds::sample_session;
pub use session::{
CloneFrom, CloneSource, Document, HISTORY_TEMPLATES, NORMAL_HEIGHT_MESH_LABEL, Session, SetCache, StackTarget, StencilLook, StencilState, Tool, ToolState,
ViewMode, history_label, stroke_template,
};
pub use set_cmds::{ResizeOutput, ResizeTask};
pub use solo::Solo;
pub use tool_settings::ToolSettings;
pub use texturecraft_compose as compose;
pub use texturecraft_core as core;
pub use texturecraft_formats as formats;
pub use texturecraft_geom as geom;
pub use texturecraft_paint as paint;
pub use texturecraft_texel as texel;
#[derive(Debug, thiserror::Error)]
pub enum EngineError {
#[error("unknown command `{0}`")]
UnknownCommand(String),
#[error("`{cmd}` is not available: {why}")]
Disabled { cmd: String, why: String },
#[error("`{cmd}`: {msg}")]
BadParams { cmd: String, msg: String },
#[error(transparent)]
Core(#[from] texturecraft_core::CoreError),
#[error("{0}")]
Other(String),
}
pub type Result<T> = std::result::Result<T, EngineError>;
/// Version string shown in About, `--version` and window titles.
pub const VERSION: &str = env!("CARGO_PKG_VERSION");