From a24859ba726e5504c9d88bb47db226c6059234bd Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Wed, 17 Apr 2013 11:15:31 +0100 Subject: Tidy up the scene_ai headers to stop libassimp leaking to public headers Change-Id: I5f5415bdab164e5530caa6976755349479d19ea4 Reviewed-by: Stephen Kelly --- src/threed/scene/qglabstractscene.cpp | 2 +- src/threed/scene_ai/ailoaderiostream.cpp | 2 +- src/threed/scene_ai/ailoaderiostream.h | 70 ------------------- src/threed/scene_ai/ailoaderiostream_p.h | 70 +++++++++++++++++++ src/threed/scene_ai/ailoaderiosystem.cpp | 4 +- src/threed/scene_ai/ailoaderiosystem.h | 70 ------------------- src/threed/scene_ai/ailoaderiosystem_p.h | 70 +++++++++++++++++++ src/threed/scene_ai/qailoader.cpp | 8 +-- src/threed/scene_ai/qailoader.h | 101 --------------------------- src/threed/scene_ai/qailoader_p.h | 102 +++++++++++++++++++++++++++ src/threed/scene_ai/qaimesh.cpp | 9 +-- src/threed/scene_ai/qaimesh.h | 72 ------------------- src/threed/scene_ai/qaimesh_p.h | 71 +++++++++++++++++++ src/threed/scene_ai/qaiscene.cpp | 11 +-- src/threed/scene_ai/qaiscene.h | 79 --------------------- src/threed/scene_ai/qaiscene_p.h | 79 +++++++++++++++++++++ src/threed/scene_ai/qaiscenehandler.cpp | 6 +- src/threed/scene_ai/qaiscenehandler.h | 116 ------------------------------- src/threed/scene_ai/qaiscenehandler_p.h | 116 +++++++++++++++++++++++++++++++ src/threed/scene_ai/scene_ai.pri | 12 ++-- 20 files changed, 537 insertions(+), 533 deletions(-) delete mode 100644 src/threed/scene_ai/ailoaderiostream.h create mode 100644 src/threed/scene_ai/ailoaderiostream_p.h delete mode 100644 src/threed/scene_ai/ailoaderiosystem.h create mode 100644 src/threed/scene_ai/ailoaderiosystem_p.h delete mode 100644 src/threed/scene_ai/qailoader.h create mode 100644 src/threed/scene_ai/qailoader_p.h delete mode 100644 src/threed/scene_ai/qaimesh.h create mode 100644 src/threed/scene_ai/qaimesh_p.h delete mode 100644 src/threed/scene_ai/qaiscene.h create mode 100644 src/threed/scene_ai/qaiscene_p.h delete mode 100644 src/threed/scene_ai/qaiscenehandler.h create mode 100644 src/threed/scene_ai/qaiscenehandler_p.h diff --git a/src/threed/scene/qglabstractscene.cpp b/src/threed/scene/qglabstractscene.cpp index 7a624cb79..f124e405b 100644 --- a/src/threed/scene/qglabstractscene.cpp +++ b/src/threed/scene/qglabstractscene.cpp @@ -43,7 +43,7 @@ #include "qglsceneformatplugin.h" #include "qglpicknode.h" -#include "qaiscenehandler.h" +#include "qaiscenehandler_p.h" #include "qglbezierscenehandler.h" #include diff --git a/src/threed/scene_ai/ailoaderiostream.cpp b/src/threed/scene_ai/ailoaderiostream.cpp index 799882879..988c2ce76 100644 --- a/src/threed/scene_ai/ailoaderiostream.cpp +++ b/src/threed/scene_ai/ailoaderiostream.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "ailoaderiostream.h" +#include "ailoaderiostream_p.h" #include diff --git a/src/threed/scene_ai/ailoaderiostream.h b/src/threed/scene_ai/ailoaderiostream.h deleted file mode 100644 index c114247b2..000000000 --- a/src/threed/scene_ai/ailoaderiostream.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef AILOADERIOSTREAM_H -#define AILOADERIOSTREAM_H - -#include -#include "IOStream.h" -#include "IOSystem.h" - -QT_BEGIN_NAMESPACE -class QIODevice; -QT_END_NAMESPACE - -class AiLoaderIOStream : public Assimp::IOStream -{ -public: - AiLoaderIOStream(QIODevice *device); - ~AiLoaderIOStream(); - size_t Read( void* pvBuffer, size_t pSize, size_t pCount); - size_t Write( const void* pvBuffer, size_t pSize, size_t pCount); - aiReturn Seek( size_t pOffset, aiOrigin pOrigin); - size_t Tell() const; - size_t FileSize() const; - void Flush(); - QIODevice *device() const { return m_device; } -private: - QIODevice *m_device; - bool m_errorState; -}; - -#endif // AILOADERIOSTREAM_H diff --git a/src/threed/scene_ai/ailoaderiostream_p.h b/src/threed/scene_ai/ailoaderiostream_p.h new file mode 100644 index 000000000..c114247b2 --- /dev/null +++ b/src/threed/scene_ai/ailoaderiostream_p.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AILOADERIOSTREAM_H +#define AILOADERIOSTREAM_H + +#include +#include "IOStream.h" +#include "IOSystem.h" + +QT_BEGIN_NAMESPACE +class QIODevice; +QT_END_NAMESPACE + +class AiLoaderIOStream : public Assimp::IOStream +{ +public: + AiLoaderIOStream(QIODevice *device); + ~AiLoaderIOStream(); + size_t Read( void* pvBuffer, size_t pSize, size_t pCount); + size_t Write( const void* pvBuffer, size_t pSize, size_t pCount); + aiReturn Seek( size_t pOffset, aiOrigin pOrigin); + size_t Tell() const; + size_t FileSize() const; + void Flush(); + QIODevice *device() const { return m_device; } +private: + QIODevice *m_device; + bool m_errorState; +}; + +#endif // AILOADERIOSTREAM_H diff --git a/src/threed/scene_ai/ailoaderiosystem.cpp b/src/threed/scene_ai/ailoaderiosystem.cpp index 40447782e..37a6dbbc2 100644 --- a/src/threed/scene_ai/ailoaderiosystem.cpp +++ b/src/threed/scene_ai/ailoaderiosystem.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "ailoaderiosystem.h" -#include "ailoaderiostream.h" +#include "ailoaderiosystem_p.h" +#include "ailoaderiostream_p.h" #include "DefaultLogger.h" #include diff --git a/src/threed/scene_ai/ailoaderiosystem.h b/src/threed/scene_ai/ailoaderiosystem.h deleted file mode 100644 index 467479a8c..000000000 --- a/src/threed/scene_ai/ailoaderiosystem.h +++ /dev/null @@ -1,70 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef AILOADERIOSYSTEM_H -#define AILOADERIOSYSTEM_H - -#include "IOSystem.h" - -#include - -QT_BEGIN_NAMESPACE -class QIODevice; -QT_END_NAMESPACE - -class IOStream; - -class AiLoaderIOSystem : public Assimp::IOSystem -{ -public: - AiLoaderIOSystem(QIODevice *device, QUrl url); - ~AiLoaderIOSystem(); - virtual bool Exists( const char* path) const; - virtual char getOsSeparator() const; - virtual Assimp::IOStream* Open(const char* pFile, const char* pMode = "rb"); - virtual void Close(Assimp::IOStream* pFile); -private: - QIODevice *m_device; - QList m_sub; - QUrl m_url; -}; - -#endif // AILOADERIOSYSTEM_H diff --git a/src/threed/scene_ai/ailoaderiosystem_p.h b/src/threed/scene_ai/ailoaderiosystem_p.h new file mode 100644 index 000000000..467479a8c --- /dev/null +++ b/src/threed/scene_ai/ailoaderiosystem_p.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef AILOADERIOSYSTEM_H +#define AILOADERIOSYSTEM_H + +#include "IOSystem.h" + +#include + +QT_BEGIN_NAMESPACE +class QIODevice; +QT_END_NAMESPACE + +class IOStream; + +class AiLoaderIOSystem : public Assimp::IOSystem +{ +public: + AiLoaderIOSystem(QIODevice *device, QUrl url); + ~AiLoaderIOSystem(); + virtual bool Exists( const char* path) const; + virtual char getOsSeparator() const; + virtual Assimp::IOStream* Open(const char* pFile, const char* pMode = "rb"); + virtual void Close(Assimp::IOStream* pFile); +private: + QIODevice *m_device; + QList m_sub; + QUrl m_url; +}; + +#endif // AILOADERIOSYSTEM_H diff --git a/src/threed/scene_ai/qailoader.cpp b/src/threed/scene_ai/qailoader.cpp index ff2065493..500d991ae 100644 --- a/src/threed/scene_ai/qailoader.cpp +++ b/src/threed/scene_ai/qailoader.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "qailoader.h" -#include "qaiscenehandler.h" -#include "qaiscene.h" -#include "qaimesh.h" +#include "qailoader_p.h" +#include "qaiscenehandler_p.h" +#include "qaiscene_p.h" +#include "qaimesh_p.h" #include "qgeometrydata.h" #include "qgltwosidedmaterial.h" diff --git a/src/threed/scene_ai/qailoader.h b/src/threed/scene_ai/qailoader.h deleted file mode 100644 index 71d32a8a2..000000000 --- a/src/threed/scene_ai/qailoader.h +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QAILOADER_H -#define QAILOADER_H - -#include -#include -#include - -#include "aiScene.h" - -#include - -struct aiMaterial; - -QT_BEGIN_NAMESPACE - -class QAiMesh; -class QAiScene; -class QGLSceneNode; -class QAiSceneHandler; -class QGLSceneAnimation; -class QGLMaterial; - -class QAiLoader -{ -public: - QAiLoader(const aiScene *scene, QAiSceneHandler* handler); - ~QAiLoader(); - QGLSceneNode *loadMeshes(); - QList loadAnimations(); - -private: - friend class QAiScene; - - void loadMesh(aiMesh *); - void loadNodes(aiNode *, QGLSceneNode *); - void loadMaterial(aiMaterial *); - void loadTextures(aiMaterial *, QGLMaterial *); - QUrl ensureResource(const QString &); - void optimizeData(); - void optimizeNodes(QGLSceneNode *node = 0, QGLSceneNode *parent = 0); - void countChildNodeReferences(); - void setEffectRecursive(QGLSceneNode *node); - - const aiScene *m_scene; - QGLSceneNode *m_root; - QAiSceneHandler *m_handler; - QList m_nodes; - QList m_materials; - QList m_meshes; - QMap m_nodeMap; - QMap m_refCounts; - QList m_animations; - bool m_hasTextures; - bool m_hasLitMaterials; - QGLBuilder m_builder; -}; - -QT_END_NAMESPACE - -#endif // QAILOADER_H diff --git a/src/threed/scene_ai/qailoader_p.h b/src/threed/scene_ai/qailoader_p.h new file mode 100644 index 000000000..51bb4ebb1 --- /dev/null +++ b/src/threed/scene_ai/qailoader_p.h @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QAILOADER_H +#define QAILOADER_H + +#include +#include +#include + +#include + +struct aiMaterial; +struct aiMesh; +struct aiNode; +struct aiScene; + +QT_BEGIN_NAMESPACE + +class QAiMesh; +class QAiScene; +class QGLSceneNode; +class QAiSceneHandler; +class QGLSceneAnimation; +class QGLMaterial; + +class QAiLoader +{ +public: + QAiLoader(const aiScene *scene, QAiSceneHandler* handler); + ~QAiLoader(); + QGLSceneNode *loadMeshes(); + QList loadAnimations(); + +private: + friend class QAiScene; + + void loadMesh(aiMesh *); + void loadNodes(aiNode *, QGLSceneNode *); + void loadMaterial(aiMaterial *); + void loadTextures(aiMaterial *, QGLMaterial *); + QUrl ensureResource(const QString &); + void optimizeData(); + void optimizeNodes(QGLSceneNode *node = 0, QGLSceneNode *parent = 0); + void countChildNodeReferences(); + void setEffectRecursive(QGLSceneNode *node); + + const aiScene *m_scene; + QGLSceneNode *m_root; + QAiSceneHandler *m_handler; + QList m_nodes; + QList m_materials; + QList m_meshes; + QMap m_nodeMap; + QMap m_refCounts; + QList m_animations; + bool m_hasTextures; + bool m_hasLitMaterials; + QGLBuilder m_builder; +}; + +QT_END_NAMESPACE + +#endif // QAILOADER_H diff --git a/src/threed/scene_ai/qaimesh.cpp b/src/threed/scene_ai/qaimesh.cpp index 2a5718e99..737766fe2 100644 --- a/src/threed/scene_ai/qaimesh.cpp +++ b/src/threed/scene_ai/qaimesh.cpp @@ -39,13 +39,14 @@ ** ****************************************************************************/ -#include "qaimesh.h" -#include "qglscenenode.h" -#include "qglmaterialcollection.h" -#include "qglbuilder.h" +#include "qaimesh_p.h" +#include +#include +#include #include #include +#include #include "aiMesh.h" #include "DefaultLogger.h" diff --git a/src/threed/scene_ai/qaimesh.h b/src/threed/scene_ai/qaimesh.h deleted file mode 100644 index a97bfe4db..000000000 --- a/src/threed/scene_ai/qaimesh.h +++ /dev/null @@ -1,72 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QAIMESH_H -#define QAIMESH_H - -#include -#include - -struct aiMesh; - -QT_BEGIN_NAMESPACE - -class QGLMaterialCollection; -class QGLSceneNode; -class QGLBuilder; -class QAiLoader; - -class QAiMesh -{ -public: - QAiMesh(aiMesh *mesh); - virtual ~QAiMesh(); - - void build(QGLBuilder &builder, bool showWarnings = false); -private: - void loadTriangles(QGLBuilder &builder); - - aiMesh *m_mesh; -}; - -QT_END_NAMESPACE - -#endif // QAIMESH_H diff --git a/src/threed/scene_ai/qaimesh_p.h b/src/threed/scene_ai/qaimesh_p.h new file mode 100644 index 000000000..9309bde66 --- /dev/null +++ b/src/threed/scene_ai/qaimesh_p.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QAIMESH_H +#define QAIMESH_H + +#include + +struct aiMesh; + +QT_BEGIN_NAMESPACE + +class QGLMaterialCollection; +class QGLSceneNode; +class QGLBuilder; +class QAiLoader; + +class QAiMesh +{ +public: + QAiMesh(aiMesh *mesh); + virtual ~QAiMesh(); + + void build(QGLBuilder &builder, bool showWarnings = false); +private: + void loadTriangles(QGLBuilder &builder); + + aiMesh *m_mesh; +}; + +QT_END_NAMESPACE + +#endif // QAIMESH_H diff --git a/src/threed/scene_ai/qaiscene.cpp b/src/threed/scene_ai/qaiscene.cpp index de93be762..103f970ec 100644 --- a/src/threed/scene_ai/qaiscene.cpp +++ b/src/threed/scene_ai/qaiscene.cpp @@ -39,11 +39,14 @@ ** ****************************************************************************/ -#include "qaiscene.h" -#include "qaimesh.h" -#include "qailoader.h" +#include "qaiscene_p.h" +#include "qaimesh_p.h" +#include "qailoader_p.h" -#include "qglscenenode.h" +#include +#include + +#include QT_BEGIN_NAMESPACE diff --git a/src/threed/scene_ai/qaiscene.h b/src/threed/scene_ai/qaiscene.h deleted file mode 100644 index 22ddbf712..000000000 --- a/src/threed/scene_ai/qaiscene.h +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QAISCENE_H -#define QAISCENE_H - -#include - -#include "aiScene.h" - -QT_BEGIN_NAMESPACE - -class QGLSceneNode; -class QAiSceneHandler; -class QAiLoader; - -class QAiScene : public QGLAbstractScene -{ - Q_OBJECT -public: - explicit QAiScene(const aiScene *scene, QAiSceneHandler *handler); - explicit QAiScene(QAiSceneHandler *handler); - virtual ~QAiScene(); - - //load a scene with the current handler - void loadScene(const aiScene*scene); - - QList objects() const; - QGLSceneNode *mainNode() const; - QList animations() const; -private: - QAiLoader * aiLoader() const; - QList m_animations; -protected: - QGLSceneNode *m_root; - QAiLoader *m_aiLoader; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/threed/scene_ai/qaiscene_p.h b/src/threed/scene_ai/qaiscene_p.h new file mode 100644 index 000000000..98d8728a3 --- /dev/null +++ b/src/threed/scene_ai/qaiscene_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QAISCENE_H +#define QAISCENE_H + +#include + +struct aiScene; + +QT_BEGIN_NAMESPACE + +class QGLSceneNode; +class QAiSceneHandler; +class QAiLoader; + +class QAiScene : public QGLAbstractScene +{ + Q_OBJECT +public: + explicit QAiScene(const aiScene *scene, QAiSceneHandler *handler); + explicit QAiScene(QAiSceneHandler *handler); + virtual ~QAiScene(); + + //load a scene with the current handler + void loadScene(const aiScene *scene); + + QList objects() const; + QGLSceneNode *mainNode() const; + QList animations() const; +private: + QAiLoader * aiLoader() const; + QList m_animations; +protected: + QGLSceneNode *m_root; + QAiLoader *m_aiLoader; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/threed/scene_ai/qaiscenehandler.cpp b/src/threed/scene_ai/qaiscenehandler.cpp index 6ab95ef90..704a40bc7 100644 --- a/src/threed/scene_ai/qaiscenehandler.cpp +++ b/src/threed/scene_ai/qaiscenehandler.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "qaiscenehandler.h" -#include "qaiscene.h" +#include "qaiscenehandler_p.h" +#include "qaiscene_p.h" #include "qdownloadmanager.h" -#include "ailoaderiosystem.h" +#include "ailoaderiosystem_p.h" #include "aiScene.h" #include "aiPostProcess.h" diff --git a/src/threed/scene_ai/qaiscenehandler.h b/src/threed/scene_ai/qaiscenehandler.h deleted file mode 100644 index 2118170d7..000000000 --- a/src/threed/scene_ai/qaiscenehandler.h +++ /dev/null @@ -1,116 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the Qt3D module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QAISCENEHANDLER_H -#define QAISCENEHANDLER_H - -#include - -#include "aiPostProcess.h" -#include "assimp.hpp" - -#include -#include - -Q_DECLARE_FLAGS(aiPostProcessFlags, aiPostProcessSteps) -Q_DECLARE_OPERATORS_FOR_FLAGS(aiPostProcessFlags) - - -QT_BEGIN_NAMESPACE - -class QIODevice; - -class QAiSceneHandler : public QGLSceneFormatHandler -{ - Q_OBJECT -public: - enum Options { - NoOptions, - ShowWarnings, // show any warnings while loading the file - CalculateNormals, // replace normals from the file with smooth generated ones - ForceFaceted, // generate non-smooth normals (implies CalculateNormals) - ForceSmooth, // deprecated - retained only for backward compatibility - IncludeAllMaterials, // include even redundant (unused) materials - IncludeLinesPoints, // include even collapsed triangles (lines or points) - FixNormals, // try to fix incorrect (in facing) normals - DeDupMeshes, // replace copied meshes with refs to a single instance - Optimize, // collapse meshes, nodes & scene heierarchies - FlipUVs, // flips UV's on the y-axis (for upside-down textures) - FlipWinding, // makes faces CW instead of CCW - UseVertexColors, // use vertex colors that are in a model - VertexSplitLimitx2, // double the vertex count which will split a large mesh - TriangleSplitLimitx2 // double the triangle count which will split a large mesh - }; - - QAiSceneHandler(); - ~QAiSceneHandler(); - - static QStringList supportedFormats(); - - QGLAbstractScene *read(); - QGLAbstractScene *download(); - - void decodeOptions(const QString &options); - - bool showWarnings() const { return m_showWarnings; } - bool mayHaveLinesPoints() const { return m_mayHaveLinesPoints; } - - aiPostProcessFlags options() const { return m_options; } - quint32 removeComponentFlags() const { return m_removeComponentFlags; } - quint32 removeSortFlags() const { return m_removeSortFlags; } - -public Q_SLOTS: - void downloadComplete(QByteArray *sceneData); - -private: - aiPostProcessFlags m_options; - bool m_showWarnings; - bool m_mayHaveLinesPoints; - int m_meshSplitVertexLimit; - int m_meshSplitTriangleLimit; - Assimp::Importer m_importer; - quint32 m_removeComponentFlags; - quint32 m_removeSortFlags; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/threed/scene_ai/qaiscenehandler_p.h b/src/threed/scene_ai/qaiscenehandler_p.h new file mode 100644 index 000000000..2118170d7 --- /dev/null +++ b/src/threed/scene_ai/qaiscenehandler_p.h @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the Qt3D module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QAISCENEHANDLER_H +#define QAISCENEHANDLER_H + +#include + +#include "aiPostProcess.h" +#include "assimp.hpp" + +#include +#include + +Q_DECLARE_FLAGS(aiPostProcessFlags, aiPostProcessSteps) +Q_DECLARE_OPERATORS_FOR_FLAGS(aiPostProcessFlags) + + +QT_BEGIN_NAMESPACE + +class QIODevice; + +class QAiSceneHandler : public QGLSceneFormatHandler +{ + Q_OBJECT +public: + enum Options { + NoOptions, + ShowWarnings, // show any warnings while loading the file + CalculateNormals, // replace normals from the file with smooth generated ones + ForceFaceted, // generate non-smooth normals (implies CalculateNormals) + ForceSmooth, // deprecated - retained only for backward compatibility + IncludeAllMaterials, // include even redundant (unused) materials + IncludeLinesPoints, // include even collapsed triangles (lines or points) + FixNormals, // try to fix incorrect (in facing) normals + DeDupMeshes, // replace copied meshes with refs to a single instance + Optimize, // collapse meshes, nodes & scene heierarchies + FlipUVs, // flips UV's on the y-axis (for upside-down textures) + FlipWinding, // makes faces CW instead of CCW + UseVertexColors, // use vertex colors that are in a model + VertexSplitLimitx2, // double the vertex count which will split a large mesh + TriangleSplitLimitx2 // double the triangle count which will split a large mesh + }; + + QAiSceneHandler(); + ~QAiSceneHandler(); + + static QStringList supportedFormats(); + + QGLAbstractScene *read(); + QGLAbstractScene *download(); + + void decodeOptions(const QString &options); + + bool showWarnings() const { return m_showWarnings; } + bool mayHaveLinesPoints() const { return m_mayHaveLinesPoints; } + + aiPostProcessFlags options() const { return m_options; } + quint32 removeComponentFlags() const { return m_removeComponentFlags; } + quint32 removeSortFlags() const { return m_removeSortFlags; } + +public Q_SLOTS: + void downloadComplete(QByteArray *sceneData); + +private: + aiPostProcessFlags m_options; + bool m_showWarnings; + bool m_mayHaveLinesPoints; + int m_meshSplitVertexLimit; + int m_meshSplitTriangleLimit; + Assimp::Importer m_importer; + quint32 m_removeComponentFlags; + quint32 m_removeSortFlags; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/threed/scene_ai/scene_ai.pri b/src/threed/scene_ai/scene_ai.pri index 794d990f6..2e384cb83 100644 --- a/src/threed/scene_ai/scene_ai.pri +++ b/src/threed/scene_ai/scene_ai.pri @@ -1,12 +1,12 @@ INCLUDEPATH += $$PWD VPATH += $$PWD HEADERS += \ - scene_ai/qaiscenehandler.h \ - scene_ai/qaiscene.h \ - scene_ai/qaimesh.h \ - scene_ai/qailoader.h \ - scene_ai/ailoaderiosystem.h \ - scene_ai/ailoaderiostream.h + scene_ai/qaiscenehandler_p.h \ + scene_ai/qaiscene_p.h \ + scene_ai/qaimesh_p.h \ + scene_ai/qailoader_p.h \ + scene_ai/ailoaderiosystem_p.h \ + scene_ai/ailoaderiostream_p.h SOURCES += \ scene_ai/qaiscenehandler.cpp \ scene_ai/qaiscene.cpp \ -- cgit v1.2.1