snogglethorpe / snogray

Snogray renderer

Home Page:http://www.nongnu.org/snogray

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add PBRT-style cached transform inverses

snogglethorpe opened this issue · comments

PBRT cleverly makes a transform actually contain its own inverse, which is more efficient if you take the inverse often, which may in fact be the case when transposing a lot of normals.

Moreover, it does this using pointers, so the "matrix.inverse()" method actually just returns a new transform with the pointers swapped.

We could do this by making the Xform (and XformBase) classes actually indirectly refer to underlying Matrix4 objects for the main transform matrix and its inverse... (ref-counted? std::shared_ptr?)