Browse Source

* Added ResolutionInverse (thanks kwando)

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9210 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
Sha..rd 13 years ago
parent
commit
b2e086bbee

+ 4 - 0
engine/src/core/com/jme3/renderer/RenderManager.java

@@ -429,6 +429,10 @@ public class RenderManager {
                     tempVec2.set(viewWidth, viewHeight);
                     tempVec2.set(viewWidth, viewHeight);
                     u.setValue(VarType.Vector2, tempVec2);
                     u.setValue(VarType.Vector2, tempVec2);
                     break;
                     break;
+                case ResolutionInverse:
+                    tempVec2.set(1f / viewWidth, 1f / viewHeight);
+                    u.setValue(VarType.Vector2, tempVec2);
+                    break;
                 case Aspect:
                 case Aspect:
                     float aspect = ((float) viewWidth) / viewHeight;
                     float aspect = ((float) viewWidth) / viewHeight;
                     u.setValue(VarType.Float, aspect);
                     u.setValue(VarType.Float, aspect);

+ 6 - 0
engine/src/core/com/jme3/shader/UniformBinding.java

@@ -119,6 +119,12 @@ public enum UniformBinding {
      * Type: vec2
      * Type: vec2
      */
      */
     Resolution,
     Resolution,
+    
+    /**
+     * The inverse of the resolution, 1/width and 1/height. 
+     * Type: vec2
+     */
+    ResolutionInverse,
 
 
     /**
     /**
      * Aspect ratio of the resolution currently set. Width/Height.
      * Aspect ratio of the resolution currently set. Width/Height.