EG/CLAUDE.md
Rowland bb56813e44 feat(core): 优化 ALVR 串流功能并添加对 Pico 4 的支持
- 添加对有线连接的支持,特别是 Pico 4 的有线连接
- 改进 ALVR 服务器检测和连接逻辑
- 优化 VR 帧获取和处理流程
- 增加备用帧获取功能(主摄像机视图)
- 修复 VR 眼部纹理相关问题
- 优化 VR 任务管理,确保正确渲染和提交帧
2025-07-29 10:17:13 +08:00

102 lines
3.7 KiB
Markdown

# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Overview
This is a Python-based 3D engine editor built with Panda3D and PyQt5. It integrates a comprehensive render pipeline (RenderPipelineFile) and provides VR support through ALVR streaming. The application follows a modular architecture with separate systems for world management, GUI, VR, scripting, and project management.
## Development Commands
This project is a Python application without npm/package.json build commands. Key development commands:
```bash
# Run the main application
python3 main.py
# Run specific demo/test files
python3 demo/basic_gui_demo.py
python3 demo/script_system_demo.py
python3 vr_test.py
# Install dependencies
pip install -r requirements/requirements.txt
```
## Core Architecture
### Main Application Structure
- **main.py**: Entry point - initializes MyWorld class which extends CoreWorld
- **MyWorld class**: Central coordinator that initializes all major systems:
- SelectionSystem, EventHandler, ToolManager, ScriptManager
- GUIManager, SceneManager, ProjectManager, PropertyPanelManager
- InterfaceManager, VRManager, VRInputHandler, ALVRStreamer
### Key Modules
1. **core/**: Core engine functionality
- `world.py`: CoreWorld base class extending Panda3DWorld
- `selection.py`: Object selection and transformation system
- `event_handler.py`: Event processing and input handling
- `tool_manager.py`: Tool system management
- `script_system.py`: Dynamic script loading and execution
- `vr_manager.py`, `vr_input_handler.py`, `alvr_streamer.py`: VR support
2. **ui/**: User interface components
- `main_window.py`: MainWindow class using PyQt5
- `widgets.py`: Custom PyQt5/Panda3D integration widgets
- `property_panel.py`: Object property editing interface
- `interface_manager.py`: UI state management
3. **QPanda3D/**: Custom Panda3D-Qt integration
- `QPanda3DWidget.py`: Core Qt widget for embedding Panda3D
- `Panda3DWorld.py`: Base world class
- Translation modules for Qt/Panda3D event mapping
4. **RenderPipelineFile/**: Advanced rendering pipeline
- Complete PBR rendering system with plugins
- Shader management, lighting, post-processing effects
- Material system and environment probes
5. **scripts/**: User scripts directory
- Contains example scripts like BouncerScript.py, RotatorScript.py
- Scripts are dynamically loaded by the script system
### VR Integration
- ALVR streaming support for wireless VR
- VR input handling with hand tracking
- VR-specific UI and interaction systems
### Demo and Testing
- **demo/**: Extensive collection of test files and examples
- GUI testing examples (basic_gui_demo.py, etc.)
- VR testing and integration demos
- Picking and selection system tests
- Script system demonstrations
## Key Dependencies
- **Panda3D 1.10.15**: Core 3D engine
- **PyQt5**: GUI framework
- **QPanda3D 0.2.10**: Qt-Panda3D integration library
- Various supporting libraries for VR, rendering, and utilities
## Development Notes
### Camera Controls
- Default camera speed: 20.0 units
- Default rotation speed: 10.0 degrees
- Mouse right-click for camera rotation
### Coordinate System
The engine uses Panda3D's coordinate system with specific camera and world setups defined in CoreWorld.
### Script System
Scripts in the `scripts/` directory are automatically discovered and can be loaded dynamically. The script system supports hot-reloading and provides a management interface.
### Render Pipeline Integration
The project integrates a sophisticated render pipeline with:
- PBR materials and lighting
- Post-processing effects (bloom, SSAO, motion blur, FXAA, etc.)
- Environment mapping and IBL
- Shadow mapping (PSSM)
- Day/night cycle simulation