refactor
This commit is contained in:
@@ -2,7 +2,7 @@ use bytemuck::{Pod, Zeroable};
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
struct Vertex {
|
||||
pub struct Vertex {
|
||||
_pos: [f32; 4],
|
||||
_normal: [f32; 4],
|
||||
}
|
||||
@@ -11,14 +11,14 @@ unsafe impl Pod for Vertex {}
|
||||
|
||||
unsafe impl Zeroable for Vertex {}
|
||||
|
||||
fn vertex(pos: [f32; 3], nor: [f32; 3]) -> Vertex {
|
||||
pub fn vertex(pos: [f32; 3], nor: [f32; 3]) -> Vertex {
|
||||
Vertex {
|
||||
_pos: [pos[0], pos[1], pos[2], 1.0],
|
||||
_normal: [nor[0], nor[1], nor[2], 0.0],
|
||||
}
|
||||
}
|
||||
|
||||
fn import_mesh(mesh_path: &str) -> (Vec<Vertex>, Vec<u32>) {
|
||||
pub fn import_mesh(mesh_path: &str) -> (Vec<Vertex>, Vec<u32>) {
|
||||
//let obj_file = "/home/mrh/source/3d-min-viable-eng/resources/Tree_01.obj";
|
||||
//let mtl_file = "/home/mrh/source/3d-min-viable-eng/resources/Tree_01.mtl";
|
||||
let (models, materials) = tobj::load_obj(mesh_path, false).expect("Failed to load file");
|
||||
@@ -73,7 +73,7 @@ fn import_mesh(mesh_path: &str) -> (Vec<Vertex>, Vec<u32>) {
|
||||
|
||||
}
|
||||
|
||||
fn create_plane(size: f32) -> (Vec<Vertex>, Vec<u32>) {
|
||||
pub fn create_plane(size: f32) -> (Vec<Vertex>, Vec<u32>) {
|
||||
let vertex_data = [
|
||||
vertex([size, -size, 0.0], [0.0, 0.0, 1.0]),
|
||||
vertex([size, size, 0.0], [0.0, 0.0, 1.0]),
|
||||
|
||||
Reference in New Issue
Block a user