forked from StrafesNET/strafe-client
use instanced rendering
This commit is contained in:
parent
f7e48be228
commit
4388f66995
51
src/main.rs
51
src/main.rs
@ -201,24 +201,8 @@ impl strafe_client::framework::Example for GraphicsData {
|
|||||||
modeldatas[2].transforms[0]=glam::Mat4::from_translation(glam::vec3(-10.,5.,10.));
|
modeldatas[2].transforms[0]=glam::Mat4::from_translation(glam::vec3(-10.,5.,10.));
|
||||||
modeldatas[3].transforms[0]=glam::Mat4::from_translation(glam::vec3(0.,0.,0.))*glam::Mat4::from_scale(glam::vec3(160.0, 1.0, 160.0));
|
modeldatas[3].transforms[0]=glam::Mat4::from_translation(glam::vec3(0.,0.,0.))*glam::Mat4::from_scale(glam::vec3(160.0, 1.0, 160.0));
|
||||||
|
|
||||||
let input = std::io::BufReader::new(&include_bytes!("../maps/bhop_easyhop.rbxm")[..]);
|
|
||||||
match strafe_client::load_roblox::get_objects(input, "BasePart") {
|
|
||||||
Ok(objects)=>{
|
|
||||||
for object in objects.iter() {
|
|
||||||
if let (
|
|
||||||
Some(rbx_dom_weak::types::Variant::CFrame(cf)),
|
|
||||||
Some(rbx_dom_weak::types::Variant::Vector3(size)),
|
|
||||||
Some(rbx_dom_weak::types::Variant::Float32(transparency)),
|
|
||||||
) = (
|
|
||||||
object.properties.get("CFrame"),
|
|
||||||
object.properties.get("Size"),
|
|
||||||
object.properties.get("Transparency"),
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if *transparency==1.0 {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
//simply draw a box
|
//simply draw a box
|
||||||
|
{
|
||||||
let face_data = [
|
let face_data = [
|
||||||
[0.0f32, 0., 1.],
|
[0.0f32, 0., 1.],
|
||||||
[0.0f32, 0., -1.],
|
[0.0f32, 0., -1.],
|
||||||
@ -304,7 +288,31 @@ impl strafe_client::framework::Example for GraphicsData {
|
|||||||
usage: wgpu::BufferUsages::VERTEX,
|
usage: wgpu::BufferUsages::VERTEX,
|
||||||
});
|
});
|
||||||
modeldatas.push(ModelData {
|
modeldatas.push(ModelData {
|
||||||
transform: glam::Mat4::from_translation(
|
transforms: Vec::new(),
|
||||||
|
vertex_buf,
|
||||||
|
entities,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let input = std::io::BufReader::new(&include_bytes!("../maps/bhop_easyhop.rbxm")[..]);
|
||||||
|
match strafe_client::load_roblox::get_objects(input, "BasePart") {
|
||||||
|
Ok(objects)=>{
|
||||||
|
for object in objects.iter() {
|
||||||
|
if let (
|
||||||
|
Some(rbx_dom_weak::types::Variant::CFrame(cf)),
|
||||||
|
Some(rbx_dom_weak::types::Variant::Vector3(size)),
|
||||||
|
Some(rbx_dom_weak::types::Variant::Float32(transparency)),
|
||||||
|
) = (
|
||||||
|
object.properties.get("CFrame"),
|
||||||
|
object.properties.get("Size"),
|
||||||
|
object.properties.get("Transparency"),
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if *transparency==1.0 {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
modeldatas[4].transforms.push(
|
||||||
|
glam::Mat4::from_translation(
|
||||||
glam::Vec3::new(cf.position.x,cf.position.y,cf.position.z)
|
glam::Vec3::new(cf.position.x,cf.position.y,cf.position.z)
|
||||||
)
|
)
|
||||||
* glam::Mat4::from_mat3(
|
* glam::Mat4::from_mat3(
|
||||||
@ -316,17 +324,14 @@ impl strafe_client::framework::Example for GraphicsData {
|
|||||||
)
|
)
|
||||||
* glam::Mat4::from_scale(
|
* glam::Mat4::from_scale(
|
||||||
glam::Vec3::new(size.x,size.y,size.z)/2.0
|
glam::Vec3::new(size.x,size.y,size.z)/2.0
|
||||||
),
|
)
|
||||||
vertex_buf,
|
)
|
||||||
entities,
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => println!("lmao err {:?}", e),
|
Err(e) => println!("lmao err {:?}", e),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
let camera_bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
let camera_bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
|
||||||
label: None,
|
label: None,
|
||||||
entries: &[
|
entries: &[
|
||||||
|
Loading…
Reference in New Issue
Block a user