Defines common attributes which are shared by majority of the shaders,
allowing mesh to be configured for the generic shader to be used with any
of them.
Makes some cases less consistent (and some convenience shortcuts
impossible), but goes well with the attitude "don't use pointer when it
can't be null".
Inspired in STL, base templated class is renamed to BasicColor{3,4} and
typedef'd with Float type to Color{3, 4}. It is much nicer to write
this:
Color3(1.0f)
Color3::fromHSV(25.0_degf, 0.5f, 0.9f);
instead of this:
Color3<>(1.0f);
Color3<>::fromHSV(25.0_degf, 0.5f, 0.9f);
Originally it was for more convenient usage of homogeneous coordinates
in shaders themselves, but it is actually not needed:
* When passing three-component vector (3D position) to `vec4`, the last
coordinate is implicitly set to `1`, thus there is no need to pass it
explicitly in each attribute.
* On the other hand, when passing three-component vector (2D position
in homogeneous coordinates) to `vec3` with Z explicitly set to `1`,
it still needs some swizzle magic to extend it to `vec4` gl_Position.
Passing it as two-component vector results in nearly the same magic
while saving precious memory.
It prevents unwanted implicit conversions from e.g. nullptr to Camera,
Vector2 to Physics::Point etc. By making all the constructors explicit
it is easier to routinely add the keyword to all new classes instead of
thinking about cases when to add and when not to.
* In shader uniforms (projectionMatrix makes more sense than projection
alone)
* For underlying types for SceneGraph transformation. It is already
used in Drawable::clean() as transformationMatrix, so why not use it
also in AbstractFeature::clean(). Moreover, clean() could be in
future also done using something else, this helps to distinguish the
type just from parameter name.
* In Physics shapes - applyTransformationMatrix() (as it could be in
future also done using something else).
It was mainly in DimensionTraits usage. Also using DimensionTraits::*Type
for private members of physics shapes instead of manually specified
superclasses. The header is still included because of all the inline
accessors, so why not use the same type inside the class.