feat: arc tex test

This commit is contained in:
2912401452 2021-06-01 13:43:11 +08:00
parent 320974fd58
commit 8420c3e158
3 changed files with 28 additions and 15 deletions

View File

@ -13,6 +13,9 @@ varying vec4 v_color;
uniform float u_time;
uniform vec4 u_aimate: [ 0, 2., 1.0, 0.2 ];
varying float v_u;
varying float v_segmentIndex;
#pragma include "picking"
void main() {
@ -47,4 +50,15 @@ void main() {
// gl_FragColor = filterColor(gl_FragColor);
// }
gl_FragColor = filterColor(gl_FragColor);
// gl_FragColor.a = v_u;
gl_FragColor = v_color;
if(v_segmentIndex < 15.0) {
// v_u = (segmentIndex + 1.0)/15.0;
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
} else {
// v_u = (segmentIndex + 1.0 - 15.0)/15.0;
// v_u = 0.0;
gl_FragColor = vec4(1.0, 1.0, 0.0, 1.0);
}
}

View File

@ -21,7 +21,8 @@ varying vec4 v_dash_array;
// uniform float u_icon_step: 100;
// uniform float u_line_texture;
// varying float v_u;
varying float v_segmentIndex;
varying float v_u;
// varying vec2 v_offset;
// varying float v_a;
// attribute vec2 a_iconMapUV;
@ -80,6 +81,7 @@ vec2 getNormal(vec2 line_clipspace, float offset_direction) {
void main() {
v_color = a_Color;
v_segmentIndex = a_Position.x + 1.0;
vec2 source = a_Instance.rg;
vec2 target = a_Instance.ba;
@ -107,7 +109,16 @@ void main() {
// if(LineTexture == u_line_texture) { // 开启贴图模式
// v_iconMapUV = a_iconMapUV;
// float r = (segmentIndex + 1.0)/30.0;
// if(segmentIndex < 15.0) {
// // v_u = (segmentIndex + 1.0)/15.0;
// v_color = vec4(1.0, 0.0, 0.0, 1.0);
// } else {
// // v_u = (segmentIndex + 1.0 - 15.0)/15.0;
// // v_u = 0.0;
// v_color = vec4(1.0, 1.0, 0.0, 1.0);
// }
// v_u = fract(r * 2.0);
// float arctotal_Distance = length(source - target);
// float pixelLen = project_pixel(u_icon_step);
// v_u = fract(segmentRatio * (floor(arctotal_Distance/pixelLen)));

View File

@ -30,18 +30,6 @@ export default class Amap2demo_arcLineTex extends React.Component {
);
let data = [
// {
// lng1: 91.111891,
// lat1: 40.662557,
// lng2: 120.342625,
// lat2: 37.373799,
// },
// {
// lng1: 116.98242187499999,
// lat1: 43.004647127794435,
// lng2: 105.64453124999999,
// lat2: 28.998531814051795,
// },
{
lng1: 75.76171875,
lat1: 36.31512514748051,
@ -71,7 +59,7 @@ export default class Amap2demo_arcLineTex extends React.Component {
// lineTexture: true, // 开启线的贴图功能
// iconStep: 100, // 设置贴图纹理的间距
})
.animate(true);
// .animate(true);
scene.addLayer(layer);
});
}