From 0b210eac5dd2afd356b1e510e27383464cdb32ed Mon Sep 17 00:00:00 2001 From: griffi-gh Date: Thu, 23 Nov 2023 11:43:48 +0100 Subject: [PATCH] use immut. buffers for primitives --- kubi-ui/examples/test.rs | 2 +- kubi/src/rendering/primitives/cube.rs | 12 ++++++------ kubi/src/rendering/primitives/rect.rs | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/kubi-ui/examples/test.rs b/kubi-ui/examples/test.rs index 7c7fe19..83d4fb9 100644 --- a/kubi-ui/examples/test.rs +++ b/kubi-ui/examples/test.rs @@ -51,7 +51,7 @@ fn main() { gap: 1., elements: { let mut elements: Vec> = vec![]; - for i in 0..100 { + for i in 0..10000 { elements.push(Box::new(ProgressBar { value: (instant.elapsed().as_secs_f32() + (i as f32 / 10.)).sin().powi(2), size: (UiSize::Auto, UiSize::Pixels(5.)), diff --git a/kubi/src/rendering/primitives/cube.rs b/kubi/src/rendering/primitives/cube.rs index 297dcb1..20f8616 100644 --- a/kubi/src/rendering/primitives/cube.rs +++ b/kubi/src/rendering/primitives/cube.rs @@ -59,25 +59,25 @@ pub(super) fn init_cube_primitive( display: NonSendSync> ) { { - let vert = VertexBuffer::new( + let vert = VertexBuffer::immutable( &display.display, CUBE_VERTICES ).unwrap(); - let index = IndexBuffer::new( + let index = IndexBuffer::immutable( &display.display, - PrimitiveType::TrianglesList, + PrimitiveType::TrianglesList, CUBE_INDICES ).unwrap(); storages.add_unique_non_send_sync(CubePrimitive(vert, index)); } { - let vert = VertexBuffer::new( + let vert = VertexBuffer::immutable( &display.display, CENTERED_CUBE_VERTICES ).unwrap(); - let index = IndexBuffer::new( + let index = IndexBuffer::immutable( &display.display, - PrimitiveType::TrianglesList, + PrimitiveType::TrianglesList, CUBE_INDICES ).unwrap(); storages.add_unique_non_send_sync(CenteredCubePrimitive(vert, index)); diff --git a/kubi/src/rendering/primitives/rect.rs b/kubi/src/rendering/primitives/rect.rs index 0215d14..3a30575 100644 --- a/kubi/src/rendering/primitives/rect.rs +++ b/kubi/src/rendering/primitives/rect.rs @@ -18,13 +18,13 @@ pub(super) fn init_rect_primitive( storages: AllStoragesView, display: NonSendSync> ) { - let vert = VertexBuffer::new( + let vert = VertexBuffer::immutable( &display.display, RECT_VERTEX ).unwrap(); - let index = IndexBuffer::new( + let index = IndexBuffer::immutable( &display.display, - PrimitiveType::TrianglesList, + PrimitiveType::TrianglesList, RECT_INDEX ).unwrap(); storages.add_unique_non_send_sync(RectPrimitive(vert, index));