同步3.1.0修改

This commit is contained in:
jiaguofeng
2023-09-01 19:47:54 +08:00
parent 43f99b3043
commit 62257acf05
40 changed files with 899 additions and 593 deletions

View File

@@ -27,6 +27,7 @@ uniform bool isWater; //水系
uniform vec4 waterColor;
uniform vec3 cameraPos;
uniform float shadowResolution;
uniform bool isLightWave;
in vec4 posInLight;
in vec4 _color;
in highp vec3 posInEye;
@@ -38,12 +39,14 @@ uniform float waveTime;
in highp float waveOff;
out vec4 fragColor;
in float distanceFromCamera;
in float guideLineTexY;
uniform bool isFogEnable;
uniform vec3 fogColor;
uniform float fogStart;
uniform float fogEnd;
uniform float fogDensity;
uniform bool isGuideLine; //引导线
void setSpotLightColor(){ //聚光灯光照效果
lowp float r_base= 4.0;
lowp float r_max = spotRadius * 32.0;
@@ -141,6 +144,11 @@ void setLinearFog()
fogAlpha=clamp(fogAlpha,0.0,1.0)*fogDensity;
fragColor.rgb = mix(fragColor.rgb,fogColor,fogAlpha);
}
void setGuideLine(){
fragColor = texture(texId,_uv);
// if(fragColor.a>0.1)
// fragColor.a = clamp(1.0/guideLineTexY,0.0,1.0);
}
void main()
{
@@ -150,6 +158,8 @@ void main()
setSignalLine();
else if (isWave)
setWave();
else if(isGuideLine)
setGuideLine();
else if (isRenderText)
setText();
else if (isTex)
@@ -165,5 +175,9 @@ void main()
fragColor = waterColor*dot(normalize(fragColor.rgb), vec3(0.0, 0.0, 1.0));
fragColor.a = 1.0;
}
if(isLightWave){
if(_uv.y>0.9)
fragColor.a = 0.0;
}
setLinearFog();
}

View File

@@ -5,6 +5,9 @@ in float _alphaFac;
layout(location = 0) out vec4 color;
void main()
{
color = texture(tex,gl_PointCoord);
vec4 c = texture(tex,gl_PointCoord);
if(c.a<0.3)
discard;
color = c;
color.a = color.a * _alphaFac;
}

View File

@@ -25,6 +25,8 @@ uniform float waterTime; //水系滚动时间
uniform bool isRenderDivider;
uniform vec3 dividerPos0;
uniform vec3 dividerPos1;
uniform bool isGuideLine; //引导线
uniform float guideLineTime;
layout( location = 0 ) in vec4 pos;
layout(location = 1) in vec4 color;
layout(location = 3) in vec2 uv;
@@ -34,6 +36,7 @@ out vec3 posInEye; //片元的view坐标
out vec2 _uv;
out float signalLineTexY;
out float waveOff;
out float guideLineTexY;
void setZebra(){
vec4 pos0 = projMat*viewMat*modelMat * vec4(zebraPos0,1.0);
vec4 pos1 = projMat*viewMat*modelMat * vec4(zebraPos1,1.0);
@@ -83,6 +86,12 @@ void setSignalLine(){
_uv = _uv + vec2(0.0,1.0)*signalLineTime;
}
}
void setGuideLine(){
_uv.x = uv.x;
_uv.y = -uv.y;
_uv = _uv + vec2(0.0,1.0)*guideLineTime;
guideLineTexY = uv.y;
}
void main()
{
setPosInEye();
@@ -112,5 +121,7 @@ void main()
setWater();
if(isRenderSignalLine)
setSignalLine();
if(isGuideLine)
setGuideLine();
gl_Position = projMat*viewMat*modelMat * pos;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 261 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 265 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB