mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-21 12:17:45 +00:00
Improve the docs for model file ops and vertex declarations
This commit is contained in:
parent
60d6382fbf
commit
ed9d7936e1
2 changed files with 7 additions and 2 deletions
|
@ -7,7 +7,7 @@ use half::f16;
|
||||||
use crate::ByteSpan;
|
use crate::ByteSpan;
|
||||||
use crate::model::MDL;
|
use crate::model::MDL;
|
||||||
|
|
||||||
// Maximum value of byte, used to divide and multiply floats in that space [0.0..1.0] to [0..255]
|
/// Maximum value of byte, used to divide and multiply floats in that space [0.0..1.0] to [0..255]
|
||||||
const MAX_BYTE_FLOAT: f32 = u8::MAX as f32;
|
const MAX_BYTE_FLOAT: f32 = u8::MAX as f32;
|
||||||
|
|
||||||
impl MDL {
|
impl MDL {
|
||||||
|
|
|
@ -5,9 +5,10 @@ use std::io::SeekFrom;
|
||||||
use binrw::{BinRead, BinResult, binrw, BinWrite};
|
use binrw::{BinRead, BinResult, binrw, BinWrite};
|
||||||
use crate::model::NUM_VERTICES;
|
use crate::model::NUM_VERTICES;
|
||||||
|
|
||||||
// Marker for end of stream (0xFF)
|
/// Marker for end of stream (0xFF)
|
||||||
const END_OF_STREAM: u8 = 0xFF;
|
const END_OF_STREAM: u8 = 0xFF;
|
||||||
|
|
||||||
|
/// The format of the vertex stream.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[brw(repr = u8)]
|
#[brw(repr = u8)]
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
|
@ -48,6 +49,7 @@ pub enum VertexType {
|
||||||
UnsignedShort4 = 17
|
UnsignedShort4 = 17
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// What the vertex stream is used for.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[brw(repr = u8)]
|
#[brw(repr = u8)]
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
|
@ -62,6 +64,7 @@ pub enum VertexUsage {
|
||||||
Color = 7,
|
Color = 7,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Represents an element within a bigger vertex stream.
|
||||||
#[binrw]
|
#[binrw]
|
||||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||||
#[allow(dead_code)]
|
#[allow(dead_code)]
|
||||||
|
@ -75,6 +78,8 @@ pub struct VertexElement {
|
||||||
pub usage_index: u8,
|
pub usage_index: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Represents the true size of VertexElement. Always use this value instead of std::mem::size_of.
|
||||||
|
// 3 extra bytes to account for the padding that doesn't appear in the struct itself
|
||||||
pub const VERTEX_ELEMENT_SIZE: usize = std::mem::size_of::<VertexElement>() + 3;
|
pub const VERTEX_ELEMENT_SIZE: usize = std::mem::size_of::<VertexElement>() + 3;
|
||||||
|
|
||||||
#[derive(Clone, Debug, PartialEq)]
|
#[derive(Clone, Debug, PartialEq)]
|
||||||
|
|
Loading…
Add table
Reference in a new issue