rendering, physics, player and camera WIP

This commit is contained in:
Jonas H
2026-01-01 19:54:00 +01:00
commit 5d2eca0393
51 changed files with 8734 additions and 0 deletions

71
src/draw.rs Normal file
View File

@@ -0,0 +1,71 @@
use std::collections::HashMap;
use std::rc::Rc;
use crate::entity::EntityHandle;
use crate::mesh::Mesh;
use crate::render::{DrawCall, Pipeline};
pub type DrawHandle = usize;
struct DrawEntry
{
mesh: Rc<Mesh>,
entity: EntityHandle,
pipeline: Pipeline,
}
pub struct DrawManager
{
entries: HashMap<DrawHandle, DrawEntry>,
next_handle: DrawHandle,
}
impl DrawManager
{
pub fn new() -> Self
{
Self {
entries: HashMap::new(),
next_handle: 0,
}
}
pub fn draw_mesh_internal(
&mut self,
mesh: Rc<Mesh>,
entity: EntityHandle,
pipeline: Pipeline,
) -> DrawHandle
{
let handle = self.next_handle;
self.next_handle += 1;
self.entries.insert(
handle,
DrawEntry {
mesh,
entity,
pipeline,
},
);
handle
}
pub fn clear_mesh_internal(&mut self, handle: DrawHandle)
{
self.entries.remove(&handle);
}
pub fn collect_draw_calls(&self) -> Vec<DrawCall>
{
vec![]
}
pub fn draw_mesh(_mesh: Rc<Mesh>, _entity: EntityHandle, _pipeline: Pipeline) -> DrawHandle
{
0
}
pub fn clear_mesh(_handle: DrawHandle) {}
}