UI系统更新
This commit is contained in:
parent
75d5fed693
commit
b78e0275bb
@ -838,7 +838,7 @@ public:
|
||||
void UpdateEnvironmentBackgroundVisibility() {
|
||||
const bool shouldShow =
|
||||
EnvironmentSkybox_ != nullptr &&
|
||||
EnvironmentScene_ != nullptr &&
|
||||
Scene_ != nullptr &&
|
||||
ActiveEnvironmentSettings_.SkyboxVisible &&
|
||||
CurrentSceneView_.ClearFlags == MetaCoreCameraClearFlags::Skybox;
|
||||
if (EnvironmentBackgroundVisible_ != shouldShow) {
|
||||
@ -848,11 +848,11 @@ public:
|
||||
" skyboxVisible=" + (ActiveEnvironmentSettings_.SkyboxVisible ? "true" : "false")
|
||||
);
|
||||
}
|
||||
if (EnvironmentScene_ != nullptr) {
|
||||
if (shouldShow && EnvironmentScene_->getSkybox() != EnvironmentSkybox_) {
|
||||
EnvironmentScene_->setSkybox(EnvironmentSkybox_);
|
||||
} else if (!shouldShow && EnvironmentScene_->getSkybox() == EnvironmentSkybox_) {
|
||||
EnvironmentScene_->setSkybox(nullptr);
|
||||
if (Scene_ != nullptr) {
|
||||
if (shouldShow && Scene_->getSkybox() != EnvironmentSkybox_) {
|
||||
Scene_->setSkybox(EnvironmentSkybox_);
|
||||
} else if (!shouldShow && Scene_->getSkybox() == EnvironmentSkybox_) {
|
||||
Scene_->setSkybox(nullptr);
|
||||
}
|
||||
}
|
||||
EnvironmentBackgroundVisible_ = shouldShow;
|
||||
@ -862,8 +862,8 @@ public:
|
||||
if (Engine_ == nullptr || EnvironmentSkyboxTexture_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
if (EnvironmentScene_ != nullptr && EnvironmentScene_->getSkybox() == EnvironmentSkybox_) {
|
||||
EnvironmentScene_->setSkybox(nullptr);
|
||||
if (Scene_ != nullptr && Scene_->getSkybox() == EnvironmentSkybox_) {
|
||||
Scene_->setSkybox(nullptr);
|
||||
}
|
||||
if (EnvironmentSkybox_ != nullptr) {
|
||||
Engine_->destroy(EnvironmentSkybox_);
|
||||
@ -877,7 +877,7 @@ public:
|
||||
if (EnvironmentSkybox_ == nullptr) {
|
||||
return false;
|
||||
}
|
||||
EnvironmentSkybox_->setLayerMask(0xFFU, kEnvironmentSkyboxLayerMask);
|
||||
EnvironmentSkybox_->setLayerMask(0xFFU, kSceneContentLayerMask);
|
||||
UpdateEnvironmentBackgroundVisibility();
|
||||
return true;
|
||||
}
|
||||
@ -1014,6 +1014,9 @@ public:
|
||||
Scene_->setIndirectLight(nullptr);
|
||||
}
|
||||
}
|
||||
if (Scene_ != nullptr && Scene_->getSkybox() == EnvironmentSkybox_) {
|
||||
Scene_->setSkybox(nullptr);
|
||||
}
|
||||
if (EnvironmentScene_ != nullptr && EnvironmentScene_->getSkybox() == EnvironmentSkybox_) {
|
||||
EnvironmentScene_->setSkybox(nullptr);
|
||||
}
|
||||
@ -2153,9 +2156,6 @@ public:
|
||||
if (!Camera_ || !View_) return;
|
||||
CurrentSceneView_ = sceneView;
|
||||
UpdateEditorGridTransform(sceneView);
|
||||
if (Scene_ != nullptr) {
|
||||
Scene_->setSkybox(nullptr);
|
||||
}
|
||||
UpdateEnvironmentBackgroundVisibility();
|
||||
|
||||
// 1. 视图矩阵同步
|
||||
@ -2227,7 +2227,6 @@ public:
|
||||
}
|
||||
|
||||
if (Renderer_->beginFrame(SwapChain_)) {
|
||||
const bool renderEnvironment = EnvironmentBackgroundVisible_ && EnvironmentView_ != nullptr;
|
||||
const bool renderEditorGrid = GridView_ != nullptr &&
|
||||
(EditorGridEntityInScene_ || EditorGridAxisEntityInScene_);
|
||||
const auto renderScenePass = [&](bool outputToRenderTarget) {
|
||||
@ -2235,18 +2234,6 @@ public:
|
||||
Renderer_->setClearOptions(options);
|
||||
Renderer_->render(View_);
|
||||
|
||||
if (renderEnvironment) {
|
||||
options.clear = false;
|
||||
Renderer_->setClearOptions(options);
|
||||
const glm::mat4 environmentCameraMatrix = glm::rotate(
|
||||
glm::mat4(1.0F),
|
||||
glm::radians(-ActiveEnvironmentSettings_.RotationDegrees),
|
||||
glm::vec3(0.0F, 0.0F, 1.0F)
|
||||
) * CameraModelMatrix_;
|
||||
Camera_->setModelMatrix(*reinterpret_cast<const filament::math::mat4f*>(glm::value_ptr(environmentCameraMatrix)));
|
||||
Renderer_->render(EnvironmentView_);
|
||||
Camera_->setModelMatrix(*reinterpret_cast<const filament::math::mat4f*>(glm::value_ptr(CameraModelMatrix_)));
|
||||
}
|
||||
if (renderEditorGrid) {
|
||||
options.clear = false;
|
||||
Renderer_->setClearOptions(options);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user