Allowed setting uniforms in shader

This commit is contained in:
2026-02-03 09:37:56 +01:00
parent 991d394098
commit 32a6d498b9
6 changed files with 267 additions and 48 deletions

View File

@@ -1,5 +1,6 @@
package renderer
import "core:math/linalg"
import "core:fmt"
MAX_DRAW_COMMANDS_CAPACITY :: 4096
@@ -28,8 +29,35 @@ Post_Processing_Pass :: struct {
post_processing_nodes: [dynamic]Post_Processing_Node, // These nodes are executed after all commands have been drawn onto the render-target.
}
Uniform :: union {
Uniform_Texture,
Uniform_Float,
Uniform_Matrix4f32,
Uniform_Vector3,
}
Uniform_Texture :: struct {
index: u8,
value: ^Texture,
}
Uniform_Float :: struct {
name: string,
value: ^f32,
}
Uniform_Matrix4f32 :: struct {
name: string,
value: ^linalg.Matrix4f32,
}
Uniform_Vector3 :: struct {
name: string,
value: ^[3]f32,
}
Post_Processing_Node :: struct {
input: []^Texture,
uniforms: []Uniform,
output: ^Render_Target,
program: ^Shader_Program,