移除渲染模块,提供更纯净的ecs

This commit is contained in:
YHH
2022-03-05 10:23:49 +08:00
parent f3f5d0bbd1
commit ccc603b59f
43 changed files with 131 additions and 3826 deletions

View File

@@ -94,9 +94,6 @@ module es {
for (let i = 0, s = this._components.length; i < s; ++ i) {
let component = this._components[i];
if (!component) continue;
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.remove(component);
// 处理IUpdatable
if (isIUpdatable(component))
@@ -112,9 +109,6 @@ module es {
if (this._components.length > 0) {
for (let i = 0, s = this._components.length; i < s; ++ i) {
let component = this._components[i];
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.add(component);
if (isIUpdatable(component))
this._updatableComponents.push(component);
@@ -157,8 +151,6 @@ module es {
if (this._componentsToAddList.length > 0) {
for (let i = 0, l = this._componentsToAddList.length; i < l; ++ i) {
let component = this._componentsToAddList[i];
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.add(component);
if (isIUpdatable(component))
this._updatableComponents.push(component);
@@ -195,9 +187,6 @@ module es {
}
public handleRemove(component: Component) {
if (component instanceof RenderableComponent)
this._entity.scene.renderableComponents.remove(component);
if (isIUpdatable(component) && this._updatableComponents.length > 0) {
let index = this._updatableComponents.findIndex((c) => (<any>c as Component).id == component.id);
if (index != -1)
@@ -325,14 +314,5 @@ module es {
this._components[i].onDisabled();
}
}
public debugRender(batcher: IBatcher) {
if (!batcher) return;
for (let i = 0; i < this._components.length; i ++) {
if (this._components[i].enabled) {
this._components[i].debugRender(batcher);
}
}
}
}
}