fix skybox mesh init (#5599)

This commit is contained in:
Yun Hsiao Wu
2019-10-23 19:11:14 +08:00
committed by pandamicro
parent c3cf0c62b9
commit 91ef4f0d8a
2 changed files with 6 additions and 4 deletions
@@ -156,6 +156,7 @@ export class RenderScene {
this.destroyPointLights();
this.destroySpotLights();
this.destroyModels();
this._skybox.destroy();
this._planarShadows.destroy();
this._texturePool.destroy();
}
+5 -4
View File
@@ -1,6 +1,7 @@
import { builtinResMgr } from '../../3d/builtin';
import { createMesh } from '../../3d/misc/utils';
import { Material } from '../../assets/material';
import { Mesh } from '../../assets/mesh';
import { TextureCube } from '../../assets/texture-cube';
import { IInternalBindingInst, UNIFORM_ENVIRONMENT } from '../../pipeline/define';
import { box } from '../../primitive';
@@ -8,6 +9,8 @@ import { samplerLib } from '../core/sampler-lib';
import { Model } from './model';
import { RenderScene } from './render-scene';
let skybox_mesh: Mesh | null = null;
export class Skybox extends Model {
set useIBL (val) {
@@ -52,10 +55,8 @@ export class Skybox extends Model {
this._scene = scene;
this._material.initialize({ effectName: 'pipeline/skybox', defines: { USE_RGBE_CUBEMAP: this._isRGBE } });
this._globalBinding = this._scene.root.pipeline.globalBindings.get(UNIFORM_ENVIRONMENT.name)!;
const mesh = createMesh(box({ width: 2, height: 2, length: 2 }));
const subMeshData = mesh.renderingMesh.getSubmesh(0)!;
this.initSubModel(0, subMeshData, this._material);
if (!skybox_mesh) { skybox_mesh = createMesh(box({ width: 2, height: 2, length: 2 })); }
this.initSubModel(0, skybox_mesh.renderingMesh.getSubmesh(0), this._material);
}
protected _updatePipeline () {