Open john-chapman opened 6 years ago
I was wondering if there have been any updates or progress made since?
I've not really looked into this since the issue was created, but I think it would be quite simple to implement an initial version. Updated thoughts:
The main goal here would be to provide an API allowing the user to avoid the overhead of making lots of Im3d calls. User code would look like this:
if (Im3d::BeginCache("BigScene")) // If false, we skip Im3d calls below and use the cached vertex data directly.
{
// ... lots of Im3d calls here.
Im3d::EndCache(); // Cache the vertex data we just created.
}
Internally, cached vertex data would follow the structure of m_vertexData
(= one list per layer, per primitive * 2 for sorted/unsorted). This way, the cache can be copied into m_vertexData
such that sorting/layering still works. There would also be an InvalidateCache(id)
function.
The approach outlined above has a couple of caveats:
Transform modification:
Nested caches:
BeginCache(_id);
,EndCache()
,DrawCache(_id)
(but with better names).