动态合批
This commit is contained in:
@@ -95,14 +95,15 @@ module es {
|
||||
let component = this._components[i];
|
||||
|
||||
if (component instanceof RenderableComponent) {
|
||||
this._entity.scene.addChild(component.displayObject);
|
||||
if (!this._entity.scene.dynamicBatch) this._entity.scene.addChild(component.displayObject);
|
||||
this._entity.scene.renderableComponents.add(component);
|
||||
}
|
||||
|
||||
this._entity.scene.addChild(component.debugDisplayObject);
|
||||
if (!this._entity.scene.dynamicBatch) this._entity.scene.addChild(component.debugDisplayObject);
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component));
|
||||
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
|
||||
}
|
||||
this._entity.scene.dynamicInBatch();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -122,17 +123,18 @@ module es {
|
||||
for (let i = 0, count = this._componentsToAdd.length; i < count; i++) {
|
||||
let component = this._componentsToAdd[i];
|
||||
if (component instanceof RenderableComponent) {
|
||||
this._entity.scene.addChild(component.displayObject);
|
||||
if (!this._entity.scene.dynamicBatch) this._entity.scene.addChild(component.displayObject);
|
||||
this._entity.scene.renderableComponents.add(component);
|
||||
}
|
||||
|
||||
this._entity.scene.addChild(component.debugDisplayObject);
|
||||
if (!this._entity.scene.dynamicBatch) this._entity.scene.addChild(component.debugDisplayObject);
|
||||
this._entity.componentBits.set(ComponentTypeManager.getIndexFor(component));
|
||||
this._entity.scene.entityProcessors.onComponentAdded(this._entity);
|
||||
|
||||
this._components.push(component);
|
||||
this._tempBufferList.push(component);
|
||||
}
|
||||
this._entity.scene.dynamicInBatch();
|
||||
|
||||
// 在调用onAddedToEntity之前清除,以防添加更多组件
|
||||
this._componentsToAdd.length = 0;
|
||||
|
||||
Reference in New Issue
Block a user