summaryrefslogtreecommitdiff
path: root/src/3d
diff options
context:
space:
mode:
Diffstat (limited to 'src/3d')
-rw-r--r--src/3d/renderer_helpers.cc29
-rw-r--r--src/3d/renderer_helpers.h14
2 files changed, 43 insertions, 0 deletions
diff --git a/src/3d/renderer_helpers.cc b/src/3d/renderer_helpers.cc
new file mode 100644
index 0000000..7ee7209
--- /dev/null
+++ b/src/3d/renderer_helpers.cc
@@ -0,0 +1,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"));
+}
diff --git a/src/3d/renderer_helpers.h b/src/3d/renderer_helpers.h
new file mode 100644
index 0000000..3d0167f
--- /dev/null
+++ b/src/3d/renderer_helpers.h
@@ -0,0 +1,14 @@
+// This file is part of the 64k demo project.
+// Helper functions for Renderer3D setup and common initialization patterns.
+
+#pragma once
+
+#include "3d/renderer.h"
+#include "gpu/texture_manager.h"
+
+// Sets up standard noise and sky textures for Renderer3D.
+// Creates GPU-procedural noise (256x256, seed 1234, freq 16) and
+// Perlin sky (512x256) textures in the TextureManager, then binds
+// them to the renderer.
+void setup_standard_textures(Renderer3D& renderer, TextureManager& tex_mgr,
+ WGPUDevice device, WGPUQueue queue);