Browse Source

{scene,image}converter: show image flags in --info.

pull/578/head
Vladimír Vondruš 4 years ago
parent
commit
37e79ad69a
  1. 11
      src/Magnum/SceneTools/sceneconverter.cpp
  2. 15
      src/Magnum/Trade/Implementation/converterUtilities.h
  3. 11
      src/Magnum/Trade/imageconverter.cpp

11
src/Magnum/SceneTools/sceneconverter.cpp

@ -1276,8 +1276,15 @@ is specified as well, the IDs reference attributes of the first mesh.)")
<< info.name << Debug::resetColor; << info.name << Debug::resetColor;
d << Debug::newline; d << Debug::newline;
} }
d << " Level" << info.level << Debug::nospace << ":" d << " Level" << info.level << Debug::nospace << ":";
<< Debug::packed; if(info.flags.one) {
d << Debug::packed << Debug::color(Debug::Color::Cyan);
if(info.size.z()) d << info.flags.three;
else if(info.size.y()) d << info.flags.two;
else d << info.flags.one;
d << Debug::resetColor;
}
d << Debug::packed;
if(info.size.z()) d << info.size; if(info.size.z()) d << info.size;
else if(info.size.y()) d << info.size.xy(); else if(info.size.y()) d << info.size.xy();
else d << Math::Vector<1, Int>(info.size.x()); else d << Math::Vector<1, Int>(info.size.x());

15
src/Magnum/Trade/Implementation/converterUtilities.h

@ -48,6 +48,17 @@ struct Duration {
std::chrono::high_resolution_clock::time_point _t; std::chrono::high_resolution_clock::time_point _t;
}; };
union ImageInfoFlags {
/* Wow, C++, YOU FUCKING SUCK, how is this not the implicit behavior?!! */
ImageInfoFlags(ImageFlags1D flags): one{flags} {}
ImageInfoFlags(ImageFlags2D flags): two{flags} {}
ImageInfoFlags(ImageFlags3D flags): three{flags} {}
ImageFlags1D one;
ImageFlags2D two;
ImageFlags3D three;
};
struct ImageInfo { struct ImageInfo {
UnsignedInt image, level; UnsignedInt image, level;
bool compressed; bool compressed;
@ -56,6 +67,7 @@ struct ImageInfo {
Vector3i size; Vector3i size;
std::size_t dataSize; std::size_t dataSize;
Trade::DataFlags dataFlags; Trade::DataFlags dataFlags;
ImageInfoFlags flags;
Containers::String name; Containers::String name;
}; };
@ -83,6 +95,7 @@ Containers::Array<ImageInfo> imageInfo(AbstractImporter& importer, bool& error,
Vector3i::pad(image->size()), Vector3i::pad(image->size()),
image->data().size(), image->data().size(),
image->dataFlags(), image->dataFlags(),
ImageInfoFlags{image->flags()},
j ? "" : importer.image1DName(i)); j ? "" : importer.image1DName(i));
} }
} }
@ -108,6 +121,7 @@ Containers::Array<ImageInfo> imageInfo(AbstractImporter& importer, bool& error,
Vector3i::pad(image->size()), Vector3i::pad(image->size()),
image->data().size(), image->data().size(),
image->dataFlags(), image->dataFlags(),
ImageInfoFlags{image->flags()},
j ? "" : name); j ? "" : name);
} }
} }
@ -133,6 +147,7 @@ Containers::Array<ImageInfo> imageInfo(AbstractImporter& importer, bool& error,
image->size(), image->size(),
image->data().size(), image->data().size(),
image->dataFlags(), image->dataFlags(),
ImageInfoFlags{image->flags()},
j ? "" : name); j ? "" : name);
} }
} }

11
src/Magnum/Trade/imageconverter.cpp

@ -609,8 +609,15 @@ no -C / --converter is specified, AnyImageConverter is used.)")
<< info.name << Debug::resetColor; << info.name << Debug::resetColor;
d << Debug::newline; d << Debug::newline;
} }
d << " Level" << info.level << Debug::nospace << ":" d << " Level" << info.level << Debug::nospace << ":";
<< Debug::packed; if(info.flags.one) {
d << Debug::packed << Debug::color(Debug::Color::Cyan);
if(info.size.z()) d << info.flags.three;
else if(info.size.y()) d << info.flags.two;
else d << info.flags.one;
d << Debug::resetColor;
}
d << Debug::packed;
if(info.size.z()) d << info.size; if(info.size.z()) d << info.size;
else if(info.size.y()) d << info.size.xy(); else if(info.size.y()) d << info.size.xy();
else d << Math::Vector<1, Int>(info.size.x()); else d << Math::Vector<1, Int>(info.size.x());

Loading…
Cancel
Save