From 08c08f6705d168f0bc7cde251cdacb2c4a53bb7a Mon Sep 17 00:00:00 2001 From: Young Hahn Date: Thu, 22 Sep 2016 19:51:41 -0400 Subject: [core] Don't use depth test unless text is pitch-aligned to map (#6404) * [core, ios, android] Use `auto` value for properties with calculated defaults * Fix render tests * [core] Don't use depth test unless text is pitch-aligned to map. * Bump mapbox-gl-test-suite * TransformState pitch is already in radians * Reduce setDepthSublayer calls * Bump test suite --- package.json | 2 +- src/mbgl/renderer/painter_symbol.cpp | 12 ++++-------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 6b2a9f6d1e..42c08dd0e0 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,7 @@ "express": "^4.11.1", "mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#de2ab007455aa2587c552694c68583f94c9f2747", "mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#a6c95d33ff5ced2c0d7df995fd89eb557c0a353c", - "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#e05680a27f93d7284fce31b9b42a19c80df96b13", + "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#880c1879b29ccdb473b3888fc2134d5261efb7d3", "mkdirp": "^0.5.1", "node-cmake": "^1.2.1", "request": "^2.72.0", diff --git a/src/mbgl/renderer/painter_symbol.cpp b/src/mbgl/renderer/painter_symbol.cpp index dbc27038a0..3d886eb4de 100644 --- a/src/mbgl/renderer/painter_symbol.cpp +++ b/src/mbgl/renderer/painter_symbol.cpp @@ -67,7 +67,7 @@ void Painter::renderSDF(SymbolBucket& bucket, sdfShader.u_rotate_with_map = rotateWithMap; sdfShader.u_pitch_with_map = pitchWithMap; sdfShader.u_texture = 0; - sdfShader.u_pitch = state.getPitch() * util::DEG2RAD; + sdfShader.u_pitch = state.getPitch(); sdfShader.u_bearing = -1.0f * state.getAngle(); sdfShader.u_aspect_ratio = (state.getWidth() * 1.0f) / (state.getHeight() * 1.0f); @@ -94,8 +94,6 @@ void Painter::renderSDF(SymbolBucket& bucket, sdfShader.u_color = haloColor; sdfShader.u_opacity = opacity; sdfShader.u_buffer = (haloOffset - haloWidth / fontScale) / sdfPx; - - setDepthSublayer(0); (bucket.*drawSDF)(sdfShader, store, paintMode()); } @@ -105,8 +103,6 @@ void Painter::renderSDF(SymbolBucket& bucket, sdfShader.u_color = color; sdfShader.u_opacity = opacity; sdfShader.u_buffer = (256.0f - 64.0f) / 256.0f; - - setDepthSublayer(1); (bucket.*drawSDF)(sdfShader, store, paintMode()); } } @@ -141,6 +137,8 @@ void Painter::renderSymbol(PaintParameters& parameters, config.stencilTest = GL_TRUE; } + setDepthSublayer(0); + if (bucket.hasIconData()) { if (layout.iconRotationAlignment == AlignmentType::Map) { config.depthFunc.reset(); @@ -218,13 +216,12 @@ void Painter::renderSymbol(PaintParameters& parameters, frameHistory.bind(store, config, 1); iconShader.u_fadetexture = 1; - setDepthSublayer(0); bucket.drawIcons(iconShader, store, paintMode()); } } if (bucket.hasTextData()) { - if (layout.textRotationAlignment == AlignmentType::Map) { + if (layout.textPitchAlignment == AlignmentType::Map) { config.depthFunc.reset(); config.depthTest = GL_TRUE; } else { @@ -265,7 +262,6 @@ void Painter::renderSymbol(PaintParameters& parameters, collisionBoxShader.u_maxzoom = (tile.id.canonical.z + 1) * 10; config.lineWidth = 1.0f; - setDepthSublayer(0); bucket.drawCollisionBoxes(collisionBoxShader, store); } -- cgit v1.2.1