diff --git a/packages/layers/src/polygon/polygon3D.ts b/packages/layers/src/polygon/polygon3D.ts index 79457439ad..b47db2d26d 100644 --- a/packages/layers/src/polygon/polygon3D.ts +++ b/packages/layers/src/polygon/polygon3D.ts @@ -1,8 +1,8 @@ import { AttributeType, gl, IEncodeFeature, ILayer } from '@l7/core'; import BaseLayer from '../core/BaseLayer'; import { PolygonExtrudeTriangulation } from '../core/triangulation'; -import pointExtrudeFrag from './shaders/polygon_frag.glsl'; -import pointExtrudeVert from './shaders/polygon_vert.glsl'; +import pointExtrudeFrag from './shaders/polygon_extrude_frag.glsl'; +import pointExtrudeVert from './shaders/polygon_extrude_vert.glsl'; interface IPointLayerStyleOptions { opacity: number; } diff --git a/packages/layers/src/polygon/shaders/polygon_extrude_frag.glsl b/packages/layers/src/polygon/shaders/polygon_extrude_frag.glsl new file mode 100644 index 0000000000..72a94d2edc --- /dev/null +++ b/packages/layers/src/polygon/shaders/polygon_extrude_frag.glsl @@ -0,0 +1,10 @@ +uniform float u_Opacity: 1.0; +varying vec4 v_Color; + +#pragma include "picking" + +void main() { + gl_FragColor = v_Color; + gl_FragColor.a *= u_Opacity; + gl_FragColor = filterColor(gl_FragColor); +} diff --git a/packages/layers/src/polygon/shaders/polygon_extrude_vert.glsl b/packages/layers/src/polygon/shaders/polygon_extrude_vert.glsl new file mode 100644 index 0000000000..4eeca1eace --- /dev/null +++ b/packages/layers/src/polygon/shaders/polygon_extrude_vert.glsl @@ -0,0 +1,19 @@ +attribute vec4 a_Color; +attribute vec3 a_Position; +attribute vec3 a_Normal; +attribute float a_Size; +uniform mat4 u_ModelMatrix; + +varying vec4 v_Color; + +#pragma include "projection" +#pragma include "picking" + +void main() { + v_Color = vec4(a_Normal,1.0); + vec4 project_pos = project_position(vec4(a_Position.xy,a_Position.z * a_Size, 1.0)); + gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); + + setPickingColor(a_PickingColor); +} + diff --git a/packages/layers/src/polygon/shaders/polygon_vert.glsl b/packages/layers/src/polygon/shaders/polygon_vert.glsl index 4eeca1eace..710449f147 100644 --- a/packages/layers/src/polygon/shaders/polygon_vert.glsl +++ b/packages/layers/src/polygon/shaders/polygon_vert.glsl @@ -10,8 +10,8 @@ varying vec4 v_Color; #pragma include "picking" void main() { - v_Color = vec4(a_Normal,1.0); - vec4 project_pos = project_position(vec4(a_Position.xy,a_Position.z * a_Size, 1.0)); + v_Color =a_Color; + vec4 project_pos = project_position(vec4(a_Position 1.0)); gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0)); setPickingColor(a_PickingColor);