mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
fix skybox mesh init (#5599)
This commit is contained in:
@@ -156,6 +156,7 @@ export class RenderScene {
|
||||
this.destroyPointLights();
|
||||
this.destroySpotLights();
|
||||
this.destroyModels();
|
||||
this._skybox.destroy();
|
||||
this._planarShadows.destroy();
|
||||
this._texturePool.destroy();
|
||||
}
|
||||
|
||||
@@ -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 () {
|
||||
|
||||
Reference in New Issue
Block a user