mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
fixed render content flicker problem (#5881)
This commit is contained in:
@@ -121,12 +121,12 @@ export class CanvasComponent extends Component {
|
||||
|
||||
/**
|
||||
* @zh
|
||||
* 渲染优先级。
|
||||
* 相机排序优先级。当 RenderMode 为 intersperse 时,指定与其它相机的渲染顺序,当 RenderMode 为 overlay 时,指定跟其余 Canvas 做排序使用。需要对多 Canvas 设定 priority 以免出现不同平台下的闪屏问题。
|
||||
*
|
||||
* @param value - 渲染优先级。
|
||||
*/
|
||||
@property({
|
||||
tooltip: '相机排序优先级。当 RenderMode 为 intersperse 时,指定与其它相机的渲染顺序,当 RenderMode 为 overlay 时,指定跟其余 Canvas 做排序使用',
|
||||
tooltip: '相机排序优先级。当 RenderMode 为 intersperse 时,指定与其它相机的渲染顺序,当 RenderMode 为 overlay 时,指定跟其余 Canvas 做排序使用。需要对多 Canvas 设定 priority 以免出现不同平台下的闪屏问题。',
|
||||
})
|
||||
get priority () {
|
||||
return this._priority;
|
||||
|
||||
@@ -7,7 +7,6 @@ import { GFXWindow } from '../gfx/window';
|
||||
import { Camera } from '../renderer/scene/camera';
|
||||
import { RenderFlow } from './render-flow';
|
||||
import { CameraDefaultMask } from './define';
|
||||
import { indexOf } from '../utils/array';
|
||||
|
||||
/**
|
||||
* @zh
|
||||
@@ -73,6 +72,9 @@ export class RenderView {
|
||||
|
||||
public set priority (val: number) {
|
||||
this._priority = val;
|
||||
if (cc.director.root) {
|
||||
cc.director.root.sortViews();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+7
-5
@@ -351,10 +351,6 @@ export class Root {
|
||||
}
|
||||
|
||||
const views = this._views;
|
||||
views.sort((a: RenderView, b: RenderView) => {
|
||||
return a.priority - b.priority;
|
||||
});
|
||||
|
||||
for (let i = 0; i < views.length; i++) {
|
||||
const view = views[i];
|
||||
if (view.isEnable && (view.window &&
|
||||
@@ -458,7 +454,7 @@ export class Root {
|
||||
view.initialize(info);
|
||||
// view.camera.resize(cc.game.canvas.width, cc.game.canvas.height);
|
||||
this._views.push(view);
|
||||
|
||||
this.sortViews();
|
||||
return view;
|
||||
}
|
||||
|
||||
@@ -546,4 +542,10 @@ export class Root {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sortViews () {
|
||||
this._views.sort((a: RenderView, b: RenderView) => {
|
||||
return a.priority - b.priority;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user