pull/21/merge
Kim 2013-03-28 18:56:19 +01:00
commit 3ad7aea123
26 changed files with 1043 additions and 773 deletions

View File

@ -16,7 +16,7 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules")
set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
set(LIBASSIMP-DEV_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}-dev) set(LIBASSIMP-DEV_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}-dev)
set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev) set(CPACK_COMPONENTS_ALL assimp-bin ${LIBASSIMP_COMPONENT} ${LIBASSIMP-DEV_COMPONENT} assimp-dev)
set(ASSIMP_LIBRARY_SUFFIX "${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}" CACHE STRING "Suffix to append to library names") set(ASSIMP_LIBRARY_SUFFIX "" CACHE STRING "Suffix to append to library names")
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it.... add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it....

View File

@ -19,7 +19,7 @@ Open Asset Import Library (assimp)
Open Asset Import Library is a Open Source library designed to load various 3d file formats and convert them into a shared, in-memory format. It supports more than 30 file formats. It also supports exporting files to a few selected file formats. Open Asset Import Library is a Open Source library designed to load various 3d file formats and convert them into a shared, in-memory format. It supports more than 30 file formats. It also supports exporting files to a few selected file formats.
Its short name is _assimp_, which is an unintended joke (the abbreviation is derived from _Asset Importer_). Its abbreviated name is _assimp_.
__Note__: this `README` refers to the file structure used by release packages, which differs in some points from the development trunk. __Note__: this `README` refers to the file structure used by release packages, which differs in some points from the development trunk.
@ -129,5 +129,3 @@ The license of the Asset Import Library is based on the modified, __3-clause BSD
Note that, unlike LGPLed code, you may link statically to Assimp. Note that, unlike LGPLed code, you may link statically to Assimp.
For the formal details, see the `LICENSE` file. For the formal details, see the `LICENSE` file.
------------------------------

View File

@ -707,7 +707,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut)
if (0 == mRootNode->mChildren.size()) if (0 == mRootNode->mChildren.size())
{ {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// It seems the file is so fucked up that it has not even a hierarchy. // It seems the file is so messed up that it has not even a hierarchy.
// generate a flat hiearachy which looks like this: // generate a flat hiearachy which looks like this:
// //
// ROOT_NODE // ROOT_NODE

View File

@ -1,3 +1,4 @@
/* /*
Open Asset Import Library (assimp) Open Asset Import Library (assimp)
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -624,7 +625,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
) )
{ {
typedef std::pair<const int,size_t> MyPair; typedef std::pair<const int,size_t> MyPair;
if (!mesh->totface || !mesh->totvert) { if ((!mesh->totface && !mesh->totloop) || !mesh->totvert) {
return; return;
} }
@ -637,6 +638,10 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
ThrowException("Number of vertices is larger than the corresponding array"); ThrowException("Number of vertices is larger than the corresponding array");
} }
if (static_cast<size_t> ( mesh->totloop ) > mesh->mloop.size()) {
ThrowException("Number of vertices is larger than the corresponding array");
}
// collect per-submesh numbers // collect per-submesh numbers
std::map<int,size_t> per_mat; std::map<int,size_t> per_mat;
for (int i = 0; i < mesh->totface; ++i) { for (int i = 0; i < mesh->totface; ++i) {
@ -644,6 +649,10 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
const MFace& mf = mesh->mface[i]; const MFace& mf = mesh->mface[i];
per_mat[ mf.mat_nr ]++; per_mat[ mf.mat_nr ]++;
} }
for (int i = 0; i < mesh->totpoly; ++i) {
const MPoly& mp = mesh->mpoly[i];
per_mat[ mp.mat_nr ]++;
}
// ... and allocate the corresponding meshes // ... and allocate the corresponding meshes
const size_t old = temp->size(); const size_t old = temp->size();
@ -780,8 +789,56 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
// } // }
} }
for (int i = 0; i < mesh->totpoly; ++i) {
const MPoly& mf = mesh->mpoly[i];
aiMesh* const out = temp[ mat_num_to_mesh_idx[ mf.mat_nr ] ];
aiFace& f = out->mFaces[out->mNumFaces++];
f.mIndices = new unsigned int[ f.mNumIndices = mf.totloop ];
aiVector3D* vo = out->mVertices + out->mNumVertices;
aiVector3D* vn = out->mNormals + out->mNumVertices;
// XXX we can't fold this easily, because we are restricted
// to the member names from the BLEND file (v1,v2,v3,v4)
// which are assigned by the genblenddna.py script and
// cannot be changed without breaking the entire
// import process.
for (int j = 0;j < mf.totloop; ++j)
{
const MLoop& loop = mesh->mloop[mf.loopstart + j];
if (loop.v >= mesh->totvert) {
ThrowException("Vertex index out of range");
}
const MVert& v = mesh->mvert[loop.v];
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[j] = out->mNumVertices++;
++vo;
++vn;
}
if (mf.totloop == 3)
{
out->mPrimitiveTypes |= aiPrimitiveType_TRIANGLE;
}
else
{
out->mPrimitiveTypes |= aiPrimitiveType_POLYGON;
}
}
// collect texture coordinates, they're stored in a separate per-face buffer // collect texture coordinates, they're stored in a separate per-face buffer
if (mesh->mtface) { if (mesh->mtface || mesh->mloopuv) {
if (mesh->totface > static_cast<int> ( mesh->mtface.size())) { if (mesh->totface > static_cast<int> ( mesh->mtface.size())) {
ThrowException("Number of UV faces is larger than the corresponding UV face array (#1)"); ThrowException("Number of UV faces is larger than the corresponding UV face array (#1)");
} }
@ -804,6 +861,20 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
vo->y = v->uv[i][1]; vo->y = v->uv[i][1];
} }
} }
for (int i = 0; i < mesh->totpoly; ++i) {
const MPoly& v = mesh->mpoly[i];
aiMesh* const out = temp[ mat_num_to_mesh_idx[ v.mat_nr ] ];
const aiFace& f = out->mFaces[out->mNumFaces++];
aiVector3D* vo = &out->mTextureCoords[0][out->mNumVertices];
for (unsigned int j = 0; j < f.mNumIndices; ++j,++vo,++out->mNumVertices) {
const MLoopUV& uv = mesh->mloopuv[v.loopstart + j];
vo->x = uv.uv[0];
vo->y = uv.uv[1];
}
}
} }
// collect texture coordinates, old-style (marked as deprecated in current blender sources) // collect texture coordinates, old-style (marked as deprecated in current blender sources)
@ -833,7 +904,7 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
} }
// collect vertex colors, stored separately as well // collect vertex colors, stored separately as well
if (mesh->mcol) { if (mesh->mcol || mesh->mloopcol) {
if (mesh->totface > static_cast<int> ( (mesh->mcol.size()/4)) ) { if (mesh->totface > static_cast<int> ( (mesh->mcol.size()/4)) ) {
ThrowException("Number of faces is larger than the corresponding color face array"); ThrowException("Number of faces is larger than the corresponding color face array");
} }
@ -860,6 +931,23 @@ void BlenderImporter::ConvertMesh(const Scene& /*in*/, const Object* /*obj*/, co
} }
for (unsigned int n = f.mNumIndices; n < 4; ++n); for (unsigned int n = f.mNumIndices; n < 4; ++n);
} }
for (int i = 0; i < mesh->totpoly; ++i) {
const MPoly& v = mesh->mpoly[i];
aiMesh* const out = temp[ mat_num_to_mesh_idx[ v.mat_nr ] ];
const aiFace& f = out->mFaces[out->mNumFaces++];
aiColor4D* vo = &out->mColors[0][out->mNumVertices];
for (unsigned int j = 0; j < f.mNumIndices; ++j,++vo,++out->mNumVertices) {
const MLoopCol& col = mesh->mloopcol[v.loopstart + j];
vo->r = col.r;
vo->g = col.g;
vo->b = col.b;
vo->a = col.a;
}
}
} }
return; return;

View File

@ -305,6 +305,27 @@ template <> void Structure :: Convert<Material> (
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
//--------------------------------------------------------------------------------
template <> void Structure :: Convert<MTexPoly> (
MTexPoly& dest,
const FileDatabase& db
) const
{
{
boost::shared_ptr<Image> tpage;
ReadFieldPtr<ErrorPolicy_Igno>(tpage,"*tpage",db);
dest.tpage = tpage.get();
}
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
ReadField<ErrorPolicy_Igno>(dest.transp,"transp",db);
ReadField<ErrorPolicy_Igno>(dest.mode,"mode",db);
ReadField<ErrorPolicy_Igno>(dest.tile,"tile",db);
ReadField<ErrorPolicy_Igno>(dest.pad,"pad",db);
db.reader->IncPtr(size);
}
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
template <> void Structure :: Convert<Mesh> ( template <> void Structure :: Convert<Mesh> (
Mesh& dest, Mesh& dest,
@ -316,6 +337,8 @@ template <> void Structure :: Convert<Mesh> (
ReadField<ErrorPolicy_Fail>(dest.totface,"totface",db); ReadField<ErrorPolicy_Fail>(dest.totface,"totface",db);
ReadField<ErrorPolicy_Fail>(dest.totedge,"totedge",db); ReadField<ErrorPolicy_Fail>(dest.totedge,"totedge",db);
ReadField<ErrorPolicy_Fail>(dest.totvert,"totvert",db); ReadField<ErrorPolicy_Fail>(dest.totvert,"totvert",db);
ReadField<ErrorPolicy_Igno>(dest.totloop,"totloop",db);
ReadField<ErrorPolicy_Igno>(dest.totpoly,"totpoly",db);
ReadField<ErrorPolicy_Igno>(dest.subdiv,"subdiv",db); ReadField<ErrorPolicy_Igno>(dest.subdiv,"subdiv",db);
ReadField<ErrorPolicy_Igno>(dest.subdivr,"subdivr",db); ReadField<ErrorPolicy_Igno>(dest.subdivr,"subdivr",db);
ReadField<ErrorPolicy_Igno>(dest.subsurftype,"subsurftype",db); ReadField<ErrorPolicy_Igno>(dest.subsurftype,"subsurftype",db);
@ -325,6 +348,11 @@ template <> void Structure :: Convert<Mesh> (
ReadFieldPtr<ErrorPolicy_Igno>(dest.tface,"*tface",db); ReadFieldPtr<ErrorPolicy_Igno>(dest.tface,"*tface",db);
ReadFieldPtr<ErrorPolicy_Fail>(dest.mvert,"*mvert",db); ReadFieldPtr<ErrorPolicy_Fail>(dest.mvert,"*mvert",db);
ReadFieldPtr<ErrorPolicy_Warn>(dest.medge,"*medge",db); ReadFieldPtr<ErrorPolicy_Warn>(dest.medge,"*medge",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mloop,"*mloop",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mloopuv,"*mloopuv",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mloopcol,"*mloopcol",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mpoly,"*mpoly",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mtpoly,"*mtpoly",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.dvert,"*dvert",db); ReadFieldPtr<ErrorPolicy_Igno>(dest.dvert,"*dvert",db);
ReadFieldPtr<ErrorPolicy_Igno>(dest.mcol,"*mcol",db); ReadFieldPtr<ErrorPolicy_Igno>(dest.mcol,"*mcol",db);
ReadFieldPtr<ErrorPolicy_Fail>(dest.mat,"**mat",db); ReadFieldPtr<ErrorPolicy_Fail>(dest.mat,"**mat",db);
@ -357,6 +385,21 @@ template <> void Structure :: Convert<World> (
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
//--------------------------------------------------------------------------------
template <> void Structure :: Convert<MLoopCol> (
MLoopCol& 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<MVert> ( template <> void Structure :: Convert<MVert> (
MVert& dest, MVert& dest,
@ -389,6 +432,19 @@ template <> void Structure :: Convert<MEdge> (
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
//--------------------------------------------------------------------------------
template <> void Structure :: Convert<MLoopUV> (
MLoopUV& dest,
const FileDatabase& db
) const
{
ReadFieldArray<ErrorPolicy_Igno>(dest.uv,"uv",db);
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",db);
db.reader->IncPtr(size);
}
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
template <> void Structure :: Convert<GroupObject> ( template <> void Structure :: Convert<GroupObject> (
GroupObject& dest, GroupObject& dest,
@ -416,6 +472,19 @@ template <> void Structure :: Convert<ListBase> (
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
//--------------------------------------------------------------------------------
template <> void Structure :: Convert<MLoop> (
MLoop& dest,
const FileDatabase& db
) const
{
ReadField<ErrorPolicy_Igno>(dest.v,"v",db);
ReadField<ErrorPolicy_Igno>(dest.e,"e",db);
db.reader->IncPtr(size);
}
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
template <> void Structure :: Convert<ModifierData> ( template <> void Structure :: Convert<ModifierData> (
ModifierData& dest, ModifierData& dest,
@ -461,34 +530,16 @@ template <> void Structure :: Convert<MCol> (
} }
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
template <> void Structure :: Convert<Image> ( template <> void Structure :: Convert<MPoly> (
Image& dest, MPoly& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
{ {
ReadField<ErrorPolicy_Fail>(dest.id,"id",db); ReadField<ErrorPolicy_Igno>(dest.loopstart,"loopstart",db);
ReadFieldArray<ErrorPolicy_Warn>(dest.name,"name",db); ReadField<ErrorPolicy_Igno>(dest.totloop,"totloop",db);
ReadField<ErrorPolicy_Igno>(dest.ok,"ok",db); ReadField<ErrorPolicy_Igno>(dest.mat_nr,"mat_nr",db);
ReadField<ErrorPolicy_Igno>(dest.flag,"flag",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); db.reader->IncPtr(size);
} }
@ -568,6 +619,39 @@ template <> void Structure :: Convert<MirrorModifierData> (
db.reader->IncPtr(size); db.reader->IncPtr(size);
} }
//--------------------------------------------------------------------------------
template <> void Structure :: Convert<Image> (
Image& dest,
const FileDatabase& db
) const
{
ReadField<ErrorPolicy_Fail>(dest.id,"id",db);
ReadFieldArray<ErrorPolicy_Warn>(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);
}
//-------------------------------------------------------------------------------- //--------------------------------------------------------------------------------
void DNA::RegisterConverters() { void DNA::RegisterConverters() {
@ -583,22 +667,27 @@ void DNA::RegisterConverters() {
converters["Base"] = DNA::FactoryPair( &Structure::Allocate<Base>, &Structure::Convert<Base> ); converters["Base"] = DNA::FactoryPair( &Structure::Allocate<Base>, &Structure::Convert<Base> );
converters["MTFace"] = DNA::FactoryPair( &Structure::Allocate<MTFace>, &Structure::Convert<MTFace> ); converters["MTFace"] = DNA::FactoryPair( &Structure::Allocate<MTFace>, &Structure::Convert<MTFace> );
converters["Material"] = DNA::FactoryPair( &Structure::Allocate<Material>, &Structure::Convert<Material> ); converters["Material"] = DNA::FactoryPair( &Structure::Allocate<Material>, &Structure::Convert<Material> );
converters["MTexPoly"] = DNA::FactoryPair( &Structure::Allocate<MTexPoly>, &Structure::Convert<MTexPoly> );
converters["Mesh"] = DNA::FactoryPair( &Structure::Allocate<Mesh>, &Structure::Convert<Mesh> ); converters["Mesh"] = DNA::FactoryPair( &Structure::Allocate<Mesh>, &Structure::Convert<Mesh> );
converters["MDeformVert"] = DNA::FactoryPair( &Structure::Allocate<MDeformVert>, &Structure::Convert<MDeformVert> ); converters["MDeformVert"] = DNA::FactoryPair( &Structure::Allocate<MDeformVert>, &Structure::Convert<MDeformVert> );
converters["World"] = DNA::FactoryPair( &Structure::Allocate<World>, &Structure::Convert<World> ); converters["World"] = DNA::FactoryPair( &Structure::Allocate<World>, &Structure::Convert<World> );
converters["MLoopCol"] = DNA::FactoryPair( &Structure::Allocate<MLoopCol>, &Structure::Convert<MLoopCol> );
converters["MVert"] = DNA::FactoryPair( &Structure::Allocate<MVert>, &Structure::Convert<MVert> ); converters["MVert"] = DNA::FactoryPair( &Structure::Allocate<MVert>, &Structure::Convert<MVert> );
converters["MEdge"] = DNA::FactoryPair( &Structure::Allocate<MEdge>, &Structure::Convert<MEdge> ); converters["MEdge"] = DNA::FactoryPair( &Structure::Allocate<MEdge>, &Structure::Convert<MEdge> );
converters["MLoopUV"] = DNA::FactoryPair( &Structure::Allocate<MLoopUV>, &Structure::Convert<MLoopUV> );
converters["GroupObject"] = DNA::FactoryPair( &Structure::Allocate<GroupObject>, &Structure::Convert<GroupObject> ); converters["GroupObject"] = DNA::FactoryPair( &Structure::Allocate<GroupObject>, &Structure::Convert<GroupObject> );
converters["ListBase"] = DNA::FactoryPair( &Structure::Allocate<ListBase>, &Structure::Convert<ListBase> ); converters["ListBase"] = DNA::FactoryPair( &Structure::Allocate<ListBase>, &Structure::Convert<ListBase> );
converters["MLoop"] = DNA::FactoryPair( &Structure::Allocate<MLoop>, &Structure::Convert<MLoop> );
converters["ModifierData"] = DNA::FactoryPair( &Structure::Allocate<ModifierData>, &Structure::Convert<ModifierData> ); converters["ModifierData"] = DNA::FactoryPair( &Structure::Allocate<ModifierData>, &Structure::Convert<ModifierData> );
converters["ID"] = DNA::FactoryPair( &Structure::Allocate<ID>, &Structure::Convert<ID> ); converters["ID"] = DNA::FactoryPair( &Structure::Allocate<ID>, &Structure::Convert<ID> );
converters["MCol"] = DNA::FactoryPair( &Structure::Allocate<MCol>, &Structure::Convert<MCol> ); converters["MCol"] = DNA::FactoryPair( &Structure::Allocate<MCol>, &Structure::Convert<MCol> );
converters["Image"] = DNA::FactoryPair( &Structure::Allocate<Image>, &Structure::Convert<Image> ); converters["MPoly"] = DNA::FactoryPair( &Structure::Allocate<MPoly>, &Structure::Convert<MPoly> );
converters["Scene"] = DNA::FactoryPair( &Structure::Allocate<Scene>, &Structure::Convert<Scene> ); converters["Scene"] = DNA::FactoryPair( &Structure::Allocate<Scene>, &Structure::Convert<Scene> );
converters["Library"] = DNA::FactoryPair( &Structure::Allocate<Library>, &Structure::Convert<Library> ); converters["Library"] = DNA::FactoryPair( &Structure::Allocate<Library>, &Structure::Convert<Library> );
converters["Tex"] = DNA::FactoryPair( &Structure::Allocate<Tex>, &Structure::Convert<Tex> ); converters["Tex"] = DNA::FactoryPair( &Structure::Allocate<Tex>, &Structure::Convert<Tex> );
converters["Camera"] = DNA::FactoryPair( &Structure::Allocate<Camera>, &Structure::Convert<Camera> ); converters["Camera"] = DNA::FactoryPair( &Structure::Allocate<Camera>, &Structure::Convert<Camera> );
converters["MirrorModifierData"] = DNA::FactoryPair( &Structure::Allocate<MirrorModifierData>, &Structure::Convert<MirrorModifierData> ); converters["MirrorModifierData"] = DNA::FactoryPair( &Structure::Allocate<MirrorModifierData>, &Structure::Convert<MirrorModifierData> );
converters["Image"] = DNA::FactoryPair( &Structure::Allocate<Image>, &Structure::Convert<Image> );
} }

View File

@ -94,6 +94,7 @@ namespace Assimp {
struct Object; struct Object;
struct MTex; struct MTex;
struct Image;
#define AI_BLEND_MESH_MAX_VERTS 2000000000L #define AI_BLEND_MESH_MAX_VERTS 2000000000L
@ -156,6 +157,38 @@ struct MEdge : ElemBase {
short flag; short flag;
}; };
// -------------------------------------------------------------------------------
struct MLoop : ElemBase {
int v, e;
};
// -------------------------------------------------------------------------------
struct MLoopUV : ElemBase {
float uv[2];
int flag;
};
// -------------------------------------------------------------------------------
// Note that red and blue are not swapped, as with MCol
struct MLoopCol : ElemBase {
char r, g, b, a;
};
// -------------------------------------------------------------------------------
struct MPoly : ElemBase {
int loopstart;
int totloop;
short mat_nr;
char flag;
};
// -------------------------------------------------------------------------------
struct MTexPoly : ElemBase {
Image* tpage;
char flag, transp;
short mode, tile, pad;
};
// ------------------------------------------------------------------------------- // -------------------------------------------------------------------------------
struct MCol : ElemBase { struct MCol : ElemBase {
char r,g,b,a FAIL; char r,g,b,a FAIL;
@ -235,6 +268,8 @@ struct Mesh : ElemBase {
int totface FAIL; int totface FAIL;
int totedge FAIL; int totedge FAIL;
int totvert FAIL; int totvert FAIL;
int totloop;
int totpoly;
short subdiv; short subdiv;
short subdivr; short subdivr;
@ -246,6 +281,11 @@ struct Mesh : ElemBase {
vector<TFace> tface; vector<TFace> tface;
vector<MVert> mvert FAIL; vector<MVert> mvert FAIL;
vector<MEdge> medge WARN; vector<MEdge> medge WARN;
vector<MLoop> mloop;
vector<MLoopUV> mloopuv;
vector<MLoopCol> mloopcol;
vector<MPoly> mpoly;
vector<MTexPoly> mtpoly;
vector<MDeformVert> dvert; vector<MDeformVert> dvert;
vector<MCol> mcol; vector<MCol> mcol;

View File

@ -120,6 +120,12 @@ template <> void Structure :: Convert<Material> (
) const ) const
; ;
template <> void Structure :: Convert<MTexPoly> (
MTexPoly& dest,
const FileDatabase& db
) const
;
template <> void Structure :: Convert<Mesh> ( template <> void Structure :: Convert<Mesh> (
Mesh& dest, Mesh& dest,
const FileDatabase& db const FileDatabase& db
@ -138,6 +144,12 @@ template <> void Structure :: Convert<World> (
) const ) const
; ;
template <> void Structure :: Convert<MLoopCol> (
MLoopCol& dest,
const FileDatabase& db
) const
;
template <> void Structure :: Convert<MVert> ( template <> void Structure :: Convert<MVert> (
MVert& dest, MVert& dest,
const FileDatabase& db const FileDatabase& db
@ -150,6 +162,12 @@ template <> void Structure :: Convert<MEdge> (
) const ) const
; ;
template <> void Structure :: Convert<MLoopUV> (
MLoopUV& dest,
const FileDatabase& db
) const
;
template <> void Structure :: Convert<GroupObject> ( template <> void Structure :: Convert<GroupObject> (
GroupObject& dest, GroupObject& dest,
const FileDatabase& db const FileDatabase& db
@ -162,6 +180,12 @@ template <> void Structure :: Convert<ListBase> (
) const ) const
; ;
template <> void Structure :: Convert<MLoop> (
MLoop& dest,
const FileDatabase& db
) const
;
template <> void Structure :: Convert<ModifierData> ( template <> void Structure :: Convert<ModifierData> (
ModifierData& dest, ModifierData& dest,
const FileDatabase& db const FileDatabase& db
@ -180,8 +204,8 @@ template <> void Structure :: Convert<MCol> (
) const ) const
; ;
template <> void Structure :: Convert<Image> ( template <> void Structure :: Convert<MPoly> (
Image& dest, MPoly& dest,
const FileDatabase& db const FileDatabase& db
) const ) const
; ;
@ -216,6 +240,12 @@ template <> void Structure :: Convert<MirrorModifierData> (
) const ) const
; ;
template <> void Structure :: Convert<Image> (
Image& dest,
const FileDatabase& db
) const
;
} }
} }

View File

@ -255,7 +255,7 @@ namespace boost {
return t; return t;
} }
// Constructs a tuple with 2 elements (fucking idiot, use std::pair instead!) // Constructs a tuple with 2 elements
template <typename T0,typename T1> template <typename T0,typename T1>
inline tuple <T0,T1> make_tuple (const T0& t0, inline tuple <T0,T1> make_tuple (const T0& t0,
const T1& t1) { const T1& t1) {
@ -265,7 +265,7 @@ namespace boost {
return t; return t;
} }
// Constructs a tuple with 1 elements (no comment ...) // Constructs a tuple with 1 elements (well ...)
template <typename T0> template <typename T0>
inline tuple <T0> make_tuple (const T0& t0) { inline tuple <T0> make_tuple (const T0& t0) {
tuple <T0> t; tuple <T0> t;
@ -273,7 +273,7 @@ namespace boost {
return t; return t;
} }
// Constructs a tuple with 0 elements (ehm? Try http://www.promillerechner.net) // Constructs a tuple with 0 elements (well ...)
inline tuple <> make_tuple () { inline tuple <> make_tuple () {
tuple <> t; tuple <> t;
return t; return t;

View File

@ -1045,9 +1045,9 @@ void COBImporter::ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const
v.y = reader.GetF4(); v.y = reader.GetF4();
} }
const size_t numfuck = reader.GetI4(); const size_t numf = reader.GetI4();
msh.faces.reserve(numfuck); msh.faces.reserve(numf);
for(size_t i = 0; i < numfuck; ++i) { for(size_t i = 0; i < numf; ++i) {
// XXX backface culling flag is 0x10 in flags // XXX backface culling flag is 0x10 in flags
// hole? // hole?

View File

@ -99,7 +99,7 @@ void ColladaExporter::WriteFile()
WriteSceneLibrary(); WriteSceneLibrary();
// useless Collada bullshit at the end, just in case we haven't had enough indirections, yet. // useless Collada fu at the end, just in case we haven't had enough indirections, yet.
mOutput << startstr << "<scene>" << endstr; mOutput << startstr << "<scene>" << endstr;
PushTag(); PushTag();
mOutput << startstr << "<instance_visual_scene url=\"#myScene\" />" << endstr; mOutput << startstr << "<instance_visual_scene url=\"#myScene\" />" << endstr;
@ -495,7 +495,7 @@ void ColladaExporter::WriteFloatArray( const std::string& pIdString, FloatDataTy
mOutput << "</float_array>" << endstr; mOutput << "</float_array>" << endstr;
PopTag(); PopTag();
// the usual Collada bullshit. Let's bloat it even more! // the usual Collada fun. Let's bloat it even more!
mOutput << startstr << "<technique_common>" << endstr; mOutput << startstr << "<technique_common>" << endstr;
PushTag(); PushTag();
mOutput << startstr << "<accessor count=\"" << pElementCount << "\" offset=\"0\" source=\"#" << arrayId << "\" stride=\"" << floatsPerElement << "\">" << endstr; mOutput << startstr << "<accessor count=\"" << pElementCount << "\" offset=\"0\" source=\"#" << arrayId << "\" stride=\"" << floatsPerElement << "\">" << endstr;

View File

@ -119,6 +119,7 @@ struct Camera
}; };
#define aiLightSource_AMBIENT 0xdeaddead #define aiLightSource_AMBIENT 0xdeaddead
#define ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET 1e9f
/** A collada light source. */ /** A collada light source. */
struct Light struct Light
@ -129,8 +130,8 @@ struct Light
, mAttQuadratic (0.f) , mAttQuadratic (0.f)
, mFalloffAngle (180.f) , mFalloffAngle (180.f)
, mFalloffExponent (0.f) , mFalloffExponent (0.f)
, mPenumbraAngle (10e10f) , mPenumbraAngle (ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET)
, mOuterAngle (10e10f) , mOuterAngle (ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET)
, mIntensity (1.f) , mIntensity (1.f)
{} {}

View File

@ -325,11 +325,11 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll
out->mAngleInnerCone = AI_DEG_TO_RAD( srcLight->mFalloffAngle ); out->mAngleInnerCone = AI_DEG_TO_RAD( srcLight->mFalloffAngle );
// ... some extension magic. FUCKING COLLADA. // ... some extension magic.
if (srcLight->mOuterAngle == 10e10f) if (srcLight->mOuterAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f))
{ {
// ... some deprecation magic. FUCKING FCOLLADA. // ... some deprecation magic.
if (srcLight->mPenumbraAngle == 10e10f) if (srcLight->mPenumbraAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f))
{ {
// Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess .... // Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess ....
// epsilon chosen to be 0.1 // epsilon chosen to be 0.1
@ -382,7 +382,7 @@ void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Col
out->mClipPlaneNear = srcCamera->mZNear; out->mClipPlaneNear = srcCamera->mZNear;
// ... but for the rest some values are optional // ... but for the rest some values are optional
// and we need to compute the others in any combination. FUCKING COLLADA. // and we need to compute the others in any combination.
if (srcCamera->mAspect != 10e10f) if (srcCamera->mAspect != 10e10f)
out->mAspect = srcCamera->mAspect; out->mAspect = srcCamera->mAspect;
@ -545,7 +545,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
std::copy( pSrcMesh->mPositions.begin() + pStartVertex, pSrcMesh->mPositions.begin() + std::copy( pSrcMesh->mPositions.begin() + pStartVertex, pSrcMesh->mPositions.begin() +
pStartVertex + numVertices, dstMesh->mVertices); pStartVertex + numVertices, dstMesh->mVertices);
// normals, if given. HACK: (thom) Due to the fucking Collada spec we never // normals, if given. HACK: (thom) Due to the glorious Collada spec we never
// know if we have the same number of normals as there are positions. So we // know if we have the same number of normals as there are positions. So we
// also ignore any vertex attribute if it has a different count // also ignore any vertex attribute if it has a different count
if( pSrcMesh->mNormals.size() >= pStartVertex + numVertices) if( pSrcMesh->mNormals.size() >= pStartVertex + numVertices)
@ -636,7 +636,7 @@ aiMesh* ColladaLoader::CreateMesh( const ColladaParser& pParser, const Collada::
throw DeadlyImportError( "Data type mismatch while resolving mesh joints"); throw DeadlyImportError( "Data type mismatch while resolving mesh joints");
// sanity check: we rely on the vertex weights always coming as pairs of BoneIndex-WeightIndex // sanity check: we rely on the vertex weights always coming as pairs of BoneIndex-WeightIndex
if( pSrcController->mWeightInputJoints.mOffset != 0 || pSrcController->mWeightInputWeights.mOffset != 1) if( pSrcController->mWeightInputJoints.mOffset != 0 || pSrcController->mWeightInputWeights.mOffset != 1)
throw DeadlyImportError( "Unsupported vertex_weight adresssing scheme. Fucking collada spec."); throw DeadlyImportError( "Unsupported vertex_weight adressing scheme. ");
// create containers to collect the weights for each bone // create containers to collect the weights for each bone
size_t numBones = jointNames.mStrings.size(); size_t numBones = jointNames.mStrings.size();
@ -1445,13 +1445,16 @@ void ColladaLoader::ConvertPath (aiString& ss)
ss.data[ss.length] = 0; ss.data[ss.length] = 0;
} }
// find and convert all %xyz special chars // find and convert all %xy special chars
char* out = ss.data; char* out = ss.data;
for( const char* it = ss.data; it != ss.data + ss.length; /**/ ) for( const char* it = ss.data; it != ss.data + ss.length; /**/ )
{ {
if( *it == '%' ) if( *it == '%' && (it + 3) < ss.data + ss.length )
{ {
size_t nbr = strtoul16( ++it, &it); // separate the number to avoid dragging in chars from behind into the parsing
char mychar[3] = { it[1], it[2], 0 };
size_t nbr = strtoul16( mychar);
it += 3;
*out++ = (char)(nbr & 0xFF); *out++ = (char)(nbr & 0xFF);
} else } else
{ {

View File

@ -487,7 +487,7 @@ void ColladaParser::ReadController( Collada::Controller& pController)
else if( IsElement( "skin")) else if( IsElement( "skin"))
{ {
// read the mesh it refers to. According to the spec this could also be another // read the mesh it refers to. According to the spec this could also be another
// controller, but I refuse to implement every bullshit idea they've come up with // controller, but I refuse to implement every single idea they've come up with
int sourceIndex = GetAttribute( "source"); int sourceIndex = GetAttribute( "source");
pController.mMeshId = mReader->getAttributeValue( sourceIndex) + 1; pController.mMeshId = mReader->getAttributeValue( sourceIndex) + 1;
} }
@ -1097,9 +1097,6 @@ void ColladaParser::ReadEffectLibrary()
if( IsElement( "effect")) if( IsElement( "effect"))
{ {
// read ID. Do I have to repeat my ranting about "optional" attributes? // read ID. Do I have to repeat my ranting about "optional" attributes?
// Alex: .... no, not necessary. Please shut up and leave more space for
// me to complain about the fucking Collada spec with its fucking
// 'optional' attributes ...
int attrID = GetAttribute( "id"); int attrID = GetAttribute( "id");
std::string id = mReader->getAttributeValue( attrID); std::string id = mReader->getAttributeValue( attrID);
@ -1613,7 +1610,7 @@ void ColladaParser::ReadSource()
} }
else if( IsElement( "technique_common")) else if( IsElement( "technique_common"))
{ {
// I don't fucking care for your profiles bullshit // I don't care for your profiles
} }
else if( IsElement( "accessor")) else if( IsElement( "accessor"))
{ {

View File

@ -48,7 +48,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include <iterator> #include <iterator>
#include <boost/tuple/tuple.hpp> #include <boost/tuple/tuple.hpp>
#include "../contrib/unzip/unzip.h" #ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
# include "../contrib/unzip/unzip.h"
#endif
#include "IFCLoader.h" #include "IFCLoader.h"
#include "STEPFileReader.h" #include "STEPFileReader.h"
@ -169,8 +171,10 @@ void IFCImporter::InternReadFile( const std::string& pFile,
ThrowException("Could not open file for reading"); ThrowException("Could not open file for reading");
} }
// if this is a ifczip file, decompress its contents first // if this is a ifczip file, decompress its contents first
if(GetExtension(pFile) == "ifczip") { if(GetExtension(pFile) == "ifczip") {
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
unzFile zip = unzOpen( pFile.c_str() ); unzFile zip = unzOpen( pFile.c_str() );
if(zip == NULL) { if(zip == NULL) {
ThrowException("Could not open ifczip file for reading, unzip failed"); ThrowException("Could not open ifczip file for reading, unzip failed");
@ -214,6 +218,9 @@ void IFCImporter::InternReadFile( const std::string& pFile,
} }
unzClose(zip); unzClose(zip);
#else
ThrowException("Could not open ifczip file for reading, assimp was built without ifczip support");
#endif
} }
boost::scoped_ptr<STEP::DB> db(STEP::ReadFileHeader(stream)); boost::scoped_ptr<STEP::DB> db(STEP::ReadFileHeader(stream));

View File

@ -448,8 +448,8 @@ void AnimResolver::GetKeys(std::vector<aiVectorKey>& out,
if ((*cur_x).time == (*cur_y).time && (*cur_x).time == (*cur_z).time ) { if ((*cur_x).time == (*cur_y).time && (*cur_x).time == (*cur_z).time ) {
// we have a keyframe for all of them defined .. great, // we have a keyframe for all of them defined .. this means
// we don't need to fucking interpolate here ... // we don't need to interpolate here.
fill.mTime = (*cur_x).time; fill.mTime = (*cur_x).time;
fill.mValue.x = (*cur_x).value; fill.mValue.x = (*cur_x).value;

View File

@ -89,7 +89,7 @@ public:
} }
// https://sourceforge.net/tracker/?func=detail&atid=1067632&aid=3358562&group_id=226462 // https://sourceforge.net/tracker/?func=detail&atid=1067632&aid=3358562&group_id=226462
#if !defined(__GNUC__) || !defined(__APPLE__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) #if !defined(__GNUC__) || !defined(__APPLE__) || __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
static void LogWarn (const char* message) { static void LogWarn (const char* message) {

View File

@ -787,7 +787,6 @@ void MDLImporter::SkipSkinLump_3DGS_MDL7(
} }
// ------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------
// What the fuck does this function do? Can't remember
void MDLImporter::ParseSkinLump_3DGS_MDL7( void MDLImporter::ParseSkinLump_3DGS_MDL7(
const unsigned char* szCurrent, const unsigned char* szCurrent,
const unsigned char** szCurrentOut, const unsigned char** szCurrentOut,

View File

@ -44,7 +44,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "AssimpPCH.h" #include "AssimpPCH.h"
#ifndef AI_BUILD_NO_NDO_IMPORTER #ifndef ASSIMP_BUILD_NO_NDO_IMPORTER
#include "NDOLoader.h" #include "NDOLoader.h"
using namespace Assimp; using namespace Assimp;

View File

@ -182,7 +182,7 @@ void OgreImporter::ReadVertexBuffer(SubMesh &theSubMesh, XmlReader *Reader, unsi
XmlRead(Reader); XmlRead(Reader);
/*it might happen, that we have more than one attribute per vertex (they are not splitted to different buffers) /*it might happen, that we have more than one attribute per vertex (they are not splitted to different buffers)
so the break condition is a bit tricky (well, IrrXML just sucks :( )*/ so the break condition is a bit tricky */
while(Reader->getNodeName()==string("vertex") while(Reader->getNodeName()==string("vertex")
||Reader->getNodeName()==string("position") ||Reader->getNodeName()==string("position")
||Reader->getNodeName()==string("normal") ||Reader->getNodeName()==string("normal")

View File

@ -77,8 +77,6 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
if(!SkeletonFile) if(!SkeletonFile)
throw DeadlyImportError(string("Failed to create XML Reader for ")+FileName); throw DeadlyImportError(string("Failed to create XML Reader for ")+FileName);
//Quick note: Whoever read this should know this one thing: irrXml fucking sucks!!!
XmlRead(SkeletonFile); XmlRead(SkeletonFile);
if(string("skeleton")!=SkeletonFile->getNodeName()) if(string("skeleton")!=SkeletonFile->getNodeName())
throw DeadlyImportError("No <skeleton> node in SkeletonFile: "+FileName); throw DeadlyImportError("No <skeleton> node in SkeletonFile: "+FileName);
@ -169,12 +167,12 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto
Bones[ChildId].ParentId=ParentId; Bones[ChildId].ParentId=ParentId;
Bones[ParentId].Children.push_back(ChildId); Bones[ParentId].Children.push_back(ChildId);
XmlRead(SkeletonFile);//I once forget this line, which led to an endless loop, did i mentioned, that irrxml sucks?? XmlRead(SkeletonFile);
} }
//_____________________________________________________________________________ //_____________________________________________________________________________
//--------- Calculate the WorldToBoneSpace Matrix recursivly for all bones: ------------------ //--------- Calculate the WorldToBoneSpace Matrix recursively for all bones: ------------------
BOOST_FOREACH(Bone &theBone, Bones) BOOST_FOREACH(Bone &theBone, Bones)
{ {
if(-1==theBone.ParentId) //the bone is a root bone if(-1==theBone.ParentId) //the bone is a root bone

View File

@ -379,8 +379,7 @@ void Q3DImporter::InternReadFile( const std::string& pFile,
light->mColorSpecular = light->mColorDiffuse; light->mColorSpecular = light->mColorDiffuse;
// We don't need the rest, but we need to know where // We don't need the rest, but we need to know where this chunk ends.
// this fucking chunk ends.
unsigned int temp = (unsigned int)(stream.GetI4() * stream.GetI4()); unsigned int temp = (unsigned int)(stream.GetI4() * stream.GetI4());
// skip the background file name // skip the background file name

View File

@ -384,7 +384,7 @@ bool STLImporter::LoadBinaryFile()
} }
aiColor4D* clr = &pMesh->mColors[0][i*3]; aiColor4D* clr = &pMesh->mColors[0][i*3];
clr->a = 1.0f; clr->a = 1.0f;
if (bIsMaterialise) // fuck, this is reversed if (bIsMaterialise) // this is reversed
{ {
clr->r = (color & 0x31u) / 31.0f; clr->r = (color & 0x31u) / 31.0f;
clr->g = ((color & (0x31u<<5))>>5u) / 31.0f; clr->g = ((color & (0x31u<<5))>>5u) / 31.0f;

View File

@ -60,9 +60,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* *
* Other (mixed) configuration switches are listed here: * Other (mixed) configuration switches are listed here:
* ASSIMP_BUILD_NO_COMPRESSED_X * ASSIMP_BUILD_NO_COMPRESSED_X
* - Disable support for compressed X files * - Disable support for compressed X files (zip)
* ASSIMP_BUILD_NO_COMPRESSED_BLEND * ASSIMP_BUILD_NO_COMPRESSED_BLEND
* - Disable support for compressed Blender files*/ * - Disable support for compressed Blender files (zip)
* ASSIMP_BUILD_NO_COMPRESSED_IFC
* - Disable support for IFCZIP files (unzip)
*/
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
#ifndef ASSIMP_BUILD_NO_COMPRESSED_X #ifndef ASSIMP_BUILD_NO_COMPRESSED_X
@ -71,6 +74,16 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND #ifndef ASSIMP_BUILD_NO_COMPRESSED_BLEND
# define ASSIMP_BUILD_NEED_Z_INFLATE # define ASSIMP_BUILD_NEED_Z_INFLATE
#endif
#ifndef ASSIMP_BUILD_NO_COMPRESSED_IFC
# define ASSIMP_BUILD_NEED_Z_INFLATE
# define ASSIMP_BUILD_NEED_UNZIP
#endif
#ifndef ASSIMP_BUILD_NO_Q3BSP_IMPORTER
# define ASSIMP_BUILD_NEED_Z_INFLATE
# define ASSIMP_BUILD_NEED_UNZIP
#endif #endif
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////

View File

@ -160,8 +160,13 @@ struct aiFace
delete[] mIndices; delete[] mIndices;
mNumIndices = o.mNumIndices; mNumIndices = o.mNumIndices;
mIndices = new unsigned int[mNumIndices]; if (mNumIndices) {
::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int)); mIndices = new unsigned int[mNumIndices];
::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int));
}
else {
mIndices = NULL;
}
return *this; return *this;
} }

View File

@ -105,7 +105,8 @@ def main():
# Parse structure definitions from BlenderScene.h # Parse structure definitions from BlenderScene.h
input = open(inputfile,"rt").read() input = open(inputfile,"rt").read()
flags = re.ASCII|re.DOTALL|re.MULTILINE #flags = re.ASCII|re.DOTALL|re.MULTILINE
flags = re.DOTALL|re.MULTILINE
#stripcoms = re.compile(r"/\*(.*?)*\/",flags) #stripcoms = re.compile(r"/\*(.*?)*\/",flags)
getstruct = re.compile(r"struct\s+(\w+?)\s*(:\s*ElemBase)?\s*\{(.*?)^\}\s*;",flags) getstruct = re.compile(r"struct\s+(\w+?)\s*(:\s*ElemBase)?\s*\{(.*?)^\}\s*;",flags)
getsmartx = re.compile(r"(std\s*::\s*)?(vector)\s*<\s*(boost\s*::\s*)?shared_(ptr)\s*<\s*(\w+)\s*>\s*>\s*",flags) getsmartx = re.compile(r"(std\s*::\s*)?(vector)\s*<\s*(boost\s*::\s*)?shared_(ptr)\s*<\s*(\w+)\s*>\s*>\s*",flags)
@ -143,7 +144,8 @@ def main():
input = input[match.end():] input = input[match.end():]
[print ("Enum: "+e) for e in enums] for e in enums:
print("Enum: "+e)
for k,v in hits.items(): for k,v in hits.items():
out = [] out = []
for line in v: for line in v:
@ -177,7 +179,8 @@ def main():
v[:] = out v[:] = out
print("Structure {0}".format(k)) print("Structure {0}".format(k))
[print("\t"+"\t".join(elem)) for elem in out] for elem in out:
print("\t"+"\t".join(elem))
print("") print("")

View File

@ -985,7 +985,7 @@ void OpenAsset()
void SetupPPUIState() void SetupPPUIState()
{ {
// fucking hell, that's ugly. anyone willing to rewrite me from scratch? // that's ugly. anyone willing to rewrite me from scratch?
HMENU hMenu = GetMenu(g_hDlg); HMENU hMenu = GetMenu(g_hDlg);
CheckMenuItem(hMenu,ID_VIEWER_PP_JIV,ppsteps & aiProcess_JoinIdenticalVertices ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,ID_VIEWER_PP_JIV,ppsteps & aiProcess_JoinIdenticalVertices ? MF_CHECKED : MF_UNCHECKED);
CheckMenuItem(hMenu,ID_VIEWER_PP_CTS,ppsteps & aiProcess_CalcTangentSpace ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,ID_VIEWER_PP_CTS,ppsteps & aiProcess_CalcTangentSpace ? MF_CHECKED : MF_UNCHECKED);
@ -1916,7 +1916,7 @@ INT_PTR CALLBACK MessageProc(HWND hwndDlg,UINT uMsg,
} }
} }
// fucking hell, this is ugly. anyone willing to rewrite it from scratch using wxwidgets or similar? // this is ugly. anyone willing to rewrite it from scratch using wxwidgets or similar?
else if (ID_VIEWER_PP_JIV == LOWORD(wParam)) { else if (ID_VIEWER_PP_JIV == LOWORD(wParam)) {
ppsteps ^= aiProcess_JoinIdenticalVertices; ppsteps ^= aiProcess_JoinIdenticalVertices;
CheckMenuItem(hMenu,ID_VIEWER_PP_JIV,ppsteps & aiProcess_JoinIdenticalVertices ? MF_CHECKED : MF_UNCHECKED); CheckMenuItem(hMenu,ID_VIEWER_PP_JIV,ppsteps & aiProcess_JoinIdenticalVertices ? MF_CHECKED : MF_UNCHECKED);