Showing the changes to libraries/render-utils/src/DeferredLightingEffect.cpp (1 of 71 files). Show all
Unified · Split
| @@ -103,13 +103,13 @@ void DeferredLightingEffect::init() { · 102 unmodified lines | |||
| 103 | 103 | ||
| 104 | void DeferredLightingEffect::setupKeyLightBatch(const RenderArgs* args, gpu::Batch& batch, int lightBufferUnit, int ambientBufferUnit, int skyboxCubemapUnit) { | 104 | void DeferredLightingEffect::setupKeyLightBatch(const RenderArgs* args, gpu::Batch& batch, int lightBufferUnit, int ambientBufferUnit, int skyboxCubemapUnit) { |
| 105 | PerformanceTimer perfTimer("DLE->setupBatch()"); | 105 | PerformanceTimer perfTimer("DLE->setupBatch()"); |
| 106 | model::LightPointer keySunLight; | 106 | graphics::LightPointer keySunLight; |
| 107 | auto lightStage = args->_scene->getStage<LightStage>(); | 107 | auto lightStage = args->_scene->getStage<LightStage>(); |
| 108 | if (lightStage) { | 108 | if (lightStage) { |
| 109 | keySunLight = lightStage->getCurrentKeyLight(); | 109 | keySunLight = lightStage->getCurrentKeyLight(); |
| 110 | } | 110 | } |
| 111 | 111 | ||
| 112 | model::LightPointer keyAmbiLight; | 112 | graphics::LightPointer keyAmbiLight; |
| 113 | if (lightStage) { | 113 | if (lightStage) { |
| 114 | keyAmbiLight = lightStage->getCurrentAmbientLight(); | 114 | keyAmbiLight = lightStage->getCurrentAmbientLight(); |
| 115 | } | 115 | } |
| @@ -229,9 +229,9 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo · 113 unmodified lines | |||
| 229 | 229 | ||
| 230 | #include <shared/Shapes.h> | 230 | #include <shared/Shapes.h> |
| 231 | 231 | ||
| 232 | model::MeshPointer DeferredLightingEffect::getPointLightMesh() { | 232 | graphics::MeshPointer DeferredLightingEffect::getPointLightMesh() { |
| 233 | if (!_pointLightMesh) { | 233 | if (!_pointLightMesh) { |
| 234 | _pointLightMesh = std::make_shared<model::Mesh>(); | 234 | _pointLightMesh = std::make_shared<graphics::Mesh>(); |
| 235 | 235 | ||
| 236 | // let's use a icosahedron | 236 | // let's use a icosahedron |
| 237 | auto solid = geometry::icosahedron(); | 237 | auto solid = geometry::icosahedron(); |
| @@ -256,19 +256,19 @@ model::MeshPointer DeferredLightingEffect::getPointLightMesh() { · 18 unmodified lines | |||
| 256 | delete[] indexData; | 256 | delete[] indexData; |
| 257 | 257 | ||
| 258 | 258 | ||
| 259 | std::vector<model::Mesh::Part> parts; | 259 | std::vector<graphics::Mesh::Part> parts; |
| 260 | parts.push_back(model::Mesh::Part(0, nbIndices, 0, model::Mesh::TRIANGLES)); | 260 | parts.push_back(graphics::Mesh::Part(0, nbIndices, 0, graphics::Mesh::TRIANGLES)); |
| 261 | parts.push_back(model::Mesh::Part(0, nbIndices, 0, model::Mesh::LINE_STRIP)); // outline version | 261 | parts.push_back(graphics::Mesh::Part(0, nbIndices, 0, graphics::Mesh::LINE_STRIP)); // outline version |
| 262 | 262 | ||
| 263 | 263 | ||
| 264 | _pointLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); | 264 | _pointLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); |
| 265 | } | 265 | } |
| 266 | return _pointLightMesh; | 266 | return _pointLightMesh; |
| 267 | } | 267 | } |
| 268 | 268 | ||
| 269 | model::MeshPointer DeferredLightingEffect::getSpotLightMesh() { | 269 | graphics::MeshPointer DeferredLightingEffect::getSpotLightMesh() { |
| 270 | if (!_spotLightMesh) { | 270 | if (!_spotLightMesh) { |
| 271 | _spotLightMesh = std::make_shared<model::Mesh>(); | 271 | _spotLightMesh = std::make_shared<graphics::Mesh>(); |
| 272 | 272 | ||
| 273 | int slices = 16; | 273 | int slices = 16; |
| 274 | int rings = 3; | 274 | int rings = 3; |
| @@ -353,12 +353,12 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() { · 78 unmodified lines | |||
| 353 | delete[] indexData; | 353 | delete[] indexData; |
| 354 | 354 | ||
| 355 | 355 | ||
| 356 | std::vector<model::Mesh::Part> parts; | 356 | std::vector<graphics::Mesh::Part> parts; |
| 357 | parts.push_back(model::Mesh::Part(0, indices, 0, model::Mesh::TRIANGLES)); | 357 | parts.push_back(graphics::Mesh::Part(0, indices, 0, graphics::Mesh::TRIANGLES)); |
| 358 | parts.push_back(model::Mesh::Part(0, indices, 0, model::Mesh::LINE_STRIP)); // outline version | 358 | parts.push_back(graphics::Mesh::Part(0, indices, 0, graphics::Mesh::LINE_STRIP)); // outline version |
| 359 | 359 | ||
| 360 | 360 | ||
| 361 | _spotLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); | 361 | _spotLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL)); |
| 362 | } | 362 | } |
| 363 | return _spotLightMesh; | 363 | return _spotLightMesh; |
| 364 | } | 364 | } |
| @@ -439,7 +439,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, · 74 unmodified lines | |||
| 439 | const DeferredFrameTransformPointer& frameTransform, | 439 | const DeferredFrameTransformPointer& frameTransform, |
| 440 | const DeferredFramebufferPointer& deferredFramebuffer, | 440 | const DeferredFramebufferPointer& deferredFramebuffer, |
| 441 | const LightingModelPointer& lightingModel, | 441 | const LightingModelPointer& lightingModel, |
| 442 | const model::HazePointer& haze, | 442 | const graphics::HazePointer& haze, |
| 443 | const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer, | 443 | const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer, |
| 444 | const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer, | 444 | const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer, |
| 445 | const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource) { | 445 | const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource) { |
| @@ -513,7 +513,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, · 67 unmodified lines | |||
| 513 | 513 | ||
| 514 | auto keyLight = lightAndShadow.first; | 514 | auto keyLight = lightAndShadow.first; |
| 515 | 515 | ||
| 516 | model::LightPointer keyAmbientLight; | 516 | graphics::LightPointer keyAmbientLight; |
| 517 | if (lightStage && lightStage->_currentFrame._ambientLights.size()) { | 517 | if (lightStage && lightStage->_currentFrame._ambientLights.size()) { |
| 518 | keyAmbientLight = lightStage->getLight(lightStage->_currentFrame._ambientLights.front()); | 518 | keyAmbientLight = lightStage->getLight(lightStage->_currentFrame._ambientLights.front()); |
| 519 | } | 519 | } |
| @@ -744,12 +744,12 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { · 224 unmodified lines | |||
| 744 | if (lightStage) { | 744 | if (lightStage) { |
| 745 | 745 | ||
| 746 | // Allocate a default global light directional and ambient | 746 | // Allocate a default global light directional and ambient |
| 747 | auto lp = std::make_shared<model::Light>(); | 747 | auto lp = std::make_shared<graphics::Light>(); |
| 748 | lp->setType(model::Light::SUN); | 748 | lp->setType(graphics::Light::SUN); |
| 749 | lp->setDirection(glm::vec3(-1.0f)); | 749 | lp->setDirection(glm::vec3(-1.0f)); |
| 750 | lp->setColor(glm::vec3(1.0f)); | 750 | lp->setColor(glm::vec3(1.0f)); |
| 751 | lp->setIntensity(1.0f); | 751 | lp->setIntensity(1.0f); |
| 752 | lp->setType(model::Light::SUN); | 752 | lp->setType(graphics::Light::SUN); |
| 753 | lp->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE); | 753 | lp->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE); |
| 754 | 754 | ||
| 755 | lp->setAmbientIntensity(0.5f); | 755 | lp->setAmbientIntensity(0.5f); |
| @@ -771,7 +771,7 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { · 15 unmodified lines | |||
| 771 | auto backgroundStage = renderContext->_scene->getStage<BackgroundStage>(); | 771 | auto backgroundStage = renderContext->_scene->getStage<BackgroundStage>(); |
| 772 | if (backgroundStage) { | 772 | if (backgroundStage) { |
| 773 | 773 | ||
| 774 | auto background = std::make_shared<model::SunSkyStage>(); | 774 | auto background = std::make_shared<graphics::SunSkyStage>(); |
| 775 | background->setSkybox(_defaultSkybox); | 775 | background->setSkybox(_defaultSkybox); |
| 776 | 776 | ||
| 777 | // capture deault background | 777 | // capture deault background |
| @@ -786,7 +786,7 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { · 8 unmodified lines | |||
| 786 | auto hazeStage = renderContext->_scene->getStage<HazeStage>(); | 786 | auto hazeStage = renderContext->_scene->getStage<HazeStage>(); |
| 787 | if (hazeStage) { | 787 | if (hazeStage) { |
| 788 | 788 | ||
| 789 | auto haze = std::make_shared<model::Haze>(); | 789 | auto haze = std::make_shared<graphics::Haze>(); |
| 790 | 790 | ||
| 791 | _defaultHaze = haze; | 791 | _defaultHaze = haze; |
| 792 | _defaultHazeID = hazeStage->addHaze(_defaultHaze); | 792 | _defaultHazeID = hazeStage->addHaze(_defaultHaze); |