Working on complex models and texture loading
This commit is contained in:
parent
6d6d9f42be
commit
c2aa4ec895
27 changed files with 780 additions and 59 deletions
|
|
@ -1,9 +1,33 @@
|
|||
#version 450
|
||||
|
||||
const int MAX_TEXTURES = 100;
|
||||
|
||||
layout(location = 0) in vec2 inTextCoords;
|
||||
layout(location = 0) out vec4 outFragColor;
|
||||
|
||||
struct Material{
|
||||
vec4 diffuseColor;
|
||||
uint hasTexture;
|
||||
uint textureIdx;
|
||||
uint padding[2];
|
||||
};
|
||||
|
||||
layout(set = 1, binding = 0) readonly buffer MaterialUniform{
|
||||
Material materials[];
|
||||
} matUniform;
|
||||
|
||||
layout(set = 2, binding = 0) uniform sampler2D textSampler[MAX_TEXTURES];
|
||||
|
||||
layout(push_constant) uniform pc{
|
||||
layout(offset = 64) uint materialIdx;
|
||||
} push_constants;
|
||||
|
||||
void main()
|
||||
{
|
||||
outFragColor = vec4(inTextCoords.x, inTextCoords.y, 0, 1);
|
||||
Material material = matUniform.materials[push_constants.materialIdx];
|
||||
if(material.hasTexture == 1){
|
||||
outFragColor = texture(textSampler[material.textureIdx],inTextCoords);
|
||||
} else{
|
||||
outFragColor = material.diffuseColor;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue