1
0
forked from Rowland/EG
EG/run_vr_test.sh
2025-09-26 14:53:27 +08:00

123 lines
3.1 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# VR性能测试启动脚本
# 使用方法: ./run_vr_test.sh
echo "🚀 VR性能测试启动脚本"
echo "======================"
# 检查是否在正确的目录
if [ ! -f "vr_performance_test.py" ]; then
echo "❌ 错误找不到vr_performance_test.py文件"
echo "请在EG项目根目录运行此脚本"
exit 1
fi
# 检查Python是否可用
if ! command -v python3 &> /dev/null; then
if ! command -v python &> /dev/null; then
echo "❌ 错误找不到Python解释器"
exit 1
else
PYTHON_CMD="python"
fi
else
PYTHON_CMD="python3"
fi
echo "✓ 使用Python解释器: $PYTHON_CMD"
# 检查核心模块是否存在
if [ ! -d "core" ]; then
echo "❌ 错误找不到core目录"
echo "请确保在EG项目根目录中运行"
exit 1
fi
if [ ! -f "core/vr_manager.py" ]; then
echo "❌ 错误找不到core/vr_manager.py文件"
echo "VR管理器模块不存在"
exit 1
fi
echo "✓ 核心模块检查通过"
# 检查VR相关依赖
echo "🔍 检查VR依赖..."
$PYTHON_CMD -c "import openvr" 2>/dev/null
if [ $? -eq 0 ]; then
echo "✓ OpenVR Python绑定可用"
else
echo "⚠️ 警告OpenVR Python绑定不可用"
echo " 如果需要VR功能请安装: pip install openvr"
fi
$PYTHON_CMD -c "from panda3d.core import Vec3" 2>/dev/null
if [ $? -eq 0 ]; then
echo "✓ Panda3D可用"
else
echo "❌ 错误Panda3D不可用"
echo "请安装Panda3D: pip install panda3d"
exit 1
fi
# 检查可选的性能监控依赖
echo "🔍 检查性能监控依赖..."
$PYTHON_CMD -c "import psutil" 2>/dev/null
if [ $? -eq 0 ]; then
echo "✓ psutil可用CPU/内存监控)"
else
echo "⚠️ 建议安装psutil以获得完整性能监控: pip install psutil"
fi
$PYTHON_CMD -c "import GPUtil" 2>/dev/null
if [ $? -eq 0 ]; then
echo "✓ GPUtil可用GPU监控"
else
echo "⚠️ 建议安装GPUtil以获得GPU监控: pip install GPUtil"
fi
echo ""
echo "🎮 启动前检查清单:"
echo "□ VR头显已连接并开机"
echo "□ SteamVR正在运行"
echo "□ VR头显已完成初始设置"
echo "□ VR跟踪系统正常工作"
echo ""
# 询问用户是否继续
echo "是否继续启动VR性能测试"
echo "按Enter继续或按Ctrl+C取消..."
read -r
echo ""
echo "🚀 正在启动VR性能测试..."
echo "控制说明:"
echo " ESC - 退出测试"
echo " 1-9 - 设置场景复杂度"
echo " R - 重置性能计数器"
echo " P - 手动输出性能报告"
echo " D - 切换调试模式"
echo "VR分辨率控制"
echo " Q - 切换质量预设 (性能/平衡/质量)"
echo " [ - 降低分辨率缩放"
echo " ] - 提高分辨率缩放"
echo " I - 显示分辨率信息"
echo ""
# 启动测试
$PYTHON_CMD vr_performance_test.py
# 检查退出状态
if [ $? -eq 0 ]; then
echo ""
echo "✅ VR性能测试正常结束"
else
echo ""
echo "❌ VR性能测试异常退出错误代码$?"
fi
echo "📋 检查当前目录中的CSV文件获取详细性能数据"
echo "📖 查看VR_PERFORMANCE_TEST_README.md获取详细使用说明"