diff --git a/.gitignore b/.gitignore index 4ab2273..71fba69 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,6 @@ # Executables miniRT -test_vector -test_parser -test_intersections -test_lighting # Libraries *.a @@ -22,9 +18,6 @@ test_lighting # Dependency files *.d -# MinilibX test programs -test_mlx - # IDE and Editor files .vscode/ .idea/ @@ -61,8 +54,5 @@ build/ .codex/skills/ .codex/tmp/ -# Optimization test script -test_optimizations.sh - # Claude Code local settings .claude/settings.local.json diff --git a/scripts/analyze_function_usage.sh b/scripts/analyze_function_usage.sh deleted file mode 100755 index 3b6eeb1..0000000 --- a/scripts/analyze_function_usage.sh +++ /dev/null @@ -1,117 +0,0 @@ -#!/bin/bash -# Function usage analysis script -# Created as part of 012-code-cleanup-refactor feature -# Analyzes function declarations and their usage across the codebase - -set -e - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" -OUTPUT_FILE="${1:-/tmp/function_usage_report.txt}" - -echo "=== MiniRT Function Usage Analysis ===" | tee "$OUTPUT_FILE" -echo "Project Root: $PROJECT_ROOT" | tee -a "$OUTPUT_FILE" -echo "Generated: $(date)" | tee -a "$OUTPUT_FILE" -echo "" | tee -a "$OUTPUT_FILE" - -# Extract all function declarations from headers -echo "=== PART 1: Function Declarations in Headers ===" | tee -a "$OUTPUT_FILE" -echo "" | tee -a "$OUTPUT_FILE" - -for header in "$PROJECT_ROOT"/includes/*.h; do - header_name=$(basename "$header") - echo "--- $header_name ---" | tee -a "$OUTPUT_FILE" - - # Extract function declarations (simplified pattern) - # Looks for: return_type function_name(params); - grep -E '^[a-z_][a-z0-9_]*\s+[a-z_][a-z0-9_]*\s*\(' "$header" | \ - sed 's/^\([a-z_][a-z0-9_]*\)\s\+\([a-z_][a-z0-9_]*\)\s*(.*/\2/' | \ - sort -u | tee -a "$OUTPUT_FILE" || echo " (no declarations found)" | tee -a "$OUTPUT_FILE" - - echo "" | tee -a "$OUTPUT_FILE" -done - -# Extract all function definitions from source files -echo "=== PART 2: Function Definitions in Source Files ===" | tee -a "$OUTPUT_FILE" -echo "" | tee -a "$OUTPUT_FILE" - -for src_dir in "$PROJECT_ROOT"/src/*/; do - dir_name=$(basename "$src_dir") - echo "--- $dir_name/ ---" | tee -a "$OUTPUT_FILE" - - # Find all .c files in directory - find "$src_dir" -name "*.c" -exec basename {} \; | while read -r src_file; do - echo " File: $src_file" | tee -a "$OUTPUT_FILE" - - # Extract function definitions (simplified) - grep -E '^[a-z_][a-z0-9_]*\s+[a-z_][a-z0-9_]*\s*\(' "$src_dir$src_file" | \ - sed 's/^\([a-z_][a-z0-9_]*\)\s\+\([a-z_][a-z0-9_]*\)\s*(.*/ \2/' | \ - tee -a "$OUTPUT_FILE" || echo " (no definitions found)" | tee -a "$OUTPUT_FILE" - done - - echo "" | tee -a "$OUTPUT_FILE" -done - -# Analyze function calls -echo "=== PART 3: Function Call Analysis ===" | tee -a "$OUTPUT_FILE" -echo "" | tee -a "$OUTPUT_FILE" -echo "Searching for function calls in codebase..." | tee -a "$OUTPUT_FILE" -echo "" | tee -a "$OUTPUT_FILE" - -# Create temporary file with all function names -temp_functions=$(mktemp) - -# Extract function names from headers -for header in "$PROJECT_ROOT"/includes/*.h; do - grep -E '^[a-z_][a-z0-9_]*\s+[a-z_][a-z0-9_]*\s*\(' "$header" | \ - sed 's/^\([a-z_][a-z0-9_]*\)\s\+\([a-z_][a-z0-9_]*\)\s*(.*/\2/' >> "$temp_functions" || true -done - -# Sort and unique -sort -u "$temp_functions" > "${temp_functions}.sorted" -mv "${temp_functions}.sorted" "$temp_functions" - -# For each function, count usages -echo "Function Name | Declaration Count | Call Sites" | tee -a "$OUTPUT_FILE" -echo "--------------|-------------------|------------" | tee -a "$OUTPUT_FILE" - -while IFS= read -r func_name; do - [ -z "$func_name" ] && continue - - # Count declarations (should be 1 ideally) - decl_count=$(grep -r "^[a-z_][a-z0-9_]*\s\+${func_name}\s*(" "$PROJECT_ROOT"/includes/ 2>/dev/null | wc -l | tr -d ' ') - - # Count call sites (usage in .c files) - call_count=$(grep -r "${func_name}(" "$PROJECT_ROOT"/src/ "$PROJECT_ROOT"/main.c 2>/dev/null | wc -l | tr -d ' ') - - echo "$func_name | $decl_count | $call_count" | tee -a "$OUTPUT_FILE" -done < "$temp_functions" - -# Cleanup -rm -f "$temp_functions" - -echo "" | tee -a "$OUTPUT_FILE" -echo "=== PART 4: Potentially Unused Functions ===" | tee -a "$OUTPUT_FILE" -echo "" | tee -a "$OUTPUT_FILE" -echo "Functions with 0 call sites (may be callbacks or unused):" | tee -a "$OUTPUT_FILE" -echo "" | tee -a "$OUTPUT_FILE" - -# Re-extract and check for zero usage -for header in "$PROJECT_ROOT"/includes/*.h; do - grep -E '^[a-z_][a-z0-9_]*\s+[a-z_][a-z0-9_]*\s*\(' "$header" | \ - sed 's/^\([a-z_][a-z0-9_]*\)\s\+\([a-z_][a-z0-9_]*\)\s*(.*/\2/' | \ - sort -u | while IFS= read -r func_name; do - [ -z "$func_name" ] && continue - - call_count=$(grep -r "${func_name}(" "$PROJECT_ROOT"/src/ "$PROJECT_ROOT"/main.c 2>/dev/null | wc -l | tr -d ' ') - - if [ "$call_count" -eq 0 ]; then - header_name=$(basename "$header") - echo " - $func_name (declared in $header_name)" | tee -a "$OUTPUT_FILE" - fi - done -done - -echo "" | tee -a "$OUTPUT_FILE" -echo "=== Analysis Complete ===" | tee -a "$OUTPUT_FILE" -echo "Report saved to: $OUTPUT_FILE" | tee -a "$OUTPUT_FILE" diff --git a/scripts/check-commit-format.sh b/scripts/check-commit-format.sh deleted file mode 100755 index 23a93f4..0000000 --- a/scripts/check-commit-format.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash -# check-commit-format.sh -# Validates commit messages follow Conventional Commits format - -set -e - -COMMIT_MSG_FILE=$1 -COMMIT_MSG=$(cat "$COMMIT_MSG_FILE") - -# Conventional commit pattern -PATTERN="^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\(.+\))?: .+" - -if ! echo "$COMMIT_MSG" | grep -qE "$PATTERN"; then - echo "❌ Invalid commit message format" - echo "" - echo "Current message:" - echo " $COMMIT_MSG" - echo "" - echo "Expected format:" - echo " type(scope): description" - echo "" - echo "Examples:" - echo " feat: add soft shadow rendering" - echo " feat(lighting): implement distance attenuation" - echo " fix: resolve segfault in vector operations" - echo " fix(parser): handle empty scene files" - echo " docs: update README with build instructions" - echo "" - echo "Valid types: feat, fix, docs, style, refactor, test, chore, perf, ci, build, revert" - exit 1 -fi - -echo "✓ Commit message format is valid" diff --git a/scripts/check-issue-reference.sh b/scripts/check-issue-reference.sh deleted file mode 100755 index b992cde..0000000 --- a/scripts/check-issue-reference.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -# check-issue-reference.sh -# Validates that commits reference an issue number when required - -set -e - -COMMIT_MSG_FILE=$1 -COMMIT_MSG=$(cat "$COMMIT_MSG_FILE") - -# Skip check for certain commit types that don't require issues -if echo "$COMMIT_MSG" | grep -qE "^(chore|docs|style): "; then - echo "✓ Commit type does not require issue reference" - exit 0 -fi - -# Check for issue reference in commit message -if ! echo "$COMMIT_MSG" | grep -qE "(#[0-9]+|issue [0-9]+|closes [0-9]+|fixes [0-9]+|resolves [0-9]+)"; then - echo "⚠️ Warning: No issue reference found in commit message" - echo "" - echo "Current message:" - echo " $COMMIT_MSG" - echo "" - echo "Consider adding an issue reference:" - echo " feat: add feature (#123)" - echo " fix: resolve bug (closes #456)" - echo " refactor: improve code (issue #789)" - echo "" - echo "This is a warning, not an error. Press Enter to continue or Ctrl+C to abort." - read -r -fi - -echo "✓ Issue reference check passed" diff --git a/scripts/compare_renders.sh b/scripts/compare_renders.sh deleted file mode 100755 index ead1672..0000000 --- a/scripts/compare_renders.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -# Compare rendered images between baseline and current -# Usage: ./scripts/compare_renders.sh [baseline_dir] [current_dir] - -set -e - -BASELINE_DIR="${1:-baseline_renders}" -CURRENT_DIR="${2:-current_renders}" - -echo "=========================================" -echo "Render Comparison Script" -echo "=========================================" -echo "Baseline: $BASELINE_DIR" -echo "Current: $CURRENT_DIR" -echo "" - -if [ ! -d "$BASELINE_DIR" ]; then - echo "✗ ERROR: Baseline directory not found: $BASELINE_DIR" - exit 1 -fi - -if [ ! -d "$CURRENT_DIR" ]; then - echo "✗ ERROR: Current directory not found: $CURRENT_DIR" - exit 1 -fi - -# Count files -baseline_count=$(find "$BASELINE_DIR" -name "*.ppm" -o -name "*.png" | wc -l | tr -d ' ') -current_count=$(find "$CURRENT_DIR" -name "*.ppm" -o -name "*.png" | wc -l | tr -d ' ') - -echo "Baseline images: $baseline_count" -echo "Current images: $current_count" -echo "" - -if [ "$baseline_count" -eq 0 ]; then - echo "✗ ERROR: No baseline images found" - exit 1 -fi - -# Compare each image -pass_count=0 -fail_count=0 -missing_count=0 - -for baseline_img in "$BASELINE_DIR"/*.{ppm,png}; do - [ -f "$baseline_img" ] || continue - - filename=$(basename "$baseline_img") - current_img="$CURRENT_DIR/$filename" - - if [ ! -f "$current_img" ]; then - echo "✗ MISSING: $filename" - ((missing_count++)) - continue - fi - - # Binary comparison - if cmp -s "$baseline_img" "$current_img"; then - echo "✓ IDENTICAL: $filename" - ((pass_count++)) - else - echo "✗ DIFFERS: $filename" - ((fail_count++)) - fi -done - -echo "" -echo "=========================================" -echo "Results:" -echo "=========================================" -echo "Identical: $pass_count" -echo "Different: $fail_count" -echo "Missing: $missing_count" - -if [ "$fail_count" -eq 0 ] && [ "$missing_count" -eq 0 ]; then - echo "✓ PASS: All renders match baseline" - exit 0 -else - echo "✗ FAIL: Some renders differ from baseline" - exit 1 -fi diff --git a/scripts/create_wiki.sh b/scripts/create_wiki.sh deleted file mode 100755 index 5e01326..0000000 --- a/scripts/create_wiki.sh +++ /dev/null @@ -1,33 +0,0 @@ -#!/bin/bash - -echo "======================================" -echo "GitHub Wiki 자동 생성 스크립트" -echo "======================================" -echo "" - -REPO="gdtknight/miniRT_final" -WIKI_URL="https://github.com/$REPO/wiki" - -echo "1. 브라우저에서 다음 URL을 열어주세요:" -echo " $WIKI_URL" -echo "" -echo "2. 'Create the first page' 버튼을 클릭하세요" -echo "" -echo "3. 아무 내용(예: 'Initial page')을 입력하고 Save 클릭" -echo "" -echo "4. 저장 후 아래 명령어를 실행하세요:" -echo "" -echo " cd /tmp" -echo " git clone git@github.com:$REPO.wiki.git" -echo " cd miniRT_final.wiki" -echo " cp /tmp/miniRT_wiki/*.md ." -echo " git add ." -echo " git commit -m 'Add comprehensive Korean documentation'" -echo " git push origin master" -echo "" -echo "======================================" -echo "" -echo "Wiki 파일 준비 상태:" -ls -lh /tmp/miniRT_wiki/*.md 2>/dev/null | awk '{print " " $9}' || echo " (파일을 다시 생성해야 합니다)" -echo "" -echo "자세한 내용은 WIKI_SETUP.md 를 참고하세요" diff --git a/scripts/fix_line_continuations.sh b/scripts/fix_line_continuations.sh deleted file mode 100755 index f6063e6..0000000 --- a/scripts/fix_line_continuations.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# Fix line continuation indentation issues - -files=( -"src/ray/intersect_cylinder.c" -"src/lighting/lighting.c" -"src/lighting/shadow_attenuation.c" -"src/lighting/shadow_calc.c" -) - -for file in "${files[@]}"; do -if [ -f "$file" ]; then -echo "Processing: $file" -# This is complex - will do manually -fi -done diff --git a/scripts/fix_whitespace.sh b/scripts/fix_whitespace.sh deleted file mode 100755 index 0da4f08..0000000 --- a/scripts/fix_whitespace.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -# Fix whitespace issues in source files - -# Convert tabs to spaces in all .c and .h files -find src includes -type f \( -name "*.c" -o -name "*.h" \) -exec bash -c ' - for file; do - # Check if file has issues - if grep -q $'\''\t'\'' "$file"; then - echo "Fixing tabs in: $file" - # Use expand to convert tabs to spaces (tab stop = 4) - expand -t 4 "$file" > "$file.tmp" && mv "$file.tmp" "$file" - fi - done -' bash {} + - -echo "Whitespace fixes complete" diff --git a/scripts/setup-ci-environment.sh b/scripts/setup-ci-environment.sh deleted file mode 100755 index 38ccd92..0000000 --- a/scripts/setup-ci-environment.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -# setup-ci-environment.sh -# Sets up CI environment for testing - -set -e - -echo "Setting up CI environment..." - -# Detect OS -if [[ "$OSTYPE" == "linux-gnu"* ]]; then - OS="Linux" - echo "Detected OS: Linux" -elif [[ "$OSTYPE" == "darwin"* ]]; then - OS="macOS" - echo "Detected OS: macOS" -else - OS="Unknown" - echo "Warning: Unknown OS: $OSTYPE" -fi - -# Install dependencies based on OS -if [ "$OS" = "Linux" ]; then - echo "Installing Linux dependencies..." - if command -v apt-get &> /dev/null; then - sudo apt-get update - sudo apt-get install -y gcc make xorg libxext-dev libbsd-dev xvfb - elif command -v yum &> /dev/null; then - sudo yum install -y gcc make libX11-devel libXext-devel - else - echo "Error: No supported package manager found" - exit 1 - fi -elif [ "$OS" = "macOS" ]; then - echo "macOS environment ready (no additional dependencies needed)" -fi - -# Install norminette if not present -if ! command -v norminette &> /dev/null; then - echo "Installing norminette..." - python3 -m pip install --upgrade pip setuptools - python3 -m pip install norminette -fi - -# Verify installations -echo "" -echo "Verifying installations..." -gcc --version | head -1 -make --version | head -1 -norminette --version - -echo "" -echo "✓ CI environment setup complete" diff --git a/scripts/test/test_controls.sh b/scripts/test/test_controls.sh deleted file mode 100755 index ca8b1a4..0000000 --- a/scripts/test/test_controls.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -# Test script to verify keyboard controls are properly implemented - -echo "Testing miniRT Interactive Controls" -echo "====================================" -echo "" - -# Check if miniRT exists -if [ ! -f "./miniRT" ]; then - echo "Error: miniRT executable not found" - echo "Please run 'make' first" - exit 1 -fi - -# Check for test scene -if [ ! -f "scenes/perf/perf_all_objects.rt" ]; then - echo "Error: Test scene not found" - exit 1 -fi - -echo "✓ miniRT executable found" -echo "✓ Test scene available" -echo "" -echo "Manual Test Instructions:" -echo "==========================" -echo "" -echo "1. Camera Movement (WASD):" -echo " - Launch: ./miniRT scenes/perf/perf_all_objects.rt" -echo " - Press W: Camera should move forward" -echo " - Press S: Camera should move backward" -echo " - Press A: Camera should strafe left" -echo " - Press D: Camera should strafe right" -echo "" -echo "2. Camera Rotation (RF):" -echo " - Press R: Camera should pitch up" -echo " - Press F: Camera should pitch down" -echo "" -echo "3. Object Selection ([/]):" -echo " - Press ]: Select next object" -echo " - Press [: Select previous object" -echo "" -echo "4. Object Movement (Numpad):" -echo " - Select an object first with ]" -echo " - Press Numpad 4/6: Move left/right" -echo " - Press Numpad 2/8: Move down/up" -echo " - Press Numpad 1/3: Move back/forward" -echo "" -echo "5. Light Control (Insert/Home/PgUp/Del/End/PgDn):" -echo " - Press Insert: Move light right" -echo " - Press Delete: Move light left" -echo " - Press Home: Move light up" -echo " - Press End: Move light down" -echo " - Press Page Up: Move light forward" -echo " - Press Page Down: Move light backward" -echo "" -echo "6. Exit:" -echo " - Press ESC to exit" -echo "" -echo "Expected behavior:" -echo "- Scene should re-render after each movement" -echo "- Controls should respond immediately" -echo "- No crashes or memory leaks" -echo "" -echo "To run the interactive test, execute:" -echo " ./miniRT scenes/perf/perf_all_objects.rt" -echo "" diff --git a/scripts/test/test_progress.sh b/scripts/test/test_progress.sh deleted file mode 100644 index 14cad4b..0000000 --- a/scripts/test/test_progress.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -cd /Users/yoshin/dev/working/miniRT -make clean >/dev/null 2>&1 -make 2>&1 | tail -3 -echo "---" -python3 -m norminette src/ includes/ 2>&1 | grep "Error:" | wc -l -python3 -m norminette src/ includes/ 2>&1 | grep "Error:" | awk '{print $2}' | sort | uniq -c | sort -rn diff --git a/scripts/test/validate_optimization.sh b/scripts/test/validate_optimization.sh deleted file mode 100755 index f6c07ac..0000000 --- a/scripts/test/validate_optimization.sh +++ /dev/null @@ -1,111 +0,0 @@ -#!/bin/bash -# Rendering Optimization Validation Script -# Validates that BVH and optimization features compile and basic structure is correct - -echo "=== miniRT Rendering Optimization Validation ===" -echo "" - -# Colors -GREEN='\033[0;32m' -RED='\033[0;31m' -YELLOW='\033[1;33m' -NC='\033[0m' # No Color - -PASS=0 -FAIL=0 - -check() { - if [ $? -eq 0 ]; then - echo -e "${GREEN}✓ PASS${NC}: $1" - ((PASS++)) - else - echo -e "${RED}✗ FAIL${NC}: $1" - ((FAIL++)) - fi -} - -echo "1. Checking if miniRT binary exists..." -[ -f ./miniRT ] -check "miniRT binary exists" - -echo "" -echo "2. Checking header files..." -[ -f includes/spatial.h ] -check "includes/spatial.h exists" - -[ -f includes/metrics.h ] -check "includes/metrics.h exists" - -[ -f includes/render_state.h ] -check "includes/render_state.h exists" - -echo "" -echo "3. Checking BVH implementation files..." -[ -f src/spatial/aabb.c ] -check "src/spatial/aabb.c exists" - -[ -f src/spatial/bounds.c ] -check "src/spatial/bounds.c exists" - -[ -f src/spatial/bvh_build.c ] -check "src/spatial/bvh_build.c exists" - -[ -f src/spatial/bvh_init.c ] -check "src/spatial/bvh_init.c exists" - -[ -f src/spatial/bvh_traverse.c ] -check "src/spatial/bvh_traverse.c exists" - -echo "" -echo "4. Checking render state implementation..." -[ -f src/render/render_state.c ] -check "src/render/render_state.c exists" - -[ -f src/utils/timer.c ] -check "src/utils/timer.c exists" - -echo "" -echo "5. Checking test scenes..." -[ -f scenes/perf/perf_spheres_20.rt ] -check "scenes/perf/perf_spheres_20.rt exists" - -[ -f scenes/perf/perf_spheres_50.rt ] -check "scenes/perf/perf_spheres_50.rt exists" - -echo "" -echo "6. Checking for required symbols in binary..." -nm ./miniRT | grep -q "bvh_create" -check "bvh_create function present" - -nm ./miniRT | grep -q "bvh_build" -check "bvh_build function present" - -nm ./miniRT | grep -q "bvh_intersect" -check "bvh_traverse/bvh_intersect function present" - -nm ./miniRT | grep -q "render_state_init" -check "render_state_init function present" - -echo "" -echo "7. Verifying compilation (symbol check complete)" -echo -e "${YELLOW}⚠ INFO${NC}: Scene rendering validation requires GUI (skipped)" - -echo "" -echo "=== Validation Summary ===" -echo -e "Passed: ${GREEN}${PASS}${NC}" -echo -e "Failed: ${RED}${FAIL}${NC}" -echo "" - -if [ $FAIL -eq 0 ]; then - echo -e "${GREEN}✓ All checks passed! BVH optimization is properly implemented.${NC}" - echo "" - echo "Next steps:" - echo "1. Test rendering with: ./miniRT scenes/perf/perf_spheres_20.rt" - echo "2. Toggle BVH with 'B' key during rendering" - echo "3. Compare performance with BVH on vs off" - echo "4. Try larger scene: ./miniRT scenes/perf/perf_spheres_50.rt" - exit 0 -else - echo -e "${RED}✗ Some checks failed. Please review the implementation.${NC}" - exit 1 -fi diff --git a/scripts/validate_42_functions.sh b/scripts/validate_42_functions.sh deleted file mode 100755 index b9bebc5..0000000 --- a/scripts/validate_42_functions.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash -# 42 Function Constraint Validation Script -# Checks for prohibited functions in miniRT codebase - -set -e - -PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" - -echo "=== 42 School Function Constraint Validation ===" -echo "Project: miniRT" -echo "Date: $(date)" -echo "" - -# Prohibited functions list -PROHIBITED_FUNCS=( - "pthread_create" - "pthread_join" - "pthread_mutex_lock" - "pthread_mutex_unlock" - "pthread_mutex_init" - "pthread_mutex_destroy" - "fork" - "pipe" - "waitpid" - "execve" - "system" -) - -violations=0 - -echo "Searching for prohibited functions..." -echo "" - -for func in "${PROHIBITED_FUNCS[@]}"; do - echo -n " Checking $func... " - - # Search in source files and headers - matches=$(grep -r "${func}(" "$PROJECT_ROOT/src/" "$PROJECT_ROOT/includes/" "$PROJECT_ROOT/main.c" 2>/dev/null | wc -l | tr -d ' ') - - if [ "$matches" -gt 0 ]; then - echo "✗ FOUND ($matches occurrences)" - violations=$((violations + matches)) - grep -rn "${func}(" "$PROJECT_ROOT/src/" "$PROJECT_ROOT/includes/" "$PROJECT_ROOT/main.c" 2>/dev/null | head -5 - else - echo "✓ OK" - fi -done - -echo "" -echo "=== Validation Results ===" - -if [ $violations -eq 0 ]; then - echo "✓ PASSED: No prohibited functions found" - echo "✓ Codebase complies with 42 School function constraints" - exit 0 -else - echo "✗ FAILED: $violations prohibited function usage(s) found" - echo "✗ Codebase violates 42 School function constraints" - exit 1 -fi diff --git a/scripts/validate_bvh_fix.sh b/scripts/validate_bvh_fix.sh deleted file mode 100755 index 4d51de3..0000000 --- a/scripts/validate_bvh_fix.sh +++ /dev/null @@ -1,85 +0,0 @@ -#!/bin/bash - -echo "=== BVH Integration Fix Validation ===" -echo "" - -# T011: Check if fixes are applied -echo "T011-T012: Checking BVH fixes..." -if grep -q "bvh_enabled = 1" src/render/render_state.c; then - echo "✅ T006: BVH enabled by default in render_state.c" -else - echo "❌ T006 FAIL: BVH not enabled by default" - exit 1 -fi - -if grep -q "hit_found = 1" src/render/trace.c && grep -q "if (!hit_found)" src/render/trace.c; then - echo "✅ T007-T008: Fallback logic correctly implemented in trace.c" -else - echo "❌ T007-T008 FAIL: Fallback logic not correct" - exit 1 -fi - -# T009: Verify norminette -echo "" -echo "T009: Running norminette..." -if norminette src/render/render_state.c src/render/trace.c > /dev/null 2>&1; then - echo "✅ T009: Norminette check passed" -else - echo "❌ T009 FAIL: Norminette errors found" - exit 1 -fi - -# T010: Verify build -echo "" -echo "T010: Testing build..." -if make re > /dev/null 2>&1; then - echo "✅ T010: Build successful" -else - echo "❌ T010 FAIL: Build failed" - exit 1 -fi - -# T013-T020: Test with simple scene -echo "" -echo "T013-T020: Testing scene loading..." -if [ ! -f "scenes/valid/valid_smoke_simple.rt" ]; then - echo "⚠️ Warning: valid_smoke_simple.rt not found, using perf_all_objects.rt" - TEST_SCENE="scenes/perf/perf_all_objects.rt" -else - TEST_SCENE="scenes/valid/valid_smoke_simple.rt" -fi - -# Test that program can start with a scene (will timeout, but that's expected for GUI) -timeout 2 ./miniRT "$TEST_SCENE" > /dev/null 2>&1 -EXIT_CODE=$? - -if [ $EXIT_CODE -eq 124 ]; then - # Timeout is expected for GUI application - echo "✅ T011-T020: Program starts and loads scene successfully" - echo " (Timed out as expected - GUI application)" -elif [ $EXIT_CODE -eq 0 ]; then - echo "✅ T011-T020: Program executed successfully" -else - echo "❌ T011-T020 FAIL: Program crashed or failed (exit code: $EXIT_CODE)" - exit 1 -fi - -echo "" -echo "=== Summary ===" -echo "✅ Phase 1: Setup & Diagnosis - Complete" -echo "✅ Phase 2: Core BVH Fixes - Complete" -echo "✅ Phase 3: Basic Rendering Tests - Complete" -echo "" -echo "Core fixes successfully implemented:" -echo " 1. BVH enabled by default (render_state.c:37)" -echo " 2. Fallback logic added to trace_ray() (trace.c:159-172)" -echo " 3. Norminette compliant" -echo " 4. Build successful" -echo " 5. Scene loading verified" -echo "" -echo "Next steps:" -echo " - Run with X11 display to visually verify rendering" -echo " - Test BVH toggle functionality if implemented" -echo " - Test with complex scenes for performance validation" -echo "" -echo "✅ BVH FIX VALIDATION PASSED" diff --git a/scripts/validate_cleanup.sh b/scripts/validate_cleanup.sh deleted file mode 100755 index 2f7ac79..0000000 --- a/scripts/validate_cleanup.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash -# Validation script for behavior preservation testing -# Created as part of 012-code-cleanup-refactor feature - -set -e - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" -SCENES_DIR="$PROJECT_ROOT/scenes" -BASELINE_DIR="/tmp/minirt_baseline" -CURRENT_DIR="/tmp/minirt_current" - -echo "=== MiniRT Cleanup Validation Script ===" -echo "Project Root: $PROJECT_ROOT" -echo "" - -# Function to render all scenes and save output -render_scenes() { - local output_dir="$1" - mkdir -p "$output_dir" - - echo "Rendering scenes to: $output_dir" - - for scene in "$SCENES_DIR"/*.rt; do - if [ -f "$scene" ]; then - scene_name=$(basename "$scene" .rt) - echo " - Rendering $scene_name..." - # Note: This would need actual screenshot/comparison logic - # For now, just verify the program runs without crash - timeout 2s "$PROJECT_ROOT/miniRT" "$scene" > "$output_dir/${scene_name}.log" 2>&1 || true - fi - done - - echo "Rendering complete." -} - -# Function to compare baseline vs current -compare_results() { - echo "" - echo "=== Comparison Results ===" - - if [ ! -d "$BASELINE_DIR" ]; then - echo "ERROR: No baseline directory found. Run with 'baseline' argument first." - return 1 - fi - - local differences=0 - - for baseline_log in "$BASELINE_DIR"/*.log; do - scene_name=$(basename "$baseline_log") - current_log="$CURRENT_DIR/$scene_name" - - if [ ! -f "$current_log" ]; then - echo " ✗ MISSING: $scene_name" - differences=$((differences + 1)) - continue - fi - - # Simple log comparison (in practice, would compare images) - if diff -q "$baseline_log" "$current_log" > /dev/null 2>&1; then - echo " ✓ PASS: $scene_name" - else - echo " ✗ DIFF: $scene_name" - differences=$((differences + 1)) - fi - done - - echo "" - if [ $differences -eq 0 ]; then - echo "✓ All scenes match baseline - behavior preserved!" - return 0 - else - echo "✗ $differences scene(s) differ from baseline" - return 1 - fi -} - -# Main execution -case "${1:-test}" in - baseline) - echo "Creating baseline..." - make -C "$PROJECT_ROOT" > /dev/null - render_scenes "$BASELINE_DIR" - echo "" - echo "✓ Baseline created successfully in $BASELINE_DIR" - ;; - - test) - echo "Testing current implementation..." - make -C "$PROJECT_ROOT" > /dev/null - render_scenes "$CURRENT_DIR" - compare_results - ;; - - clean) - echo "Cleaning validation data..." - rm -rf "$BASELINE_DIR" "$CURRENT_DIR" - echo "✓ Cleaned" - ;; - - *) - echo "Usage: $0 {baseline|test|clean}" - echo "" - echo " baseline - Create baseline rendering results" - echo " test - Test current implementation against baseline" - echo " clean - Remove validation data" - exit 1 - ;; -esac diff --git a/scripts/verify_release.sh b/scripts/verify_release.sh deleted file mode 100755 index ad0eda6..0000000 --- a/scripts/verify_release.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash - -# miniRT Release Gate Verification Script -# 릴리즈 게이트 체크리스트 자동 검증 스크립트 - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[1;33m' -BLUE='\033[0;34m' -NC='\033[0m' - -PASSED=0 -FAILED=0 -WARNINGS=0 - -echo -e "${BLUE}========================================${NC}" -echo -e "${BLUE}miniRT Release Gate Verification${NC}" -echo -e "${BLUE}========================================${NC}\n" - -print_status() { - if [ $1 -eq 0 ]; then - echo -e "${GREEN}✓ PASSED${NC}: $2" - ((PASSED++)) - else - echo -e "${RED}✗ FAILED${NC}: $2" - ((FAILED++)) - fi -} - -print_warning() { - echo -e "${YELLOW}⚠ WARNING${NC}: $1" - ((WARNINGS++)) -} - -# 1. Build System -echo -e "\n${BLUE}[1] Build System${NC}" -make re > /dev/null 2>&1 && print_status 0 "Build success" || print_status 1 "Build failed" -[ -f "miniRT" ] && print_status 0 "Executable exists" || print_status 1 "No executable" - -# 2. Norminette -echo -e "\n${BLUE}[2] Norminette${NC}" -if command -v norminette &> /dev/null; then - norminette src/ includes/ 2>&1 | grep -q "Error" && print_status 1 "Norminette errors" || print_status 0 "Norminette OK" -else - print_warning "norminette not installed" -fi - -# 3. 42 Header -echo -e "\n${BLUE}[3] 42 Headers${NC}" -HEADERS=$(find src includes -name "*.c" -o -name "*.h" | xargs grep -l "/\* \*\*\*" | wc -l) -TOTAL=$(find src includes -name "*.c" -o -name "*.h" | wc -l) -[ $HEADERS -eq $TOTAL ] && print_status 0 "All headers present ($HEADERS/$TOTAL)" || print_status 1 "Missing headers ($HEADERS/$TOTAL)" - -# Summary -echo -e "\n${BLUE}========================================${NC}" -echo -e "${GREEN}Passed: $PASSED${NC} | ${RED}Failed: $FAILED${NC} | ${YELLOW}Warnings: $WARNINGS${NC}" -[ $FAILED -eq 0 ] && echo -e "${GREEN}✓ PASSED${NC}" || echo -e "${RED}✗ FAILED${NC}" diff --git a/tests/baselines/metadata.json b/tests/baselines/metadata.json deleted file mode 100644 index 07724d9..0000000 --- a/tests/baselines/metadata.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "generated_at": "2026-01-14T11:35:15Z", - "commit_hash": "8428e3fddaf54acc72a6de13570a28a3a2afc45a", - "branch": "016-compliance-refactoring", - "miniRT_version": "1.0.0", - "scene_count": 43, - "note": "Baseline captured before compliance refactoring - miniRT is GUI-based, visual validation will be manual during implementation", - "validation_method": "Build success + norminette + memory checks + manual visual verification" -} diff --git a/tests/test_shadow_calc b/tests/test_shadow_calc deleted file mode 100755 index 7071be1..0000000 Binary files a/tests/test_shadow_calc and /dev/null differ diff --git a/tests/test_shadow_calc.c b/tests/test_shadow_calc.c deleted file mode 100644 index b390655..0000000 --- a/tests/test_shadow_calc.c +++ /dev/null @@ -1,83 +0,0 @@ -/* ************************************************************************** */ -/* */ -/* ::: :::::::: */ -/* test_shadow_calc.c :+: :+: :+: */ -/* +:+ +:+ +:+ */ -/* By: miniRT team +#+ +:+ +#+ */ -/* +#+#+#+#+#+ +#+ */ -/* Created: 2025/12/17 00:00:00 by miniRT #+# #+# */ -/* Updated: 2025/12/17 00:00:00 by miniRT ### ########.fr */ -/* */ -/* ************************************************************************** */ - -#include "shadow.h" -#include "vec3.h" -#include -#include -#include - -void test_shadow_bias_perpendicular(void) -{ - t_vec3 normal; - t_vec3 light_dir; - double bias; - - printf("Testing shadow bias - perpendicular (90°)...\n"); - normal.x = 0.0; - normal.y = 1.0; - normal.z = 0.0; - light_dir.x = 0.0; - light_dir.y = 1.0; - light_dir.z = 0.0; - bias = calculate_shadow_bias(normal, light_dir, 0.001); - assert(bias >= 0.001 && bias <= 0.0015); - printf("✓ Perpendicular angle test passed (bias: %f)\n", bias); -} - -void test_shadow_bias_parallel(void) -{ - t_vec3 normal; - t_vec3 light_dir; - double bias; - - printf("Testing shadow bias - parallel (0°)...\n"); - normal.x = 0.0; - normal.y = 1.0; - normal.z = 0.0; - light_dir.x = 1.0; - light_dir.y = 0.0; - light_dir.z = 0.0; - bias = calculate_shadow_bias(normal, light_dir, 0.001); - assert(bias >= 0.002); - printf("✓ Parallel angle test passed (bias: %f)\n", bias); -} - -void test_shadow_bias_45_degree(void) -{ - t_vec3 normal; - t_vec3 light_dir; - double bias; - double sqrt2; - - printf("Testing shadow bias - 45° angle...\n"); - sqrt2 = sqrt(2.0); - normal.x = 0.0; - normal.y = 1.0; - normal.z = 0.0; - light_dir.x = sqrt2 / 2.0; - light_dir.y = sqrt2 / 2.0; - light_dir.z = 0.0; - bias = calculate_shadow_bias(normal, light_dir, 0.001); - assert(bias > 0.001 && bias < 0.003); - printf("✓ 45° angle test passed (bias: %f)\n", bias); -} - -int main(void) -{ - printf("\n=== Shadow Calculation Unit Tests ===\n\n"); - test_shadow_bias_perpendicular(); - test_shadow_bias_parallel(); - test_shadow_bias_45_degree(); - printf("\n=== Shadow bias tests passed! ===\n\n"); - return (0); -} diff --git a/tests/test_shadow_config b/tests/test_shadow_config deleted file mode 100755 index 6c322b0..0000000 Binary files a/tests/test_shadow_config and /dev/null differ