cesium icon indicating copy to clipboard operation
cesium copied to clipboard

Refactor `ModelExperimentalDrawCommand` to keep track of `ShaderBuilder`

Open j9liu opened this issue 3 years ago • 0 comments

Currently ModelExperimentalDrawCommand is a wrapper for the DrawCommand(s) that draw the primitives of the model. In buildDrawCommand:

  1. The shader programs are built by the shader builder
  2. The initial DrawCommand is made from the various render settings
  3. The DrawCommand is passed into a ModelExperimentalDrawCommand constructor; any derived commands are created / managed by that class

While this has been fine so far, it's been introducing some complications for when the derived commands use different shader programs. We're able to bypass this by having a uniform return different values for different commands (e.g. u_silhouettePass for the silhouette command), but this workaround may not be enough / efficient for future use cases.

The idea to refactor ModelExperimentalDrawCommand would take steps 1 and 2 out from buildDrawCommand, and manage that in ModelExperimentalDrawCommand. (Perhaps buildDrawCommand should be integrated into the class altogether?). Then, the class will have access to the ShaderBuilder, which it can then use to modify shaders for different commands.

j9liu avatar Jul 13 '22 19:07 j9liu