From 4cbb35ab5cae662381c02daaf73485f007738b84 Mon Sep 17 00:00:00 2001 From: Tobias Knerr Date: Wed, 13 Nov 2024 13:36:22 +0100 Subject: [PATCH] Assign LOD to golf features --- .../osm2world/core/world/modules/GolfModule.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/org/osm2world/core/world/modules/GolfModule.java b/src/main/java/org/osm2world/core/world/modules/GolfModule.java index af2373bb..3160ec46 100644 --- a/src/main/java/org/osm2world/core/world/modules/GolfModule.java +++ b/src/main/java/org/osm2world/core/world/modules/GolfModule.java @@ -10,6 +10,7 @@ import static org.osm2world.core.math.algorithms.TriangulationUtil.triangulationXZtoXYZ; import static org.osm2world.core.target.common.material.Materials.PLASTIC; import static org.osm2world.core.target.common.material.Materials.SAND; +import static org.osm2world.core.target.common.mesh.LevelOfDetail.*; import static org.osm2world.core.target.common.texcoord.NamedTexCoordFunction.GLOBAL_X_Z; import static org.osm2world.core.target.common.texcoord.NamedTexCoordFunction.STRIP_WALL; import static org.osm2world.core.target.common.texcoord.TexCoordUtil.texCoordLists; @@ -113,12 +114,22 @@ public Collection getRawGroundFootprint() { @Override public void buildMeshesAndModels(Target target) { + /* triangulate the bunker's area normally at low LOD */ + + target.setCurrentLodRange(LOD0, LOD1); + + List basicTriangulation = getTriangulation(); + target.drawTriangles(SAND, basicTriangulation, + triangleTexCoordLists(basicTriangulation, SAND, GLOBAL_X_Z)); + /* draw the bunker as a depression by shrinking the outline polygon and lowering it at each step. * * The first step gets special handling and is primarily intended for bunkers in uneven terrain. * It involves an almost vertical drop towards the lowest point of the bunker outline * that is textured with ground, not sand. */ + target.setCurrentLodRange(LOD2, LOD4); + List resultingTriangulation = new ArrayList<>(); double[] dropSteps = {-0.03, -0.07, -0.05, -0.02}; @@ -279,6 +290,8 @@ public void buildMeshesAndModels(Target target) { /* render pin */ + target.setCurrentLodRange(LOD3, LOD4); + PolygonXYZ upperHoleRing = pinConnectors.getPosXYZ(pinHoleLoop); drawPin(target, pinPosition, upperHoleRing.vertices());