With pixel pack/unpack support it will be possible to create views onto
sub-images, renamed the class to reflect that.
The old Magnum/ImageReference.h and ImageReference types are now aliases
to ImageView.h and ImageView types, are marked as deprecated and will be
removed in future release.
When pixel pack/unpack parameter support is done, this class will
contain only stuff that's common to both compressed and uncompressed
images. Currently that's nothing, so the class is empty.
Note the hilarious bug in both GCC and Clang: if you remove the `_dummy`
member, both of them start complaining about weird completely unrelated
stuff.
`char*` is now the default type for byte arrays. Results in shorter
code, less annoyances and more convenient testing. As is the case with
Corrade, I'm not doing any compatibility/deprecation layer, as most of
these functions is not widely used anyway.
The only places where they aren't absolute are:
- when header is included from corresponding source file
- when including headers which are not part of final installation (e.g.
test-specific configuration, headers from Implementation/)
Everything what was in src/ is now in src/Corrade, everything from
src/Plugins is now in src/MagnumPlugins, everything from external/ is in
src/MagnumExternal. Added new CMakeLists.txt file and updated the other
ones for the moves, no other change was made. If MAGNUM_BUILD_DEPRECATED
is set, everything compiles and installs like previously except for the
plugins, which are now in MagnumPlugins and not in Magnum/Plugins.
To have BufferImage::buffer().data() consistent with Image::data()
(default is unsigned char data type, but it is possible to reinterpret
the data). Saves some ugly code:
Image2D image(ColorFormat::RGB, ColorType::UnsignedByte, ...);
Color3ub a = reinterpret_cast<Color3ub*>(image.data())[0]; // before
Color3ub b = image.data<Color3ub>()[0]; // after
ImageReference is supposed to be wrapper around existing data array of
some type which is passed to Magnum functions. Thus modifying the
original data array (which must be kept somewhere for proper deletion)
is much better option than casting the pointer returned by data() to
some proper type and then operating on that. Hopefully this won't break
any existing code.
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.
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.
Buffered* hinted that it has something to do with caching, streaming or
whatever. "Buffer texture" is now also consistent with naming in
specification.
It is now ambiguous whether data passed as `std::int8_t` are of
Type::Byte, Type::ByteInteger or whatnot. The user now must explicitly
specify both format and type.
Thanks to DimensionTraits it is now possible to e.g. conveniently access
components by name or pass size as combination of vector and scalar:
GLsizei width = image.size().x();
image.setData({xy, 1}, ...);
Instead of previous inconvenient ways:
GLsizei width = image.size()[0];
Math::Vector2<GLsizei> size(xy, 1);
image.setData(size, ...);
Not using the specialized type for internal functions and storage, as it
wouldn't cause any other improvements. This way it is virtually possible
to forward-declare the specialized types without including them in the
headers.
Sometimes something needs to modify the data (in similar way it modifies
e.g. MeshData) and there is no reason to forbid that, as the data must
be non-const for delete[] operator anyway. There might be slight problem
with ImageWrapper, which should be able to wrap const data, but
currently nothing needs it.
It only caused another maintenance burden and was confusing to users.
Now when scene graph is in SceneGraph namespace there is no need for
another grouping. Namespaces are (and should be) sufficient.
This reverts commit 79945ab6fc.
Conflicts:
src/BufferedImage.h
src/BufferedTexture.h
src/Framebuffer.h
src/Query.h
src/SceneGraph/Scene.h
While namespaces act for hierarchy, modules are something like "tags" -
usable when you want to check related classes of e.g. CubeMapTexture.
Not sure how to name module for Math and Physics namespaces and
Contexts/Trade, though.
Long-standing TODO. It is better to have size first, because it is more
significant than type (e.g. because there are Vector4<T> specializations
and not VectorT<4> specializations). It is also IMHO easier for user to
distinguish/read the type than before:
Vector<float, 4> -> Vector4<float> // before
Vector<4, float> -> Vector4<float> // now
* Framebuffer related functions moved to Framebuffer class, thus
simplifying the data setting functions - removed setDimensions(),
more flexible setData() function.
* Allow to set data with explicit format specification, reorganized
function parameters to make these two setData() more similar.
* Now using new AbstractType::ComponentType enum instead of basic Type,
updated TypeTraits to return the new enum from imageType() function.
Checking whether given type can be used for mesh indices or image data
was always done like this, because it was also needed to get OpenGL type
ID for the type:
TypeTraits<typename TypeTraits<T>::IndexType>::glType()
This was cumbersome, now the check is done using function, which
returns the OpenGL type ID directly:
TypeTraits<T>::indexType()
Also replaced TextureType with imageType() and renamed glType() to just
type().
These classes are meant to be used in the same texture updating
functions as Trade::ImageData due to static polymorphism. In addition to
Trade::ImageData, which is read-only, these classes support updating the
dimensions and data. Image2D and ImageBuffer2D can update the data also
from framebuffer.
Start of AbstractImporter rework - Trade namespace will contain simple
classes usable for exchanging data with other formats, importers will
not depend on any OpenGL functionality, they will just provide access to
plain data.