Banjo API 0.0.1
C99 game development API
Loading...
Searching...
No Matches
shader.h
Go to the documentation of this file.
1
22#ifndef BJ_SHADER_H
23#define BJ_SHADER_H
24
25#include <banjo/api.h>
26#include <banjo/bitmap.h>
27#include <banjo/vec.h>
28
42typedef int (*bj_bitmap_shading_fn_t)(bj_vec3 out_color, const bj_vec2 pixel_coord, void* user_data);
43
131
142#define BJ_SHADER_STANDARD_FLAGS (BJ_SHADER_INVERT_Y | BJ_SHADER_CLAMP_COLOR | BJ_SHADER_NORMALIZE_COORDS | BJ_SHADER_CENTER_COORDS)
143
158 bj_bitmap* p_bitmap,
159 bj_bitmap_shading_fn_t p_shader,
160 void* p_data,
161 uint8_t flags
162);
163
164#endif
General-purpose definitions for Banjo API.
Header file for Bitmap type.
struct bj_bitmap_t bj_bitmap
Typedef for the bj_bitmap struct.
Definition bitmap.h:60
#define BANJO_EXPORT
Definition api.h:139
bj_real bj_vec3[3]
bj_vec3: 3D vector of bj_real values.
Definition vec.h:34
bj_real bj_vec2[2]
bj_vec2: 2D vector of bj_real values.
Definition vec.h:27
bj_shader_flag_t
Shader input control flags.
Definition shader.h:52
void bj_shader_bitmap(bj_bitmap *p_bitmap, bj_bitmap_shading_fn_t p_shader, void *p_data, uint8_t flags)
Applies a shader function to every pixel in a bitmap.
int(* bj_bitmap_shading_fn_t)(bj_vec3 out_color, const bj_vec2 pixel_coord, void *user_data)
Function type for a bitmap shading operation.
Definition shader.h:42
enum bj_shader_flag_t bj_shader_flag
Shader input control flags.
@ BJ_SHADER_CENTER_COORDS
Center pixel coordinates around the origin.
Definition shader.h:128
@ BJ_SHADER_CLAMP_COLOR
Clamp the output color to the range [0.0, 1.0].
Definition shader.h:93
@ BJ_SHADER_INVERT_Y
Invert the Y coordinate of the input pixel.
Definition shader.h:82
@ BJ_SHADER_NORMALIZE_COORDS
Normalize pixel coordinates to the [0.0, 1.0] range.
Definition shader.h:107
@ BJ_SHADER_INVERT_X
Invert the X coordinate of the input pixel.
Definition shader.h:67
vector manipulation API