Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 16 files). Show all
Unified · Split
| @@ -121,23 +121,13 @@ int RenderVisitor::visit(MetavoxelInfo& info) { · 120 unmodified lines | |||
| 121 | return STOP_RECURSION; | 121 | return STOP_RECURSION; |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | const GLenum COLOR_DRAW_BUFFERS[] = { GL_COLOR_ATTACHMENT0 }; | ||
| 125 | const GLenum NORMAL_DRAW_BUFFERS[] = { GL_COLOR_ATTACHMENT1 }; | ||
| 126 | const GLenum COLOR_NORMAL_DRAW_BUFFERS[] = { GL_COLOR_ATTACHMENT0, GL_COLOR_ATTACHMENT1 }; | ||
| 127 | |||
| 128 | void MetavoxelSystem::render() { | 124 | void MetavoxelSystem::render() { |
| 129 | // update the frustum | 125 | // update the frustum |
| 130 | ViewFrustum* viewFrustum = Application::getInstance()->getDisplayViewFrustum(); | 126 | ViewFrustum* viewFrustum = Application::getInstance()->getDisplayViewFrustum(); |
| 131 | _frustum.set(viewFrustum->getFarTopLeft(), viewFrustum->getFarTopRight(), viewFrustum->getFarBottomLeft(), | 127 | _frustum.set(viewFrustum->getFarTopLeft(), viewFrustum->getFarTopRight(), viewFrustum->getFarBottomLeft(), |
| 132 | viewFrustum->getFarBottomRight(), viewFrustum->getNearTopLeft(), viewFrustum->getNearTopRight(), | 128 | viewFrustum->getFarBottomRight(), viewFrustum->getNearTopLeft(), viewFrustum->getNearTopRight(), |
| 133 | viewFrustum->getNearBottomLeft(), viewFrustum->getNearBottomRight()); | 129 | viewFrustum->getNearBottomLeft(), viewFrustum->getNearBottomRight()); |
| 134 | 130 | ||
| 135 | // clear the normal buffer | ||
| 136 | glDrawBuffers(sizeof(NORMAL_DRAW_BUFFERS) / sizeof(NORMAL_DRAW_BUFFERS[0]), NORMAL_DRAW_BUFFERS); | ||
| 137 | glClear(GL_COLOR_BUFFER_BIT); | ||
| 138 | |||
| 139 | glDrawBuffers(sizeof(COLOR_DRAW_BUFFERS) / sizeof(COLOR_DRAW_BUFFERS[0]), COLOR_DRAW_BUFFERS); | ||
| 140 | |||
| 141 | RenderVisitor renderVisitor(getLOD()); | 131 | RenderVisitor renderVisitor(getLOD()); |
| 142 | guideToAugmented(renderVisitor, true); | 132 | guideToAugmented(renderVisitor, true); |
| 143 | 133 | ||
| @@ -834,7 +824,7 @@ void HeightfieldBuffer::render(bool cursor) { · 690 unmodified lines | |||
| 834 | 824 | ||
| 835 | glDrawRangeElements(GL_TRIANGLES, 0, vertexCount - 1, indexCount, GL_UNSIGNED_INT, 0); | 825 | glDrawRangeElements(GL_TRIANGLES, 0, vertexCount - 1, indexCount, GL_UNSIGNED_INT, 0); |
| 836 | 826 | ||
| 837 | glDrawBuffers(sizeof(COLOR_DRAW_BUFFERS) / sizeof(COLOR_DRAW_BUFFERS[0]), COLOR_DRAW_BUFFERS); | 827 | Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false); |
| 838 | 828 | ||
| 839 | glDepthFunc(GL_LEQUAL); | 829 | glDepthFunc(GL_LEQUAL); |
| 840 | glDepthMask(false); | 830 | glDepthMask(false); |
| @@ -907,7 +897,7 @@ void HeightfieldBuffer::render(bool cursor) { · 66 unmodified lines | |||
| 907 | glDepthMask(true); | 897 | glDepthMask(true); |
| 908 | glDepthFunc(GL_LESS); | 898 | glDepthFunc(GL_LESS); |
| 909 | 899 | ||
| 910 | glDrawBuffers(sizeof(COLOR_NORMAL_DRAW_BUFFERS) / sizeof(COLOR_NORMAL_DRAW_BUFFERS[0]), COLOR_NORMAL_DRAW_BUFFERS); | 900 | Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, true); |
| 911 | 901 | ||
| 912 | DefaultMetavoxelRendererImplementation::getBaseHeightfieldProgram().bind(); | 902 | DefaultMetavoxelRendererImplementation::getBaseHeightfieldProgram().bind(); |
| 913 | 903 | ||
| @@ -936,7 +926,7 @@ void HeightfieldBuffer::render(bool cursor) { · 22 unmodified lines | |||
| 936 | QHash<int, HeightfieldBuffer::BufferPair> HeightfieldBuffer::_bufferPairs; | 926 | QHash<int, HeightfieldBuffer::BufferPair> HeightfieldBuffer::_bufferPairs; |
| 937 | 927 | ||
| 938 | void HeightfieldPreview::render(const glm::vec3& translation, float scale) const { | 928 | void HeightfieldPreview::render(const glm::vec3& translation, float scale) const { |
| 939 | glDrawBuffers(sizeof(COLOR_NORMAL_DRAW_BUFFERS) / sizeof(COLOR_NORMAL_DRAW_BUFFERS[0]), COLOR_NORMAL_DRAW_BUFFERS); | 929 | Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, true); |
| 940 | 930 | ||
| 941 | glDisable(GL_BLEND); | 931 | glDisable(GL_BLEND); |
| 942 | glEnable(GL_CULL_FACE); | 932 | glEnable(GL_CULL_FACE); |
| @@ -969,7 +959,7 @@ void HeightfieldPreview::render(const glm::vec3& translation, float scale) const · 26 unmodified lines | |||
| 969 | glDisable(GL_CULL_FACE); | 959 | glDisable(GL_CULL_FACE); |
| 970 | glEnable(GL_BLEND); | 960 | glEnable(GL_BLEND); |
| 971 | 961 | ||
| 972 | glDrawBuffers(sizeof(COLOR_DRAW_BUFFERS) / sizeof(COLOR_DRAW_BUFFERS[0]), COLOR_DRAW_BUFFERS); | 962 | Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false); |
| 973 | } | 963 | } |
| 974 | 964 | ||
| 975 | VoxelBuffer::VoxelBuffer(const QVector<VoxelPoint>& vertices, const QVector<int>& indices, | 965 | VoxelBuffer::VoxelBuffer(const QVector<VoxelPoint>& vertices, const QVector<int>& indices, |
| @@ -1017,7 +1007,7 @@ void VoxelBuffer::render(bool cursor) { · 41 unmodified lines | |||
| 1017 | glDrawRangeElements(GL_QUADS, 0, _vertexCount - 1, _indexCount, GL_UNSIGNED_INT, 0); | 1007 | glDrawRangeElements(GL_QUADS, 0, _vertexCount - 1, _indexCount, GL_UNSIGNED_INT, 0); |
| 1018 | 1008 | ||
| 1019 | if (!_materials.isEmpty()) { | 1009 | if (!_materials.isEmpty()) { |
| 1020 | glDrawBuffers(sizeof(COLOR_DRAW_BUFFERS) / sizeof(COLOR_DRAW_BUFFERS[0]), COLOR_DRAW_BUFFERS); | 1010 | Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false); |
| 1021 | 1011 | ||
| 1022 | glDepthFunc(GL_LEQUAL); | 1012 | glDepthFunc(GL_LEQUAL); |
| 1023 | glDepthMask(false); | 1013 | glDepthMask(false); |
| @@ -1087,7 +1077,7 @@ void VoxelBuffer::render(bool cursor) { · 63 unmodified lines | |||
| 1087 | glDepthMask(true); | 1077 | glDepthMask(true); |
| 1088 | glDepthFunc(GL_LESS); | 1078 | glDepthFunc(GL_LESS); |
| 1089 | 1079 | ||
| 1090 | glDrawBuffers(sizeof(COLOR_NORMAL_DRAW_BUFFERS) / sizeof(COLOR_NORMAL_DRAW_BUFFERS[0]), COLOR_NORMAL_DRAW_BUFFERS); | 1080 | Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, true); |
| 1091 | 1081 | ||
| 1092 | DefaultMetavoxelRendererImplementation::getSplatVoxelProgram().disableAttributeArray(locations.materials); | 1082 | DefaultMetavoxelRendererImplementation::getSplatVoxelProgram().disableAttributeArray(locations.materials); |
| 1093 | DefaultMetavoxelRendererImplementation::getSplatVoxelProgram().disableAttributeArray(locations.materialWeights); | 1083 | DefaultMetavoxelRendererImplementation::getSplatVoxelProgram().disableAttributeArray(locations.materialWeights); |
| @@ -2132,7 +2122,7 @@ void DefaultMetavoxelRendererImplementation::render(MetavoxelData& data, Metavox · 1038 unmodified lines | |||
| 2132 | 2122 | ||
| 2133 | _pointProgram.release(); | 2123 | _pointProgram.release(); |
| 2134 | 2124 | ||
| 2135 | glDrawBuffers(sizeof(COLOR_NORMAL_DRAW_BUFFERS) / sizeof(COLOR_NORMAL_DRAW_BUFFERS[0]), COLOR_NORMAL_DRAW_BUFFERS); | 2125 | Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, true); |
| 2136 | 2126 | ||
| 2137 | glEnable(GL_CULL_FACE); | 2127 | glEnable(GL_CULL_FACE); |
| 2138 | glEnable(GL_ALPHA_TEST); | 2128 | glEnable(GL_ALPHA_TEST); |
| @@ -2175,7 +2165,7 @@ void DefaultMetavoxelRendererImplementation::render(MetavoxelData& data, Metavox · 36 unmodified lines | |||
| 2175 | glDisableClientState(GL_COLOR_ARRAY); | 2165 | glDisableClientState(GL_COLOR_ARRAY); |
| 2176 | glDisableClientState(GL_NORMAL_ARRAY); | 2166 | glDisableClientState(GL_NORMAL_ARRAY); |
| 2177 | 2167 | ||
| 2178 | glDrawBuffers(sizeof(COLOR_DRAW_BUFFERS) / sizeof(COLOR_DRAW_BUFFERS[0]), COLOR_DRAW_BUFFERS); | 2168 | Application::getInstance()->getTextureCache()->setPrimaryDrawBuffers(true, false); |
| 2179 | } | 2169 | } |
| 2180 | 2170 | ||
| 2181 | void DefaultMetavoxelRendererImplementation::loadSplatProgram(const char* type, | 2171 | void DefaultMetavoxelRendererImplementation::loadSplatProgram(const char* type, |