1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
// This file is part of the 64k demo project.
// It defines the interface for procedural texture generation.
// Used to generate texture data at runtime.
#pragma once
#include <cstdint>
// Procedural generation function signature
// buffer: Pointer to RGBA8 buffer (size w * h * 4)
// w, h: Dimensions
// params: Arbitrary float parameters for the generator
typedef void (*ProcGenFunc)(uint8_t* buffer, int w, int h, const float* params,
int num_params);
namespace procedural {
// Example: Simple noise generator
void gen_noise(uint8_t* buffer, int w, int h, const float* params,
int num_params);
// Example: Grid pattern
void gen_grid(uint8_t* buffer, int w, int h, const float* params,
int num_params);
// Post-process: Make texture periodic by blending edges
// Params[0]: Border size ratio (0.0 - 0.5), default 0.1
void make_periodic(uint8_t* buffer, int w, int h, const float* params,
int num_params);
} // namespace procedural
|