Merge branch 'master' of https://github.com/assimp/assimp
commit
6e5ca257de
|
@ -35,6 +35,14 @@ install:
|
|||
script:
|
||||
- if [ $ANDROID ]; then
|
||||
ant -v -Dmy.dir=${TRAVIS_BUILD_DIR} -f ${TRAVIS_BUILD_DIR}/port/jassimp/build.xml ndk-jni ;
|
||||
elif [ $WINDOWS -a $CC = "gcc" ]; then
|
||||
sudo sh -c "wget http://source.winehq.org/git/wine.git/commitdiff_plain/86781a6a524fa336f893ffd0a87373ffd306913c?hp=076edfe9d4b6cd39b6cf41b9f1d3e18688cc8673 -O - | patch -p 1 -d /usr/x86_64-w64-mingw32" ;
|
||||
sudo sh -c "wget https://www.winehq.org/pipermail/wine-patches/2012-February/111438.html -O - | patch -p 1 -d /usr/x86_64-w64-mingw32" ;
|
||||
cmake -G "Unix Makefiles" -DASSIMP_NO_EXPORT=$TRAVIS_NO_EXPORT -DBUILD_SHARED_LIBS=$SHARED_BUILD -DCMAKE_TOOLCHAIN_FILE=cmake-modules/MinGW_x86_64.cmake ;
|
||||
cmake --build . ;
|
||||
make install ;
|
||||
elif [ $WINDOWS ]; then
|
||||
echo "Skip compile with non-gcc setting." ;
|
||||
elif [ $RESERVED ]; then
|
||||
echo "Reserved condition" ;
|
||||
else
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
# this one sets internal to crosscompile (in theory)
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
|
||||
# the minimalistic settings
|
||||
SET(CMAKE_C_COMPILER "/usr/bin/x86_64-w64-mingw32-gcc")
|
||||
SET(CMAKE_CXX_COMPILER "/usr/bin/x86_64-w64-mingw32-g++")
|
||||
SET(CMAKE_RC_COMPILER "/usr/bin/x86_64-w64-mingw32-windres")
|
||||
|
||||
# where is the target (so called staging) environment
|
||||
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
|
||||
|
||||
# search for programs in the build host directories (default BOTH)
|
||||
#SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
# for libraries and headers in the target directories
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
|
@ -522,43 +522,23 @@ IfcMatrix3 DerivePlaneCoordinateSpace(const TempMesh& curmesh, bool& ok, IfcVect
|
|||
return m;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& result,
|
||||
ConversionData& conv, bool collect_openings)
|
||||
// Extrudes the given polygon along the direction, converts it into an opening or applies all openings as necessary.
|
||||
void ProcessExtrudedArea(const IfcExtrudedAreaSolid& solid, const TempMesh& curve,
|
||||
const IfcVector3& extrusionDir, TempMesh& result, ConversionData &conv, bool collect_openings)
|
||||
{
|
||||
TempMesh meshout;
|
||||
|
||||
// First read the profile description
|
||||
if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.verts.size()<=1) {
|
||||
return;
|
||||
}
|
||||
|
||||
IfcVector3 dir;
|
||||
ConvertDirection(dir,solid.ExtrudedDirection);
|
||||
|
||||
dir *= solid.Depth; /*
|
||||
if(conv.collect_openings && !conv.apply_openings) {
|
||||
dir *= 1000.0;
|
||||
} */
|
||||
|
||||
// Outline: assuming that `meshout.verts` is now a list of vertex points forming
|
||||
// the underlying profile, extrude along the given axis, forming new
|
||||
// triangles.
|
||||
|
||||
std::vector<IfcVector3>& in = meshout.verts;
|
||||
const size_t size=in.size();
|
||||
|
||||
const bool has_area = solid.SweptArea->ProfileType == "AREA" && size>2;
|
||||
if(solid.Depth < 1e-6) {
|
||||
if(has_area) {
|
||||
result = meshout;
|
||||
// Outline: 'curve' is now a list of vertex points forming the underlying profile, extrude along the given axis,
|
||||
// forming new triangles.
|
||||
const bool has_area = solid.SweptArea->ProfileType == "AREA" && curve.verts.size() > 2;
|
||||
if( solid.Depth < 1e-6 ) {
|
||||
if( has_area ) {
|
||||
result.Append(curve);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
result.verts.reserve(size*(has_area?4:2));
|
||||
result.vertcnt.reserve(meshout.vertcnt.size()+2);
|
||||
result.verts.reserve(curve.verts.size()*(has_area ? 4 : 2));
|
||||
result.vertcnt.reserve(curve.verts.size() + 2);
|
||||
std::vector<IfcVector3> in = curve.verts;
|
||||
|
||||
// First step: transform all vertices into the target coordinate space
|
||||
IfcMatrix4 trafo;
|
||||
|
@ -566,7 +546,7 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
|
|||
|
||||
IfcVector3 vmin, vmax;
|
||||
MinMaxChooser<IfcVector3>()(vmin, vmax);
|
||||
BOOST_FOREACH(IfcVector3& v,in) {
|
||||
BOOST_FOREACH(IfcVector3& v, in) {
|
||||
v *= trafo;
|
||||
|
||||
vmin = std::min(vmin, v);
|
||||
|
@ -575,93 +555,91 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
|
|||
|
||||
vmax -= vmin;
|
||||
const IfcFloat diag = vmax.Length();
|
||||
|
||||
IfcVector3 min = in[0];
|
||||
dir *= IfcMatrix3(trafo);
|
||||
IfcVector3 dir = IfcMatrix3(trafo) * extrusionDir;
|
||||
|
||||
// reverse profile polygon if it's winded in the wrong direction in relation to the extrusion direction
|
||||
IfcVector3 profileNormal = TempMesh::ComputePolygonNormal( in.data(), in.size());
|
||||
IfcVector3 profileNormal = TempMesh::ComputePolygonNormal(in.data(), in.size());
|
||||
if( profileNormal * dir < 0.0 )
|
||||
std::reverse( in.begin(), in.end());
|
||||
std::reverse(in.begin(), in.end());
|
||||
|
||||
std::vector<IfcVector3> nors;
|
||||
const bool openings = !!conv.apply_openings && conv.apply_openings->size();
|
||||
|
||||
|
||||
// Compute the normal vectors for all opening polygons as a prerequisite
|
||||
// to TryAddOpenings_Poly2Tri()
|
||||
// XXX this belongs into the aforementioned function
|
||||
if (openings) {
|
||||
if( openings ) {
|
||||
|
||||
if (!conv.settings.useCustomTriangulation) {
|
||||
if( !conv.settings.useCustomTriangulation ) {
|
||||
// it is essential to apply the openings in the correct spatial order. The direction
|
||||
// doesn't matter, but we would screw up if we started with e.g. a door in between
|
||||
// two windows.
|
||||
std::sort(conv.apply_openings->begin(),conv.apply_openings->end(),
|
||||
TempOpening::DistanceSorter(min));
|
||||
std::sort(conv.apply_openings->begin(), conv.apply_openings->end(), TempOpening::DistanceSorter(in[0]));
|
||||
}
|
||||
|
||||
|
||||
nors.reserve(conv.apply_openings->size());
|
||||
BOOST_FOREACH(TempOpening& t,*conv.apply_openings) {
|
||||
BOOST_FOREACH(TempOpening& t, *conv.apply_openings) {
|
||||
TempMesh& bounds = *t.profileMesh.get();
|
||||
|
||||
if (bounds.verts.size() <= 2) {
|
||||
|
||||
if( bounds.verts.size() <= 2 ) {
|
||||
nors.push_back(IfcVector3());
|
||||
continue;
|
||||
}
|
||||
nors.push_back(((bounds.verts[2]-bounds.verts[0])^(bounds.verts[1]-bounds.verts[0]) ).Normalize());
|
||||
nors.push_back(((bounds.verts[2] - bounds.verts[0]) ^ (bounds.verts[1] - bounds.verts[0])).Normalize());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
TempMesh temp;
|
||||
TempMesh& curmesh = openings ? temp : result;
|
||||
std::vector<IfcVector3>& out = curmesh.verts;
|
||||
|
||||
|
||||
size_t sides_with_openings = 0;
|
||||
for(size_t i = 0; i < size; ++i) {
|
||||
const size_t next = (i+1)%size;
|
||||
for( size_t i = 0; i < in.size(); ++i ) {
|
||||
const size_t next = (i + 1) % in.size();
|
||||
|
||||
curmesh.vertcnt.push_back(4);
|
||||
|
||||
|
||||
out.push_back(in[i]);
|
||||
out.push_back(in[next]);
|
||||
out.push_back(in[next]+dir);
|
||||
out.push_back(in[i]+dir);
|
||||
out.push_back(in[next] + dir);
|
||||
out.push_back(in[i] + dir);
|
||||
|
||||
if(openings) {
|
||||
if((in[i]-in[next]).Length() > diag * 0.1 && GenerateOpenings(*conv.apply_openings,nors,temp,true, true, dir)) {
|
||||
if( openings ) {
|
||||
if( (in[i] - in[next]).Length() > diag * 0.1 && GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) {
|
||||
++sides_with_openings;
|
||||
}
|
||||
|
||||
|
||||
result.Append(temp);
|
||||
temp.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
if(openings) {
|
||||
if( openings ) {
|
||||
BOOST_FOREACH(TempOpening& opening, *conv.apply_openings) {
|
||||
if (!opening.wallPoints.empty()) {
|
||||
if( !opening.wallPoints.empty() ) {
|
||||
IFCImporter::LogError("failed to generate all window caps");
|
||||
}
|
||||
opening.wallPoints.clear();
|
||||
}
|
||||
}
|
||||
|
||||
size_t sides_with_v_openings = 0;
|
||||
if(has_area) {
|
||||
|
||||
for(size_t n = 0; n < 2; ++n) {
|
||||
size_t sides_with_v_openings = 0;
|
||||
if( has_area ) {
|
||||
|
||||
for( size_t n = 0; n < 2; ++n ) {
|
||||
if( n > 0 ) {
|
||||
for(size_t i = 0; i < size; ++i )
|
||||
out.push_back(in[i]+dir);
|
||||
} else {
|
||||
for(size_t i = size; i--; )
|
||||
for( size_t i = 0; i < in.size(); ++i )
|
||||
out.push_back(in[i] + dir);
|
||||
}
|
||||
else {
|
||||
for( size_t i = in.size(); i--; )
|
||||
out.push_back(in[i]);
|
||||
}
|
||||
|
||||
curmesh.vertcnt.push_back(size);
|
||||
if(openings && size > 2) {
|
||||
if(GenerateOpenings(*conv.apply_openings,nors,temp,true, true, dir)) {
|
||||
curmesh.vertcnt.push_back(in.size());
|
||||
if( openings && in.size() > 2 ) {
|
||||
if( GenerateOpenings(*conv.apply_openings, nors, temp, true, true, dir) ) {
|
||||
++sides_with_v_openings;
|
||||
}
|
||||
|
||||
|
@ -671,7 +649,7 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
|
|||
}
|
||||
}
|
||||
|
||||
if(openings && ((sides_with_openings == 1 && sides_with_openings) || (sides_with_v_openings == 2 && sides_with_v_openings))) {
|
||||
if( openings && ((sides_with_openings == 1 && sides_with_openings) || (sides_with_v_openings == 2 && sides_with_v_openings)) ) {
|
||||
IFCImporter::LogWarn("failed to resolve all openings, presumably their topology is not supported by Assimp");
|
||||
}
|
||||
|
||||
|
@ -679,17 +657,58 @@ void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& resul
|
|||
|
||||
// If this is an opening element, store both the extruded mesh and the 2D profile mesh
|
||||
// it was created from. Return an empty mesh to the caller.
|
||||
if(collect_openings && !result.IsEmpty()) {
|
||||
if( collect_openings && !result.IsEmpty() ) {
|
||||
ai_assert(conv.collect_openings);
|
||||
boost::shared_ptr<TempMesh> profile = boost::shared_ptr<TempMesh>(new TempMesh());
|
||||
profile->Swap(result);
|
||||
|
||||
boost::shared_ptr<TempMesh> profile2D = boost::shared_ptr<TempMesh>(new TempMesh());
|
||||
profile2D->Swap(meshout);
|
||||
conv.collect_openings->push_back(TempOpening(&solid,dir,profile, profile2D));
|
||||
profile2D->verts.insert(profile2D->verts.end(), in.begin(), in.end());
|
||||
profile2D->vertcnt.push_back(in.size());
|
||||
conv.collect_openings->push_back(TempOpening(&solid, dir, profile, profile2D));
|
||||
|
||||
ai_assert(result.IsEmpty());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
void ProcessExtrudedAreaSolid(const IfcExtrudedAreaSolid& solid, TempMesh& result,
|
||||
ConversionData& conv, bool collect_openings)
|
||||
{
|
||||
TempMesh meshout;
|
||||
|
||||
// First read the profile description.
|
||||
if(!ProcessProfile(*solid.SweptArea,meshout,conv) || meshout.verts.size()<=1) {
|
||||
return;
|
||||
}
|
||||
|
||||
IfcVector3 dir;
|
||||
ConvertDirection(dir,solid.ExtrudedDirection);
|
||||
dir *= solid.Depth;
|
||||
|
||||
// Some profiles bring their own holes, for which we need to provide a container. This all is somewhat backwards,
|
||||
// and there's still so many corner cases uncovered - we really need a generic solution to all of this hole carving.
|
||||
std::vector<TempOpening> fisherPriceMyFirstOpenings;
|
||||
std::vector<TempOpening>* oldApplyOpenings = conv.apply_openings;
|
||||
if( const IfcArbitraryProfileDefWithVoids* const cprofile = solid.SweptArea->ToPtr<IfcArbitraryProfileDefWithVoids>() ) {
|
||||
if( !cprofile->InnerCurves.empty() ) {
|
||||
// read all inner curves and extrude them to form proper openings.
|
||||
std::vector<TempOpening>* oldCollectOpenings = conv.collect_openings;
|
||||
conv.collect_openings = &fisherPriceMyFirstOpenings;
|
||||
|
||||
BOOST_FOREACH(const IfcCurve* curve, cprofile->InnerCurves) {
|
||||
TempMesh curveMesh, tempMesh;
|
||||
ProcessCurve(*curve, curveMesh, conv);
|
||||
ProcessExtrudedArea(solid, curveMesh, dir, tempMesh, conv, true);
|
||||
}
|
||||
// and then apply those to the geometry we're about to generate
|
||||
conv.apply_openings = conv.collect_openings;
|
||||
conv.collect_openings = oldCollectOpenings;
|
||||
}
|
||||
}
|
||||
|
||||
ProcessExtrudedArea(solid, meshout, dir, result, conv, collect_openings);
|
||||
conv.apply_openings = oldApplyOpenings;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------------------------
|
||||
|
@ -784,7 +803,7 @@ bool ProcessGeometricItem(const IfcRepresentationItem& geo, unsigned int matid,
|
|||
meshtmp->RemoveDegenerates();
|
||||
|
||||
if(fix_orientation) {
|
||||
meshtmp->FixupFaceOrientation();
|
||||
// meshtmp->FixupFaceOrientation();
|
||||
}
|
||||
|
||||
aiMesh* const mesh = meshtmp->ToMesh();
|
||||
|
|
File diff suppressed because it is too large
Load Diff
7292
code/IFCReaderGen.h
7292
code/IFCReaderGen.h
File diff suppressed because it is too large
Load Diff
|
@ -271,6 +271,7 @@ IfcFloat ConvertSIPrefix(const std::string& prefix);
|
|||
|
||||
// IFCProfile.cpp
|
||||
bool ProcessProfile(const IfcProfileDef& prof, TempMesh& meshout, ConversionData& conv);
|
||||
bool ProcessCurve(const IfcCurve& curve, TempMesh& meshout, ConversionData& conv);
|
||||
|
||||
// IFCMaterial.cpp
|
||||
unsigned int ProcessMaterials(uint64_t id, unsigned int prevMatId, ConversionData& conv, bool forceDefaultMat);
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
# ==============================================================================
|
||||
# ==============================================================================
|
||||
# List of IFC structures needed by Assimp
|
||||
# ==============================================================================
|
||||
# ==============================================================================
|
||||
# use genentitylist.sh to update this list
|
||||
|
||||
# This machine-generated list is not complete, it lacks many intermediate
|
||||
# This machine-generated list is not complete, it lacks many intermediate
|
||||
# classes in the inheritance hierarchy. Those are magically augmented by the
|
||||
# code generator. Also, the names of all used entities need to be present
|
||||
# code generator. Also, the names of all used entities need to be present
|
||||
# in the source code for this to work.
|
||||
|
||||
IfcAnnotation
|
||||
IfcArbitraryClosedProfileDef
|
||||
IfcArbitraryOpenProfileDef
|
||||
IfcArbitraryProfileDefWithVoids
|
||||
IfcAxis1Placement
|
||||
IfcAxis2Placement
|
||||
IfcAxis2Placement2D
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue