新增renderable组件render方法 去除mathhelper.minof/maxof

This commit is contained in:
yhh
2020-06-18 10:49:32 +08:00
parent 9c293979a4
commit 231276e39b
12 changed files with 162 additions and 68 deletions

View File

@@ -3,9 +3,9 @@
*/
abstract class RenderableComponent extends Component {
private _isVisible: boolean;
private _areBoundsDirty = true;
private _bounds: Rectangle;
private _localOffset: Vector2;
protected _areBoundsDirty = true;
protected _bounds: Rectangle;
protected _localOffset: Vector2;
public get width(){
return this.getWidth();
@@ -54,6 +54,8 @@ abstract class RenderableComponent extends Component {
protected onBecameInvisible(){}
public abstract render(camera: Camera);
public isVisibleFromCamera(camera: Camera): boolean{
this.isVisible = camera.bounds.intersects(this.bounds);
return this.isVisible;