Skip to content

Fix Issue #416: Implement dynamic resource file location for testbed #428

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

killerdevildog
Copy link

This commit addresses the hardcoded relative path issue that caused problems when different compilers/IDEs placed executables in different directories.

Key Changes:

  • Added ResourceManager class for dynamic resource path discovery
  • Searches up to 4 parent directories for testbed/shaders and testbed/meshes
  • Supports RP3D_RESOURCE_PATH environment variable override
  • Maintains backwards compatibility with fallback to relative paths
  • Uses std::filesystem for cross-platform path handling

Files Added:

  • testbed/common/ResourceManager.h - Header with dynamic path discovery API
  • testbed/common/ResourceManager.cpp - Implementation with filesystem search
  • dynamicresourcefilelocation.md - Comprehensive documentation

Files Modified:

  • testbed/src/SceneDemo.cpp - Updated shader and mesh folder paths
  • testbed/common/*.cpp - Updated all hardcoded mesh paths (Box, Sphere, etc.)
  • testbed/scenes//.cpp - Updated scene-specific mesh paths
  • testbed/CMakeLists.txt - Added ResourceManager to build system

Benefits:

  • Cross-platform compatibility across different build environments
  • No manual configuration required for developers
  • Robust error handling with informative fallback warnings
  • Performance optimized with path caching

Tested successfully with CMake build system - application now runs without file not found errors regardless of build directory structure.

…n for testbed

This commit addresses the hardcoded relative path issue that caused problems
when different compilers/IDEs placed executables in different directories.

Key Changes:
- Added ResourceManager class for dynamic resource path discovery
- Searches up to 4 parent directories for testbed/shaders and testbed/meshes
- Supports RP3D_RESOURCE_PATH environment variable override
- Maintains backwards compatibility with fallback to relative paths
- Uses std::filesystem for cross-platform path handling

Files Added:
- testbed/common/ResourceManager.h - Header with dynamic path discovery API
- testbed/common/ResourceManager.cpp - Implementation with filesystem search
- dynamicresourcefilelocation.md - Comprehensive documentation

Files Modified:
- testbed/src/SceneDemo.cpp - Updated shader and mesh folder paths
- testbed/common/*.cpp - Updated all hardcoded mesh paths (Box, Sphere, etc.)
- testbed/scenes/*/*.cpp - Updated scene-specific mesh paths
- testbed/CMakeLists.txt - Added ResourceManager to build system

Benefits:
- Cross-platform compatibility across different build environments
- No manual configuration required for developers
- Robust error handling with informative fallback warnings
- Performance optimized with path caching

Tested successfully with CMake build system - application now runs without
file not found errors regardless of build directory structure.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant