Added affine texture mapping
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| #version 330 core | ||||
|  | ||||
| in vec2 UV; | ||||
| in vec3 UV; | ||||
|  | ||||
| out vec4 FragColor; | ||||
|  | ||||
| @@ -19,6 +19,6 @@ void main() { | ||||
|     FragColor += vec4(material.color, 1.0); | ||||
|   } | ||||
|   if (material.usesTex) { | ||||
|     FragColor += texture(material.tex, UV); | ||||
|     FragColor += texture(material.tex, UV.xy / UV.z); | ||||
|   } | ||||
| } | ||||
|   | ||||
| @@ -7,9 +7,10 @@ uniform mat4 MODEL; | ||||
| uniform mat4 VIEW; | ||||
| uniform mat4 PROJECTION; | ||||
|  | ||||
| out vec2 UV; | ||||
| out vec3 UV; | ||||
|  | ||||
| void main() { | ||||
|   gl_Position = PROJECTION * VIEW * MODEL * vec4(pos, 1.0); | ||||
|   UV = uv; | ||||
|   vec4 vertex = PROJECTION * VIEW * MODEL * vec4(pos, 1.0); | ||||
|   gl_Position = vertex; | ||||
|   UV = vec3(uv * vertex.z, vertex.z); | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Dane Johnson
					Dane Johnson