deck.gl icon indicating copy to clipboard operation
deck.gl copied to clipboard

[Doc] Plan for updating documentation for 9.1?

Open EmilRybergAkson opened this issue 9 months ago • 1 comments

Link

https://deck.gl/docs/developer-guide/custom-layers/subclassed-layers

Description

Hi.

It seems that some parts of the documentation has not been updated to reflect the changes in 9.0/9.1. For example this example of adding additional uniforms:

/// rounded-rectangle-layer.js
// Example to draw rounded rectangles instead of circles in ScatterplotLayer
import {ScatterplotLayer} from '@deck.gl/layers';
import customFragmentShader from './rounded-rectangle-layer-fragment';

export default RoundedRectangleLayer extends ScatterplotLayer {

  draw({uniforms}) {
    super.draw({
      uniforms:
        {
        ...uniforms,
        cornerRadius: this.props.cornerRadius
        }
    })
  }

  getShaders() {
    // use object.assign to make sure we don't overwrite existing fields like `vs`, `modules`...
    return Object.assign({}, super.getShaders(), {
      fs: customFragmentShader
    });
  }
}

RoundedRectangleLayer.defaultProps = {
  // cornerRadius: the amount of rounding at the rectangle corners
  // 0 - rectangle. 1 - circle.
  cornerRadius: 0.1
}

From quickly looking around the source code, it seems that uniforms are no longer passed like that to the parent class draw call. Or am i missing something?

Is there anything in the works for updating it? Currently it is difficult to update custom subclassed layers from 8.9 to 9.1, due to all the changes in deck.gl 9.1 and luma.gl, and missing / not up to date documentation.

EmilRybergAkson avatar Feb 25 '25 15:02 EmilRybergAkson