History

REarrange the light stage construction and light frame usage to produce the light clusters

samcake committed 10 years ago

Commit 821072b1 parent 7a7a60a11 files · +128 −50Browse files

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

Unified · Split

libraries/render-utils/src/DeferredLightingEffect.cpp+8−3
@@ -118,9 +118,7 @@ void DeferredLightingEffect::init() { · 117 unmodified lines
118 118
119 // Light Stage and clusters119 // Light Stage and clusters
120 _lightStage = std::make_shared<LightStage>();120 _lightStage = std::make_shared<LightStage>();
121 _lightClusters = std::make_shared<LightClusters>();121
122 _lightClusters->updateLightStage(_lightStage);
123
124 // Allocate a global light representing the Global Directional light casting shadow (the sun) and the ambient light122 // Allocate a global light representing the Global Directional light casting shadow (the sun) and the ambient light
125 _allocatedLights.push_back(std::make_shared<model::Light>());123 _allocatedLights.push_back(std::make_shared<model::Light>());
126 model::LightPointer lp = _allocatedLights[0];124 model::LightPointer lp = _allocatedLights[0];
@@ -146,6 +144,7 @@ void DeferredLightingEffect::addLight(const model::LightPointer& light) { · 19 unmodified lines
146 }144 }
147}145}
148 146
147
149void DeferredLightingEffect::addPointLight(const glm::vec3& position, float radius, const glm::vec3& color,148void DeferredLightingEffect::addPointLight(const glm::vec3& position, float radius, const glm::vec3& color,
150 float intensity, float falloffRadius) {149 float intensity, float falloffRadius) {
151 addSpotLight(position, radius, color, intensity, falloffRadius);150 addSpotLight(position, radius, color, intensity, falloffRadius);
@@ -472,6 +471,7 @@ void PreparePrimaryFramebuffer::run(const SceneContextPointer& sceneContext, con · 320 unmodified lines
472 }471 }
473 _primaryFramebuffer->resize(frameSize.x, frameSize.y);472 _primaryFramebuffer->resize(frameSize.x, frameSize.y);
474 473
474
475 primaryFramebuffer = _primaryFramebuffer;475 primaryFramebuffer = _primaryFramebuffer;
476}476}
477 477
@@ -508,6 +508,11 @@ void PrepareDeferred::run(const SceneContextPointer& sceneContext, const RenderC · 30 unmodified lines
508 // For the rest of the rendering, bind the lighting model508 // For the rest of the rendering, bind the lighting model
509 batch.setUniformBuffer(LIGHTING_MODEL_BUFFER_SLOT, lightingModel->getParametersBuffer());509 batch.setUniformBuffer(LIGHTING_MODEL_BUFFER_SLOT, lightingModel->getParametersBuffer());
510 });510 });
511
512
513 // Prepare a fresh Light Frame
514 auto deferredLightingEffect = DependencyManager::get<DeferredLightingEffect>();
515 deferredLightingEffect->getLightStage()->_currentFrame.clear();
511}516}
512 517
513 518

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