pull/21/head
ulf 2013-03-27 12:52:28 +01:00
commit 368092174b
24 changed files with 123 additions and 74 deletions

View File

@ -2,10 +2,9 @@ cmake_minimum_required( VERSION 2.6 )
PROJECT( Assimp ) PROJECT( Assimp )
# Define here the needed parameters # Define here the needed parameters
set (ASSIMP_SV_REVISION 1264)
set (ASSIMP_VERSION_MAJOR 3) set (ASSIMP_VERSION_MAJOR 3)
set (ASSIMP_VERSION_MINOR 0) 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_VERSION ${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
set (ASSIMP_SOVERSION 3) set (ASSIMP_SOVERSION 3)
SET ( PROJECT_VERSION "${ASSIMP_VERSION}" ) 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) 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(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_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}.${ASSIMP_VERSION_PATCH})
set(LIBASSIMP-DEV_COMPONENT libassimp${ASSIMP_VERSION_MAJOR}.${ASSIMP_VERSION_MINOR}-r${ASSIMP_SV_REVISION}-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 "" 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

@ -1,13 +1,13 @@
set( ASSIMP_PACKAGE_VERSION "@ASSIMP_VERSION@" ) set( PACKAGE_VERSION "@ASSIMP_VERSION@" )
if( "${ASSIMP_PACKAGE_FIND_VERSION}" VERSION_EQUAL "@ASSIMP_VERSION@") if( "${PACKAGE_FIND_VERSION}" VERSION_EQUAL "@ASSIMP_VERSION@")
set(ASSIMP_PACKAGE_VERSION_EXACT 1) set(PACKAGE_VERSION_EXACT 1)
endif() endif()
if( "${ASSIMP_PACKAGE_FIND_VERSION_MAJOR}.${ASSIMP_PACKAGE_FIND_VERSION_MINOR}" EQUAL "@ASSIMP_SOVERSION@" ) if( "${PACKAGE_FIND_VERSION_MAJOR}.${PACKAGE_FIND_VERSION_MINOR}" EQUAL "@ASSIMP_SOVERSION@" )
set(ASSIMP_PACKAGE_VERSION_COMPATIBLE 1) set(PACKAGE_VERSION_COMPATIBLE 1)
elseif( "${ASSIMP_PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@ASSIMP_VERSION_MAJOR@" ) elseif( "${PACKAGE_FIND_VERSION_MAJOR}" EQUAL "@ASSIMP_VERSION_MAJOR@" )
# for now backward compatible if minor version is less # for now backward compatible if minor version is less
if( ${ASSIMP_PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ ) if( ${PACKAGE_FIND_VERSION_MINOR} LESS @ASSIMP_VERSION_MINOR@ )
set(ASSIMP_PACKAGE_VERSION_COMPATIBLE 1) set(PACKAGE_VERSION_COMPATIBLE 1)
endif() endif()
endif() endif()
set( ASSIMP_STATIC_LIB "@ASSIMP_BUILD_STATIC_LIB@") set( ASSIMP_STATIC_LIB "@ASSIMP_BUILD_STATIC_LIB@")

View File

@ -37,8 +37,8 @@ if( WIN32 )
set( ASSIMP_CXX_FLAGS " -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB") set( ASSIMP_CXX_FLAGS " -DBOOST_ALL_DYN_LINK -DBOOST_ALL_NO_LIB")
endif() endif()
set( ASSIMP_LINK_FLAGS "" ) set( ASSIMP_LINK_FLAGS "" )
set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@LIB_INSTALL_DIR@") set( ASSIMP_LIBRARY_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_LIB_INSTALL_DIR@")
set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@INCLUDE_INSTALL_DIR@") set( ASSIMP_INCLUDE_DIRS "${ASSIMP_ROOT_DIR}/@ASSIMP_INCLUDE_INSTALL_DIR@")
set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX}) set( ASSIMP_LIBRARIES assimp${ASSIMP_LIBRARY_SUFFIX})
# the boost version assimp was compiled with # the boost version assimp was compiled with

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

@ -472,7 +472,7 @@ void BlenderImporter::ResolveTexture(aiMaterial* out, const Material* mat, const
return; 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. // These are substituted by a dummy texture.
const char* dispnam = ""; const char* dispnam = "";
switch( rtex->type ) switch( rtex->type )

View File

@ -175,7 +175,7 @@ namespace boost {
// Get a specific tuple element // Get a specific tuple element
template <unsigned N> template <unsigned N>
typename detail::type_getter<T0,0,typename very_long::next_type, N>::type& get () { 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 // ... and the const version
@ -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

@ -696,6 +696,7 @@ TARGET_LINK_LIBRARIES(assimp ${ZLIB_LIBRARIES})
SET_TARGET_PROPERTIES( assimp PROPERTIES SET_TARGET_PROPERTIES( assimp PROPERTIES
VERSION ${ASSIMP_VERSION} VERSION ${ASSIMP_VERSION}
SOVERSION ${ASSIMP_SOVERSION} # use full version SOVERSION ${ASSIMP_SOVERSION} # use full version
OUTPUT_NAME assimp${ASSIMP_LIBRARY_SUFFIX}
) )
# Build against external unzip, or add ../contrib/unzip so # Build against external unzip, or add ../contrib/unzip so
# assimp can #include "unzip.h" # assimp can #include "unzip.h"

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();

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

@ -381,12 +381,16 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
unsigned int newcount = 0; unsigned int newcount = 0;
bool was_outside_boundary = !PointInPoly(proj * in[vidx], profile->verts); 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; IfcVector3 last_intersected_boundary_point;
bool extra_point_flag = false; bool extra_point_flag = false;
IfcVector3 extra_point; IfcVector3 extra_point;
IfcVector3 enter_volume;
bool entered_volume_flag = false;
for(unsigned int i = 0; i < *iit; ++i) { 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 // 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]; const IfcVector3& e0 = extra_point_flag ? extra_point : in[vidx+i];
@ -434,6 +438,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
outvert.push_back(isectpos); outvert.push_back(isectpos);
++newcount; ++newcount;
/*
// this is, however, only a line that goes to the plane, but not // this is, however, only a line that goes to the plane, but not
// necessarily to the point where the bounding volume on the // necessarily to the point where the bounding volume on the
// black side of the plane is hit. So basically, we need another // black side of the plane is hit. So basically, we need another
@ -442,8 +447,30 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
extra_point_flag = true; extra_point_flag = true;
extra_point = isectpos; extra_point = isectpos;
//was_outside_boundary = true; was_outside_boundary = true;
//continue; 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 { else {
outvert.push_back(e0); outvert.push_back(e0);
@ -459,8 +486,15 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
outvert.push_back(e0); outvert.push_back(e0);
} }
else { 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; ++newcount;
} }
else { // no intersection with plane or parallel; e0,e1 are on the bad side else { // no intersection with plane or parallel; e0,e1 are on the bad side
@ -482,7 +516,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
// ... // ...
IfcFloat d = 1e10; IfcFloat d = 1e20;
IfcVector3 vclosest; IfcVector3 vclosest;
BOOST_FOREACH(const IfcVector3& v, intersected_boundary_points) { BOOST_FOREACH(const IfcVector3& v, intersected_boundary_points) {
const IfcFloat dn = (v-e1_plane).SquareLength(); const IfcFloat dn = (v-e1_plane).SquareLength();
@ -492,13 +526,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; ++newcount;
//outvert.push_back(e1); //outvert.push_back(e1);
//++newcount; //++newcount;
} }
else { else {
entered_volume_flag = true;
// we just entered the clipping boundary. Record the point // we just entered the clipping boundary. Record the point
// and the segment where we entered and also generate this point. // and the segment where we entered and also generate this point.
//last_intersected_boundary_segment = intersected_boundary_segments.front(); //last_intersected_boundary_segment = intersected_boundary_segments.front();
@ -507,7 +552,7 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
outvert.push_back(e0); outvert.push_back(e0);
++newcount; ++newcount;
IfcFloat d = 1e10; IfcFloat d = 1e20;
IfcVector3 vclosest; IfcVector3 vclosest;
BOOST_FOREACH(const IfcVector3& v, intersected_boundary_points) { BOOST_FOREACH(const IfcVector3& v, intersected_boundary_points) {
const IfcFloat dn = (v-e0_plane).SquareLength(); const IfcFloat dn = (v-e0_plane).SquareLength();
@ -517,7 +562,8 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
} }
} }
outvert.push_back(proj_inv * vclosest); enter_volume = proj_inv * vclosest;
outvert.push_back(enter_volume);
++newcount; ++newcount;
} }
} }
@ -525,6 +571,8 @@ void ProcessPolygonalBoundedBooleanHalfSpaceDifference(const IfcPolygonalBounded
else if (is_outside_boundary) { else if (is_outside_boundary) {
outvert.push_back(e0); outvert.push_back(e0);
++newcount; ++newcount;
entered_volume_flag = false;
} }
} }

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

@ -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

@ -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

@ -409,11 +409,12 @@ public:
* instance. Use GetOrphanedScene() to take ownership of it. * instance. Use GetOrphanedScene() to take ownership of it.
* *
* @note This is a straightforward way to decode models from memory * @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 * data across multiple files or even directories. Examples include
* OBJ or MD3, which outsource parts of their material stuff into * OBJ or MD3, which outsource parts of their material info into
* external scripts. If you need the full functionality, provide * external scripts. If you need full functionality, provide
* a custom IOSystem to make Assimp find these files. * a custom IOSystem to make Assimp find these files and use
* the regular ReadFile() API.
*/ */
const aiScene* ReadFileFromMemory( const aiScene* ReadFileFromMemory(
const void* pBuffer, const void* pBuffer,

View File

@ -170,11 +170,13 @@ ASSIMP_API const C_STRUCT aiScene* aiImportFileExWithProperties(
* Check the return value, and you'll know ... * Check the return value, and you'll know ...
* @return A pointer to the imported data, NULL if the import failed. * @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 * @note This is a straightforward way to decode models from memory
* doesn't handle model formats spreading their data across multiple files or even * buffers, but it doesn't handle model formats that spread their
* directories. Examples include OBJ or MD3, which outsource parts of their material * data across multiple files or even directories. Examples include
* stuff into external scripts. If you need the full functionality, provide a custom * OBJ or MD3, which outsource parts of their material info into
* IOSystem to make Assimp find these files. * 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( ASSIMP_API const C_STRUCT aiScene* aiImportFileFromMemory(
const char* pBuffer, const char* pBuffer,

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

@ -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);