Shader material ECS example

This commit is contained in:
2026-04-10 12:48:05 -05:00
parent 37cfdde1ee
commit 673d8e0a18
20 changed files with 349 additions and 64 deletions
@@ -159,6 +159,20 @@ errorret_t shaderSetTextureDolphin(
errorOk();
}
errorret_t shaderSetColorDolphin(
shaderdolphin_t *shader,
const char_t *name,
color_t color
) {
assertNotNull(shader, "Shader must not be null");
assertNotNull(name, "Uniform name must not be null");
assertStrLenMin(name, 1, "Uniform name cannot be empty");
GX_SetChanMatColor(GX_COLOR0A0, (GXColor){ color.r, color.g, color.b, color.a });
errorOk();
}
errorret_t shaderDisposeDolphin(shaderdolphin_t *shader) {
assertNotNull(shader, "Shader must not be null");
+15 -1
View File
@@ -80,9 +80,23 @@ errorret_t shaderSetTextureDolphin(
texture_t *texture
);
/**
* Sets a color uniform in the dolphin shader.
*
* @param shader Shader to set the color in.
* @param name Name of the uniform to set.
* @param color Color to set.
* @return Error code if failure.
*/
errorret_t shaderSetColorDolphin(
shaderdolphin_t *shader,
const char_t *name,
color_t color
);
/**
* Disposes a dolphin shader. Basically does nothing.
*
*
* @param shader Shader to dispose.
* @return Error code if failure.
*/
@@ -15,4 +15,5 @@ typedef shaderdefinitiondolphin_t shaderdefinitionplatform_t;
#define shaderBindPlatform shaderBindDolphin
#define shaderSetMatrixPlatform shaderSetMatrixDolphin
#define shaderSetTexturePlatform shaderSetTextureDolphin
#define shaderSetColorPlatform shaderSetColorDolphin
#define shaderDisposePlatform shaderDisposeDolphin
@@ -8,5 +8,6 @@
#include "display/shader/shaderunlit.h"
shaderdefinition_t SHADER_UNLIT_DEFINITION = {
0
.platform = { 0 },
.upload = shaderUnlitUpload
};