修复无graphics报错问题

This commit is contained in:
yhh
2021-05-28 17:00:33 +08:00
parent 79d684caae
commit 44e2ca07e5
5 changed files with 28 additions and 2 deletions

View File

@@ -377,6 +377,7 @@ module es {
}
public debugRender(batcher: IBatcher) {
if (!batcher) return;
this.components.debugRender(batcher);
}

View File

@@ -327,6 +327,7 @@ module es {
}
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);

View File

@@ -14,22 +14,34 @@ module es {
public unload() { }
protected beginRender(cam: ICamera) {
if (!Graphics.instance)
return;
Graphics.instance.batcher.begin(cam);
}
protected endRender() {
if (!Graphics.instance)
return;
Graphics.instance.batcher.end();
}
public abstract render(scene: Scene): void;
protected renderAfterStateCheck(renderable: IRenderable, cam: ICamera) {
if (!Graphics.instance)
return;
renderable.render(Graphics.instance.batcher, cam);
}
protected debugRender(scene: Scene) {
es.Physics.debugDraw(2);
if (!Graphics.instance)
return;
es.Physics.debugDraw(2);
for (let i = 0; i < scene.entities.count; i ++) {
let entity = scene.entities.buffer[i];
if (entity.enabled) {