初次提交
This commit is contained in:
8
第17章 游戏的心脏——物理引擎/Sample17_5/assets/frag.sh
Normal file
8
第17章 游戏的心脏——物理引擎/Sample17_5/assets/frag.sh
Normal file
@@ -0,0 +1,8 @@
|
||||
precision mediump float;
|
||||
varying vec2 vTextureCoord;//接收从顶点着色器过来的参数
|
||||
uniform sampler2D sTexture;//纹理内容数据
|
||||
void main()
|
||||
{
|
||||
//给此片元颜色值
|
||||
gl_FragColor = texture2D(sTexture, vTextureCoord);
|
||||
}
|
||||
12
第17章 游戏的心脏——物理引擎/Sample17_5/assets/vertex.sh
Normal file
12
第17章 游戏的心脏——物理引擎/Sample17_5/assets/vertex.sh
Normal file
@@ -0,0 +1,12 @@
|
||||
uniform mat4 uMVPMatrix; //总变换矩阵
|
||||
uniform mat4 uMMatrix; //变换矩阵
|
||||
uniform vec3 uCamera; //摄像机位置
|
||||
attribute vec3 aPosition; //顶点位置
|
||||
attribute vec2 aTexCoor; //顶点纹理坐标
|
||||
varying vec2 vTextureCoord;
|
||||
void main()
|
||||
{
|
||||
gl_Position = uMVPMatrix * vec4(aPosition,1); //根据总变换矩阵计算此次绘制此顶点位置
|
||||
//将顶点的纹理坐标传给片元着色器
|
||||
vTextureCoord=aTexCoor;
|
||||
}
|
||||
Reference in New Issue
Block a user