From 1de4c9f9ae7028e0ac4371759dad52858a49a21e Mon Sep 17 00:00:00 2001 From: skal Date: Sat, 14 Feb 2026 14:23:16 +0100 Subject: Refactor: extract setup_standard_textures helper Eliminates repetitive Renderer3D texture initialization across 3 test files. Creates setup_standard_textures() helper that configures standard noise (256x256, GPU procedural) and sky (512x256, Perlin) textures. - New: src/3d/renderer_helpers.{h,cc} - Refactor: test_3d_physics, test_3d_render, test_mesh use helper - Build: Added renderer_helpers.cc to CMake 3D_SOURCES - Result: -52 lines of boilerplate across 3 files Production effects (Hybrid3DEffect, FlashCubeEffect) use asset-based textures and retain custom initialization. Co-Authored-By: Claude Sonnet 4.5 --- src/3d/renderer_helpers.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/3d/renderer_helpers.h (limited to 'src/3d/renderer_helpers.h') 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); -- cgit v1.2.3