mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 07:42:38 +08:00
disable ssaa feature
This commit is contained in:
+2
-14
@@ -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,
|
||||
|
||||
@@ -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');
|
||||
}
|
||||
|
||||
+5
-1
@@ -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);
|
||||
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -143,6 +143,8 @@ export class Camera {
|
||||
});
|
||||
|
||||
this.changeTargetDisplay(info.targetDisplay);
|
||||
|
||||
console.log('Create Camera: ' + this._name + ' ' + this._width + ' x ' + this._height);
|
||||
}
|
||||
|
||||
public destroy () {
|
||||
|
||||
Reference in New Issue
Block a user