Showing the changes to interface/src/MetavoxelSystem.cpp (1 of 9 files). Show all
Unified · Split
| @@ -822,22 +822,38 @@ void HeightfieldBuffer::render(bool cursor) { · 821 unmodified lines | ||
| 822 | 822 | DefaultMetavoxelRendererImplementation::getSplatHeightScaleLocation(), 1.0f / _heightSize); |
| 823 | 823 | DefaultMetavoxelRendererImplementation::getSplatHeightfieldProgram().setUniformValue( |
| 824 | 824 | DefaultMetavoxelRendererImplementation::getSplatTextureScaleLocation(), (float)_heightSize / innerSize); |
| 825 | + DefaultMetavoxelRendererImplementation::getSplatHeightfieldProgram().setUniformValue( | |
| 826 | + DefaultMetavoxelRendererImplementation::getSplatTextureOffsetLocation(), | |
| 827 | + _translation.x / _scale, _translation.z / _scale); | |
| 825 | 828 | |
| 826 | 829 | glBindTexture(GL_TEXTURE_2D, _textureTextureID); |
| 827 | 830 | |
| 828 | 831 | const int TEXTURES_PER_SPLAT = 4; |
| 829 | 832 | for (int i = 0; i < _textures.size(); i += TEXTURES_PER_SPLAT) { |
| 833 | + QVector4D scalesS, scalesT; | |
| 834 | + | |
| 830 | 835 | for (int j = 0; j < SPLAT_COUNT; j++) { |
| 831 | 836 | glActiveTexture(GL_TEXTURE0 + SPLAT_TEXTURE_UNITS[j]); |
| 832 | 837 | int index = i + j; |
| 833 | 838 | if (index < _networkTextures.size()) { |
| 834 | 839 | const NetworkTexturePointer& texture = _networkTextures.at(index); |
| 835 | − glBindTexture(GL_TEXTURE_2D, texture ? texture->getID() : 0); | |
| 840 | + if (texture) { | |
| 841 | + HeightfieldTexture* heightfieldTexture = static_cast<HeightfieldTexture*>(_textures.at(index).data()); | |
| 842 | + scalesS[j] = _scale / heightfieldTexture->getScaleS(); | |
| 843 | + scalesT[j] = _scale / heightfieldTexture->getScaleT(); | |
| 844 | + glBindTexture(GL_TEXTURE_2D, texture->getID()); | |
| 845 | + } else { | |
| 846 | + glBindTexture(GL_TEXTURE_2D, 0); | |
| 847 | + } | |
| 836 | 848 | } else { |
| 837 | 849 | glBindTexture(GL_TEXTURE_2D, 0); |
| 838 | 850 | } |
| 839 | 851 | } |
| 840 | 852 | const float QUARTER_STEP = 0.25f * EIGHT_BIT_MAXIMUM_RECIPROCAL; |
| 853 | + DefaultMetavoxelRendererImplementation::getSplatHeightfieldProgram().setUniformValue( | |
| 854 | + DefaultMetavoxelRendererImplementation::getSplatTextureScalesSLocation(), scalesS); | |
| 855 | + DefaultMetavoxelRendererImplementation::getSplatHeightfieldProgram().setUniformValue( | |
| 856 | + DefaultMetavoxelRendererImplementation::getSplatTextureScalesTLocation(), scalesT); | |
| 841 | 857 | DefaultMetavoxelRendererImplementation::getSplatHeightfieldProgram().setUniformValue( |
| 842 | 858 | DefaultMetavoxelRendererImplementation::getSplatTextureValueMinimaLocation(), |
| 843 | 859 | (i + 1) * EIGHT_BIT_MAXIMUM_RECIPROCAL - QUARTER_STEP, (i + 2) * EIGHT_BIT_MAXIMUM_RECIPROCAL - QUARTER_STEP, |
| @@ -1050,6 +1066,9 @@ void DefaultMetavoxelRendererImplementation::init() { · 206 unmodified lines | ||
| 1050 | 1066 | _splatHeightfieldProgram.setUniformValueArray("diffuseMaps", SPLAT_TEXTURE_UNITS, SPLAT_COUNT); |
| 1051 | 1067 | _splatHeightScaleLocation = _splatHeightfieldProgram.uniformLocation("heightScale"); |
| 1052 | 1068 | _splatTextureScaleLocation = _splatHeightfieldProgram.uniformLocation("textureScale"); |
| 1069 | + _splatTextureOffsetLocation = _splatHeightfieldProgram.uniformLocation("splatTextureOffset"); | |
| 1070 | + _splatTextureScalesSLocation = _splatHeightfieldProgram.uniformLocation("splatTextureScalesS"); | |
| 1071 | + _splatTextureScalesTLocation = _splatHeightfieldProgram.uniformLocation("splatTextureScalesT"); | |
| 1053 | 1072 | _splatTextureValueMinimaLocation = _splatHeightfieldProgram.uniformLocation("textureValueMinima"); |
| 1054 | 1073 | _splatTextureValueMaximaLocation = _splatHeightfieldProgram.uniformLocation("textureValueMaxima"); |
| 1055 | 1074 | _splatHeightfieldProgram.release(); |
| @@ -1695,6 +1714,9 @@ int DefaultMetavoxelRendererImplementation::_baseColorScaleLocation; · 639 unmodified lines | ||
| 1695 | 1714 | ProgramObject DefaultMetavoxelRendererImplementation::_splatHeightfieldProgram; |
| 1696 | 1715 | int DefaultMetavoxelRendererImplementation::_splatHeightScaleLocation; |
| 1697 | 1716 | int DefaultMetavoxelRendererImplementation::_splatTextureScaleLocation; |
| 1717 | +int DefaultMetavoxelRendererImplementation::_splatTextureOffsetLocation; | |
| 1718 | +int DefaultMetavoxelRendererImplementation::_splatTextureScalesSLocation; | |
| 1719 | +int DefaultMetavoxelRendererImplementation::_splatTextureScalesTLocation; | |
| 1698 | 1720 | int DefaultMetavoxelRendererImplementation::_splatTextureValueMinimaLocation; |
| 1699 | 1721 | int DefaultMetavoxelRendererImplementation::_splatTextureValueMaximaLocation; |
| 1700 | 1722 | ProgramObject DefaultMetavoxelRendererImplementation::_lightHeightfieldProgram; |