rvandoosselaer / Blocks

A block (voxel) engine for jMonkeyEngine
BSD 3-Clause "New" or "Revised" License
42 stars 14 forks source link

Precompute the Quaternions #64

Closed vxel closed 2 years ago

vxel commented 2 years ago

This is an optimization proposition. Quaternions are heavily used during mesh generation and are costly to create and to compute. This PR uses pre-computed quaternions for the most used operations.

Warning : this somewhat breaks the backward compatibility since the same Quaternion objects are used, requiring shapes to clone them when needed (and not using e.g. xxxLocal() operations ! See impact on existing shapes. If unacceptable, we will need to clone() each quaternion returned.