The UpdateMeshBuffer Method is important for updating GPU mesh data repeatedly in a performant manner.
This pull request intends to add a safe utility version of this method by accepting a span wrapper of the data rather than a pointer.
This method (including the interop version) requires an index to whichever buffer the user wishes to update—for example vertices, texture coordinates, colors etcetera. This is why I added VboIdIndex constants to the mesh class to help users access the right vertex buffer object (VBO) ID for the UpdateMeshBuffer Method.
For whatever reason raysan5/raylib does not include an enum or definitions for these VBO indexes. The closest thing I could find to these indexes being defined anywhere was in the raylib source code in UploadMesh.
I also added an example showing a good use case for the safe UpdateMeshBuffer Method and the VBO definitions.
Here is what you should expect from the example program:
The UpdateMeshBuffer Method is important for updating GPU mesh data repeatedly in a performant manner.
This pull request intends to add a safe utility version of this method by accepting a span wrapper of the data rather than a pointer.
This method (including the interop version) requires an index to whichever buffer the user wishes to update—for example vertices, texture coordinates, colors etcetera. This is why I added VboIdIndex constants to the mesh class to help users access the right vertex buffer object (VBO) ID for the UpdateMeshBuffer Method.
For whatever reason raysan5/raylib does not include an enum or definitions for these VBO indexes. The closest thing I could find to these indexes being defined anywhere was in the raylib source code in UploadMesh.
I also added an example showing a good use case for the safe UpdateMeshBuffer Method and the VBO definitions. Here is what you should expect from the example program: