From 07b002d5365d76967ad1d64b11e3f438fb7cc9e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Madar=C3=A1sz?= Date: Mon, 11 Sep 2023 15:22:16 +0200 Subject: [PATCH] render: fix skybox_mie_calc_sh cast --- engine/bind/v4k.lua | 2 +- engine/joint/v4k.h | 4 ++-- engine/split/v4k_render.c | 2 +- engine/split/v4k_render.h | 2 +- engine/v4k.c | 2 +- engine/v4k.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/engine/bind/v4k.lua b/engine/bind/v4k.lua index 4de1d9e..82d067e 100644 --- a/engine/bind/v4k.lua +++ b/engine/bind/v4k.lua @@ -2533,7 +2533,7 @@ cubemap_t cubemap; int flags; int framebuffers[6]; int textures[6]; -unsigned char *pixels; +float *pixels; } skybox_t; skybox_t skybox(const char *panorama_or_cubemap_folder, int flags); int skybox_render(skybox_t *sky, mat44 proj, mat44 view); diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index 3ad8397..25c8a53 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -16785,7 +16785,7 @@ typedef struct skybox_t { // mie int framebuffers[6]; int textures[6]; - unsigned char *pixels; + float *pixels; } skybox_t; API skybox_t skybox(const char *panorama_or_cubemap_folder, int flags); @@ -341782,7 +341782,7 @@ void skybox_mie_calc_sh(skybox_t *sky, float sky_intensity) { const vec3 skyY[] = {{ 0, 1, 0},{ 0, 1, 0},{ 0, 0,-1},{ 0, 0, 1},{ 0, 1, 0},{ 0, 1, 0}}; int step = 16; for (int y = 0; y < HEIGHT; y += step) { - unsigned float *p = (unsigned float*)sky->pixels + y * WIDTH * 3; + float *p = (float*)(sky->pixels + y * WIDTH * 3); for (int x = 0; x < WIDTH; x += step) { vec3 n = add3( add3( diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index b3c8a7e..ca23af5 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -2466,7 +2466,7 @@ void skybox_mie_calc_sh(skybox_t *sky, float sky_intensity) { const vec3 skyY[] = {{ 0, 1, 0},{ 0, 1, 0},{ 0, 0,-1},{ 0, 0, 1},{ 0, 1, 0},{ 0, 1, 0}}; int step = 16; for (int y = 0; y < HEIGHT; y += step) { - unsigned float *p = (unsigned float*)sky->pixels + y * WIDTH * 3; + float *p = (float*)(sky->pixels + y * WIDTH * 3); for (int x = 0; x < WIDTH; x += step) { vec3 n = add3( add3( diff --git a/engine/split/v4k_render.h b/engine/split/v4k_render.h index 77b9ae6..ce8ffbd 100644 --- a/engine/split/v4k_render.h +++ b/engine/split/v4k_render.h @@ -629,7 +629,7 @@ typedef struct skybox_t { // mie int framebuffers[6]; int textures[6]; - unsigned char *pixels; + float *pixels; } skybox_t; API skybox_t skybox(const char *panorama_or_cubemap_folder, int flags); diff --git a/engine/v4k.c b/engine/v4k.c index 2663c31..9c0ae02 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -12690,7 +12690,7 @@ void skybox_mie_calc_sh(skybox_t *sky, float sky_intensity) { const vec3 skyY[] = {{ 0, 1, 0},{ 0, 1, 0},{ 0, 0,-1},{ 0, 0, 1},{ 0, 1, 0},{ 0, 1, 0}}; int step = 16; for (int y = 0; y < HEIGHT; y += step) { - unsigned float *p = (unsigned float*)sky->pixels + y * WIDTH * 3; + float *p = (float*)(sky->pixels + y * WIDTH * 3); for (int x = 0; x < WIDTH; x += step) { vec3 n = add3( add3( diff --git a/engine/v4k.h b/engine/v4k.h index 5f52627..7be6170 100644 --- a/engine/v4k.h +++ b/engine/v4k.h @@ -2868,7 +2868,7 @@ typedef struct skybox_t { // mie int framebuffers[6]; int textures[6]; - unsigned char *pixels; + float *pixels; } skybox_t; API skybox_t skybox(const char *panorama_or_cubemap_folder, int flags);