History

Removed glColor reset hack in MeshPartPayload and replaced it by a reset of the color attribute to white in the execution of the setInputFormat command of the various GLBackends

Olivier Prat committed 8 years ago

Commit bd666401 parent 7ea1f3b11 files · +75 −19Browse files

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

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+30−0
@@ -760,6 +760,20 @@ void GeometryCache::renderWireShape(gpu::Batch& batch, Shape shape) { · 759 unmodified lines
760760 _shapes[shape].drawWire(batch);
761761 }
762762
763+void GeometryCache::renderShape(gpu::Batch& batch, Shape shape, const glm::vec4& color) {
764+ batch.setInputFormat(getSolidStreamFormat());
765+ // Color must be set after input format
766+ batch._glColor4f(color.r, color.g, color.b, color.a);
767+ _shapes[shape].draw(batch);
768+}
769+
770+void GeometryCache::renderWireShape(gpu::Batch& batch, Shape shape, const glm::vec4& color) {
771+ batch.setInputFormat(getSolidStreamFormat());
772+ // Color must be set after input format
773+ batch._glColor4f(color.r, color.g, color.b, color.a);
774+ _shapes[shape].drawWire(batch);
775+}
776+
763777 void setupBatchInstance(gpu::Batch& batch, gpu::BufferPointer colorBuffer) {
764778 gpu::BufferView colorView(colorBuffer, COLOR_ELEMENT);
765779 batch.setInputBuffer(gpu::Stream::COLOR, colorView);
@@ -811,6 +825,14 @@ void GeometryCache::renderWireCube(gpu::Batch& batch) { · 45 unmodified lines
811825 renderWireShape(batch, Cube);
812826 }
813827
828+void GeometryCache::renderCube(gpu::Batch& batch, const glm::vec4& color) {
829+ renderShape(batch, Cube, color);
830+}
831+
832+void GeometryCache::renderWireCube(gpu::Batch& batch, const glm::vec4& color) {
833+ renderWireShape(batch, Cube, color);
834+}
835+
814836 void GeometryCache::renderSphere(gpu::Batch& batch) {
815837 renderShape(batch, Sphere);
816838 }
@@ -819,6 +841,14 @@ void GeometryCache::renderWireSphere(gpu::Batch& batch) { · 2 unmodified lines
819841 renderWireShape(batch, Sphere);
820842 }
821843
844+void GeometryCache::renderSphere(gpu::Batch& batch, const glm::vec4& color) {
845+ renderShape(batch, Sphere, color);
846+}
847+
848+void GeometryCache::renderWireSphere(gpu::Batch& batch, const glm::vec4& color) {
849+ renderWireShape(batch, Sphere, color);
850+}
851+
822852 void GeometryCache::renderGrid(gpu::Batch& batch, const glm::vec2& minCorner, const glm::vec2& maxCorner,
823853 int majorRows, int majorCols, float majorEdge,
824854 int minorRows, int minorCols, float minorEdge,

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t