Thanks to visit codestin.com
Credit goes to github.com

Skip to content

How do I update slice of VertexBuffer? #2149

@TymekBrunka

Description

@TymekBrunka

for both VertexBuffer<T> and VertexBufferSlice<T>, T is Sized type and method write() takes &self and data: &T;
That means that you are able to modify only 1 T at a time with this method.

Another way would be to use map() method and then for result of that method use deref_mut() but it returns &mut T, so you can modify only 1 T at a thime with this method.

So the only solution is to in loop, make slice (VertexBufferSlice) of size of 1 T from VertexBuffer for each vertex I want to modify and write() to it, right?
No more convinient ways to do that?

btw how do i add tags?
#question

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions