-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
For discussion: remove withParametersWebGL #8731
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -56,6 +56,14 @@ export type RenderStats = { | |
pickableCount: number; | ||
}; | ||
|
||
const DEFAULT_PARAMETERS: LayerParameters = { | ||
blendColorSrcFactor: 'src-alpha', | ||
blendColorDstFactor: 'one-minus-src-alpha', | ||
blendAlphaSrcFactor: 'one', | ||
blendAlphaDstFactor: 'one-minus-src-alpha', | ||
depthCompare: 'less-equal' | ||
}; | ||
|
||
/** A Pass that renders all layers */ | ||
export default class LayersPass extends Pass { | ||
_lastRenderIndex: number = -1; | ||
|
@@ -191,7 +199,9 @@ export default class LayersPass extends Pass { | |
moduleParameters | ||
); | ||
layerParam.layerParameters = { | ||
...DEFAULT_PARAMETERS, | ||
...layer.context.deck?.props.parameters, | ||
...layer.props.parameters, | ||
...this.getLayerParameters(layer, layerIndex, viewport) | ||
}; | ||
} | ||
|
@@ -262,7 +272,7 @@ export default class LayersPass extends Pass { | |
renderPass, | ||
moduleParameters, | ||
uniforms: {layerIndex: layerRenderIndex}, | ||
parameters: layerParameters | ||
parameters: layerParameters! | ||
}); | ||
} catch (err) { | ||
layer.raiseError(err as Error, `drawing ${layer} to ${pass}`); | ||
|
@@ -288,7 +298,10 @@ export default class LayersPass extends Pass { | |
layerIndex: number, | ||
viewport: Viewport | ||
): LayerParameters { | ||
return layer.props.parameters; | ||
const {getPolygonOffset} = layer.props; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if we should have deprecated Is there any reason to keep the function? I think it would be clearer to pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I certainly agree that it should not be called an "accessor" if that is really the case, as accessors operate on data rows and this function operates on a layer. We can still deprecate a function at any time. But I believe the functionality of being able to adjust depth bias based on layer index is needed to address Z fighting so we can't just drop it, we need to have a replacement for this function. |
||
const offsets = (getPolygonOffset && getPolygonOffset({layerIndex})) || [0, 0]; | ||
|
||
return {depthBias: offsets[0], depthBiasSlopeScale: offsets[1]}; | ||
} | ||
|
||
/* Private */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an idea: would it be useful if
props.parameters
could also accept a function to allow the application to control the final parameters? By passing in thePass
theLayer
could have more control: