Mesh-visualizer: uncomment and update to the new serializing format
Hi @chinedufn: Awesome work. Thank you for sharing the water demo and the deserializer. I got well impressed with the water demo and could reproduce it (Blender 2.7).
Problem: I would like to upload my own Blender 2.8 files. So trying to make mesh-visualizer work but it is pretty hard for me (noob: never heard of multi-index) If someone manage to do it before me, I would be pretty glad.
Solution: Very little changes seems required: getting data from a subobject (positions.attribute.data).
Like in mesh-visualizer/src/render/mod.rs
GpuBufferer::buffer_f32_data(&gl, &mesh.multi_indexed_vertex_attributes.positions.attribute.data as &[f32], pos_attrib as u32, 3);
GpuBufferer::buffer_u16_indices(&gl, &mesh.multi_indexed_vertex_attributes.positions.indices as &[u16]);
Reason: It is difficult to count, get the good order, well do the good thing. That is why a deserializer helps a lot to use a serializer (one could even load a class mesh-visualizer in its code and use some nice object forgetting the 1d array nightmare)
Hey there.
So the multi vs. single concept is a bit confusing and I plan to re-work it at some point.
For now though, I'll explain.
Multi indexed just means that instead of repeating the same position, normal and uv data we use a position index, normal index and uv index to point to the data so that if we need to use the second vertex normal 10 times we can just say "use vertex normal number 2 10 times". Same idea for positions and uvs.
Modern graphics APIs have no notion of this though. You can't have three different indices. You can only have one.
So instead of saying "Hey use vertex normal number 2 ten different times". You instead just have to duplicate that data ten times.
It looks like you started trying to use some of the more recent blender-mesh APIs.
Buffering the multi indexed vertex attributes won't work for the reasons mentioned above.
Instead you want to first call blender_mesh.combine_vertex_indices and then buffer that vertex data.
Please let me know if that works for you or if there is any other way that I can help.
Anyway I can find no working renderind example for combined index. It would look nice if it could convert SingleIndexedVertexAttributes to &[f32] arrays to pass to GL array buffer ))
Hey.
I use landon in my engine to render using a single vertex buffer, but I'm not sure that there's a working example of using a single vertex buffer from blender-mesh floating around..
I'm not sure when I'll get around to writing one.
If it helps at all (apologies for not having a working example for you), it should be no different from how you'd render using an interleaved vertex buffer anywhere else. Create a vertex buffer on the GPU and set up your vertex attributes with the proper stride.
Actually it should probably be renamed from SingleIndexedVertexAttributes to InterleavedVertexBuffer ...