I can have a potentially very large number of mesh instances (the mesh being a 3d hex tile) in my viewport at one time - potentially 64 by 64 by 64...
As it turns out, when there is that many instances (I'm always trying to test for worst case) one of the biggest bottlenecks was actually going through and extracting the transform for 200,000 tiles - what I was doing at first was building a std::vector of transforms every frame and using glBufferData passing a pointer to that std::vector - this was terribly slow and did not work at all
So then I changed it and made a std::vector of transforms where each hex tile instance contained a reference to a transform in the std::vector - when a tile was moved it would change its transform directly through the reference - I then used a dirty flag and only rebuilt the transformBuffer when a tile was added or deleted from the map
This worked fairly well but was messy and made it hard for me to implement any kind of culling - I'm okay with only rebuilding the transform buffer when a new tile is added or one is deleted from the map, but I don't like it that when the user is moving a tile around they are directly manipulating the tile's transform... which leads me to my question
Is it really feasible to run through 200,000 tile instances (considering a tile instance is basically a small struct containing a pointer to a HexTile and some other things like a 4dmatrix reference), check if the tile needs to be updated, and if it does then update the transform as needed?
The main problem I have with the user directly manipulating the tile's transform is that it puts the Input System in charge of things it seems like it shouldn't be in charge of... IE the input system is calling tileInstance.move(x,y,z) which directly changes the tileInstance's transform.. I don't really know why but that seems bad