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
106}106}
107 107
108void DeferredLightingEffect::renderSolidSphere(float radius, int slices, int stacks, const glm::vec4& color) {108void 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
114void DeferredLightingEffect::renderSolidSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color) {
109 bindSimpleProgram();115 bindSimpleProgram();
110 DependencyManager::get<GeometryCache>()->renderSphere(radius, slices, stacks, color);116 DependencyManager::get<GeometryCache>()->renderSphere(radius, slices, stacks, color);
111 releaseSimpleProgram();117 releaseSimpleProgram();
112}118}
113 119
114void DeferredLightingEffect::renderWireSphere(float radius, int slices, int stacks, const glm::vec4& color) {120void 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
126void DeferredLightingEffect::renderWireSphere(gpu::Batch& batch, float radius, int slices, int stacks, const glm::vec4& color) {
115 bindSimpleProgram();127 bindSimpleProgram();
116 DependencyManager::get<GeometryCache>()->renderSphere(radius, slices, stacks, color, false);128 DependencyManager::get<GeometryCache>()->renderSphere(batch, radius, slices, stacks, color, false);
117 releaseSimpleProgram();129 releaseSimpleProgram();
118}130}
119 131
120void DeferredLightingEffect::renderSolidCube(float size, const glm::vec4& color) {132void DeferredLightingEffect::renderSolidCube(float size, const glm::vec4& color) {
133 gpu::Batch batch;
134 renderSolidCube(batch, size, color);
135 gpu::GLBackend::renderBatch(batch);
136}
137
138void DeferredLightingEffect::renderSolidCube(gpu::Batch& batch, float size, const glm::vec4& color) {
121 bindSimpleProgram();139 bindSimpleProgram();
122 DependencyManager::get<GeometryCache>()->renderSolidCube(size, color);140 DependencyManager::get<GeometryCache>()->renderSolidCube(size, color);
123 releaseSimpleProgram();141 releaseSimpleProgram();
124}142}
125 143
126void DeferredLightingEffect::renderWireCube(float size, const glm::vec4& color) {144void DeferredLightingEffect::renderWireCube(float size, const glm::vec4& color) {
145 gpu::Batch batch;
146 renderWireCube(batch, size, color);
147 gpu::GLBackend::renderBatch(batch);
148}
149
150void DeferredLightingEffect::renderWireCube(gpu::Batch& batch, float size, const glm::vec4& color) {
127 bindSimpleProgram();151 bindSimpleProgram();
128 DependencyManager::get<GeometryCache>()->renderWireCube(size, color);152 DependencyManager::get<GeometryCache>()->renderWireCube(size, color);
129 releaseSimpleProgram();153 releaseSimpleProgram();
@@ -131,6 +155,13 @@ void DeferredLightingEffect::renderWireCube(float size, const glm::vec4& color) · 1 unmodified line
131 155
132void DeferredLightingEffect::renderLine(const glm::vec3& p1, const glm::vec3& p2, 156void DeferredLightingEffect::renderLine(const glm::vec3& p1, const glm::vec3& p2,
133 const glm::vec4& color1, const glm::vec4& color2) {157 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
163void DeferredLightingEffect::renderLine(gpu::Batch& batch, const glm::vec3& p1, const glm::vec3& p2,
164 const glm::vec4& color1, const glm::vec4& color2) {
134 bindSimpleProgram();165 bindSimpleProgram();
135 DependencyManager::get<GeometryCache>()->renderLine(p1, p2, color1, color2);166 DependencyManager::get<GeometryCache>()->renderLine(p1, p2, color1, color2);
136 releaseSimpleProgram();167 releaseSimpleProgram();