mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-02-18 14:13:48 +00:00
Just the functional assimp lib rather than the entire assimp repository unnecessarily.
This commit is contained in:
parent
0f7641a282
commit
e9ea38eda3
1747 changed files with 9012 additions and 925008 deletions
|
|
@ -364,7 +364,7 @@ void InsertWindowContours(const ContourVector& contours,
|
|||
}
|
||||
|
||||
if (const size_t d = curmesh.verts.size()-old) {
|
||||
curmesh.vertcnt.push_back(d);
|
||||
curmesh.vertcnt.push_back(static_cast<unsigned int>(d));
|
||||
std::reverse(curmesh.verts.rbegin(),curmesh.verts.rbegin()+d);
|
||||
}
|
||||
if (n == very_first_hit) {
|
||||
|
|
@ -549,7 +549,7 @@ void CleanupOuterContour(const std::vector<IfcVector2>& contour_flat, TempMesh&
|
|||
clipper.Execute(ClipperLib::ctIntersection,clipped,ClipperLib::pftNonZero,ClipperLib::pftNonZero);
|
||||
|
||||
for(const ClipperLib::ExPolygon& ex : clipped) {
|
||||
iold.push_back(ex.outer.size());
|
||||
iold.push_back(static_cast<unsigned int>(ex.outer.size()));
|
||||
for(const ClipperLib::IntPoint& point : ex.outer) {
|
||||
vold.push_back(IfcVector3(
|
||||
from_int64(point.X),
|
||||
|
|
@ -715,14 +715,14 @@ void FindAdjacentContours(ContourVector::iterator current, const ContourVector&
|
|||
const Contour& mcontour = (*it).contour;
|
||||
|
||||
for (size_t n = 0; n < ncontour.size(); ++n) {
|
||||
const IfcVector2& n0 = ncontour[n];
|
||||
const IfcVector2& n1 = ncontour[(n+1) % ncontour.size()];
|
||||
const IfcVector2 n0 = ncontour[n];
|
||||
const IfcVector2 n1 = ncontour[(n+1) % ncontour.size()];
|
||||
|
||||
for (size_t m = 0, mend = (is_me ? n : mcontour.size()); m < mend; ++m) {
|
||||
ai_assert(&mcontour != &ncontour || m < n);
|
||||
|
||||
const IfcVector2& m0 = mcontour[m];
|
||||
const IfcVector2& m1 = mcontour[(m+1) % mcontour.size()];
|
||||
const IfcVector2 m0 = mcontour[m];
|
||||
const IfcVector2 m1 = mcontour[(m+1) % mcontour.size()];
|
||||
|
||||
IfcVector2 isect0, isect1;
|
||||
if (IntersectingLineSegments(n0,n1, m0, m1, isect0, isect1)) {
|
||||
|
|
@ -901,13 +901,21 @@ size_t CloseWindows(ContourVector& contours,
|
|||
curmesh.verts.reserve(curmesh.verts.size() + (*it).contour.size() * 4);
|
||||
curmesh.vertcnt.reserve(curmesh.vertcnt.size() + (*it).contour.size());
|
||||
|
||||
bool reverseCountourFaces = false;
|
||||
|
||||
// compare base poly normal and contour normal to detect if we need to reverse the face winding
|
||||
IfcVector3 basePolyNormal = TempMesh::ComputePolygonNormal( curmesh.verts.data(), curmesh.vertcnt.front());
|
||||
std::vector<IfcVector3> worldSpaceContourVtx( it->contour.size());
|
||||
for( size_t a = 0; a < it->contour.size(); ++a )
|
||||
worldSpaceContourVtx[a] = minv * IfcVector3( it->contour[a].x, it->contour[a].y, 0.0);
|
||||
IfcVector3 contourNormal = TempMesh::ComputePolygonNormal( worldSpaceContourVtx.data(), worldSpaceContourVtx.size());
|
||||
bool reverseCountourFaces = (contourNormal * basePolyNormal) > 0.0;
|
||||
if(curmesh.vertcnt.size() > 0) {
|
||||
IfcVector3 basePolyNormal = TempMesh::ComputePolygonNormal(curmesh.verts.data(), curmesh.vertcnt.front());
|
||||
|
||||
std::vector<IfcVector3> worldSpaceContourVtx(it->contour.size());
|
||||
|
||||
for(size_t a = 0; a < it->contour.size(); ++a)
|
||||
worldSpaceContourVtx[a] = minv * IfcVector3(it->contour[a].x, it->contour[a].y, 0.0);
|
||||
|
||||
IfcVector3 contourNormal = TempMesh::ComputePolygonNormal(worldSpaceContourVtx.data(), worldSpaceContourVtx.size());
|
||||
|
||||
reverseCountourFaces = (contourNormal * basePolyNormal) > 0.0;
|
||||
}
|
||||
|
||||
// XXX this algorithm is really a bit inefficient - both in terms
|
||||
// of constant factor and of asymptotic runtime.
|
||||
|
|
@ -1484,14 +1492,14 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
|||
vmax -= vmin;
|
||||
|
||||
// If this happens then the projection must have been wrong.
|
||||
assert(vmax.Length());
|
||||
ai_assert(vmax.Length());
|
||||
|
||||
ClipperLib::ExPolygons clipped;
|
||||
ClipperLib::Polygons holes_union;
|
||||
|
||||
|
||||
IfcVector3 wall_extrusion;
|
||||
bool do_connections = false, first = true;
|
||||
bool first = true;
|
||||
|
||||
try {
|
||||
|
||||
|
|
@ -1519,7 +1527,6 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
|||
if (first) {
|
||||
first = false;
|
||||
if (dot > 0.f) {
|
||||
do_connections = true;
|
||||
wall_extrusion = t.extrusionDir;
|
||||
if (is_extruded_side) {
|
||||
wall_extrusion = - wall_extrusion;
|
||||
|
|
@ -1599,44 +1606,6 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
|||
old_verts.swap(curmesh.verts);
|
||||
old_vertcnt.swap(curmesh.vertcnt);
|
||||
|
||||
|
||||
// add connection geometry to close the adjacent 'holes' for the openings
|
||||
// this should only be done from one side of the wall or the polygons
|
||||
// would be emitted twice.
|
||||
if (false && do_connections) {
|
||||
|
||||
std::vector<IfcVector3> tmpvec;
|
||||
for(ClipperLib::Polygon& opening : holes_union) {
|
||||
|
||||
assert(ClipperLib::Orientation(opening));
|
||||
|
||||
tmpvec.clear();
|
||||
|
||||
for(ClipperLib::IntPoint& point : opening) {
|
||||
|
||||
tmpvec.push_back( minv * IfcVector3(
|
||||
vmin.x + from_int64(point.X) * vmax.x,
|
||||
vmin.y + from_int64(point.Y) * vmax.y,
|
||||
coord));
|
||||
}
|
||||
|
||||
for(size_t i = 0, size = tmpvec.size(); i < size; ++i) {
|
||||
const size_t next = (i+1)%size;
|
||||
|
||||
curmesh.vertcnt.push_back(4);
|
||||
|
||||
const IfcVector3& in_world = tmpvec[i];
|
||||
const IfcVector3& next_world = tmpvec[next];
|
||||
|
||||
// Assumptions: no 'partial' openings, wall thickness roughly the same across the wall
|
||||
curmesh.verts.push_back(in_world);
|
||||
curmesh.verts.push_back(in_world+wall_extrusion);
|
||||
curmesh.verts.push_back(next_world+wall_extrusion);
|
||||
curmesh.verts.push_back(next_world);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector< std::vector<p2t::Point*> > contours;
|
||||
for(ClipperLib::ExPolygon& clip : clipped) {
|
||||
|
||||
|
|
@ -1697,7 +1666,7 @@ bool TryAddOpenings_Poly2Tri(const std::vector<TempOpening>& openings,const std:
|
|||
static_cast<IfcFloat>( tri->GetPoint(i)->y )
|
||||
);
|
||||
|
||||
assert(v.x <= 1.0 && v.x >= 0.0 && v.y <= 1.0 && v.y >= 0.0);
|
||||
ai_assert(v.x <= 1.0 && v.x >= 0.0 && v.y <= 1.0 && v.y >= 0.0);
|
||||
const IfcVector3 v3 = minv * IfcVector3(vmin.x + v.x * vmax.x, vmin.y + v.y * vmax.y,coord) ;
|
||||
|
||||
curmesh.verts.push_back(v3);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue