forked from StrafesNET/map-tool
Compare commits
29 Commits
obj
...
feature/ex
Author | SHA1 | Date | |
---|---|---|---|
bd94520ef4 | |||
ae19448ee8 | |||
4907362c71 | |||
43b756bf8e | |||
360e76177b | |||
f17a1a86a9 | |||
590062f3c3 | |||
cc4e80db8a | |||
8c0f46007f | |||
48d3fca895 | |||
e833d4c032 | |||
8bd0765290 | |||
894584f855 | |||
0e1b9494c2 | |||
7b1b381064 | |||
91f452a94b | |||
eeac376500 | |||
d1b52b4367 | |||
ae5a451159 | |||
02310c5653 | |||
f55f9c1d55 | |||
b561ffdfc6 | |||
6606d3be51 | |||
f639047980 | |||
9e30f5dca7 | |||
8b7f034f50 | |||
7c1ecbf6da | |||
540f5253d6 | |||
e8c73bbd95 |
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -778,7 +778,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "map-tool"
|
||||
version = "1.4.0"
|
||||
version = "1.3.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"clap",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "map-tool"
|
||||
version = "1.4.0"
|
||||
version = "1.3.0"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
28
LICENSE
28
LICENSE
@ -1,23 +1,9 @@
|
||||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
MIT License
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
Copyright (c) 2023 StrafesNET Map Tool Developers
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
@ -665,14 +665,9 @@ fn replace() -> AResult<()>{
|
||||
println!("One or more scripts failed to replace.");
|
||||
}else{
|
||||
let mut dest=std::path::PathBuf::from("maps/unprocessed");
|
||||
dest.push(file_thing.file_name());
|
||||
dest.set_file_name(file_thing.file_name());
|
||||
let output = std::io::BufWriter::new(std::fs::File::open(dest)?);
|
||||
//write workspace:GetChildren()[1]
|
||||
let workspace_children=dom.root().children();
|
||||
if workspace_children.len()!=1{
|
||||
return Err(anyhow::Error::msg("there can only be one model"));
|
||||
}
|
||||
rbx_binary::to_writer(output, &dom, &[workspace_children[0]])?;
|
||||
rbx_binary::to_writer(output, &dom, &[dom.root_ref()])?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
41
src/obj.rs
41
src/obj.rs
@ -1,41 +0,0 @@
|
||||
|
||||
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()
|
||||
}
|
Reference in New Issue
Block a user