pub struct Map {Show 33 fields
pub id: Uuid,
pub name: String,
pub offset: Vec2<f32>,
pub grid_size: f32,
pub subdivisions: f32,
pub terrain: Terrain,
pub possible_polygon: Vec<u32>,
pub curr_grid_pos: Option<Vec2<f32>>,
pub curr_mouse_pos: Option<Vec2<f32>>,
pub curr_rectangle: Option<(Vec2<f32>, Vec2<f32>)>,
pub vertices: Vec<Vertex>,
pub linedefs: Vec<Linedef>,
pub sectors: Vec<Sector>,
pub shapefx_graphs: IndexMap<Uuid, ShapeFXGraph>,
pub sky_texture: Option<Uuid>,
pub camera: MapCamera,
pub camera_xz: Option<Vec2<f32>>,
pub look_at_xz: Option<Vec2<f32>>,
pub lights: Vec<Light>,
pub entities: Vec<Entity>,
pub items: Vec<Item>,
pub selected_vertices: Vec<u32>,
pub selected_linedefs: Vec<u32>,
pub selected_sectors: Vec<u32>,
pub selected_entity_item: Option<Uuid>,
pub properties: ValueContainer,
pub softrigs: IndexMap<Uuid, SoftRig>,
pub editing_rig: Option<Uuid>,
pub soft_animator: Option<SoftRigAnimator>,
pub surfaces: IndexMap<Uuid, Surface>,
pub profiles: HashMap<Uuid, Map, FxBuildHasher>,
pub shaders: IndexMap<Uuid, Module>,
pub changed: u32,
}Fields§
§id: Uuid§name: String§offset: Vec2<f32>§grid_size: f32§subdivisions: f32§terrain: Terrain§possible_polygon: Vec<u32>§curr_grid_pos: Option<Vec2<f32>>§curr_mouse_pos: Option<Vec2<f32>>§curr_rectangle: Option<(Vec2<f32>, Vec2<f32>)>§vertices: Vec<Vertex>§linedefs: Vec<Linedef>§sectors: Vec<Sector>§shapefx_graphs: IndexMap<Uuid, ShapeFXGraph>§sky_texture: Option<Uuid>§camera: MapCamera§camera_xz: Option<Vec2<f32>>§look_at_xz: Option<Vec2<f32>>§lights: Vec<Light>§entities: Vec<Entity>§items: Vec<Item>§selected_vertices: Vec<u32>§selected_linedefs: Vec<u32>§selected_sectors: Vec<u32>§selected_entity_item: Option<Uuid>§properties: ValueContainer§softrigs: IndexMap<Uuid, SoftRig>All SoftRigs in the map, each defining vertex-based keyforms
editing_rig: Option<Uuid>Currently edited SoftRig, or None for base geometry
soft_animator: Option<SoftRigAnimator>Vertex animation
surfaces: IndexMap<Uuid, Surface>The surfaces of the 3D meshes.
profiles: HashMap<Uuid, Map, FxBuildHasher>The optional profile of surfaces.
shaders: IndexMap<Uuid, Module>The shaders used in the map.
changed: u32Implementations§
Source§impl Map
impl Map
pub fn new() -> Map
Sourcepub fn clear_temp(&mut self)
pub fn clear_temp(&mut self)
Clear temporary data
Sourcepub fn clear_selection(&mut self)
pub fn clear_selection(&mut self)
Clear the selection
Sourcepub fn get_surface_for_sector_id(&self, sector_id: u32) -> Option<&Surface>
pub fn get_surface_for_sector_id(&self, sector_id: u32) -> Option<&Surface>
Returns the surface for the given sector_id
Sourcepub fn get_surface_for_sector_id_mut(
&mut self,
sector_id: u32,
) -> Option<&mut Surface>
pub fn get_surface_for_sector_id_mut( &mut self, sector_id: u32, ) -> Option<&mut Surface>
Returns the mutable surface for the given sector_id
Sourcepub fn update_surfaces(&mut self)
pub fn update_surfaces(&mut self)
Updates the geometry of all surfaces
Sourcepub fn as_mini(&self, blocking_tiles: &HashSet<Uuid, FxBuildHasher>) -> MapMini
pub fn as_mini(&self, blocking_tiles: &HashSet<Uuid, FxBuildHasher>) -> MapMini
Return the Map as MapMini
Sourcepub fn bounding_box(&self) -> Option<Vec4<f32>>
pub fn bounding_box(&self) -> Option<Vec4<f32>>
Generate a bounding box for all vertices in the map
Sourcepub fn get_vertex(&self, vertex_id: u32) -> Option<Vec2<f32>>
pub fn get_vertex(&self, vertex_id: u32) -> Option<Vec2<f32>>
Get the current position of a vertex, using any keyform override in the current SoftRig.
Sourcepub fn get_vertex_3d(&self, vertex_id: u32) -> Option<Vec3<f32>>
pub fn get_vertex_3d(&self, vertex_id: u32) -> Option<Vec3<f32>>
Get the current position of a vertex, using any keyform override in the current SoftRig.
Sourcepub fn update_vertex(&mut self, vertex_id: u32, new_position: Vec2<f32>)
pub fn update_vertex(&mut self, vertex_id: u32, new_position: Vec2<f32>)
Update the vertex position. If a keyform in the selected rig contains this vertex, update it. Otherwise, create a new keyform for this single vertex.
pub fn add_vertex_at(&mut self, x: f32, y: f32) -> u32
Sourcepub fn add_vertex_at_3d(&mut self, x: f32, y: f32, z: f32, snap: bool) -> u32
pub fn add_vertex_at_3d(&mut self, x: f32, y: f32, z: f32, snap: bool) -> u32
Add a 3D vertex (x,y on the 2D grid; z is up).
Sourcepub fn find_vertex_at_3d(&self, x: f32, y: f32, z: f32) -> Option<u32>
pub fn find_vertex_at_3d(&self, x: f32, y: f32, z: f32) -> Option<u32>
Finds a vertex exactly at (x,y,z) and returns its ID if it exists
Sourcepub fn find_vertex_at(&self, x: f32, y: f32) -> Option<u32>
pub fn find_vertex_at(&self, x: f32, y: f32) -> Option<u32>
Finds a vertex at the given position and returns its ID if it exists
Sourcepub fn find_vertex(&self, id: u32) -> Option<&Vertex>
pub fn find_vertex(&self, id: u32) -> Option<&Vertex>
Finds a reference to a vertex by its ID
Sourcepub fn find_vertex_mut(&mut self, id: u32) -> Option<&mut Vertex>
pub fn find_vertex_mut(&mut self, id: u32) -> Option<&mut Vertex>
Finds a mutable reference to a vertex by its ID
Sourcepub fn find_linedef(&self, id: u32) -> Option<&Linedef>
pub fn find_linedef(&self, id: u32) -> Option<&Linedef>
Finds a reference to a linedef by its ID
Sourcepub fn find_linedef_mut(&mut self, id: u32) -> Option<&mut Linedef>
pub fn find_linedef_mut(&mut self, id: u32) -> Option<&mut Linedef>
Finds a reference to a linedef by its ID
Sourcepub fn find_sector(&self, id: u32) -> Option<&Sector>
pub fn find_sector(&self, id: u32) -> Option<&Sector>
Finds a mutable reference to a sector by its ID
Sourcepub fn find_sector_mut(&mut self, id: u32) -> Option<&mut Sector>
pub fn find_sector_mut(&mut self, id: u32) -> Option<&mut Sector>
Finds a mutable reference to a sector by its ID
pub fn create_linedef( &mut self, start_vertex: u32, end_vertex: u32, ) -> (u32, Option<u32>)
pub fn create_linedef_manual( &mut self, start_vertex: u32, end_vertex: u32, ) -> u32
pub fn close_polygon_manual(&mut self) -> Option<u32>
pub fn is_vertex_in_rect_sector(&self, vertex_id: u32) -> bool
pub fn duplicate_vertex(&mut self, vertex_id: u32) -> Option<u32>
pub fn replace_vertex_in_sector( &mut self, sector_id: u32, old_vertex_id: u32, new_vertex_id: u32, )
Sourcepub fn test_for_closed_polygon(&self) -> bool
pub fn test_for_closed_polygon(&self) -> bool
Check if the possible_polygon forms a closed loop
Sourcepub fn create_sector_from_polygon(&mut self) -> Option<u32>
pub fn create_sector_from_polygon(&mut self) -> Option<u32>
Tries to create a polyon from the tracked vertices in possible_polygon
Sourcepub fn delete_elements(
&mut self,
vertex_ids: &[u32],
linedef_ids: &[u32],
sector_ids: &[u32],
)
pub fn delete_elements( &mut self, vertex_ids: &[u32], linedef_ids: &[u32], sector_ids: &[u32], )
Deletes the specified vertices, linedefs, and sectors.
Sourcepub fn is_linedef_in_closed_polygon(&self, linedef_id: u32) -> bool
pub fn is_linedef_in_closed_polygon(&self, linedef_id: u32) -> bool
Check if a given linedef ID is part of any sector.
Sourcepub fn add_to_selection(
&mut self,
vertices: Vec<u32>,
linedefs: Vec<u32>,
sectors: Vec<u32>,
)
pub fn add_to_selection( &mut self, vertices: Vec<u32>, linedefs: Vec<u32>, sectors: Vec<u32>, )
Add the given geometry to the selection.
Sourcepub fn remove_from_selection(
&mut self,
vertices: Vec<u32>,
linedefs: Vec<u32>,
sectors: Vec<u32>,
)
pub fn remove_from_selection( &mut self, vertices: Vec<u32>, linedefs: Vec<u32>, sectors: Vec<u32>, )
Remove the given geometry from the selection.
Sourcepub fn sorted_sectors_by_area(&self) -> Vec<&Sector>
pub fn sorted_sectors_by_area(&self) -> Vec<&Sector>
Returns the sectors sorted from largest to smallest by area
Sourcepub fn add_midpoint(&mut self, linedef_id: u32) -> Option<u32>
pub fn add_midpoint(&mut self, linedef_id: u32) -> Option<u32>
Adds a midpoint to a specified linedef, updates the geometry, and returns the new vertex ID.
Sourcepub fn find_sectors_with_vertex_indices(
&self,
vertex_indices: &[u32; 4],
) -> Vec<u32>
pub fn find_sectors_with_vertex_indices( &self, vertex_indices: &[u32; 4], ) -> Vec<u32>
Find sectors which consist of exactly the same 4 vertices and return them. This is used for stacking tiles / layering via the RECT tool.
Sourcepub fn find_sector_at(&self, position: Vec2<f32>) -> Option<&Sector>
pub fn find_sector_at(&self, position: Vec2<f32>) -> Option<&Sector>
Returns the sector at the given position (if any).
Sourcepub fn debug_print_vertices(&self)
pub fn debug_print_vertices(&self)
Debug: Print all vertices with their current animated positions
Sourcepub fn sanitize(&mut self)
pub fn sanitize(&mut self)
Sanitizes and associates linedefs with their sectors by populating the sector_ids vector. Removes orphaned linedefs that reference non-existent vertices. This should be called after loading a map or when sectors are modified.
Sourcepub fn associate_linedefs_with_sectors(&mut self)
pub fn associate_linedefs_with_sectors(&mut self)
Alias for sanitize() to maintain backward compatibility.
Sourcepub fn is_linedef_in_rect(&self, linedef_id: u32) -> bool
pub fn is_linedef_in_rect(&self, linedef_id: u32) -> bool
Returns true if the given linedef is part of a sector with rect rendering enabled.
Sourcepub fn find_free_vertex_id(&self) -> Option<u32>
pub fn find_free_vertex_id(&self) -> Option<u32>
Finds a free vertex ID that can be used for creating a new vertex.
Sourcepub fn find_free_linedef_id(&self) -> Option<u32>
pub fn find_free_linedef_id(&self) -> Option<u32>
Finds a free linedef ID that can be used for creating a new linedef.
Sourcepub fn find_free_sector_id(&self) -> Option<u32>
pub fn find_free_sector_id(&self) -> Option<u32>
Finds a free sector ID that can be used for creating a new sector.
Sourcepub fn has_selection(&self) -> bool
pub fn has_selection(&self) -> bool
Check if the map has selected geometry.
Sourcepub fn copy_selected(&mut self, cut: bool) -> Map
pub fn copy_selected(&mut self, cut: bool) -> Map
Copy selected geometry into a new map
Sourcepub fn paste_at_position(&mut self, local_map: &Map, position: Vec2<f32>)
pub fn paste_at_position(&mut self, local_map: &Map, position: Vec2<f32>)
Inserts the given map at the given position.
Sourcepub fn geometry_clone(&self) -> Map
pub fn geometry_clone(&self) -> Map
Creates a geometry_clone clone of the map containing only vertices, linedefs, and sectors.
Sourcepub fn extract_chunk_geometry(&self, bbox: BBox) -> Map
pub fn extract_chunk_geometry(&self, bbox: BBox) -> Map
Extracts all geometry into a new Map which intersects with the given chunk bbox.
pub fn find_embedded_sectors(&self, container_sector_id: u32) -> Vec<u32>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Map
impl<'de> Deserialize<'de> for Map
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Map, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Map, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for Map
impl Serialize for Map
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Map
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnsafeUnpin for Map
impl UnwindSafe for Map
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.