Skip to content

Commit 49080c0

Browse files
committed
Change Placemark default depth offset from -0.1 to -0.015 to prevent texture from protruding through the terrain.
Fix placemarks altitude mode in PlacemarksMilStd2525Activity to be correctly rendered on the top of the surface. Use billboarding approach of placemarks rendering to prevent clipping by terrain as described in MIL-STD-2525C APPENDIX F.5.1.1.2.
1 parent 6c4342c commit 49080c0

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

worldwind-examples/src/main/java/gov/nasa/worldwindx/PlacemarksMilStd2525Activity.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ protected void onPostExecute(Void notUsed) {
8686
Placemark drone = new Placemark(
8787
Position.fromDegrees(32.4520, 63.44553, 3000),
8888
MilStd2525.getPlacemarkAttributes("SFAPMFQM--GIUSA", modifiers, null));
89+
drone.getAttributes().setDrawLeader(true);
8990

9091
symbolLayer.addRenderable(drone);
9192

@@ -96,6 +97,7 @@ protected void onPostExecute(Void notUsed) {
9697
Placemark launcher = new Placemark(
9798
Position.fromDegrees(32.4014, 63.3894, 0),
9899
MilStd2525.getPlacemarkAttributes("SHGXUCFRMS----G", modifiers, null));
100+
launcher.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
99101

100102
symbolLayer.addRenderable(launcher);
101103

@@ -109,6 +111,7 @@ protected void onPostExecute(Void notUsed) {
109111
Placemark machineGun = new Placemark(
110112
Position.fromDegrees(32.3902, 63.4161, 0),
111113
MilStd2525.getPlacemarkAttributes("SFGPEWRH--MTUSG", modifiers, null));
114+
machineGun.setAltitudeMode(WorldWind.CLAMP_TO_GROUND);
112115

113116
symbolLayer.addRenderable(machineGun);
114117

worldwind-examples/src/main/java/gov/nasa/worldwindx/milstd2525/MilStd2525.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,8 @@ public Bitmap createBitmap() {
269269
Rect bounds = imageInfo.getImageBounds(); // The extents of the image, including text modifiers
270270
this.placemarkOffset = new Offset(
271271
WorldWind.OFFSET_PIXELS, centerPoint.x, // x offset
272-
WorldWind.OFFSET_PIXELS, bounds.height() - centerPoint.y); // y offset converted to lower-left origin
272+
// Use billboarding or lollipopping to prevent icon clipping by terrain as described in MIL-STD-2525C APPENDIX F.5.1.1.2
273+
WorldWind.OFFSET_PIXELS, 0/*bounds.height() - centerPoint.y*/); // y offset converted to lower-left origin
273274

274275
// Apply the placemark offset to the attributes on the main thread. This is necessary to synchronize write
275276
// access to placemarkAttributes from the thread that invokes this BitmapFactory and read access from the

worldwind/src/main/java/gov/nasa/worldwind/shape/Placemark.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public interface LevelOfDetailSelector {
6060
*/
6161
protected static final double DEFAULT_EYE_DISTANCE_SCALING_THRESHOLD = 1e6;
6262

63-
protected static final double DEFAULT_DEPTH_OFFSET = -0.1;
63+
protected static final double DEFAULT_DEPTH_OFFSET = -0.03;
6464

6565
private static Vec3 placePoint = new Vec3();
6666

@@ -684,8 +684,9 @@ protected void doRender(RenderContext rc) {
684684

685685
// Compute a screen depth offset appropriate for the current viewing parameters.
686686
double depthOffset = 0;
687-
if (this.cameraDistance < rc.horizonDistance) {
688-
depthOffset = DEFAULT_DEPTH_OFFSET;
687+
double absTilt = Math.abs( rc.camera.tilt );
688+
if (this.cameraDistance < rc.horizonDistance && absTilt <= 90) {
689+
depthOffset = ( 1 - absTilt / 90 ) * DEFAULT_DEPTH_OFFSET;
689690
}
690691

691692
// Project the placemark's model point to screen coordinates, using the screen depth offset to push the screen

0 commit comments

Comments
 (0)