apeltsi / loitsu

Cross-platform Game Engine written in Rust
MIT License
1 stars 0 forks source link

Automatic Instancing #26

Open apeltsi opened 9 months ago

apeltsi commented 9 months ago

Drawables could specify if they're instanciable. The engine could then sort drawables by some unique identifier. For a sprite renderer this could be the the sprite, so that loitsu automatically creates a instance group for the same type of sprite.

Implementation notes: Sprite change: Imagine that a sprite drawable gets a request to change. This should be handled properly, as this would lead to the sprite getting removed from the instance group and potentially joining another instance group

We could just make every instanciable drawable into a instance drawcall. This way we have one drawcall per type of sprite, and then just count how many of each type. So the sprite drawable wouldn't even have an implementation for rendering a sprite using a normal drawcall.