Skip to content

Commit

Permalink
skip all selection pass rendering for styles that don't support featu…
Browse files Browse the repository at this point in the history
…re selection

e.g. pure raster styles don't support selection, but rendering was only returning from inner loop, causing subsequent mesh/tile combinations to fail
  • Loading branch information
bcamper committed Sep 2, 2018
1 parent 530a375 commit 7c51588
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions src/scene.js
Original file line number Diff line number Diff line change
Expand Up @@ -632,20 +632,26 @@ export default class Scene {
continue;
}

// Render current mesh variant for current style for current tile
// Get meshes for current variant order, current style, and current tile
const meshes = tile.meshes[style_name].filter(m => m.variant.order === mo); // find meshes by variant order
meshes.forEach(mesh => {
// Style-specific state
// Only setup style if rendering for first time this frame
// (lazy init, not all styles will be used in all screen views; some styles might be defined but never used)
if (first_for_style === true) {
first_for_style = false;
program = this.setupStyle(style, program_key);
if (!program) {
return 0;
}
if (meshes.length === 0) {
continue;
}

// Style-specific state
// Only setup style if rendering for first time this frame
// (lazy init, not all styles will be used in all screen views; some styles might be defined but never used)
if (first_for_style === true) {
first_for_style = false;
program = this.setupStyle(style, program_key);
if (!program) {
// no program found, e.g. happens when rendering selection pass, but style doesn't support selection
return 0;
}
}

// Render each mesh (for current variant order)
meshes.forEach(mesh => {
// Tile-specific state
if (first_for_tile === true) {
first_for_tile = false;
Expand Down

0 comments on commit 7c51588

Please sign in to comment.