初次提交

This commit is contained in:
2022-09-19 18:05:01 +08:00
commit 57051fc44b
5401 changed files with 325410 additions and 0 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,18 @@
precision mediump float;
varying vec2 vTextureCoord; //接收从顶点着色器过来的参数
uniform sampler2D sTexture;//纹理内容数据
uniform int uisButtonDown;//按钮是否按下,如果按下,改变其不透明度
void main()
{
//给此片元从纹理中采样出颜色值
vec4 finalColor = texture2D(sTexture, vTextureCoord);
if(uisButtonDown==1)//当前按钮按下
{
gl_FragColor=finalColor*0.5;
}
else
{
gl_FragColor=finalColor;
}
}

View File

@@ -0,0 +1,13 @@
precision mediump float;
//接收从顶点着色器过来的参数
uniform float colorR;//颜色值的R分量
uniform float colorG;//颜色值的G分量
uniform float colorB;//颜色值的B分量
uniform float colorA;
void main()
{
//将计算出的颜色给此片元
vec4 finalColor;
finalColor=vec4(colorR,colorG,colorB,colorA);
gl_FragColor = finalColor;//给此片元颜色值
}

View File

@@ -0,0 +1,85 @@
precision mediump float;
varying vec2 vTextureCoord; //接收纹理坐标参数
varying float vertexHeight;//接受顶点的高度值
uniform sampler2D usTextureTuCeng;//纹理内容数据 ----土层
uniform sampler2D usTextureCaoDi;//纹理内容数据-----草地
uniform sampler2D usTextureShiTou;//纹理内容数据-----石头
uniform sampler2D usTextureShanDing;//纹理内容数据-----山顶
uniform float uheight;//最低点高度
uniform float uheight_span;
uniform int uland_flag;//山的标志1为地面上的高山
void main()
{
//第一块地图的高度
float height1=30.0;//第一个的渐变高度
float height2=30.0;
float height3=10.0;
float land1=250.0;//陆地山的过度
float land2=400.0;
vec4 finalColor0=vec4(0.3,0.3,0.3,0.5);//黑色条
vec4 finalColor1=texture2D(usTextureTuCeng, vTextureCoord);//土层
vec4 finalColor2=texture2D(usTextureCaoDi, vTextureCoord); //草地
vec4 finalColor3=texture2D(usTextureShiTou, vTextureCoord);//石头
vec4 finalColor4=texture2D(usTextureShanDing, vTextureCoord);//山顶纹理
if(uland_flag==0)
{
if(abs(vertexHeight)<uheight)
{
float ratio=abs(vertexHeight)/uheight;
finalColor3 *=(1.0-ratio);
finalColor0 *=ratio;
gl_FragColor =finalColor3+ finalColor0;
}
else if(abs(vertexHeight)>=uheight&&abs(vertexHeight)<=uheight+height1)//第一个渐变高度
{
float ratio=(abs(vertexHeight)-uheight)/height1;
finalColor0 *=(1.0-ratio);
finalColor1 *=ratio;
gl_FragColor =finalColor1 + finalColor0;
}
else if(abs(vertexHeight)>uheight+height1&&abs(vertexHeight)<=uheight_span-height2)
{
gl_FragColor =finalColor1;
}
else if(abs(vertexHeight)>=uheight_span-height2&&abs(vertexHeight)<=uheight_span)
{
float ratio=(abs(vertexHeight)-uheight_span+height2)/height2;
finalColor1 *=(1.0-ratio);
finalColor0 *=ratio;
gl_FragColor =finalColor1 + finalColor0;
}
else if(abs(vertexHeight)>=uheight_span&&abs(vertexHeight)<=uheight_span+height3)
{
float ratio=(abs(vertexHeight)-uheight_span)/height3;
finalColor0 *=(1.0-ratio);
finalColor2 *=ratio;
finalColor0.a=0.2;
gl_FragColor =finalColor2 + finalColor0;
}
else
{
gl_FragColor = finalColor2;
}
}
else
{
if(abs(vertexHeight)<land1)
{
gl_FragColor = finalColor2;
}
else if(abs(vertexHeight)>=land1&&abs(vertexHeight)<=land2)
{
float ratio=(abs(vertexHeight)-land1)/(land2-land1);
finalColor2 *=(1.0-ratio);
finalColor4 *=ratio;
gl_FragColor =finalColor2 + finalColor4;
}
else
{
gl_FragColor = finalColor4;
}
}
}

View File

@@ -0,0 +1,8 @@
precision mediump float;
varying vec2 vTextureCoord; //接收从顶点着色器过来的参数
uniform sampler2D sTexture;//纹理内容数据
void main()
{
//给此片元从纹理中采样出颜色值
gl_FragColor = texture2D(sTexture, vTextureCoord);
}

View File

@@ -0,0 +1,14 @@
//具有纹理功能的片元着色器
precision mediump float;
varying vec2 vTextureCoord; //接收从顶点着色器过来的参数
uniform sampler2D sTexture;//纹理内容数据
uniform float stK;
void main()
{
//纹理坐标ST的偏移量
vec2 st_Result=vec2(0,0);
st_Result.x=vTextureCoord.x+stK;
st_Result.y=vTextureCoord.y;
//给此片元从纹理中采样出颜色值
gl_FragColor = texture2D(sTexture, st_Result);
}

View File

@@ -0,0 +1,5 @@
//星空着色器
precision mediump float;
void main(){
gl_FragColor = vec4(1.0,1.0,1.0,1.0); //给此片元颜色值
}

View File

@@ -0,0 +1,18 @@
precision mediump float;
varying vec2 vTextureCoord; //接收纹理坐标参数
varying float vertexHeight;//接受顶点的高度值
varying float vertexwhidth;//接受血的最左边位置
uniform sampler2D sTexture;//纹理内容数据
uniform float ublood;
void main()
{
vec4 finalColor=texture2D(sTexture, vTextureCoord);
if(vertexwhidth<ublood&&vertexwhidth>-97.0&&vertexwhidth<97.0&&vertexHeight>-6.5&&vertexHeight<6.5)
{
gl_FragColor = vec4(0.5,0.17,0.04,1.0);
}
else
{
gl_FragColor=finalColor;
}
}

View File

@@ -0,0 +1,133 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# ´´˝¨ľÄÎÄźţ:16.09.2011 22:45:41
#
# object Cylinder02
#
v -0.0357 0.0470 -0.0971
v 0.4643 -0.8192 -0.1158
v 0.9643 0.0470 -0.0971
v -0.5357 -0.8192 -0.1158
v -1.0357 0.0470 -0.0971
v -0.5357 0.9132 -0.0785
v 0.4643 0.9132 -0.0785
v 0.4643 -0.7180 -25.5408
v 0.9643 0.1482 -25.5223
v -0.5357 -0.7180 -25.5408
v -1.0357 0.1482 -25.5223
v -0.5357 1.0144 -25.5037
v 0.4643 1.0144 -25.5037
v -0.0357 0.1482 -25.5223
# 14 vertices
vt 0.5000 0.0000 0.0000
vt 0.9167 0.0000 0.0000
vt 0.7500 0.0000 0.0000
vt 0.0833 0.0000 0.0000
vt -0.0833 0.0000 0.0000
vt 0.2500 0.0000 0.0000
vt 0.4167 0.0000 0.0000
vt 0.5833 0.0000 0.0000
vt 0.9167 1.0000 0.0000
vt 0.7500 1.0000 0.0000
vt 0.0833 1.0000 0.0000
vt -0.0833 1.0000 0.0000
vt 0.2500 1.0000 0.0000
vt 0.4167 1.0000 0.0000
vt 0.5833 1.0000 0.0000
vt 0.5000 1.0000 0.0000
# 16 texture coords
g Cylinder02
f 1/1 2/2 3/3
f 1/1 4/4 2/5
f 1/1 5/6 4/4
f 1/1 6/7 5/6
f 1/1 7/8 6/7
f 1/1 3/3 7/8
f 3/3 8/9 9/10
f 3/3 2/2 8/9
f 2/5 10/11 8/12
f 2/5 4/4 10/11
f 4/4 11/13 10/11
f 4/4 5/6 11/13
f 5/6 12/14 11/13
f 5/6 6/7 12/14
f 6/7 13/15 12/14
f 6/7 7/8 13/15
f 7/8 9/10 13/15
f 7/8 3/3 9/10
f 14/16 9/10 8/9
f 14/16 8/12 10/11
f 14/16 10/11 11/13
f 14/16 11/13 12/14
f 14/16 12/14 13/15
f 14/16 13/15 9/10
# 24 faces
#
# object Cylinder03
#
v -0.0069 0.0013 -20.4433
v 0.7431 -1.2956 -20.5194
v 1.4931 0.0013 -20.4433
v -0.7569 -1.2956 -20.5194
v -1.5069 0.0013 -20.4433
v -0.7569 1.2981 -20.3673
v 0.7431 1.2981 -20.3673
v 0.7431 -1.0615 -24.5125
v 1.4931 0.2353 -24.4365
v -0.7569 -1.0615 -24.5125
v -1.5069 0.2353 -24.4365
v -0.7569 1.5321 -24.3605
v 0.7431 1.5321 -24.3605
v -0.0069 0.2353 -24.4365
# 14 vertices
vt 0.5000 0.0000 0.0000
vt 0.9167 0.0000 0.0000
vt 0.7500 0.0000 0.0000
vt 0.0833 0.0000 0.0000
vt -0.0833 0.0000 0.0000
vt 0.2500 0.0000 0.0000
vt 0.4167 0.0000 0.0000
vt 0.5833 0.0000 0.0000
vt 0.9167 1.0000 0.0000
vt 0.7500 1.0000 0.0000
vt 0.0833 1.0000 0.0000
vt -0.0833 1.0000 0.0000
vt 0.2500 1.0000 0.0000
vt 0.4167 1.0000 0.0000
vt 0.5833 1.0000 0.0000
vt 0.5000 1.0000 0.0000
# 16 texture coords
g Cylinder03
f 15/17 16/18 17/19
f 15/17 18/20 16/21
f 15/17 19/22 18/20
f 15/17 20/23 19/22
f 15/17 21/24 20/23
f 15/17 17/19 21/24
f 17/19 22/25 23/26
f 17/19 16/18 22/25
f 16/21 24/27 22/28
f 16/21 18/20 24/27
f 18/20 25/29 24/27
f 18/20 19/22 25/29
f 19/22 26/30 25/29
f 19/22 20/23 26/30
f 20/23 27/31 26/30
f 20/23 21/24 27/31
f 21/24 23/26 27/31
f 21/24 17/19 23/26
f 28/32 23/26 22/25
f 28/32 22/28 24/27
f 28/32 24/27 25/29
f 28/32 25/29 26/30
f 28/32 26/30 27/31
f 28/32 27/31 23/26
# 24 faces

View File

@@ -0,0 +1,186 @@
# 3ds Max Wavefront OBJ Exporter v0.97b - (c)2007 guruware
# ´´˝¨ľÄÎÄźţ:16.09.2011 21:11:21
mtllib tank.mtl
#
# object Cylinder01
#
v 7.9507 13.8365 -0.0018
v 3.0543 18.3818 -3.3152
v 4.3703 18.3818 -0.0018
v 5.5860 13.8365 -5.7614
v -0.1228 18.3818 -4.6876
v -0.1228 13.8365 -8.1471
v -3.2999 18.3818 -3.3152
v -5.8316 13.8365 -5.7614
v -4.6158 18.3818 -0.0018
v -8.1962 13.8365 -0.0018
v -3.2999 18.3818 3.3116
v -5.8316 13.8365 5.7578
v -0.1228 18.3818 4.6840
v -0.1228 13.8365 8.1435
v 3.0543 18.3818 3.3116
v 5.5860 13.8365 5.7578
v -0.1228 18.3818 -0.0018
# 17 vertices
vt 0.7500 0.0000 0.0000
vt 0.8750 1.0000 0.0000
vt 0.7500 1.0000 0.0000
vt 0.8750 0.0000 0.0000
vt -0.1250 0.0000 0.0000
vt 0.0000 1.0000 0.0000
vt -0.1250 1.0000 0.0000
vt 0.0000 0.0000 0.0000
vt 0.1250 1.0000 0.0000
vt 0.1250 0.0000 0.0000
vt 0.2500 1.0000 0.0000
vt 0.2500 0.0000 0.0000
vt 0.3750 1.0000 0.0000
vt 0.3750 0.0000 0.0000
vt 0.5000 1.0000 0.0000
vt 0.5000 0.0000 0.0000
vt 0.6250 1.0000 0.0000
vt 0.6250 0.0000 0.0000
# 18 texture coords
g Cylinder01
usemtl initialShadingGroup
f 1/1 2/2 3/3
f 1/1 4/4 2/2
f 4/5 5/6 2/7
f 4/5 6/8 5/6
f 6/8 7/9 5/6
f 6/8 8/10 7/9
f 8/10 9/11 7/9
f 8/10 10/12 9/11
f 10/12 11/13 9/11
f 10/12 12/14 11/13
f 12/14 13/15 11/13
f 12/14 14/16 13/15
f 14/16 15/17 13/15
f 14/16 16/18 15/17
f 16/18 3/3 15/17
f 16/18 1/1 3/3
f 17/15 3/3 2/2
f 17/15 2/7 5/6
f 17/15 5/6 7/9
f 17/15 7/9 9/11
f 17/15 9/11 11/13
f 17/15 11/13 13/15
f 17/15 13/15 15/17
f 17/15 15/17 3/3
# 24 faces
#
# object Box01
#
v -10.6728 13.8499 10.4160
v 10.3698 13.8499 10.4160
v 10.3698 13.8499 -11.3723
v -10.6728 13.8499 -11.3723
v -10.6728 8.8499 17.8421
v 10.3698 8.8499 17.8421
v 10.3698 11.3499 14.6786
v -10.6728 11.3499 14.6786
v 10.3698 8.8499 -20.1192
v 10.3698 10.1006 -18.3504
v -10.6728 8.8499 -20.1192
v -10.6728 10.1006 -18.3504
# 12 vertices
vt 0.0000 0.0000 0.0000
vt 1.0000 0.0000 0.0000
vt 1.0000 1.0000 0.0000
vt 0.0000 1.0000 0.0000
vt 1.0000 0.5000 0.0000
vt 0.0000 0.5000 0.0000
# 6 texture coords
g Box01
usemtl initialShadingGroup
f 18/19 19/20 20/21
f 20/21 21/22 18/19
f 22/19 23/20 24/23
f 24/23 25/24 22/19
f 25/24 24/23 19/21
f 19/21 18/22 25/24
f 23/19 26/20 27/23
f 27/23 24/24 23/19
f 24/24 27/23 20/21
f 20/21 19/22 24/24
f 26/19 28/20 29/23
f 29/23 27/24 26/19
f 27/24 29/23 21/21
f 21/21 20/22 27/24
f 28/19 22/20 25/23
f 25/23 29/24 28/19
f 29/24 25/23 18/21
f 18/21 21/22 29/24
# 18 faces
#
# object Box02
#
v -10.5444 0.1708 13.8325
v -10.5444 0.1708 -14.1778
v 10.5210 0.1708 -14.1778
v 10.5210 0.1708 13.8325
v 10.5210 2.5185 16.8031
v -10.5444 2.2558 16.8031
v 10.5210 5.9917 18.6752
v -10.5444 5.9917 18.6752
v 10.5210 9.0335 17.6845
v -10.5444 9.0335 17.6845
v 10.5210 2.2250 -17.3194
v 10.5210 7.1370 -21.4220
v 10.5210 8.9859 -19.8319
v -10.5444 2.2250 -17.3194
v -10.5444 7.1370 -21.4220
v -10.5444 8.9859 -19.8319
# 16 vertices
vt 1.0000 0.0000 0.0000
vt 1.0000 1.0000 0.0000
vt 0.0000 1.0000 0.0000
vt 0.0000 0.0000 0.0000
vt 1.0000 0.3333 0.0000
vt 0.0000 0.3333 0.0000
vt 1.0000 0.6667 0.0000
vt 0.0000 0.6667 0.0000
# 8 texture coords
g Box02
usemtl initialShadingGroup
f 30/25 31/26 32/27
f 32/27 33/28 30/25
f 30/28 33/25 34/29
f 34/29 35/30 30/28
f 35/30 34/29 36/31
f 36/31 37/32 35/30
f 37/32 36/31 38/26
f 38/26 39/27 37/32
f 33/28 32/25 40/29
f 40/29 34/30 33/28
f 34/30 40/29 41/31
f 41/31 36/32 34/30
f 36/32 41/31 42/26
f 42/26 38/27 36/32
f 32/28 31/25 43/29
f 43/29 40/30 32/28
f 40/30 43/29 44/31
f 44/31 41/32 40/30
f 41/32 44/31 45/26
f 45/26 42/27 41/32
f 31/28 30/25 35/29
f 35/29 43/30 31/28
f 43/30 35/29 37/31
f 37/31 44/32 43/30
f 44/32 37/31 39/26
f 39/26 45/27 44/32
# 26 faces

View File

@@ -0,0 +1,11 @@
uniform mat4 uMVPMatrix; //总变换矩阵
attribute vec3 aPosition; //顶点位置
attribute vec2 aTexCoor; //顶点纹理坐标
varying vec2 vTextureCoord; //用于传递给片元着色器的变量
varying float positonX;
void main()
{
gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置
vTextureCoord = aTexCoor;//将接收的纹理坐标传递给片元着色器
positonX=aPosition.x;
}

View File

@@ -0,0 +1,6 @@
uniform mat4 uMVPMatrix; //总变换矩阵
attribute vec3 aPosition; //顶点位置
void main()
{
gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置
}

View File

@@ -0,0 +1,11 @@
//山地的顶点着色器
uniform mat4 uMVPMatrix; //总变换矩阵
attribute vec3 aPosition; //顶点位置
attribute vec2 aTexCoor; //顶点纹理坐标
varying vec2 vTextureCoord; //用于传递给片元着色器的变量
varying float vertexHeight;//接受顶点的高度值
void main(){
gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置
vTextureCoord = aTexCoor;//将接收的纹理坐标传递给片元着色器
vertexHeight = aPosition.y;//将该顶点的高度传入片元着色器
}

View File

@@ -0,0 +1,9 @@
uniform mat4 uMVPMatrix; //总变换矩阵
attribute vec3 aPosition; //顶点位置
attribute vec2 aTexCoor; //顶点纹理坐标
varying vec2 vTextureCoord; //用于传递给片元着色器的变量
void main()
{
gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置
vTextureCoord = aTexCoor;//将接收的纹理坐标传递给片元着色器
}

View File

@@ -0,0 +1,10 @@
//绘制水面具有波浪功能的顶点着色器
uniform mat4 uMVPMatrix; //总变换矩阵
attribute vec3 aPosition; //顶点位置
attribute vec2 aTexCoor; //顶点纹理坐标
varying vec2 vTextureCoord; //用于传递给片元着色器的变量
void main()
{
gl_Position = uMVPMatrix * vec4(aPosition,1);
vTextureCoord = aTexCoor;//将接收的纹理坐标传递给片元着色器
}

View File

@@ -0,0 +1,8 @@
//星空着色器
uniform mat4 uMVPMatrix; //总变换矩阵
uniform float uPointSize;//点尺寸
attribute vec3 aPosition; //顶点位置
void main(){
gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置
gl_PointSize=uPointSize;
}

View File

@@ -0,0 +1,13 @@
uniform mat4 uMVPMatrix; //总变换矩阵
attribute vec3 aPosition; //顶点位置
attribute vec2 aTexCoor; //顶点纹理坐标
varying vec2 vTextureCoord; //用于传递给片元着色器的变量
varying float vertexHeight;//接受顶点的高度值
varying float vertexwhidth;//接受血的最左边位置
void main()
{
gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置
vTextureCoord = aTexCoor;//将接收的纹理坐标传递给片元着色器
vertexHeight = aPosition.y;//将该顶点的高度传入片元着色器
vertexwhidth=aPosition.x;
}