summaryrefslogtreecommitdiff
path: root/game/geoData.h
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 14:20:28 +0000
committerDan Goodliffe <dan@randomdan.homeip.net>2023-11-26 14:20:28 +0000
commit3abe940a22d99939b666bd806214c8b986cb3ed9 (patch)
treebba599f39e8b328c3d4911a940a4263781e74a77 /game/geoData.h
parentMerge branch 'ints' into terrain (diff)
downloadilt-3abe940a22d99939b666bd806214c8b986cb3ed9.tar.bz2
ilt-3abe940a22d99939b666bd806214c8b986cb3ed9.tar.xz
ilt-3abe940a22d99939b666bd806214c8b986cb3ed9.zip
Calculate vertex normals only
Doesn't require half edge normals or face normals, which uses Newell's method, which results in integer overflow... Not to mention we don't need all the other normals.
Diffstat (limited to 'game/geoData.h')
-rw-r--r--game/geoData.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/game/geoData.h b/game/geoData.h
index 3141dbe..d4d0fb3 100644
--- a/game/geoData.h
+++ b/game/geoData.h
@@ -10,10 +10,10 @@
#include <thirdparty/openmesh/glmcompat.h>
struct GeoDataTraits : public OpenMesh::DefaultTraits {
- FaceAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status);
+ FaceAttributes(OpenMesh::Attributes::Status);
EdgeAttributes(OpenMesh::Attributes::Status);
VertexAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status);
- HalfedgeAttributes(OpenMesh::Attributes::Normal | OpenMesh::Attributes::Status);
+ HalfedgeAttributes(OpenMesh::Attributes::Status);
using Point = GlobalPosition3D;
using Normal = Normal3D;
};
@@ -105,6 +105,8 @@ protected:
[[nodiscard]] bool triangleContainsPoint(const GlobalPosition2D, FaceHandle) const;
[[nodiscard]] HalfedgeHandle findBoundaryStart() const;
+ void update_vertex_normals_only();
+
private:
GlobalPosition3D lowerExtent {}, upperExtent {};
};