mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 23:17:02 +02:00
Bring back the procedural skybox
This commit is contained in:
parent
43d96afc89
commit
fa9b0930d2
8 changed files with 23 additions and 15 deletions
|
@ -22,7 +22,7 @@
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <SceneScriptingInterface.h>
|
#include <SceneScriptingInterface.h>
|
||||||
#include <ScriptEngine.h>
|
#include <ScriptEngine.h>
|
||||||
#include <procedural/Procedural.h>
|
#include <procedural/ProceduralSkybox.h>
|
||||||
#include <TextureCache.h>
|
#include <TextureCache.h>
|
||||||
|
|
||||||
#include "EntityTreeRenderer.h"
|
#include "EntityTreeRenderer.h"
|
||||||
|
@ -294,17 +294,17 @@ void EntityTreeRenderer::applyZonePropertiesToScene(std::shared_ptr<ZoneEntityIt
|
||||||
_viewState->endOverrideEnvironmentData();
|
_viewState->endOverrideEnvironmentData();
|
||||||
auto stage = scene->getSkyStage();
|
auto stage = scene->getSkyStage();
|
||||||
if (zone->getBackgroundMode() == BACKGROUND_MODE_SKYBOX) {
|
if (zone->getBackgroundMode() == BACKGROUND_MODE_SKYBOX) {
|
||||||
auto skybox = stage->getSkybox();
|
auto skybox = std::dynamic_pointer_cast<ProceduralSkybox>(stage->getSkybox());
|
||||||
skybox->setColor(zone->getSkyboxProperties().getColorVec3());
|
skybox->setColor(zone->getSkyboxProperties().getColorVec3());
|
||||||
static QString userData;
|
static QString userData;
|
||||||
if (userData != zone->getUserData()) {
|
if (userData != zone->getUserData()) {
|
||||||
userData = zone->getUserData();
|
userData = zone->getUserData();
|
||||||
/* QSharedPointer<Procedural> procedural(new Procedural(userData));
|
ProceduralPointer procedural(new Procedural(userData));
|
||||||
if (procedural->_enabled) {
|
if (procedural->_enabled) {
|
||||||
skybox->setProcedural(procedural);
|
skybox->setProcedural(procedural);
|
||||||
} else {
|
} else {
|
||||||
skybox->setProcedural(QSharedPointer<Procedural>());
|
skybox->setProcedural(ProceduralPointer());
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
if (zone->getSkyboxProperties().getURL().isEmpty()) {
|
if (zone->getSkyboxProperties().getURL().isEmpty()) {
|
||||||
skybox->setCubemap(gpu::TexturePointer());
|
skybox->setCubemap(gpu::TexturePointer());
|
||||||
|
|
|
@ -48,7 +48,7 @@ void Skybox::render(gpu::Batch& batch, const ViewFrustum& viewFrustum, const Sky
|
||||||
static gpu::BufferPointer theBuffer;
|
static gpu::BufferPointer theBuffer;
|
||||||
static gpu::Stream::FormatPointer theFormat;
|
static gpu::Stream::FormatPointer theFormat;
|
||||||
|
|
||||||
if (skybox._procedural || skybox.getCubemap()) {
|
if (skybox.getCubemap()) {
|
||||||
if (!theBuffer) {
|
if (!theBuffer) {
|
||||||
const float CLIP = 1.0f;
|
const float CLIP = 1.0f;
|
||||||
const glm::vec2 vertices[4] = { { -CLIP, -CLIP }, { CLIP, -CLIP }, { -CLIP, CLIP }, { CLIP, CLIP } };
|
const glm::vec2 vertices[4] = { { -CLIP, -CLIP }, { CLIP, -CLIP }, { -CLIP, CLIP }, { CLIP, CLIP } };
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
#include "Light.h"
|
#include "Light.h"
|
||||||
|
|
||||||
class ViewFrustum;
|
class ViewFrustum;
|
||||||
struct Procedural;
|
|
||||||
typedef std::shared_ptr<Procedural> ProceduralPointer;
|
|
||||||
|
|
||||||
namespace gpu { class Batch; }
|
namespace gpu { class Batch; }
|
||||||
|
|
||||||
|
@ -37,13 +35,10 @@ 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; }
|
||||||
|
|
||||||
void setProcedural(const ProceduralPointer& procedural);
|
|
||||||
|
|
||||||
static void render(gpu::Batch& batch, const ViewFrustum& frustum, const Skybox& skybox);
|
static void render(gpu::Batch& batch, const ViewFrustum& frustum, const Skybox& skybox);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
gpu::TexturePointer _cubemap;
|
gpu::TexturePointer _cubemap;
|
||||||
ProceduralPointer _procedural;
|
|
||||||
Color _color{1.0f, 1.0f, 1.0f};
|
Color _color{1.0f, 1.0f, 1.0f};
|
||||||
};
|
};
|
||||||
typedef std::shared_ptr< Skybox > SkyboxPointer;
|
typedef std::shared_ptr< Skybox > SkyboxPointer;
|
||||||
|
|
|
@ -204,7 +204,6 @@ SunSkyStage::SunSkyStage() :
|
||||||
// Begining of march
|
// Begining of march
|
||||||
setYearTime(60.0f);
|
setYearTime(60.0f);
|
||||||
|
|
||||||
_skybox = std::make_shared<Skybox>();
|
|
||||||
_skybox->setColor(Color(1.0f, 0.0f, 0.0f));
|
_skybox->setColor(Color(1.0f, 0.0f, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,12 @@
|
||||||
ProceduralSkybox::ProceduralSkybox() : model::Skybox() {
|
ProceduralSkybox::ProceduralSkybox() : model::Skybox() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProceduralSkybox::ProceduralSkybox(const ProceduralSkybox& skybox) :
|
||||||
|
model::Skybox(skybox),
|
||||||
|
_procedural(skybox._procedural) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void ProceduralSkybox::setProcedural(const ProceduralPointer& procedural) {
|
void ProceduralSkybox::setProcedural(const ProceduralPointer& procedural) {
|
||||||
_procedural = procedural;
|
_procedural = procedural;
|
||||||
if (_procedural) {
|
if (_procedural) {
|
||||||
|
|
|
@ -17,9 +17,12 @@
|
||||||
|
|
||||||
#include "Procedural.h"
|
#include "Procedural.h"
|
||||||
|
|
||||||
|
typedef std::shared_ptr<Procedural> ProceduralPointer;
|
||||||
|
|
||||||
class ProceduralSkybox: public model::Skybox {
|
class ProceduralSkybox: public model::Skybox {
|
||||||
public:
|
public:
|
||||||
ProceduralSkybox();
|
ProceduralSkybox();
|
||||||
|
ProceduralSkybox(const ProceduralSkybox& skybox);
|
||||||
ProceduralSkybox& operator= (const ProceduralSkybox& skybox);
|
ProceduralSkybox& operator= (const ProceduralSkybox& skybox);
|
||||||
virtual ~ProceduralSkybox() {};
|
virtual ~ProceduralSkybox() {};
|
||||||
|
|
||||||
|
|
|
@ -9,12 +9,17 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
|
|
||||||
|
#include "SceneScriptingInterface.h"
|
||||||
|
|
||||||
#include <AddressManager.h>
|
#include <AddressManager.h>
|
||||||
|
|
||||||
#include "SceneScriptingInterface.h"
|
|
||||||
|
|
||||||
#include "SceneScriptingInterface.h"
|
#include <procedural/ProceduralSkybox.h>
|
||||||
|
|
||||||
|
SceneScriptingInterface::SceneScriptingInterface() {
|
||||||
|
// Let's make sure the sunSkyStage is using a proceduralSKybox
|
||||||
|
_skyStage->setSkybox(model::SkyboxPointer(new ProceduralSkybox()));
|
||||||
|
}
|
||||||
|
|
||||||
void SceneScriptingInterface::setStageOrientation(const glm::quat& orientation) {
|
void SceneScriptingInterface::setStageOrientation(const glm::quat& orientation) {
|
||||||
_skyStage->setOriginOrientation(orientation);
|
_skyStage->setOriginOrientation(orientation);
|
||||||
|
|
|
@ -117,7 +117,7 @@ signals:
|
||||||
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
|
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
|
||||||
void shouldRenderEntitiesChanged(bool shouldRenderEntities);
|
void shouldRenderEntitiesChanged(bool shouldRenderEntities);
|
||||||
protected:
|
protected:
|
||||||
SceneScriptingInterface() {};
|
SceneScriptingInterface();
|
||||||
~SceneScriptingInterface() {};
|
~SceneScriptingInterface() {};
|
||||||
|
|
||||||
model::SunSkyStagePointer _skyStage = std::make_shared<model::SunSkyStage>();
|
model::SunSkyStagePointer _skyStage = std::make_shared<model::SunSkyStage>();
|
||||||
|
|
Loading…
Reference in a new issue