动态合批
This commit is contained in:
@@ -33,6 +33,7 @@ module es {
|
||||
public _renderers: Renderer[] = [];
|
||||
public readonly _postProcessors: PostProcessor[] = [];
|
||||
public _didSceneBegin;
|
||||
public dynamicBatch: boolean = false;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
@@ -189,6 +190,35 @@ module es {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 动态合批
|
||||
*/
|
||||
public dynamicInBatch(){
|
||||
this.removeChildren();
|
||||
let batching = false;
|
||||
let displayContainer: egret.DisplayObjectContainer;
|
||||
for (let component of this.renderableComponents.buffer){
|
||||
if (component instanceof SpriteAnimator){
|
||||
// 动态
|
||||
this.addChild(component.displayObject);
|
||||
this.addChild(component.debugDisplayObject);
|
||||
batching = false;
|
||||
displayContainer = null;
|
||||
} else if (component instanceof RenderableComponent) {
|
||||
// 静态
|
||||
if (!batching){
|
||||
batching = true;
|
||||
displayContainer = new egret.DisplayObjectContainer();
|
||||
displayContainer.cacheAsBitmap = true;
|
||||
this.addChild(displayContainer);
|
||||
}
|
||||
|
||||
displayContainer.addChild(component.displayObject);
|
||||
displayContainer.addChild(component.debugDisplayObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 现在的任何后处理器都要完成它的处理
|
||||
* 只有在SceneTransition请求渲染时,它才会有一个值。
|
||||
|
||||
Reference in New Issue
Block a user