CesiumGS / CesiumGS/cesium

Refactor `ModelDrawCommand` to keep track of `ShaderBuilder`

Open
#10,550 0 comments 1 reaction 0 assignees View on GitHub
category - model/gltf
Dominant language
JavaScript
Stars
15.7k
Forks
3.9k
Avg merge
4d 6h
Merged PRs (30d)
34

Description

Currently `ModelDrawCommand` 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 `ModelDrawCommand` 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 `ModelDrawCommand` would take steps 1 and 2 out from `buildDrawCommand`, and manage that in `ModelDrawCommand`. (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.

Contributor guide

Open the contributing guide

Research direction

Start by reading ModelDrawCommand and buildDrawCommand to understand how ShaderBuilder and the initial DrawCommand are currently managed. Define the refactor so ModelDrawCommand owns access to ShaderBuilder and can support derived commands with different shader programs, then verify existing command behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
computer-graphics
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.