Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
0fbac15828 |
@ -1,2 +0,0 @@
|
||||
[registries.strafesnet]
|
||||
index = "sparse+https://git.itzana.me/api/packages/strafesnet/cargo/"
|
1445
Cargo.lock
generated
1445
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
26
Cargo.toml
26
Cargo.toml
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "map-tool"
|
||||
version = "1.5.7"
|
||||
version = "1.4.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
@ -9,22 +9,18 @@ edition = "2021"
|
||||
anyhow = "1.0.75"
|
||||
clap = { version = "4.4.2", features = ["derive"] }
|
||||
flate2 = "1.0.27"
|
||||
image = "0.25.2"
|
||||
image_dds = "0.6.0"
|
||||
image = "0.24.7"
|
||||
image_dds = "0.1.1"
|
||||
lazy-regex = "3.1.0"
|
||||
rbx_binary = { version = "0.7.4", registry = "strafesnet" }
|
||||
rbx_dom_weak = { version = "2.7.0", registry = "strafesnet" }
|
||||
rbx_reflection_database = { version = "0.2.10", registry = "strafesnet" }
|
||||
rbx_xml = { version = "0.13.3", registry = "strafesnet" }
|
||||
strafesnet_bsp_loader = { version = "0.2.1", registry = "strafesnet" }
|
||||
strafesnet_deferred_loader = { version = "0.4.0", features = ["legacy"], registry = "strafesnet" }
|
||||
strafesnet_rbx_loader = { version = "0.5.1", registry = "strafesnet" }
|
||||
strafesnet_snf = { version = "0.2.0", registry = "strafesnet" }
|
||||
vbsp = "0.6.0"
|
||||
vmdl = "0.2.0"
|
||||
vmt-parser = "0.2.0"
|
||||
rbx_binary = "0.7.1"
|
||||
rbx_dom_weak = "2.5.0"
|
||||
rbx_reflection_database = "0.2.7"
|
||||
rbx_xml = "0.13.1"
|
||||
vbsp = "0.5.0"
|
||||
vmdl = "0.1.1"
|
||||
vmt-parser = "0.1.1"
|
||||
vpk = "0.2.0"
|
||||
vtf = "0.3.0"
|
||||
vtf = "0.2.1"
|
||||
|
||||
#[profile.release]
|
||||
#lto = true
|
||||
|
1135
src/main.rs
1135
src/main.rs
File diff suppressed because it is too large
Load Diff
41
src/obj.rs
Normal file
41
src/obj.rs
Normal file
@ -0,0 +1,41 @@
|
||||
|
||||
pub fn generate_indexed_model_list_from_obj(data:obj::ObjData,color:Color4)->Vec<IndexedModel>{
|
||||
let mut unique_vertex_index = std::collections::HashMap::<obj::IndexTuple,u32>::new();
|
||||
return data.objects.iter().map(|object|{
|
||||
unique_vertex_index.clear();
|
||||
let mut unique_vertices = Vec::new();
|
||||
let groups = object.groups.iter().map(|group|{
|
||||
IndexedGroup{
|
||||
texture:None,
|
||||
polys:group.polys.iter().map(|poly|{
|
||||
IndexedPolygon{
|
||||
vertices:poly.0.iter().map(|&tup|{
|
||||
if let Some(&i)=unique_vertex_index.get(&tup){
|
||||
i
|
||||
}else{
|
||||
let i=unique_vertices.len() as u32;
|
||||
unique_vertices.push(IndexedVertex{
|
||||
pos: tup.0 as u32,
|
||||
tex: tup.1.unwrap() as u32,
|
||||
normal: tup.2.unwrap() as u32,
|
||||
color: 0,
|
||||
});
|
||||
unique_vertex_index.insert(tup,i);
|
||||
i
|
||||
}
|
||||
}).collect()
|
||||
}
|
||||
}).collect()
|
||||
}
|
||||
}).collect();
|
||||
IndexedModel{
|
||||
unique_pos: data.position.iter().map(|&v|Planar64Vec3::try_from(v).unwrap()).collect(),
|
||||
unique_tex: data.texture.iter().map(|&v|TextureCoordinate::from_array(v)).collect(),
|
||||
unique_normal: data.normal.iter().map(|&v|Planar64Vec3::try_from(v).unwrap()).collect(),
|
||||
unique_color: vec![color],
|
||||
unique_vertices,
|
||||
groups,
|
||||
instances:Vec::new(),
|
||||
}
|
||||
}).collect()
|
||||
}
|
Loading…
Reference in New Issue
Block a user