pub enum SkinFile {
New(Skin),
Old(OldSkin),
}Expand description
Enum to represent either format variant
Variants§
New(Skin)
New format with version field (camera files)
Old(OldSkin)
Old format without version field (character models)
Implementations§
Source§impl SkinFile
impl SkinFile
Sourcepub fn parse<R: Read + Seek>(reader: &mut R) -> Result<Self>
pub fn parse<R: Read + Seek>(reader: &mut R) -> Result<Self>
Parse a SKIN file with automatic format detection
Sourcepub fn load<P: AsRef<Path>>(path: P) -> Result<Self>
pub fn load<P: AsRef<Path>>(path: P) -> Result<Self>
Load a SKIN file from a path with automatic format detection
Sourcepub fn write<W: Write + Seek>(&self, writer: &mut W) -> Result<()>
pub fn write<W: Write + Seek>(&self, writer: &mut W) -> Result<()>
Write the SKIN file to a writer
Sourcepub fn get_resolved_indices(&self) -> Vec<u16>
pub fn get_resolved_indices(&self) -> Vec<u16>
Get resolved vertex indices for rendering
CRITICAL CORRECTION: After empirical analysis, the triangles array already contains the final vertex indices for rendering. The previous assumption about two-level indirection was incorrect.
For both embedded skins (pre-WotLK) and external .skin files (WotLK+):
- The triangles array contains the direct vertex indices for mesh connectivity
- No additional indirection is needed
- Values like [76, 21, 23] are the actual vertex indices to use for triangles
Sourcepub fn indices(&self) -> &Vec<u16>
pub fn indices(&self) -> &Vec<u16>
Get raw indices array (vertex mapping/lookup table)
Note: For triangle rendering, use get_resolved_indices() instead.
This method returns the indices array which serves as a vertex mapping table.
In practice, this array typically contains sequential values [0,1,2,3…]
and is used internally by the M2 format for vertex organization.
Sourcepub fn submeshes(&self) -> &Vec<SkinSubmesh>
pub fn submeshes(&self) -> &Vec<SkinSubmesh>
Get submeshes regardless of format
Sourcepub fn convert(&self, target_version: M2Version) -> Result<Self>
pub fn convert(&self, target_version: M2Version) -> Result<Self>
Convert this skin file to a target version
This handles cross-format conversion automatically:
- WotLK and earlier use old format (no version field)
- Cataclysm and later use new format (with version field)
The conversion preserves all mesh data while adjusting the header structure as needed for the target version.
Sourcepub fn bone_indices(&self) -> &Vec<u8> ⓘ
pub fn bone_indices(&self) -> &Vec<u8> ⓘ
Get the bone indices regardless of format
Sourcepub fn is_new_format(&self) -> bool
pub fn is_new_format(&self) -> bool
Check if this is a new format SKIN file
Sourcepub fn is_old_format(&self) -> bool
pub fn is_old_format(&self) -> bool
Check if this is an old format SKIN file
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SkinFile
impl RefUnwindSafe for SkinFile
impl Send for SkinFile
impl Sync for SkinFile
impl Unpin for SkinFile
impl UnwindSafe for SkinFile
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> 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 more