got a good obj file, finally
This commit is contained in:
13
resources/texture-test-1.mtl
Normal file
13
resources/texture-test-1.mtl
Normal file
@@ -0,0 +1,13 @@
|
||||
# Blender MTL File: 'None'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl Material.002
|
||||
Ns 225.000000
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.800000 0.800000 0.800000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd /Users/mitchellhansen/source/minimum-viable-game-engine/resources/test.jpg
|
||||
18
resources/texture-test-1.obj
Normal file
18
resources/texture-test-1.obj
Normal file
@@ -0,0 +1,18 @@
|
||||
# Blender v2.93.1 OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib texture-test-1.mtl
|
||||
o Plane_Plane.001
|
||||
v -1.000000 0.000000 1.000000
|
||||
v 1.000000 0.000000 1.000000
|
||||
v -1.000000 0.000000 -1.000000
|
||||
v 1.000000 0.000000 -1.000000
|
||||
vt 1.000000 0.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.000000
|
||||
vt 1.000000 1.000000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
g Plane_Plane.001_Material.002
|
||||
usemtl Material.002
|
||||
s off
|
||||
f 2/1/1 3/2/1 1/3/1
|
||||
f 2/1/1 4/4/1 3/2/1
|
||||
@@ -58,6 +58,11 @@ pub fn load_obj(obj_path: &str) -> Result<RawMesh, String> {
|
||||
for model in models {
|
||||
let mesh = &model.mesh;
|
||||
|
||||
if let Some(mat_id) = mesh.material_id {
|
||||
let mat : &Material = materials.get(mat_id).unwrap();
|
||||
println!("{:?}", mat);
|
||||
}
|
||||
|
||||
// Cycle through the faces and chunk out the indices
|
||||
let mut next_face = 0;
|
||||
for f in 0..mesh.num_face_indices.len() {
|
||||
|
||||
@@ -290,11 +290,6 @@ impl RenderState {
|
||||
}],
|
||||
});
|
||||
|
||||
/*
|
||||
There appear to be two passes required for shadows, the shadow pass, and the forward pass
|
||||
Need to open this up in renderdoc and see what it's actually doing
|
||||
*/
|
||||
|
||||
let shadow_pass = {
|
||||
let uniform_size = mem::size_of::<ShadowUniforms>() as wgpu::BufferAddress;
|
||||
|
||||
|
||||
@@ -111,5 +111,7 @@ impl RuntimeState {
|
||||
self.mesh_cache.insert(filename, mesh);
|
||||
}
|
||||
}
|
||||
|
||||
panic!("nah");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,59 +127,59 @@ pub fn runtime_spawn(
|
||||
) {
|
||||
for entity in &runtime_state.get_entities() {
|
||||
match entity.type_name.as_ref() {
|
||||
"Sprite" => {
|
||||
|
||||
|
||||
|
||||
let mesh_name = entity.mesh.clone().unwrap();
|
||||
let raw_mesh = match runtime_state.get_mesh(mesh_name.as_str()) {
|
||||
None => {
|
||||
log::warn!("Skipping entity with invalid mesh file {:?} ", mesh_name);
|
||||
continue;
|
||||
}
|
||||
Some(mesh) => mesh,
|
||||
};
|
||||
|
||||
let position = Position::from(entity.position.clone());
|
||||
|
||||
let mut static_body = RigidBodyBuilder::new_static()
|
||||
.position(Isometry3::new(
|
||||
Vector3::new(position.x, position.y, position.z),
|
||||
Vector::y(),
|
||||
))
|
||||
.build();
|
||||
|
||||
let mesh_collider = ColliderBuilder::trimesh(
|
||||
raw_mesh.vertices.iter().map(|v| v.position()).collect(),
|
||||
raw_mesh.indices.clone(),
|
||||
)
|
||||
.build();
|
||||
|
||||
let gpu_mesh_buffer = renderer
|
||||
.upload_mesh_to_buffer(
|
||||
raw_mesh,
|
||||
Some(wgpu::Color {
|
||||
r: 1.0,
|
||||
g: 0.7,
|
||||
b: 0.3,
|
||||
a: 1.0,
|
||||
}),
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
let entity: Entity = cmd.push((
|
||||
position,
|
||||
gpu_mesh_buffer,
|
||||
Physics {
|
||||
rigid_body: static_body,
|
||||
rigid_body_handle: None,
|
||||
},
|
||||
Collider {
|
||||
collider: mesh_collider,
|
||||
collider_handle: None,
|
||||
},
|
||||
));
|
||||
}
|
||||
// "Sprite" => {
|
||||
//
|
||||
//
|
||||
//
|
||||
// let mesh_name = entity.mesh.clone().unwrap();
|
||||
// let raw_mesh = match runtime_state.get_mesh(mesh_name.as_str()) {
|
||||
// None => {
|
||||
// log::warn!("Skipping entity with invalid mesh file {:?} ", mesh_name);
|
||||
// continue;
|
||||
// }
|
||||
// Some(mesh) => mesh,
|
||||
// };
|
||||
//
|
||||
// let position = Position::from(entity.position.clone());
|
||||
//
|
||||
// let mut static_body = RigidBodyBuilder::new_static()
|
||||
// .position(Isometry3::new(
|
||||
// Vector3::new(position.x, position.y, position.z),
|
||||
// Vector::y(),
|
||||
// ))
|
||||
// .build();
|
||||
//
|
||||
// let mesh_collider = ColliderBuilder::trimesh(
|
||||
// raw_mesh.vertices.iter().map(|v| v.position()).collect(),
|
||||
// raw_mesh.indices.clone(),
|
||||
// )
|
||||
// .build();
|
||||
//
|
||||
// let gpu_mesh_buffer = renderer
|
||||
// .upload_mesh_to_buffer(
|
||||
// raw_mesh,
|
||||
// Some(wgpu::Color {
|
||||
// r: 1.0,
|
||||
// g: 0.7,
|
||||
// b: 0.3,
|
||||
// a: 1.0,
|
||||
// }),
|
||||
// )
|
||||
// .unwrap();
|
||||
//
|
||||
// let entity: Entity = cmd.push((
|
||||
// position,
|
||||
// gpu_mesh_buffer,
|
||||
// Physics {
|
||||
// rigid_body: static_body,
|
||||
// rigid_body_handle: None,
|
||||
// },
|
||||
// Collider {
|
||||
// collider: mesh_collider,
|
||||
// collider_handle: None,
|
||||
// },
|
||||
// ));
|
||||
// }
|
||||
"PhysicsEntity" => {
|
||||
let mesh_name = entity.mesh.as_ref().unwrap();
|
||||
let raw_mesh = match runtime_state.get_mesh(mesh_name.as_str()) {
|
||||
|
||||
Reference in New Issue
Block a user