feat: render and manage textures :3
This commit is contained in:
parent
2501390225
commit
74a1be796f
21 changed files with 2908 additions and 320 deletions
|
|
@ -1,16 +1,34 @@
|
|||
|
||||
#version 450
|
||||
|
||||
// Input from vertex shader
|
||||
layout(location = 0) in vec3 fragColor;
|
||||
// layout(location = 1) in vec2 fragTexCoord; // If using textures
|
||||
layout(location = 0) in vec3 fragNormal; // Receive normal
|
||||
layout(location = 1) in vec2 fragTexCoord; // Receive texture coordinates
|
||||
|
||||
// Output color
|
||||
layout(location = 0) out vec4 outColor;
|
||||
|
||||
// layout(binding = 1) uniform sampler2D texSampler; // If using textures
|
||||
// Descriptor set for material properties (Set 1)
|
||||
layout(set = 1, binding = 0) uniform sampler2D baseColorSampler;
|
||||
|
||||
// Optional: Pass material factors via another UBO or Push Constants if needed
|
||||
// layout(set = 1, binding = 1) uniform MaterialFactors {
|
||||
// vec4 baseColorFactor;
|
||||
// } materialFactors;
|
||||
|
||||
void main() {
|
||||
// Use interpolated color
|
||||
outColor = vec4(fragColor, 1.0);
|
||||
// outColor = texture(texSampler, fragTexCoord); // If using textures
|
||||
// Sample the texture
|
||||
vec4 texColor = texture(baseColorSampler, fragTexCoord);
|
||||
|
||||
// Use the texture color
|
||||
// You might multiply by baseColorFactor here if you pass it
|
||||
// outColor = texColor * materialFactors.baseColorFactor;
|
||||
outColor = texColor;
|
||||
|
||||
// Basic fallback if texture alpha is zero (or use baseColorFactor)
|
||||
if (outColor.a == 0.0) {
|
||||
outColor = vec4(0.8, 0.8, 0.8, 1.0); // Default grey
|
||||
}
|
||||
|
||||
// You could add basic lighting using fragNormal here later
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue