Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Align sublayer depth calculation #9713

Closed
kkaefer opened this issue Aug 7, 2017 · 1 comment
Closed

Align sublayer depth calculation #9713

kkaefer opened this issue Aug 7, 2017 · 1 comment
Labels
archived Archived because of inactivity Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS refactor

Comments

@kkaefer
Copy link
Member

kkaefer commented Aug 7, 2017

Followup from #9699: We're using different formulas to compute the depth mode:

JS:

setDepthSublayer(n: number) {
    const farDepth = 1 - ((1 + this.currentLayer) * this.numSublayers + n) * this.depthEpsilon;
    const nearDepth = farDepth - 1 + this.depthRange;
    this.gl.depthRange(nearDepth, farDepth);
}

Native:

gl::DepthMode PaintParameters::depthModeForSublayer(uint8_t n, gl::DepthMode::Mask mask) const {
    float nearDepth = ((1 + currentLayer) * numSublayers + n) * depthEpsilon;
    float farDepth = nearDepth + depthRangeSize;
    return gl::DepthMode { gl::DepthMode::LessEqual, mask, { nearDepth, farDepth } };
}

We should fix this difference. Once it's fixed, we also have to reverse the logic in render_fill_layer.cpp that switches between 0 and 2 for outline sublayers.

/cc @jfirebaugh

@kkaefer kkaefer added Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS refactor labels Aug 7, 2017
@stale stale bot added the archived Archived because of inactivity label Nov 5, 2018
@stale
Copy link

stale bot commented Dec 1, 2018

This issue has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale bot closed this as completed Dec 1, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
archived Archived because of inactivity Core The cross-platform C++ core, aka mbgl GL JS parity For feature parity with Mapbox GL JS refactor
Projects
None yet
Development

No branches or pull requests

1 participant