@@ -49,18 +49,15 @@ var gl_polygonFeature = function (arg) {
4949 'attribute float fillOpacity;' ,
5050 'uniform mat4 modelViewMatrix;' ,
5151 'uniform mat4 projectionMatrix;' ,
52- 'uniform float pixelWidth;' ,
53- 'varying vec3 fillColorVar;' ,
54- 'varying float fillOpacityVar;' ,
52+ 'varying vec4 fillColorVar;' ,
5553
5654 'void main(void)' ,
5755 '{' ,
5856 ' vec4 clipPos = projectionMatrix * modelViewMatrix * vec4(pos.xyz, 1);' ,
5957 ' if (clipPos.w != 0.0) {' ,
6058 ' clipPos = clipPos/clipPos.w;' ,
6159 ' }' ,
62- ' fillColorVar = fillColor;' ,
63- ' fillOpacityVar = fillOpacity;' ,
60+ ' fillColorVar = vec4(fillColor, fillOpacity);' ,
6461 ' gl_Position = clipPos;' ,
6562 '}'
6663 ] . join ( '\n' ) ,
@@ -74,10 +71,9 @@ var gl_polygonFeature = function (arg) {
7471 '#ifdef GL_ES' ,
7572 ' precision highp float;' ,
7673 '#endif' ,
77- 'varying vec3 fillColorVar;' ,
78- 'varying float fillOpacityVar;' ,
74+ 'varying vec4 fillColorVar;' ,
7975 'void main () {' ,
80- ' gl_FragColor = vec4 ( fillColorVar, fillOpacityVar) ;' ,
76+ ' gl_FragColor = fillColorVar;' ,
8177 '}'
8278 ] . join ( '\n' ) ,
8379 shader = new vgl . shader ( vgl . GL . FRAGMENT_SHADER ) ;
@@ -105,20 +101,23 @@ var gl_polygonFeature = function (arg) {
105101 var posBuf , posFunc ,
106102 fillColor , fillColorFunc , fillColorVal ,
107103 fillOpacity , fillOpacityFunc , fillOpacityVal ,
104+ fillFunc , fillVal ,
108105 uniformPolyFunc , uniform ,
109106 indices ,
110107 items = [ ] ,
111108 target_gcs = m_this . gcs ( ) ,
112109 map_gcs = m_this . layer ( ) . map ( ) . gcs ( ) ,
113110 numPts = 0 ,
114111 geom = m_mapper . geometryData ( ) ,
115- color , opacity , d , d3 , vertices , i , j , k , n ,
112+ color , opacity , fill , d , d3 , vertices , i , j , k , n ,
116113 record , item , itemIndex , original ;
117114
118115 fillColorFunc = m_this . style . get ( 'fillColor' ) ;
119116 fillColorVal = util . isFunction ( m_this . style ( 'fillColor' ) ) ? undefined : fillColorFunc ( ) ;
120117 fillOpacityFunc = m_this . style . get ( 'fillOpacity' ) ;
121118 fillOpacityVal = util . isFunction ( m_this . style ( 'fillOpacity' ) ) ? undefined : fillOpacityFunc ( ) ;
119+ fillFunc = m_this . style . get ( 'fill' ) ;
120+ fillVal = util . isFunction ( m_this . style ( 'fill' ) ) ? undefined : fillFunc ( ) ;
122121 uniformPolyFunc = m_this . style . get ( 'uniformPolygon' ) ;
123122
124123 if ( ! onlyStyle ) {
@@ -190,6 +189,7 @@ var gl_polygonFeature = function (arg) {
190189 d = d3 = 0 ;
191190 color = fillColorVal ;
192191 opacity = fillOpacityVal ;
192+ fill = fillVal ;
193193 for ( k = 0 ; k < items . length ; k += 1 ) {
194194 n = items [ k ] . triangles . length ;
195195 vertices = items [ k ] . vertices ;
@@ -205,6 +205,12 @@ var gl_polygonFeature = function (arg) {
205205 opacity = fillOpacityFunc ( vertices [ 0 ] , 0 , item , itemIndex ) ;
206206 }
207207 }
208+ if ( fillVal === undefined ) {
209+ fill = fillFunc ( item , itemIndex ) ;
210+ }
211+ if ( ! fill ) {
212+ opacity = 0 ;
213+ }
208214 if ( uniform && onlyStyle && items [ k ] . uniform && items [ k ] . color &&
209215 color . r === items [ k ] . color . r && color . g === items [ k ] . color . g &&
210216 color . b === items [ k ] . color . b && opacity === items [ k ] . opacity ) {
0 commit comments