-Ability to and unwrap lightmap coordinates on import
-Added unwrap functionality to Mesh -Ability to display and debug mesh UVs -Added multiline draw, so it's easier and faster to draw UVs -Many fixes to SurfaceTool -Fixes to Thekla Unwrap, but it's a piece of ass and it keeps crashing. Will have to go away
This commit is contained in:
@ -38,6 +38,7 @@ using namespace nv;
|
||||
/// Ctor.
|
||||
Atlas::Atlas()
|
||||
{
|
||||
failed=false;
|
||||
}
|
||||
|
||||
// Dtor.
|
||||
@ -100,6 +101,7 @@ void Atlas::extractCharts(const HalfEdge::Mesh * mesh)
|
||||
|
||||
void Atlas::computeCharts(const HalfEdge::Mesh * mesh, const SegmentationSettings & settings, const Array<uint> & unchartedMaterialArray)
|
||||
{
|
||||
failed=false;
|
||||
MeshCharts * meshCharts = new MeshCharts(mesh);
|
||||
meshCharts->computeCharts(settings, unchartedMaterialArray);
|
||||
addMeshCharts(meshCharts);
|
||||
@ -235,6 +237,8 @@ float Atlas::packCharts(int quality, float texelsPerUnit, bool blockAlign, bool
|
||||
{
|
||||
AtlasPacker packer(this);
|
||||
packer.packCharts(quality, texelsPerUnit, blockAlign, conservative);
|
||||
if (hasFailed())
|
||||
return 0;
|
||||
return packer.computeAtlasUtilization();
|
||||
}
|
||||
|
||||
|
||||
3
thirdparty/thekla_atlas/nvmesh/param/Atlas.h
vendored
3
thirdparty/thekla_atlas/nvmesh/param/Atlas.h
vendored
@ -64,9 +64,12 @@ namespace nv
|
||||
|
||||
// Pack charts in the smallest possible rectangle.
|
||||
float packCharts(int quality, float texelArea, bool blockAlign, bool conservative);
|
||||
bool setFailed() { failed = true; }
|
||||
bool hasFailed() const { return failed; }
|
||||
|
||||
private:
|
||||
|
||||
bool failed;
|
||||
Array<MeshCharts *> m_meshChartsArray;
|
||||
|
||||
};
|
||||
|
||||
@ -152,7 +152,7 @@ AtlasPacker::~AtlasPacker()
|
||||
}
|
||||
|
||||
// This should compute convex hull and use rotating calipers to find the best box. Currently it uses a brute force method.
|
||||
static void computeBoundingBox(Chart * chart, Vector2 * majorAxis, Vector2 * minorAxis, Vector2 * minCorner, Vector2 * maxCorner)
|
||||
static bool computeBoundingBox(Chart * chart, Vector2 * majorAxis, Vector2 * minorAxis, Vector2 * minCorner, Vector2 * maxCorner)
|
||||
{
|
||||
// Compute list of boundary points.
|
||||
Array<Vector2> points(16);
|
||||
@ -184,6 +184,9 @@ static void computeBoundingBox(Chart * chart, Vector2 * majorAxis, Vector2 * min
|
||||
|
||||
#if 1
|
||||
Array<Vector2> hull;
|
||||
if (points.size()==0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
convexHull(points, hull, 0.00001f);
|
||||
|
||||
@ -373,6 +376,8 @@ static void computeBoundingBox(Chart * chart, Vector2 * majorAxis, Vector2 * min
|
||||
}
|
||||
}*/
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -431,7 +436,10 @@ void AtlasPacker::packCharts(int quality, float texelsPerUnit, bool blockAligned
|
||||
|
||||
// Compute bounding box of chart.
|
||||
Vector2 majorAxis, minorAxis, origin, end;
|
||||
computeBoundingBox(chart, &majorAxis, &minorAxis, &origin, &end);
|
||||
if (!computeBoundingBox(chart, &majorAxis, &minorAxis, &origin, &end)) {
|
||||
m_atlas->setFailed();
|
||||
return;
|
||||
}
|
||||
|
||||
nvCheck(isFinite(majorAxis) && isFinite(minorAxis) && isFinite(origin));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user