src/shader.c

changeset 167
8e6a661c87db
parent 163
3628cc3c0483
--- a/src/shader.c	Tue Jun 24 20:09:47 2025 +0200
+++ b/src/shader.c	Tue Jun 24 20:21:38 2025 +0200
@@ -25,9 +25,10 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "ascension/shader.h"
+
 #include "ascension/context.h"
 #include "ascension/error.h"
-#include "ascension/shader.h"
 #include "ascension/filesystem.h"
 
 #include <string.h>
@@ -262,3 +263,19 @@
     // also clear the active program to avoid accidental matches with newly created shaders
     asc_shader_use(NULL, NULL);
 }
+
+void asc_shader_upload_model_matrix(const AscShaderProgram *shader, const AscSceneNode *node) {
+    glUniformMatrix4fv(shader->model, 1,GL_FALSE, node->world_transform);
+}
+
+void asc_shader_upload_col4f(int uniform_id, asc_col4f color) {
+    glUniform4f(uniform_id, color.red, color.green, color.blue, color.alpha);
+}
+
+void asc_shader_upload_float(int uniform_id, float value) {
+    glUniform1f(uniform_id, value);
+}
+
+void asc_shader_upload_vec2f(int uniform_id, asc_vec2f value) {
+    glUniform2f(uniform_id, value.x, value.y);
+}

mercurial