Merge pull request #757 from b-guild/tilemapdata

Removing dependency on `fyrox-core` from `fyrox-autotile`.
This commit is contained in:
Dmitry Stepanov
2025-03-23 09:35:01 +03:00
committed by GitHub
4 changed files with 19 additions and 5 deletions
+16 -1
View File
@@ -67,12 +67,27 @@ pub struct AutoTileMacro {
autotiler: TileSetAutoTiler,
}
#[derive(Default, Debug, Clone, Visit, Reflect)]
#[derive(Default, Debug, Clone, Reflect)]
struct CellData {
terrain_id: TileTerrainId,
#[reflect(hidden)]
fill: ConstraintFillRules,
}
impl Visit for CellData {
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult {
let mut region = visitor.enter_region(name)?;
self.terrain_id.visit("TerrainId", &mut region)?;
let mut region = region.enter_region("Fill")?;
self.fill
.include_adjacent
.visit("IncludeAdjacent", &mut region)?;
self.fill
.include_diagonal
.visit("IncludeDiagonal", &mut region)
}
}
#[derive(Debug, Default, Clone, Visit, Reflect, TypeUuidProvider)]
#[type_uuid(id = "b320543d-3df0-43fd-b0d9-60a398f49853")]
pub(super) struct AutoTileInstance {
+1 -1
View File
@@ -14,6 +14,6 @@ readme = "README.md"
include = ["/src/**/*", "/Cargo.toml", "/LICENSE", "/README.md"]
[dependencies]
fyrox-core = { path = "../fyrox-core", version = "0.36.0" }
nalgebra = { version = "0.33", features = ["bytemuck"] }
fxhash = "0.2.1"
rand = "0.8.5"
+1 -1
View File
@@ -119,7 +119,7 @@ pub trait PatternSource {
/// to fit with the new terrain of this cell. This object specifies whether that should
/// be done. Cells that are added this way keep their current terrain, but their pattern
/// may change.
#[derive(Debug, Default, Clone, Copy, Visit, Reflect)]
#[derive(Debug, Default, Clone, Copy)]
pub struct ConstraintFillRules {
/// True if adjacent cells should be automatically added to the autotiling constraint
/// so that they may be modified.
+1 -2
View File
@@ -37,8 +37,7 @@
use std::{collections::hash_map::Entry, fmt::Debug, hash::Hash};
use fxhash::FxHashMap;
use fyrox_core::algebra::{Vector2, Vector3};
use fyrox_core::{reflect::prelude::*, visitor::prelude::*};
use nalgebra::{Vector2, Vector3};
use rand::Rng;
mod auto;