From d38b6eb9ef0b88d86f9f5ae077143faef3fe0313 Mon Sep 17 00:00:00 2001 From: AlexisDrogoul Date: Sun, 27 Mar 2022 10:04:39 +0700 Subject: [PATCH] See #2761. Prevents overlays to rotate when the display rotates --- .../src/msi/gama/outputs/LayeredDisplayOutput.java | 2 +- .../msi/gama/outputs/layers/AgentLayerStatement.java | 10 +++++----- .../src/ummisco/gama/opengl/scene/ModelScene.java | 4 ++++ 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/msi.gama.core/src/msi/gama/outputs/LayeredDisplayOutput.java b/msi.gama.core/src/msi/gama/outputs/LayeredDisplayOutput.java index e83082ca63..dac04d757a 100644 --- a/msi.gama.core/src/msi/gama/outputs/LayeredDisplayOutput.java +++ b/msi.gama.core/src/msi/gama/outputs/LayeredDisplayOutput.java @@ -97,7 +97,7 @@ type = IType.GEOMETRY, optional = true, doc = @doc ( - deprecated = "Use 'camera default target: the_agent' to achieve the same effect", + deprecated = "Use 'camera default target: the_agent' to achieve the same effect. And please note that this possibility does not exist on Java2D anymore", value = "the geometry (or agent) on which the display will (dynamically) focus")), // WARNING VALIDER EN VERIFIANT LE TYPE DU DISPLAY @facet ( diff --git a/msi.gama.core/src/msi/gama/outputs/layers/AgentLayerStatement.java b/msi.gama.core/src/msi/gama/outputs/layers/AgentLayerStatement.java index 8c3cdcd8ba..b9278c7731 100644 --- a/msi.gama.core/src/msi/gama/outputs/layers/AgentLayerStatement.java +++ b/msi.gama.core/src/msi/gama/outputs/layers/AgentLayerStatement.java @@ -109,11 +109,11 @@ type = IType.LABEL, optional = true, doc = @doc ("Human readable title of the layer")), - @facet ( - name = IKeyword.FOCUS, - type = IType.AGENT, - optional = true, - doc = @doc ("the agent on which the camera will be focused (it is dynamically computed)")), + // @facet ( + // name = IKeyword.FOCUS, + // type = IType.AGENT, + // optional = true, + // doc = @doc ("the agent on which the camera will be focused (it is dynamically computed)")), @facet ( name = IKeyword.ASPECT, type = IType.ID, diff --git a/ummisco.gama.opengl/src/ummisco/gama/opengl/scene/ModelScene.java b/ummisco.gama.opengl/src/ummisco/gama/opengl/scene/ModelScene.java index f9b5cea859..9f61cc211e 100644 --- a/ummisco.gama.opengl/src/ummisco/gama/opengl/scene/ModelScene.java +++ b/ummisco.gama.opengl/src/ummisco/gama/opengl/scene/ModelScene.java @@ -121,12 +121,16 @@ public void draw(final OpenGL gl) { gl.rotateModel(); for (LayerObject layer : layers.values()) { if (layer != null && !layer.isInvalid()) { + // AD added to prevent overlays to rotate + if (layer.isOverlay()) { gl.pushIdentity(GLMatrixFunc.GL_MODELVIEW); } try { layer.lock(); layer.draw(gl); } catch (final RuntimeException r) { DEBUG.ERR("Runtime error " + r.getMessage() + " in OpenGL loop"); r.printStackTrace(); + } finally { + if (layer.isOverlay()) { gl.pop(GLMatrixFunc.GL_MODELVIEW); } } } }