Merge branch 'master' of https://github.com/highfidelity/hifi into restore-WebView-tab-handler

This commit is contained in:
howard-stearns 2016-08-29 15:43:42 -07:00
commit a48aced7bd
2 changed files with 8 additions and 5 deletions

View file

@ -26,10 +26,12 @@ Skybox::Skybox() {
} }
void Skybox::setColor(const Color& color) { void Skybox::setColor(const Color& color) {
_empty = false;
_schemaBuffer.edit<Schema>().color = color; _schemaBuffer.edit<Schema>().color = color;
} }
void Skybox::setCubemap(const gpu::TexturePointer& cubemap) { void Skybox::setCubemap(const gpu::TexturePointer& cubemap) {
_empty = false;
_cubemap = cubemap; _cubemap = cubemap;
} }
@ -50,6 +52,7 @@ void Skybox::updateSchemaBuffer() const {
} }
void Skybox::clear() { void Skybox::clear() {
_empty = true;
_schemaBuffer.edit<Schema>().color = vec3(0); _schemaBuffer.edit<Schema>().color = vec3(0);
setCubemap(nullptr); setCubemap(nullptr);
} }

View file

@ -35,7 +35,7 @@ public:
void setCubemap(const gpu::TexturePointer& cubemap); void setCubemap(const gpu::TexturePointer& cubemap);
const gpu::TexturePointer& getCubemap() const { return _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(); virtual void clear();
void prepare(gpu::Batch& batch, int textureSlot = SKYBOX_SKYMAP_SLOT, int bufferSlot = SKYBOX_CONSTANTS_SLOT) const; 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_SKYMAP_SLOT { 0 };
static const int SKYBOX_CONSTANTS_SLOT { 0 }; static const int SKYBOX_CONSTANTS_SLOT { 0 };
gpu::TexturePointer _cubemap;
class Schema { class Schema {
public: public:
glm::vec3 color { 0.0f, 0.0f, 0.0f }; glm::vec3 color { 0.0f, 0.0f, 0.0f };
float blend { 0.0f }; float blend { 0.0f };
}; };
mutable gpu::BufferView _schemaBuffer;
void updateSchemaBuffer() const; void updateSchemaBuffer() const;
mutable gpu::BufferView _schemaBuffer;
gpu::TexturePointer _cubemap;
bool _empty{ true };
}; };
typedef std::shared_ptr<Skybox> SkyboxPointer; typedef std::shared_ptr<Skybox> SkyboxPointer;