mirror of
https://github.com/lubosz/overte.git
synced 2025-04-10 04:28:59 +02:00
detect unset skybox
This commit is contained in:
parent
89b00883dd
commit
c740b263a8
5 changed files with 11 additions and 4 deletions
|
@ -4326,7 +4326,7 @@ namespace render {
|
|||
}
|
||||
case model::SunSkyStage::SKY_BOX: {
|
||||
auto skybox = skyStage->getSkybox();
|
||||
if (skybox) {
|
||||
if (!skybox->empty()) {
|
||||
PerformanceTimer perfTimer("skybox");
|
||||
skybox->render(batch, args->getViewFrustum());
|
||||
break;
|
||||
|
|
|
@ -35,6 +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 void clear() { setCubemap(nullptr); }
|
||||
|
||||
void prepare(gpu::Batch& batch, int textureSlot = SKYBOX_SKYMAP_SLOT, int bufferSlot = SKYBOX_CONSTANTS_SLOT) const;
|
||||
|
|
|
@ -38,6 +38,7 @@ public:
|
|||
void parse(const QString& userDataJson);
|
||||
|
||||
bool ready();
|
||||
bool enabled() { return _enabled; }
|
||||
void prepare(gpu::Batch& batch, const glm::vec3& position, const glm::vec3& size, const glm::quat& orientation);
|
||||
const gpu::ShaderPointer& getShader() const { return _shader; }
|
||||
|
||||
|
|
|
@ -26,6 +26,10 @@ ProceduralSkybox::ProceduralSkybox() : model::Skybox() {
|
|||
_procedural._opaqueState->setStencilTest(true, 0xFF, gpu::State::StencilTest(0, 0xFF, gpu::EQUAL, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP, gpu::State::STENCIL_OP_KEEP));
|
||||
}
|
||||
|
||||
bool ProceduralSkybox::empty() {
|
||||
return !_procedural.enabled() && Skybox::empty();
|
||||
}
|
||||
|
||||
void ProceduralSkybox::clear() {
|
||||
// Parse and prepare a procedural with no shaders to release textures
|
||||
parse(QString());
|
||||
|
|
|
@ -20,13 +20,14 @@
|
|||
class ProceduralSkybox: public model::Skybox {
|
||||
public:
|
||||
ProceduralSkybox();
|
||||
virtual ~ProceduralSkybox() {};
|
||||
~ProceduralSkybox() override {};
|
||||
|
||||
void parse(const QString& userData) { _procedural.parse(userData); }
|
||||
|
||||
virtual void clear() override;
|
||||
bool empty() override;
|
||||
void clear() override;
|
||||
|
||||
virtual void render(gpu::Batch& batch, const ViewFrustum& frustum) const override;
|
||||
void render(gpu::Batch& batch, const ViewFrustum& frustum) const override;
|
||||
static void render(gpu::Batch& batch, const ViewFrustum& frustum, const ProceduralSkybox& skybox);
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Reference in a new issue