From 3dc654cbcd212f7fcd9d689bb52e3b1a080e52e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BE=90=E5=85=B5?= <49358166+xubing0906@users.noreply.github.com> Date: Thu, 8 Dec 2022 16:31:46 +0800 Subject: [PATCH] move reflection-probe to 3d module (#13711) * add validate * fix switch probe error * export reflectionProbe * remove export reflectionProbeManager * export --- cocos/3d/index.ts | 1 + cocos/3d/reflection-probe/index.ts | 26 +++++++++++++++++++ .../reflection-probe-component.ts | 20 +++++++------- cocos/misc/index.ts | 1 - cocos/rendering/custom/define.ts | 3 +-- 5 files changed, 38 insertions(+), 13 deletions(-) create mode 100644 cocos/3d/reflection-probe/index.ts rename cocos/{misc => 3d/reflection-probe}/reflection-probe-component.ts (95%) diff --git a/cocos/3d/index.ts b/cocos/3d/index.ts index 6d342d60c8..4a89bd0d6b 100644 --- a/cocos/3d/index.ts +++ b/cocos/3d/index.ts @@ -33,6 +33,7 @@ export * from './framework'; export * from './lights'; export * from './skinned-mesh-renderer'; export * from './lod'; +export * from './reflection-probe'; export { utils, diff --git a/cocos/3d/reflection-probe/index.ts b/cocos/3d/reflection-probe/index.ts new file mode 100644 index 0000000000..ec0ed5f109 --- /dev/null +++ b/cocos/3d/reflection-probe/index.ts @@ -0,0 +1,26 @@ +/* + Copyright (c) 2022 Xiamen Yaji Software Co., Ltd. + + http://www.cocos.com + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated engine source code (the "Software"), a limited, + worldwide, royalty-free, non-assignable, revocable and non-exclusive license + to use Cocos Creator solely to develop games on your target platforms. You shall + not use Cocos Creator software for developing other software or tools that's + used for developing games. You are not granted to publish, distribute, + sublicense, and/or sell copies of Cocos Creator. + + The software or tools in this License Agreement are licensed, not sold. + Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. +*/ + +export { ReflectionProbe } from './reflection-probe-component'; diff --git a/cocos/misc/reflection-probe-component.ts b/cocos/3d/reflection-probe/reflection-probe-component.ts similarity index 95% rename from cocos/misc/reflection-probe-component.ts rename to cocos/3d/reflection-probe/reflection-probe-component.ts index 2e172d9ab2..fa7bb98c13 100644 --- a/cocos/misc/reflection-probe-component.ts +++ b/cocos/3d/reflection-probe/reflection-probe-component.ts @@ -24,17 +24,17 @@ */ import { ccclass, executeInEditMode, menu, playOnFocus, serializable, tooltip, type, visible } from 'cc.decorator'; import { EDITOR } from 'internal:constants'; -import { CCObject, Color, Enum, size, Vec3 } from '../core'; +import { CCObject, Color, Enum, size, Vec3 } from '../../core'; -import { TextureCube } from '../asset/assets'; -import { scene } from '../render-scene'; -import { CAMERA_DEFAULT_MASK } from '../rendering/define'; -import { ReflectionProbeManager } from '../rendering/reflection-probe-manager'; -import { Component } from '../scene-graph/component'; -import { Layers } from '../scene-graph/layers'; -import { Camera } from './camera-component'; -import { Node, TransformBit } from '../scene-graph'; -import { ProbeClearFlag, ProbeType } from '../render-scene/scene/reflection-probe'; +import { TextureCube } from '../../asset/assets'; +import { scene } from '../../render-scene'; +import { CAMERA_DEFAULT_MASK } from '../../rendering/define'; +import { ReflectionProbeManager } from '../../rendering/reflection-probe-manager'; +import { Component } from '../../scene-graph/component'; +import { Layers } from '../../scene-graph/layers'; +import { Camera } from '../../misc/camera-component'; +import { Node, TransformBit } from '../../scene-graph'; +import { ProbeClearFlag, ProbeType } from '../../render-scene/scene/reflection-probe'; export enum ProbeResolution { /** diff --git a/cocos/misc/index.ts b/cocos/misc/index.ts index 7ab88f16ba..de07f74a90 100644 --- a/cocos/misc/index.ts +++ b/cocos/misc/index.ts @@ -30,6 +30,5 @@ export { ModelRenderer } from './model-renderer'; export { Renderer } from './renderer'; export { MissingScript } from './missing-script'; export { PrefabLink } from './prefab-link'; -export { ReflectionProbe } from './reflection-probe-component'; /** deprecated */ export * from './deprecated'; diff --git a/cocos/rendering/custom/define.ts b/cocos/rendering/custom/define.ts index a599be6434..f05d0c5f46 100644 --- a/cocos/rendering/custom/define.ts +++ b/cocos/rendering/custom/define.ts @@ -6,7 +6,6 @@ import { AccessType, AttachmentType, ComputeView, LightInfo, QueueHint, RasterVi import { Vec4, macro, geometry, toRadian, cclegacy } from '../../core'; import { Material } from '../../asset/assets'; import { SRGBToLinear } from '../pipeline-funcs'; -import { ReflectionProbeManager } from '../reflection-probe-manager'; import { RenderWindow } from '../../render-scene/core/render-window'; // Anti-aliasing type, other types will be gradually added in the future @@ -604,7 +603,7 @@ export function buildShadowPass (passName: Readonly, export function buildReflectionProbePasss (camera: Camera, ppl: Pipeline, isOffScreen: boolean) { - const probes = ReflectionProbeManager.probeManager.getProbes(); + const probes = cclegacy.internal.reflectionProbeManager.getProbes(); if (probes.length === 0) { return; }