Browse Source

closer???????????

master
Alison Watson 4 months ago
parent
commit
a35e788160
1 changed files with 10 additions and 10 deletions
  1. +10
    -10
      source/framework/render/model.rs

+ 10
- 10
source/framework/render/model.rs View File

@@ -13,14 +13,14 @@ pub enum ErrModelDraw {
}

pub struct Model {
vert_buf: Rc<Buffer>,
indx_buf: Rc<Buffer>,
vtx_buf: Rc<Buffer>,
idx_buf: Rc<Buffer>,
model: data::model::Model,
}

impl GetDevice for Model {
fn get_device(&self) -> &Rc<Device> {
self.vert_buf.get_device()
self.vtx_buf.get_device()
}
}

@@ -30,10 +30,10 @@ impl Model {
model: data::model::Model,
model_data: data::model::ModelData,
) -> Result<Rc<Self>, ErrAllocMem> {
let vert_buf = Buffer::create_vert(cmd_pool, &model_data.vtx)?;
let indx_buf = Buffer::create_indx(cmd_pool, &model_data.idx)?;
let vtx_buf = Buffer::create_vert(cmd_pool, &model_data.vtx)?;
let idx_buf = Buffer::create_indx(cmd_pool, &model_data.idx)?;

Ok(Rc::new(Self { vert_buf, indx_buf, model }))
Ok(Rc::new(Self { vtx_buf, idx_buf, model }))
}

pub fn draw(
@@ -46,13 +46,13 @@ impl Model {
self.get_device().cmd_bind_vertex_buffers(
buf,
0,
&[**self.vert_buf],
&[**self.vtx_buf],
&[0],
);

self.get_device().cmd_bind_index_buffer(
buf,
**self.indx_buf,
**self.idx_buf,
0,
vk::IndexType::UINT32,
);
@@ -64,8 +64,8 @@ impl Model {
buf,
mesh.idx_len() as u32,
1,
mesh.vtx_beg() as u32,
mesh.idx_beg() as i32,
0,
mesh.vtx_beg() as i32,
0,
);
}


Loading…
Cancel
Save