Veykril / cubism-rs

A rust wrapper around the Live2D Cubism SDK with extra functionality
Apache License 2.0
39 stars 10 forks source link

general renderer api #9

Open Veykril opened 5 years ago

Veykril commented 5 years ago

The current api of the (two) implemented renderers has been made quite hastily and I'm uncertain whether these are good enough or if they can be improved.

In general it seems best to have one renderer per moc(all models that use the same moc) since these always have the same drawable count meaning there is no need to recreate a vertex buffer then. Even better, the index buffer only has to be uploaded once since the index data is static(this is now implemented in the glium renderer. It creates the index buffers once for a given moc and then only allows rendering models from the same moc).

This can probably be enforced by checking the underlying moc, for example by cloning the Arc into the renderer and then comparing.

It's probably best to have one renderer per model after all so that the renderer can cache the vertexbuffers if necessary by making use of the DynamicFlags::VERTEX_POSITIONS_CHANGED flags.