DarkRadiant: master be2a97a3

Author Committer Branch Timestamp Parent
Matthew Mott Matthew Mott master 26.09.2021 19:22 master eab2c3e4
Changeset Separate const and modifying Matrix4 column accessors

Distinguish the methods which return a modifiable reference to columns by
appending 'Ref' to the method name, i.e. xCol3Ref(), tColRef() etc. Calling
code is updated to use these versions where a reference is *required*, either
because it is assigned to as an lvalue or returned by const reference to a
higher-level function.

The remaining xCol3(), yCol3() etc methods now return by value. Changing a
method from returning a reference to returning a value is potentially
dangerous, because any calling code which continues to treat the returned value
as if it were a reference (e.g. assigning to it) will do the wrong thing, and
neither G++ nor CLang seem to be able to warn about this. Hopefully the
combination of manual searching along with unit tests has ensured that there
are no remaining uses of xCol3() which should be xCol3Ref().
mod - libs/Transformable.h Diff File
mod - libs/math/Matrix4.h Diff File
mod - libs/pivot.h Diff File
mod - radiantcore/brush/TextureProjection.cpp Diff File
mod - radiantcore/particles/ParticleNode.cpp Diff File
mod - radiantcore/selection/ManipulationPivot.cpp Diff File
mod - radiantcore/selection/manipulators/RotateManipulator.cpp Diff File
mod - test/math/Matrix4.cpp Diff File