Revert previous glTF fix (e5233283ef) because it breaks ODR as pointed out by @turol, instead just make importer depend on the necessary definitions.

pull/877/head
Alexander Gessler 2016-05-05 19:11:33 +02:00
parent f5327a99ba
commit 0b79d1ebda
5 changed files with 10 additions and 13 deletions

View File

@ -756,19 +756,17 @@ namespace glTF
virtual void AttachToDocument(Document& doc) = 0;
virtual void DetachFromDocument() = 0;
#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT
virtual void WriteObjects(AssetWriter& writer) = 0;
#endif
};
#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT
template<class T>
class LazyDict;
//! (Implemented in glTFAssetWriter.h)
template<class T>
void WriteLazyDict(LazyDict<T>& d, AssetWriter& w);
#endif
//! Manages lazy loading of the glTF top-level objects, and keeps a reference to them by ID
//! It is the owner the loaded objects, so when it is destroyed it also deletes them
@ -790,10 +788,8 @@ namespace glTF
void AttachToDocument(Document& doc);
void DetachFromDocument();
#ifdef GLTF_ASSET_WITH_EXPORT_SUPPORT
void WriteObjects(AssetWriter& writer)
{ WriteLazyDict<T>(*this, writer); }
#endif
Ref<T> Add(T* obj);

View File

@ -48,7 +48,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef glTFAssetWriter_H_INC
#define glTFAssetWriter_H_INC
#define GLTF_ASSET_WITH_EXPORT_SUPPORT
#include "glTFAsset.h"
namespace glTF

View File

@ -305,7 +305,7 @@ namespace glTF {
}
AssetWriter::AssetWriter(Asset& a)
inline AssetWriter::AssetWriter(Asset& a)
: mDoc()
, mAsset(a)
, mAl(mDoc.GetAllocator())
@ -326,7 +326,7 @@ namespace glTF {
}
}
void AssetWriter::WriteFile(const char* path)
inline void AssetWriter::WriteFile(const char* path)
{
bool isBinary = mAsset.extensionsUsed.KHR_binary_glTF;
@ -363,7 +363,7 @@ namespace glTF {
}
}
void AssetWriter::WriteBinaryData(IOStream* outfile, size_t sceneLength)
inline void AssetWriter::WriteBinaryData(IOStream* outfile, size_t sceneLength)
{
//
// write the body data
@ -413,7 +413,7 @@ namespace glTF {
}
void AssetWriter::WriteMetadata()
inline void AssetWriter::WriteMetadata()
{
Value asset;
asset.SetObject();
@ -425,7 +425,7 @@ namespace glTF {
mDoc.AddMember("asset", asset, mAl);
}
void AssetWriter::WriteExtensionsUsed()
inline void AssetWriter::WriteExtensionsUsed()
{
Value exts;
exts.SetArray();

View File

@ -44,6 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_GLTF_EXPORTER
#include "glTFExporter.h"
#include "Exceptional.h"
#include "StringComparison.h"
#include "ByteSwapper.h"
@ -54,7 +55,6 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <assimp/material.h>
#include <assimp/scene.h>
#include <memory>
#include <memory>
#include "glTFAssetWriter.h"

View File

@ -53,6 +53,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "MakeVerboseFormat.h"
#include "glTFAsset.h"
// This is included here so WriteLazyDict<T>'s definition is found.
#include "glTFAssetWriter.h"
using namespace Assimp;
using namespace glTF;