Skip to content

Commit

Permalink
Merge parameters in layers-pass
Browse files Browse the repository at this point in the history
  • Loading branch information
felixpalmer committed Mar 15, 2024
1 parent 12624ac commit 11dcd54
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
6 changes: 6 additions & 0 deletions modules/core/src/lib/layer.ts
Expand Up @@ -1072,6 +1072,12 @@ export default abstract class Layer<PropsT extends {} = {}> extends Component<

context.device.setParametersWebGL({polygonOffset: offsets});

// TODO (v9) remove pickingActive check once pick-layers-pass removes GL parameters
const pickingActive = moduleParameters.picking?.isActive === 1;
for (const model of this.getModels()) {
model.setParameters(pickingActive ? {} : parameters);
}

// Call subclass lifecycle method
context.device.withParametersWebGL(parameters, () => {
const opts = {renderPass, moduleParameters, uniforms, parameters, context};
Expand Down
5 changes: 4 additions & 1 deletion modules/core/src/passes/layers-pass.ts
Expand Up @@ -181,7 +181,10 @@ export default class LayersPass extends Pass {
pass,
moduleParameters
);
layerParam.layerParameters = this.getLayerParameters(layer, layerIndex, viewport);
layerParam.layerParameters = {
...layer.context.deck?.props.parameters,
...this.getLayerParameters(layer, layerIndex, viewport)
};
}
drawLayerParams[layerIndex] = layerParam;
}
Expand Down
12 changes: 12 additions & 0 deletions modules/core/src/passes/pick-layers-pass.ts
Expand Up @@ -11,6 +11,16 @@ const PICKING_PARAMETERS: GLParameters = {
blendEquation: GL.FUNC_ADD
};

// TODO (v9) migrate to string constants
// const PICKING_PARAMETERS: RenderPipelineParameters = {
// blendColorOperation: 'add',
// blendColorSrcFactor: 'one',
// blendColorDstFactor: 'zero',
// blendAlphaOperation: 'add',
// blendAlphaSrcFactor: 'constant-alpha', // <- Not yet implemented in luma
// blendAlphaDstFactor: 'zero'
// };

type PickLayersPassRenderOptions = LayersPassRenderOptions & {
pickingFBO: Framebuffer;
deviceRect: Rect;
Expand Down Expand Up @@ -76,6 +86,8 @@ export default class PickLayersPass extends LayersPass {
// Set blend mode for picking
// always overwrite existing pixel with [r,g,b,layerIndex]
const renderStatus = this.device.withParametersWebGL(
// TODO (v9) should move parameters to getLayerParameters(), but first need
// luma to support BlendFactor 'constant-alpha'
{
scissorTest: true,
scissor: [x, y, width, height],
Expand Down

0 comments on commit 11dcd54

Please sign in to comment.