Skip to content

Commit dfe2843

Browse files
committed
Fix PointPlacemark pitch issue which cause texture looks like single line (#151)
1 parent b183002 commit dfe2843

File tree

1 file changed

+17
-15
lines changed

1 file changed

+17
-15
lines changed

src/gov/nasa/worldwind/render/PointPlacemark.java

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -999,9 +999,25 @@ protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidate
999999
(byte) color.getAlpha());
10001000
}
10011001

1002+
// Compute the scale
1003+
double xscale;
1004+
Double scale = this.getActiveAttributes().getScale();
1005+
if (scale != null)
1006+
xscale = scale * this.activeTexture.getWidth(dc);
1007+
else
1008+
xscale = this.activeTexture.getWidth(dc);
1009+
1010+
double yscale;
1011+
if (scale != null)
1012+
yscale = scale * this.activeTexture.getHeight(dc);
1013+
else
1014+
yscale = this.activeTexture.getHeight(dc);
1015+
1016+
double maxwh = Math.max(xscale, yscale);
1017+
10021018
// The image is drawn using a parallel projection.
10031019
osh.pushProjectionIdentity(gl);
1004-
gl.glOrtho(0d, dc.getView().getViewport().width, 0d, dc.getView().getViewport().height, -1d, 1d);
1020+
gl.glOrtho(0d, dc.getView().getViewport().width, 0d, dc.getView().getViewport().height, -0.6 * maxwh, 0.6 * maxwh);
10051021

10061022
// Apply the depth buffer but don't change it (for screen-space shapes).
10071023
if ((!dc.isDeepPickingEnabled()))
@@ -1023,20 +1039,6 @@ protected void doDrawOrderedRenderable(DrawContext dc, PickSupport pickCandidate
10231039
osh.pushModelviewIdentity(gl);
10241040
gl.glTranslated(opm.screenPoint.x + this.dx, opm.screenPoint.y + this.dy, 0);
10251041

1026-
// Compute the scale
1027-
double xscale;
1028-
Double scale = this.getActiveAttributes().getScale();
1029-
if (scale != null)
1030-
xscale = scale * this.activeTexture.getWidth(dc);
1031-
else
1032-
xscale = this.activeTexture.getWidth(dc);
1033-
1034-
double yscale;
1035-
if (scale != null)
1036-
yscale = scale * this.activeTexture.getHeight(dc);
1037-
else
1038-
yscale = this.activeTexture.getHeight(dc);
1039-
10401042
Double heading = getActiveAttributes().getHeading();
10411043
Double pitch = getActiveAttributes().getPitch();
10421044

0 commit comments

Comments
 (0)