新增renderableComponent 用于控制可渲染组件的基类 不要在transform当中直接更改目标属性

This commit is contained in:
yhh
2020-06-10 16:25:39 +08:00
parent 94818d5784
commit f62f449d99
12 changed files with 125 additions and 114 deletions

View File

@@ -203,14 +203,6 @@ class Transform {
this.localScale = scale;
}
for (let i = 0; i < this.entity.components.buffer.length; i ++){
let component = this.entity.components.buffer[i];
if (component.displayRender){
component.displayRender.scaleX = this.scale.x;
component.displayRender.scaleY = this.scale.y;
}
}
return this;
}
@@ -234,13 +226,6 @@ class Transform {
this.localRotation = radians;
}
for (let i = 0; i < this.entity.components.buffer.length; i ++){
let component = this.entity.components.buffer[i];
if (component.displayRender){
component.displayRender.rotation = this.rotation;
}
}
return this;
}
@@ -270,14 +255,6 @@ class Transform {
this.localPosition = position;
}
for (let i = 0; i < this.entity.components.buffer.length; i ++){
let component = this.entity.components.buffer[i];
if (component.displayRender){
component.displayRender.x = this.entity.scene.camera.transformMatrix.m31 + this.position.x;
component.displayRender.y = this.entity.scene.camera.transformMatrix.m32 + this.position.y;
}
}
return this;
}