Merge branch 'master' into gltf_o3dgc

pull/972/head
Alexandr Arutjunov 2016-09-10 10:37:32 +03:00
commit a375344052
7 changed files with 36 additions and 62 deletions

View File

@ -275,7 +275,6 @@ ENDIF ( ASSIMP_BUILD_COMPILER STREQUAL "")
MARK_AS_ADVANCED ( ASSIMP_BUILD_ARCHITECTURE ASSIMP_BUILD_COMPILER )
SET ( ASSIMP_BUILD_NONFREE_C4D_IMPORTER OFF CACHE BOOL
"Build the C4D importer, which relies on the non-free Melange SDK."
)
@ -337,16 +336,16 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
# Why here? Maybe user do not want Qt viewer and have no Qt.
# Why assimp_qt_viewer/CMakeLists.txt still contain similar check?
# Because viewer can be build independently of Assimp.
FIND_PACKAGE(Qt4 QUIET)
FIND_PACKAGE(Qt5 QUIET)
FIND_PACKAGE(DevIL QUIET)
FIND_PACKAGE(OpenGL QUIET)
IF ( Qt4_FOUND AND IL_FOUND AND OPENGL_FOUND)
IF ( Qt5_FOUND AND IL_FOUND AND OPENGL_FOUND)
ADD_SUBDIRECTORY( tools/assimp_qt_viewer/ )
ELSE()
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "")
IF (NOT Qt4_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} Qt4")
ENDIF (NOT Qt4_FOUND)
IF (NOT Qt5_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} Qt5")
ENDIF (NOT Qt5_FOUND)
IF (NOT IL_FOUND)
SET ( ASSIMP_QT_VIEWER_DEPENDENCIES "${ASSIMP_QT_VIEWER_DEPENDENCIES} DevIL")
@ -357,10 +356,9 @@ IF ( ASSIMP_BUILD_ASSIMP_TOOLS )
ENDIF (NOT OPENGL_FOUND)
MESSAGE (WARNING "Build of assimp_qt_viewer is disabled. Unsatisfied dendencies: ${ASSIMP_QT_VIEWER_DEPENDENCIES}")
ENDIF ( Qt4_FOUND AND IL_FOUND AND OPENGL_FOUND)
ENDIF ( Qt5_FOUND AND IL_FOUND AND OPENGL_FOUND)
ENDIF ( ASSIMP_BUILD_ASSIMP_TOOLS )
IF ( ASSIMP_BUILD_SAMPLES)
IF ( WIN32 )
ADD_SUBDIRECTORY( samples/SimpleTexturedOpenGL/ )

View File

@ -74,11 +74,10 @@ static int ioprintf( IOStream * io, const char *format, ... ) {
static const size_t Size = 4096;
char sz[ Size ];
size_t len( strlen( format ) );
::memset( sz, '\0', Size );
va_list va;
va_start( va, format );
int nSize = vsnprintf( sz, Size-1, format, va );
const unsigned int nSize = vsnprintf( sz, Size-1, format, va );
ai_assert( nSize < Size );
va_end( va );

View File

@ -617,8 +617,6 @@ ADD_ASSIMP_IMPORTER( 3MF
D3MFOpcPackage.h
D3MFOpcPackage.cpp
)
SOURCE_GROUP( 3MF FILES ${(3MF_SRCS})
SET( Step_SRCS
StepExporter.h
@ -662,7 +660,6 @@ SET( Clipper_SRCS
)
SOURCE_GROUP( Clipper FILES ${Clipper_SRCS})
SET( Poly2Tri_SRCS
../contrib/poly2tri/poly2tri/common/shapes.cc
../contrib/poly2tri/poly2tri/common/shapes.h

View File

@ -339,15 +339,12 @@ D3MFImporter::~D3MFImporter()
bool D3MFImporter::CanRead(const std::string &pFile, IOSystem *pIOHandler, bool checkSig) const
{
const std::string extension = GetExtension(pFile);
if(extension == "3mf")
{
if(extension == "3mf") {
return true;
}
else if(!extension.length() || checkSig)
{
if(!pIOHandler)
} else if ( !extension.length() || checkSig ) {
if (nullptr == pIOHandler ) {
return true;
}
}
return false;
@ -365,8 +362,6 @@ const aiImporterDesc *D3MFImporter::GetInfo() const
void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOSystem *pIOHandler)
{
D3MF::D3MFOpcPackage opcPackage(pIOHandler, pFile);
std::unique_ptr<CIrrXML_IOStreamReader> xmlStream(new CIrrXML_IOStreamReader(opcPackage.RootStream()));
@ -374,12 +369,9 @@ void D3MFImporter::InternReadFile(const std::string &pFile, aiScene *pScene, IOS
D3MF::XmlSerializer xmlSerializer(xmlReader.get());
xmlSerializer.ImportXml(pScene);
}
}
} // Namespace Assimp
#endif // ASSIMP_BUILD_NO_3MF_IMPORTER

View File

@ -61,26 +61,21 @@ namespace Assimp {
namespace D3MF {
namespace XmlTag {
const std::string CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
const std::string ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
const std::string SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
const std::string SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
const std::string RELS_RELATIONSHIP_CONTAINER = "Relationships";
const std::string RELS_RELATIONSHIP_NODE = "Relationship";
const std::string RELS_ATTRIB_TARGET = "Target";
const std::string RELS_ATTRIB_TYPE = "Type";
const std::string RELS_ATTRIB_ID = "Id";
const std::string PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
const std::string PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
const std::string PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
const std::string PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
const std::string PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
static const std::string CONTENT_TYPES_ARCHIVE = "[Content_Types].xml";
static const std::string ROOT_RELATIONSHIPS_ARCHIVE = "_rels/.rels";
static const std::string SCHEMA_CONTENTTYPES = "http://schemas.openxmlformats.org/package/2006/content-types";
static const std::string SCHEMA_RELATIONSHIPS = "http://schemas.openxmlformats.org/package/2006/relationships";
static const std::string RELS_RELATIONSHIP_CONTAINER = "Relationships";
static const std::string RELS_RELATIONSHIP_NODE = "Relationship";
static const std::string RELS_ATTRIB_TARGET = "Target";
static const std::string RELS_ATTRIB_TYPE = "Type";
static const std::string RELS_ATTRIB_ID = "Id";
static const std::string PACKAGE_START_PART_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dmodel";
static const std::string PACKAGE_PRINT_TICKET_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/printticket";
static const std::string PACKAGE_TEXTURE_RELATIONSHIP_TYPE = "http://schemas.microsoft.com/3dmanufacturing/2013/01/3dtexture";
static const std::string PACKAGE_CORE_PROPERTIES_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
static const std::string PACKAGE_THUMBNAIL_RELATIONSHIP_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/thumbnail";
}
class IOSystem2Unzip {
@ -461,9 +456,8 @@ public:
ParseRootNode(xmlReader);
}
}
}
void ParseRootNode(XmlReader* xmlReader)
{
ParseAttributes(xmlReader);
@ -476,13 +470,13 @@ public:
ParseChildNode(xmlReader);
}
}
}
void ParseAttributes(XmlReader*)
{
}
void ParseChildNode(XmlReader* xmlReader)
{
OpcPackageRelationshipPtr relPtr(new OpcPackageRelationship());
@ -494,26 +488,22 @@ public:
m_relationShips.push_back(relPtr);
}
std::vector<OpcPackageRelationshipPtr> m_relationShips;
};
// ------------------------------------------------------------------------------------------------
D3MFOpcPackage::D3MFOpcPackage(IOSystem* pIOHandler, const std::string& rFile)
: m_RootStream(nullptr)
{
zipArchive.reset(new D3MF::D3MFZipArchive( pIOHandler, rFile ));
if(!zipArchive->isOpen())
if(!zipArchive->isOpen()) {
throw DeadlyImportError("Failed to open file " + rFile+ ".");
}
std::vector<std::string> fileList;
zipArchive->getFileList(fileList);
for(auto& file: fileList){
if(file == D3MF::XmlTag::ROOT_RELATIONSHIPS_ARCHIVE)
{
if(file == D3MF::XmlTag::ROOT_RELATIONSHIPS_ARCHIVE) {
//PkgRelationshipReader pkgRelReader(file, archive);
ai_assert(zipArchive->Exists(file.c_str()));

Binary file not shown.

View File

@ -10,12 +10,10 @@
// Header files, Qt.
#include <QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow w;
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
MainWindow w;
w.show();
w.show();
return a.exec();
return a.exec();
}