mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-26 05:38:20 -06:00
use immut. buffers for primitives
This commit is contained in:
parent
e78400ae82
commit
3231a292ad
|
@ -51,7 +51,7 @@ fn main() {
|
||||||
gap: 1.,
|
gap: 1.,
|
||||||
elements: {
|
elements: {
|
||||||
let mut elements: Vec<Box<dyn UiElement>> = vec![];
|
let mut elements: Vec<Box<dyn UiElement>> = vec![];
|
||||||
for i in 0..100 {
|
for i in 0..10000 {
|
||||||
elements.push(Box::new(ProgressBar {
|
elements.push(Box::new(ProgressBar {
|
||||||
value: (instant.elapsed().as_secs_f32() + (i as f32 / 10.)).sin().powi(2),
|
value: (instant.elapsed().as_secs_f32() + (i as f32 / 10.)).sin().powi(2),
|
||||||
size: (UiSize::Auto, UiSize::Pixels(5.)),
|
size: (UiSize::Auto, UiSize::Pixels(5.)),
|
||||||
|
|
|
@ -59,25 +59,25 @@ pub(super) fn init_cube_primitive(
|
||||||
display: NonSendSync<UniqueView<Renderer>>
|
display: NonSendSync<UniqueView<Renderer>>
|
||||||
) {
|
) {
|
||||||
{
|
{
|
||||||
let vert = VertexBuffer::new(
|
let vert = VertexBuffer::immutable(
|
||||||
&display.display,
|
&display.display,
|
||||||
CUBE_VERTICES
|
CUBE_VERTICES
|
||||||
).unwrap();
|
).unwrap();
|
||||||
let index = IndexBuffer::new(
|
let index = IndexBuffer::immutable(
|
||||||
&display.display,
|
&display.display,
|
||||||
PrimitiveType::TrianglesList,
|
PrimitiveType::TrianglesList,
|
||||||
CUBE_INDICES
|
CUBE_INDICES
|
||||||
).unwrap();
|
).unwrap();
|
||||||
storages.add_unique_non_send_sync(CubePrimitive(vert, index));
|
storages.add_unique_non_send_sync(CubePrimitive(vert, index));
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
let vert = VertexBuffer::new(
|
let vert = VertexBuffer::immutable(
|
||||||
&display.display,
|
&display.display,
|
||||||
CENTERED_CUBE_VERTICES
|
CENTERED_CUBE_VERTICES
|
||||||
).unwrap();
|
).unwrap();
|
||||||
let index = IndexBuffer::new(
|
let index = IndexBuffer::immutable(
|
||||||
&display.display,
|
&display.display,
|
||||||
PrimitiveType::TrianglesList,
|
PrimitiveType::TrianglesList,
|
||||||
CUBE_INDICES
|
CUBE_INDICES
|
||||||
).unwrap();
|
).unwrap();
|
||||||
storages.add_unique_non_send_sync(CenteredCubePrimitive(vert, index));
|
storages.add_unique_non_send_sync(CenteredCubePrimitive(vert, index));
|
||||||
|
|
|
@ -18,13 +18,13 @@ pub(super) fn init_rect_primitive(
|
||||||
storages: AllStoragesView,
|
storages: AllStoragesView,
|
||||||
display: NonSendSync<UniqueView<Renderer>>
|
display: NonSendSync<UniqueView<Renderer>>
|
||||||
) {
|
) {
|
||||||
let vert = VertexBuffer::new(
|
let vert = VertexBuffer::immutable(
|
||||||
&display.display,
|
&display.display,
|
||||||
RECT_VERTEX
|
RECT_VERTEX
|
||||||
).unwrap();
|
).unwrap();
|
||||||
let index = IndexBuffer::new(
|
let index = IndexBuffer::immutable(
|
||||||
&display.display,
|
&display.display,
|
||||||
PrimitiveType::TrianglesList,
|
PrimitiveType::TrianglesList,
|
||||||
RECT_INDEX
|
RECT_INDEX
|
||||||
).unwrap();
|
).unwrap();
|
||||||
storages.add_unique_non_send_sync(RectPrimitive(vert, index));
|
storages.add_unique_non_send_sync(RectPrimitive(vert, index));
|
||||||
|
|
Loading…
Reference in a new issue