mirror of
https://github.com/JulianGro/overte.git
synced 2025-08-08 17:46:56 +02:00
Refining the shader for key and testing removing completely the code dealing with Zone lighting in the ENtityTreeREnderer
This commit is contained in:
parent
36ac623e66
commit
589bcc19ce
4 changed files with 24 additions and 20 deletions
|
@ -141,7 +141,7 @@ void EntityTreeRenderer::clear() {
|
||||||
|
|
||||||
// reset the zone to the default (while we load the next scene)
|
// reset the zone to the default (while we load the next scene)
|
||||||
_layeredZones.clear();
|
_layeredZones.clear();
|
||||||
applyZoneAndHasSkybox(nullptr);
|
// applyZoneAndHasSkybox(nullptr);
|
||||||
|
|
||||||
OctreeRenderer::clear();
|
OctreeRenderer::clear();
|
||||||
}
|
}
|
||||||
|
@ -198,11 +198,11 @@ void EntityTreeRenderer::update() {
|
||||||
|
|
||||||
// If we haven't already updated and previously attempted to load a texture,
|
// If we haven't already updated and previously attempted to load a texture,
|
||||||
// check if the texture loaded and apply it
|
// check if the texture loaded and apply it
|
||||||
if (!updated &&
|
/* if (!updated &&
|
||||||
((_pendingAmbientTexture && (!_ambientTexture || _ambientTexture->isLoaded())) ||
|
((_pendingAmbientTexture && (!_ambientTexture || _ambientTexture->isLoaded())) ||
|
||||||
(_pendingSkyboxTexture && (!_skyboxTexture || _skyboxTexture->isLoaded())))) {
|
(_pendingSkyboxTexture && (!_skyboxTexture || _skyboxTexture->isLoaded())))) {
|
||||||
applySkyboxAndHasAmbient();
|
applySkyboxAndHasAmbient();
|
||||||
}
|
}*/
|
||||||
|
|
||||||
// Even if we're not moving the mouse, if we started clicking on an entity and we have
|
// Even if we're not moving the mouse, if we started clicking on an entity and we have
|
||||||
// not yet released the hold then this is still considered a holdingClickOnEntity event
|
// not yet released the hold then this is still considered a holdingClickOnEntity event
|
||||||
|
@ -371,7 +371,7 @@ bool EntityTreeRenderer::applyLayeredZones() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
bool EntityTreeRenderer::applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone) {
|
bool EntityTreeRenderer::applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone) {
|
||||||
auto textureCache = DependencyManager::get<TextureCache>();
|
auto textureCache = DependencyManager::get<TextureCache>();
|
||||||
auto scene = DependencyManager::get<SceneScriptingInterface>();
|
auto scene = DependencyManager::get<SceneScriptingInterface>();
|
||||||
|
@ -427,8 +427,8 @@ bool EntityTreeRenderer::applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityI
|
||||||
|
|
||||||
// Set the skybox texture
|
// Set the skybox texture
|
||||||
return layerZoneAndHasSkybox(zone);
|
return layerZoneAndHasSkybox(zone);
|
||||||
}
|
}*/
|
||||||
|
/*
|
||||||
bool EntityTreeRenderer::layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone) {
|
bool EntityTreeRenderer::layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone) {
|
||||||
assert(zone);
|
assert(zone);
|
||||||
|
|
||||||
|
@ -483,8 +483,8 @@ bool EntityTreeRenderer::layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityI
|
||||||
}
|
}
|
||||||
|
|
||||||
return hasSkybox;
|
return hasSkybox;
|
||||||
}
|
}*/
|
||||||
|
/*
|
||||||
bool EntityTreeRenderer::applySkyboxAndHasAmbient() {
|
bool EntityTreeRenderer::applySkyboxAndHasAmbient() {
|
||||||
auto textureCache = DependencyManager::get<TextureCache>();
|
auto textureCache = DependencyManager::get<TextureCache>();
|
||||||
auto scene = DependencyManager::get<SceneScriptingInterface>();
|
auto scene = DependencyManager::get<SceneScriptingInterface>();
|
||||||
|
@ -539,7 +539,7 @@ bool EntityTreeRenderer::applySkyboxAndHasAmbient() {
|
||||||
}
|
}
|
||||||
|
|
||||||
return isAmbientSet;
|
return isAmbientSet;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
const FBXGeometry* EntityTreeRenderer::getGeometryForEntity(EntityItemPointer entityItem) {
|
const FBXGeometry* EntityTreeRenderer::getGeometryForEntity(EntityItemPointer entityItem) {
|
||||||
const FBXGeometry* result = NULL;
|
const FBXGeometry* result = NULL;
|
||||||
|
@ -1169,7 +1169,7 @@ std::pair<EntityTreeRenderer::LayeredZones::iterator, bool> EntityTreeRenderer::
|
||||||
void EntityTreeRenderer::LayeredZones::apply() {
|
void EntityTreeRenderer::LayeredZones::apply() {
|
||||||
assert(_entityTreeRenderer);
|
assert(_entityTreeRenderer);
|
||||||
|
|
||||||
applyPartial(begin());
|
// applyPartial(begin());
|
||||||
}
|
}
|
||||||
|
|
||||||
void EntityTreeRenderer::LayeredZones::update(std::shared_ptr<ZoneEntityItem> zone) {
|
void EntityTreeRenderer::LayeredZones::update(std::shared_ptr<ZoneEntityItem> zone) {
|
||||||
|
@ -1211,11 +1211,11 @@ void EntityTreeRenderer::LayeredZones::update(std::shared_ptr<ZoneEntityItem> zo
|
||||||
}
|
}
|
||||||
|
|
||||||
if (shouldUpdate) {
|
if (shouldUpdate) {
|
||||||
applyPartial(layer);
|
// applyPartial(layer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
void EntityTreeRenderer::LayeredZones::applyPartial(iterator layer) {
|
void EntityTreeRenderer::LayeredZones::applyPartial(iterator layer) {
|
||||||
bool hasSkybox = false;
|
bool hasSkybox = false;
|
||||||
_skyboxLayer = end();
|
_skyboxLayer = end();
|
||||||
|
@ -1243,7 +1243,7 @@ void EntityTreeRenderer::LayeredZones::applyPartial(iterator layer) {
|
||||||
|
|
||||||
_skyboxLayer = layer;
|
_skyboxLayer = layer;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
bool EntityTreeRenderer::LayeredZones::contains(const LayeredZones& other) {
|
bool EntityTreeRenderer::LayeredZones::contains(const LayeredZones& other) {
|
||||||
bool result = std::equal(other.begin(), other._skyboxLayer, begin());
|
bool result = std::equal(other.begin(), other._skyboxLayer, begin());
|
||||||
if (result) {
|
if (result) {
|
||||||
|
|
|
@ -147,9 +147,9 @@ private:
|
||||||
void addEntityToScene(EntityItemPointer entity);
|
void addEntityToScene(EntityItemPointer entity);
|
||||||
bool findBestZoneAndMaybeContainingEntities(QVector<EntityItemID>* entitiesContainingAvatar = nullptr);
|
bool findBestZoneAndMaybeContainingEntities(QVector<EntityItemID>* entitiesContainingAvatar = nullptr);
|
||||||
|
|
||||||
bool applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
|
// bool applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
|
||||||
bool layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
|
// bool layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
|
||||||
bool applySkyboxAndHasAmbient();
|
// bool applySkyboxAndHasAmbient();
|
||||||
bool applyLayeredZones();
|
bool applyLayeredZones();
|
||||||
|
|
||||||
void checkAndCallPreload(const EntityItemID& entityID, bool reload = false, bool unloadFirst = false);
|
void checkAndCallPreload(const EntityItemID& entityID, bool reload = false, bool unloadFirst = false);
|
||||||
|
@ -223,7 +223,7 @@ private:
|
||||||
std::shared_ptr<ZoneEntityItem> getZone() { return empty() ? nullptr : begin()->zone; }
|
std::shared_ptr<ZoneEntityItem> getZone() { return empty() ? nullptr : begin()->zone; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void applyPartial(iterator layer);
|
// void applyPartial(iterator layer);
|
||||||
|
|
||||||
std::map<QUuid, iterator> _map;
|
std::map<QUuid, iterator> _map;
|
||||||
iterator _skyboxLayer{ end() };
|
iterator _skyboxLayer{ end() };
|
||||||
|
|
|
@ -160,8 +160,11 @@ void DeferredLightingEffect::init() {
|
||||||
|
|
||||||
|
|
||||||
lp->setAmbientIntensity(0.5f);
|
lp->setAmbientIntensity(0.5f);
|
||||||
lp->setAmbientMap(_defaultSkyboxAmbientTexture);
|
lp->setAmbientMap(_defaultSkyboxAmbientTexture);
|
||||||
|
auto irradianceSH = _defaultSkyboxAmbientTexture->getIrradiance();
|
||||||
|
if (irradianceSH) {
|
||||||
|
lp->setAmbientSphere((*irradianceSH));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeferredLightingEffect::setupKeyLightBatch(gpu::Batch& batch, int lightBufferUnit, int ambientBufferUnit, int skyboxCubemapUnit) {
|
void DeferredLightingEffect::setupKeyLightBatch(gpu::Batch& batch, int lightBufferUnit, int ambientBufferUnit, int skyboxCubemapUnit) {
|
||||||
|
|
|
@ -45,7 +45,8 @@ void main(void) {
|
||||||
vec3 inSpherePos = normalize(vec3(inSphereUV, sqrt(1.0 - dot(inSphereUV.xy, inSphereUV.xy))));
|
vec3 inSpherePos = normalize(vec3(inSphereUV, sqrt(1.0 - dot(inSphereUV.xy, inSphereUV.xy))));
|
||||||
vec3 inNormal = vec3(getViewInverse() * vec4(inSpherePos, 0.0));
|
vec3 inNormal = vec3(getViewInverse() * vec4(inSpherePos, 0.0));
|
||||||
|
|
||||||
color += lightIrradiance * vec3(dot(-lightDirection, inNormal));
|
vec3 marbleColor = max(lightIrradiance * vec3(dot(-lightDirection, inNormal)), vec3(0.01));
|
||||||
|
color += marbleColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
color = color * 1.0 - base.w + base.xyz * base.w;
|
color = color * 1.0 - base.w + base.xyz * base.w;
|
||||||
|
|
Loading…
Reference in a new issue