Merge pull request #728 from antvis/shihui_dev

Shihui dev
This commit is contained in:
@thinkinggis 2021-07-26 13:32:39 +08:00 committed by GitHub
commit 5cb6457b57
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 7 deletions

View File

@ -4,23 +4,23 @@ uniform mat4 u_cellTypeLayout; // 描述数据纹理 cell 结构的矩阵
uniform sampler2D u_dataTexture; // 数据纹理
bool hasOpacity() { // 判断 cell 中是否存在 opacity 的数据
return u_cellTypeLayout[1][0] > 0.0;
return u_cellTypeLayout[1][0] > 0.0 && u_cellTypeLayout[3][3] > 0.0;
}
bool hasStrokeOpacity() { // 判断 cell 中是否存在 strokeOpacity 的数据
return u_cellTypeLayout[1][1] > 0.0;
return u_cellTypeLayout[1][1] > 0.0 && u_cellTypeLayout[3][3] > 0.0;
}
bool hasStrokeWidth() { // 判断 cell 中是否存在 strokeWidth 的数据
return u_cellTypeLayout[1][2] > 0.0;
return u_cellTypeLayout[1][2] > 0.0 && u_cellTypeLayout[3][3] > 0.0;
}
bool hasStroke() { // 判断 cell 中是否存在 stroke 的数据
return u_cellTypeLayout[1][3] > 0.0;
return u_cellTypeLayout[1][3] > 0.0 && u_cellTypeLayout[3][3] > 0.0;
}
bool hasOffsets() { // 判断 cell 中是否存在 offsets 的数据
return u_cellTypeLayout[2][0] > 0.0;
return u_cellTypeLayout[2][0] > 0.0 && u_cellTypeLayout[3][3] > 0.0;
}
// 根据坐标位置先是计算 uv ,然后根据 uv 从数据纹理中取值

View File

@ -159,6 +159,13 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
hasOffsets: 0,
};
this.dataTextureTest = this.layerService.getOESTextureFloat();
this.dataTexture = this.createTexture2D({
data: new ImageData(1, 1).data,
mag: gl.NEAREST,
min: gl.NEAREST,
width: 1,
height: 1,
});
}
// style datatexture mapping
@ -197,7 +204,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
0.0,
0.0,
0.0,
0.0,
1.0,
];
} else {
return [
@ -216,7 +223,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}>
0.0,
0.0,
0.0,
0.0,
-1.0,
];
}
}