diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-28 08:57:57 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-28 08:57:57 +0100 |
| commit | d26866fb6cf7bd22c90000055cd27a65c31766dd (patch) | |
| tree | a5b7b3ec6d9fe2af703581e2e5c1f3d8b9f50757 /src | |
| parent | e07f87cba89ef738781399b079840615f27e1667 (diff) | |
misc: cleanup comments and formatting in headers
- asset_manager_dcl.h: clarify purpose vs asset_manager.h
- camera_params.h: broaden description to include 3D rendering
- sdf_cpu.h: simplify calc_normal formatting
- platform.h: add missing newline at EOF
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/3d/sdf_cpu.h | 10 | ||||
| -rw-r--r-- | src/gpu/camera_params.h | 4 | ||||
| -rw-r--r-- | src/platform/platform.h | 2 | ||||
| -rw-r--r-- | src/util/asset_manager_dcl.h | 5 |
4 files changed, 9 insertions, 12 deletions
diff --git a/src/3d/sdf_cpu.h b/src/3d/sdf_cpu.h index e0f1b3f..e7f9f47 100644 --- a/src/3d/sdf_cpu.h +++ b/src/3d/sdf_cpu.h @@ -44,13 +44,9 @@ inline float sdPlane(vec3 p, vec3 n, float h) { */ template <typename F> inline vec3 calc_normal(vec3 p, F sdf_func, float e = 0.001f) { - const float d2e = 2.0f * e; - return vec3(sdf_func(vec3(p.x + e, p.y, p.z)) - - sdf_func(vec3(p.x - e, p.y, p.z)), - sdf_func(vec3(p.x, p.y + e, p.z)) - - sdf_func(vec3(p.x, p.y - e, p.z)), - sdf_func(vec3(p.x, p.y, p.z + e)) - - sdf_func(vec3(p.x, p.y, p.z - e))) + return vec3(sdf_func(vec3(p.x + e, p.y, p.z)) - sdf_func(vec3(p.x - e, p.y, p.z)), + sdf_func(vec3(p.x, p.y + e, p.z)) - sdf_func(vec3(p.x, p.y - e, p.z)), + sdf_func(vec3(p.x, p.y, p.z + e)) - sdf_func(vec3(p.x, p.y, p.z - e))) .normalize(); } diff --git a/src/gpu/camera_params.h b/src/gpu/camera_params.h index 361f65f..0798c52 100644 --- a/src/gpu/camera_params.h +++ b/src/gpu/camera_params.h @@ -1,11 +1,11 @@ // This file is part of the 64k demo project. -// It defines CameraParams for raymarching effects. +// It defines CameraParams for raymarching and 3D effects. #pragma once #include "util/mini_math.h" -// Camera parameters for SDF raymarching effects +// Camera parameters for SDF raymarching effects and 3D rendering // Binding convention: @group(0) @binding(3) struct CameraParams { mat4 inv_view; // Inverse view matrix (screen→world transform) diff --git a/src/platform/platform.h b/src/platform/platform.h index 7bcee9d..03aa2b3 100644 --- a/src/platform/platform.h +++ b/src/platform/platform.h @@ -100,4 +100,4 @@ WGPUSurface platform_create_wgpu_surface(WGPUInstance instance, PlatformState* state); // Global time query (if needed without state) -double platform_get_time();
\ No newline at end of file +double platform_get_time(); diff --git a/src/util/asset_manager_dcl.h b/src/util/asset_manager_dcl.h index bf618f0..6eee4f3 100644 --- a/src/util/asset_manager_dcl.h +++ b/src/util/asset_manager_dcl.h @@ -1,6 +1,7 @@ // This file is part of the 64k demo project. -// Forward declarations for asset management system. -// Use this header when you only need AssetId type. +// Lightweight forward declarations for AssetId and ProcGenFunc. +// Include this instead of asset_manager.h when you don't need AssetRecord or +// the asset API (GetAsset, DropAsset, etc.). #pragma once #include <cstddef> |
