Conversation
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Replace separate sphere/plane/cylinder intersection functions with unified intersect_object_new(). Add intersect_cyl_new.c for cylinder body/cap intersection. Remove legacy intersect_cylinder.c and intersections.c. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add scene_create/scene_destroy with flag-based element tracking - Extract t_mlx_context from scattered void pointers - Add error.h with typed error codes and error_print/error_exit - Add overlay.h for HUD/keyguide rendering interface - Remove timer_basic.c (consolidated into timer.c) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Replace individual dirty/is_rendering/low_quality booleans with bit-flag state_flags in t_render - Add render_has_flag/render_set_flag/render_clear_flag helpers - Simplify object selection into single window_selection.c - Remove window_select_cycle.c and window_select_helpers.c - Update spatial/render modules for unified object refs Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Adapt HUD rendering to t_object union and t_object_list - Update parse_elements/parse_objects for scene flag helpers - Add parse_cylinder.c for cylinder-specific parsing - Update shadow_test and keyguide for new field paths Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Reject files without .rt extension before attempting to parse. Outputs 'Error\n' followed by descriptive message per eval spec. Implements: FR-001, FR-002 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- J/K: increase/decrease sphere diameter or cylinder diameter - N/M: increase/decrease cylinder height - Minimum threshold 0.1 prevents zero-size objects - Plane resize ignored silently (FR-011) - Sets RENDER_BVH_DIRTY flag for lazy BVH rebuild Implements: FR-003, FR-004, FR-010, FR-011 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- U/O: X-axis rotation, Y/P: Y-axis, LEFT/RIGHT: Z-axis - Rodrigues rotation formula with 5-degree step - Axis degeneration guard: skip rotation if normalized length < EPSILON - Sphere rotation ignored (FR-006) - Sets RENDER_BVH_DIRTY flag for lazy BVH rebuild Implements: FR-005, FR-006, FR-012 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add KEY_J/K/N/M/U/O/Y/P/LEFT/RIGHT constants (macOS + Linux) - Dispatch resize/rotation keys from handle_transform_keys() - Register expose hook (event 12) for window restore content persistence - Add BVH dirty rebuild before render pass in render_loop() - Set RENDER_BVH_DIRTY on object move for accurate BVH after translation Implements: FR-007, FR-009 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add scene/, mlx_context, render_flags_set, intersect_object, intersect_cyl_new, parse_cylinder, window_resize, window_rotate - Remove intersect_cylinder, intersections, timer_basic, window_select_cycle, window_select_helpers Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- resize_test.rt: sphere + cylinder for resize key verification - rotation_test.rt: cylinder + plane for rotation key verification - inside_test.rt: camera inside cylinder for interior rendering test Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- spec.md: 13 functional requirements, 6 success criteria - plan.md: 8-phase implementation plan with 6 design decisions - research.md: key mapping, BVH rebuild, expose, normal flip, threshold - data-model.md: RENDER_BVH_DIRTY flag, key constants, state flows - quickstart.md: test scenes and verification checklists - tasks.md: 27 tasks across 9 phases (all completed) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add missing features for mandatory evaluation: - .rt file extension validation - Object resize (J/K/N/M keys) - Object rotation (U/O/Y/P/LEFT/RIGHT keys) - Window expose handler for content persistence - Cylinder inside normal correction - BVH lazy rebuild on object transform - Unified object representation refactoring
…facts Add feature spec, plan, research, data-model, quickstart, tasks, and requirements checklist for HUD key guide update and expose restore fix. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add keyguide_render_extra.c with Resize (J/K - Diameter, N/M - Height) and Rotation (U/O - Rot X, Y/P - Rot Y, <-/-> - Rot Z) sections. Increase KEYGUIDE_HEIGHT from 400 to 500 to accommodate new labels. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove hud_render_background() call to eliminate pixel-by-pixel blending overhead. Set RENDER_DIRTY on HUD toggle to ensure clean scene buffer after overlay text is removed. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Call hud_render() and keyguide_render() in handle_expose() when HUD is visible, so overlays persist after window uncover/restore. Remove unused is_movement_key static function. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
…store - Add Resize/Rotation key sections to keyguide - Restore HUD/keyguide overlay on expose event - Remove HUD/keyguide background blending - Remove unused is_movement_key function
…m compliance Extract debounce_handle_active() and debounce_handle_preview() from debounce_update() to stay within 25-line limit. Move debounce_cancel() to render_debounce_timer.c to stay within 5-function limit. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove unused metrics_log_render(). Move metrics_reset_bvh() from metrics_counters.c to metrics_calc.c to stay within 5-function limit. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Fix extra tab indentation in bounds_for_plane(). Move get_object_center() to bvh_init.c to stay within 5-function limit. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Remove forward declaration from intersect_object.c to fix Norm tab indentation error. Add prototype to ray.h instead. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Rename anonymous union to union u_object_data to satisfy Norm v4.1 union naming convention (u_ prefix required). Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Move g_error_messages from file-scope global to function-local static const in error_get_message(). Rename to error_messages to follow local variable naming convention. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
- Add libft as git submodule in lib/libft - Update Makefile to build and link libft - Add libft include path to CFLAGS - Remove minilibx-linux submodule (use system install) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Delete ft_atoi.c (now provided by libft) - Delete memory.c (ft_memcpy, ft_memset now from libft) - Add format_helpers.c with format_id and float_to_str - Update utils.h with new format helper declarations - Include libft.h in minirt.h, remove ft_atoi declaration Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use format_id instead of snprintf for sphere/plane/cylinder IDs - Replace strcpy with ft_strlcpy in read_line - Remove stdio.h/string.h includes where possible Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use ft_memcpy instead of memcpy in object_list_grow - Use ft_bzero instead of memset in scene_create - Remove string.h includes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Use ft_bzero for struct initialization - Include libft.h instead of string.h Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Delete files with zero callers and no header declarations. Deleted files (2 headers + 2 sources): - includes/overlay.h (4 unused types, 8 unimplemented function decls) - includes/format_object_id.h (unused header) - src/spatial/aabb_shapes.c (aabb_for_sphere, aabb_for_cylinder, aabb_for_plane) - src/utils/format_object_id.c (format_object_id, get_object_type_prefix) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Clean partial dead code from headers and one source file. - objects.h: delete legacy t_sphere, t_plane, t_cylinder typedefs (superseded by t_object + t_sphere_data/t_plane_data/t_cylinder_data) - parser.h: delete dead parse_vector, parse_color declarations (superseded by parse_vector_strict, parse_color_strict) - window_internal.h: delete 7 unimplemented selection helper declarations (cycle_type_forward, cycle_backward_*, next_type_from_*) and 1 duplicate render_scene_to_buffer declaration - keyguide.h: delete keyguide_render_background declaration - keyguide_render.c: delete keyguide_render_background function body Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move in_range() from parse_validation.c to parse_validation_strict.c,
then delete emptied legacy files and migrate error API.
- Move in_range() to parse_validation_strict.c (parser.h already declares it)
- Delete parse_validation.c (parse_vector, parse_color were dead code)
- Delete ft_atof.c (only caller was dead parse_vector)
- Replace 7 print_error() calls in parser.c with error_print() using
comma operator pattern (error_print(CODE), 0) to preserve return value
Mapping: validate_scene 4x → ERR_PARSE_MISSING,
parse_scene → ERR_FILE_EXT, ERR_FILE_OPEN, ERR_MALLOC
- Delete print_error() function from error.c
- Delete print_error declaration from error.h
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Replace cleanup_all() in close_window() with explicit render_destroy + scene_destroy sequence. Save render->scene to local variable before render_destroy to prevent use-after-free. - window_lifecycle.c: cleanup_all → render_destroy + scene_destroy - Delete cleanup.c (cleanup_scene, cleanup_render, cleanup_all wrappers) - minirt.h: remove cleanup_all and ft_atof declarations - Makefile: remove 8 SRCS entries for all deleted .c files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Dead code removal: 13 files deleted, 22 declarations removed, 3 legacy wrapper call sites replaced with direct calls. Zero functional change — build, norminette, error output preserved.
mlx_context_init() leaked mlx connection and window handle when mlx_new_window or mlx_img_init failed. Add mlx_context_destroy() calls in failure paths to clean up partially initialized resources. Also add defensive mlx_context_destroy in render_create failure path. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
HUD and keyguide allocated bg_img via mlx_new_image but never rendered them. HUD background uses direct alpha blending on the main framebuffer (hud_text.c), keyguide renders text only via mlx_string_put. - Remove bg_img, bg_data, bpp, size_line, endian fields from t_hud_state and t_keyguide_state (window.h) - Delete fill_background_pixels() and hud_create_background() from hud_init.c (5→3 functions) - Simplify keyguide_init() to position/visibility init only - Simplify hud_cleanup() and keyguide_cleanup() to no-ops (API signatures preserved for render_destroy compatibility) Saves ~3.3MB unnecessary image allocation per session. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Delete hud_create_background declaration from hud.h (no implementation) - Remove redundant mlx_context_destroy in render_create failure path (mlx_context_init already cleans up internally on failure) - Update hud_init/hud_cleanup/init_ui_components comments to reflect bg_img removal from prior refactor Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Wire up BVH node_visit, box_test, and intersect_test counters to their respective call sites. These counters were defined but never called, preventing any measurement of BVH traversal efficiency. Insertion sites: - bvh_traverse.c: node_visit + box_test per node, intersect_test per leaf object - trace.c: intersect_test in brute-force path - shadow_test.c: intersect_test in shadow path Note: bvh_skip counter omitted from bvh_node_intersect due to 25-line Norm limit; derivable from box_tests - nodes_that_continued. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Print all render metrics (frame time, FPS, rays, intersect tests, BVH node visits, BVH box tests, BVH efficiency) to stdout after each full-quality render pass. Enables capturing baseline numbers before optimization work begins. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Record pre-optimization performance baseline across 4 scenes: - perf_timing (3sp): 514ms - perf_spheres_20 (20sp): 1,836ms - perf_spheres_50 (50sp): 3,366ms - perf_all_objects (18 mixed): 27,174ms Key findings: - Shadow path dominates (~94% of intersect cost) - BVH miss fallback to check_all_objects causes double traversal - Cylinder scenes disproportionately slow (9x more tests/ray than sphere-only) Includes bench.sh helper script for reproducible measurements. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Shadow intersection tests were mixed with primary ray tests, distorting Tests/ray and BVH efficiency calculations. Add shadow_intersect_tests field and dedicated counter so primary and shadow stats are independent. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove redundant box_test counter (equals node_visit) and insert bvh_skip on AABB miss. Replace BVH efficiency with skip rate (skips/visits) for a more direct traversal quality measure. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Pixel timing samples were accumulating across frames, producing misleading aggregate statistics. Reset counters before each full-quality render pass so stats reflect the current frame only. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
box_tests was never incremented after the box_test call was removed, yet the summary printed nodes_visited under a "BVH box tests" label. Remove the field, its counter function, and the misleading output line entirely since nodes_visited already conveys the same info. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The null check was removed to fit the 25-line Norm limit, but bvh_build_recursive can return NULL on allocation failure, making the guard necessary. Refactor by inlining intersect_ref into bvh_leaf_intersect and extracting traverse_children, keeping 5 functions and all bodies within the limit. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Restructure baseline report to match the metrics collection plan: scenario IDs (S1-S4), separated metric categories, and an appendix template for recording optimization rounds with delta columns. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Consolidate research report (P1-P9), unified report, metrics reviews, collection plan, and benchmark baseline into a single execution plan. Add P0 (BVH miss fallback removal) discovered during benchmarking. Define phased execution order (0/A/B/C/D) with measurement gates. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Replace "BVH efficiency" with "skip rate" throughout (matches code: tests_skipped / nodes_visited) - P2: change "프레임 시작 시 1회 계산" to "카메라 변경 시 cache 갱신" to match the dirty-flag input flow - P0 risk: add concrete verification steps (count check + pixel comparison across S1-S4) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Remove redundant check_all_objects() fallback when BVH is valid. BVH covers all scene objects, so the fallback doubled intersection tests on miss rays and distorted skip rate metrics. Changes: - Add root null guard to BVH-on condition (enabled + root != NULL) - Restructure trace_ray() with early returns (remove found variable) - Preserve brute-force path for BVH disabled/invalid states Results (S2/S3): frame time -37~47%, intersect tests -58~61%, BVH skip rate restored from 0% to 58~60%. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
P3: Replace pow(spec, 32.0) with fast_pow32() using repeated squaring
- 5 multiplications instead of generic pow() (~100 cycles saved/pixel)
- Location: src/lighting/lighting.c
P8: Cache sqrt(discriminant) in sphere intersection
- Reuse c variable to store sqrt result, eliminating duplicate sqrt call
- Location: src/ray/intersect_object.c
P7: Unify shadow magnitude/normalize calculations
- Single sqrt via vec3_magnitude(), then manual normalization
- Location: src/lighting/shadow_test.c
Benchmark results (Round 2):
- S3 (50 spheres): 0.4% improvement
- S4 (mixed objects): 2.3% improvement
- S1, S2: Within measurement noise
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add offset_lut field to t_shadow_config - Precompute circular stratified offsets in init_shadow_offset_lut() - Use LUT in sample_shadow_ray() with fallback for malloc failure - Add magnitude guard in is_in_shadow() to prevent NaN/INF - Free LUT in scene_destroy() Performance: S1 6.0%, S2 1.7%, S3 0.8%, S4 2.3% improvement Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Related Issue
Closes #
Type of Change
Changes
Testing
Test Environment
Test Steps
Test Results
Screenshots
Checklist
Constitution Compliance
Performance Impact
Additional Notes