[map-sdk]地图版本3.3.3.7
@@ -38,10 +38,22 @@ uniform float waveVel;
|
||||
uniform vec4 waveColor;
|
||||
uniform float waveTime;
|
||||
in highp float waveOff;
|
||||
|
||||
uniform bool isLeadLine;
|
||||
uniform bool isLeadLineShowArrow;
|
||||
uniform bool isLeadLineShowBright;
|
||||
uniform float leadLineArrowTime;
|
||||
uniform float leadLineWaveVel;
|
||||
uniform vec4 leadLineWaveColor;
|
||||
uniform float leadLineWaveTime;
|
||||
in highp float leadLineWaveOff;
|
||||
uniform float leadLineTotalUVY;
|
||||
uniform bool isLeadLineUseWorldPos;
|
||||
out vec4 fragColor;
|
||||
in float distanceFromCamera;
|
||||
in float guideLineTexY;
|
||||
|
||||
in float leadLineTexY;
|
||||
in vec2 leadLineFlowLightUV;
|
||||
uniform bool isFogEnable;
|
||||
uniform vec3 fogColor;
|
||||
uniform float fogStart;
|
||||
@@ -57,6 +69,21 @@ uniform float blurStart;
|
||||
uniform float blurEnd;
|
||||
uniform float blurDensity;
|
||||
uniform float zoom;
|
||||
uniform bool isScaleInSkybox;
|
||||
uniform bool isRoadbed;
|
||||
uniform vec4 roadbedMixColor1;
|
||||
uniform vec4 roadbedMixColor2;
|
||||
uniform bool isGreenBelt;
|
||||
uniform vec4 greenBeltMixColor1;
|
||||
uniform vec4 greenBeltMixColor2;
|
||||
uniform bool isPlane;
|
||||
uniform vec4 planeMixColor1;
|
||||
uniform vec4 planeMixColor2;
|
||||
uniform bool isMorning;
|
||||
uniform bool isEvening;
|
||||
uniform bool isDaytime;
|
||||
uniform bool isBuilding;
|
||||
in vec4 ndc;
|
||||
void setSpotLightColor(){ //聚光灯光照效果
|
||||
lowp float r_base= 4.0;
|
||||
lowp float r_max = spotRadius * 32.0;
|
||||
@@ -106,6 +133,10 @@ void setColor(){
|
||||
fragColor = _color;
|
||||
}
|
||||
void setTex(){
|
||||
if(isScaleInSkybox){
|
||||
if(_uv.y<0.0 || _uv.y>1.0)
|
||||
discard;
|
||||
}
|
||||
fragColor = texture(texId,_uv);
|
||||
}
|
||||
float getShadowOffset(float x, float y)
|
||||
@@ -141,6 +172,48 @@ highp float k = clamp(cos(waveTime/20.0*waveVel-waveOff), 0.0,1.0);
|
||||
k = clamp(pow(k, 25.0),0.02,0.98);
|
||||
fragColor = mix(_color,waveColor,k);
|
||||
}
|
||||
void setLeadLine(){
|
||||
fragColor = _color;
|
||||
if(isLeadLineShowBright){
|
||||
float posFac = leadLineTexY / leadLineTotalUVY; //当前位置距起始位置的长度,在引导线总长度中的比例
|
||||
float flowLightIntensity0 = 0.0; //流光强度因子
|
||||
if(posFac>=0.0 && posFac<0.15) //流光强度根据距离变化
|
||||
flowLightIntensity0 = mix(0.4,0.7,smoothstep(0.0,0.15,posFac));
|
||||
else
|
||||
flowLightIntensity0 = mix(0.7,0.0,smoothstep(0.15,1.0,posFac));
|
||||
float flowLightIntensity1 = clamp(cos(leadLineWaveTime/20.0*leadLineWaveVel-leadLineFlowLightUV.y), 0.0,1.0);
|
||||
flowLightIntensity1 = pow(flowLightIntensity1, 25.0);
|
||||
if (flowLightIntensity1 > 0.98) flowLightIntensity1 = 1.0;
|
||||
else if (flowLightIntensity1 < 0.02) flowLightIntensity1 = 0.0;
|
||||
fragColor = mix(fragColor,leadLineWaveColor,flowLightIntensity1*flowLightIntensity0);
|
||||
}
|
||||
bool isArrowPixel = false;
|
||||
if(isLeadLineShowArrow){
|
||||
if(_uv.y>-10.0){
|
||||
vec2 scaleUV = _uv;
|
||||
scaleUV.y += leadLineArrowTime;
|
||||
float m = mod(scaleUV.y,5.0);
|
||||
if(m>=0.0 && m<1.0){
|
||||
scaleUV.x = (scaleUV.x - 0.5)*1.8 + 0.5; //对箭头在x方向上缩放
|
||||
if(scaleUV.x>=0.0 && scaleUV.x<=1.0){
|
||||
vec4 c = texture(texId,scaleUV);
|
||||
if(c.a>0.0){
|
||||
isArrowPixel = true;
|
||||
float k = smoothstep(-10.0,-6.0,_uv.y);
|
||||
fragColor.rgb = mix(fragColor.rgb,c.rgb,c.a*k);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!isArrowPixel){ //对引导线x方向两侧模糊,排除箭头像素
|
||||
float dis2Center = abs(_uv.x-0.5);
|
||||
const float q = 0.2; //模糊范围
|
||||
const float minAlpha = 0.3; //最边缘的透明度
|
||||
if(dis2Center>q)
|
||||
fragColor.a*=(1.0-smoothstep(q,0.5,dis2Center))*(1.0-minAlpha)+minAlpha;
|
||||
}
|
||||
}
|
||||
void setSignalLine(){
|
||||
if(signalLineObj==0){
|
||||
if(signalLineStep==0 && _uv.y>1.0)
|
||||
@@ -192,6 +265,10 @@ void setBlur()
|
||||
}
|
||||
void main()
|
||||
{
|
||||
if(isLeadLine){
|
||||
setLeadLine();
|
||||
return;
|
||||
}
|
||||
if (isRenderZebra)
|
||||
setZebra();
|
||||
else if (isRenderSignalLine)
|
||||
@@ -226,4 +303,22 @@ void main()
|
||||
}
|
||||
setLinearFog();
|
||||
setBlur();
|
||||
float y = (ndc.y / ndc.w+1.0)*0.5;
|
||||
y = smoothstep(0.0,1.0,y);
|
||||
if(isDaytime || isMorning || isEvening || isRoadbed || isGreenBelt || isPlane){
|
||||
vec4 c = vec4(0.0);
|
||||
if(isRoadbed){
|
||||
c = mix(roadbedMixColor1,roadbedMixColor2,y);
|
||||
}
|
||||
if(isGreenBelt){
|
||||
c = mix(greenBeltMixColor1,greenBeltMixColor2,y);
|
||||
}
|
||||
if(isPlane){
|
||||
c = mix(planeMixColor1,planeMixColor2,y);
|
||||
}
|
||||
if(isBuilding){
|
||||
c = mix(planeMixColor1,planeMixColor2,y);
|
||||
}
|
||||
fragColor.rgb = mix(fragColor.rgb,c.rgb,c.a);
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ uniform float blurDensity;
|
||||
uniform vec3 cameraPos;
|
||||
uniform float zoom;
|
||||
uniform bool isIce;
|
||||
uniform bool isUsePureColor;
|
||||
uniform vec4 pureColor;
|
||||
in vec3 posInEye;
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
//锚点变色逻辑,高爽写得代码,逻辑没变,复制到这
|
||||
@@ -104,7 +106,12 @@ void main()
|
||||
if(diffuse!=0.0)
|
||||
specular = pow(max(dot(H, N),0.0), specularPow); //高光系数
|
||||
vec4 oriColor=vec4(0.0); //片元原来的颜色
|
||||
oriColor = changeColorMethod(texture(texId,fragTexCoord) * colorFac);
|
||||
vec4 baseColor=vec4(0.0);
|
||||
if(isUsePureColor)
|
||||
baseColor = pureColor;
|
||||
else
|
||||
baseColor = texture(texId,fragTexCoord);
|
||||
oriColor = changeColorMethod(baseColor * colorFac);
|
||||
fragColor = oriColor * (ambientColor + diffuseColor * diffuse) + specularColor * specular; //融合这几种颜色
|
||||
fragColor+=oriColor*vec4(0.3)*max(dot(vec3(0,0,1),N),0.0); //罗欢说模型屁股那太黑,给屁股那增加点颜色
|
||||
if(isIce)
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
#version 300 es
|
||||
precision mediump float;
|
||||
uniform samplerCube texId;
|
||||
uniform samplerCube texId0;
|
||||
uniform samplerCube texId1;
|
||||
uniform bool isTwo;
|
||||
uniform float alpha;
|
||||
uniform bool isFogEnable;
|
||||
uniform vec3 fogColor;
|
||||
uniform float fogStart;
|
||||
@@ -18,6 +21,28 @@ void setLinearFog()
|
||||
}
|
||||
void main()
|
||||
{
|
||||
fragColor = texture(texId, _uv);
|
||||
vec3 uv = _uv;
|
||||
if(uv.x==1.0){
|
||||
uv.y = _uv.z;
|
||||
uv.z = -_uv.y;
|
||||
}else if(uv.x==-1.0){
|
||||
uv.y = _uv.z;
|
||||
uv.z = -_uv.y;
|
||||
}else if(uv.y==1.0){
|
||||
uv.x = -_uv.x;
|
||||
uv.z = -_uv.z;
|
||||
}else if(uv.y==-1.0){
|
||||
}
|
||||
// if(uv.y!=-1.0 && uv.x!=1.0 && uv.y!=1.0){
|
||||
// fragColor.rgba = vec4(1.0);
|
||||
// return;
|
||||
// }
|
||||
if(!isTwo){
|
||||
fragColor = texture(texId0, uv);
|
||||
}else{
|
||||
fragColor.rgb = mix(texture(texId0, uv),texture(texId1, uv),alpha).rgb;
|
||||
fragColor.a = 1.0;
|
||||
}
|
||||
// fragColor = vec4(_uv.z,0.0,0.0,1.0);
|
||||
setLinearFog();
|
||||
}
|
||||
@@ -28,8 +28,17 @@ uniform vec3 dividerPos0;
|
||||
uniform vec3 dividerPos1;
|
||||
uniform bool isGuideLine; //引导线
|
||||
uniform float guideLineTime;
|
||||
|
||||
uniform bool isLeadLine;
|
||||
uniform float leadLineWaveTime;
|
||||
uniform float leadLineArrowTime;
|
||||
uniform float leadLineTotalUVY;
|
||||
uniform bool isLeadLineUseWorldPos;
|
||||
uniform bool isScaleInSkybox;
|
||||
uniform bool isBuilding;
|
||||
layout( location = 0 ) in vec4 pos;
|
||||
layout(location = 1) in vec4 color;
|
||||
layout(location = 2) in vec3 normal;
|
||||
layout(location = 3) in vec2 uv;
|
||||
out vec4 posInLight; //从光源位置看此片元的proj坐标
|
||||
out vec4 _color;
|
||||
@@ -39,6 +48,10 @@ out vec2 _uv;
|
||||
out float signalLineTexY;
|
||||
out float waveOff;
|
||||
out float guideLineTexY;
|
||||
out float leadLineWaveOff;
|
||||
out float leadLineTexY;
|
||||
out vec2 leadLineFlowLightUV;
|
||||
out vec4 ndc;
|
||||
void setZebra(){
|
||||
vec4 pos0 = projMat*viewMat*modelMat * vec4(zebraPos0,1.0);
|
||||
vec4 pos1 = projMat*viewMat*modelMat * vec4(zebraPos1,1.0);
|
||||
@@ -63,6 +76,9 @@ void setColor(){
|
||||
}
|
||||
void setTex(){
|
||||
_uv = uv;
|
||||
if(isScaleInSkybox){
|
||||
_uv.y = (_uv.y-0.5)*2.0 + 0.5;
|
||||
}
|
||||
}
|
||||
bool hasSetPosInEye = false;
|
||||
void setPosInEye(){
|
||||
@@ -78,7 +94,20 @@ void setWater(){
|
||||
_uv.x = _uv.x + waterTime;
|
||||
}
|
||||
void setWave(){
|
||||
waveOff = pos.y / 1000.0 /2.0;
|
||||
vec4 p = modelMat * pos;
|
||||
waveOff = p.y/10.0;
|
||||
}
|
||||
void setLeadLine(){
|
||||
leadLineWaveOff = smoothstep(0.0,leadLineTotalUVY/10.0,_uv.y/10.0);
|
||||
leadLineTexY = _uv.y;
|
||||
if(isLeadLineUseWorldPos){
|
||||
vec4 p = modelMat * pos;
|
||||
_uv.y = -p.y;
|
||||
leadLineFlowLightUV.y = p.y/10.0/5.0;
|
||||
}else{
|
||||
_uv.y = -_uv.y;
|
||||
leadLineFlowLightUV = _uv + vec2(0.0,1.0)*leadLineArrowTime*5.0;
|
||||
}
|
||||
}
|
||||
void setSignalLine(){
|
||||
if(signalLineObj==1 && signalLineStep>0){
|
||||
@@ -96,8 +125,19 @@ void setGuideLine(){
|
||||
}
|
||||
void main()
|
||||
{
|
||||
if(isBuilding){
|
||||
_uv = uv;
|
||||
}
|
||||
worldPos = (modelMat * pos).xyz;
|
||||
setPosInEye();
|
||||
if(isLeadLine){
|
||||
setTex();
|
||||
setColor();
|
||||
setLeadLine();
|
||||
gl_Position = projMat*viewMat*modelMat * pos;
|
||||
ndc = gl_Position;
|
||||
return;
|
||||
}
|
||||
if(isRenderDivider){
|
||||
vec4 pos0 = projMat*viewMat*modelMat * vec4(dividerPos0,1.0);
|
||||
vec4 pos1 = projMat*viewMat*modelMat * vec4(dividerPos1,1.0);
|
||||
@@ -126,5 +166,7 @@ void main()
|
||||
setSignalLine();
|
||||
if(isGuideLine)
|
||||
setGuideLine();
|
||||
|
||||
gl_Position = projMat*viewMat*modelMat * pos;
|
||||
ndc = gl_Position;
|
||||
}
|
||||
@@ -3,10 +3,14 @@ precision mediump float;
|
||||
uniform mat4 modelMat;
|
||||
uniform mat4 viewMat;
|
||||
uniform mat4 projMat;
|
||||
uniform bool isTest;
|
||||
layout( location = 0) in vec4 pos;
|
||||
out vec3 _uv;
|
||||
void main()
|
||||
{
|
||||
gl_Position = (projMat * viewMat * modelMat * pos).xyww;
|
||||
if(isTest)
|
||||
gl_Position = (projMat * viewMat * modelMat * pos).xyzw;
|
||||
else
|
||||
gl_Position = (projMat * viewMat * modelMat * pos).xyww;
|
||||
_uv = pos.xyz;
|
||||
}
|
||||
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 13 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 7.9 KiB |
|
After Width: | Height: | Size: 10 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 2.6 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 27 KiB |
|
After Width: | Height: | Size: 5.5 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 35 KiB |
|
After Width: | Height: | Size: 365 B |
|
After Width: | Height: | Size: 368 B |
|
After Width: | Height: | Size: 366 B |
|
After Width: | Height: | Size: 824 B |
|
After Width: | Height: | Size: 827 B |
|
After Width: | Height: | Size: 823 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 1.7 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 9.5 KiB |
|
After Width: | Height: | Size: 327 B |
|
After Width: | Height: | Size: 328 B |
|
After Width: | Height: | Size: 327 B |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 761 B |
|
After Width: | Height: | Size: 760 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 23 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 22 KiB |
|
After Width: | Height: | Size: 21 KiB |
|
After Width: | Height: | Size: 25 KiB |
|
After Width: | Height: | Size: 40 KiB |
|
After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 15 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 17 KiB |
|
After Width: | Height: | Size: 1005 B |
|
After Width: | Height: | Size: 969 B |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 3.7 KiB |