pub struct Vmt {
pub shader: String,
pub properties: IndexMap<VmtKey, Vec<Value>>,
}Fields§
§shader: String§properties: IndexMap<VmtKey, Vec<Value>>Implementations§
Source§impl Vmt
impl Vmt
Sourcepub fn from_str(input: &str) -> Result<Self, Error>
pub fn from_str(input: &str) -> Result<Self, Error>
Parses VMT from a string using AST parser to handle root-level shader.
Sourcepub fn set_string(&mut self, key: &str, value: &str) -> &mut Self
pub fn set_string(&mut self, key: &str, value: &str) -> &mut Self
Set a string property. Overwrites if exists.
Sourcepub fn set_flag(&mut self, key: &str, enabled: bool) -> &mut Self
pub fn set_flag(&mut self, key: &str, enabled: bool) -> &mut Self
Set a flag (boolean) property (converts to “1” or “0”).
Sourcepub fn remove(&mut self, key: &str) -> &mut Self
pub fn remove(&mut self, key: &str) -> &mut Self
Removes a property by key, checking for $, % and raw name.
Sourcepub fn get_raw(&self, key: &str) -> Option<&Value>
pub fn get_raw(&self, key: &str) -> Option<&Value>
O(1) lookup. Handles $, % prefixes and case-insensitive keys.
Sourcepub fn get_string(&self, key: &str) -> Option<String>
pub fn get_string(&self, key: &str) -> Option<String>
Get value as string if it exists.
Sourcepub fn get_color(&self, key: &str) -> Option<[f32; 3]>
pub fn get_color(&self, key: &str) -> Option<[f32; 3]>
Parses colors/vectors in both [0.0 0.0 0.0] and {255 255 255} formats. Returns a normalized [f32; 3] (0.0 to 1.0).
Sourcepub fn add_proxy<'a, I>(&mut self, name: &str, params: I) -> &mut Self
pub fn add_proxy<'a, I>(&mut self, name: &str, params: I) -> &mut Self
Adds a proxy to the material.
Trait Implementations§
impl StructuralPartialEq for Vmt
Auto Trait Implementations§
impl Freeze for Vmt
impl RefUnwindSafe for Vmt
impl Send for Vmt
impl Sync for Vmt
impl Unpin for Vmt
impl UnsafeUnpin for Vmt
impl UnwindSafe for Vmt
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
Mutably borrows from an owned value. Read more