mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 14:47:19 +02:00
allow black skybox
This commit is contained in:
parent
c3e345150b
commit
5f699072d9
2 changed files with 8 additions and 5 deletions
|
@ -26,10 +26,12 @@ Skybox::Skybox() {
|
|||
}
|
||||
|
||||
void Skybox::setColor(const Color& color) {
|
||||
_empty = false;
|
||||
_schemaBuffer.edit<Schema>().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<Schema>().color = vec3(0);
|
||||
setCubemap(nullptr);
|
||||
}
|
||||
|
|
|
@ -35,7 +35,7 @@ public:
|
|||
void setCubemap(const gpu::TexturePointer& cubemap);
|
||||
const gpu::TexturePointer& getCubemap() const { return _cubemap; }
|
||||
|
||||
virtual bool empty() { return _schemaBuffer.get<Schema>().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<Skybox> SkyboxPointer;
|
||||
|
||||
|
|
Loading…
Reference in a new issue