summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2024-03-23 18:46:18 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2024-03-23 18:46:18 +0000
commit7a8c0a1ac626a394a90a0a41b8a42a9c743aba8e (patch)
tree512f51d5311f399b9a98d41675473036a8c3891e
parentRemove boundary collection (diff)
downloadilt-7a8c0a1ac626a394a90a0a41b8a42a9c743aba8e.tar.bz2
ilt-7a8c0a1ac626a394a90a0a41b8a42a9c743aba8e.tar.xz
ilt-7a8c0a1ac626a394a90a0a41b8a42a9c743aba8e.zip
Create extents purely from corner arcs
-rw-r--r--game/geoData.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/game/geoData.cpp b/game/geoData.cpp
index c6f7902..80a4eba 100644
--- a/game/geoData.cpp
+++ b/game/geoData.cpp
@@ -412,9 +412,11 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
std::vector<Extrusion> extrusionExtents;
boundaryWalk(
[this, &extrusionExtents](const auto boundaryHeh) {
+ const auto prevBoundaryHeh = prev_halfedge_handle(boundaryHeh);
+ const auto prevBoundaryVertex = from_vertex_handle(prevBoundaryHeh);
const auto boundaryVertex = from_vertex_handle(boundaryHeh);
const auto nextBoundaryVertex = to_vertex_handle(boundaryHeh);
- const auto p0 = point(from_vertex_handle(prev_halfedge_handle(boundaryHeh)));
+ const auto p0 = point(prevBoundaryVertex);
const auto p1 = point(boundaryVertex);
const auto p2 = point(nextBoundaryVertex);
const auto e0 = glm::normalize(vector_normal(RelativePosition2D(p1 - p0)));
@@ -445,9 +447,9 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
};
// Previous half edge end to current half end start arc tangents
const Arc arc {e0, e1};
- const auto limit = std::floor((arc.second - arc.first) * 5.F / pi);
- const auto inc = (arc.second - arc.first) / limit;
- for (float step = 1; step < limit; step += 1.F) {
+ const auto limit = std::ceil(arc.length() * 5.F / pi);
+ const auto inc = arc.length() / limit;
+ for (float step = 0; step <= limit; step += 1.F) {
const auto direction = sincosf(arc.first + (step * inc));
VertexHandle extrusionVertex;
extrusionExtents.emplace_back(boundaryVertex, extrusionVertex,
@@ -455,14 +457,6 @@ GeoData::setHeights(const std::span<const GlobalPosition3D> triangleStrip)
doExtrusion(extrusionVertex, direction, p1, MAX_SLOPE));
assert(extrusionVertex.is_valid());
}
- // Half edge start/end tangents
- for (const auto p : {boundaryVertex, nextBoundaryVertex}) {
- VertexHandle extrusionVertex;
- extrusionExtents.emplace_back(p, extrusionVertex,
- doExtrusion(extrusionVertex, e1, point(p), -MAX_SLOPE),
- doExtrusion(extrusionVertex, e1, point(p), MAX_SLOPE));
- assert(extrusionVertex.is_valid());
- }
},
*voh_begin(newVerts.front()));