From b2e086bbee52535b0f1278f9c18d5b9e6c892bdc Mon Sep 17 00:00:00 2001 From: "Sha..rd" Date: Sat, 25 Feb 2012 22:48:59 +0000 Subject: [PATCH] * Added ResolutionInverse (thanks kwando) git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9210 75d07b2b-3a1a-0410-a2c5-0572b91ccdca --- engine/src/core/com/jme3/renderer/RenderManager.java | 4 ++++ engine/src/core/com/jme3/shader/UniformBinding.java | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/engine/src/core/com/jme3/renderer/RenderManager.java b/engine/src/core/com/jme3/renderer/RenderManager.java index cccd7b905..86305c5ca 100644 --- a/engine/src/core/com/jme3/renderer/RenderManager.java +++ b/engine/src/core/com/jme3/renderer/RenderManager.java @@ -429,6 +429,10 @@ public class RenderManager { tempVec2.set(viewWidth, viewHeight); u.setValue(VarType.Vector2, tempVec2); break; + case ResolutionInverse: + tempVec2.set(1f / viewWidth, 1f / viewHeight); + u.setValue(VarType.Vector2, tempVec2); + break; case Aspect: float aspect = ((float) viewWidth) / viewHeight; u.setValue(VarType.Float, aspect); diff --git a/engine/src/core/com/jme3/shader/UniformBinding.java b/engine/src/core/com/jme3/shader/UniformBinding.java index e1ee454fe..a30f58d81 100644 --- a/engine/src/core/com/jme3/shader/UniformBinding.java +++ b/engine/src/core/com/jme3/shader/UniformBinding.java @@ -119,6 +119,12 @@ public enum UniformBinding { * Type: vec2 */ Resolution, + + /** + * The inverse of the resolution, 1/width and 1/height. + * Type: vec2 + */ + ResolutionInverse, /** * Aspect ratio of the resolution currently set. Width/Height.