highfidelity/hifi — pull request #3778 by samcake (2014-11-12 08:56:07+00:00)
Title: Introduce the Transform class and use it in the gpu api and for rendering models

- add the Transform class files in the Shared library. mostly inspired by Andrezj design, this is encapsulating the standard translation, rotation and scale of a rigid/uniform/nonuniform transformation matrix represented by a glm::mat4. the class manage a hidden cache Mat4. We will be able to improve on this and support projection matrix in the near future.

-- THe accuracy of transform composition is not necessarily better with this object now but we will be able to improve on the accuracy of transform stacks inside the class while preserving simple float vec and quat parameters for the interface... this is definitely a TODO.

- add a Transform stage to the gpu::Batch interface that can take a projection, view and model Transform. This will do the right thing for rendering the shape at the MVP matrix defined just like in fixed pipeline of OpenGL. When we will switch to non fixed piepeline we will be able to make these transform matrices available to the shaders through generic uniforms.

- Introduce a "viewTransform" to the application in order to mimic the current "untranslatedViewMatrix" and use it for rendering the models. With this change, the models don't use the glMatrix calls anymore but instead the new Transform stage of the gpu::Batch

- Performance wise this last change doesn't change things much. we definitely still do a lot extra works while creating the gpu::batch creating new Transform for each entities. One of the goal of this work is also to be soon able to replay the same batch several times just changing the viewTransform upfront and avoid redoing the traversal for several frames, to be continued....