From c30569cd5529e22a7850cfb0758175d7262d3695 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 11 Jan 2016 13:26:47 -0800 Subject: [PATCH] Naming coding standard --- libraries/gpu/src/gpu/Batch.cpp | 14 ++++----- libraries/gpu/src/gpu/Batch.h | 11 ++++--- libraries/render-utils/src/GeometryCache.cpp | 30 ++++++++++++-------- tests/gpu-test/src/main.cpp | 2 +- 4 files changed, 31 insertions(+), 26 deletions(-) diff --git a/libraries/gpu/src/gpu/Batch.cpp b/libraries/gpu/src/gpu/Batch.cpp index f9c4131a1b..999e528a94 100644 --- a/libraries/gpu/src/gpu/Batch.cpp +++ b/libraries/gpu/src/gpu/Batch.cpp @@ -362,8 +362,8 @@ bool Batch::isSkyboxEnabled() const { void Batch::setupNamedCalls(const std::string& instanceName, size_t count, NamedBatchData::Function function) { NamedBatchData& instance = _namedData[instanceName]; - instance._count += count; - instance._function = function; + instance.count += count; + instance.function = function; } void Batch::setupNamedCalls(const std::string& instanceName, NamedBatchData::Function function) { @@ -372,13 +372,13 @@ void Batch::setupNamedCalls(const std::string& instanceName, NamedBatchData::Fun BufferPointer Batch::getNamedBuffer(const std::string& instanceName, uint8_t index) { NamedBatchData& instance = _namedData[instanceName]; - if (instance._buffers.size() <= index) { - instance._buffers.resize(index + 1); + if (instance.buffers.size() <= index) { + instance.buffers.resize(index + 1); } - if (!instance._buffers[index]) { - instance._buffers[index].reset(new Buffer()); + if (!instance.buffers[index]) { + instance.buffers[index].reset(new Buffer()); } - return instance._buffers[index]; + return instance.buffers[index]; } void Batch::preExecute() { diff --git a/libraries/gpu/src/gpu/Batch.h b/libraries/gpu/src/gpu/Batch.h index 88d28f9d10..aa2fc1622c 100644 --- a/libraries/gpu/src/gpu/Batch.h +++ b/libraries/gpu/src/gpu/Batch.h @@ -49,14 +49,13 @@ public: using BufferPointers = std::vector; using Function = std::function; - std::once_flag _once; - BufferPointers _buffers; - size_t _count{ 0 }; - Function _function; + BufferPointers buffers; + size_t count { 0 }; + Function function; void process(Batch& batch) { - if (_function) { - _function(batch, *this); + if (function) { + function(batch, *this); } } }; diff --git a/libraries/render-utils/src/GeometryCache.cpp b/libraries/render-utils/src/GeometryCache.cpp index 87635eb9b6..8c112229b1 100644 --- a/libraries/render-utils/src/GeometryCache.cpp +++ b/libraries/render-utils/src/GeometryCache.cpp @@ -1854,16 +1854,18 @@ void renderInstances(const std::string& name, gpu::Batch& batch, const Transform void GeometryCache::renderSolidSphereInstance(gpu::Batch& batch, const Transform& transform, const glm::vec4& color) { static const std::string INSTANCE_NAME = __FUNCTION__; renderInstances(INSTANCE_NAME, batch, transform, color, [](gpu::Batch& batch, gpu::Batch::NamedBatchData& data) { - DependencyManager::get()->renderShapeInstances(batch, GeometryCache::Sphere, data._count, - data._buffers[INSTANCE_TRANSFORM_BUFFER], data._buffers[INSTANCE_COLOR_BUFFER]); + DependencyManager::get()->renderShapeInstances(batch, GeometryCache::Sphere, data.count, + data.buffers[INSTANCE_TRANSFORM_BUFFER], + data.buffers[INSTANCE_COLOR_BUFFER]); }); } void GeometryCache::renderWireSphereInstance(gpu::Batch& batch, const Transform& transform, const glm::vec4& color) { static const std::string INSTANCE_NAME = __FUNCTION__; renderInstances(INSTANCE_NAME, batch, transform, color, [](gpu::Batch& batch, gpu::Batch::NamedBatchData& data) { - DependencyManager::get()->renderWireShapeInstances(batch, GeometryCache::Sphere, data._count, - data._buffers[INSTANCE_TRANSFORM_BUFFER], data._buffers[INSTANCE_COLOR_BUFFER]); + DependencyManager::get()->renderWireShapeInstances(batch, GeometryCache::Sphere, data.count, + data.buffers[INSTANCE_TRANSFORM_BUFFER], + data.buffers[INSTANCE_COLOR_BUFFER]); }); } @@ -1901,17 +1903,20 @@ void GeometryCache::renderSolidCubeInstance(gpu::Batch& batch, const Transform& // For the first half second for a given shape, show the wireframe, for the second half, show the solid. if (fractionalSeconds > 0.5f) { - DependencyManager::get()->renderShapeInstances(batch, shape, data._count, - data._buffers[INSTANCE_TRANSFORM_BUFFER], data._buffers[INSTANCE_COLOR_BUFFER]); + DependencyManager::get()->renderShapeInstances(batch, shape, data.count, + data.buffers[INSTANCE_TRANSFORM_BUFFER], + data.buffers[INSTANCE_COLOR_BUFFER]); } else { - DependencyManager::get()->renderWireShapeInstances(batch, shape, data._count, - data._buffers[INSTANCE_TRANSFORM_BUFFER], data._buffers[INSTANCE_COLOR_BUFFER]); + DependencyManager::get()->renderWireShapeInstances(batch, shape, data.count, + data.buffers[INSTANCE_TRANSFORM_BUFFER], + data.buffers[INSTANCE_COLOR_BUFFER]); } }); #else renderInstances(INSTANCE_NAME, batch, transform, color, [](gpu::Batch& batch, gpu::Batch::NamedBatchData& data) { - DependencyManager::get()->renderCubeInstances(batch, data._count, - data._buffers[INSTANCE_TRANSFORM_BUFFER], data._buffers[INSTANCE_COLOR_BUFFER]); + DependencyManager::get()->renderCubeInstances(batch, data.count, + data.buffers[INSTANCE_TRANSFORM_BUFFER], + data.buffers[INSTANCE_COLOR_BUFFER]); }); #endif } @@ -1919,8 +1924,9 @@ void GeometryCache::renderSolidCubeInstance(gpu::Batch& batch, const Transform& void GeometryCache::renderWireCubeInstance(gpu::Batch& batch, const Transform& transform, const glm::vec4& color) { static const std::string INSTANCE_NAME = __FUNCTION__; renderInstances(INSTANCE_NAME, batch, transform, color, [](gpu::Batch& batch, gpu::Batch::NamedBatchData& data) { - DependencyManager::get()->renderWireCubeInstances(batch, data._count, - data._buffers[INSTANCE_TRANSFORM_BUFFER], data._buffers[INSTANCE_COLOR_BUFFER]); + DependencyManager::get()->renderWireCubeInstances(batch, data.count, + data.buffers[INSTANCE_TRANSFORM_BUFFER], + data.buffers[INSTANCE_COLOR_BUFFER]); }); } diff --git a/tests/gpu-test/src/main.cpp b/tests/gpu-test/src/main.cpp index f5ff7de035..de5aa877eb 100644 --- a/tests/gpu-test/src/main.cpp +++ b/tests/gpu-test/src/main.cpp @@ -246,7 +246,7 @@ public: batch.setModelTransform(Transform()); batch.setPipeline(_pipeline); batch._glUniform1i(_instanceLocation, 1); - geometryCache->renderWireShapeInstances(batch, GeometryCache::Line, data._count, transformBuffer, colorBuffer); + geometryCache->renderWireShapeInstances(batch, GeometryCache::Line, data.count, transformBuffer, colorBuffer); batch._glUniform1i(_instanceLocation, 0); }); }