History

TransitionStage + FadeJob compiling but not linked to entity events

Olivier Prat committed 9 years ago

Commit 06d69d02 parents 4256a1f d15c4ea87 files · +1613 −729Browse files

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

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+18−17
@@ -29,6 +29,7 @@ · 28 unmodified lines
29#include "gpu/StandardShaderLib.h"29#include "gpu/StandardShaderLib.h"
30 30
31#include "model/TextureMap.h"31#include "model/TextureMap.h"
32#include "render/Args.h"
32 33
33#include "standardTransformPNTC_vert.h"34#include "standardTransformPNTC_vert.h"
34#include "standardDrawTexture_frag.h"35#include "standardDrawTexture_frag.h"
@@ -513,7 +514,7 @@ void GeometryCache::initializeShapePipelines() { · 478 unmodified lines
513render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool transparent, bool culled,514render::ShapePipelinePointer GeometryCache::getShapePipeline(bool textured, bool transparent, bool culled,
514 bool unlit, bool depthBias, bool fading) {515 bool unlit, bool depthBias, bool fading) {
515 return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, fading), nullptr,516 return std::make_shared<render::ShapePipeline>(getSimplePipeline(textured, transparent, culled, unlit, depthBias, fading), nullptr,
516 [](const render::ShapePipeline&, gpu::Batch& batch) {517 [](const render::ShapePipeline&, gpu::Batch& batch, render::Args*) {
517 // Set the defaults needed for a simple program518 // Set the defaults needed for a simple program
518 batch.setResourceTexture(render::ShapePipeline::Slot::MAP::ALBEDO,519 batch.setResourceTexture(render::ShapePipeline::Slot::MAP::ALBEDO,
519 DependencyManager::get<TextureCache>()->getWhiteTexture());520 DependencyManager::get<TextureCache>()->getWhiteTexture());
@@ -1971,7 +1972,7 @@ uint32_t toCompactColor(const glm::vec4& color) { · 1451 unmodified lines
1971 1972
1972static const size_t INSTANCE_COLOR_BUFFER = 0;1973static const size_t INSTANCE_COLOR_BUFFER = 0;
1973 1974
1974void renderInstances(gpu::Batch& batch, const glm::vec4& color, bool isWire,1975void renderInstances(RenderArgs* args, gpu::Batch& batch, const glm::vec4& color, bool isWire,
1975 const render::ShapePipelinePointer& pipeline, GeometryCache::Shape shape) {1976 const render::ShapePipelinePointer& pipeline, GeometryCache::Shape shape) {
1976 // Add pipeline to name1977 // Add pipeline to name
1977 std::string instanceName = (isWire ? "wire_shapes_" : "solid_shapes_") + std::to_string(shape) + "_" + std::to_string(std::hash<render::ShapePipelinePointer>()(pipeline));1978 std::string instanceName = (isWire ? "wire_shapes_" : "solid_shapes_") + std::to_string(shape) + "_" + std::to_string(std::hash<render::ShapePipelinePointer>()(pipeline));
@@ -1984,9 +1985,9 @@ void renderInstances(gpu::Batch& batch, const glm::vec4& color, bool isWire, · 6 unmodified lines
1984 }1985 }
1985 1986
1986 // Add call to named buffer1987 // Add call to named buffer
1987 batch.setupNamedCalls(instanceName, [isWire, pipeline, shape](gpu::Batch& batch, gpu::Batch::NamedBatchData& data) {1988 batch.setupNamedCalls(instanceName, [args, isWire, pipeline, shape](gpu::Batch& batch, gpu::Batch::NamedBatchData& data) {
1988 batch.setPipeline(pipeline->pipeline);1989 batch.setPipeline(pipeline->pipeline);
1989 pipeline->prepare(batch);1990 pipeline->prepare(batch, args);
1990 1991
1991 if (isWire) {1992 if (isWire) {
1992 DependencyManager::get<GeometryCache>()->renderWireShapeInstances(batch, shape, data.count(), data.buffers[INSTANCE_COLOR_BUFFER]);1993 DependencyManager::get<GeometryCache>()->renderWireShapeInstances(batch, shape, data.count(), data.buffers[INSTANCE_COLOR_BUFFER]);
@@ -1996,32 +1997,32 @@ void renderInstances(gpu::Batch& batch, const glm::vec4& color, bool isWire, · 3 unmodified lines
1996 });1997 });
1997}1998}
1998 1999
1999void GeometryCache::renderSolidShapeInstance(gpu::Batch& batch, GeometryCache::Shape shape, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {2000void GeometryCache::renderSolidShapeInstance(RenderArgs* args, gpu::Batch& batch, GeometryCache::Shape shape, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {
2000 assert(pipeline != nullptr);2001 assert(pipeline != nullptr);
2001 renderInstances(batch, color, false, pipeline, shape);2002 renderInstances(args, batch, color, false, pipeline, shape);
2002}2003}
2003 2004
2004void GeometryCache::renderWireShapeInstance(gpu::Batch& batch, GeometryCache::Shape shape, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {2005void GeometryCache::renderWireShapeInstance(RenderArgs* args, gpu::Batch& batch, GeometryCache::Shape shape, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {
2005 assert(pipeline != nullptr);2006 assert(pipeline != nullptr);
2006 renderInstances(batch, color, true, pipeline, shape);2007 renderInstances(args, batch, color, true, pipeline, shape);
2007}2008}
2008 2009
2009 2010void GeometryCache::renderSolidSphereInstance(RenderArgs* args, gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {
2010void GeometryCache::renderSolidSphereInstance(gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {
2011 assert(pipeline != nullptr);2011 assert(pipeline != nullptr);
2012 renderInstances(batch, color, false, pipeline, GeometryCache::Sphere);2012 renderInstances(args, batch, color, false, pipeline, GeometryCache::Sphere);
2013}2013}
2014 2014
2015void GeometryCache::renderWireSphereInstance(gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {2015void GeometryCache::renderWireSphereInstance(RenderArgs* args, gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {
2016 assert(pipeline != nullptr);2016 assert(pipeline != nullptr);
2017 renderInstances(batch, color, true, pipeline, GeometryCache::Sphere);2017 renderInstances(args, batch, color, true, pipeline, GeometryCache::Sphere);
2018}2018}
2019 2019
2020// Enable this in a debug build to cause 'box' entities to iterate through all the2020// Enable this in a debug build to cause 'box' entities to iterate through all the
2021// available shape types, both solid and wireframes2021// available shape types, both solid and wireframes
2022//#define DEBUG_SHAPES2022//#define DEBUG_SHAPES
2023 2023
2024void GeometryCache::renderSolidCubeInstance(gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {2024
2025void GeometryCache::renderSolidCubeInstance(RenderArgs* args, gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {
2025 assert(pipeline != nullptr);2026 assert(pipeline != nullptr);
2026#ifdef DEBUG_SHAPES2027#ifdef DEBUG_SHAPES
2027 static auto startTime = usecTimestampNow();2028 static auto startTime = usecTimestampNow();
@@ -2056,12 +2057,12 @@ void GeometryCache::renderSolidCubeInstance(gpu::Batch& batch, const glm::vec4& · 28 unmodified lines
2056 }2057 }
2057 });2058 });
2058#else2059#else
2059 renderInstances(batch, color, false, pipeline, GeometryCache::Cube);2060 renderInstances(args, batch, color, false, pipeline, GeometryCache::Cube);
2060#endif2061#endif
2061}2062}
2062 2063
2063void GeometryCache::renderWireCubeInstance(gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {2064void GeometryCache::renderWireCubeInstance(RenderArgs* args, gpu::Batch& batch, const glm::vec4& color, const render::ShapePipelinePointer& pipeline) {
2064 static const std::string INSTANCE_NAME = __FUNCTION__;2065 static const std::string INSTANCE_NAME = __FUNCTION__;
2065 assert(pipeline != nullptr);2066 assert(pipeline != nullptr);
2066 renderInstances(batch, color, true, pipeline, GeometryCache::Cube);2067 renderInstances(args, batch, color, true, pipeline, GeometryCache::Cube);
2067}2068}