Refining the shader for key and testing removing completely the code dealing with Zone lighting in the ENtityTreeREnderer

This commit is contained in:
Sam Gateau 2017-05-19 17:50:19 -07:00
parent 36ac623e66
commit 589bcc19ce
4 changed files with 24 additions and 20 deletions

View file

@ -141,7 +141,7 @@ void EntityTreeRenderer::clear() {
// reset the zone to the default (while we load the next scene)
_layeredZones.clear();
applyZoneAndHasSkybox(nullptr);
// applyZoneAndHasSkybox(nullptr);
OctreeRenderer::clear();
}
@ -198,11 +198,11 @@ void EntityTreeRenderer::update() {
// If we haven't already updated and previously attempted to load a texture,
// check if the texture loaded and apply it
if (!updated &&
/* if (!updated &&
((_pendingAmbientTexture && (!_ambientTexture || _ambientTexture->isLoaded())) ||
(_pendingSkyboxTexture && (!_skyboxTexture || _skyboxTexture->isLoaded())))) {
applySkyboxAndHasAmbient();
}
}*/
// 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
@ -371,7 +371,7 @@ bool EntityTreeRenderer::applyLayeredZones() {
return true;
}
/*
bool EntityTreeRenderer::applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone) {
auto textureCache = DependencyManager::get<TextureCache>();
auto scene = DependencyManager::get<SceneScriptingInterface>();
@ -427,8 +427,8 @@ bool EntityTreeRenderer::applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityI
// Set the skybox texture
return layerZoneAndHasSkybox(zone);
}
}*/
/*
bool EntityTreeRenderer::layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone) {
assert(zone);
@ -483,8 +483,8 @@ bool EntityTreeRenderer::layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityI
}
return hasSkybox;
}
}*/
/*
bool EntityTreeRenderer::applySkyboxAndHasAmbient() {
auto textureCache = DependencyManager::get<TextureCache>();
auto scene = DependencyManager::get<SceneScriptingInterface>();
@ -539,7 +539,7 @@ bool EntityTreeRenderer::applySkyboxAndHasAmbient() {
}
return isAmbientSet;
}
}*/
const FBXGeometry* EntityTreeRenderer::getGeometryForEntity(EntityItemPointer entityItem) {
const FBXGeometry* result = NULL;
@ -1169,7 +1169,7 @@ std::pair<EntityTreeRenderer::LayeredZones::iterator, bool> EntityTreeRenderer::
void EntityTreeRenderer::LayeredZones::apply() {
assert(_entityTreeRenderer);
applyPartial(begin());
// applyPartial(begin());
}
void EntityTreeRenderer::LayeredZones::update(std::shared_ptr<ZoneEntityItem> zone) {
@ -1211,11 +1211,11 @@ void EntityTreeRenderer::LayeredZones::update(std::shared_ptr<ZoneEntityItem> zo
}
if (shouldUpdate) {
applyPartial(layer);
// applyPartial(layer);
}
}
}
/*
void EntityTreeRenderer::LayeredZones::applyPartial(iterator layer) {
bool hasSkybox = false;
_skyboxLayer = end();
@ -1243,7 +1243,7 @@ void EntityTreeRenderer::LayeredZones::applyPartial(iterator layer) {
_skyboxLayer = layer;
}
*/
bool EntityTreeRenderer::LayeredZones::contains(const LayeredZones& other) {
bool result = std::equal(other.begin(), other._skyboxLayer, begin());
if (result) {

View file

@ -147,9 +147,9 @@ private:
void addEntityToScene(EntityItemPointer entity);
bool findBestZoneAndMaybeContainingEntities(QVector<EntityItemID>* entitiesContainingAvatar = nullptr);
bool applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
bool layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
bool applySkyboxAndHasAmbient();
// bool applyZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
// bool layerZoneAndHasSkybox(const std::shared_ptr<ZoneEntityItem>& zone);
// bool applySkyboxAndHasAmbient();
bool applyLayeredZones();
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; }
private:
void applyPartial(iterator layer);
// void applyPartial(iterator layer);
std::map<QUuid, iterator> _map;
iterator _skyboxLayer{ end() };

View file

@ -160,8 +160,11 @@ void DeferredLightingEffect::init() {
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) {

View file

@ -45,7 +45,8 @@ void main(void) {
vec3 inSpherePos = normalize(vec3(inSphereUV, sqrt(1.0 - dot(inSphereUV.xy, inSphereUV.xy))));
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;