History

Merge remote-tracking branch 'upstream/master' into android

Brad Davis committed 8 years ago

Commit 6a06bf42 parents b422321 d4571bd188 files · +1191 −774Browse files

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

Unified · Split

libraries/render-utils/src/DeferredLightingEffect.cpp+21−21
@@ -106,13 +106,13 @@ void DeferredLightingEffect::init() { · 105 unmodified lines
106 106
107void DeferredLightingEffect::setupKeyLightBatch(const RenderArgs* args, gpu::Batch& batch, int lightBufferUnit, int ambientBufferUnit, int skyboxCubemapUnit) {107void DeferredLightingEffect::setupKeyLightBatch(const RenderArgs* args, gpu::Batch& batch, int lightBufferUnit, int ambientBufferUnit, int skyboxCubemapUnit) {
108 PerformanceTimer perfTimer("DLE->setupBatch()");108 PerformanceTimer perfTimer("DLE->setupBatch()");
109 model::LightPointer keySunLight;109 graphics::LightPointer keySunLight;
110 auto lightStage = args->_scene->getStage<LightStage>();110 auto lightStage = args->_scene->getStage<LightStage>();
111 if (lightStage) {111 if (lightStage) {
112 keySunLight = lightStage->getCurrentKeyLight();112 keySunLight = lightStage->getCurrentKeyLight();
113 }113 }
114 114
115 model::LightPointer keyAmbiLight;115 graphics::LightPointer keyAmbiLight;
116 if (lightStage) {116 if (lightStage) {
117 keyAmbiLight = lightStage->getCurrentAmbientLight();117 keyAmbiLight = lightStage->getCurrentAmbientLight();
118 }118 }
@@ -232,9 +232,9 @@ static void loadLightProgram(const char* vertSource, const char* fragSource, boo · 113 unmodified lines
232 232
233#include <shared/Shapes.h>233#include <shared/Shapes.h>
234 234
235model::MeshPointer DeferredLightingEffect::getPointLightMesh() {235graphics::MeshPointer DeferredLightingEffect::getPointLightMesh() {
236 if (!_pointLightMesh) {236 if (!_pointLightMesh) {
237 _pointLightMesh = std::make_shared<model::Mesh>();237 _pointLightMesh = std::make_shared<graphics::Mesh>();
238 238
239 // let's use a icosahedron239 // let's use a icosahedron
240 auto solid = geometry::icosahedron();240 auto solid = geometry::icosahedron();
@@ -259,19 +259,19 @@ model::MeshPointer DeferredLightingEffect::getPointLightMesh() { · 18 unmodified lines
259 delete[] indexData;259 delete[] indexData;
260 260
261 261
262 std::vector<model::Mesh::Part> parts;262 std::vector<graphics::Mesh::Part> parts;
263 parts.push_back(model::Mesh::Part(0, nbIndices, 0, model::Mesh::TRIANGLES));263 parts.push_back(graphics::Mesh::Part(0, nbIndices, 0, graphics::Mesh::TRIANGLES));
264 parts.push_back(model::Mesh::Part(0, nbIndices, 0, model::Mesh::LINE_STRIP)); // outline version264 parts.push_back(graphics::Mesh::Part(0, nbIndices, 0, graphics::Mesh::LINE_STRIP)); // outline version
265 265
266 266
267 _pointLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));267 _pointLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
268 }268 }
269 return _pointLightMesh;269 return _pointLightMesh;
270}270}
271 271
272model::MeshPointer DeferredLightingEffect::getSpotLightMesh() {272graphics::MeshPointer DeferredLightingEffect::getSpotLightMesh() {
273 if (!_spotLightMesh) {273 if (!_spotLightMesh) {
274 _spotLightMesh = std::make_shared<model::Mesh>();274 _spotLightMesh = std::make_shared<graphics::Mesh>();
275 275
276 int slices = 16;276 int slices = 16;
277 int rings = 3;277 int rings = 3;
@@ -356,12 +356,12 @@ model::MeshPointer DeferredLightingEffect::getSpotLightMesh() { · 78 unmodified lines
356 delete[] indexData;356 delete[] indexData;
357 357
358 358
359 std::vector<model::Mesh::Part> parts;359 std::vector<graphics::Mesh::Part> parts;
360 parts.push_back(model::Mesh::Part(0, indices, 0, model::Mesh::TRIANGLES));360 parts.push_back(graphics::Mesh::Part(0, indices, 0, graphics::Mesh::TRIANGLES));
361 parts.push_back(model::Mesh::Part(0, indices, 0, model::Mesh::LINE_STRIP)); // outline version361 parts.push_back(graphics::Mesh::Part(0, indices, 0, graphics::Mesh::LINE_STRIP)); // outline version
362 362
363 363
364 _spotLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(model::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));364 _spotLightMesh->setPartBuffer(gpu::BufferView(new gpu::Buffer(parts.size() * sizeof(graphics::Mesh::Part), (gpu::Byte*) parts.data()), gpu::Element::PART_DRAWCALL));
365 }365 }
366 return _spotLightMesh;366 return _spotLightMesh;
367}367}
@@ -442,7 +442,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, · 74 unmodified lines
442 const DeferredFrameTransformPointer& frameTransform,442 const DeferredFrameTransformPointer& frameTransform,
443 const DeferredFramebufferPointer& deferredFramebuffer,443 const DeferredFramebufferPointer& deferredFramebuffer,
444 const LightingModelPointer& lightingModel,444 const LightingModelPointer& lightingModel,
445 const model::HazePointer& haze,445 const graphics::HazePointer& haze,
446 const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer,446 const SurfaceGeometryFramebufferPointer& surfaceGeometryFramebuffer,
447 const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer,447 const AmbientOcclusionFramebufferPointer& ambientOcclusionFramebuffer,
448 const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource) {448 const SubsurfaceScatteringResourcePointer& subsurfaceScatteringResource) {
@@ -516,7 +516,7 @@ void RenderDeferredSetup::run(const render::RenderContextPointer& renderContext, · 67 unmodified lines
516 516
517 auto keyLight = lightAndShadow.first;517 auto keyLight = lightAndShadow.first;
518 518
519 model::LightPointer keyAmbientLight;519 graphics::LightPointer keyAmbientLight;
520 if (lightStage && lightStage->_currentFrame._ambientLights.size()) {520 if (lightStage && lightStage->_currentFrame._ambientLights.size()) {
521 keyAmbientLight = lightStage->getLight(lightStage->_currentFrame._ambientLights.front());521 keyAmbientLight = lightStage->getLight(lightStage->_currentFrame._ambientLights.front());
522 }522 }
@@ -749,12 +749,12 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { · 226 unmodified lines
749 if (lightStage) { 749 if (lightStage) {
750 750
751 // Allocate a default global light directional and ambient751 // Allocate a default global light directional and ambient
752 auto lp = std::make_shared<model::Light>();752 auto lp = std::make_shared<graphics::Light>();
753 lp->setType(model::Light::SUN);753 lp->setType(graphics::Light::SUN);
754 lp->setDirection(glm::vec3(-1.0f));754 lp->setDirection(glm::vec3(-1.0f));
755 lp->setColor(glm::vec3(1.0f));755 lp->setColor(glm::vec3(1.0f));
756 lp->setIntensity(1.0f);756 lp->setIntensity(1.0f);
757 lp->setType(model::Light::SUN);757 lp->setType(graphics::Light::SUN);
758 lp->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE);758 lp->setAmbientSpherePreset(gpu::SphericalHarmonics::Preset::OLD_TOWN_SQUARE);
759 759
760 lp->setAmbientIntensity(0.5f);760 lp->setAmbientIntensity(0.5f);
@@ -776,7 +776,7 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { · 15 unmodified lines
776 auto backgroundStage = renderContext->_scene->getStage<BackgroundStage>();776 auto backgroundStage = renderContext->_scene->getStage<BackgroundStage>();
777 if (backgroundStage) {777 if (backgroundStage) {
778 778
779 auto background = std::make_shared<model::SunSkyStage>();779 auto background = std::make_shared<graphics::SunSkyStage>();
780 background->setSkybox(_defaultSkybox);780 background->setSkybox(_defaultSkybox);
781 781
782 // capture deault background782 // capture deault background
@@ -791,7 +791,7 @@ void DefaultLightingSetup::run(const RenderContextPointer& renderContext) { · 8 unmodified lines
791 auto hazeStage = renderContext->_scene->getStage<HazeStage>();791 auto hazeStage = renderContext->_scene->getStage<HazeStage>();
792 if (hazeStage) {792 if (hazeStage) {
793 793
794 auto haze = std::make_shared<model::Haze>();794 auto haze = std::make_shared<graphics::Haze>();
795 795
796 _defaultHaze = haze;796 _defaultHaze = haze;
797 _defaultHazeID = hazeStage->addHaze(_defaultHaze);797 _defaultHazeID = hazeStage->addHaze(_defaultHaze);