Passing pointer as function parameter will now mean that it is possible
to pass `nullptr`. Some code examples now look like the parameter is
copied instead of referenced, which is misleading. Updated the
documentation to reflect that more clearly.
Merged constexpr test cases into other ones to remove duplicate code.
Copied the constructors from Math::Vector as I don't feel reinventing
all that again.
Assumes that no resources of given type are referenced. The test case
for this is awful, as I can't think of a way to test which would work
without trying to decrement reference counter on already deleted
resource. Added just-to-be-sure assertion to make it fail early and not
somewhere deep in STL.
Previously was done per type (i.e. for each type delete loader and then
the data), wasn't usable when the loader stored different resource type
(which is the only case where it is useful).
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);
Advantages:
* The enums were large (600-800 lines) and they polluted the header,
now they are in separate files (except for BufferTexture, which has
the enum small enough to be left in the same file).
* Image classes now don't need to include OpenGL headers, as they were
needed only for the enum values. With advantage of C++11's forward
enum declarations there is no need to include the enum headers
anywhere in implementation, only when particular values are needed.
* The values are now less verbose:
AbstractTexture::InternalFormat::RGB8 // before
TextureFormat::RGB8 // now
* Resolved another "trivial choice" problem (thanks @JanDupal for
introducing this term to me): how to specify the format if there are
ten ways to do it (some being massively confusing):
Image2D::Format f = AbstractImage::Format::RGB; // too long...
Image2D::Format f = Image3D::Format::RGBA; // why 3D? this works?
Image2D::Format f = BufferImage1D::Format::RGBA; // wat?
It is even worse (and more verbose) with textures:
Texture2D::InternalFormat f =
CubeMapTextureArray::InternalFormat::RGB8; // this is allowed?
To have consistent naming this change was done also with
BufferTexture::InternalFormat (now BufferTextureFormat), although there
were no trivial choice issues and the enum isn't too large. But at least
it is now less typing.
Remaining unspecified components are set to 0, 0, 1, according to spec.
Also cleaned up and simplified the internals, added debug output
operators for attribute component count and types and tested the whole
thing.
The enum is finally completely reimplemented for specific cases with
proper values (Mesh attribute types, index types, pixel types, ...). The
rest currently remaining in TypeTraits.h is used only in Mesh and
AbstractShaderProgram, probably will be moved there.
(De)normalization from/to [0, 1] for unsigned types and from/to [-1, 1]
for signed types. -1.0 is always denormalized to min+1.
Also updated some tests for Color, as they depended on previous
imprecise implementation.
Removing of another <*stream> #include leads to more compilation time
saving, now from ~5:12 to ~4:55. Another compilation time improvements
will now be possible only by using Clang's modules, I don't know where
to optimize further (except for getting rid of <sstream> in tests).