Browse Source

sceneconverter: show also total data size in --info.

For animations, scenes, meshes and images, where the memory impact is
measurable. For others such as materials or cameras the memory impact is
either unclear (depending on the final representation) or so small it's
not important.
sceneconverter
Vladimír Vondruš 4 years ago
parent
commit
d07b6a2bb4
  1. 21
      src/Magnum/SceneTools/sceneconverter.cpp

21
src/Magnum/SceneTools/sceneconverter.cpp

@ -803,6 +803,7 @@ is specified as well, the IDs reference attributes of the first mesh.)")
useColor24 = false; useColor24 = false;
} }
std::size_t totalSceneDataSize = 0;
for(const SceneInfo& info: sceneInfos) { for(const SceneInfo& info: sceneInfos) {
Debug d{useColor}; Debug d{useColor};
d << Debug::boldColor(Debug::Color::White) << "Scene" << info.scene << Debug::nospace << ":" << Debug::resetColor; d << Debug::boldColor(Debug::Color::White) << "Scene" << info.scene << Debug::nospace << ":" << Debug::resetColor;
@ -842,7 +843,11 @@ is specified as well, the IDs reference attributes of the first mesh.)")
<< field.flags << Debug::resetColor; << field.flags << Debug::resetColor;
d << Debug::nospace << "," << field.size << "entries"; d << Debug::nospace << "," << field.size << "entries";
} }
totalSceneDataSize += info.dataSize;
} }
if(!sceneInfos.isEmpty())
Debug{} << "Total scene data size:" << Utility::format("{:.1f}", totalSceneDataSize/1024.0f) << "kB";
for(const ObjectInfo& info: objectInfos) { for(const ObjectInfo& info: objectInfos) {
/* Objects without a name and not referenced by any scenes are /* Objects without a name and not referenced by any scenes are
@ -886,6 +891,7 @@ is specified as well, the IDs reference attributes of the first mesh.)")
} }
} }
std::size_t totalAnimationDataSize = 0;
for(const AnimationInfo& info: animationInfos) { for(const AnimationInfo& info: animationInfos) {
Debug d{useColor}; Debug d{useColor};
d << Debug::boldColor(Debug::Color::White) << "Animation" << info.animation << Debug::nospace << ":" << Debug::resetColor; d << Debug::boldColor(Debug::Color::White) << "Animation" << info.animation << Debug::nospace << ":" << Debug::resetColor;
@ -927,7 +933,12 @@ is specified as well, the IDs reference attributes of the first mesh.)")
/** @todo might be useful to show bounds here as well, though /** @todo might be useful to show bounds here as well, though
not so much for things like complex numbers or quats */ not so much for things like complex numbers or quats */
} }
totalAnimationDataSize += info.data.data().size();
} }
if(!animationInfos.isEmpty())
Debug{} << "Total animation data size:" << Utility::format("{:.1f}", totalAnimationDataSize/1024.0f) << "kB";
for(const SkinInfo& info: skinInfos) { for(const SkinInfo& info: skinInfos) {
Debug d{useColor}; Debug d{useColor};
d << Debug::boldColor(Debug::Color::White) << "Skin" << info.skin d << Debug::boldColor(Debug::Color::White) << "Skin" << info.skin
@ -1104,6 +1115,7 @@ is specified as well, the IDs reference attributes of the first mesh.)")
} }
} }
std::size_t totalMeshDataSize = 0;
for(const MeshInfo& info: meshInfos) { for(const MeshInfo& info: meshInfos) {
Debug d{useColor}; Debug d{useColor};
if(info.level == 0) { if(info.level == 0) {
@ -1168,7 +1180,11 @@ is specified as well, the IDs reference attributes of the first mesh.)")
if(info.indexBounds) if(info.indexBounds)
d << Debug::newline << " bounds:" << info.indexBounds; d << Debug::newline << " bounds:" << info.indexBounds;
} }
totalMeshDataSize += info.vertexDataSize + info.indexDataSize;
} }
if(!meshInfos.isEmpty())
Debug{} << "Total mesh data size:" << Utility::format("{:.1f}", totalMeshDataSize/1024.0f) << "kB";
for(const TextureInfo& info: textureInfos) { for(const TextureInfo& info: textureInfos) {
Debug d{useColor}; Debug d{useColor};
@ -1210,6 +1226,7 @@ is specified as well, the IDs reference attributes of the first mesh.)")
<< Debug::resetColor << Debug::nospace << "}"; << Debug::resetColor << Debug::nospace << "}";
} }
std::size_t totalImageDataSize = 0;
for(const Trade::Implementation::ImageInfo& info: imageInfos) { for(const Trade::Implementation::ImageInfo& info: imageInfos) {
Debug d{useColor}; Debug d{useColor};
if(info.level == 0) { if(info.level == 0) {
@ -1257,7 +1274,11 @@ is specified as well, the IDs reference attributes of the first mesh.)")
<< Debug::color(Debug::Color::Green) << info.dataFlags << Debug::color(Debug::Color::Green) << info.dataFlags
<< Debug::resetColor; << Debug::resetColor;
d << Debug::nospace << ")"; d << Debug::nospace << ")";
totalImageDataSize += info.dataSize;
} }
if(!imageInfos.isEmpty())
Debug{} << "Total (uncompressed) image data size:" << Utility::format("{:.1f}", totalImageDataSize/1024.0f) << "kB";
if(args.isSet("profile")) { if(args.isSet("profile")) {
Debug{} << "Import took" << UnsignedInt(std::chrono::duration_cast<std::chrono::milliseconds>(importTime).count())/1.0e3f << "seconds"; Debug{} << "Import took" << UnsignedInt(std::chrono::duration_cast<std::chrono::milliseconds>(importTime).count())/1.0e3f << "seconds";

Loading…
Cancel
Save