docs: 完成测试文档和功能文档
- Task 11: 创建测试场景和验证 - 创建 docs/tests/hammer-deformation-test-results.md - 包含4个测试用例模板 - 包含性能数据表格和调试工具检查清单 - Task 13: 文档更新 - 更新 CLAUDE.md 添加阶段1核心系统说明 - 创建 docs/features/hammer-deformation-system.md - 更新架构概览、数据流、关键类关系 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -39,13 +39,17 @@ Unreal Engine uses the Automation System:
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
### Core Systems
|
||||
### Core Systems (阶段1更新后)
|
||||
|
||||
**1. Dynamic Mesh Deformation System**
|
||||
- `ADynamicIronBlock` (Source/BladeSmith/DynamicIronBlock.h/cpp) - Main iron block actor that handles all deformation
|
||||
- Uses UE5's GeometryScripting API for runtime mesh manipulation
|
||||
- Implements plastic deformation with volume-preserving bulge effects
|
||||
- BVH acceleration structure for efficient collision detection
|
||||
**1. Dynamic Mesh Deformation System (增强)**
|
||||
- `ADynamicIronBlock` (Source/BladeSmith/DynamicIronBlock.h/cpp) - 支持各向异性材料流动
|
||||
- 顶点属性层: 初始位置、累积应变、硬度系数、打磨度
|
||||
- 边缘检测与约束: 保持刀刃平整锐利
|
||||
- 表面磨损可视化: 基于打磨度的颜色混合
|
||||
- 各向异性材料流动(AnisotropyRatio控制方向性)
|
||||
- 锤击时自动更新打磨度(表面从生锈到光亮)
|
||||
- Laplacian平滑维护网格质量
|
||||
- 自适应优化策略
|
||||
|
||||
**2. Voxel-Based Temperature System**
|
||||
- 3D temperature voxel grid (`FTemperatureVoxel`) stores temperature and plasticity coefficients
|
||||
@@ -76,20 +80,36 @@ ABladeSmithCharacter (Player)
|
||||
└── OnHammerImpact()
|
||||
└── ADynamicIronBlock (Iron Workpiece)
|
||||
├── Temperature Voxel Grid (CPU/GPU)
|
||||
├── Vertex Attribute Arrays (CPU)
|
||||
│ ├── InitialPositionsArray
|
||||
│ ├── AccumulatedStrainArray
|
||||
│ ├── HardnessCoefficientArray
|
||||
│ └── PolishAmountArray
|
||||
├── Dynamic Mesh (GeometryScripting)
|
||||
│ ├── Anisotropic Flow Direction
|
||||
│ ├── Edge Constraint
|
||||
│ └── Laplacian Smoothing
|
||||
└── MiceShaders Compute Shaders
|
||||
```
|
||||
|
||||
### Data Flow: Hammer Impact to Deformation
|
||||
### Data Flow: Hammer Impact to Deformation (阶段1更新)
|
||||
|
||||
1. Player swings hammer (`UBladeSmithWeaponComponent::SwingHammer()`)
|
||||
2. Ray-cast detects hit on `ADynamicIronBlock`
|
||||
3. `OnHammerImpact()` receives: location, normal, radius, depth, force
|
||||
4. Sample plasticity coefficient from temperature voxels at hit location
|
||||
5. Apply plastic deformation to mesh vertices via `EditMesh()` lambda
|
||||
6. Volume-preserving bulge effect applied around impact zone
|
||||
7. Update vertex colors to visualize temperature
|
||||
8. GPU compute shader updates temperature distribution
|
||||
4. **计算材料流动方向** (各向异性)
|
||||
- `FindNearestFreeEdgeDirection()` - 查找最近边缘
|
||||
- `CalculatePrimaryFlowDirection()` - 计算主流动方向
|
||||
- `CalculateSecondaryFlowDirection()` - 计算次流动方向
|
||||
5. Sample plasticity coefficient from temperature voxels at hit location
|
||||
6. Apply plastic deformation to mesh vertices via `EditMesh()` lambda
|
||||
- **各向异性距离计算** - 材料沿主方向更容易流动
|
||||
- **更新顶点属性** - 累积应变、打磨度
|
||||
7. **边缘约束** (如果启用) - `ApplyEdgeLinearConstraint()`
|
||||
8. **Laplacian平滑** - `ApplyLaplacianSmoothing()` (自适应)
|
||||
9. Recompute mesh normals
|
||||
10. Update vertex colors (温度 × 打磨度)
|
||||
11. GPU compute shader updates temperature distribution (如启用)
|
||||
|
||||
## Module Dependencies
|
||||
|
||||
|
||||
Reference in New Issue
Block a user