Add WIP version of the BLENDER importer. DO NOT USE FOR PRODUCTION YET!
Loads static meshes. Sometimes (it segfaults on the rest). No materials, cameras, fancy stuff. Works with all versions of blender. No compressed blend files yet. - StreamReader now uses shared_ptr's to manage ownership of the stream. - Adapt other loaders accordingly. git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@717 67173fc5-114c-0410-ac8e-9d2fd5bffc1fpull/1/head
parent
1928dc7df7
commit
32bfa9ac21
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "AssimpPCH.h"
|
||||
|
||||
#ifndef AI_BUILD_NO_AC_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_AC_IMPORTER
|
||||
|
||||
// internal headers
|
||||
#include "ACLoader.h"
|
||||
|
@ -853,4 +853,4 @@ void AC3DImporter::InternReadFile( const std::string& pFile,
|
|||
}
|
||||
}
|
||||
|
||||
#endif //!defined AI_BUILD_NO_AC_IMPORTER
|
||||
#endif //!defined ASSIMP_BUILD_NO_AC_IMPORTER
|
||||
|
|
|
@ -118,6 +118,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <new>
|
||||
#include <cstdio>
|
||||
|
||||
// Boost headers
|
||||
#include <boost/pointer_cast.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/shared_array.hpp>
|
||||
//#include <boost/make_shared.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
// Public ASSIMP headers
|
||||
#include "../include/DefaultLogger.h"
|
||||
#include "../include/IOStream.h"
|
||||
|
@ -133,12 +144,5 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include "StreamReader.h"
|
||||
#include "qnan.h"
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
#include <boost/scoped_array.hpp>
|
||||
#include <boost/format.hpp>
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/static_assert.hpp>
|
||||
|
||||
#endif // !! ASSIMP_PCH_INCLUDED
|
||||
|
|
|
@ -63,25 +63,6 @@ BaseImporter::~BaseImporter()
|
|||
// nothing to do here
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct tinyguard
|
||||
{
|
||||
tinyguard(T* obj) : obj(obj), mdismiss() {}
|
||||
~tinyguard () throw() {if (!mdismiss) {delete obj;} obj = NULL;}
|
||||
|
||||
void dismiss() {
|
||||
mdismiss=true;
|
||||
}
|
||||
|
||||
operator T*() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
private:
|
||||
T* obj;
|
||||
bool mdismiss;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file and returns the imported data.
|
||||
aiScene* BaseImporter::ReadFile( const std::string& pFile, IOSystem* pIOHandler)
|
||||
|
@ -90,7 +71,7 @@ aiScene* BaseImporter::ReadFile( const std::string& pFile, IOSystem* pIOHandler)
|
|||
FileSystemFilter filter(pFile,pIOHandler);
|
||||
|
||||
// create a scene object to hold the data
|
||||
tinyguard<aiScene> sc(new aiScene());
|
||||
ScopeGuard<aiScene> sc(new aiScene());
|
||||
|
||||
// dispatch importing
|
||||
try
|
||||
|
|
|
@ -58,6 +58,35 @@ class Importer;
|
|||
#define AI_MAKE_MAGIC(string) ((uint32_t)((string[0] << 24) + \
|
||||
(string[1] << 16) + (string[2] << 8) + string[3]))
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
template <typename T>
|
||||
struct ScopeGuard
|
||||
{
|
||||
ScopeGuard(T* obj) : obj(obj), mdismiss() {}
|
||||
~ScopeGuard () throw() {
|
||||
if (!mdismiss) {
|
||||
delete obj;
|
||||
}
|
||||
obj = NULL;
|
||||
}
|
||||
|
||||
T* dismiss() {
|
||||
mdismiss=true;
|
||||
return obj;
|
||||
}
|
||||
|
||||
operator T*() {
|
||||
return obj;
|
||||
}
|
||||
|
||||
T* operator -> () {
|
||||
return obj;
|
||||
}
|
||||
|
||||
private:
|
||||
T* obj;
|
||||
bool mdismiss;
|
||||
};
|
||||
|
||||
//! @cond never
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
@ -0,0 +1,359 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderDNA.cpp
|
||||
* @brief Implementation of the Blender `DNA`, that is its own
|
||||
* serialized set of data structures.
|
||||
*/
|
||||
#include "AssimpPCH.h"
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
|
||||
#include "BlenderDNA.h"
|
||||
#include "StreamReader.h"
|
||||
#include "fast_atof.h"
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace Assimp::Blender;
|
||||
using namespace Assimp::Formatter;
|
||||
|
||||
#define for_each BOOST_FOREACH
|
||||
bool match4(StreamReaderAny& stream, const char* string) {
|
||||
char tmp[] = {
|
||||
(stream).GetI1(),
|
||||
(stream).GetI1(),
|
||||
(stream).GetI1(),
|
||||
(stream).GetI1()
|
||||
};
|
||||
return (tmp[0]==string[0] && tmp[1]==string[1] && tmp[2]==string[2] && tmp[3]==string[3]);
|
||||
}
|
||||
|
||||
struct Type {
|
||||
size_t size;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DNAParser :: Parse ()
|
||||
{
|
||||
StreamReaderAny& stream = *db.reader.get();
|
||||
DNA& dna = db.dna;
|
||||
|
||||
if(!match4(stream,"SDNA")) {
|
||||
throw DeadlyImportError("BlenderDNA: Expected SDNA chunk");
|
||||
}
|
||||
|
||||
// name dictionary
|
||||
if(!match4(stream,"NAME")) {
|
||||
throw DeadlyImportError("BlenderDNA: Expected NAME field");
|
||||
}
|
||||
|
||||
std::vector<std::string> names (stream.GetI4());
|
||||
for_each(std::string& s, names) {
|
||||
while (char c = stream.GetI1()) {
|
||||
s += c;
|
||||
}
|
||||
}
|
||||
|
||||
// type dictionary
|
||||
for (;stream.GetCurrentPos() & 0x3; stream.GetI1());
|
||||
if(!match4(stream,"TYPE")) {
|
||||
throw DeadlyImportError("BlenderDNA: Expected TYPE field");
|
||||
}
|
||||
|
||||
std::vector<Type> types (stream.GetI4());
|
||||
for_each(Type& s, types) {
|
||||
while (char c = stream.GetI1()) {
|
||||
s.name += c;
|
||||
}
|
||||
}
|
||||
|
||||
// type length dictionary
|
||||
for (;stream.GetCurrentPos() & 0x3; stream.GetI1());
|
||||
if(!match4(stream,"TLEN")) {
|
||||
throw DeadlyImportError("BlenderDNA: Expected TLEN field");
|
||||
}
|
||||
|
||||
for_each(Type& s, types) {
|
||||
s.size = stream.GetI2();
|
||||
}
|
||||
|
||||
// structures dictionary
|
||||
for (;stream.GetCurrentPos() & 0x3; stream.GetI1());
|
||||
if(!match4(stream,"STRC")) {
|
||||
throw DeadlyImportError("BlenderDNA: Expected STRC field");
|
||||
}
|
||||
|
||||
size_t end = stream.GetI4(), fields = 0;
|
||||
|
||||
dna.structures.reserve(end);
|
||||
for(size_t i = 0; i != end; ++i) {
|
||||
|
||||
uint16_t n = stream.GetI2();
|
||||
if (n >= types.size()) {
|
||||
throw DeadlyImportError((format(),
|
||||
"BlenderDNA: Invalid type index in structure name" ,n,
|
||||
" (there are only ", types.size(), " entries)"
|
||||
));
|
||||
}
|
||||
|
||||
// maintain separate indexes
|
||||
dna.indices[types[n].name] = dna.structures.size();
|
||||
|
||||
dna.structures.push_back(Structure());
|
||||
Structure& s = dna.structures.back();
|
||||
s.name = types[n].name;
|
||||
//s.index = dna.structures.size()-1;
|
||||
|
||||
n = stream.GetI2();
|
||||
s.fields.reserve(n);
|
||||
|
||||
size_t offset = 0;
|
||||
for (size_t m = 0; m < n; ++m, ++fields) {
|
||||
|
||||
uint16_t j = stream.GetI2();
|
||||
if (j >= types.size()) {
|
||||
throw DeadlyImportError((format(),
|
||||
"BlenderDNA: Invalid type index in structure field ", j,
|
||||
" (there are only ", types.size(), " entries)"
|
||||
));
|
||||
}
|
||||
s.fields.push_back(Field());
|
||||
Field& f = s.fields.back();
|
||||
f.offset = offset;
|
||||
|
||||
f.type = types[j].name;
|
||||
f.size = types[j].size;
|
||||
|
||||
j = stream.GetI2();
|
||||
if (j >= names.size()) {
|
||||
throw DeadlyImportError((format(),
|
||||
"BlenderDNA: Invalid name index in structure field ", j,
|
||||
" (there are only ", names.size(), " entries)"
|
||||
));
|
||||
}
|
||||
|
||||
f.name = names[j];
|
||||
f.flags = 0u;
|
||||
|
||||
// pointers always specify the size of the pointee instead of their own.
|
||||
// The pointer asterisk remains a property of the lookup name.
|
||||
if (f.name[0] == '*') {
|
||||
f.size = db.i64bit ? 8 : 4;
|
||||
f.flags |= FieldFlag_Pointer;
|
||||
}
|
||||
|
||||
// arrays, however, specify the size of a single element so we
|
||||
// need to parse the (possibly multi-dimensional) array declaration
|
||||
// in order to obtain the actual size of the array in the file.
|
||||
// Also we need to alter the lookup name to include no array
|
||||
// brackets anymore or size fixup won't work (if our size does
|
||||
// not match the size read from the DNA).
|
||||
if (*f.name.rbegin() == ']') {
|
||||
const std::string::size_type rb = f.name.find('[');
|
||||
if (rb == std::string::npos) {
|
||||
throw DeadlyImportError((format(),
|
||||
"BlenderDNA: Encountered invalid array declaration ",
|
||||
f.name
|
||||
));
|
||||
}
|
||||
|
||||
f.flags |= FieldFlag_Array;
|
||||
DNA::ExtractArraySize(f.name,f.array_sizes);
|
||||
f.name = f.name.substr(0,rb);
|
||||
|
||||
f.size *= f.array_sizes[0] * f.array_sizes[1];
|
||||
}
|
||||
|
||||
// maintain separate indexes
|
||||
s.indices[f.name] = s.fields.size()-1;
|
||||
offset += f.size;
|
||||
}
|
||||
s.size = offset;
|
||||
}
|
||||
|
||||
DefaultLogger::get()->debug((format(),"BlenderDNA: Got ",dna.structures.size(),
|
||||
" structures with totally ",fields," fields"));
|
||||
|
||||
#ifdef ASSIMP_BUILD_BLENDER_DEBUG
|
||||
dna.DumpToFile();
|
||||
#endif
|
||||
|
||||
dna.AddPrimitiveStructures();
|
||||
dna.RegisterConverters();
|
||||
}
|
||||
|
||||
|
||||
#ifdef ASSIMP_BUILD_BLENDER_DEBUG
|
||||
|
||||
#include <fstream>
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DNA :: DumpToFile()
|
||||
{
|
||||
// we dont't bother using the VFS here for this is only for debugging.
|
||||
// (and all your bases are belong to us).
|
||||
|
||||
std::ofstream f("dna.txt");
|
||||
if (f.fail()) {
|
||||
DefaultLogger::get()->error("Could not dump dna to dna.txt");
|
||||
return;
|
||||
}
|
||||
f << "Field format: type name offset size" << "\n";
|
||||
f << "Structure format: name size" << "\n";
|
||||
|
||||
for_each(const Structure& s, structures) {
|
||||
f << s.name << " " << s.size << "\n\n";
|
||||
for_each(const Field& ff, s.fields) {
|
||||
f << "\t" << ff.type << " " << ff.name << " " << ff.offset << " " << ff.size << std::endl;
|
||||
}
|
||||
f << std::endl;
|
||||
}
|
||||
DefaultLogger::get()->info("BlenderDNA: Dumped dna to dna.txt");
|
||||
}
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/*static*/ void DNA :: ExtractArraySize(
|
||||
const std::string& out,
|
||||
size_t array_sizes[2]
|
||||
)
|
||||
{
|
||||
array_sizes[0] = array_sizes[1] = 1;
|
||||
std::string::size_type pos = out.find('[');
|
||||
if (pos++ == std::string::npos) {
|
||||
return;
|
||||
}
|
||||
array_sizes[0] = strtol10(&out[pos]);
|
||||
|
||||
pos = out.find('[',pos);
|
||||
if (pos++ == std::string::npos) {
|
||||
return;
|
||||
}
|
||||
array_sizes[1] = strtol10(&out[pos]);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
boost::shared_ptr< ElemBase > DNA :: ConvertBlobToStructure(
|
||||
const Structure& structure,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
std::map<std::string, ConvertProcPtr>::const_iterator it = converters.find(structure.name);
|
||||
if (it == converters.end()) {
|
||||
return boost::shared_ptr< ElemBase >();
|
||||
}
|
||||
|
||||
return (structure.*((*it).second))(db);
|
||||
}
|
||||
|
||||
// basing on http://www.blender.org/development/architecture/notes-on-sdna/
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void DNA :: AddPrimitiveStructures()
|
||||
{
|
||||
// NOTE: these are just dummies. Their presence enforces
|
||||
// Structure::Convert<target_type> to be called on these
|
||||
// empty structures. These converters are special
|
||||
// overloads which scan the name of the structure and
|
||||
// perform the required data type conversion if one
|
||||
// of these special names is found in the structure
|
||||
// in question.
|
||||
|
||||
indices["int"] = structures.size();
|
||||
structures.push_back( Structure() );
|
||||
structures.back().name = "int";
|
||||
structures.back().size = 4;
|
||||
|
||||
indices["short"] = structures.size();
|
||||
structures.push_back( Structure() );
|
||||
structures.back().name = "short";
|
||||
structures.back().size = 2;
|
||||
|
||||
|
||||
indices["char"] = structures.size();
|
||||
structures.push_back( Structure() );
|
||||
structures.back().name = "char";
|
||||
structures.back().size = 1;
|
||||
|
||||
|
||||
indices["float"] = structures.size();
|
||||
structures.push_back( Structure() );
|
||||
structures.back().name = "float";
|
||||
structures.back().size = 4;
|
||||
|
||||
|
||||
indices["double"] = structures.size();
|
||||
structures.push_back( Structure() );
|
||||
structures.back().name = "double";
|
||||
structures.back().size = 8;
|
||||
|
||||
// no long, seemingly.
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void SectionParser :: Next()
|
||||
{
|
||||
stream.SetCurrentPos(current.start + current.size);
|
||||
|
||||
const char tmp[] = {
|
||||
stream.GetI1(),
|
||||
stream.GetI1(),
|
||||
stream.GetI1(),
|
||||
stream.GetI1()
|
||||
};
|
||||
current.id = std::string(tmp,tmp[3]?4:tmp[2]?3:tmp[1]?2:1);
|
||||
|
||||
current.size = stream.GetI4();
|
||||
current.address.val = ptr64 ? stream.GetU8() : stream.GetU4();
|
||||
|
||||
current.dna_index = stream.GetI4();
|
||||
current.num = stream.GetI4();
|
||||
|
||||
current.start = stream.GetCurrentPos();
|
||||
if (stream.GetRemainingSizeToLimit() < current.size) {
|
||||
throw DeadlyImportError("BLEND: invalid size of file block");
|
||||
}
|
||||
|
||||
#ifdef ASSIMP_BUILD_BLENDER_DEBUG
|
||||
DefaultLogger::get()->debug(current.id);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,712 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderDNA.h
|
||||
* @brief Blender `DNA` (file format specification embedded in
|
||||
* blend file itself) loader.
|
||||
*/
|
||||
#ifndef INCLUDED_AI_BLEND_DNA_H
|
||||
#define INCLUDED_AI_BLEND_DNA_H
|
||||
|
||||
#include "BaseImporter.h"
|
||||
#include "TinyFormatter.h"
|
||||
|
||||
// enable verbose log output. really verbose, so be careful.
|
||||
#ifdef _DEBUG
|
||||
# define ASSIMP_BUILD_BLENDER_DEBUG
|
||||
#endif
|
||||
|
||||
// #define ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
|
||||
namespace Assimp {
|
||||
template <bool,bool> class StreamReader;
|
||||
typedef StreamReader<true,true> StreamReaderAny;
|
||||
|
||||
namespace Blender {
|
||||
class FileDatabase;
|
||||
struct FileBlockHead;
|
||||
|
||||
template <template <typename> class TOUT>
|
||||
class ObjectCache;
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Exception class used by the blender loader to selectively catch exceptions
|
||||
* thrown in its own code (DeadlyImportErrors thrown in general utility
|
||||
* functions are untouched then). If such an exception is not caught by
|
||||
* the loader itself, it will still be caught by Assimp due to its
|
||||
* ancestry. */
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Error : DeadlyImportError
|
||||
{
|
||||
Error (const std::string& s)
|
||||
: DeadlyImportError(s)
|
||||
{}
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** The only purpose of this structure is to feed a virtual dtor into its
|
||||
* descendents. It serves as base class for all data structure fields. */
|
||||
// -------------------------------------------------------------------------------
|
||||
struct ElemBase
|
||||
{
|
||||
virtual ~ElemBase() {}
|
||||
|
||||
/** Type name of the element. The type
|
||||
* string points is the `c_str` of the `name` attribute of the
|
||||
* corresponding `Structure`, that is, it is only valid as long
|
||||
* as the DNA is not modified. The dna_type is only set if the
|
||||
* data type is not static, i.e. a boost::shared_ptr<ElemBase>
|
||||
* in the scene description would have its type resolved
|
||||
* at runtime. */
|
||||
const char* dna_type;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Represents a generic pointer to a memory location, which can be either 32
|
||||
* or 64 bits. These pointers are loaded from the BLEND file and finally
|
||||
* fixed to point to the real, converted representation of the objects
|
||||
* they used to point to.*/
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Pointer
|
||||
{
|
||||
Pointer() : val() {}
|
||||
uint64_t val;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Mixed flags for use in #Field */
|
||||
// -------------------------------------------------------------------------------
|
||||
enum FieldFlags
|
||||
{
|
||||
FieldFlag_Pointer = 0x1,
|
||||
FieldFlag_Array = 0x2
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Represents a single member of a data structure in a BLEND file */
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Field
|
||||
{
|
||||
std::string name;
|
||||
std::string type;
|
||||
|
||||
size_t size;
|
||||
size_t offset;
|
||||
|
||||
/** Size of each array dimension. For flat arrays,
|
||||
* the second dimension is set to 1. */
|
||||
size_t array_sizes[2];
|
||||
|
||||
/** Any of the #FieldFlags enumerated values */
|
||||
unsigned int flags;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Range of possible behaviours for fields absend in the input file. Some are
|
||||
* mission critical so we need them, while others can silently be default
|
||||
* initialized and no animations are harmed. */
|
||||
// -------------------------------------------------------------------------------
|
||||
enum ErrorPolicy
|
||||
{
|
||||
/** Substitute default value and ignore */
|
||||
ErrorPolicy_Igno,
|
||||
/** Substitute default value and write to log */
|
||||
ErrorPolicy_Warn,
|
||||
/** Substitute a massive error message and crash the whole matrix. Its time for another zion */
|
||||
ErrorPolicy_Fail
|
||||
};
|
||||
|
||||
#ifdef ASSIMP_BUILD_BLENDER_DEBUG
|
||||
# define ErrorPolicy_Igno ErrorPolicy_Warn
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Represents a data structure in a BLEND file. A Structure defines n fields
|
||||
* and their locatios and encodings the input stream. Usually, every
|
||||
* Structure instance pertains to one equally-named data structure in the
|
||||
* BlenderScene.h header. This class defines various utilities to map a
|
||||
* binary `blob` read from the file to such a structure instance with
|
||||
* meaningful contents. */
|
||||
// -------------------------------------------------------------------------------
|
||||
class Structure
|
||||
{
|
||||
template <template <typename> class> friend class ObjectCache;
|
||||
|
||||
public:
|
||||
|
||||
Structure()
|
||||
: cache_idx(-1)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
// publicly accessible members
|
||||
std::string name;
|
||||
std::vector< Field > fields;
|
||||
std::map<std::string, size_t> indices;
|
||||
|
||||
size_t size;
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Access a field of the structure by its canonical name */
|
||||
inline const Field& operator [] (const std::string& ss) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Access a field of the structure by its index */
|
||||
inline const Field& operator [] (const size_t i) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
inline bool operator== (const Structure& other) const {
|
||||
return name == other.name; // name is meant to be an unique identifier
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
inline bool operator!= (const Structure& other) const {
|
||||
return name != other.name;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Try to read an instance of the structure from the stream
|
||||
* and attempt to convert to `T`. This is done by
|
||||
* an appropriate specialization. If none is available,
|
||||
* a compiler complain is the result.
|
||||
* @param dest Destination value to be written
|
||||
* @param db File database, including input stream. */
|
||||
template <typename T> inline void Convert (T& dest,
|
||||
const FileDatabase& db) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
template <typename T>
|
||||
boost::shared_ptr<ElemBase> Convert(
|
||||
const FileDatabase& db) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
// field parsing for 1d arrays
|
||||
template <int error_policy, typename T, size_t M>
|
||||
void ReadFieldArray(T (& out)[M], const char* name,
|
||||
const FileDatabase& db) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
// field parsing for 2d arrays
|
||||
template <int error_policy, typename T, size_t M, size_t N>
|
||||
void ReadFieldArray2(T (& out)[M][N], const char* name,
|
||||
const FileDatabase& db) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
// field parsing for pointer or dynamic array types
|
||||
// (boost::shared_ptr or boost::shared_array)
|
||||
template <int error_policy, template <typename> class TOUT, typename T>
|
||||
void ReadFieldPtr(TOUT<T>& out, const char* name,
|
||||
const FileDatabase& db) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
// field parsing for `normal` values
|
||||
template <int error_policy, typename T>
|
||||
void ReadField(T& out, const char* name,
|
||||
const FileDatabase& db) const;
|
||||
|
||||
private:
|
||||
|
||||
// --------------------------------------------------------
|
||||
template <template <typename> class TOUT, typename T>
|
||||
void ResolvePointer(TOUT<T>& out, const Pointer & ptrval,
|
||||
const FileDatabase& db, const Field& f) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
inline const FileBlockHead* LocateFileBlockForAddress(
|
||||
const Pointer & ptrval,
|
||||
const FileDatabase& db) const;
|
||||
|
||||
private:
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
template <typename T> void _allocate(boost::shared_ptr<T>& out, size_t& s) const {
|
||||
out = boost::shared_ptr<T>(new T());
|
||||
s = 1;
|
||||
}
|
||||
|
||||
template <typename T> void _allocate(boost::shared_array<T>& out, size_t& s) const {
|
||||
out = boost::shared_array<T>(new T[s]);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------
|
||||
template <int error_policy>
|
||||
struct _defaultInitializer {
|
||||
|
||||
template <typename T, unsigned int N>
|
||||
void operator ()(T (& out)[N], const char* = NULL) {
|
||||
for (unsigned int i = 0; i < N; ++i) {
|
||||
out[i] = T();
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T, unsigned int N, unsigned int M>
|
||||
void operator ()(T (& out)[N][M], const char* = NULL) {
|
||||
for (unsigned int i = 0; i < N; ++i) {
|
||||
for (unsigned int j = 0; j < M; ++j) {
|
||||
out[i][j] = T();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void operator ()(T& out, const char* = NULL) {
|
||||
out = T();
|
||||
}
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
mutable size_t cache_idx;
|
||||
};
|
||||
|
||||
// --------------------------------------------------------
|
||||
template <> struct Structure :: _defaultInitializer<ErrorPolicy_Warn> {
|
||||
|
||||
template <typename T>
|
||||
void operator ()(T& out, const char* reason = "<add reason>") {
|
||||
DefaultLogger::get()->warn(reason);
|
||||
|
||||
// ... and let the show go on
|
||||
_defaultInitializer<0 /*ErrorPolicy_Igno*/>()(out);
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct Structure :: _defaultInitializer<ErrorPolicy_Fail> {
|
||||
|
||||
template <typename T>
|
||||
void operator ()(T& out,const char* = "") {
|
||||
// obviously, it is crucial that _DefaultInitializer is used
|
||||
// only from within a catch clause.
|
||||
throw;
|
||||
}
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
template <> inline void Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::shared_ptr<ElemBase>& out,
|
||||
const Pointer & ptrval,
|
||||
const FileDatabase& db,
|
||||
const Field& f
|
||||
) const;
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Represents the full data structure information for a single BLEND file.
|
||||
* This data is extracted from the DNA1 chunk in the file.
|
||||
* #DNAParser does the reading and represents currently the only place where
|
||||
* DNA is altered.*/
|
||||
// -------------------------------------------------------------------------------
|
||||
class DNA
|
||||
{
|
||||
public:
|
||||
|
||||
typedef boost::shared_ptr<ElemBase> (Structure::*ConvertProcPtr) (const FileDatabase& ) const;
|
||||
|
||||
std::map<std::string, ConvertProcPtr> converters;
|
||||
std::vector<Structure > structures;
|
||||
std::map<std::string, size_t> indices;
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Access a structure by its canonical name */
|
||||
inline const Structure& operator [] (const std::string& ss) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Access a structure by its index */
|
||||
inline const Structure& operator [] (const size_t i) const;
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Add structure definitions for all the primitive types,
|
||||
* i.e. integer, short, char, float */
|
||||
void AddPrimitiveStructures();
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Fill the @c converters member with converters for all
|
||||
* known data types. The implementation of this method is
|
||||
* in BlenderScene.cpp and is machine-generated.
|
||||
* Converters are used to quickly handle objects whose
|
||||
* exact data type is a runtime-property and not yet
|
||||
* known at compile time (consier Object::data).*/
|
||||
void RegisterConverters();
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Take an input blob, interpret it according to a its structure name and
|
||||
* convert it to the intermediate representation.
|
||||
* @param structure Destination structure definition
|
||||
* @param db File database.
|
||||
* @return A null pointer if no appropriate converter is available.*/
|
||||
boost::shared_ptr< ElemBase > ConvertBlobToStructure(
|
||||
const Structure& structure,
|
||||
const FileDatabase& db
|
||||
) const;
|
||||
|
||||
|
||||
#ifdef ASSIMP_BUILD_BLENDER_DEBUG
|
||||
// --------------------------------------------------------
|
||||
/** Dump the DNA to a text file. This is for debugging purposes.
|
||||
* The output file is `dna.txt` in the current working folder*/
|
||||
void DumpToFile();
|
||||
#endif
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Extract array dimensions from a C array declaration, such
|
||||
* as `...[4][6]`. Returned string would be `...[][]`.
|
||||
* @param out
|
||||
* @param array_sizes Receive maximally two array dimensions,
|
||||
* the second element is set to 1 if the array is flat.
|
||||
* Both are set to 1 if the input is not an array.
|
||||
* @throw DeadlyImportError if more than 2 dimensions are
|
||||
* encountered. */
|
||||
static void ExtractArraySize(
|
||||
const std::string& out,
|
||||
size_t array_sizes[2]
|
||||
);
|
||||
};
|
||||
|
||||
// special converters for primitive types
|
||||
template <> inline void Structure :: Convert<int> (int& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<short> (short& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<char> (char& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<float> (float& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<double> (double& dest,const FileDatabase& db) const;
|
||||
template <> inline void Structure :: Convert<Pointer> (Pointer& dest,const FileDatabase& db) const;
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Describes a master file block header. Each master file sections holds n
|
||||
* elements of a certain SDNA structure (or otherwise unspecified data). */
|
||||
// -------------------------------------------------------------------------------
|
||||
struct FileBlockHead
|
||||
{
|
||||
// points right after the header of the file block
|
||||
StreamReaderAny::pos start;
|
||||
|
||||
std::string id;
|
||||
size_t size;
|
||||
|
||||
// original memory address of the data
|
||||
Pointer address;
|
||||
|
||||
// index into DNA
|
||||
unsigned int dna_index;
|
||||
|
||||
// number of structure instances to follow
|
||||
size_t num;
|
||||
|
||||
|
||||
|
||||
// file blocks are sorted by address to quickly locate specific memory addresses
|
||||
bool operator < (const FileBlockHead& o) const {
|
||||
return address.val < o.address.val;
|
||||
}
|
||||
|
||||
// for std::upper_bound
|
||||
operator const Pointer& () const {
|
||||
return address;
|
||||
}
|
||||
};
|
||||
|
||||
// for std::upper_bound
|
||||
inline bool operator< (const Pointer& a, const Pointer& b) {
|
||||
return a.val < b.val;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Utility to read all master file blocks in turn. */
|
||||
// -------------------------------------------------------------------------------
|
||||
class SectionParser
|
||||
{
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** @param stream Inout stream, must point to the
|
||||
* first section in the file. Call Next() once
|
||||
* to have it read.
|
||||
* @param ptr64 Pointer size in file is 64 bits? */
|
||||
SectionParser(StreamReaderAny& stream,bool ptr64)
|
||||
: stream(stream)
|
||||
, ptr64(ptr64)
|
||||
{
|
||||
current.size = current.start = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
const FileBlockHead& GetCurrent() const {
|
||||
return current;
|
||||
}
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Advance to the next section.
|
||||
* @throw DeadlyImportError if the last chunk was passed. */
|
||||
void Next();
|
||||
|
||||
public:
|
||||
|
||||
FileBlockHead current;
|
||||
StreamReaderAny& stream;
|
||||
bool ptr64;
|
||||
};
|
||||
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Import statistics, i.e. number of file blocks read*/
|
||||
// -------------------------------------------------------------------------------
|
||||
class Statistics {
|
||||
|
||||
public:
|
||||
|
||||
Statistics ()
|
||||
: fields_read ()
|
||||
, pointers_resolved ()
|
||||
, cache_hits ()
|
||||
// , blocks_read ()
|
||||
, cached_objects ()
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
/** total number of fields we read */
|
||||
unsigned int fields_read;
|
||||
|
||||
/** total number of resolved pointers */
|
||||
unsigned int pointers_resolved;
|
||||
|
||||
/** number of pointers resolved from the cache */
|
||||
unsigned int cache_hits;
|
||||
|
||||
/** number of blocks (from FileDatabase::entries)
|
||||
we did actually read from. */
|
||||
// unsigned int blocks_read;
|
||||
|
||||
/** objects in FileData::cache */
|
||||
unsigned int cached_objects;
|
||||
};
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** The object cache - all objects addressed by pointers are added here. This
|
||||
* avoids circular references and avoids object duplication. */
|
||||
// -------------------------------------------------------------------------------
|
||||
template <template <typename> class TOUT>
|
||||
class ObjectCache
|
||||
{
|
||||
public:
|
||||
|
||||
typedef std::map< Pointer, TOUT<ElemBase> > StructureCache;
|
||||
|
||||
public:
|
||||
|
||||
ObjectCache(const FileDatabase& db)
|
||||
: db(db)
|
||||
{
|
||||
// currently there are only ~400 structure records per blend file.
|
||||
// we read only a small part of them and don't cache objects
|
||||
// which we don't need, so this should suffice.
|
||||
caches.reserve(64);
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Check whether a specific item is in the cache.
|
||||
* @param s Data type of the item
|
||||
* @param out Output pointer. Unchanged if the
|
||||
* cache doens't know the item yet.
|
||||
* @param ptr Item address to look for. */
|
||||
template <typename T> void get (
|
||||
const Structure& s,
|
||||
TOUT<T>& out,
|
||||
const Pointer& ptr) const;
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Add an item to the cache after the item has
|
||||
* been fully read. Do not insert anything that
|
||||
* may be faulty or might cause the loading
|
||||
* to abort.
|
||||
* @param s Data type of the item
|
||||
* @param out Item to insert into the cache
|
||||
* @param ptr address (cache key) of the item. */
|
||||
template <typename T> void set
|
||||
(const Structure& s,
|
||||
const TOUT<T>& out,
|
||||
const Pointer& ptr);
|
||||
|
||||
private:
|
||||
|
||||
mutable std::vector<StructureCache> caches;
|
||||
const FileDatabase& db;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
template <> class ObjectCache<boost::shared_array>
|
||||
{
|
||||
public:
|
||||
|
||||
ObjectCache(const FileDatabase&) {}
|
||||
void get(...) {}
|
||||
void set(...) {}
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(disable:4355)
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Memory representation of a full BLEND file and all its dependencies. The
|
||||
* output aiScene is constructed from an instance of this data structure. */
|
||||
// -------------------------------------------------------------------------------
|
||||
class FileDatabase
|
||||
{
|
||||
template <template <typename> class TOUT> friend class ObjectCache;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
FileDatabase()
|
||||
: next_cache_idx()
|
||||
, _cacheArrays(*this)
|
||||
, _cache(*this)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
// publicly accessible fields
|
||||
bool i64bit;
|
||||
bool little;
|
||||
|
||||
DNA dna;
|
||||
boost::shared_ptr< StreamReaderAny > reader;
|
||||
std::vector< FileBlockHead > entries;
|
||||
|
||||
public:
|
||||
|
||||
Statistics& stats() const {
|
||||
return _stats;
|
||||
}
|
||||
|
||||
// For all our templates to work on both shared_ptr's and shared_array's
|
||||
// using the same code, a dummy cache for arrays is provided. Actually,
|
||||
// arrays of objects are never cached because we can't easily
|
||||
// ensure their proper destruction.
|
||||
template <typename T>
|
||||
ObjectCache<boost::shared_ptr>& cache(boost::shared_ptr<T>& in) const {
|
||||
return _cache;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
ObjectCache<boost::shared_array>& cache(boost::shared_array<T>& in) const {
|
||||
return _cacheArrays;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
mutable Statistics _stats;
|
||||
#endif
|
||||
|
||||
mutable ObjectCache<boost::shared_array> _cacheArrays;
|
||||
mutable ObjectCache<boost::shared_ptr> _cache;
|
||||
|
||||
mutable size_t next_cache_idx;
|
||||
};
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(default:4355)
|
||||
#endif
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
/** Factory to extract a #DNA from the DNA1 file block in a BLEND file. */
|
||||
// -------------------------------------------------------------------------------
|
||||
class DNAParser
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/** Bind the parser to a empty DNA and an input stream */
|
||||
DNAParser(FileDatabase& db)
|
||||
: db(db)
|
||||
{}
|
||||
|
||||
public:
|
||||
|
||||
// --------------------------------------------------------
|
||||
/** Locate the DNA in the file and parse it. The input
|
||||
* stream is expected to point to the beginning of the DN1
|
||||
* chunk at the time this method is called and is
|
||||
* undefined afterwards.
|
||||
* @throw DeadlyImportError if the DNA cannot be read.
|
||||
* @note The position of the stream pointer is undefined
|
||||
* afterwards.*/
|
||||
void Parse ();
|
||||
|
||||
public:
|
||||
|
||||
/** Obtain a reference to the extracted DNA information */
|
||||
const Blender::DNA& GetDNA() const {
|
||||
return db.dna;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
FileDatabase& db;
|
||||
};
|
||||
|
||||
} // end Blend
|
||||
} // end Assimp
|
||||
|
||||
#include "BlenderDNA.inl"
|
||||
|
||||
#endif
|
|
@ -0,0 +1,562 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderDNA.inl
|
||||
* @brief Blender `DNA` (file format specification embedded in
|
||||
* blend file itself) loader.
|
||||
*/
|
||||
#ifndef INCLUDED_AI_BLEND_DNA_INL
|
||||
#define INCLUDED_AI_BLEND_DNA_INL
|
||||
|
||||
namespace Assimp {
|
||||
namespace Blender {
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
const Field& Structure :: operator [] (const std::string& ss) const
|
||||
{
|
||||
std::map<std::string, size_t>::const_iterator it = indices.find(ss);
|
||||
if (it == indices.end()) {
|
||||
throw Error((Formatter::format(),
|
||||
"BlendDNA: Did not find a field named `",ss,"` in structure `",name,"`"
|
||||
));
|
||||
}
|
||||
|
||||
return fields[(*it).second];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
const Field& Structure :: operator [] (const size_t i) const
|
||||
{
|
||||
if (i >= fields.size()) {
|
||||
throw Error((Formatter::format(),
|
||||
"BlendDNA: There is no field with index `",i,"` in structure `",name,"`"
|
||||
));
|
||||
}
|
||||
|
||||
return fields[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <typename T> boost::shared_ptr<ElemBase> Structure :: Convert(
|
||||
const FileDatabase& db) const
|
||||
{
|
||||
// FIXME: use boost::make_shared
|
||||
boost::shared_ptr<T> s = boost::shared_ptr<T>(new T());
|
||||
Convert<T> (*s.get(),db);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <int error_policy, typename T, size_t M>
|
||||
void Structure :: ReadFieldArray(T (& out)[M], const char* name, const FileDatabase& db) const
|
||||
{
|
||||
const StreamReaderAny::pos old = db.reader->GetCurrentPos();
|
||||
try {
|
||||
const Field& f = (*this)[name];
|
||||
const Structure& s = db.dna[f.type];
|
||||
|
||||
// is the input actually an array?
|
||||
if (!(f.flags & FieldFlag_Array)) {
|
||||
throw Error((Formatter::format(),"Field `",name,"` of structure `",
|
||||
this->name,"` ought to be an array of size ",M
|
||||
));
|
||||
}
|
||||
|
||||
db.reader->IncPtr(f.offset);
|
||||
|
||||
// size conversions are always allowed, regardless of error_policy
|
||||
unsigned int i = 0;
|
||||
for(; i < std::min(f.array_sizes[0],M); ++i) {
|
||||
s.Convert(out[i],db);
|
||||
}
|
||||
for(; i < M; ++i) {
|
||||
_defaultInitializer<ErrorPolicy_Igno>()(out[i]);
|
||||
}
|
||||
}
|
||||
catch (const Error& e) {
|
||||
_defaultInitializer<error_policy>()(out,e.what());
|
||||
}
|
||||
|
||||
// and recover the previous stream position
|
||||
db.reader->SetCurrentPos(old);
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
++db.stats().fields_read;
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <int error_policy, typename T, size_t M, size_t N>
|
||||
void Structure :: ReadFieldArray2(T (& out)[M][N], const char* name, const FileDatabase& db) const
|
||||
{
|
||||
const StreamReaderAny::pos old = db.reader->GetCurrentPos();
|
||||
try {
|
||||
const Field& f = (*this)[name];
|
||||
const Structure& s = db.dna[f.type];
|
||||
|
||||
// is the input actually an array?
|
||||
if (!(f.flags & FieldFlag_Array)) {
|
||||
throw Error((Formatter::format(),"Field `",name,"` of structure `",
|
||||
this->name,"` ought to be an array of size ",M,"*",N
|
||||
));
|
||||
}
|
||||
|
||||
db.reader->IncPtr(f.offset);
|
||||
|
||||
// size conversions are always allowed, regardless of error_policy
|
||||
unsigned int i = 0;
|
||||
for(; i < std::min(f.array_sizes[0],M); ++i) {
|
||||
unsigned int j = 0;
|
||||
for(; j < std::min(f.array_sizes[1],N); ++j) {
|
||||
s.Convert(out[i][j],db);
|
||||
}
|
||||
for(; j < N; ++j) {
|
||||
_defaultInitializer<ErrorPolicy_Igno>()(out[i][j]);
|
||||
}
|
||||
}
|
||||
for(; i < M; ++i) {
|
||||
_defaultInitializer<ErrorPolicy_Igno>()(out[i]);
|
||||
}
|
||||
}
|
||||
catch (const Error& e) {
|
||||
_defaultInitializer<error_policy>()(out,e.what());
|
||||
}
|
||||
|
||||
// and recover the previous stream position
|
||||
db.reader->SetCurrentPos(old);
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
++db.stats().fields_read;
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <int error_policy, template <typename> class TOUT, typename T>
|
||||
void Structure :: ReadFieldPtr(TOUT<T>& out, const char* name, const FileDatabase& db) const
|
||||
{
|
||||
const StreamReaderAny::pos old = db.reader->GetCurrentPos();
|
||||
Pointer ptrval;
|
||||
const Field* f;
|
||||
try {
|
||||
f = &(*this)[name];
|
||||
|
||||
// sanity check, should never happen if the genblenddna script is right
|
||||
if (!(f->flags & FieldFlag_Pointer)) {
|
||||
throw Error((Formatter::format(),"Field `",name,"` of structure `",
|
||||
this->name,"` ought to be a pointer"
|
||||
));
|
||||
}
|
||||
|
||||
db.reader->IncPtr(f->offset);
|
||||
Convert(ptrval,db);
|
||||
// actually it is meaningless on which Structure the Convert is called
|
||||
// because the `Pointer` argument triggers a special implementation.
|
||||
}
|
||||
catch (const Error& e) {
|
||||
_defaultInitializer<error_policy>()(out,e.what());
|
||||
|
||||
out.reset();
|
||||
return;
|
||||
}
|
||||
|
||||
// resolve the pointer and load the corresponding structure
|
||||
ResolvePointer(out,ptrval,db,*f);
|
||||
|
||||
// and recover the previous stream position
|
||||
db.reader->SetCurrentPos(old);
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
if (out) {
|
||||
++db.stats().pointers_resolved;
|
||||
}
|
||||
++db.stats().fields_read;
|
||||
#endif
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <int error_policy, typename T>
|
||||
void Structure :: ReadField(T& out, const char* name, const FileDatabase& db) const
|
||||
{
|
||||
const StreamReaderAny::pos old = db.reader->GetCurrentPos();
|
||||
try {
|
||||
const Field& f = (*this)[name];
|
||||
// find the structure definition pertaining to this field
|
||||
const Structure& s = db.dna[f.type];
|
||||
|
||||
db.reader->IncPtr(f.offset);
|
||||
s.Convert(out,db);
|
||||
}
|
||||
catch (const Error& e) {
|
||||
_defaultInitializer<error_policy>()(out,e.what());
|
||||
}
|
||||
|
||||
// and recover the previous stream position
|
||||
db.reader->SetCurrentPos(old);
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
++db.stats().fields_read;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <template <typename> class TOUT, typename T>
|
||||
void Structure :: ResolvePointer(TOUT<T>& out, const Pointer & ptrval, const FileDatabase& db, const Field& f) const
|
||||
{
|
||||
out.reset();
|
||||
if (ptrval.val) {
|
||||
const Structure& s = db.dna[f.type];
|
||||
|
||||
// find the file block the pointer is pointing to
|
||||
const FileBlockHead* block = LocateFileBlockForAddress(ptrval,db);
|
||||
|
||||
// also determine the target type from the block header
|
||||
// and check if it matches the type which we expect.
|
||||
const Structure& ss = db.dna[block->dna_index];
|
||||
if (ss != s) {
|
||||
throw Error((Formatter::format(),"Expected target to be of type `",s.name,
|
||||
"` but seemingly it is a `",ss.name,"` instead"
|
||||
));
|
||||
}
|
||||
|
||||
// try to retrieve the object from the cache
|
||||
db.cache(out).get(s,out,ptrval);
|
||||
if (out) {
|
||||
return;
|
||||
}
|
||||
|
||||
// seek to this location, but save the previous stream pointer.
|
||||
const StreamReaderAny::pos pold = db.reader->GetCurrentPos();
|
||||
db.reader->SetCurrentPos(block->start+ static_cast<size_t>((ptrval.val - block->address.val) ));
|
||||
// FIXME: basically, this could cause problems with 64 bit pointers on 32 bit systems.
|
||||
// I really ought to improve StreamReader to work with 64 bit indices exclusively.
|
||||
|
||||
// continue conversion after allocating the required storage
|
||||
size_t num = block->size / ss.size;
|
||||
_allocate(out,num);
|
||||
|
||||
// cache the object before we convert it to avoid
|
||||
// cyclic recursion.
|
||||
db.cache(out).set(s,out,ptrval);
|
||||
|
||||
T* o = out.get();
|
||||
for (size_t i = 0; i < num; ++i,++o) {
|
||||
s.Convert(*o,db);
|
||||
}
|
||||
|
||||
db.reader->SetCurrentPos(pold);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: ResolvePointer<boost::shared_ptr,ElemBase>(boost::shared_ptr<ElemBase>& out,
|
||||
const Pointer & ptrval,
|
||||
const FileDatabase& db,
|
||||
const Field& f
|
||||
) const
|
||||
{
|
||||
// Special case when the data type needs to be determined at runtime.
|
||||
// Less secure than in the `strongly-typed` case.
|
||||
|
||||
out.reset();
|
||||
if (ptrval.val) {
|
||||
// find the file block the pointer is pointing to
|
||||
const FileBlockHead* block = LocateFileBlockForAddress(ptrval,db);
|
||||
|
||||
// determine the target type from the block header
|
||||
const Structure& s = db.dna[block->dna_index];
|
||||
|
||||
// try to retrieve the object from the cache
|
||||
db.cache(out).get(s,out,ptrval);
|
||||
if (out) {
|
||||
return;
|
||||
}
|
||||
|
||||
// seek to this location, but save the previous stream pointer.
|
||||
const StreamReaderAny::pos pold = db.reader->GetCurrentPos();
|
||||
db.reader->SetCurrentPos(block->start+ static_cast<size_t>((ptrval.val - block->address.val) ));
|
||||
// FIXME: basically, this could cause problems with 64 bit pointers on 32 bit systems.
|
||||
// I really ought to improve StreamReader to work with 64 bit indices exclusively.
|
||||
|
||||
// continue conversion after allocating the required storage
|
||||
out = db.dna.ConvertBlobToStructure(s,db);
|
||||
db.reader->SetCurrentPos(pold);
|
||||
if (!out) {
|
||||
// this might happen if DNA::RegisterConverters hasn't been called so far
|
||||
// or if the target type is not contained in `our` DNA.
|
||||
out.reset();
|
||||
DefaultLogger::get()->warn((Formatter::format(),
|
||||
"Failed to find a converter for the `",s.name,"` structure"
|
||||
));
|
||||
return;
|
||||
}
|
||||
|
||||
// store a pointer to the name string of the actual type
|
||||
// in the object itself. This allows the conversion code
|
||||
// to perform additional type checking.
|
||||
out->dna_type = s.name.c_str();
|
||||
|
||||
// cache the object now that construction is complete
|
||||
// FIXME we need to do this in ConvertBlobToStructure
|
||||
db.cache(out).set(s,out,ptrval);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
const FileBlockHead* Structure :: LocateFileBlockForAddress(const Pointer & ptrval, const FileDatabase& db) const
|
||||
{
|
||||
// the file blocks appear in list sorted by
|
||||
// with ascending base addresses so we can run a
|
||||
// binary search to locate the pointee quickly.
|
||||
|
||||
// NOTE: Blender seems to distinguish between side-by-side
|
||||
// data (stored in the same data block) and far pointers,
|
||||
// which are only used for structures starting with an ID.
|
||||
// We don't need to make this distinction, our algorithm
|
||||
// works regardless where the data is stored.
|
||||
std::vector<FileBlockHead>::const_iterator it = std::lower_bound(db.entries.begin(),db.entries.end(),ptrval);
|
||||
if (it == db.entries.end()) {
|
||||
// this is crucial, pointers may not be invalid.
|
||||
// this is either a corrupted file or an attempted attack.
|
||||
throw DeadlyImportError((Formatter::format(),"Failure resolving pointer 0x",
|
||||
std::hex,ptrval.val,", no file block falls into this address range"
|
||||
));
|
||||
}
|
||||
if (ptrval.val >= (*it).address.val + (*it).size) {
|
||||
throw DeadlyImportError((Formatter::format(),"Failure resolving pointer 0x",
|
||||
std::hex,ptrval.val,", nearest file block starting at 0x",
|
||||
(*it).address.val," ends at 0x",
|
||||
(*it).address.val + (*it).size
|
||||
));
|
||||
}
|
||||
return &*it;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// NOTE: The MSVC debugger keeps showing up this annoying `a cast to a smaller data type has
|
||||
// caused a loss of data`-warning. Avoid this warning by a masking with an appropriate bitmask.
|
||||
|
||||
template <typename T> struct signless;
|
||||
template <> struct signless<char> {typedef unsigned char type;};
|
||||
template <> struct signless<short> {typedef unsigned short type;};
|
||||
template <> struct signless<int> {typedef unsigned int type;};
|
||||
|
||||
template <typename T>
|
||||
struct static_cast_silent {
|
||||
template <typename V>
|
||||
T operator()(V in) {
|
||||
return static_cast<T>(in & static_cast<typename signless<T>::type>(-1));
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct static_cast_silent<float> {
|
||||
template <typename V> float operator()(V in) {
|
||||
return static_cast<float> (in);
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct static_cast_silent<double> {
|
||||
template <typename V> double operator()(V in) {
|
||||
return static_cast<double>(in);
|
||||
}
|
||||
};
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <typename T> inline void ConvertDispatcher(T& out, const Structure& in,const FileDatabase& db)
|
||||
{
|
||||
if (in.name == "int") {
|
||||
out = static_cast_silent<T>()(db.reader->GetU4());
|
||||
//db.reader->IncPtr(-4);
|
||||
}
|
||||
else if (in.name == "short") {
|
||||
out = static_cast_silent<T>()(db.reader->GetU2());
|
||||
//db.reader->IncPtr(-2);
|
||||
}
|
||||
else if (in.name == "char") {
|
||||
out = static_cast_silent<T>()(db.reader->GetU1());
|
||||
//db.reader->IncPtr(-1);
|
||||
}
|
||||
else if (in.name == "float") {
|
||||
out = static_cast<T>(db.reader->GetF4());
|
||||
//db.reader->IncPtr(-4);
|
||||
}
|
||||
else if (in.name == "double") {
|
||||
out = static_cast<T>(db.reader->GetF8());
|
||||
//db.reader->IncPtr(-8);
|
||||
}
|
||||
else {
|
||||
throw DeadlyImportError("Unknown source for conversion to primitive data type: "+in.name);
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> inline void Structure :: Convert<int> (int& dest,const FileDatabase& db) const
|
||||
{
|
||||
ConvertDispatcher(dest,*this,db);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> inline void Structure :: Convert<short> (short& dest,const FileDatabase& db) const
|
||||
{
|
||||
ConvertDispatcher(dest,*this,db);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> inline void Structure :: Convert<char> (char& dest,const FileDatabase& db) const
|
||||
{
|
||||
// automatic rescaling from char to float and vice versa (seems useful for RGB colors)
|
||||
if (name == "float") {
|
||||
dest = static_cast<char>(db.reader->GetF4() * 255.f);
|
||||
//db.reader->IncPtr(-4);
|
||||
return;
|
||||
}
|
||||
else if (name == "double") {
|
||||
dest = static_cast<char>(db.reader->GetF8() * 255.f);
|
||||
//db.reader->IncPtr(-8);
|
||||
return;
|
||||
}
|
||||
ConvertDispatcher(dest,*this,db);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> inline void Structure :: Convert<float> (float& dest,const FileDatabase& db) const
|
||||
{
|
||||
// automatic rescaling from char to float and vice versa (seems useful for RGB colors)
|
||||
if (name == "char") {
|
||||
dest = db.reader->GetI1() / 255.f;
|
||||
//db.reader->IncPtr(-1);
|
||||
return;
|
||||
}
|
||||
ConvertDispatcher(dest,*this,db);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> inline void Structure :: Convert<double> (double& dest,const FileDatabase& db) const
|
||||
{
|
||||
if (name == "char") {
|
||||
dest = db.reader->GetI1() / 255.f;
|
||||
//db.reader->IncPtr(-1);
|
||||
return;
|
||||
}
|
||||
ConvertDispatcher(dest,*this,db);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
template <> inline void Structure :: Convert<Pointer> (Pointer& dest,const FileDatabase& db) const
|
||||
{
|
||||
if (db.i64bit) {
|
||||
dest.val = db.reader->GetU8();
|
||||
//db.reader->IncPtr(-8);
|
||||
return;
|
||||
}
|
||||
dest.val = db.reader->GetU4();
|
||||
//db.reader->IncPtr(-4);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
const Structure& DNA :: operator [] (const std::string& ss) const
|
||||
{
|
||||
std::map<std::string, size_t>::const_iterator it = indices.find(ss);
|
||||
if (it == indices.end()) {
|
||||
throw Error((Formatter::format(),
|
||||
"BlendDNA: Did not find a structure named `",ss,"`"
|
||||
));
|
||||
}
|
||||
|
||||
return structures[(*it).second];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
const Structure& DNA :: operator [] (const size_t i) const
|
||||
{
|
||||
if (i >= structures.size()) {
|
||||
throw Error((Formatter::format(),
|
||||
"BlendDNA: There is no structure with index `",i,"`"
|
||||
));
|
||||
}
|
||||
|
||||
return structures[i];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <template <typename> class TOUT> template <typename T> void ObjectCache<TOUT> :: get (
|
||||
const Structure& s,
|
||||
TOUT<T>& out,
|
||||
const Pointer& ptr
|
||||
) const {
|
||||
|
||||
if(s.cache_idx == static_cast<size_t>(-1)) {
|
||||
s.cache_idx = db.next_cache_idx++;
|
||||
caches.resize(db.next_cache_idx);
|
||||
return;
|
||||
}
|
||||
|
||||
typename StructureCache::const_iterator it = caches[s.cache_idx].find(ptr);
|
||||
if (it != caches[s.cache_idx].end()) {
|
||||
out = boost::static_pointer_cast<T>( (*it).second );
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
++db.stats().cache_hits;
|
||||
#endif
|
||||
}
|
||||
// otherwise, out remains untouched
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <template <typename> class TOUT> template <typename T> void ObjectCache<TOUT> :: set (
|
||||
const Structure& s,
|
||||
const TOUT<T>& out,
|
||||
const Pointer& ptr
|
||||
) {
|
||||
if(s.cache_idx == static_cast<size_t>(-1)) {
|
||||
s.cache_idx = db.next_cache_idx++;
|
||||
caches.resize(db.next_cache_idx);
|
||||
}
|
||||
caches[s.cache_idx][ptr] = boost::static_pointer_cast<ElemBase>( out );
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
++db.stats().cached_objects;
|
||||
#endif
|
||||
}
|
||||
|
||||
}}
|
||||
#endif
|
|
@ -0,0 +1,643 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderLoader.cpp
|
||||
* @brief Implementation of the Blender3D importer class.
|
||||
*/
|
||||
#include "AssimpPCH.h"
|
||||
|
||||
#ifndef ASSIMP_BUILD_NO_BLEND_IMPORTER
|
||||
#include "BlenderLoader.h"
|
||||
#include "BlenderDNA.h"
|
||||
#include "BlenderScene.h"
|
||||
#include "BlenderSceneGen.h"
|
||||
|
||||
#include "StreamReader.h"
|
||||
#include "TinyFormatter.h"
|
||||
|
||||
//#include <boost/make_shared.hpp>
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace Assimp::Blender;
|
||||
using namespace Assimp::Formatter;
|
||||
|
||||
#define for_each BOOST_FOREACH
|
||||
|
||||
static const aiLoaderDesc blenderDesc = {
|
||||
"Blender 3D Importer \nhttp://www.blender3d.org",
|
||||
"Alexander Gessler <alexander.gessler@gmx.net>",
|
||||
"",
|
||||
"",
|
||||
aiLoaderFlags_SupportBinaryFlavour | aiLoaderFlags_Experimental,
|
||||
0,
|
||||
0,
|
||||
2,
|
||||
50
|
||||
};
|
||||
|
||||
namespace Assimp {
|
||||
namespace Blender {
|
||||
|
||||
/** Mini smart-array to avoid pulling in even more boost stuff */
|
||||
template <template <typename,typename> class TCLASS, typename T>
|
||||
struct TempArray {
|
||||
~TempArray () {
|
||||
for_each(T* elem, arr) {
|
||||
delete elem;
|
||||
}
|
||||
}
|
||||
|
||||
void dismiss() {
|
||||
arr.clear();
|
||||
}
|
||||
|
||||
TCLASS< T*,std::allocator<T*> >* operator -> () {
|
||||
return &arr;
|
||||
}
|
||||
|
||||
operator TCLASS< T*,std::allocator<T*> > () {
|
||||
return arr;
|
||||
}
|
||||
|
||||
private:
|
||||
TCLASS< T*,std::allocator<T*> > arr;
|
||||
};
|
||||
|
||||
/** ConversionData acts as intermediate storage location for
|
||||
* the various ConvertXXX routines in BlenderImporter.*/
|
||||
struct ConversionData {
|
||||
std::set<const Object*> objects;
|
||||
|
||||
TempArray <std::vector, aiMesh> meshes;
|
||||
TempArray <std::vector, aiCamera> cameras;
|
||||
TempArray <std::vector, aiLight> lights;
|
||||
TempArray <std::vector, aiMaterial> materials;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Constructor to be privately used by Importer
|
||||
BlenderImporter::BlenderImporter()
|
||||
{}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Destructor, private as well
|
||||
BlenderImporter::~BlenderImporter()
|
||||
{}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Returns whether the class can handle the format of the given file.
|
||||
bool BlenderImporter::CanRead( const std::string& pFile, IOSystem* pIOHandler, bool checkSig) const
|
||||
{
|
||||
const std::string& extension = GetExtension(pFile);
|
||||
if (extension == "blend") {
|
||||
return true;
|
||||
}
|
||||
|
||||
else if ((!extension.length() || checkSig) && pIOHandler) {
|
||||
const char* tokens[] = {"BLENDER"};
|
||||
return SearchFileHeaderForToken(pIOHandler,pFile,tokens,1);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// List all extensions handled by this loader
|
||||
void BlenderImporter::GetExtensionList(std::set<std::string>& app)
|
||||
{
|
||||
app.insert("blend");
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Loader registry entry
|
||||
const aiLoaderDesc& BlenderImporter::GetInfo () const
|
||||
{
|
||||
return blenderDesc;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Setup configuration properties for the loader
|
||||
void BlenderImporter::SetupProperties(const Importer* pImp)
|
||||
{
|
||||
// nothing to be done for the moment
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Imports the given file into the given scene structure.
|
||||
void BlenderImporter::InternReadFile( const std::string& pFile,
|
||||
aiScene* pScene, IOSystem* pIOHandler)
|
||||
{
|
||||
FileDatabase file;
|
||||
boost::shared_ptr<IOStream> stream(pIOHandler->Open(pFile,"rb"));
|
||||
if (!stream) {
|
||||
ThrowException("Could not open file for reading");
|
||||
}
|
||||
|
||||
char magic[8] = {0};
|
||||
stream->Read(magic,7,1);
|
||||
if (strcmp(magic,"BLENDER")) {
|
||||
ThrowException("BLENDER magic bytes are missing");
|
||||
}
|
||||
|
||||
file.i64bit = (stream->Read(magic,1,1),magic[0]=='-');
|
||||
file.little = (stream->Read(magic,1,1),magic[0]=='v');
|
||||
|
||||
stream->Read(magic,3,1);
|
||||
magic[3] = '\0';
|
||||
|
||||
LogInfo((format(),"Blender version is ",magic[0],".",magic+1,
|
||||
" (64bit: ",file.i64bit?"true":"false",
|
||||
", little endian: ",file.little?"true":"false",")"
|
||||
));
|
||||
|
||||
ParseBlendFile(file,stream);
|
||||
|
||||
Scene scene;
|
||||
ExtractScene(scene,file);
|
||||
|
||||
ConvertBlendFile(pScene,scene);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderImporter::ParseBlendFile(FileDatabase& out, boost::shared_ptr<IOStream> stream)
|
||||
{
|
||||
out.reader = boost::shared_ptr<StreamReaderAny>(new StreamReaderAny(stream,out.little));
|
||||
|
||||
DNAParser dna_reader(out);
|
||||
const DNA* dna = NULL;
|
||||
|
||||
out.entries.reserve(128); { // even small BLEND files tend to consist of many file blocks
|
||||
SectionParser parser(*out.reader.get(),out.i64bit);
|
||||
|
||||
// first parse the file in search for the DNA and insert all other sections into the database
|
||||
while ((parser.Next(),1)) {
|
||||
const FileBlockHead& head = parser.GetCurrent();
|
||||
|
||||
if (head.id == "ENDB") {
|
||||
break; // only valid end of the file
|
||||
}
|
||||
else if (head.id == "DNA1") {
|
||||
dna_reader.Parse();
|
||||
dna = &dna_reader.GetDNA();
|
||||
continue;
|
||||
}
|
||||
|
||||
out.entries.push_back(head);
|
||||
}
|
||||
}
|
||||
if (!dna) {
|
||||
ThrowException("SDNA not found");
|
||||
}
|
||||
|
||||
std::sort(out.entries.begin(),out.entries.end());
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderImporter::ExtractScene(Scene& out, const FileDatabase& file)
|
||||
{
|
||||
const FileBlockHead* block = NULL;
|
||||
std::map<std::string,size_t>::const_iterator it = file.dna.indices.find("Scene");
|
||||
if (it == file.dna.indices.end()) {
|
||||
ThrowException("There is no `Scene` structure record");
|
||||
}
|
||||
|
||||
const Structure& ss = file.dna.structures[(*it).second];
|
||||
|
||||
// we need a scene somewhere to start with.
|
||||
for_each(const FileBlockHead& bl,file.entries) {
|
||||
if (bl.id == "SC") {
|
||||
block = &bl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!block) {
|
||||
ThrowException("There is not a single `Scene` record to load");
|
||||
}
|
||||
|
||||
file.reader->SetCurrentPos(block->start);
|
||||
ss.Convert(out,file);
|
||||
|
||||
#ifndef ASSIMP_BUILD_BLENDER_NO_STATS
|
||||
DefaultLogger::get()->info((format(),
|
||||
"(Stats) Fields read: " ,file.stats().fields_read,
|
||||
", pointers resolved: " ,file.stats().pointers_resolved,
|
||||
", cache hits: " ,file.stats().cache_hits,
|
||||
", cached objects: " ,file.stats().cached_objects
|
||||
));
|
||||
#endif
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderImporter::ConvertBlendFile(aiScene* out, const Scene& in)
|
||||
{
|
||||
ConversionData conv;
|
||||
|
||||
// FIXME it must be possible to take the hierarchy directly from
|
||||
// the file. This is terrible. Here, we're first looking for
|
||||
// all objects which don't have parent objects at all -
|
||||
std::deque<const Object*> no_parents;
|
||||
for (boost::shared_ptr<Base> cur = boost::static_pointer_cast<Base> ( in.base.first ); cur; cur = cur->next) {
|
||||
if (cur->object) {
|
||||
if(!cur->object->parent) {
|
||||
no_parents.push_back(cur->object.get());
|
||||
}
|
||||
else conv.objects.insert(cur->object.get());
|
||||
}
|
||||
}
|
||||
for (boost::shared_ptr<Base> cur = in.basact; cur; cur = cur->next) {
|
||||
if (cur->object) {
|
||||
if(cur->object->parent) {
|
||||
conv.objects.insert(cur->object.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (no_parents.empty()) {
|
||||
ThrowException("Expected at least one object with no parent");
|
||||
}
|
||||
|
||||
aiNode* root = out->mRootNode = new aiNode("<BlenderRoot>");
|
||||
|
||||
root->mNumChildren = static_cast<unsigned int>(no_parents.size());
|
||||
root->mChildren = new aiNode*[root->mNumChildren]();
|
||||
for (unsigned int i = 0; i < root->mNumChildren; ++i) {
|
||||
root->mChildren[i] = ConvertNode(in, no_parents[i], conv);
|
||||
root->mChildren[i]->mParent = root;
|
||||
}
|
||||
|
||||
if (conv.meshes->size()) {
|
||||
out->mMeshes = new aiMesh*[out->mNumMeshes = static_cast<unsigned int>( conv.meshes->size() )];
|
||||
std::copy(conv.meshes->begin(),conv.meshes->end(),out->mMeshes);
|
||||
conv.meshes.dismiss();
|
||||
}
|
||||
|
||||
if (conv.lights->size()) {
|
||||
out->mLights = new aiLight*[out->mNumLights = static_cast<unsigned int>( conv.lights->size() )];
|
||||
std::copy(conv.lights->begin(),conv.lights->end(),out->mLights);
|
||||
conv.lights.dismiss();
|
||||
}
|
||||
|
||||
if (conv.cameras->size()) {
|
||||
out->mCameras = new aiCamera*[out->mNumCameras = static_cast<unsigned int>( conv.cameras->size() )];
|
||||
std::copy(conv.cameras->begin(),conv.cameras->end(),out->mCameras);
|
||||
conv.cameras.dismiss();
|
||||
}
|
||||
|
||||
if (conv.materials->size()) {
|
||||
out->mMaterials = new aiMaterial*[out->mNumMaterials = static_cast<unsigned int>( conv.materials->size() )];
|
||||
std::copy(conv.materials->begin(),conv.materials->end(),out->mMaterials);
|
||||
conv.materials.dismiss();
|
||||
}
|
||||
|
||||
|
||||
// acknowledge that the scene might come out incomplete
|
||||
// by Assimps definition of `complete`: blender scenes
|
||||
// can consist of thousands of cameras or lights with
|
||||
// not a single mesh in them.
|
||||
if (!out->mNumMeshes) {
|
||||
out->mFlags |= AI_SCENE_FLAGS_INCOMPLETE;
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderImporter::CheckActualType(const ElemBase* dt, const char* check)
|
||||
{
|
||||
ai_assert(dt);
|
||||
if (strcmp(dt->dna_type,check)) {
|
||||
ThrowException((format(),
|
||||
"Expected object at ",std::hex,dt," to be of type `",check,
|
||||
"`, but it claims to be a `",dt->dna_type,"`instead"
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void BlenderImporter::NotSupportedObjectType(const Object* obj, const char* type)
|
||||
{
|
||||
LogWarn((format(), "Object `",obj->id.name,"` - type is unsupported: `",type, "`, skipping" ));
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
aiMesh* BlenderImporter::ConvertMesh(const Scene& in, const Object* obj, const Mesh* mesh, ConversionData& conv_data)
|
||||
{
|
||||
if (!mesh->totface || !mesh->totvert) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ScopeGuard<aiMesh> out(new aiMesh());
|
||||
|
||||
aiVector3D* vo = out->mVertices = new aiVector3D[mesh->totface*4];
|
||||
aiVector3D* vn = out->mNormals = new aiVector3D[mesh->totface*4];
|
||||
|
||||
out->mNumFaces = mesh->totface;
|
||||
out->mFaces = new aiFace[out->mNumFaces]();
|
||||
|
||||
for (unsigned int i = 0; i < out->mNumFaces; ++i) {
|
||||
aiFace& f = out->mFaces[i];
|
||||
|
||||
const MFace& mf = mesh->mface[i];
|
||||
f.mIndices = new unsigned int[ f.mNumIndices = mf.v4?4:3 ];
|
||||
|
||||
if (mf.v1 >= mesh->totvert) {
|
||||
ThrowException("Vertex index v1 out of range");
|
||||
}
|
||||
const MVert* v = &mesh->mvert[mf.v1];
|
||||
vo->x = v->co[0];
|
||||
vo->y = v->co[1];
|
||||
vo->z = v->co[2];
|
||||
vn->x = v->no[0];
|
||||
vn->y = v->no[1];
|
||||
vn->z = v->no[2];
|
||||
f.mIndices[0] = out->mNumVertices++;
|
||||
++vo;
|
||||
++vn;
|
||||
|
||||
// if (f.mNumIndices >= 2) {
|
||||
if (mf.v2 >= mesh->totvert) {
|
||||
ThrowException("Vertex index v2 out of range");
|
||||
}
|
||||
v = &mesh->mvert[mf.v2];
|
||||
vo->x = v->co[0];
|
||||
vo->y = v->co[1];
|
||||
vo->z = v->co[2];
|
||||
vn->x = v->no[0];
|
||||
vn->y = v->no[1];
|
||||
vn->z = v->no[2];
|
||||
f.mIndices[1] = out->mNumVertices++;
|
||||
++vo;
|
||||
++vn;
|
||||
|
||||
if (mf.v3 >= mesh->totvert) {
|
||||
ThrowException("Vertex index v3 out of range");
|
||||
}
|
||||
// if (f.mNumIndices >= 3) {
|
||||
v = &mesh->mvert[mf.v3];
|
||||
vo->x = v->co[0];
|
||||
vo->y = v->co[1];
|
||||
vo->z = v->co[2];
|
||||
vn->x = v->no[0];
|
||||
vn->y = v->no[1];
|
||||
vn->z = v->no[2];
|
||||
f.mIndices[2] = out->mNumVertices++;
|
||||
++vo;
|
||||
++vn;
|
||||
|
||||
if (mf.v4 >= mesh->totvert) {
|
||||
ThrowException("Vertex index v4 out of range");
|
||||
}
|
||||
// if (f.mNumIndices >= 4) {
|
||||
if (mf.v4) {
|
||||
v = &mesh->mvert[mf.v4];
|
||||
vo->x = v->co[0];
|
||||
vo->y = v->co[1];
|
||||
vo->z = v->co[2];
|
||||
vn->x = v->no[0];
|
||||
vn->y = v->no[1];
|
||||
vn->z = v->no[2];
|
||||
f.mIndices[3] = out->mNumVertices++;
|
||||
++vo;
|
||||
++vn;
|
||||
}
|
||||
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
if (mesh->mtface) {
|
||||
vo = out->mTextureCoords[0] = new aiVector3D[out->mNumVertices];
|
||||
|
||||
for (unsigned int i = 0; i < out->mNumFaces; ++i) {
|
||||
const aiFace& f = out->mFaces[i];
|
||||
|
||||
const MTFace* v = &mesh->mtface[i];
|
||||
for (unsigned int i = 0; i < f.mNumIndices; ++i,++vo) {
|
||||
vo->x = v->uv[i][0];
|
||||
vo->y = v->uv[i][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh->tface) {
|
||||
vo = out->mTextureCoords[0] = new aiVector3D[out->mNumVertices];
|
||||
|
||||
for (unsigned int i = 0; i < out->mNumFaces; ++i) {
|
||||
const aiFace& f = out->mFaces[i];
|
||||
|
||||
const TFace* v = &mesh->tface[i];
|
||||
for (unsigned int i = 0; i < f.mNumIndices; ++i,++vo) {
|
||||
vo->x = v->uv[i][0];
|
||||
vo->y = v->uv[i][1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (mesh->mcol) {
|
||||
aiColor4D* vo = out->mColors[0] = new aiColor4D[out->mNumVertices];
|
||||
for (unsigned int i = 0; i < out->mNumFaces; ++i) {
|
||||
|
||||
for (unsigned int n = 0; n < 4; ++n, ++vo) {
|
||||
const MCol* col = &mesh->mcol[(i<<2)+n];
|
||||
|
||||
vo->r = col->r;
|
||||
vo->g = col->g;
|
||||
vo->b = col->b;
|
||||
vo->a = col->a;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return out.dismiss();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
aiCamera* BlenderImporter::ConvertCamera(const Scene& in, const Object* obj, const Camera* mesh, ConversionData& conv_data)
|
||||
{
|
||||
ScopeGuard<aiCamera> out(new aiCamera());
|
||||
|
||||
return NULL ; //out.dismiss();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
aiLight* BlenderImporter::ConvertLight(const Scene& in, const Object* obj, const Lamp* mesh, ConversionData& conv_data)
|
||||
{
|
||||
ScopeGuard<aiLight> out(new aiLight());
|
||||
|
||||
return NULL ; //out.dismiss();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
aiNode* BlenderImporter::ConvertNode(const Scene& in, const Object* obj, ConversionData& conv_data)
|
||||
{
|
||||
std::deque<const Object*> children;
|
||||
for(std::set<const Object*>::iterator it = conv_data.objects.begin(); it != conv_data.objects.end() ;++it) {
|
||||
const Object* object = *it;
|
||||
if (object->parent.get() == obj) {
|
||||
children.push_back(object);
|
||||
conv_data.objects.erase(it++);
|
||||
if(it == conv_data.objects.end()) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ScopeGuard<aiNode> node(new aiNode(obj->id.name));
|
||||
if (obj->data) {
|
||||
switch (obj->type)
|
||||
{
|
||||
case Object :: Type_EMPTY:
|
||||
break; // do nothing
|
||||
|
||||
|
||||
// supported object types
|
||||
case Object :: Type_MESH: {
|
||||
CheckActualType(obj->data.get(),"Mesh");
|
||||
aiMesh* mesh = ConvertMesh(in,obj,static_cast<const Mesh*>(
|
||||
obj->data.get()),conv_data);
|
||||
|
||||
if (mesh) {
|
||||
node->mMeshes = new unsigned int[node->mNumMeshes = 1u];
|
||||
node->mMeshes[0] = conv_data.meshes->size();
|
||||
|
||||
conv_data.meshes->push_back(mesh);
|
||||
}}
|
||||
break;
|
||||
case Object :: Type_LAMP: {
|
||||
CheckActualType(obj->data.get(),"Lamp");
|
||||
aiLight* mesh = ConvertLight(in,obj,static_cast<const Lamp*>(
|
||||
obj->data.get()),conv_data);
|
||||
|
||||
if (mesh) {
|
||||
conv_data.lights->push_back(mesh);
|
||||
}}
|
||||
break;
|
||||
case Object :: Type_CAMERA: {
|
||||
CheckActualType(obj->data.get(),"Camera");
|
||||
aiCamera* mesh = ConvertCamera(in,obj,static_cast<const Camera*>(
|
||||
obj->data.get()),conv_data);
|
||||
|
||||
if (mesh) {
|
||||
conv_data.cameras->push_back(mesh);
|
||||
}}
|
||||
break;
|
||||
|
||||
|
||||
// unsupported object types / log, but do not break
|
||||
case Object :: Type_CURVE:
|
||||
NotSupportedObjectType(obj,"Curve");
|
||||
break;
|
||||
case Object :: Type_SURF:
|
||||
NotSupportedObjectType(obj,"Surface");
|
||||
break;
|
||||
case Object :: Type_FONT:
|
||||
NotSupportedObjectType(obj,"Font");
|
||||
break;
|
||||
case Object :: Type_MBALL:
|
||||
NotSupportedObjectType(obj,"MetaBall");
|
||||
break;
|
||||
case Object :: Type_WAVE:
|
||||
NotSupportedObjectType(obj,"Wave");
|
||||
break;
|
||||
case Object :: Type_LATTICE:
|
||||
NotSupportedObjectType(obj,"Lattice");
|
||||
break;
|
||||
|
||||
// invalid or unknown type
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for(unsigned int x = 0; x < 4; ++x) {
|
||||
for(unsigned int y = 0; y < 4; ++y) {
|
||||
node->mTransformation[y][x] = obj->parentinv[x][y];
|
||||
}
|
||||
}
|
||||
|
||||
aiMatrix4x4 m;
|
||||
for(unsigned int x = 0; x < 4; ++x) {
|
||||
for(unsigned int y = 0; y < 4; ++y) {
|
||||
m[y][x] = obj->obmat[x][y];
|
||||
}
|
||||
}
|
||||
|
||||
node->mTransformation = m*node->mTransformation;
|
||||
|
||||
if (children.size()) {
|
||||
node->mNumChildren = static_cast<unsigned int>(children.size());
|
||||
aiNode** nd = node->mChildren = new aiNode*[node->mNumChildren]();
|
||||
for_each (const Object* nobj,children) {
|
||||
*nd = ConvertNode(in,nobj,conv_data);
|
||||
(*nd++)->mParent = node;
|
||||
}
|
||||
}
|
||||
|
||||
return node.dismiss();
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/*static*/ void BlenderImporter::ThrowException(const std::string& msg)
|
||||
{
|
||||
throw DeadlyImportError("BLEND: "+msg);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/*static*/ void BlenderImporter::LogWarn(const Formatter::format& message) {
|
||||
DefaultLogger::get()->warn(std::string("BLEND: ")+=message);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/*static*/ void BlenderImporter::LogError(const Formatter::format& message) {
|
||||
DefaultLogger::get()->error(std::string("BLEND: ")+=message);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/*static*/ void BlenderImporter::LogInfo(const Formatter::format& message) {
|
||||
DefaultLogger::get()->info(std::string("BLEND: ")+=message);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
/*static*/ void BlenderImporter::LogDebug(const Formatter::format& message) {
|
||||
DefaultLogger::get()->debug(std::string("BLEND: ")+=message);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,219 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderLoader.h
|
||||
* @brief Declaration of the Blender 3D (*.blend) importer class.
|
||||
*/
|
||||
#ifndef INCLUDED_AI_BLEND_LOADER_H
|
||||
#define INCLUDED_AI_BLEND_LOADER_H
|
||||
|
||||
#include "BaseImporter.h"
|
||||
namespace Assimp {
|
||||
|
||||
// TinyFormatter.h
|
||||
namespace Formatter {
|
||||
template <typename T,typename TR, typename A> class basic_formatter;
|
||||
typedef class basic_formatter< char, std::char_traits<char>, std::allocator<char> > format;
|
||||
}
|
||||
|
||||
// BlenderDNA.h
|
||||
namespace Blender {
|
||||
class FileDatabase;
|
||||
struct ElemBase;
|
||||
}
|
||||
|
||||
// BlenderScene.h
|
||||
namespace Blender {
|
||||
struct Scene;
|
||||
struct Object;
|
||||
struct Mesh;
|
||||
struct Camera;
|
||||
struct Lamp;
|
||||
}
|
||||
|
||||
// BlenderLoader.cpp
|
||||
namespace Blender {
|
||||
struct ConversionData;
|
||||
}
|
||||
|
||||
|
||||
enum aiLoaderFlags
|
||||
{
|
||||
aiLoaderFlags_SupportAsciiFlavour = 0x1,
|
||||
aiLoaderFlags_SupportBinaryFlavour = 0x2,
|
||||
aiLoaderFlags_SupportCompressedFlavour = 0x4,
|
||||
|
||||
aiLoaderFlags_LimitedSupport = 0x8,
|
||||
|
||||
aiLoaderFlags_Experimental = 0x10,
|
||||
aiLoaderFlags_Testing = 0x20,
|
||||
aiLoaderFlags_Production = 0x40,
|
||||
};
|
||||
|
||||
struct aiLoaderDesc
|
||||
{
|
||||
const char* mName;
|
||||
const char* mAuthor;
|
||||
const char* mMaintainer;
|
||||
const char* mComments;
|
||||
unsigned int mFlags;
|
||||
|
||||
unsigned int mMinMajor;
|
||||
unsigned int mMinMinor;
|
||||
unsigned int mMaxMajor;
|
||||
unsigned int mMaxMinor;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------------------
|
||||
/** Load blenders official binary format. The actual file structure (the `DNA` how they
|
||||
* call it is outsourced to BlenderDNA.cpp/BlenderDNA.h. This class only performs the
|
||||
* conversion from intermediate format to aiScene. */
|
||||
// -------------------------------------------------------------------------------------------
|
||||
class BlenderImporter : public BaseImporter
|
||||
{
|
||||
friend class Importer;
|
||||
|
||||
protected:
|
||||
|
||||
/** Constructor to be privately used by Importer */
|
||||
BlenderImporter();
|
||||
|
||||
/** Destructor, private as well */
|
||||
~BlenderImporter();
|
||||
|
||||
public:
|
||||
|
||||
// --------------------
|
||||
bool CanRead( const std::string& pFile,
|
||||
IOSystem* pIOHandler,
|
||||
bool checkSig
|
||||
) const;
|
||||
|
||||
protected:
|
||||
|
||||
// --------------------
|
||||
const aiLoaderDesc& GetInfo () const;
|
||||
|
||||
// --------------------
|
||||
void GetExtensionList(std::set<std::string>& app);
|
||||
|
||||
// --------------------
|
||||
void SetupProperties(const Importer* pImp);
|
||||
|
||||
// --------------------
|
||||
void InternReadFile( const std::string& pFile,
|
||||
aiScene* pScene,
|
||||
IOSystem* pIOHandler
|
||||
);
|
||||
|
||||
// --------------------
|
||||
void ParseBlendFile(Blender::FileDatabase& out,
|
||||
boost::shared_ptr<IOStream> stream
|
||||
);
|
||||
|
||||
// --------------------
|
||||
void ExtractScene(Blender::Scene& out,
|
||||
const Blender::FileDatabase& file
|
||||
);
|
||||
|
||||
// --------------------
|
||||
void ConvertBlendFile(aiScene* out,
|
||||
const Blender::Scene& in
|
||||
);
|
||||
|
||||
private:
|
||||
|
||||
// --------------------
|
||||
aiNode* ConvertNode(const Blender::Scene& in,
|
||||
const Blender::Object* obj,
|
||||
Blender::ConversionData& conv_info
|
||||
);
|
||||
|
||||
// --------------------
|
||||
aiMesh* ConvertMesh(const Blender::Scene& in,
|
||||
const Blender::Object* obj,
|
||||
const Blender::Mesh* mesh,
|
||||
Blender::ConversionData& conv_data
|
||||
);
|
||||
|
||||
// --------------------
|
||||
aiLight* ConvertLight(const Blender::Scene& in,
|
||||
const Blender::Object* obj,
|
||||
const Blender::Lamp* mesh,
|
||||
Blender::ConversionData& conv_data
|
||||
);
|
||||
|
||||
// --------------------
|
||||
aiCamera* ConvertCamera(const Blender::Scene& in,
|
||||
const Blender::Object* obj,
|
||||
const Blender::Camera* mesh,
|
||||
Blender::ConversionData& conv_data
|
||||
);
|
||||
|
||||
private: // static stuff, mostly logging and error reporting.
|
||||
|
||||
// --------------------
|
||||
static void CheckActualType(const Blender::ElemBase* dt,
|
||||
const char* check
|
||||
);
|
||||
|
||||
// --------------------
|
||||
static void NotSupportedObjectType(const Blender::Object* obj,
|
||||
const char* type
|
||||
);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** Prepend 'BLEND: ' and throw msg.*/
|
||||
static void ThrowException(const std::string& msg);
|
||||
|
||||
// -------------------------------------------------------------------
|
||||
/** @defgroup blog Prepend 'BLEND: ' and write @c message to log.*/
|
||||
static void LogWarn (const Formatter::format& message); //! @ingroup blog
|
||||
static void LogError (const Formatter::format& message); //! @ingroup blog
|
||||
static void LogInfo (const Formatter::format& message); //! @ingroup blog
|
||||
static void LogDebug (const Formatter::format& message); //! @ingroup blog
|
||||
|
||||
private:
|
||||
|
||||
}; // !class BlenderImporter
|
||||
|
||||
} // end of namespace Assimp
|
||||
#endif // AI_UNREALIMPORTER_H_INC
|
|
@ -0,0 +1,539 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderScene.cpp
|
||||
* @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py
|
||||
*/
|
||||
#include "AssimpPCH.h"
|
||||
#ifndef AI_BUILD_NO_BLEND_IMPORTER
|
||||
|
||||
#include "BlenderDNA.h"
|
||||
#include "BlenderScene.h"
|
||||
#include "BlenderSceneGen.h"
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace Assimp::Blender;
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Object> (
|
||||
Object& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.type,"type",db);
|
||||
ReadFieldArray2<ErrorPolicy_Igno>(dest.obmat,"obmat",db);
|
||||
ReadFieldArray2<ErrorPolicy_Igno>(dest.parentinv,"parentinv",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.parsubstr,"parsubstr",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.parent,"*parent",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.track,"*track",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.proxy,"*proxy",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.proxy_from,"*proxy_from",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.proxy_group,"*proxy_group",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.dup_group,"*dup_group",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.data,"*data",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Group> (
|
||||
Group& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.layer,"layer",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.gobject,"*gobject",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<MTex> (
|
||||
MTex& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.blendtype,"blendtype",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.object,"*object",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.tex,"*tex",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.uvname,"uvname",db);
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.projx,"projx",db);
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.projy,"projy",db);
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.projz,"projz",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mapping,"mapping",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.ofs,"ofs",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.size,"size",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.rot,"rot",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.texflag,"texflag",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.colormodel,"colormodel",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.pmapto,"pmapto",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.pmaptoneg,"pmaptoneg",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.r,"r",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.g,"g",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.b,"b",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.k,"k",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.colspecfac,"colspecfac",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mirrfac,"mirrfac",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.alphafac,"alphafac",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.difffac,"difffac",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.specfac,"specfac",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.emitfac,"emitfac",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.hardfac,"hardfac",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<TFace> (
|
||||
TFace& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldArray2<ErrorPolicy_Igno>(dest.uv,"uv",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.col,"col",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.unwrap,"unwrap",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<MFace> (
|
||||
MFace& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.v1,"v1",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.v2,"v2",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.v3,"v3",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.v4,"v4",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mat_nr,"mat_nr",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Lamp> (
|
||||
Lamp& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.type,"type",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flags,"flags",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.colormodel,"colormodel",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.totex,"totex",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.r,"r",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.g,"g",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.b,"b",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.k,"k",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.energy,"energy",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.dist,"dist",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.spotsize,"spotsize",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.spotblend,"spotblend",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.att1,"att1",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.att2,"att2",db);
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.falloff_type,"falloff_type",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.sun_brightness,"sun_brightness",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<MDeformWeight> (
|
||||
MDeformWeight& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.def_nr,"def_nr",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.weight,"weight",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<PackedFile> (
|
||||
PackedFile& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Base> (
|
||||
Base& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.prev,"*prev",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.next,"*next",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.object,"*object",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<MTFace> (
|
||||
MTFace& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldArray2<ErrorPolicy_Igno>(dest.uv,"uv",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.unwrap,"unwrap",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Material> (
|
||||
Material& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.r,"r",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.g,"g",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.b,"b",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.specr,"specr",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.specg,"specg",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.specb,"specb",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.ambir,"ambir",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.ambig,"ambig",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.ambib,"ambib",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mirr,"mirr",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mirg,"mirg",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mirb,"mirb",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.emit,"emit",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.alpha,"alpha",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.ref,"ref",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.translucency,"translucency",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.roughness,"roughness",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.darkness,"darkness",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.refrac,"refrac",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.group,"*group",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.diff_shader,"diff_shader",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.spec_shader,"spec_shader",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Mesh> (
|
||||
Mesh& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.totface,"totface",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.totedge,"totedge",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.totvert,"totvert",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.subdiv,"subdiv",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.subdivr,"subdivr",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.subsurftype,"subsurftype",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.smoothresh,"smoothresh",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.mface,"*mface",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.mtface,"*mtface",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.tface,"*tface",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.mvert,"*mvert",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.medge,"*medge",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.dvert,"*dvert",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.mcol,"*mcol",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<MDeformVert> (
|
||||
MDeformVert& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.dw,"*dw",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.totweight,"totweight",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<World> (
|
||||
World& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<MVert> (
|
||||
MVert& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.co,"co",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.no,"no",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.mat_nr,"mat_nr",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.bweight,"bweight",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<MEdge> (
|
||||
MEdge& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.v1,"v1",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.v2,"v2",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.crease,"crease",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.bweight,"bweight",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<GroupObject> (
|
||||
GroupObject& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.prev,"*prev",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.next,"*next",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.ob,"*ob",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<ListBase> (
|
||||
ListBase& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.first,"*first",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.last,"*last",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<ID> (
|
||||
ID& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.name,"name",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<MCol> (
|
||||
MCol& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.r,"r",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.g,"g",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.b,"b",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.a,"a",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Image> (
|
||||
Image& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.name,"name",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.ok,"ok",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.source,"source",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.type,"type",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.pad,"pad",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.pad1,"pad1",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.lastframe,"lastframe",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.tpageflag,"tpageflag",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.totbind,"totbind",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.xrep,"xrep",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.yrep,"yrep",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.twsta,"twsta",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.twend,"twend",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.packedfile,"*packedfile",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.lastupdate,"lastupdate",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.lastused,"lastused",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.animspeed,"animspeed",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.gen_x,"gen_x",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.gen_y,"gen_y",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.gen_type,"gen_type",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Scene> (
|
||||
Scene& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.camera,"*camera",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.world,"*world",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.basact,"*basact",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.base,"base",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Library> (
|
||||
Library& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.name,"name",db);
|
||||
ReadFieldArray<ErrorPolicy_Igno>(dest.filename,"filename",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.parent,"*parent",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Tex> (
|
||||
Tex& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.type,"type",db);
|
||||
ReadFieldPtr<ErrorPolicy_Igno>(dest.ima,"*ima",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
template <> void Structure :: Convert<Camera> (
|
||||
Camera& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
{
|
||||
|
||||
ReadField<ErrorPolicy_Igno>(dest.id,"id",db);
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.type,"type",db);
|
||||
ReadField<ErrorPolicy_Igno>((int&)dest.flag,"flag",db);
|
||||
ReadField<ErrorPolicy_Igno>(dest.angle,"angle",db);
|
||||
|
||||
db.reader->IncPtr(size);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------
|
||||
void DNA::RegisterConverters() {
|
||||
|
||||
converters["Object"] = &Structure::Convert<Object>;
|
||||
converters["Group"] = &Structure::Convert<Group>;
|
||||
converters["MTex"] = &Structure::Convert<MTex>;
|
||||
converters["TFace"] = &Structure::Convert<TFace>;
|
||||
converters["MFace"] = &Structure::Convert<MFace>;
|
||||
converters["Lamp"] = &Structure::Convert<Lamp>;
|
||||
converters["MDeformWeight"] = &Structure::Convert<MDeformWeight>;
|
||||
converters["PackedFile"] = &Structure::Convert<PackedFile>;
|
||||
converters["Base"] = &Structure::Convert<Base>;
|
||||
converters["MTFace"] = &Structure::Convert<MTFace>;
|
||||
converters["Material"] = &Structure::Convert<Material>;
|
||||
converters["Mesh"] = &Structure::Convert<Mesh>;
|
||||
converters["MDeformVert"] = &Structure::Convert<MDeformVert>;
|
||||
converters["World"] = &Structure::Convert<World>;
|
||||
converters["MVert"] = &Structure::Convert<MVert>;
|
||||
converters["MEdge"] = &Structure::Convert<MEdge>;
|
||||
converters["GroupObject"] = &Structure::Convert<GroupObject>;
|
||||
converters["ListBase"] = &Structure::Convert<ListBase>;
|
||||
converters["ID"] = &Structure::Convert<ID>;
|
||||
converters["MCol"] = &Structure::Convert<MCol>;
|
||||
converters["Image"] = &Structure::Convert<Image>;
|
||||
converters["Scene"] = &Structure::Convert<Scene>;
|
||||
converters["Library"] = &Structure::Convert<Library>;
|
||||
converters["Tex"] = &Structure::Convert<Tex>;
|
||||
converters["Camera"] = &Structure::Convert<Camera>;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
|
@ -0,0 +1,592 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderScene.h
|
||||
* @brief Intermediate representation of a BLEND scene.
|
||||
*/
|
||||
#ifndef INCLUDED_AI_BLEND_SCENE_H
|
||||
#define INCLUDED_AI_BLEND_SCENE_H
|
||||
|
||||
namespace Assimp {
|
||||
namespace Blender {
|
||||
|
||||
// Minor parts of this file are extracts from blender data structures,
|
||||
// declared in the ./source/blender/makesdna directory.
|
||||
// Stuff that is not used by Assimp is commented.
|
||||
|
||||
|
||||
// NOTE
|
||||
// this file serves as input data to the `./scripts/genblenddna.py`
|
||||
// script. This script generates the actual binding code to read a
|
||||
// blender file with a possibly different DNA into our structures.
|
||||
// Only `struct` declarations are considered and the following
|
||||
// rules must be obeyed in order for the script to work properly:
|
||||
//
|
||||
// * C++ style comments only
|
||||
//
|
||||
// * Structures may include the primitive types char, int, short,
|
||||
// float, double. Signedness specifiers are not allowed on
|
||||
// integers. Enum types are allowed, but they must have been
|
||||
// defined in this header.
|
||||
//
|
||||
// * Structures may aggregate other structures, unless not defined
|
||||
// in this header.
|
||||
//
|
||||
// * Pointers to other structures or primitive types are allowed.
|
||||
// No references or double pointers or arrays of pointers.
|
||||
// A pointer to a T is written as boost::shared_ptr, while a
|
||||
// pointer to an array of elements is written as boost::
|
||||
// shared_array.
|
||||
//
|
||||
// * Arrays can have maximally two-dimensions. Any non-pointer
|
||||
// type can form them.
|
||||
//
|
||||
// * Multiple fields can be declare in a single line (i.e `int a,b;`)
|
||||
// provided they are neither pointers nor arrays.
|
||||
//
|
||||
// * One of WARN, FAIL can be appended to the declaration (
|
||||
// prior to the semiolon to specifiy the error handling policy if
|
||||
// this field is missing in the input DNA). If none of those
|
||||
// is specified the default policy is to subtitute a default
|
||||
// value for the field.
|
||||
//
|
||||
|
||||
#define WARN // warn if field is missing, substitute default value
|
||||
#define FAIL // fail the import if the field does not exist
|
||||
|
||||
struct Object;
|
||||
|
||||
#define AI_BLEND_MESH_MAX_VERTS 2000000000L
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct ID : ElemBase {
|
||||
|
||||
char name[24] WARN;
|
||||
short flag;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct ListBase : ElemBase {
|
||||
|
||||
boost::shared_ptr<ElemBase> first;
|
||||
boost::shared_ptr<ElemBase> last;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct PackedFile : ElemBase {
|
||||
// int size;
|
||||
// int seek;
|
||||
// void* data;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct GroupObject : ElemBase {
|
||||
|
||||
boost::shared_ptr<GroupObject> prev,next FAIL;
|
||||
boost::shared_ptr<Object> ob;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Group : ElemBase {
|
||||
ID id FAIL;
|
||||
int layer;
|
||||
|
||||
boost::shared_ptr<GroupObject> gobject;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct World : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MVert : ElemBase {
|
||||
float co[3] FAIL;
|
||||
float no[3] FAIL;
|
||||
char flag;
|
||||
int mat_nr WARN;
|
||||
int bweight FAIL;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MEdge : ElemBase {
|
||||
int v1, v2 FAIL;
|
||||
char crease, bweight;
|
||||
short flag;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MCol : ElemBase {
|
||||
char r,g,b,a FAIL;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MFace : ElemBase {
|
||||
int v1,v2,v3,v4 FAIL;
|
||||
int mat_nr FAIL;
|
||||
char flag;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct TFace : ElemBase {
|
||||
float uv[4][2] FAIL;
|
||||
int col[4] FAIL;
|
||||
char flag;
|
||||
short mode;
|
||||
short tile;
|
||||
short unwrap;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MTFace : ElemBase {
|
||||
|
||||
float uv[4][2] FAIL;
|
||||
char flag;
|
||||
short mode;
|
||||
short tile;
|
||||
short unwrap;
|
||||
|
||||
// boost::shared_ptr<Image> tpage;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MDeformWeight : ElemBase {
|
||||
int def_nr FAIL;
|
||||
float weight FAIL;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MDeformVert : ElemBase {
|
||||
|
||||
boost::shared_array<MDeformWeight> dw WARN;
|
||||
int totweight;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Material : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
float r,g,b WARN;
|
||||
float specr,specg,specb WARN;
|
||||
float ambir,ambig,ambib WARN;
|
||||
float mirr,mirg,mirb;
|
||||
float emit WARN;
|
||||
float alpha WARN;
|
||||
float ref;
|
||||
float translucency;
|
||||
float roughness;
|
||||
float darkness;
|
||||
float refrac;
|
||||
|
||||
boost::shared_ptr<Group> group;
|
||||
|
||||
short diff_shader WARN;
|
||||
short spec_shader WARN;
|
||||
|
||||
//MTex *mtex[18];
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Mesh : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
int totface FAIL;
|
||||
int totedge FAIL;
|
||||
int totvert FAIL;
|
||||
|
||||
short subdiv;
|
||||
short subdivr;
|
||||
short subsurftype;
|
||||
short smoothresh;
|
||||
|
||||
boost::shared_array<MFace> mface FAIL;
|
||||
boost::shared_array<MTFace> mtface;
|
||||
boost::shared_array<TFace> tface;
|
||||
boost::shared_array<MVert> mvert FAIL;
|
||||
boost::shared_array<MEdge> medge WARN;
|
||||
boost::shared_array<MDeformVert> dvert;
|
||||
boost::shared_array<MCol> mcol;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Library : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
char name[240] WARN;
|
||||
char filename[240] FAIL;
|
||||
boost::shared_ptr<Library> parent WARN;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Camera : ElemBase {
|
||||
enum Type {
|
||||
Type_PERSP = 0
|
||||
,Type_ORTHO = 1
|
||||
};
|
||||
|
||||
ID id FAIL;
|
||||
|
||||
// struct AnimData *adt;
|
||||
|
||||
Type type,flag WARN;
|
||||
float angle WARN;
|
||||
//float passepartalpha, angle;
|
||||
//float clipsta, clipend;
|
||||
//float lens, ortho_scale, drawsize;
|
||||
//float shiftx, shifty;
|
||||
|
||||
//float YF_dofdist, YF_aperture;
|
||||
//short YF_bkhtype, YF_bkhbias;
|
||||
//float YF_bkhrot;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Lamp : ElemBase {
|
||||
|
||||
enum FalloffType {
|
||||
FalloffType_Constant = 0x0
|
||||
,FalloffType_InvLinear = 0x1
|
||||
,FalloffType_InvSquare = 0x2
|
||||
//,FalloffType_Curve = 0x3
|
||||
//,FalloffType_Sliders = 0x4
|
||||
};
|
||||
|
||||
enum Type {
|
||||
Type_Local = 0x0
|
||||
,Type_Sun = 0x1
|
||||
,Type_Spot = 0x2
|
||||
,Type_Hemi = 0x3
|
||||
,Type_Area = 0x4
|
||||
//,Type_YFPhoton = 0x5
|
||||
};
|
||||
|
||||
ID id FAIL;
|
||||
//AnimData *adt;
|
||||
|
||||
Type type FAIL;
|
||||
short flags;
|
||||
|
||||
//int mode;
|
||||
|
||||
short colormodel, totex;
|
||||
float r,g,b,k WARN;
|
||||
//float shdwr, shdwg, shdwb;
|
||||
|
||||
float energy, dist, spotsize, spotblend;
|
||||
//float haint;
|
||||
|
||||
float att1, att2;
|
||||
//struct CurveMapping *curfalloff;
|
||||
FalloffType falloff_type;
|
||||
|
||||
//float clipsta, clipend, shadspotsize;
|
||||
//float bias, soft, compressthresh;
|
||||
//short bufsize, samp, buffers, filtertype;
|
||||
//char bufflag, buftype;
|
||||
|
||||
//short ray_samp, ray_sampy, ray_sampz;
|
||||
//short ray_samp_type;
|
||||
//short area_shape;
|
||||
//float area_size, area_sizey, area_sizez;
|
||||
//float adapt_thresh;
|
||||
//short ray_samp_method;
|
||||
|
||||
//short texact, shadhalostep;
|
||||
|
||||
//short sun_effect_type;
|
||||
//short skyblendtype;
|
||||
//float horizon_brightness;
|
||||
//float spread;
|
||||
float sun_brightness;
|
||||
//float sun_size;
|
||||
//float backscattered_light;
|
||||
//float sun_intensity;
|
||||
//float atm_turbidity;
|
||||
//float atm_inscattering_factor;
|
||||
//float atm_extinction_factor;
|
||||
//float atm_distance_factor;
|
||||
//float skyblendfac;
|
||||
//float sky_exposure;
|
||||
//short sky_colorspace;
|
||||
|
||||
// int YF_numphotons, YF_numsearch;
|
||||
// short YF_phdepth, YF_useqmc, YF_bufsize, YF_pad;
|
||||
// float YF_causticblur, YF_ltradius;
|
||||
|
||||
// float YF_glowint, YF_glowofs;
|
||||
// short YF_glowtype, YF_pad2;
|
||||
|
||||
//struct Ipo *ipo;
|
||||
//struct MTex *mtex[18];
|
||||
// short pr_texture;
|
||||
|
||||
//struct PreviewImage *preview;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Object : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
enum Type {
|
||||
Type_EMPTY = 0
|
||||
,Type_MESH = 1
|
||||
,Type_CURVE = 2
|
||||
,Type_SURF = 3
|
||||
,Type_FONT = 4
|
||||
,Type_MBALL = 5
|
||||
|
||||
,Type_LAMP = 10
|
||||
,Type_CAMERA = 11
|
||||
|
||||
,Type_WAVE = 21
|
||||
,Type_LATTICE = 22
|
||||
};
|
||||
|
||||
Type type FAIL;
|
||||
float obmat[4][4] WARN;
|
||||
float parentinv[4][4] WARN;
|
||||
char parsubstr[32] WARN;
|
||||
|
||||
boost::shared_ptr<Object> parent WARN;
|
||||
boost::shared_ptr<Object> track WARN;
|
||||
|
||||
boost::shared_ptr<Object> proxy,proxy_from,proxy_group WARN;
|
||||
boost::shared_ptr<Group> dup_group WARN;
|
||||
boost::shared_ptr<ElemBase> data FAIL;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Base : ElemBase {
|
||||
boost::shared_ptr<Base> prev WARN;
|
||||
boost::shared_ptr<Base> next WARN;
|
||||
boost::shared_ptr<Object> object WARN;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Scene : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
boost::shared_ptr<Object> camera WARN;
|
||||
boost::shared_ptr<World> world WARN;
|
||||
boost::shared_ptr<Base> basact WARN;
|
||||
|
||||
ListBase base;
|
||||
};
|
||||
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Image : ElemBase {
|
||||
ID id FAIL;
|
||||
|
||||
char name[240] WARN;
|
||||
|
||||
//struct anim *anim;
|
||||
|
||||
short ok, flag;
|
||||
short source, type, pad, pad1;
|
||||
int lastframe;
|
||||
|
||||
short tpageflag, totbind;
|
||||
short xrep, yrep;
|
||||
short twsta, twend;
|
||||
//unsigned int bindcode;
|
||||
//unsigned int *repbind;
|
||||
|
||||
boost::shared_ptr<PackedFile> packedfile;
|
||||
//struct PreviewImage * preview;
|
||||
|
||||
float lastupdate;
|
||||
int lastused;
|
||||
short animspeed;
|
||||
|
||||
short gen_x, gen_y, gen_type;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct Tex : ElemBase {
|
||||
|
||||
// actually, the only texture type we support is Type_IMAGE
|
||||
enum Type {
|
||||
Type_CLOUDS = 1
|
||||
,Type_WOOD = 2
|
||||
,Type_MARBLE = 3
|
||||
,Type_MAGIC = 4
|
||||
,Type_BLEND = 5
|
||||
,Type_STUCCI = 6
|
||||
,Type_NOISE = 7
|
||||
,Type_IMAGE = 8
|
||||
,Type_PLUGIN = 9
|
||||
,Type_ENVMAP = 10
|
||||
,Type_MUSGRAVE = 11
|
||||
,Type_VORONOI = 12
|
||||
,Type_DISTNOISE = 13
|
||||
,Type_POINTDENSITY = 14
|
||||
,Type_VOXELDATA = 15
|
||||
};
|
||||
|
||||
ID id FAIL;
|
||||
// AnimData *adt;
|
||||
|
||||
//float noisesize, turbul;
|
||||
//float bright, contrast, rfac, gfac, bfac;
|
||||
//float filtersize;
|
||||
|
||||
//float mg_H, mg_lacunarity, mg_octaves, mg_offset, mg_gain;
|
||||
//float dist_amount, ns_outscale;
|
||||
|
||||
//float vn_w1;
|
||||
//float vn_w2;
|
||||
//float vn_w3;
|
||||
//float vn_w4;
|
||||
//float vn_mexp;
|
||||
//short vn_distm, vn_coltype;
|
||||
|
||||
//short noisedepth, noisetype;
|
||||
//short noisebasis, noisebasis2;
|
||||
|
||||
//short imaflag, flag;
|
||||
Type type FAIL;
|
||||
//short stype;
|
||||
|
||||
//float cropxmin, cropymin, cropxmax, cropymax;
|
||||
//int texfilter;
|
||||
//int afmax;
|
||||
//short xrepeat, yrepeat;
|
||||
//short extend;
|
||||
|
||||
//short fie_ima;
|
||||
//int len;
|
||||
//int frames, offset, sfra;
|
||||
|
||||
//float checkerdist, nabla;
|
||||
//float norfac;
|
||||
|
||||
//ImageUser iuser;
|
||||
|
||||
//bNodeTree *nodetree;
|
||||
//Ipo *ipo;
|
||||
boost::shared_ptr<Image> ima WARN;
|
||||
//PluginTex *plugin;
|
||||
//ColorBand *coba;
|
||||
//EnvMap *env;
|
||||
//PreviewImage * preview;
|
||||
//PointDensity *pd;
|
||||
//VoxelData *vd;
|
||||
|
||||
//char use_nodes;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------
|
||||
struct MTex : ElemBase {
|
||||
|
||||
enum Projection {
|
||||
Proj_N = 0
|
||||
,Proj_X = 1
|
||||
,Proj_Y = 2
|
||||
,Proj_Z = 3
|
||||
};
|
||||
|
||||
enum Flag {
|
||||
Flag_RGBTOINT = 0x1
|
||||
,Flag_STENCIL = 0x2
|
||||
,Flag_NEGATIVE = 0x4
|
||||
,Flag_ALPHAMIX = 0x8
|
||||
,Flag_VIEWSPACE = 0x10
|
||||
};
|
||||
|
||||
enum BlendType {
|
||||
BlendType_BLEND = 0
|
||||
,BlendType_MUL = 1
|
||||
,BlendType_ADD = 2
|
||||
,BlendType_SUB = 3
|
||||
,BlendType_DIV = 4
|
||||
,BlendType_DARK = 5
|
||||
,BlendType_DIFF = 6
|
||||
,BlendType_LIGHT = 7
|
||||
,BlendType_SCREEN = 8
|
||||
,BlendType_OVERLAY = 9
|
||||
,BlendType_BLEND_HUE = 10
|
||||
,BlendType_BLEND_SAT = 11
|
||||
,BlendType_BLEND_VAL = 12
|
||||
,BlendType_BLEND_COLOR = 13
|
||||
};
|
||||
|
||||
// short texco, mapto, maptoneg;
|
||||
|
||||
BlendType blendtype;
|
||||
boost::shared_ptr<Object> object;
|
||||
boost::shared_ptr<Tex> tex;
|
||||
char uvname[32];
|
||||
|
||||
Projection projx,projy,projz;
|
||||
char mapping;
|
||||
float ofs[3], size[3], rot;
|
||||
|
||||
int texflag;
|
||||
short colormodel, pmapto, pmaptoneg;
|
||||
//short normapspace, which_output;
|
||||
//char brush_map_mode;
|
||||
float r,g,b,k WARN;
|
||||
//float def_var, rt;
|
||||
|
||||
//float colfac, varfac;
|
||||
|
||||
//float norfac, dispfac, warpfac;
|
||||
float colspecfac, mirrfac, alphafac;
|
||||
float difffac, specfac, emitfac, hardfac;
|
||||
//float raymirrfac, translfac, ambfac;
|
||||
//float colemitfac, colreflfac, coltransfac;
|
||||
//float densfac, scatterfac, reflfac;
|
||||
|
||||
//float timefac, lengthfac, clumpfac;
|
||||
//float kinkfac, roughfac, padensfac;
|
||||
//float lifefac, sizefac, ivelfac, pvelfac;
|
||||
//float shadowfac;
|
||||
//float zenupfac, zendownfac, blendfac;
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -0,0 +1,205 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderSceneGen.h
|
||||
* @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py
|
||||
*/
|
||||
#ifndef INCLUDED_AI_BLEND_SCENEGEN_H
|
||||
#define INCLUDED_AI_BLEND_SCENEGEN_H
|
||||
|
||||
namespace Assimp {
|
||||
namespace Blender {
|
||||
|
||||
|
||||
template <> void Structure :: Convert<Object> (
|
||||
Object& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Group> (
|
||||
Group& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<MTex> (
|
||||
MTex& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<TFace> (
|
||||
TFace& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<MFace> (
|
||||
MFace& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Lamp> (
|
||||
Lamp& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<MDeformWeight> (
|
||||
MDeformWeight& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<PackedFile> (
|
||||
PackedFile& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Base> (
|
||||
Base& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<MTFace> (
|
||||
MTFace& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Material> (
|
||||
Material& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Mesh> (
|
||||
Mesh& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<MDeformVert> (
|
||||
MDeformVert& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<World> (
|
||||
World& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<MVert> (
|
||||
MVert& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<MEdge> (
|
||||
MEdge& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<GroupObject> (
|
||||
GroupObject& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<ListBase> (
|
||||
ListBase& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<ID> (
|
||||
ID& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<MCol> (
|
||||
MCol& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Image> (
|
||||
Image& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Scene> (
|
||||
Scene& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Library> (
|
||||
Library& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Tex> (
|
||||
Tex& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
template <> void Structure :: Convert<Camera> (
|
||||
Camera& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -305,6 +305,17 @@ SOURCE_GROUP(COB FILES
|
|||
COBScene.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP(BLENDER FILES
|
||||
BlenderLoader.cpp
|
||||
BlenderLoader.h
|
||||
BlenderDNA.cpp
|
||||
BlenderDNA.h
|
||||
BlenderDNA.inl
|
||||
BlenderScene.cpp
|
||||
BlenderScene.h
|
||||
BlenderSceneGen.h
|
||||
)
|
||||
|
||||
SOURCE_GROUP( PostProcessing FILES
|
||||
CalcTangentsProcess.cpp
|
||||
CalcTangentsProcess.h
|
||||
|
@ -676,6 +687,14 @@ ADD_LIBRARY( assimp SHARED
|
|||
COBScene.h
|
||||
TinyFormatter.h
|
||||
LineSplitter.h
|
||||
BlenderLoader.cpp
|
||||
BlenderLoader.h
|
||||
BlenderDNA.cpp
|
||||
BlenderDNA.h
|
||||
BlenderDNA.inl
|
||||
BlenderScene.cpp
|
||||
BlenderScene.h
|
||||
BlenderSceneGen.h
|
||||
|
||||
# Necessary to show the headers in the project when using the VC++ generator:
|
||||
BoostWorkaround/boost/math/common_factor_rt.hpp
|
||||
|
|
|
@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
*/
|
||||
#include "AssimpPCH.h"
|
||||
|
||||
#ifndef AI_BUILD_NO_COB_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_COB_IMPORTER
|
||||
#include "COBLoader.h"
|
||||
#include "COBScene.h"
|
||||
|
||||
|
@ -125,8 +125,7 @@ void COBImporter::InternReadFile( const std::string& pFile,
|
|||
aiScene* pScene, IOSystem* pIOHandler)
|
||||
{
|
||||
COB::Scene scene;
|
||||
boost::scoped_ptr<StreamReaderLE> stream(new StreamReaderLE(
|
||||
pIOHandler->Open(pFile,"rb")) );
|
||||
boost::scoped_ptr<StreamReaderLE> stream(new StreamReaderLE( pIOHandler->Open(pFile,"rb")) );
|
||||
|
||||
// check header
|
||||
char head[32];
|
||||
|
|
|
@ -45,7 +45,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "AssimpPCH.h"
|
||||
|
||||
#ifndef AI_BUILD_NO_CSM_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
|
||||
|
||||
#include "CSMLoader.h"
|
||||
#include "SkeletonMeshBuilder.h"
|
||||
|
@ -278,4 +278,4 @@ void CSMImporter::InternReadFile( const std::string& pFile,
|
|||
SkeletonMeshBuilder maker(pScene,pScene->mRootNode,true);
|
||||
}
|
||||
|
||||
#endif // !! AI_BUILD_NO_CSM_IMPORTER
|
||||
#endif // !! ASSIMP_BUILD_NO_CSM_IMPORTER
|
||||
|
|
|
@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "AssimpPCH.h"
|
||||
|
||||
#ifndef AI_BUILD_NO_FINDINVALIDDATA_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS
|
||||
|
||||
// internal headers
|
||||
#include "FindInvalidDataProcess.h"
|
||||
|
@ -416,4 +416,4 @@ int FindInvalidDataProcess::ProcessMesh (aiMesh* pMesh)
|
|||
}
|
||||
|
||||
|
||||
#endif // !! AI_BUILD_NO_FINDINVALIDDATA_PROCESS
|
||||
#endif // !! ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS
|
||||
|
|
|
@ -72,170 +72,173 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
// Importers
|
||||
// (include_new_importers_here)
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#ifndef AI_BUILD_NO_X_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_X_IMPORTER
|
||||
# include "XFileImporter.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_3DS_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_3DS_IMPORTER
|
||||
# include "3DSLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_MD3_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_MD3_IMPORTER
|
||||
# include "MD3Loader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_MDL_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_MDL_IMPORTER
|
||||
# include "MDLLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_MD2_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_MD2_IMPORTER
|
||||
# include "MD2Loader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_PLY_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_PLY_IMPORTER
|
||||
# include "PlyLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_ASE_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_ASE_IMPORTER
|
||||
# include "ASELoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_OBJ_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_OBJ_IMPORTER
|
||||
# include "ObjFileImporter.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_HMP_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_HMP_IMPORTER
|
||||
# include "HMPLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_SMD_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_SMD_IMPORTER
|
||||
# include "SMDLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_MDC_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_MDC_IMPORTER
|
||||
# include "MDCLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_MD5_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_MD5_IMPORTER
|
||||
# include "MD5Loader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_STL_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_STL_IMPORTER
|
||||
# include "STLLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_LWO_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_LWO_IMPORTER
|
||||
# include "LWOLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_DXF_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_DXF_IMPORTER
|
||||
# include "DXFLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_NFF_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_NFF_IMPORTER
|
||||
# include "NFFLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_RAW_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_RAW_IMPORTER
|
||||
# include "RawLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_OFF_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_OFF_IMPORTER
|
||||
# include "OFFLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_AC_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_AC_IMPORTER
|
||||
# include "ACLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_BVH_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_BVH_IMPORTER
|
||||
# include "BVHLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_IRRMESH_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_IRRMESH_IMPORTER
|
||||
# include "IRRMeshLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_IRR_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_IRR_IMPORTER
|
||||
# include "IRRLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_Q3D_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_Q3D_IMPORTER
|
||||
# include "Q3DLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_B3D_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_B3D_IMPORTER
|
||||
# include "B3DImporter.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_COLLADA_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_COLLADA_IMPORTER
|
||||
# include "ColladaLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_TERRAGEN_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
|
||||
# include "TerragenLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_CSM_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_CSM_IMPORTER
|
||||
# include "CSMLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_3D_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_3D_IMPORTER
|
||||
# include "UnrealLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_LWS_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_LWS_IMPORTER
|
||||
# include "LWSLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_OGRE_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_OGRE_IMPORTER
|
||||
# include "OgreImporter.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_MS3D_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_MS3D_IMPORTER
|
||||
# include "MS3DLoader.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_COB_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_COB_IMPORTER
|
||||
# include "COBLoader.h"
|
||||
#endif
|
||||
#ifndef ASSIMP_BUILD_NO_COB_IMPORTER
|
||||
# include "BlenderLoader.h"
|
||||
#endif
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
// Post processing-Steps
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
#ifndef AI_BUILD_NO_CALCTANGENTS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS
|
||||
# include "CalcTangentsProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_JOINVERTICES_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_JOINVERTICES_PROCESS
|
||||
# include "JoinVerticesProcess.h"
|
||||
#endif
|
||||
#if !(defined AI_BUILD_NO_MAKELEFTHANDED_PROCESS && defined AI_BUILD_NO_FLIPUVS_PROCESS && defined AI_BUILD_NO_FLIPWINDINGORDER_PROCESS)
|
||||
#if !(defined ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS && defined ASSIMP_BUILD_NO_FLIPUVS_PROCESS && defined ASSIMP_BUILD_NO_FLIPWINDINGORDER_PROCESS)
|
||||
# include "ConvertToLHProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_TRIANGULATE_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_TRIANGULATE_PROCESS
|
||||
# include "TriangulateProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_GENFACENORMALS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS
|
||||
# include "GenFaceNormalsProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_GENVERTEXNORMALS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS
|
||||
# include "GenVertexNormalsProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_REMOVEVC_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_REMOVEVC_PROCESS
|
||||
# include "RemoveVCProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_SPLITLARGEMESHES_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS
|
||||
# include "SplitLargeMeshes.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_PRETRANSFORMVERTICES_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS
|
||||
# include "PretransformVertices.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_LIMITBONEWEIGHTS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS
|
||||
# include "LimitBoneWeightsProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||
# include "ValidateDataStructure.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_IMPROVECACHELOCALITY_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS
|
||||
# include "ImproveCacheLocality.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_FIXINFACINGNORMALS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS
|
||||
# include "FixNormalsStep.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS
|
||||
# include "RemoveRedundantMaterials.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_FINDINVALIDDATA_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS
|
||||
# include "FindInvalidDataProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_FINDDEGENERATES_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS
|
||||
# include "FindDegenerates.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_SORTBYPTYPE_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS
|
||||
# include "SortByPTypeProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_GENUVCOORDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS
|
||||
# include "ComputeUVMappingProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
|
||||
# include "TextureTransform.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_FINDINSTANCES_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS
|
||||
# include "FindInstancesProcess.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_OPTIMIZEMESHES_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS
|
||||
# include "OptimizeMeshes.h"
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_OPTIMIZEGRAPH_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS
|
||||
# include "OptimizeGraph.h"
|
||||
#endif
|
||||
|
||||
|
@ -302,102 +305,105 @@ Importer::Importer()
|
|||
// (register_new_importers_here)
|
||||
// ----------------------------------------------------------------------------
|
||||
pimpl->mImporter.reserve(64);
|
||||
#if (!defined AI_BUILD_NO_X_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_X_IMPORTER)
|
||||
pimpl->mImporter.push_back( new XFileImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_OBJ_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_OBJ_IMPORTER)
|
||||
pimpl->mImporter.push_back( new ObjFileImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_3DS_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_3DS_IMPORTER)
|
||||
pimpl->mImporter.push_back( new Discreet3DSImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_MD3_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_MD3_IMPORTER)
|
||||
pimpl->mImporter.push_back( new MD3Importer());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_MD2_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_MD2_IMPORTER)
|
||||
pimpl->mImporter.push_back( new MD2Importer());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_PLY_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_PLY_IMPORTER)
|
||||
pimpl->mImporter.push_back( new PLYImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_MDL_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_MDL_IMPORTER)
|
||||
pimpl->mImporter.push_back( new MDLImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_ASE_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_ASE_IMPORTER)
|
||||
pimpl->mImporter.push_back( new ASEImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_HMP_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_HMP_IMPORTER)
|
||||
pimpl->mImporter.push_back( new HMPImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_SMD_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_SMD_IMPORTER)
|
||||
pimpl->mImporter.push_back( new SMDImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_MDC_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_MDC_IMPORTER)
|
||||
pimpl->mImporter.push_back( new MDCImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_MD5_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_MD5_IMPORTER)
|
||||
pimpl->mImporter.push_back( new MD5Importer());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_STL_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_STL_IMPORTER)
|
||||
pimpl->mImporter.push_back( new STLImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_LWO_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_LWO_IMPORTER)
|
||||
pimpl->mImporter.push_back( new LWOImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_DXF_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_DXF_IMPORTER)
|
||||
pimpl->mImporter.push_back( new DXFImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_NFF_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_NFF_IMPORTER)
|
||||
pimpl->mImporter.push_back( new NFFImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_RAW_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_RAW_IMPORTER)
|
||||
pimpl->mImporter.push_back( new RAWImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_OFF_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_OFF_IMPORTER)
|
||||
pimpl->mImporter.push_back( new OFFImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_AC_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_AC_IMPORTER)
|
||||
pimpl->mImporter.push_back( new AC3DImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_BVH_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_BVH_IMPORTER)
|
||||
pimpl->mImporter.push_back( new BVHLoader());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_IRRMESH_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_IRRMESH_IMPORTER)
|
||||
pimpl->mImporter.push_back( new IRRMeshImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_IRR_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_IRR_IMPORTER)
|
||||
pimpl->mImporter.push_back( new IRRImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_Q3D_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_Q3D_IMPORTER)
|
||||
pimpl->mImporter.push_back( new Q3DImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_B3D_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_B3D_IMPORTER)
|
||||
pimpl->mImporter.push_back( new B3DImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_COLLADA_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_COLLADA_IMPORTER)
|
||||
pimpl->mImporter.push_back( new ColladaLoader());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_TERRAGEN_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_TERRAGEN_IMPORTER)
|
||||
pimpl->mImporter.push_back( new TerragenImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_CSM_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_CSM_IMPORTER)
|
||||
pimpl->mImporter.push_back( new CSMImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_3D_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_3D_IMPORTER)
|
||||
pimpl->mImporter.push_back( new UnrealImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_LWS_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_LWS_IMPORTER)
|
||||
pimpl->mImporter.push_back( new LWSImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_OGRE_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_OGRE_IMPORTER)
|
||||
pimpl->mImporter.push_back( new Ogre::OgreImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_MS3D_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_MS3D_IMPORTER)
|
||||
pimpl->mImporter.push_back( new MS3DImporter());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_COB_IMPORTER)
|
||||
#if (!defined ASSIMP_BUILD_NO_COB_IMPORTER)
|
||||
pimpl->mImporter.push_back( new COBImporter());
|
||||
#endif
|
||||
#if (!defined ASSIMP_BUILD_NO_BLEND_IMPORTER)
|
||||
pimpl->mImporter.push_back( new BlenderImporter());
|
||||
#endif
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Add an instance of each post processing step here in the order
|
||||
|
@ -405,49 +411,49 @@ Importer::Importer()
|
|||
// validated - as RegisterPPStep() does - all dependencies must be given.
|
||||
// ----------------------------------------------------------------------------
|
||||
pimpl->mPostProcessingSteps.reserve(25);
|
||||
#if (!defined AI_BUILD_NO_REMOVEVC_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_REMOVEVC_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new RemoveVCProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_REMOVE_REDUNDANTMATERIALS_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new RemoveRedundantMatsProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_FINDINSTANCES_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_FINDINSTANCES_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new FindInstancesProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_OPTIMIZEGRAPH_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_OPTIMIZEGRAPH_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new OptimizeGraphProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_OPTIMIZEMESHES_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_OPTIMIZEMESHES_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new OptimizeMeshesProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_FINDDEGENERATES_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_FINDDEGENERATES_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new FindDegeneratesProcess());
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_GENUVCOORDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_GENUVCOORDS_PROCESS
|
||||
pimpl->mPostProcessingSteps.push_back( new ComputeUVMappingProcess());
|
||||
#endif
|
||||
#ifndef AI_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_TRANSFORMTEXCOORDS_PROCESS
|
||||
pimpl->mPostProcessingSteps.push_back( new TextureTransformStep());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_PRETRANSFORMVERTICES_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_PRETRANSFORMVERTICES_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new PretransformVertices());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_TRIANGULATE_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_TRIANGULATE_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new TriangulateProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_SORTBYPTYPE_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_SORTBYPTYPE_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new SortByPTypeProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_FINDINVALIDDATA_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_FINDINVALIDDATA_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new FindInvalidDataProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_FIXINFACINGNORMALS_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_FIXINFACINGNORMALS_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new FixInfacingNormalsProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new SplitLargeMeshesProcess_Triangle());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_GENFACENORMALS_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_GENFACENORMALS_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new GenFaceNormalsProcess());
|
||||
#endif
|
||||
|
||||
|
@ -456,13 +462,13 @@ Importer::Importer()
|
|||
pimpl->mPostProcessingSteps.push_back( new ComputeSpatialSortProcess());
|
||||
// .........................................................................
|
||||
|
||||
#if (!defined AI_BUILD_NO_GENVERTEXNORMALS_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_GENVERTEXNORMALS_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new GenVertexNormalsProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_CALCTANGENTS_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_CALCTANGENTS_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new CalcTangentsProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_JOINVERTICES_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_JOINVERTICES_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new JoinVerticesProcess());
|
||||
#endif
|
||||
|
||||
|
@ -470,22 +476,22 @@ Importer::Importer()
|
|||
pimpl->mPostProcessingSteps.push_back( new DestroySpatialSortProcess());
|
||||
// .........................................................................
|
||||
|
||||
#if (!defined AI_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_SPLITLARGEMESHES_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new SplitLargeMeshesProcess_Vertex());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_MAKELEFTHANDED_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_MAKELEFTHANDED_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new MakeLeftHandedProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_FLIPUVS_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_FLIPUVS_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new FlipUVsProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_FLIPWINDINGORDER_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_FLIPWINDINGORDER_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new FlipWindingOrderProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_LIMITBONEWEIGHTS_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_LIMITBONEWEIGHTS_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new LimitBoneWeightsProcess());
|
||||
#endif
|
||||
#if (!defined AI_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
|
||||
#if (!defined ASSIMP_BUILD_NO_IMPROVECACHELOCALITY_PROCESS)
|
||||
pimpl->mPostProcessingSteps.push_back( new ImproveCacheLocalityProcess());
|
||||
#endif
|
||||
|
||||
|
@ -739,7 +745,7 @@ bool Importer::ValidateFlags(unsigned int pFlags)
|
|||
}
|
||||
|
||||
// ValidateDS does not anymore occur in the pp list, it plays an awesome extra role ...
|
||||
#ifdef AI_BUILD_NO_VALIDATEDS_PROCESS
|
||||
#ifdef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||
if (pFlags & aiProcess_ValidateDataStructure)
|
||||
return false;
|
||||
#endif
|
||||
|
@ -873,7 +879,7 @@ const aiScene* Importer::ReadFile( const char* _pFile, unsigned int pFlags)
|
|||
// If successful, apply all active post processing steps to the imported data
|
||||
if( pimpl->mScene) {
|
||||
|
||||
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||
// The ValidateDS process is an exception. It is executed first, even before ScenePreprocessor is called.
|
||||
if (pFlags & aiProcess_ValidateDataStructure)
|
||||
{
|
||||
|
@ -939,7 +945,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|||
ai_assert(_ValidateFlags(pFlags));
|
||||
DefaultLogger::get()->info("Entering post processing pipeline");
|
||||
|
||||
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||
// The ValidateDS process plays an exceptional role. It isn't contained in the global
|
||||
// list of post-processing steps, so we need to call it manually.
|
||||
if (pFlags & aiProcess_ValidateDataStructure)
|
||||
|
@ -954,7 +960,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|||
#ifdef _DEBUG
|
||||
if (pimpl->bExtraVerbose)
|
||||
{
|
||||
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||
DefaultLogger::get()->error("Verbose Import is not available due to build settings");
|
||||
#endif // no validation
|
||||
pFlags |= aiProcess_ValidateDataStructure;
|
||||
|
@ -976,7 +982,7 @@ const aiScene* Importer::ApplyPostProcessing(unsigned int pFlags)
|
|||
}
|
||||
#ifdef _DEBUG
|
||||
|
||||
#ifndef AI_BUILD_NO_VALIDATEDS_PROCESS
|
||||
#ifndef ASSIMP_BUILD_NO_VALIDATEDS_PROCESS
|
||||
continue;
|
||||
#endif // no validation
|
||||
|
||||
|
|
|
@ -47,6 +47,47 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "ByteSwap.h"
|
||||
namespace Assimp {
|
||||
namespace Intern {
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
template <typename T, bool doit>
|
||||
struct ByteSwapper {
|
||||
void operator() (T* inout) {
|
||||
ByteSwap::Swap(inout);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ByteSwapper<T,false> {
|
||||
void operator() (T*) {
|
||||
}
|
||||
};
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
template <bool SwapEndianess, typename T, bool RuntimeSwitch>
|
||||
struct Getter {
|
||||
void operator() (T* inout, bool le) {
|
||||
#ifdef AI_BUILD_BIG_ENDIAN
|
||||
le = le;
|
||||
#else
|
||||
le = !le;
|
||||
#endif
|
||||
if (le) {
|
||||
ByteSwapper<T,(sizeof(T)>1?true:false)> () (inout);
|
||||
}
|
||||
else ByteSwapper<T,false> () (inout);
|
||||
}
|
||||
};
|
||||
|
||||
template <bool SwapEndianess, typename T>
|
||||
struct Getter<SwapEndianess,T,false> {
|
||||
void operator() (T* inout, bool le) {
|
||||
|
||||
// static branch
|
||||
ByteSwapper<T,(SwapEndianess && sizeof(T)>1)> () (inout);
|
||||
}
|
||||
};
|
||||
} // end Intern
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
/** Wrapper class around IOStream to allow for consistent reading of binary data in both
|
||||
|
@ -58,39 +99,51 @@ namespace Assimp {
|
|||
*
|
||||
* XXX switch from unsigned int for size types to size_t? or ptrdiff_t?*/
|
||||
// --------------------------------------------------------------------------------------------
|
||||
template <bool SwapEndianess = false>
|
||||
template <bool SwapEndianess = false, bool RuntimeSwitch = false>
|
||||
class StreamReader
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// FIXME: use these data types throughout the whole library,
|
||||
// then change them to 64 bit values :-)
|
||||
|
||||
typedef int diff;
|
||||
typedef unsigned int pos;
|
||||
|
||||
public:
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Construction from a given stream with a well-defined endianess
|
||||
/** Construction from a given stream with a well-defined endianess.
|
||||
*
|
||||
* The stream will be deleted afterwards.
|
||||
* @param stream Input stream
|
||||
*/
|
||||
StreamReader(IOStream* _stream)
|
||||
* The StreamReader holds a permanent strong reference to the
|
||||
* stream, which is released upon destruction.
|
||||
* @param stream Input stream. The stream is not restarted if
|
||||
* its file pointer is not at 0. Instead, the stream reader
|
||||
* reads from the current position to the end of the stream.
|
||||
* @param le If @c RuntimeSwitch is true: specifies whether the
|
||||
* stream is in little endian byte order. Otherwise the
|
||||
* endianess information is contained in the @c SwapEndianess
|
||||
* template parameter and this parameter is meaningless. */
|
||||
StreamReader(boost::shared_ptr<IOStream> stream, bool le = false)
|
||||
: stream(stream)
|
||||
, le(le)
|
||||
{
|
||||
if (!_stream) {
|
||||
throw DeadlyImportError("StreamReader: Unable to open file");
|
||||
}
|
||||
stream = _stream;
|
||||
|
||||
const size_t s = stream->FileSize();
|
||||
if (!s) {
|
||||
throw DeadlyImportError("StreamReader: File is empty");
|
||||
_Begin();
|
||||
}
|
||||
|
||||
current = buffer = new int8_t[s];
|
||||
stream->Read(current,s,1);
|
||||
end = limit = &buffer[s];
|
||||
}
|
||||
|
||||
~StreamReader()
|
||||
// ---------------------------------------------------------------------
|
||||
StreamReader(IOStream* stream, bool le = false)
|
||||
: stream(boost::shared_ptr<IOStream>(stream))
|
||||
, le(le)
|
||||
{
|
||||
_Begin();
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
~StreamReader() {
|
||||
delete[] buffer;
|
||||
delete stream;
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -180,8 +233,8 @@ public:
|
|||
/** Increase the file pointer (relative seeking) */
|
||||
void IncPtr(int plus) {
|
||||
current += plus;
|
||||
if (current > end) {
|
||||
throw DeadlyImportError("End of file was reached");
|
||||
if (current > limit) {
|
||||
throw DeadlyImportError("End of file or read limit was reached");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -201,8 +254,8 @@ public:
|
|||
void SetPtr(int8_t* p) {
|
||||
|
||||
current = p;
|
||||
if (current > end || current < buffer) {
|
||||
throw DeadlyImportError("End of file was reached");
|
||||
if (current > limit || current < buffer) {
|
||||
throw DeadlyImportError("End of file or read limit was reached");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -225,6 +278,10 @@ public:
|
|||
return (unsigned int)(current - buffer);
|
||||
}
|
||||
|
||||
void SetCurrentPos(size_t pos) {
|
||||
SetPtr(buffer + pos);
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Setup a temporary read limit
|
||||
*
|
||||
|
@ -268,19 +325,6 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
template <typename T, bool doit>
|
||||
struct ByteSwapper {
|
||||
void operator() (T* inout) {
|
||||
ByteSwap::Swap(inout);
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ByteSwapper<T,false> {
|
||||
void operator() (T*) {
|
||||
}
|
||||
};
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
/** Generic read method. ByteSwap::Swap(T*) *must* be defined */
|
||||
template <typename T>
|
||||
|
@ -290,19 +334,39 @@ private:
|
|||
}
|
||||
|
||||
T f = *((const T*)current);
|
||||
ByteSwapper<T,(SwapEndianess && sizeof(T)>1)> swapper;
|
||||
swapper(&f);
|
||||
Intern :: Getter<SwapEndianess,T,RuntimeSwitch>() (&f,le);
|
||||
|
||||
current += sizeof(T);
|
||||
return f;
|
||||
}
|
||||
|
||||
IOStream* stream;
|
||||
// ---------------------------------------------------------------------
|
||||
void _Begin() {
|
||||
if (!stream) {
|
||||
throw DeadlyImportError("StreamReader: Unable to open file");
|
||||
}
|
||||
|
||||
const size_t s = stream->FileSize() - stream->Tell();
|
||||
if (!s) {
|
||||
throw DeadlyImportError("StreamReader: File is empty or EOF is already reached");
|
||||
}
|
||||
|
||||
current = buffer = new int8_t[s];
|
||||
stream->Read(current,s,1);
|
||||
end = limit = &buffer[s];
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
|
||||
boost::shared_ptr<IOStream> stream;
|
||||
int8_t *buffer, *current, *end, *limit;
|
||||
bool le;
|
||||
};
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------------------------
|
||||
// `static` StreamReaders. Their byte order is fixed and they might be a little bit faster.
|
||||
#ifdef AI_BUILD_BIG_ENDIAN
|
||||
typedef StreamReader<true> StreamReaderLE;
|
||||
typedef StreamReader<false> StreamReaderBE;
|
||||
|
@ -311,6 +375,10 @@ private:
|
|||
typedef StreamReader<false> StreamReaderLE;
|
||||
#endif
|
||||
|
||||
// `dynamic` StreamReader. The byte order of the input data is specified in the
|
||||
// c'tor. This involves runtime branching and might be a little bit slower.
|
||||
typedef StreamReader<true,true> StreamReaderAny;
|
||||
|
||||
} // end namespace Assimp
|
||||
|
||||
#endif // !! AI_STREAMREADER_H_INCLUDED
|
||||
|
|
|
@ -43,7 +43,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "AssimpPCH.h"
|
||||
|
||||
#ifndef AI_BUILD_NO_TERRAGEN_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
|
||||
#include "TerragenLoader.h"
|
||||
|
||||
using namespace Assimp;
|
||||
|
@ -251,4 +251,4 @@ void TerragenImporter::InternReadFile( const std::string& pFile,
|
|||
pScene->mFlags |= AI_SCENE_FLAGS_TERRAIN;
|
||||
}
|
||||
|
||||
#endif // !! AI_BUILD_NO_TERRAGEN_IMPORTER
|
||||
#endif // !! ASSIMP_BUILD_NO_TERRAGEN_IMPORTER
|
||||
|
|
|
@ -113,6 +113,20 @@ public:
|
|||
return *this;
|
||||
}
|
||||
|
||||
|
||||
// comma operator overloaded as well, choose your preferred way.
|
||||
template <typename TToken>
|
||||
const basic_formatter& operator, (const TToken& s) const {
|
||||
underlying << s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename TToken>
|
||||
basic_formatter& operator, (const TToken& s) {
|
||||
underlying << s;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
mutable stringstream underlying;
|
||||
};
|
||||
|
|
|
@ -48,7 +48,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include "AssimpPCH.h"
|
||||
|
||||
#ifndef AI_BUILD_NO_3D_IMPORTER
|
||||
#ifndef ASSIMP_BUILD_NO_3D_IMPORTER
|
||||
|
||||
#include "UnrealLoader.h"
|
||||
#include "StreamReader.h"
|
||||
|
@ -423,4 +423,4 @@ void UnrealImporter::InternReadFile( const std::string& pFile,
|
|||
flipper.Execute(pScene);
|
||||
}
|
||||
|
||||
#endif // !! AI_BUILD_NO_3D_IMPORTER
|
||||
#endif // !! ASSIMP_BUILD_NO_3D_IMPORTER
|
||||
|
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderScene.cpp
|
||||
* @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py
|
||||
*/
|
||||
#include "AssimpPCH.h"
|
||||
#ifndef AI_BUILD_NO_BLEND_IMPORTER
|
||||
|
||||
#include "BlenderDNA.h"
|
||||
#include "BlenderScene.h"
|
||||
#include "BlenderSceneGen.h"
|
||||
|
||||
using namespace Assimp;
|
||||
using namespace Assimp::Blender;
|
||||
|
||||
<HERE>
|
||||
|
||||
#endif
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
Open Asset Import Library (ASSIMP)
|
||||
----------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use of this software in source and binary forms,
|
||||
with or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the
|
||||
following disclaimer in the documentation and/or other
|
||||
materials provided with the distribution.
|
||||
|
||||
* Neither the name of the ASSIMP team, nor the names of its
|
||||
contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior
|
||||
written permission of the ASSIMP Development Team.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
----------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
/** @file BlenderSceneGen.h
|
||||
* @brief MACHINE GENERATED BY ./scripts/BlenderImporter/genblenddna.py
|
||||
*/
|
||||
#ifndef INCLUDED_AI_BLEND_SCENEGEN_H
|
||||
#define INCLUDED_AI_BLEND_SCENEGEN_H
|
||||
|
||||
namespace Assimp {
|
||||
namespace Blender {
|
||||
|
||||
<HERE>
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,233 @@
|
|||
#!/usr/bin/env python3
|
||||
# -*- Coding: UTF-8 -*-
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Open Asset Import Library (ASSIMP)
|
||||
# ---------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006-2010, ASSIMP Development Team
|
||||
#
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use of this software in source and binary forms,
|
||||
# with or without modification, are permitted provided that the following
|
||||
# conditions are met:
|
||||
#
|
||||
# * Redistributions of source code must retain the above
|
||||
# copyright notice, this list of conditions and the
|
||||
# following disclaimer.
|
||||
#
|
||||
# * Redistributions in binary form must reproduce the above
|
||||
# copyright notice, this list of conditions and the
|
||||
# following disclaimer in the documentation and/or other
|
||||
# materials provided with the distribution.
|
||||
#
|
||||
# * Neither the name of the ASSIMP team, nor the names of its
|
||||
# contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior
|
||||
# written permission of the ASSIMP Development Team.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
"""Generate BlenderSceneGen.h and BlenderScene.cpp from the
|
||||
data structures in BlenderScene.h to map from *any* DNA to
|
||||
*our* DNA"""
|
||||
|
||||
import sys
|
||||
import os
|
||||
import re
|
||||
|
||||
inputfile = os.path.join("..","..","code","BlenderScene.h")
|
||||
outputfile_gen = os.path.join("..","..","code","BlenderSceneGen.h")
|
||||
outputfile_src = os.path.join("..","..","code","BlenderScene.cpp")
|
||||
|
||||
template_gen = "BlenderSceneGen.h.template"
|
||||
template_src = "BlenderScene.cpp.template"
|
||||
|
||||
|
||||
Structure_Convert_decl = """
|
||||
template <> void Structure :: Convert<{a}> (
|
||||
{a}& dest,
|
||||
const FileDatabase& db
|
||||
) const
|
||||
"""
|
||||
|
||||
|
||||
Structure_Convert_ptrdecl = """
|
||||
ReadFieldPtr<{policy}>({destcast}dest.{name_canonical},"{name_dna}",db);"""
|
||||
|
||||
Structure_Convert_arraydecl = """
|
||||
ReadFieldArray<{policy}>({destcast}dest.{name_canonical},"{name_dna}",db);"""
|
||||
|
||||
Structure_Convert_arraydecl2d = """
|
||||
ReadFieldArray2<{policy}>({destcast}dest.{name_canonical},"{name_dna}",db);"""
|
||||
|
||||
Structure_Convert_normal = """
|
||||
ReadField<{policy}>({destcast}dest.{name_canonical},"{name_dna}",db);"""
|
||||
|
||||
|
||||
DNA_RegisterConverters_decl = """
|
||||
void DNA::RegisterConverters() """
|
||||
|
||||
DNA_RegisterConverters_add = """
|
||||
converters["{a}"] = &Structure::Convert<{a}>;"""
|
||||
|
||||
|
||||
map_policy = {
|
||||
"" : "ErrorPolicy_Igno"
|
||||
,"IGNO" : "ErrorPolicy_Igno"
|
||||
,"WARN" : "ErrorPolicy_Warn"
|
||||
,"FAIL" : "ErrorPolicy_Fail"
|
||||
}
|
||||
|
||||
#
|
||||
def main():
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Parse structure definitions from BlenderScene.h
|
||||
input = open(inputfile,"rt").read()
|
||||
|
||||
flags = re.ASCII|re.DOTALL|re.MULTILINE
|
||||
#stripcoms = re.compile(r"/\*(.*?)*\/",flags)
|
||||
getstruct = re.compile(r"struct\s+(\w+?)\s*(:\s*ElemBase)?\s*\{(.*?)^\}\s*;",flags)
|
||||
getsmartp = re.compile(r"(boost\s*::\s*)?shared_(ptr)\s*<\s*(\w+)\s*>\s*",flags)
|
||||
getsmarta = re.compile(r"(boost\s*::\s*)?shared_(array)\s*<\s*(\w+)\s*>\s*",flags)
|
||||
getpolicy = re.compile(r"\s*(WARN|FAIL|IGNO|)",flags)
|
||||
stripenum = re.compile(r"enum\s+(\w+)\s*{.*?\}\s*;",flags)
|
||||
|
||||
enums = set()
|
||||
#re.sub(stripcoms," ",input)
|
||||
#print(input)
|
||||
|
||||
hits = {}
|
||||
while 1:
|
||||
match = re.search(getstruct,input)
|
||||
if match is None:
|
||||
break
|
||||
|
||||
tmp = match.groups()[2]
|
||||
while 1:
|
||||
match2 = re.search(stripenum,tmp)
|
||||
if match2 is None:
|
||||
break
|
||||
tmp = tmp[match2.end():]
|
||||
enums.add(match2.groups()[0])
|
||||
|
||||
hits[match.groups()[0]] = list(
|
||||
filter(lambda x:x[:2] != "//" and len(x),
|
||||
map(str.strip,
|
||||
re.sub(stripenum," ",match.groups()[2]).split(";")
|
||||
)))
|
||||
|
||||
input = input[match.end():]
|
||||
|
||||
[print ("Enum: "+e) for e in enums]
|
||||
for k,v in hits.items():
|
||||
out = []
|
||||
for line in v:
|
||||
tok = line.split(None,1)
|
||||
if len(tok) <= 1:
|
||||
continue
|
||||
|
||||
#print(tok)
|
||||
|
||||
ty = re.match(getsmartp,tok[0]) or re.match(getsmarta,tok[0]) or tok[0]
|
||||
if not isinstance(ty,str):
|
||||
if ty.groups()[1] == "ptr":
|
||||
ty = ty.groups()[2] + "*"
|
||||
elif ty.groups()[1] == "array":
|
||||
ty = ty.groups()[2] + "*"
|
||||
|
||||
policy = "IGNO"
|
||||
py = re.search(getpolicy,tok[1]) or tok[1]
|
||||
if not isinstance(py,str):
|
||||
policy = py.groups()[0]
|
||||
py = re.sub(getpolicy,"",tok[1])
|
||||
|
||||
#print(py)
|
||||
for m in py.split(','):
|
||||
out.append((ty,m,policy))
|
||||
|
||||
v[:] = out
|
||||
print("Structure {0}".format(k))
|
||||
[print("\t"+"\t".join(elem)) for elem in out]
|
||||
print("")
|
||||
|
||||
|
||||
output = open(outputfile_gen,"wt")
|
||||
templt = open(template_gen,"rt").read()
|
||||
s = ""
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Structure::Convert<T> declarations for all supported structures
|
||||
for k,v in hits.items():
|
||||
s += Structure_Convert_decl.format(a=k)+";\n";
|
||||
output.write(templt.replace("<HERE>",s))
|
||||
|
||||
output = open(outputfile_src,"wt")
|
||||
templt = open(template_src,"rt").read()
|
||||
s = ""
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# Structure::Convert<T> definitions for all supported structures
|
||||
for k,v in hits.items():
|
||||
s += "//" + "-"*80 + Structure_Convert_decl.format(a=k)+ "{ \n";
|
||||
|
||||
for type, name, policy in v:
|
||||
splits = name.split("[",1)
|
||||
name_canonical = splits[0]
|
||||
#array_part = "" if len(splits)==1 else "["+splits[1]
|
||||
ptr_decl = "*"*type.count("*")
|
||||
name_dna = ptr_decl+name_canonical #+array_part
|
||||
|
||||
#required = "false"
|
||||
policy = map_policy[policy]
|
||||
destcast = "(int&)" if type in enums else ""
|
||||
|
||||
# POINTER
|
||||
if ptr_decl:
|
||||
s += Structure_Convert_ptrdecl.format(**locals())
|
||||
# ARRAY MEMBER
|
||||
elif name.count('[')==1:
|
||||
s += Structure_Convert_arraydecl.format(**locals())
|
||||
elif name.count('[')==2:
|
||||
s += Structure_Convert_arraydecl2d.format(**locals())
|
||||
# NORMAL MEMBER
|
||||
else:
|
||||
s += Structure_Convert_normal.format(**locals())
|
||||
|
||||
s += "\n\n\tdb.reader->IncPtr(size);\n}\n\n"
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------
|
||||
# DNA::RegisterConverters - collect all available converter functions
|
||||
# in a std::map<name,converter_proc>
|
||||
#s += "#if 0\n"
|
||||
s += "//" + "-"*80 + DNA_RegisterConverters_decl + "{\n"
|
||||
for k,v in hits.items():
|
||||
s += DNA_RegisterConverters_add.format(a=k)
|
||||
|
||||
s += "\n}\n"
|
||||
#s += "#endif\n"
|
||||
|
||||
output.write(templt.replace("<HERE>",s))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -1884,6 +1884,42 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="blender"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderDNA.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderDNA.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderDNA.inl"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderScene.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderScene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderSceneGen.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="process"
|
||||
|
@ -2229,46 +2265,6 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="util"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\ByteSwap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\fast_atof.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\GenericProperty.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Hash.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\ParsingUtils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\ProcessHelper.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\qnan.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\StringComparison.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Vertex.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="extern"
|
||||
>
|
||||
|
@ -3440,6 +3436,22 @@
|
|||
RelativePath="..\..\code\BaseProcess.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\ByteSwap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\fast_atof.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\GenericProperty.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Hash.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Importer.cpp"
|
||||
>
|
||||
|
@ -3568,6 +3580,18 @@
|
|||
RelativePath="..\..\code\MaterialSystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\ParsingUtils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\ProcessHelper.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\qnan.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\RemoveComments.cpp"
|
||||
>
|
||||
|
@ -3632,6 +3656,10 @@
|
|||
RelativePath="..\..\code\StandardShapes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\StringComparison.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Subdivision.cpp"
|
||||
>
|
||||
|
@ -3652,6 +3680,10 @@
|
|||
RelativePath="..\..\code\TinyFormatter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Vertex.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\VertexTriangleAdjacency.cpp"
|
||||
>
|
||||
|
|
|
@ -1120,50 +1120,6 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="BoostWorkaround"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\foreach.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\format.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\scoped_array.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\scoped_ptr.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\shared_ptr.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\static_assert.hpp"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="tuple"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\tuple\tuple.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="math"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\math\common_factor_rt.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Cpp"
|
||||
>
|
||||
|
@ -1891,6 +1847,42 @@
|
|||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="blend"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderDNA.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderDNA.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderDNA.inl"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderLoader.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderLoader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderScene.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderScene.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\BlenderSceneGen.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="process"
|
||||
|
@ -2227,10 +2219,6 @@
|
|||
RelativePath="..\..\code\FileSystemFilter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\StreamReader.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="core"
|
||||
|
@ -2259,10 +2247,30 @@
|
|||
RelativePath="..\..\code\BaseProcess.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\ByteSwap.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Exceptional.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\fast_atof.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\GenericProperty.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Hash.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\IFF.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Importer.cpp"
|
||||
>
|
||||
|
@ -2375,6 +2383,14 @@
|
|||
RelativePath="..\..\code\MaterialSystem.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\ParsingUtils.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\qnan.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\RemoveComments.cpp"
|
||||
>
|
||||
|
@ -2439,6 +2455,14 @@
|
|||
RelativePath="..\..\code\StandardShapes.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\StreamReader.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\StringComparison.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Subdivision.cpp"
|
||||
>
|
||||
|
@ -2459,6 +2483,10 @@
|
|||
RelativePath="..\..\code\TinyFormatter.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Vertex.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\VertexTriangleAdjacency.cpp"
|
||||
>
|
||||
|
@ -3549,45 +3577,57 @@
|
|||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="util"
|
||||
Name="noboost"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\ByteSwap.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\foreach.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\fast_atof.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\format.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\GenericProperty.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\pointer_cast.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\Hash.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\scoped_array.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\IFF.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\scoped_ptr.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\ParsingUtils.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\shared_array.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\qnan.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\shared_ptr.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\code\StringComparison.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\static_assert.hpp"
|
||||
>
|
||||
</File>
|
||||
<Filter
|
||||
Name="tuple"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\Vertex.h"
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\tuple\tuple.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="math"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\code\BoostWorkaround\boost\math\common_factor_rt.hpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
</Filter>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="doc"
|
||||
|
|
Loading…
Reference in New Issue