-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Shader module system and dynamic injection #120
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
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
30a9543
Move mesh-layer into folder
kylebarron e47cd05
POC: module injection
kylebarron a40e1fb
add comment
kylebarron 57cf8f2
Merge branch 'main' into kyle/subclass-mesh-fragments
kylebarron 9de02c7
Define renderPipeline
kylebarron 57976f4
Merge branch 'main' into kyle/subclass-mesh-fragments
kylebarron 4a54d5f
Pass down renderPipeline
kylebarron 992e25e
Define shader modules for creating texture, filtering, colormap
kylebarron 138cd1b
Fix cog basic example
kylebarron 7265492
Fix creating default render pipeline for ImageData
kylebarron 7e189b1
Rename texture creation module without unorm suffix
kylebarron 66be7b2
cleaner modules creation
kylebarron File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
packages/deck.gl-raster/src/mesh-layer/mesh-layer-fragment.glsl.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /** | ||
| * This is a vendored copy of the SimpleMeshLayer's fragment shader: | ||
| * https://github.com/visgl/deck.gl/blob/a15c8cea047993c8a861bf542835c1988f30165c/modules/mesh-layers/src/simple-mesh-layer/simple-mesh-layer-fragment.glsl.ts | ||
| * under the MIT license. | ||
| * | ||
| * We edited this to remove the hard-coded texture uniform because we want to | ||
| * support integer and signed integer textures, not only normalized unsigned | ||
| * textures. | ||
| */ | ||
| export default /* glsl */ `#version 300 es | ||
| #define SHADER_NAME simple-mesh-layer-fs | ||
|
|
||
| precision highp float; | ||
|
|
||
| in vec2 vTexCoord; | ||
| in vec3 cameraPosition; | ||
| in vec3 normals_commonspace; | ||
| in vec4 position_commonspace; | ||
| in vec4 vColor; | ||
|
|
||
| out vec4 fragColor; | ||
|
|
||
| void main(void) { | ||
| geometry.uv = vTexCoord; | ||
|
|
||
| vec3 normal; | ||
| if (simpleMesh.flatShading) { | ||
|
|
||
| normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz))); | ||
| } else { | ||
| normal = normals_commonspace; | ||
| } | ||
|
|
||
| // We initialize color here before passing into DECKGL_FILTER_COLOR | ||
| vec4 color; | ||
| DECKGL_FILTER_COLOR(color, geometry); | ||
|
|
||
| vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal); | ||
| fragColor = vec4(lightColor, color.a * layer.opacity); | ||
| } | ||
| `; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This still assumes that
colorwill be a unorm vec4. Maybe we'll want to also allow the parameter intoDECKGL_FILTER_COLORto be auvec4or anivec4?