From 8529cb9ad1abdf0b0536596cd6703e26a7dcae41 Mon Sep 17 00:00:00 2001 From: Felipe Alfonso Date: Fri, 9 Feb 2018 15:45:22 -0300 Subject: [PATCH] Resolution fix work in progress --- src/renderer/webgl/WebGLRenderer.js | 16 +++++++++------- .../webgl/pipelines/TextureTintPipeline.js | 3 ++- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/renderer/webgl/WebGLRenderer.js b/src/renderer/webgl/WebGLRenderer.js index dfc82dd13..c9a4cb8c0 100644 --- a/src/renderer/webgl/WebGLRenderer.js +++ b/src/renderer/webgl/WebGLRenderer.js @@ -37,19 +37,19 @@ var WebGLRenderer = new Class({ pixelArt: game.config.pixelArt, backgroundColor: game.config.backgroundColor, contextCreation: contextCreationConfig, - resolution: game.config.resolution + resolution: game.config.resolution, + autoResize: game.config.autoResize }; this.game = game; this.type = CONST.WEBGL; - this.width = game.config.width * game.config.resolution; - this.height = game.config.height * game.config.resolution; + this.width = game.config.width; + this.height = game.config.height; this.canvas = game.canvas; this.lostContextCallbacks = []; this.restoredContextCallbacks = []; this.blendModes = []; this.nativeTextures = []; this.contextLost = false; - this.autoResize = false; this.pipelines = null; this.snapshotState = { callback: null, @@ -148,15 +148,16 @@ var WebGLRenderer = new Class({ this.addPipeline('Light2D', new ForwardDiffuseLightPipeline(this.game, gl, this)); this.setBlendMode(CONST.BlendModes.NORMAL); - this.resize(this.width, this.height, config.resolution); + this.resize(this.width, this.height); return this; }, - resize: function (width, height, resolution) + resize: function (width, height) { var gl = this.gl; var pipelines = this.pipelines; + var resolution = this.config.resolution; this.width = width * resolution; this.height = height * resolution; @@ -164,7 +165,7 @@ var WebGLRenderer = new Class({ this.canvas.width = this.width; this.canvas.height = this.height; - if (this.autoResize) + //if (this.config.autoResize) { this.canvas.style.width = (this.width / resolution) + 'px'; this.canvas.style.height = (this.height / resolution) + 'px'; @@ -177,6 +178,7 @@ var WebGLRenderer = new Class({ { pipelines[pipelineName].resize(width, height, resolution); } + return this; }, diff --git a/src/renderer/webgl/pipelines/TextureTintPipeline.js b/src/renderer/webgl/pipelines/TextureTintPipeline.js index 66c063a33..60ea01705 100644 --- a/src/renderer/webgl/pipelines/TextureTintPipeline.js +++ b/src/renderer/webgl/pipelines/TextureTintPipeline.js @@ -74,7 +74,8 @@ var TextureTintPipeline = new Class({ { WebGLPipeline.prototype.resize.call(this, width, height, resolution); this.projOrtho(0, this.width, this.height, 0, -1000.0, 1000.0); - + this.viewScale(resolution, resolution, 1.0); + this.modelScale(resolution, resolution, 1.0); return this; },