Skip to main content

Map

Struct Map 

Source
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: u32

Implementations§

Source§

impl Map

Source

pub fn new() -> Map

Source

pub fn clear_temp(&mut self)

Clear temporary data

Source

pub fn clear_selection(&mut self)

Clear the selection

Source

pub fn get_surface_for_sector_id(&self, sector_id: u32) -> Option<&Surface>

Returns the surface for the given sector_id

Source

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

Source

pub fn update_surfaces(&mut self)

Updates the geometry of all surfaces

Source

pub fn as_mini(&self, blocking_tiles: &HashSet<Uuid, FxBuildHasher>) -> MapMini

Return the Map as MapMini

Source

pub fn bbox(&self) -> BBox

Generate a bounding box for all vertices in the map

Source

pub fn bounding_box(&self) -> Option<Vec4<f32>>

Generate a bounding box for all vertices in the map

Source

pub fn tick(&mut self, delta_time: f32)

Tick the soft animator.

Source

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.

Source

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.

Source

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.

Source

pub fn add_vertex_at(&mut self, x: f32, y: f32) -> u32

Source

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).

Source

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

Source

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

Source

pub fn find_vertex(&self, id: u32) -> Option<&Vertex>

Finds a reference to a vertex by its ID

Source

pub fn find_vertex_mut(&mut self, id: u32) -> Option<&mut Vertex>

Finds a mutable reference to a vertex by its ID

Source

pub fn find_linedef(&self, id: u32) -> Option<&Linedef>

Finds a reference to a linedef by its ID

Source

pub fn find_linedef_mut(&mut self, id: u32) -> Option<&mut Linedef>

Finds a reference to a linedef by its ID

Source

pub fn find_sector(&self, id: u32) -> Option<&Sector>

Finds a mutable reference to a sector by its ID

Source

pub fn find_sector_mut(&mut self, id: u32) -> Option<&mut Sector>

Finds a mutable reference to a sector by its ID

Source

pub fn create_linedef( &mut self, start_vertex: u32, end_vertex: u32, ) -> (u32, Option<u32>)

Source

pub fn create_linedef_manual( &mut self, start_vertex: u32, end_vertex: u32, ) -> u32

Source

pub fn close_polygon_manual(&mut self) -> Option<u32>

Source

pub fn is_vertex_in_rect_sector(&self, vertex_id: u32) -> bool

Source

pub fn duplicate_vertex(&mut self, vertex_id: u32) -> Option<u32>

Source

pub fn replace_vertex_in_sector( &mut self, sector_id: u32, old_vertex_id: u32, new_vertex_id: u32, )

Source

pub fn test_for_closed_polygon(&self) -> bool

Check if the possible_polygon forms a closed loop

Source

pub fn create_sector_from_polygon(&mut self) -> Option<u32>

Tries to create a polyon from the tracked vertices in possible_polygon

Source

pub fn delete_elements( &mut self, vertex_ids: &[u32], linedef_ids: &[u32], sector_ids: &[u32], )

Deletes the specified vertices, linedefs, and sectors.

Source

pub fn is_linedef_in_closed_polygon(&self, linedef_id: u32) -> bool

Check if a given linedef ID is part of any sector.

Source

pub fn add_to_selection( &mut self, vertices: Vec<u32>, linedefs: Vec<u32>, sectors: Vec<u32>, )

Add the given geometry to the selection.

Source

pub fn remove_from_selection( &mut self, vertices: Vec<u32>, linedefs: Vec<u32>, sectors: Vec<u32>, )

Remove the given geometry from the selection.

Source

pub fn sorted_sectors_by_area(&self) -> Vec<&Sector>

Returns the sectors sorted from largest to smallest by area

Source

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.

Source

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.

Source

pub fn find_sector_at(&self, position: Vec2<f32>) -> Option<&Sector>

Returns the sector at the given position (if any).

Source

pub fn debug_print_vertices(&self)

Debug: Print all vertices with their current animated positions

Source

pub fn info(&self) -> String

Returns information about the Map

Source

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.

Source

pub fn associate_linedefs_with_sectors(&mut self)

Alias for sanitize() to maintain backward compatibility.

Source

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.

Source

pub fn find_free_vertex_id(&self) -> Option<u32>

Finds a free vertex ID that can be used for creating a new vertex.

Source

pub fn find_free_linedef_id(&self) -> Option<u32>

Finds a free linedef ID that can be used for creating a new linedef.

Source

pub fn find_free_sector_id(&self) -> Option<u32>

Finds a free sector ID that can be used for creating a new sector.

Source

pub fn has_selection(&self) -> bool

Check if the map has selected geometry.

Source

pub fn is_empty(&self) -> bool

Check if the map is empty.

Source

pub fn copy_selected(&mut self, cut: bool) -> Map

Copy selected geometry into a new map

Source

pub fn paste_at_position(&mut self, local_map: &Map, position: Vec2<f32>)

Inserts the given map at the given position.

Source

pub fn geometry_clone(&self) -> Map

Creates a geometry_clone clone of the map containing only vertices, linedefs, and sectors.

Source

pub fn extract_chunk_geometry(&self, bbox: BBox) -> Map

Extracts all geometry into a new Map which intersects with the given chunk bbox.

Source

pub fn find_embedded_sectors(&self, container_sector_id: u32) -> Vec<u32>

Trait Implementations§

Source§

impl Clone for Map

Source§

fn clone(&self) -> Map

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Map

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Default for Map

Source§

fn default() -> Map

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for Map

Source§

fn deserialize<__D>( __deserializer: __D, ) -> Result<Map, <__D as Deserializer<'de>>::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Map

Source§

fn serialize<__S>( &self, __serializer: __S, ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<S> FromSample<S> for S

Source§

fn from_sample_(s: S) -> S

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<R, P> ReadPrimitive<R> for P
where R: Read + ReadEndian<P>, P: Default,

Source§

fn read_from_little_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_little_endian().
Source§

fn read_from_big_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_big_endian().
Source§

fn read_from_native_endian(read: &mut R) -> Result<Self, Error>

Read this value from the supplied reader. Same as ReadEndian::read_from_native_endian().
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

Source§

fn to_sample_(self) -> U

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,