ignore external props for now

This commit is contained in:
Quaternions 2024-01-09 16:49:08 -08:00
parent f2bd9152d2
commit be7abc7df0

View File

@ -180,15 +180,14 @@ pub fn generate_indexed_models<R:std::io::Read+std::io::Seek>(input:&mut R)->Res
//generate model instances //generate model instances
for prop in bsp.static_props(){ for prop in bsp.static_props(){
let placement=prop.as_prop_placement(); let placement=prop.as_prop_placement();
let model=prop_models.get_mut(model_map[placement.model]).unwrap(); if let Some(&model_index)=model_map.get(placement.model){
model.instances.push(crate::model::ModelInstance{ prop_models[model_index].instances.push(crate::model::ModelInstance{
transform:crate::integer::Planar64Affine3::new( transform:crate::integer::Planar64Affine3::new(
crate::integer::Planar64Mat3::try_from( crate::integer::Planar64Mat3::try_from(
glam::Mat3A::from_diagonal(glam::Vec3::splat(placement.scale)) glam::Mat3A::from_diagonal(glam::Vec3::splat(placement.scale))
*glam::Mat3A::from_quat( *glam::Mat3A::from_quat(
//TODO: does rotation need valve transform? //TODO: does rotation need valve transform?
glam::Quat::from_xyzw(placement.rotation.v.x,placement.rotation.v.y,placement.rotation.v.z,placement.rotation.s), glam::Quat::from_xyzw(placement.rotation.v.x,placement.rotation.v.y,placement.rotation.v.z,placement.rotation.s),
) )
).unwrap(), ).unwrap(),
valve_transform(<[f32;3]>::from(placement.origin)), valve_transform(<[f32;3]>::from(placement.origin)),
@ -196,6 +195,9 @@ pub fn generate_indexed_models<R:std::io::Read+std::io::Seek>(input:&mut R)->Res
attributes:crate::model::CollisionAttributes::Decoration, attributes:crate::model::CollisionAttributes::Decoration,
..Default::default() ..Default::default()
}); });
}else{
println!("model not found {}",placement.model);
}
} }
//actually add the prop models //actually add the prop models