Banjo API 1.1.0-alpha
Low-level C99 game development API
Loading...
Searching...
No Matches
shader.h
Go to the documentation of this file.
1
37#ifndef BJ_SHADER_H
38#define BJ_SHADER_H
39
40#include <banjo/api.h>
41#include <banjo/bitmap.h>
42#include <banjo/vec.h>
43
61typedef int (*bj_bitmap_shading_fn)(struct bj_vec3* out_color, const struct bj_vec2 pixel_coord, void* user_data);
62
161#ifndef BJ_NO_TYPEDEF
163#endif
164
166#define BJ_SHADER_INVERT_X BJ_SHADER_FLAG_INVERT_X
168#define BJ_SHADER_INVERT_Y BJ_SHADER_FLAG_INVERT_Y
170#define BJ_SHADER_CLAMP_COLOR BJ_SHADER_FLAG_CLAMP_COLOR
172#define BJ_SHADER_NORMALIZE_COORDS BJ_SHADER_FLAG_NORMALIZE_COORDS
174#define BJ_SHADER_CENTER_COORDS BJ_SHADER_FLAG_CENTER_COORDS
175
186#define BJ_SHADER_FLAGS_STANDARD (BJ_SHADER_FLAG_INVERT_Y | BJ_SHADER_FLAG_CLAMP_COLOR | BJ_SHADER_FLAG_NORMALIZE_COORDS | BJ_SHADER_FLAG_CENTER_COORDS)
187
189#define BJ_SHADER_STANDARD_FLAGS BJ_SHADER_FLAGS_STANDARD
190
208 struct bj_bitmap* bitmap,
210 void* data,
211 uint8_t flags
212);
213
216 struct bj_bitmap* bitmap,
218 void* data,
219 uint8_t flags
220);
221
222#endif
General-purpose definitions for Banjo API.
bj_audio_play_note_data data
Definition audio_pcm.c:104
Header file for Bitmap type.
#define BANJO_EXPORT
Definition api.h:179
struct bj_bitmap bj_bitmap
Definition api.h:340
2D vector of bj_real components.
Definition vec.h:57
3D vector of bj_real components.
Definition vec.h:70
void bj_shade_bitmap(struct bj_bitmap *bitmap, bj_bitmap_shading_fn shader, void *data, uint8_t flags)
Applies a shader function to every pixel in a bitmap.
void bj_shader_bitmap(struct bj_bitmap *bitmap, bj_bitmap_shading_fn shader, void *data, uint8_t flags)
bj_shader_flag
Shader input control flags.
Definition shader.h:71
int(* bj_bitmap_shading_fn)(struct bj_vec3 *out_color, const struct bj_vec2 pixel_coord, void *user_data)
Function type for a bitmap shading operation.
Definition shader.h:61
@ BJ_SHADER_FLAG_INVERT_Y
Invert the Y coordinate of the input pixel.
Definition shader.h:105
@ BJ_SHADER_FLAG_CENTER_COORDS
Centre pixel coordinates around the origin.
Definition shader.h:158
@ BJ_SHADER_FLAG_INVERT_X
Invert the X coordinate of the input pixel.
Definition shader.h:88
@ BJ_SHADER_FLAG_CLAMP_COLOR
Clamp the output colour to the range [0.0, 1.0].
Definition shader.h:116
@ BJ_SHADER_FLAG_NORMALIZE_COORDS
Normalise pixel coordinates to the [0.0, 1.0) range.
Definition shader.h:134
Fixed-size vector types (2D, 3D, 4D) and inline operations.