Added [models] example - skybox loading and drawing
This commit is contained in:
parent
553871567e
commit
382cbda3de
4 changed files with 168 additions and 0 deletions
24
examples/models/skybox/skybox.vs
Normal file
24
examples/models/skybox/skybox.vs
Normal file
|
@ -0,0 +1,24 @@
|
|||
#version 330
|
||||
|
||||
// input vertex attributes
|
||||
in vec3 vertexPosition;
|
||||
|
||||
// input uniform values
|
||||
uniform mat4 matProjection;
|
||||
uniform mat4 matView;
|
||||
|
||||
// output vertex attributes (to fragment shader)
|
||||
out vec3 fragPosition;
|
||||
|
||||
void main()
|
||||
{
|
||||
// calculate fragment position based on model transformations
|
||||
fragPosition = vertexPosition;
|
||||
|
||||
// remove translation from the view matrix
|
||||
mat4 rotView = mat4(mat3(matView));
|
||||
vec4 clipPos = matProjection*rotView*vec4(vertexPosition, 1.0);
|
||||
|
||||
// calculate final vertex position
|
||||
gl_Position = clipPos;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue