浏览代码

Fix issue where vignette aspect ratio is different between offscreen and direct rendering

George Corney 5 年之前
父节点
当前提交
b2fed515bc
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      src/Materials/imageProcessingConfiguration.ts

+ 4 - 2
src/Materials/imageProcessingConfiguration.ts

@@ -494,9 +494,9 @@ export class ImageProcessingConfiguration {
     /**
      * Binds the image processing to the shader.
      * @param effect The effect to bind to
-     * @param aspectRatio Define the current aspect ratio of the effect
+     * @param overrideAspectRatio Override the aspect ratio of the effect
      */
-    public bind(effect: Effect, aspectRatio = 1): void {
+    public bind(effect: Effect, overrideAspectRatio?: number): void {
         // Color Curves
         if (this._colorCurvesEnabled && this.colorCurves) {
             ColorCurves.Bind(this.colorCurves, effect);
@@ -508,6 +508,8 @@ export class ImageProcessingConfiguration {
             var inverseHeight = 1 / effect.getEngine().getRenderHeight();
             effect.setFloat2("vInverseScreenSize", inverseWidth, inverseHeight);
 
+            let aspectRatio = overrideAspectRatio != null ? overrideAspectRatio : (inverseHeight/inverseWidth);
+
             let vignetteScaleY = Math.tan(this.vignetteCameraFov * 0.5);
             let vignetteScaleX = vignetteScaleY * aspectRatio;