mirror of
https://github.com/overte-org/overte.git
synced 2025-04-16 13:56:24 +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 <SceneScriptingInterface.h>
|
||||
#include <ScriptEngine.h>
|
||||
#include <procedural/Procedural.h>
|
||||
#include <procedural/ProceduralSkybox.h>
|
||||
#include <TextureCache.h>
|
||||
|
||||
#include "EntityTreeRenderer.h"
|
||||
|
@ -294,17 +294,17 @@ void EntityTreeRenderer::applyZonePropertiesToScene(std::shared_ptr<ZoneEntityIt
|
|||
_viewState->endOverrideEnvironmentData();
|
||||
auto stage = scene->getSkyStage();
|
||||
if (zone->getBackgroundMode() == BACKGROUND_MODE_SKYBOX) {
|
||||
auto skybox = stage->getSkybox();
|
||||
auto skybox = std::dynamic_pointer_cast<ProceduralSkybox>(stage->getSkybox());
|
||||
skybox->setColor(zone->getSkyboxProperties().getColorVec3());
|
||||
static QString userData;
|
||||
if (userData != zone->getUserData()) {
|
||||
userData = zone->getUserData();
|
||||
/* QSharedPointer<Procedural> procedural(new Procedural(userData));
|
||||
ProceduralPointer procedural(new Procedural(userData));
|
||||
if (procedural->_enabled) {
|
||||
skybox->setProcedural(procedural);
|
||||
} else {
|
||||
skybox->setProcedural(QSharedPointer<Procedural>());
|
||||
}*/
|
||||
skybox->setProcedural(ProceduralPointer());
|
||||
}
|
||||
}
|
||||
if (zone->getSkyboxProperties().getURL().isEmpty()) {
|
||||
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::Stream::FormatPointer theFormat;
|
||||
|
||||
if (skybox._procedural || skybox.getCubemap()) {
|
||||
if (skybox.getCubemap()) {
|
||||
if (!theBuffer) {
|
||||
const float CLIP = 1.0f;
|
||||
const glm::vec2 vertices[4] = { { -CLIP, -CLIP }, { CLIP, -CLIP }, { -CLIP, CLIP }, { CLIP, CLIP } };
|
||||
|
|
|
@ -16,8 +16,6 @@
|
|||
#include "Light.h"
|
||||
|
||||
class ViewFrustum;
|
||||
struct Procedural;
|
||||
typedef std::shared_ptr<Procedural> ProceduralPointer;
|
||||
|
||||
namespace gpu { class Batch; }
|
||||
|
||||
|
@ -37,13 +35,10 @@ public:
|
|||
void setCubemap(const gpu::TexturePointer& 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);
|
||||
|
||||
protected:
|
||||
gpu::TexturePointer _cubemap;
|
||||
ProceduralPointer _procedural;
|
||||
Color _color{1.0f, 1.0f, 1.0f};
|
||||
};
|
||||
typedef std::shared_ptr< Skybox > SkyboxPointer;
|
||||
|
|
|
@ -204,7 +204,6 @@ SunSkyStage::SunSkyStage() :
|
|||
// Begining of march
|
||||
setYearTime(60.0f);
|
||||
|
||||
_skybox = std::make_shared<Skybox>();
|
||||
_skybox->setColor(Color(1.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,12 @@
|
|||
ProceduralSkybox::ProceduralSkybox() : model::Skybox() {
|
||||
}
|
||||
|
||||
ProceduralSkybox::ProceduralSkybox(const ProceduralSkybox& skybox) :
|
||||
model::Skybox(skybox),
|
||||
_procedural(skybox._procedural) {
|
||||
|
||||
}
|
||||
|
||||
void ProceduralSkybox::setProcedural(const ProceduralPointer& procedural) {
|
||||
_procedural = procedural;
|
||||
if (_procedural) {
|
||||
|
|
|
@ -17,9 +17,12 @@
|
|||
|
||||
#include "Procedural.h"
|
||||
|
||||
typedef std::shared_ptr<Procedural> ProceduralPointer;
|
||||
|
||||
class ProceduralSkybox: public model::Skybox {
|
||||
public:
|
||||
ProceduralSkybox();
|
||||
ProceduralSkybox(const ProceduralSkybox& skybox);
|
||||
ProceduralSkybox& operator= (const ProceduralSkybox& skybox);
|
||||
virtual ~ProceduralSkybox() {};
|
||||
|
||||
|
|
|
@ -9,12 +9,17 @@
|
|||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "SceneScriptingInterface.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) {
|
||||
_skyStage->setOriginOrientation(orientation);
|
||||
|
|
|
@ -117,7 +117,7 @@ signals:
|
|||
void shouldRenderAvatarsChanged(bool shouldRenderAvatars);
|
||||
void shouldRenderEntitiesChanged(bool shouldRenderEntities);
|
||||
protected:
|
||||
SceneScriptingInterface() {};
|
||||
SceneScriptingInterface();
|
||||
~SceneScriptingInterface() {};
|
||||
|
||||
model::SunSkyStagePointer _skyStage = std::make_shared<model::SunSkyStage>();
|
||||
|
|
Loading…
Reference in a new issue