History

Update GeometryCache to accept gpu::Batch

Ryan Huffman committed 11 years ago

Commit 5abd4bb1 parent 3471c0a4 files · +170 −56Browse files

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

Unified · Split

libraries/render-utils/src/DeferredLightingEffect.cpp+32−1
@@ -106,24 +106,48 @@ void DeferredLightingEffect::releaseSimpleProgram() { · 105 unmodified lines
106106 }
107107
108108 void DeferredLightingEffect::renderSolidSphere(float radius, int slices, int stacks, const glm::vec4& color) {
109+ gpu::Batch batch;
110+ renderSolidSphere(batch, radius, slices, stacks, color);
111+ gpu::GLBackend::renderBatch(batch);
112+}
113+
114+void DeferredLightingEffect::renderSolidSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color) {
109115 bindSimpleProgram();
110116 DependencyManager::get<GeometryCache>()->renderSphere(radius, slices, stacks, color);
111117 releaseSimpleProgram();
112118 }
113119
114120 void DeferredLightingEffect::renderWireSphere(float radius, int slices, int stacks, const glm::vec4& color) {
121+ gpu::Batch batch;
122+ renderWireSphere(batch, radius, slices, stacks, color);
123+ gpu::GLBackend::renderBatch(batch);
124+}
125+
126+void DeferredLightingEffect::renderWireSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color) {
115127 bindSimpleProgram();
116− DependencyManager::get<GeometryCache>()->renderSphere(radius, slices, stacks, color, false);
128+ DependencyManager::get<GeometryCache>()->renderSphere(batch, radius, slices, stacks, color, false);
117129 releaseSimpleProgram();
118130 }
119131
120132 void DeferredLightingEffect::renderSolidCube(float size, const glm::vec4& color) {
133+ gpu::Batch batch;
134+ renderSolidCube(batch, size, color);
135+ gpu::GLBackend::renderBatch(batch);
136+}
137+
138+void DeferredLightingEffect::renderSolidCube(gpu::Batch& batch, float size, const glm::vec4& color) {
121139 bindSimpleProgram();
122140 DependencyManager::get<GeometryCache>()->renderSolidCube(size, color);
123141 releaseSimpleProgram();
124142 }
125143
126144 void DeferredLightingEffect::renderWireCube(float size, const glm::vec4& color) {
145+ gpu::Batch batch;
146+ renderWireCube(batch, size, color);
147+ gpu::GLBackend::renderBatch(batch);
148+}
149+
150+void DeferredLightingEffect::renderWireCube(gpu::Batch& batch, float size, const glm::vec4& color) {
127151 bindSimpleProgram();
128152 DependencyManager::get<GeometryCache>()->renderWireCube(size, color);
129153 releaseSimpleProgram();
@@ -131,6 +155,13 @@ void DeferredLightingEffect::renderWireCube(float size, const glm::vec4& color) · 1 unmodified line
131155
132156 void DeferredLightingEffect::renderLine(const glm::vec3& p1, const glm::vec3& p2,
133157 const glm::vec4& color1, const glm::vec4& color2) {
158+ gpu::Batch batch;
159+ renderLine(batch, p1, p2, color1, color2);
160+ gpu::GLBackend::renderBatch(batch);
161+}
162+
163+void DeferredLightingEffect::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2,
164+ const glm::vec4& color1, const glm::vec4& color2) {
134165 bindSimpleProgram();
135166 DependencyManager::get<GeometryCache>()->renderLine(p1, p2, color1, color2);
136167 releaseSimpleProgram();