Browse Source

AnySceneImporter: support most of new formats from AssimpImporter.

pull/205/head
Vladimír Vondruš 9 years ago
parent
commit
3811a1b208
  1. 49
      src/MagnumPlugins/AnySceneImporter/AnySceneImporter.cpp
  2. 35
      src/MagnumPlugins/AnySceneImporter/AnySceneImporter.h
  3. 4
      src/MagnumPlugins/AnySceneImporter/Test/Test.cpp

49
src/MagnumPlugins/AnySceneImporter/AnySceneImporter.cpp

@ -60,14 +60,61 @@ void AnySceneImporter::doOpenFile(const std::string& filename) {
/* Detect type from extension */
std::string plugin;
if(Utility::String::endsWith(filename, ".dae"))
if(Utility::String::endsWith(filename, ".3ds") ||
Utility::String::endsWith(filename, ".ase"))
plugin = "3dsImporter";
else if(Utility::String::endsWith(filename, ".ac"))
plugin = "Ac3dImporter";
else if(Utility::String::endsWith(filename, ".blend"))
plugin = "BlenderImporter";
else if(Utility::String::endsWith(filename, ".bvh"))
plugin = "BvhImporter";
else if(Utility::String::endsWith(filename, ".csm"))
plugin = "CsmImporter";
else if(Utility::String::endsWith(filename, ".dae"))
plugin = "ColladaImporter";
else if(Utility::String::endsWith(filename, ".x"))
plugin = "DirectXImporter";
else if(Utility::String::endsWith(filename, ".dxf"))
plugin = "DxfImporter";
else if(Utility::String::endsWith(filename, ".fbx"))
plugin = "FbxImporter";
else if(Utility::String::endsWith(filename, ".gltf") ||
Utility::String::endsWith(filename, ".glb"))
plugin = "GltfImporter";
else if(Utility::String::endsWith(filename, ".ifc"))
plugin = "IfcImporter";
else if(Utility::String::endsWith(filename, ".irrmesh") ||
Utility::String::endsWith(filename, ".irr"))
plugin = "IrrlichtImporter";
else if(Utility::String::endsWith(filename, ".lwo") ||
Utility::String::endsWith(filename, ".lws"))
plugin = "LightWaveImporter";
else if(Utility::String::endsWith(filename, ".lxo"))
plugin = "ModoImporter";
else if(Utility::String::endsWith(filename, ".ms3d"))
plugin = "MilkshapeImporter";
else if(Utility::String::endsWith(filename, ".obj"))
plugin = "ObjImporter";
else if(Utility::String::endsWith(filename, ".xml"))
plugin = "OgreImporter";
else if(Utility::String::endsWith(filename, ".ogex"))
plugin = "OpenGexImporter";
else if(Utility::String::endsWith(filename, ".ply"))
plugin = "StanfordImporter";
else if(Utility::String::endsWith(filename, ".stl"))
plugin = "StlImporter";
else if(Utility::String::endsWith(filename, ".cob") ||
Utility::String::endsWith(filename, ".scn"))
plugin = "TrueSpaceImporter";
else if(Utility::String::endsWith(filename, ".3d"))
plugin = "UnrealImporter";
else if(Utility::String::endsWith(filename, ".smd") ||
Utility::String::endsWith(filename, ".vta"))
plugin = "ValveImporter";
else if(Utility::String::endsWith(filename, ".xgl") ||
Utility::String::endsWith(filename, ".zgl"))
plugin = "XglImporter";
else {
Error() << "Trade::AnySceneImporter::openFile(): cannot determine type of file" << filename;
return;

35
src/MagnumPlugins/AnySceneImporter/AnySceneImporter.h

@ -63,14 +63,45 @@ link to `MagnumPlugins::AnySceneImporter` target. See @ref building-plugins,
Supported formats:
- 3ds Max 3DS and ASE (`*.3ds`, `*.ase`), loaded with any plugin that
provides `3dsImporter``
- AC3D (`*.ac`), loaded with any plugin that provides `Ac3dImporter`
- Blender 3D (`*.blend`), loaded with any plugin that provides
`BlenderImporter`
- Biovision BVH (`*.bvh`), loaded with any plugin that provides `BvhImporter`
- CharacterStudio Motion (`*.csm`), loaded with any plugin that provides
`CsmImporter`
- COLLADA (`*.dae`), loaded with @ref ColladaImporter or any other plugin
that provides it
- OBJ (`*.obj`), loaded with @ref ObjImporter or any other plugin that
provides it
- DirectX X (`*.x`), loaded with any plugin that provides `DirectXImporter`
- AutoCAD DXF (`*.dxf`), loaded with any plugin that provides `DxfImporter`
- Autodesk FBX (`*.fbx`), loaded with any plugin that provides `FbxImporter`
- glTF (`*.gltf`, `*.glb`), loaded with any plugin that provides
`GltfImporter`
- Industry Foundation Classes (IFC/Step) (`*.ifc`), loaded with any plugin
that provides `IfcImporter`
- Irrlicht Mesh and Scene (`*.irrmesh`, `*.irr`), loaded with any plugin that
provides `IrrlichtImporter`
- LightWave, LightWave Scene (`*.lwo`, `*.lws`), loaded with any plugin that
provides `LightWaveImporter`
- Modo (`*.lxo`), loaded with any plugin that provides `ModoImporter`
- Milkshape 3D (`*.ms3d`), loaded with any plugin that provides
`MilkshapeImporter`
- Wavefront OBJ (`*.obj`), loaded with @ref ObjImporter or any other plugin
that provides it
- Ogre XML (`*.xml`), loaded with any plugin that provides `OgreImporter`
- OpenGEX (`*.ogex`), loaded with @ref OpenGexImporter or any other plugin
that provides it
- Stanford (`*.ply`), loaded with @ref StanfordImporter or any other plugin
that provides it
- Stereolitography (`*.stl`), loaded with any plugin that provides
`StlImporter`
- TrueSpace (`*.cob`, `*.scn`), loaded with any plugin that provides
`TrueSpaceImporter`
- Unreal (`*.3d`), loaded with any plugin that provides `UnrealImporter`
- Valve Model (`*.smd`, `*.vta`), loaded with any plugin that provides
`ValveImporter`
- XGL (`*.xgl`, `*.zgl`), loaded with any plugin that provides `XglImporter`
Only loading from files is supported.
*/

4
src/MagnumPlugins/AnySceneImporter/Test/Test.cpp

@ -85,9 +85,9 @@ void AnySceneImporterTest::unknown() {
Error redirectError{&output};
AnySceneImporter importer{_manager};
CORRADE_VERIFY(!importer.openFile("mesh.stl"));
CORRADE_VERIFY(!importer.openFile("mesh.wtf"));
CORRADE_COMPARE(output.str(), "Trade::AnySceneImporter::openFile(): cannot determine type of file mesh.stl\n");
CORRADE_COMPARE(output.str(), "Trade::AnySceneImporter::openFile(): cannot determine type of file mesh.wtf\n");
}
}}}

Loading…
Cancel
Save