Fix: 打开新模型时旧模型存在残留

main
wuyize 2024-03-14 16:21:11 +08:00
parent d968b585fb
commit 9ff0a3b45c
6 changed files with 10 additions and 9 deletions

View File

@ -108,6 +108,7 @@ void Renderer::Model::unloadModel()
paintingLoaded.clear(); paintingLoaded.clear();
texturesLoaded.clear(); texturesLoaded.clear();
meshes.clear(); meshes.clear();
paintingMeshes.clear();
minPos = glm::vec3(std::numeric_limits<float>::max()); minPos = glm::vec3(std::numeric_limits<float>::max());
maxPos = glm::vec3(std::numeric_limits<float>::min()); maxPos = glm::vec3(std::numeric_limits<float>::min());

View File

@ -100,7 +100,7 @@ namespace Renderer
} }
} }
PageIDCallbackPass::PageIDCallbackPass(GladGLContext* gl, unsigned int& frameWidth, unsigned int& frameHeight, QOpenGLFramebufferObject*& fbo, GLuint* gBuffers, GLuint& gPageID, VirtualTextureManager& vtManager) PageIDFeedbackPass::PageIDFeedbackPass(GladGLContext* gl, unsigned int& frameWidth, unsigned int& frameHeight, QOpenGLFramebufferObject*& fbo, GLuint* gBuffers, GLuint& gPageID, VirtualTextureManager& vtManager)
: RenderPass(gl) : RenderPass(gl)
, pageIdDownsampleShader(":/Shaders/pageId_downsample.comp") , pageIdDownsampleShader(":/Shaders/pageId_downsample.comp")
, frameWidth(frameWidth) , frameWidth(frameWidth)
@ -112,7 +112,7 @@ namespace Renderer
{ {
} }
void PageIDCallbackPass::dispatch() void PageIDFeedbackPass::dispatch()
{ {
if (fbo->bind()) if (fbo->bind())
{ {

View File

@ -49,10 +49,10 @@ namespace Renderer
QMatrix4x4& view; QMatrix4x4& view;
}; };
class PageIDCallbackPass : public RenderPass class PageIDFeedbackPass : public RenderPass
{ {
public: public:
PageIDCallbackPass(GladGLContext* gl, unsigned int& frameWidth, unsigned int& frameHeight, QOpenGLFramebufferObject*& fbo, PageIDFeedbackPass(GladGLContext* gl, unsigned int& frameWidth, unsigned int& frameHeight, QOpenGLFramebufferObject*& fbo,
GLuint* gBuffers, GLuint& gPageID, VirtualTextureManager& vtManager); GLuint* gBuffers, GLuint& gPageID, VirtualTextureManager& vtManager);
void dispatch(); void dispatch();
private: private:

View File

@ -138,7 +138,7 @@ void RendererGLWidget::initializeGL()
shadowMapPass = std::make_unique<ShadowMapPass>(gl.get(), shadowFboHandle, shadowMapResolution, light, model); shadowMapPass = std::make_unique<ShadowMapPass>(gl.get(), shadowFboHandle, shadowMapResolution, light, model);
geometryPass = std::make_unique<GeometryPass>(gl.get(), frameWidth, frameHeight, fboPtr, model, projection, view); geometryPass = std::make_unique<GeometryPass>(gl.get(), frameWidth, frameHeight, fboPtr, model, projection, view);
pageIDCallbackPass = std::make_unique<PageIDCallbackPass>(gl.get(), frameWidth, frameHeight, fboPtr, gbuffers, gPageID, *vtManager); pageIDFeedbackPass = std::make_unique<PageIDFeedbackPass>(gl.get(), frameWidth, frameHeight, fboPtr, gbuffers, gPageID, *vtManager);
lightingPass = std::make_unique<LightingPass>(gl.get(), frameWidth, frameHeight, view, camera, light, lightingPass = std::make_unique<LightingPass>(gl.get(), frameWidth, frameHeight, view, camera, light,
gBaseColor, gNormal, gPosition, gMetallicRoughness, shadowGbuffer, irradianceMap, prefilterMap, brdfLUTTexture); gBaseColor, gNormal, gPosition, gMetallicRoughness, shadowGbuffer, irradianceMap, prefilterMap, brdfLUTTexture);
skyboxPass = std::make_unique<SkyboxPass>(gl.get(), fboPtr, projection, view, skyCubemap); skyboxPass = std::make_unique<SkyboxPass>(gl.get(), fboPtr, projection, view, skyCubemap);
@ -210,7 +210,7 @@ void RendererGLWidget::paintGL()
//vtManager->commitMutex.lock(); //vtManager->commitMutex.lock();
shadowMapPass->dispatch(); shadowMapPass->dispatch();
geometryPass->dispatch(); geometryPass->dispatch();
pageIDCallbackPass->dispatch(); pageIDFeedbackPass->dispatch();
//gl->Finish(); //gl->Finish();
//vtManager->commitMutex.unlock(); //vtManager->commitMutex.unlock();
lightingPass->dispatch(); lightingPass->dispatch();

View File

@ -63,7 +63,7 @@ namespace Renderer
std::unique_ptr<ShadowMapPass> shadowMapPass; std::unique_ptr<ShadowMapPass> shadowMapPass;
std::unique_ptr<GeometryPass> geometryPass; std::unique_ptr<GeometryPass> geometryPass;
std::unique_ptr<PageIDCallbackPass> pageIDCallbackPass; std::unique_ptr<PageIDFeedbackPass> pageIDFeedbackPass;
std::unique_ptr<LightingPass> lightingPass; std::unique_ptr<LightingPass> lightingPass;
std::unique_ptr<SkyboxPass> skyboxPass; std::unique_ptr<SkyboxPass> skyboxPass;
std::unique_ptr<ToneMappingPass> toneMappingPass; std::unique_ptr<ToneMappingPass> toneMappingPass;

View File

@ -1,6 +1,6 @@
# ArchitectureColoredPainting # 古建筑彩绘计算机辅助设计系统
古建筑彩绘计算机辅助设计系统 本软件实现一种设计矢量纹案的软件工具,矢量纹理采用高效的数据结构存储,支持图案**复用**,支持将矢量图作为模型的纹理,用户可以利用软件中的图元引用、变换以及样式等功能方便地完成**矢量纹理的设计**;完成矢量纹理的设计后,可以将其应用在**三维模型**上,方便展示**模拟纹案的渲染后结果**,用户可以自由调整摄像机位置和缩放视野,模型中的矢量纹理**不会在缩放过程中失真**。
## 依赖 ## 依赖