blob: 7ee7209b6f51e1b7a5e3cd9153aec15b47558206 (
plain)
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
|
// This file is part of the 64k demo project.
// Implementation of Renderer3D helper functions.
#include "3d/renderer_helpers.h"
void setup_standard_textures(Renderer3D& renderer, TextureManager& tex_mgr,
WGPUDevice device, WGPUQueue queue) {
tex_mgr.init(device, queue);
// Standard noise texture (256x256, seed 1234, frequency 16)
GpuProceduralParams noise_params = {};
noise_params.width = 256;
noise_params.height = 256;
float noise_vals[2] = {1234.0f, 16.0f};
noise_params.params = noise_vals;
noise_params.num_params = 2;
tex_mgr.create_gpu_noise_texture("noise", noise_params);
renderer.set_noise_texture(tex_mgr.get_texture_view("noise"));
// Standard sky texture (512x256 Perlin)
GpuProceduralParams sky_params = {};
sky_params.width = 512;
sky_params.height = 256;
float sky_vals[5] = {42.0f, 4.0f, 1.0f, 0.5f, 6.0f};
sky_params.params = sky_vals;
sky_params.num_params = 5;
tex_mgr.create_gpu_perlin_texture("sky", sky_params);
renderer.set_sky_texture(tex_mgr.get_texture_view("sky"));
}
|