Rransforms are all sent to the gpu with one buffer
This commit is contained in:
parent
9a5ffc70a5
commit
d010954abb
4 changed files with 29 additions and 9 deletions
|
|
@ -4,6 +4,7 @@ struct Transform {
|
|||
mat4 translation;
|
||||
mat4 scale;
|
||||
mat4 rotation;
|
||||
vec4 quaternion;
|
||||
};
|
||||
|
||||
layout(location = 0) in vec3 vertPos;
|
||||
|
|
@ -26,8 +27,13 @@ layout(location = 2) out vec3 Normal;
|
|||
layout(location = 3) out vec3 FragPos;
|
||||
layout(location = 4) out vec2 TexCoords;
|
||||
|
||||
layout(push_constant) uniform pc {
|
||||
layout(offset = 4) int transform_index;
|
||||
} pushConstants;
|
||||
|
||||
void main() {
|
||||
mat4 transformation = transform.transforms[0].translation * transform.transforms[0].scale * transform.transforms[0].rotation;
|
||||
int transform_index = pushConstants.transform_index;
|
||||
mat4 transformation = transform.transforms[transform_index].translation * transform.transforms[transform_index].scale * transform.transforms[transform_index].rotation;
|
||||
vec4 out_vec = proj.proj * view.view * transformation * vec4(vertPos, 1.0);
|
||||
FragPos = vec3(transformation * vec4(vertPos, 1.0));
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue