diff options
author | pryazha <pryadeiniv@mail.ru> | 2025-08-04 01:19:01 +0500 |
---|---|---|
committer | pryazha <pryadeiniv@mail.ru> | 2025-08-04 01:19:01 +0500 |
commit | 99337878eca2807436bcf11d36946b90db44a2d3 (patch) | |
tree | cc1acfb8ec79abcc8d5323680dfd574fc5436f03 /libs | |
parent | 2e64d3c5d6eb1eb04168d39d5eb5f2d89af1a8b0 (diff) |
Diffstat (limited to 'libs')
-rw-r--r-- | libs/common.h | 13 | ||||
-rw-r--r-- | libs/pwyazh/v2f.h | 7 | ||||
-rw-r--r-- | libs/pwyazh/v3f.h | 7 |
3 files changed, 22 insertions, 5 deletions
diff --git a/libs/common.h b/libs/common.h index 08e753a..a7f8985 100644 --- a/libs/common.h +++ b/libs/common.h @@ -454,16 +454,16 @@ typedef struct { #define MAX_SHADERS 8 shader_t shaders[MAX_SHADERS] = {0}; -void add_shader(const char *vert_filename, const char *frag_filename, const char *geom_filename) +U32 add_shader(const char *vert_filename, const char *frag_filename, const char *geom_filename) { if (!vert_filename) { info("vertex shader filename not specified"); - return; + return 0; } const char *dot = strrchr(vert_filename, '.'); if (!dot) { info("shader \"%s\" was not loaded .vert or .vs expected for vertex shader", vert_filename); - return; + return 0; } U64 len = dot - vert_filename; char *name = malloc(len + 1); @@ -476,10 +476,11 @@ void add_shader(const char *vert_filename, const char *frag_filename, const char if (!shaders[i].id) die("failed to load shader \"%s\"", name); shaders[i].name = name; info("shader \"%s\" loaded successfully", name); - return; + return shaders[i].id; } } info("max shaders reached, can't load \"%s\"", name); + return 0; } void remove_shader(const char *name) @@ -689,7 +690,9 @@ void gl_debug_output(GLenum source, GLenum type, GLuint id, GLenum severity, GLs /* ignore these non-significant error codes */ if(id == 131169 || id == 131185 || id == 131218 || id == 131204) return; - info("debug message (%d): %s", id, message); + if (userParam) + info("user parameters doesn't supported"); + info("debug message (%d length: %d): %s", id, length, message); switch (source) { case GL_DEBUG_SOURCE_API: info("source: api"); diff --git a/libs/pwyazh/v2f.h b/libs/pwyazh/v2f.h index bc09b45..67f9bd2 100644 --- a/libs/pwyazh/v2f.h +++ b/libs/pwyazh/v2f.h @@ -9,6 +9,13 @@ v2f(F32 x, F32 y) } V2F +v2fa(F32 x) +{ + V2F result = { x, x }; + return(result); +} + +V2F v2f_zero() { V2F result = { 0.0f, 0.0f }; diff --git a/libs/pwyazh/v3f.h b/libs/pwyazh/v3f.h index f1b4ff7..c5a5c1b 100644 --- a/libs/pwyazh/v3f.h +++ b/libs/pwyazh/v3f.h @@ -9,6 +9,13 @@ v3f(F32 x, F32 y, F32 z) } V3F +v3fa(F32 x) +{ + V3F result = { x, x, x }; + return(result); +} + +V3F v3f_from_v4f(V4F a) { V3F result = { a.x, a.y, a.z }; |