v0.00.002 - Text rendering, image manipulation, hash tables

This commit is contained in:
Charlie 2024-07-07 20:44:40 +02:00
parent 18f4fc8123
commit 3d781e0bd1
2 changed files with 40 additions and 11 deletions

11
build.c
View file

@ -3,17 +3,6 @@
/// ///
// Build config stuff // Build config stuff
#define RUN_TESTS 0
// This is only for people developing oogabooga!
#define OOGABOOGA_DEV 1
#define ENABLE_PROFILING 0
// ENABLE_SIMD Requires CPU to support at least SSE1 but I will be very surprised if you find a system today which doesn't
#define ENABLE_SIMD 0
#define INITIAL_PROGRAM_MEMORY_SIZE MB(5) #define INITIAL_PROGRAM_MEMORY_SIZE MB(5)
typedef struct Context_Extra { typedef struct Context_Extra {

40
changelog.txt Normal file
View file

@ -0,0 +1,40 @@
## v0.00.002 - Text rendering, image manipulation, hash tables
Renderer:
- Pass 8-bit integers "type" and "sampler_index" to shader
- Sample texture differently depending on "type" (text or regular quad)
- Sample with nearest/linear min/mag depending on sampler_index
- Set min/mag filtering in Draw_Quad
- Images are now created and deleted directly with gfx calls rather than deferring it for gfx_update.
- We can now set image sub data with gfx_set_image_data()
- Images are no longer hard coded to 4 channels
Text/Fonts:
- Added font loading with lazy initialization/rasterization when it's needed
- Load & rasterize any fonts with load_font_from_disk()
- Fonts automatically rasterize glyphs into atlases and generate metrics on the fly
- Measure text for very_useful metrics with measure_text()
- Walk over glyphs and their metrics with walk_glyphs()
- Implemented simple but powerful text rendering
- Draw text with draw_text() or draw_text_xform()
- See oogabooga/examples/text_rendering.c for more
Other:
- Added 3 simple hash functions:
- 64-bit xx_hash(): Very fast hash for 64-bit values
- 64-bit city_hash(): Very fast hash for short strings
- 64-bit djb2_hash(): Fast hash for strings longer than 32 bytes
- Made a generic get_hash() macro to detect the type you are trying to hash and call the approriate procedure
- Introduced a simple (kinda slow) hash table with following procedures:
- hash_table_add
- hash_table_find
- hash_table_contains
- hash_table_set
See hash_table.c for more information.
- Utf8 utility:
- utf8_to_utf32(): convert utf8 bytes to a single u32 codepoint
- next_utf8(): Convert first utf8 character in a string to a u32 codepoint and advance the passed string to the next unicode
- Renamed m4_multiply -> m4_mul for consistency
- Refactored os window to be DPI aware
- Window now has scaled_width, scaled_height which is the DPI-scaled size. Previous window.width & window.height are now aliased as window.pixel_height and window.pixel_width for clarity
- in minimal example, renamed hammer_xform -> rect_xform