asny / three-d

2D/3D renderer - makes it simple to draw stuff across platforms (including web)
MIT License
1.33k stars 110 forks source link

Any plans to support custom buffer element types for interleaved data? #447

Closed zdimension closed 9 months ago

zdimension commented 9 months ago

Glium allows doing this:

#[derive(Copy, Clone)]
pub struct Vertex
{
    pub position: Point,
    pub color: Color3f,
}

implement_vertex!(Vertex, position, color);

Currently, three-d only supports vertex buffers with elements of primitive types (buffer of float, buffer of int, ...). Any kind of composite-type element requires creating multiple buffers, one per attribute. Interleaved data is usually better performance-wise. Are there any plans on supporting that? Currently, the DataType trait is private anyways.

asny commented 9 months ago

No there's no plan to support that. Interleaved data is a legacy thing, at least I have never seen the interleaved data make a difference. Probably modern hardware/OpenGL implementations can do this optimisation, so no need for you to do that manually, just create a buffer for each vertex attribute 🙂