From 5f699072d9c101874a0de1526be617d2d06e6ad0 Mon Sep 17 00:00:00 2001 From: Zach Pomerantz Date: Mon, 29 Aug 2016 10:58:09 -0700 Subject: [PATCH] allow black skybox --- libraries/model/src/model/Skybox.cpp | 3 +++ libraries/model/src/model/Skybox.h | 10 +++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libraries/model/src/model/Skybox.cpp b/libraries/model/src/model/Skybox.cpp index 4a66c18f98..bfbc883978 100755 --- a/libraries/model/src/model/Skybox.cpp +++ b/libraries/model/src/model/Skybox.cpp @@ -26,10 +26,12 @@ Skybox::Skybox() { } void Skybox::setColor(const Color& color) { + _empty = false; _schemaBuffer.edit().color = color; } void Skybox::setCubemap(const gpu::TexturePointer& cubemap) { + _empty = false; _cubemap = cubemap; } @@ -50,6 +52,7 @@ void Skybox::updateSchemaBuffer() const { } void Skybox::clear() { + _empty = true; _schemaBuffer.edit().color = vec3(0); setCubemap(nullptr); } diff --git a/libraries/model/src/model/Skybox.h b/libraries/model/src/model/Skybox.h index 1e6d30bbc1..d7d95fbe9e 100755 --- a/libraries/model/src/model/Skybox.h +++ b/libraries/model/src/model/Skybox.h @@ -35,7 +35,7 @@ public: void setCubemap(const gpu::TexturePointer& cubemap); const gpu::TexturePointer& getCubemap() const { return _cubemap; } - virtual bool empty() { return _schemaBuffer.get().color == vec3(0) && !_cubemap; } + virtual bool empty() { return _empty; } virtual void clear(); void prepare(gpu::Batch& batch, int textureSlot = SKYBOX_SKYMAP_SLOT, int bufferSlot = SKYBOX_CONSTANTS_SLOT) const; @@ -47,17 +47,17 @@ protected: static const int SKYBOX_SKYMAP_SLOT { 0 }; static const int SKYBOX_CONSTANTS_SLOT { 0 }; - gpu::TexturePointer _cubemap; - class Schema { public: glm::vec3 color { 0.0f, 0.0f, 0.0f }; float blend { 0.0f }; }; - mutable gpu::BufferView _schemaBuffer; - void updateSchemaBuffer() const; + + mutable gpu::BufferView _schemaBuffer; + gpu::TexturePointer _cubemap; + bool _empty{ true }; }; typedef std::shared_ptr SkyboxPointer;