add suzanne

This commit is contained in:
Quaternions 2023-09-01 14:22:12 -07:00
parent ce5f6fceb9
commit ba2bab562f
2 changed files with 2614 additions and 32 deletions

2580
models/suzanne.obj Normal file

File diff suppressed because it is too large Load Diff

View File

@ -143,22 +143,7 @@ impl Skybox {
}
}
impl strafe_client::framework::Example for Skybox {
fn optional_features() -> wgpu::Features {
wgpu::Features::TEXTURE_COMPRESSION_ASTC
| wgpu::Features::TEXTURE_COMPRESSION_ETC2
| wgpu::Features::TEXTURE_COMPRESSION_BC
}
fn init(
config: &wgpu::SurfaceConfiguration,
_adapter: &wgpu::Adapter,
device: &wgpu::Device,
queue: &wgpu::Queue,
) -> Self {
let mut entities = Vec::new();
{
let source = include_bytes!("../models/teslacyberv3.0.obj");
fn add_obj(device:&wgpu::Device,entities:& mut Vec<Entity>,source:&[u8]){
let data = obj::ObjData::load_buf(&source[..]).unwrap();
let mut vertices = Vec::new();
for object in data.objects {
@ -187,8 +172,25 @@ impl strafe_client::framework::Example for Skybox {
});
}
}
}
impl strafe_client::framework::Example for Skybox {
fn optional_features() -> wgpu::Features {
wgpu::Features::TEXTURE_COMPRESSION_ASTC
| wgpu::Features::TEXTURE_COMPRESSION_ETC2
| wgpu::Features::TEXTURE_COMPRESSION_BC
}
fn init(
config: &wgpu::SurfaceConfiguration,
_adapter: &wgpu::Adapter,
device: &wgpu::Device,
queue: &wgpu::Queue,
) -> Self {
let mut entities = Vec::<Entity>::new();
add_obj(device,& mut entities,include_bytes!("../models/teslacyberv3.0.obj"));
add_obj(device,& mut entities,include_bytes!("../models/suzanne.obj"));
let bind_group_layout = device.create_bind_group_layout(&wgpu::BindGroupLayoutDescriptor {
label: None,
entries: &[