From d893b95be6a072f4eac301fee78ff8e2444cfc25 Mon Sep 17 00:00:00 2001 From: acgessler <alexander.gessler@gmx.net> Date: Fri, 15 Feb 2013 01:01:08 +0100 Subject: [PATCH 01/12] - Ifc: further improvements on the IfcPolygonalBoundedHalfSpace code. Still causes artifacts sometimes. --- code/IfcBoolean.cpp | 61 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/code/IfcBoolean.cpp b/code/IfcBoolean.cpp index b52727c14..696137d9f 100644 --- a/code/IfcBoolean.cpp +++ b/code/IfcBoolean.cpp @@ -387,6 +387,9 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded bool extra_point_flag = false; IfcVector3 extra_point; + IfcVector3 enter_volume; + bool entered_volume_flag = false; + for(unsigned int i = 0; i < *iit; ++i) { // current segment: [i,i+1 mod size] or [*extra_point,i] if extra_point_flag is set const IfcVector3& e0 = extra_point_flag ? extra_point : in[vidx+i]; @@ -434,6 +437,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded outvert.push_back(isectpos); ++newcount; + /* // this is, however, only a line that goes to the plane, but not // necessarily to the point where the bounding volume on the // black side of the plane is hit. So basically, we need another @@ -442,8 +446,30 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded extra_point_flag = true; extra_point = isectpos; - //was_outside_boundary = true; - //continue; + was_outside_boundary = true; + continue; */ + + // [isectpos, enter_volume] potentially needs extra points. + // For this, we determine the intersection point with the + // bounding volume and project it onto the plane. + /* + const IfcVector3& enter_volume_proj = proj * enter_volume; + const IfcVector3& enter_isectpos = proj * isectpos; + + intersected_boundary_segments.clear(); + intersected_boundary_points.clear(); + + IntersectsBoundaryProfile(enter_volume_proj, enter_isectpos, profile->verts, + intersected_boundary_segments, + intersected_boundary_points); + + if(!intersected_boundary_segments.empty()) { + + vec = vec + ((p - vec) * n) * n; + } + */ + + //entered_volume_flag = true; } else { outvert.push_back(e0); @@ -459,8 +485,15 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded outvert.push_back(e0); } else { - outvert.push_back(isectpos); + if(entered_volume_flag) { + const IfcVector3& fix_point = enter_volume + ((p - enter_volume) * n) * n; + outvert.push_back(fix_point); + ++newcount; + } + + outvert.push_back(isectpos); } + entered_volume_flag = false; ++newcount; } else { // no intersection with plane or parallel; e0,e1 are on the bad side @@ -482,7 +515,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded // ... - IfcFloat d = 1e10; + IfcFloat d = 1e20; IfcVector3 vclosest; BOOST_FOREACH(const IfcVector3& v, intersected_boundary_points) { const IfcFloat dn = (v-e1_plane).SquareLength(); @@ -492,13 +525,24 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded } } - outvert.push_back(proj_inv * vclosest); + vclosest = proj_inv * vclosest; + if(entered_volume_flag) { + const IfcVector3& fix_point = vclosest + ((p - vclosest) * n) * n; + outvert.push_back(fix_point); + ++newcount; + + entered_volume_flag = false; + } + + outvert.push_back(vclosest); ++newcount; //outvert.push_back(e1); //++newcount; } else { + entered_volume_flag = true; + // we just entered the clipping boundary. Record the point // and the segment where we entered and also generate this point. //last_intersected_boundary_segment = intersected_boundary_segments.front(); @@ -507,7 +551,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded outvert.push_back(e0); ++newcount; - IfcFloat d = 1e10; + IfcFloat d = 1e20; IfcVector3 vclosest; BOOST_FOREACH(const IfcVector3& v, intersected_boundary_points) { const IfcFloat dn = (v-e0_plane).SquareLength(); @@ -517,7 +561,8 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded } } - outvert.push_back(proj_inv * vclosest); + enter_volume = proj_inv * vclosest; + outvert.push_back(enter_volume); ++newcount; } } @@ -525,6 +570,8 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded else if (is_outside_boundary) { outvert.push_back(e0); ++newcount; + + entered_volume_flag = false; } } From c4a8193e4beb039d486d2a4a74e715581c342464 Mon Sep 17 00:00:00 2001 From: Alexander Gessler <alexander.gessler@gmx.net> Date: Sun, 17 Feb 2013 20:25:30 +0100 Subject: [PATCH 02/12] - fix a typo. --- code/BlenderLoader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BlenderLoader.cpp b/code/BlenderLoader.cpp index c175c719f..cef6ffad3 100644 --- a/code/BlenderLoader.cpp +++ b/code/BlenderLoader.cpp @@ -472,7 +472,7 @@ void BlenderImporter::ResolveTexture(aiMaterial* out, const Material* mat, const return; } - // We can't support most of the texture types because the're mostly procedural. + // We can't support most of the texture types because they're mostly procedural. // These are substituted by a dummy texture. const char* dispnam = ""; switch( rtex->type ) From de7b1aaa50a117d0e62efeea6ba72f0f593c2d9b Mon Sep 17 00:00:00 2001 From: Alexander Gessler <alexander.gessler@gmx.net> Date: Mon, 18 Feb 2013 16:10:47 +0100 Subject: [PATCH 03/12] - IFCBoolean.cpp: fix capitalization error in filename --- code/{IfcBoolean.cpp => IFCBoolean.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename code/{IfcBoolean.cpp => IFCBoolean.cpp} (100%) diff --git a/code/IfcBoolean.cpp b/code/IFCBoolean.cpp similarity index 100% rename from code/IfcBoolean.cpp rename to code/IFCBoolean.cpp From 16744d78d73e82125348a0b5130e9793d980ed96 Mon Sep 17 00:00:00 2001 From: rdiankov <rosen.diankov@gmail.com> Date: Tue, 26 Feb 2013 14:02:35 +0900 Subject: [PATCH 04/12] fixed the broken cmake config files (assimp-cmake), adding version suffix libraries --- CMakeLists.txt | 8 ++++---- assimp-config-version.cmake.in | 16 ++++++++-------- assimp-config.cmake.in | 4 ++-- code/CMakeLists.txt | 1 + 4 files changed, 15 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index f5391f7d2..e6f89d62c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,9 @@ cmake_minimum_required( VERSION 2.6 ) PROJECT( Assimp ) # Define here the needed parameters -set (ASSIMP_SV_REVISION 1264) set (ASSIMP_VERSION_MAJOR 3) set (ASSIMP_VERSION_MINOR 0) -set (ASSIMP_VERSION_PATCH ${ASSIMP_SV_REVISION}) # subversion revision? +set (ASSIMP_VERSION_PATCH 1) # subversion revision? set (ASSIMP_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH}) set (ASSIMP_SOVERSION 3) SET ( PROJECT_VERSION "${ASSIMP_VERSION}" ) @@ -14,9 +13,10 @@ set(ASSIMP_PACKAGE_VERSION "0" CACHE STRING "the package-specific version used f option(ASSIMP_OPT_BUILD_PACKAGES "Set to ON to generate CPack configuration files and packaging targets" OFF) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules") -set(LIBASSIMP_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}-r${ASSIMP_SV_REVISION}) -set(LIBASSIMP-DEV_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}-r${ASSIMP_SV_REVISION}-dev) +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(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") 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.... diff --git a/assimp-config-version.cmake.in b/assimp-config-version.cmake.in index 2698a53ac..ff48b4822 100644 --- a/assimp-config-version.cmake.in +++ b/assimp-config-version.cmake.in @@ -1,13 +1,13 @@ -set( ASSIMP_PACKAGE_VERSION "@ASSIMP_VERSION@" ) -if( "${ASSIMP_PACKAGE_FIND_VERSION}" VERSION_EQUAL "@ASSIMP_VERSION@") - set(ASSIMP_PACKAGE_VERSION_EXACT 1) +set( PACKAGE_VERSION "@ASSIMP_VERSION@" ) +if( "${PACKAGE_FIND_VERSION}" VERSION_EQUAL "@ASSIMP_VERSION@") + set(PACKAGE_VERSION_EXACT 1) endif() -if( "${ASSIMP_PACKAGE_FIND_VERSION_MAJOR}.${ASSIMP_PACKAGE_FIND_VERSION_MINOR}" EQUAL "@ASSIMP_SOVERSION@" ) - set(ASSIMP_PACKAGE_VERSION_COMPATIBLE 1) -elseif( "${ASSIMP_PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@ASSIMP_VERSION_MAJOR@" ) +if( "${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@ASSIMP_SOVERSION@" ) + set(PACKAGE_VERSION_COMPATIBLE 1) +elseif( "${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@ASSIMP_VERSION_MAJOR@" ) # for now backward compatible if minor version is less - if( ${ASSIMP_PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ ) - set(ASSIMP_PACKAGE_VERSION_COMPATIBLE 1) + if( ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ ) + set(PACKAGE_VERSION_COMPATIBLE 1) endif() endif() set( ASSIMP_STATIC_LIB "@ASSIMP_BUILD_STATIC_LIB@") diff --git a/assimp-config.cmake.in b/assimp-config.cmake.in index 1d581b20a..75d233a0e 100644 --- a/assimp-config.cmake.in +++ b/assimp-config.cmake.in @@ -37,8 +37,8 @@ if( WIN32 ) set( ASSIMP_CXX_FLAGS " -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB") endif() set( ASSIMP_LINK_FLAGS "" ) -set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@LIB_INSTALL_DIR@") -set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@INCLUDE_INSTALL_DIR@") +set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@") +set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@") set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX}) # the boost version assimp was compiled with diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index fe3d28219..9746ffd87 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -696,6 +696,7 @@ TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES}) SET_TARGET_PROPERTIES( assimp PROPERTIES VERSION ${ASSIMP_VERSION} SOVERSION ${ASSIMP_SOVERSION} # use full version + OUTPUT_NAME assimp${ASSIMP_LIBRARY_SUFFIX} ) # Build against external unzip, or add ../contrib/unzip so # assimp can #include "unzip.h" From 260568912c277e4ba104e2b659dbbd95967cfd85 Mon Sep 17 00:00:00 2001 From: Alexander Gessler <alexander.gessler@gmx.net> Date: Sun, 10 Mar 2013 19:15:14 +0100 Subject: [PATCH 05/12] - Importer::ReadFileFromMemory/aiImportFileFromMemory() clarify wording in documentation --- include/assimp/Importer.hpp | 9 +++++---- include/assimp/cimport.h | 12 +++++++----- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/include/assimp/Importer.hpp b/include/assimp/Importer.hpp index e0a1c8cb6..e0d55d4da 100644 --- a/include/assimp/Importer.hpp +++ b/include/assimp/Importer.hpp @@ -409,11 +409,12 @@ public: * instance. Use GetOrphanedScene() to take ownership of it. * * @note This is a straightforward way to decode models from memory - * buffers, but it doesn't handle model formats spreading their + * buffers, but it doesn't handle model formats that spread their * data across multiple files or even directories. Examples include - * OBJ or MD3, which outsource parts of their material stuff into - * external scripts. If you need the full functionality, provide - * a custom IOSystem to make Assimp find these files. + * OBJ or MD3, which outsource parts of their material info into + * external scripts. If you need full functionality, provide + * a custom IOSystem to make Assimp find these files and use + * the regular ReadFile() API. */ const aiScene* ReadFileFromMemory( const void* pBuffer, diff --git a/include/assimp/cimport.h b/include/assimp/cimport.h index 92b6e0b7a..237e65c29 100644 --- a/include/assimp/cimport.h +++ b/include/assimp/cimport.h @@ -170,11 +170,13 @@ ASSIMP_API const C_STRUCT aiScene* aiImportFileExWithProperties( * Check the return value, and you'll know ... * @return A pointer to the imported data, NULL if the import failed. * - * @note This is a straightforward way to decode models from memory buffers, but it - * doesn't handle model formats spreading their data across multiple files or even - * directories. Examples include OBJ or MD3, which outsource parts of their material - * stuff into external scripts. If you need the full functionality, provide a custom - * IOSystem to make Assimp find these files. + * @note This is a straightforward way to decode models from memory + * buffers, but it doesn't handle model formats that spread their + * data across multiple files or even directories. Examples include + * OBJ or MD3, which outsource parts of their material info into + * external scripts. If you need full functionality, provide + * a custom IOSystem to make Assimp find these files and use + * the regular aiImportFileEx()/aiImportFileExWithProperties() API. */ ASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemory( const char* pBuffer, From 3587eef6eb80104b8c411ec0f881f233452bcebf Mon Sep 17 00:00:00 2001 From: Kim <Kulling> Date: Mon, 11 Mar 2013 22:44:53 +0100 Subject: [PATCH 06/12] bugfix : fix a w4 compiler warning. Signed-off-by: Kim <Kulling> --- code/IFCBoolean.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/code/IFCBoolean.cpp b/code/IFCBoolean.cpp index 696137d9f..911f23a44 100644 --- a/code/IFCBoolean.cpp +++ b/code/IFCBoolean.cpp @@ -381,7 +381,8 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded unsigned int newcount = 0; bool was_outside_boundary = !PointInPoly(proj * in[vidx], profile->verts); - size_t last_intersected_boundary_segment; + // used any more? + //size_t last_intersected_boundary_segment; IfcVector3 last_intersected_boundary_point; bool extra_point_flag = false; From 8213805dc6556566a9f983e480e44038bdb75674 Mon Sep 17 00:00:00 2001 From: Kim <Kulling> Date: Sun, 17 Mar 2013 14:44:24 +0100 Subject: [PATCH 07/12] bugfix : fix for Build problem on Mac OS 10.8.2. Signed-off-by: Kim <Kulling> --- code/BoostWorkaround/boost/tuple/tuple.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/BoostWorkaround/boost/tuple/tuple.hpp b/code/BoostWorkaround/boost/tuple/tuple.hpp index b6466f590..562e12203 100644 --- a/code/BoostWorkaround/boost/tuple/tuple.hpp +++ b/code/BoostWorkaround/boost/tuple/tuple.hpp @@ -175,7 +175,7 @@ namespace boost { // Get a specific tuple element template <unsigned N> typename detail::type_getter<T0,0,typename very_long::next_type, N>::type& get () { - return m.get<N>(); + return m.template get<N>(); } // ... and the const version From 241c35abb2bc891c0f1fcc0b519a86d7cf3df3ee Mon Sep 17 00:00:00 2001 From: rdiankov <rosen.diankov@gmail.com> Date: Mon, 18 Mar 2013 21:11:49 +0900 Subject: [PATCH 08/12] removed ASSIMP_LIBRARY_SUFFIX --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e6f89d62c..fcafbab41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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-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(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) add_definitions(-fPIC) # this is a very important switch and some libraries seem now to have it.... From 0b9d6bec0d6d8f3fc39ae15708166ba3c04b5fde Mon Sep 17 00:00:00 2001 From: Alexander Gessler <alexander.gessler@gmx.net> Date: Thu, 21 Mar 2013 19:54:55 +0100 Subject: [PATCH 09/12] - drop a few swear words from documentation. Some of these are years old and I think the authors (me included) don't want them associated with their commits. --- code/3DSConverter.cpp | 2 +- code/BoostWorkaround/boost/tuple/tuple.hpp | 6 +++--- code/COBLoader.cpp | 6 +++--- code/ColladaExporter.cpp | 4 ++-- code/ColladaLoader.cpp | 10 +++++----- code/ColladaParser.cpp | 7 ++----- code/LWOAnimation.cpp | 4 ++-- code/MDLMaterialLoader.cpp | 1 - code/OgreMesh.cpp | 2 +- code/OgreSkeleton.cpp | 6 ++---- code/Q3DLoader.cpp | 3 +-- code/STLLoader.cpp | 2 +- tools/assimp_view/MessageProc.cpp | 4 ++-- 13 files changed, 25 insertions(+), 32 deletions(-) diff --git a/code/3DSConverter.cpp b/code/3DSConverter.cpp index 1cb18c058..91ace96b5 100644 --- a/code/3DSConverter.cpp +++ b/code/3DSConverter.cpp @@ -707,7 +707,7 @@ void Discreet3DSImporter::GenerateNodeGraph(aiScene* pcOut) 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: // // ROOT_NODE diff --git a/code/BoostWorkaround/boost/tuple/tuple.hpp b/code/BoostWorkaround/boost/tuple/tuple.hpp index 562e12203..ea9ee3503 100644 --- a/code/BoostWorkaround/boost/tuple/tuple.hpp +++ b/code/BoostWorkaround/boost/tuple/tuple.hpp @@ -255,7 +255,7 @@ namespace boost { 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> inline tuple <T0,T1> make_tuple (const T0& t0, const T1& t1) { @@ -265,7 +265,7 @@ namespace boost { return t; } - // Constructs a tuple with 1 elements (no comment ...) + // Constructs a tuple with 1 elements (well ...) template <typename T0> inline tuple <T0> make_tuple (const T0& t0) { tuple <T0> t; @@ -273,7 +273,7 @@ namespace boost { 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 () { tuple <> t; return t; diff --git a/code/COBLoader.cpp b/code/COBLoader.cpp index 71b8209b3..47b6b0315 100644 --- a/code/COBLoader.cpp +++ b/code/COBLoader.cpp @@ -1045,9 +1045,9 @@ void COBImporter::ReadPolH_Binary(COB::Scene& out, StreamReaderLE& reader, const v.y = reader.GetF4(); } - const size_t numfuck = reader.GetI4(); - msh.faces.reserve(numfuck); - for(size_t i = 0; i < numfuck; ++i) { + const size_t numf = reader.GetI4(); + msh.faces.reserve(numf); + for(size_t i = 0; i < numf; ++i) { // XXX backface culling flag is 0x10 in flags // hole? diff --git a/code/ColladaExporter.cpp b/code/ColladaExporter.cpp index 487d64a36..763480650 100644 --- a/code/ColladaExporter.cpp +++ b/code/ColladaExporter.cpp @@ -99,7 +99,7 @@ void ColladaExporter::WriteFile() 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; PushTag(); mOutput << startstr << "<instance_visual_scene url=\"#myScene\" />" << endstr; @@ -495,7 +495,7 @@ void ColladaExporter::WriteFloatArray( const std::string& pIdString, FloatDataTy mOutput << "</float_array>" << endstr; 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; PushTag(); mOutput << startstr << "<accessor count=\"" << pElementCount << "\" offset=\"0\" source=\"#" << arrayId << "\" stride=\"" << floatsPerElement << "\">" << endstr; diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index 5d83ccaba..d201ff44f 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -325,10 +325,10 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll out->mAngleInnerCone = AI_DEG_TO_RAD( srcLight->mFalloffAngle ); - // ... some extension magic. FUCKING COLLADA. + // ... some extension magic. O if (srcLight->mOuterAngle == 10e10f) { - // ... some deprecation magic. FUCKING FCOLLADA. + // ... some deprecation magic. if (srcLight->mPenumbraAngle == 10e10f) { // Need to rely on falloff_exponent. I don't know how to interpret it, so I need to guess .... @@ -382,7 +382,7 @@ void ColladaLoader::BuildCamerasForNode( const ColladaParser& pParser, const Col out->mClipPlaneNear = srcCamera->mZNear; // ... 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) 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() + 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 // also ignore any vertex attribute if it has a different count 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"); // sanity check: we rely on the vertex weights always coming as pairs of BoneIndex-WeightIndex 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 size_t numBones = jointNames.mStrings.size(); diff --git a/code/ColladaParser.cpp b/code/ColladaParser.cpp index 14853c019..843dd618e 100644 --- a/code/ColladaParser.cpp +++ b/code/ColladaParser.cpp @@ -487,7 +487,7 @@ void ColladaParser::ReadController( Collada::Controller& pController) else if( IsElement( "skin")) { // 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"); pController.mMeshId = mReader->getAttributeValue( sourceIndex) + 1; } @@ -1097,9 +1097,6 @@ void ColladaParser::ReadEffectLibrary() if( IsElement( "effect")) { // 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"); std::string id = mReader->getAttributeValue( attrID); @@ -1613,7 +1610,7 @@ void ColladaParser::ReadSource() } 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")) { diff --git a/code/LWOAnimation.cpp b/code/LWOAnimation.cpp index d719ef951..f9308baef 100644 --- a/code/LWOAnimation.cpp +++ b/code/LWOAnimation.cpp @@ -448,8 +448,8 @@ void AnimResolver::GetKeys(std::vector<aiVectorKey>& out, if ((*cur_x).time == (*cur_y).time && (*cur_x).time == (*cur_z).time ) { - // we have a keyframe for all of them defined .. great, - // we don't need to fucking interpolate here ... + // we have a keyframe for all of them defined .. this means + // we don't need to interpolate here. fill.mTime = (*cur_x).time; fill.mValue.x = (*cur_x).value; diff --git a/code/MDLMaterialLoader.cpp b/code/MDLMaterialLoader.cpp index 1946eedd9..dfa438b3a 100644 --- a/code/MDLMaterialLoader.cpp +++ b/code/MDLMaterialLoader.cpp @@ -787,7 +787,6 @@ void MDLImporter::SkipSkinLump_3DGS_MDL7( } // ------------------------------------------------------------------------------------------------ -// What the fuck does this function do? Can't remember void MDLImporter::ParseSkinLump_3DGS_MDL7( const unsigned char* szCurrent, const unsigned char** szCurrentOut, diff --git a/code/OgreMesh.cpp b/code/OgreMesh.cpp index 93451d49a..4abdee635 100644 --- a/code/OgreMesh.cpp +++ b/code/OgreMesh.cpp @@ -182,7 +182,7 @@ void OgreImporter::ReadVertexBuffer(SubMesh &theSubMesh, XmlReader *Reader, unsi XmlRead(Reader); /*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") ||Reader->getNodeName()==string("position") ||Reader->getNodeName()==string("normal") diff --git a/code/OgreSkeleton.cpp b/code/OgreSkeleton.cpp index 567a22fb7..376829cfb 100644 --- a/code/OgreSkeleton.cpp +++ b/code/OgreSkeleton.cpp @@ -77,8 +77,6 @@ void OgreImporter::LoadSkeleton(std::string FileName, vector<Bone> &Bones, vecto if(!SkeletonFile) 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); if(string("skeleton")!=SkeletonFile->getNodeName()) 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[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) { if(-1==theBone.ParentId) //the bone is a root bone diff --git a/code/Q3DLoader.cpp b/code/Q3DLoader.cpp index 76051feea..dc4b2b31c 100644 --- a/code/Q3DLoader.cpp +++ b/code/Q3DLoader.cpp @@ -379,8 +379,7 @@ void Q3DImporter::InternReadFile( const std::string& pFile, light->mColorSpecular = light->mColorDiffuse; - // We don't need the rest, but we need to know where - // this fucking chunk ends. + // We don't need the rest, but we need to know where this chunk ends. unsigned int temp = (unsigned int)(stream.GetI4() * stream.GetI4()); // skip the background file name diff --git a/code/STLLoader.cpp b/code/STLLoader.cpp index b94f22043..8bfde9656 100644 --- a/code/STLLoader.cpp +++ b/code/STLLoader.cpp @@ -384,7 +384,7 @@ bool STLImporter::LoadBinaryFile() } aiColor4D* clr = &pMesh->mColors[0][i*3]; clr->a = 1.0f; - if (bIsMaterialise) // fuck, this is reversed + if (bIsMaterialise) // this is reversed { clr->r = (color & 0x31u) / 31.0f; clr->g = ((color & (0x31u<<5))>>5u) / 31.0f; diff --git a/tools/assimp_view/MessageProc.cpp b/tools/assimp_view/MessageProc.cpp index af038b912..44d38568d 100644 --- a/tools/assimp_view/MessageProc.cpp +++ b/tools/assimp_view/MessageProc.cpp @@ -985,7 +985,7 @@ void OpenAsset() 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); 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); @@ -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)) { ppsteps ^= aiProcess_JoinIdenticalVertices; CheckMenuItem(hMenu,ID_VIEWER_PP_JIV,ppsteps & aiProcess_JoinIdenticalVertices ? MF_CHECKED : MF_UNCHECKED); From b4f666083adbcbc0c5b910e84ca2f3fddc3a569e Mon Sep 17 00:00:00 2001 From: Alexander Gessler <alexander.gessler@gmx.net> Date: Thu, 21 Mar 2013 20:00:33 +0100 Subject: [PATCH 10/12] - collada: avoid unsafe float comparison against a magic number. --- code/ColladaHelper.h | 5 +++-- code/ColladaLoader.cpp | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/code/ColladaHelper.h b/code/ColladaHelper.h index 64f68849b..f9bd4fb5a 100644 --- a/code/ColladaHelper.h +++ b/code/ColladaHelper.h @@ -119,6 +119,7 @@ struct Camera }; #define aiLightSource_AMBIENT 0xdeaddead +#define ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET 1e9f /** A collada light source. */ struct Light @@ -129,8 +130,8 @@ struct Light , mAttQuadratic (0.f) , mFalloffAngle (180.f) , mFalloffExponent (0.f) - , mPenumbraAngle (10e10f) - , mOuterAngle (10e10f) + , mPenumbraAngle (ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET) + , mOuterAngle (ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET) , mIntensity (1.f) {} diff --git a/code/ColladaLoader.cpp b/code/ColladaLoader.cpp index d201ff44f..9b3392a5c 100644 --- a/code/ColladaLoader.cpp +++ b/code/ColladaLoader.cpp @@ -325,11 +325,11 @@ void ColladaLoader::BuildLightsForNode( const ColladaParser& pParser, const Coll out->mAngleInnerCone = AI_DEG_TO_RAD( srcLight->mFalloffAngle ); - // ... some extension magic. O - if (srcLight->mOuterAngle == 10e10f) + // ... some extension magic. + if (srcLight->mOuterAngle >= ASSIMP_COLLADA_LIGHT_ANGLE_NOT_SET*(1-1e-6f)) { // ... 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 .... // epsilon chosen to be 0.1 From c01619819182752e4d98e48d816d13d2a0a3a0b3 Mon Sep 17 00:00:00 2001 From: Alexander Gessler <alexander.gessler@gmx.net> Date: Thu, 21 Mar 2013 20:17:09 +0100 Subject: [PATCH 11/12] aiMesh: fix copy constructor so issue [3572335] (and any further instances of the same pattern in creating face arrays) is resolved. --- include/assimp/mesh.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/include/assimp/mesh.h b/include/assimp/mesh.h index 26084c77e..df257e7f1 100644 --- a/include/assimp/mesh.h +++ b/include/assimp/mesh.h @@ -160,8 +160,13 @@ struct aiFace delete[] mIndices; mNumIndices = o.mNumIndices; - mIndices = new unsigned int[mNumIndices]; - ::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int)); + if (mNumIndices) { + mIndices = new unsigned int[mNumIndices]; + ::memcpy( mIndices, o.mIndices, mNumIndices * sizeof( unsigned int)); + } + else { + mIndices = NULL; + } return *this; } From 358cb9b4c722a52dc775bda22fd0c665e01b544a Mon Sep 17 00:00:00 2001 From: Alexander Gessler <alexander.gessler@gmx.net> Date: Sun, 24 Mar 2013 23:05:57 +0100 Subject: [PATCH 12/12] - update readme.md --- Readme.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Readme.md b/Readme.md index 92a019738..dea7e7756 100644 --- a/Readme.md +++ b/Readme.md @@ -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. -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. @@ -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. For the formal details, see the `LICENSE` file. - -------------------------------