History

Post merge with Zach work for environment map

samcake committed 10 years ago

Commit 99ba0112 parents 483f9a4 7457b7322 files · +103 −80Browse files

Showing the changes to libraries/render-utils/src/DeferredLightingEffect.cpp (1 of 22 files). Show all

Unified · Split

libraries/render-utils/src/DeferredLightingEffect.cpp+14−11
@@ -87,6 +87,8 @@ void DeferredLightingEffect::init() { · 86 unmodified lines
8787 _allocatedLights.push_back(std::make_shared<model::Light>());
8888
8989 model::LightPointer lp = _allocatedLights[0];
90+ lp->setType(model::Light::SUN);
91+
9092 // Add the global light to the light stage (for later shadow rendering)
9193 _lightStage.addLight(lp);
9294
@@ -318,18 +320,18 @@ void DeferredLightingEffect::render(const render::RenderContextPointer& renderCo · 225 unmodified lines
318320 // Setup the global directional pass pipeline
319321 {
320322 if (_shadowMapEnabled) {
321− if (_skyboxTexture) {
323+ /* if (_skyboxTexture) {
322324 program = _directionalSkyboxLightShadow;
323325 locations = _directionalSkyboxLightShadowLocations;
324− } else {
326+ } else {*/
325327 program = _directionalAmbientSphereLightShadow;
326328 locations = _directionalAmbientSphereLightShadowLocations;
327329 }
328330 } else {
329− if (_skyboxTexture) {
331+ /* if (_skyboxTexture) {
330332 program = _directionalSkyboxLight;
331333 locations = _directionalSkyboxLightLocations;
332− } else {
334+ } else {*/
333335 program = _directionalAmbientSphereLight;
334336 locations = _directionalAmbientSphereLightLocations;
335337 }
@@ -560,16 +562,17 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo · 224 unmodified lines
560562 }
561563
562564 void DeferredLightingEffect::setGlobalLight(const model::LightPointer& light, const gpu::TexturePointer& skyboxTexture) {
563− _allocatedLights.front() = light;
565+ auto globalLight = _allocatedLights.front();
566+ globalLight->setDirection(light->getDirection());
567+ globalLight->setColor(light->getColor());
568+ globalLight->setIntensity(light->getIntensity());
569+ globalLight->setAmbientIntensity(light->getAmbientIntensity());
570+ globalLight->setAmbientSphere(light->getAmbientSphere());
571+
564572 _skyboxTexture = skyboxTexture;
565573
566574 // Update the available mipmap levels
567− if (_skyboxTexture) {
568− float dim = glm::max(_skyboxTexture->getHeight(), _skyboxTexture->getWidth(), _skyboxTexture->getDepth());
569− auto skyboxMipmapLevels = 1 + glm::floor(glm::log2(dim));
570− _deferredTransformBuffer[0].edit<DeferredTransform>().skyboxMipmapLevels = skyboxMipmapLevels;
571− _deferredTransformBuffer[1].edit<DeferredTransform>().skyboxMipmapLevels = skyboxMipmapLevels;
572− }
575+ globalLight->setAmbientMapNumMips((_skyboxTexture ? _skyboxTexture->evalNumMips() : 0));
573576 }
574577
575578 model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t