Mokosha/Lambency

Create more generalized transforms.

Mokosha opened this issue · 0 comments

Currently, the Transform type exposed to the user is what I'll call a TRS transform. In other words, it's only a scale, rotation, and translation, in that order. This means it's not really possible to, e.g., rotate an object about a point. All rotations are done relative to the origin in that object's object space.

Internally, the rendering engine only really cares about Mat4fs, so however those get generated doesn't really matter. This means that we can have lower-level transforms that can stack translations, rotations, and scales one on top of the other, similar to how the old glPushMatrix calls worked. These would then flatten to the appropriate matrix at rendering time.

The changes that are needed (off the top of my head) are:

  • Create new TRS datatype that replaces the current Transform datatype
  • Create new Transform datatype that acts as a stack of simple transforms
  • Instance Transformable3D for new Transform datatype
  • Change RenderContext to use Mat4f instead of Transform in Render.hs.
  • Change type of addTransformedRenderAction to parameterize over Transformable3D to use both types of transforms.