From e11d3f2661e4ef767c1eb119ebb2ddaea82f2cd5 Mon Sep 17 00:00:00 2001 From: jerrywwl Date: Thu, 4 Apr 2019 11:50:17 +0800 Subject: [PATCH] disable ssaa feature --- cocos/core/game.js | 16 ++-------------- cocos/core/platform/CCView.js | 14 ++++++-------- cocos/core/root.ts | 6 +++++- cocos/gfx/webgl/webgl-device.ts | 3 +-- cocos/gfx/webgl2/webgl2-device.ts | 3 +-- cocos/pipeline/render-pipeline.ts | 7 ++++--- cocos/renderer/scene/camera.ts | 2 ++ 7 files changed, 21 insertions(+), 30 deletions(-) diff --git a/cocos/core/game.js b/cocos/core/game.js index 119907a2aa..11eba66dc7 100644 --- a/cocos/core/game.js +++ b/cocos/core/game.js @@ -702,21 +702,9 @@ class Game extends EventTarget { cc.view.enableRetina(true) cc.view.setOrientation(cc.macro.ORIENTATION_LANDSCAPE); cc.view._initFrameSize(); - let nativeWidth = Math.floor(screen.width); - let nativeHeight = Math.floor(screen.height); + let nativeWidth = Math.floor(screen.width * cc.view._devicePixelRatio); + let nativeHeight = Math.floor(screen.height * cc.view._devicePixelRatio); - /* - if (nativeHeight > nativeWidth) { - let temp = localCanvas.width; - localCanvas.width = localCanvas.height; - localCanvas.height = temp; - - temp = nativeWidth; - nativeWidth = nativeHeight; - nativeHeight = temp; - } - */ - this._gfxDevice.initialize({ canvasElm: localCanvas, debug: true, diff --git a/cocos/core/platform/CCView.js b/cocos/core/platform/CCView.js index 21961eb072..4acfbd9b94 100644 --- a/cocos/core/platform/CCView.js +++ b/cocos/core/platform/CCView.js @@ -554,11 +554,11 @@ class View extends EventTarget { var canvas = cc.game.canvas; var container = cc.game.container; - // canvas.width = width * this._devicePixelRatio; - // canvas.height = height * this._devicePixelRatio; + canvas.width = width * this._devicePixelRatio; + canvas.height = height * this._devicePixelRatio; - canvas.width = width; - canvas.height = height; + // canvas.width = width; + // canvas.height = height; canvas.style.width = width + 'px'; canvas.style.height = height + 'px'; @@ -1097,17 +1097,15 @@ class ContainerStrategy { locContainer.style.height = locCanvas.style.height = h + 'px'; } // Setup pixel ratio for retina display - /* var devicePixelRatio = view._devicePixelRatio = 1; if (view.isRetinaEnabled()) devicePixelRatio = view._devicePixelRatio = Math.min(2, window.devicePixelRatio || 1); // Setup canvas locCanvas.width = w * devicePixelRatio; locCanvas.height = h * devicePixelRatio; - */ - locCanvas.width = w; - locCanvas.height = h; + // locCanvas.width = w; + // locCanvas.height = h; view.emit('canvas-resize'); } diff --git a/cocos/core/root.ts b/cocos/core/root.ts index ee81017df1..243d817eb8 100644 --- a/cocos/core/root.ts +++ b/cocos/core/root.ts @@ -111,7 +111,9 @@ export class Root { } cc.view.on('canvas-resize', () => { - this.resize(cc.game.canvas.width, cc.game.canvas.height); + const width = cc.game.canvas.width; + const height = cc.game.canvas.height; + this.resize(width, height); }, this); return true; @@ -136,6 +138,8 @@ export class Root { } public resize (width: number, height: number) { + // const w = width / cc.view._devicePixelRatio; + // const h = height / cc.view._devicePixelRatio; this._device.resize(width, height); diff --git a/cocos/gfx/webgl/webgl-device.ts b/cocos/gfx/webgl/webgl-device.ts index 052e921551..ae664faacc 100644 --- a/cocos/gfx/webgl/webgl-device.ts +++ b/cocos/gfx/webgl/webgl-device.ts @@ -188,8 +188,7 @@ export class WebGLGFXDevice extends GFXDevice { try { const webGLCtxAttribs: WebGLContextAttributes = { alpha: true, - antialias: false, - // antialias: this._isAntialias, + antialias: this._isAntialias, depth: true, stencil: true, premultipliedAlpha: this._isPremultipliedAlpha, diff --git a/cocos/gfx/webgl2/webgl2-device.ts b/cocos/gfx/webgl2/webgl2-device.ts index 79b10f0e1d..d11f27cb6c 100644 --- a/cocos/gfx/webgl2/webgl2-device.ts +++ b/cocos/gfx/webgl2/webgl2-device.ts @@ -119,8 +119,7 @@ export class WebGL2GFXDevice extends GFXDevice { try { const webGLCtxAttribs: WebGLContextAttributes = { alpha: true, - antialias: false, - // antialias: this._isAntialias, + antialias: this._isAntialias, depth: true, stencil: true, premultipliedAlpha: this._isPremultipliedAlpha, diff --git a/cocos/pipeline/render-pipeline.ts b/cocos/pipeline/render-pipeline.ts index 8da400f65a..da0e598583 100644 --- a/cocos/pipeline/render-pipeline.ts +++ b/cocos/pipeline/render-pipeline.ts @@ -361,9 +361,10 @@ export abstract class RenderPipeline { // colorFmt = GFXFormat.RGBA16F; - this._shadingScale = this._device.devicePixelRatio; - this._shadingWidth = this._device.nativeWidth * this._shadingScale; - this._shadingHeight = this._device.nativeHeight * this._shadingScale; + // this._shadingScale = this._device.devicePixelRatio; + this._shadingScale = 1.0; + this._shadingWidth = Math.floor(this._device.nativeWidth); + this._shadingHeight = Math.floor(this._device.nativeHeight); console.info('USE_MSAA: ' + this._useMSAA); console.info('USE_SMAA: ' + this._useSMAA); diff --git a/cocos/renderer/scene/camera.ts b/cocos/renderer/scene/camera.ts index 7e7e73c6c4..108157acf7 100644 --- a/cocos/renderer/scene/camera.ts +++ b/cocos/renderer/scene/camera.ts @@ -143,6 +143,8 @@ export class Camera { }); this.changeTargetDisplay(info.targetDisplay); + + console.log('Create Camera: ' + this._name + ' ' + this._width + ' x ' + this._height); } public destroy () {