Split model and view matrix for clarity, destroy Vulkan resources
This commit is contained in:
parent
d7725c9b79
commit
62cc1faf33
5 changed files with 29 additions and 21 deletions
|
|
@ -11,6 +11,7 @@ layout (binding = 0) uniform UBO
|
|||
{
|
||||
mat4 projection;
|
||||
mat4 model;
|
||||
mat4 view;
|
||||
vec4 lightPos;
|
||||
vec4 viewPos;
|
||||
vec2 uvOffset;
|
||||
|
|
@ -23,16 +24,16 @@ layout (location = 3) out vec3 outLightVec;
|
|||
|
||||
out gl_PerVertex
|
||||
{
|
||||
vec4 gl_Position;
|
||||
vec4 gl_Position;
|
||||
};
|
||||
|
||||
void main()
|
||||
{
|
||||
outUV = inUV * 2.0 + ubo.uvOffset;
|
||||
vec4 pos = vec4(inPos, 1.0);
|
||||
gl_Position = ubo.projection * ubo.model * vec4(pos);
|
||||
gl_Position = ubo.projection * ubo.view * ubo.model * vec4(pos);
|
||||
|
||||
outNormal = mat3(ubo.model) * inNormal;
|
||||
outLightVec = ubo.lightPos.xyz - pos.xyz;
|
||||
outViewVec = ubo.viewPos.xyz - pos.xyz;
|
||||
outNormal = mat3(ubo.model) * inNormal;
|
||||
outLightVec = ubo.lightPos.xyz - pos.xyz;
|
||||
outViewVec = ubo.viewPos.xyz - pos.xyz;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue