-
Notifications
You must be signed in to change notification settings - Fork 644
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: polygon extrude mode support set linear color * style: lint style
- Loading branch information
1 parent
ef0aadd
commit a37b33a
Showing
9 changed files
with
202 additions
and
176 deletions.
There are no files selected for viewing
This file contains 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
19 changes: 16 additions & 3 deletions
19
packages/layers/src/polygon/shaders/extrude/polygon_extrude_frag.glsl
This file contains 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 |
---|---|---|
@@ -1,12 +1,25 @@ | ||
uniform float u_opacity: 1.0; | ||
uniform vec4 u_sourceColor; | ||
uniform vec4 u_targetColor; | ||
uniform float u_linearColor: 0; | ||
varying vec4 v_Color; | ||
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据 | ||
#pragma include "picking" | ||
|
||
void main() { | ||
float opacity = styleMappingMat[0][0]; | ||
gl_FragColor = v_Color; | ||
// gl_FragColor.a *= u_opacity; | ||
float opacity = styleMappingMat[0][0]; | ||
float isSide = styleMappingMat[0][3]; | ||
float sidey = styleMappingMat[3][0]; | ||
float lightWeight = styleMappingMat[3][1]; | ||
|
||
if(isSide < 1.0 && u_linearColor == 1.0) { | ||
vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey); | ||
linearColor.rgb *= lightWeight; | ||
gl_FragColor = linearColor; | ||
} else { | ||
gl_FragColor = v_Color; | ||
} | ||
|
||
gl_FragColor.a *= opacity; | ||
gl_FragColor = filterColor(gl_FragColor); | ||
} |
20 changes: 16 additions & 4 deletions
20
packages/layers/src/polygon/shaders/extrude/polygon_extrude_picklight_frag.glsl
This file contains 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 |
---|---|---|
@@ -1,13 +1,25 @@ | ||
uniform float u_opacity: 1.0; | ||
uniform vec4 u_sourceColor; | ||
uniform vec4 u_targetColor; | ||
uniform float u_linearColor: 0; | ||
varying vec4 v_Color; | ||
varying mat4 styleMappingMat; // 传递从片元中传递的映射数据 | ||
#pragma include "picking" | ||
varying float v_lightWeight; | ||
|
||
void main() { | ||
float opacity = styleMappingMat[0][0]; | ||
gl_FragColor = v_Color; | ||
// gl_FragColor.a *= u_opacity; | ||
float isSide = styleMappingMat[0][3]; | ||
float sidey = styleMappingMat[3][0]; | ||
float lightWeight = styleMappingMat[3][1]; | ||
|
||
if(isSide < 1.0 && u_linearColor == 1.0) { | ||
vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey); | ||
linearColor.rgb *= lightWeight; | ||
gl_FragColor = linearColor; | ||
} else { | ||
gl_FragColor = v_Color; | ||
} | ||
|
||
gl_FragColor.a *= opacity; | ||
gl_FragColor = filterColorAlpha(gl_FragColor, v_lightWeight); | ||
gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight); | ||
} |
This file contains 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 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 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 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.