Files
XCEngine/README.md

180 lines
5.1 KiB
Markdown
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.
# XCEngine
基于 DirectX 12 的渲染引擎项目,包含体积渲染器、基础渲染示例和核心模块单元测试。
## 项目概述
XCEngine 是一个正在开发中的图形渲染引擎,使用 DirectX 12 作为底层渲染 API。项目采用模块化设计包含核心库和单元测试。
## 技术栈
- **渲染 API**: DirectX 12
- **语言**: C++17
- **构建系统**: CMake
- **测试框架**: Google Test
## 项目结构
```
XCEngine/
├── engine/ # 核心引擎库
│ ├── include/XCEngine/
│ │ ├── Containers/ # 容器模块
│ │ │ ├── String.h # 字符串类
│ │ │ ├── Array.h # 动态数组
│ │ │ └── HashMap.h # 哈希表
│ │ ├── Memory/ # 内存管理模块
│ │ │ ├── Allocator.h # 分配器接口
│ │ │ ├── LinearAllocator.h # 线性分配器
│ │ │ ├── PoolAllocator.h # 内存池分配器
│ │ │ ├── ProxyAllocator.h # 代理分配器
│ │ │ └── MemoryManager.h # 内存管理器
│ │ ├── Threading/ # 线程模块
│ │ │ ├── Thread.h # 线程类
│ │ │ ├── Mutex.h # 互斥锁
│ │ │ ├── SpinLock.h # 自旋锁
│ │ │ ├── ReadWriteLock.h # 读写锁
│ │ │ ├── Task.h # 任务基类
│ │ │ ├── LambdaTask.h # Lambda任务
│ │ │ ├── TaskGroup.h # 任务组
│ │ │ ├── TaskSystem.h # 任务系统
│ │ │ └── TaskSystemConfig.h # 任务系统配置
│ │ ├── Math/ # 数学库
│ │ │ ├── Vector.h
│ │ │ ├── Matrix.h
│ │ │ ├── Quaternion.h
│ │ │ └── ...
│ │ └── Core/ # 核心模块
│ │
│ └── src/ # 实现文件
│ ├── Containers/
│ ├── Memory/
│ ├── Threading/
│ └── Math/
├── tests/ # 单元测试
│ ├── containers/ # 容器测试
│ ├── memory/ # 内存管理测试
│ ├── threading/ # 线程模块测试
│ ├── core/ # 核心模块测试
│ └── math/ # 数学库测试
├── MVS/ # 多个示例版本(开发中)
│ ├── HelloEarth/ # 基础渲染示例
│ └── VolumeRenderer/ # 体积渲染器
├── docs/ # 设计文档
│ ├── XCEngine渲染引擎架构设计.md
│ └── ...
└── build/ # 构建目录
```
## 快速开始
### 前置要求
- Windows 10/11
- Visual Studio 2019 或更高版本
- CMake 3.15+
### 构建项目
```bash
# 创建构建目录
mkdir build && cd build
# 配置 CMake
cmake .. -A x64
# 编译
cmake --build . --config Debug
```
### 运行测试
```bash
cd build/tests
ctest -C Debug --output-on-failure
```
或直接运行测试可执行文件:
```bash
build/tests/containers/Debug/xcengine_containers_tests.exe
build/tests/memory/Debug/xcengine_memory_tests.exe
build/tests/threading/Debug/xcengine_threading_tests.exe
```
## 核心模块说明
### Containers容器
- **String**: 动态字符串类,支持常用字符串操作
- **Array**: 模板动态数组,自动内存管理
- **HashMap**: 模板哈希表,支持自定义键类型
### Memory内存管理
- **IAllocator**: 内存分配器接口
- **LinearAllocator**: 线性分配器,适合帧分配
- **PoolAllocator**: 内存池分配器,适合固定大小对象
- **ProxyAllocator**: 代理分配器,跟踪内存使用统计
- **MemoryManager**: 全局内存管理器
### Threading线程
- **Thread**: 线程封装类
- **Mutex**: 互斥锁
- **SpinLock**: 自旋锁,适合短临界区
- **ReadWriteLock**: 读写锁
- **TaskSystem**: 多线程任务系统
- **Task/TaskGroup**: 任务和任务组管理
### Math数学库
- **Vector**: 向量运算
- **Matrix**: 矩阵运算
- **Quaternion**: 四元数
- **Transform**: 变换
- **Color**: 颜色
- **Frustum**: 视锥体
- **Bounds**: 边界框
## 测试覆盖
- Containers: 51+ 测试用例
- Memory: 19 测试用例
- Threading: 13 测试用例
- Math: 通过
## MVS 示例版本
MVSMultiple Version Samples是项目的渲染示例部分展示各种渲染技术
### HelloEarth开发中
基础的 DirectX 12 渲染示例,展示如何:
- 初始化 DirectX 12 渲染环境
- 加载和渲染静态网格
- 使用几何着色器
- 纹理映射
- 常量缓冲区更新
### VolumeRenderer开发中
基于 NanoVDB 的体积渲染器,支持:
- NanoVDB 格式体积数据加载
- 光线步进Ray Marching渲染
- HDDA 空间跳跃加速
- 体积阴影
- 多种渲染参数配置
## 文档
更多详细设计文档请参考 `docs/` 目录。
## 许可证
MIT License