mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-20 11:47:46 +00:00
Model: Make vertex declarations and enums public
This commit is contained in:
parent
16e4db2a00
commit
f6c2b98b80
2 changed files with 25 additions and 1 deletions
|
@ -108,7 +108,7 @@ mod sha1;
|
|||
mod model_file_operations;
|
||||
|
||||
#[cfg(feature = "visual_data")]
|
||||
mod model_vertex_declarations;
|
||||
pub mod model_vertex_declarations;
|
||||
|
||||
#[cfg(feature = "visual_data")]
|
||||
pub mod lgb;
|
||||
|
|
|
@ -11,6 +11,7 @@ const END_OF_STREAM: u8 = 0xFF;
|
|||
/// The format of the vertex stream.
|
||||
#[binrw]
|
||||
#[brw(repr = u8)]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub enum VertexType {
|
||||
/// 1 32-bit float
|
||||
|
@ -49,9 +50,31 @@ pub enum VertexType {
|
|||
UnsignedShort4 = 17,
|
||||
}
|
||||
|
||||
/// In bytes
|
||||
pub fn get_vertex_type_size(vertex_type: VertexType) -> usize {
|
||||
// TODO: Most of these are wrong
|
||||
match vertex_type {
|
||||
VertexType::Single1 => 4,
|
||||
VertexType::Single2 => 8,
|
||||
VertexType::Single3 => 12,
|
||||
VertexType::Single4 => 16,
|
||||
VertexType::Byte4 => 4,
|
||||
VertexType::Short2 => 4,
|
||||
VertexType::Short4 => 8,
|
||||
VertexType::ByteFloat4 => 4,
|
||||
VertexType::Short2n => 4,
|
||||
VertexType::Short4n => 4,
|
||||
VertexType::Half2 => 4,
|
||||
VertexType::Half4 => 8,
|
||||
VertexType::UnsignedShort2 => 4,
|
||||
VertexType::UnsignedShort4 => 8,
|
||||
}
|
||||
}
|
||||
|
||||
/// What the vertex stream is used for.
|
||||
#[binrw]
|
||||
#[brw(repr = u8)]
|
||||
#[repr(C)]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
pub enum VertexUsage {
|
||||
Position = 0,
|
||||
|
@ -68,6 +91,7 @@ pub enum VertexUsage {
|
|||
#[binrw]
|
||||
#[derive(Copy, Clone, Debug, PartialEq)]
|
||||
#[allow(dead_code)]
|
||||
#[repr(C)]
|
||||
#[brw(little)]
|
||||
pub struct VertexElement {
|
||||
pub stream: u8,
|
||||
|
|
Loading…
Add table
Reference in a new issue