mirror of
https://github.com/redstrate/Physis.git
synced 2025-04-24 05:27:45 +00:00
Implement Default trait for Vertex
This commit is contained in:
parent
eb08d9f142
commit
1810821fd7
1 changed files with 16 additions and 12 deletions
28
src/model.rs
28
src/model.rs
|
@ -280,6 +280,21 @@ pub struct Vertex {
|
|||
pub bone_id: [u8; 4],
|
||||
}
|
||||
|
||||
impl Default for Vertex {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
position: [0.0; 3],
|
||||
uv0: [0.0; 2],
|
||||
uv1: [0.0; 2],
|
||||
normal: [0.0; 3],
|
||||
bitangent: [0.0; 4],
|
||||
color: [0.0; 4],
|
||||
bone_weight: [0.0; 4],
|
||||
bone_id: [0u8; 4],
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy)]
|
||||
#[repr(C)]
|
||||
pub struct SubMesh {
|
||||
|
@ -360,18 +375,7 @@ impl MDL {
|
|||
let vertex_count = model.meshes[j as usize].vertex_count;
|
||||
let material_index = model.meshes[j as usize].material_index;
|
||||
|
||||
let default_vertex = Vertex {
|
||||
position: [0.0; 3],
|
||||
uv0: [0.0; 2],
|
||||
uv1: [0.0; 2],
|
||||
normal: [0.0; 3],
|
||||
bitangent: [0.0; 4],
|
||||
color: [0.0; 4],
|
||||
bone_weight: [0.0; 4],
|
||||
bone_id: [0u8; 4],
|
||||
};
|
||||
|
||||
let mut vertices: Vec<Vertex> = vec![default_vertex; vertex_count as usize];
|
||||
let mut vertices: Vec<Vertex> = vec![Vertex::default(); vertex_count as usize];
|
||||
|
||||
for k in 0..vertex_count {
|
||||
for element in &declaration.elements {
|
||||
|
|
Loading…
Add table
Reference in a new issue