docs: 更新 API 文档 - 多模块修复和完善

- audio: 更新 audio-system 方法文档
- components: 新增 audio-listener/audio-source 组件方法文档,新增 remove-component 方法
- core: 更新 filewriter, types 文档
- math: 更新 box 方法文档
- memory: 更新 proxy-allocator 文档
- resources: 更新 loader 和 texture 文档
- rhi: 更新 opengl 设备、shader、swap-chain 文档
- threading: 更新 mutex 和 task-system 文档
This commit is contained in:
2026-03-26 01:58:45 +08:00
parent 445876752c
commit 8df04c120f
81 changed files with 1747 additions and 170 deletions

View File

@@ -15,12 +15,12 @@ void Initialize(const AudioConfig& config);
```cpp ```cpp
#include <XCEngine/Audio/AudioSystem.h> #include <XCEngine/Audio/AudioSystem.h>
#include <XCEngine/Audio/WASAPI/WASAPIBackend.h> #include <XCEngine/Audio/WindowsAudioBackend.h>
using namespace XCEngine::Audio; using namespace XCEngine::Audio;
void SetupAudio() { void SetupAudio() {
AudioSystem::Get().SetBackend(std::make_unique<WASAPIBackend>()); AudioSystem::Get().SetBackend(std::make_unique<WASAPI::WASAPIBackend>());
AudioConfig config; AudioConfig config;
config.sampleRate = 48000; config.sampleRate = 48000;

View File

@@ -15,12 +15,12 @@ void SetBackend(std::unique_ptr<IAudioBackend> backend);
```cpp ```cpp
#include <XCEngine/Audio/AudioSystem.h> #include <XCEngine/Audio/AudioSystem.h>
#include <XCEngine/Audio/WASAPI/WASAPIBackend.h> #include <XCEngine/Audio/WindowsAudioBackend.h>
using namespace XCEngine::Audio; using namespace XCEngine::Audio;
void SetupAudio() { void SetupAudio() {
AudioSystem::Get().SetBackend(std::make_unique<WASAPIBackend>()); AudioSystem::Get().SetBackend(std::make_unique<WASAPI::WASAPIBackend>());
} }
``` ```

View File

@@ -0,0 +1,37 @@
# GetDopplerLevel
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 获取音频监听器的多普勒效应等级。
## 函数签名
```cpp
float GetDopplerLevel() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前多普勒等级1.0 为默认值 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void PrintDopplerLevel(AudioListenerComponent* listener) {
float level = listener->GetDopplerLevel();
printf("Doppler level: %.2f\n", level);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [SetDopplerLevel](./set-doppler-level.md) - 设置多普勒等级

View File

@@ -0,0 +1,37 @@
# GetEnergy
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 获取音频监听器当前接收到的音频能量值。
## 函数签名
```cpp
float GetEnergy() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前音频能量值,通常在 0.0 到 1.0 范围内 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void CheckAudioEnergy(AudioListenerComponent* listener) {
float energy = listener->GetEnergy();
printf("Current audio energy: %.2f\n", energy);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [GetFrequencyData](./get-frequency-data.md) - 获取频谱数据

View File

@@ -0,0 +1,37 @@
# GetFrequencyDataSize
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 获取音频监听器频谱数据的大小。
## 函数签名
```cpp
size_t GetFrequencyDataSize() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `size_t` | 频谱数据数组的元素数量 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void CheckSpectrumSize(AudioListenerComponent* listener) {
size_t size = listener->GetFrequencyDataSize();
printf("Spectrum data size: %zu\n", size);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [GetFrequencyData](./get-frequency-data.md) - 获取频谱数据

View File

@@ -0,0 +1,43 @@
# GetFrequencyData
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 获取音频监听器的频谱数据指针。
## 函数签名
```cpp
const float* GetFrequencyData() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `const float*` | 频谱数据数组指针,数据为 FFT 变换后的频率幅度 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void ProcessFrequencyData(AudioListenerComponent* listener) {
const float* data = listener->GetFrequencyData();
size_t size = listener->GetFrequencyDataSize();
// 打印前几个频率值
for (size_t i = 0; i < size && i < 10; ++i) {
printf("Freq[%zu]: %.2f\n", i, data[i]);
}
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [GetFrequencyDataSize](./get-frequency-data-size.md) - 获取频谱数据大小
- [GetEnergy](./get-energy.md) - 获取音频能量

View File

@@ -0,0 +1,37 @@
# GetReverbLevel
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 获取音频监听器的混响等级。
## 函数签名
```cpp
float GetReverbLevel() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前混响等级,范围 0.0 到 1.0 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void PrintReverbLevel(AudioListenerComponent* listener) {
float level = listener->GetReverbLevel();
printf("Reverb level: %.2f\n", level);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [SetReverbLevel](./set-reverb-level.md) - 设置混响等级

View File

@@ -0,0 +1,42 @@
# GetReverb
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 获取音频监听器当前的混响效果器。
## 函数签名
```cpp
Audio::AudioMixer* GetReverb() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `Audio::AudioMixer*` | 混响效果器指针,如果未设置则返回 nullptr |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
using namespace XCEngine::Audio;
void CheckReverb(AudioListenerComponent* listener) {
AudioMixer* reverb = listener->GetReverb();
if (reverb) {
printf("Reverb effect is set\n");
} else {
printf("No reverb effect\n");
}
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [SetReverb](./set-reverb.md) - 设置混响效果器

View File

@@ -0,0 +1,37 @@
# GetSpeedOfSound
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 获取声音传播速度。
## 函数签名
```cpp
float GetSpeedOfSound() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前声速设置,单位米/秒 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void PrintSpeedOfSound(AudioListenerComponent* listener) {
float speed = listener->GetSpeedOfSound();
printf("Speed of sound: %.1f m/s\n", speed);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [SetSpeedOfSound](./set-speed-of-sound.md) - 设置声速

View File

@@ -0,0 +1,44 @@
# SetDopplerLevel
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 设置音频监听器的多普勒效应等级。
## 函数签名
```cpp
void SetDopplerLevel(float level);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `level` | `float` | 多普勒等级1.0 为默认值0.0 禁用多普勒效应 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void SetupDoppler(AudioListenerComponent* listener) {
// 设置正常多普勒效应
listener->SetDopplerLevel(1.0f);
// 禁用多普勒效应
listener->SetDopplerLevel(0.0f);
// 增强多普勒效应
listener->SetDopplerLevel(2.0f);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [GetDopplerLevel](./get-doppler-level.md) - 获取多普勒等级
- [SetSpeedOfSound](./set-speed-of-sound.md) - 设置声速

View File

@@ -0,0 +1,37 @@
# SetMute
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 设置音频监听器的静音状态。
## 函数签名
```cpp
void SetMute(bool mute);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `mute` | `bool` | 静音状态true 启用静音false 禁用静音 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void ToggleMute(AudioListenerComponent* listener) {
bool currentMute = listener->IsMute();
listener->SetMute(!currentMute);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [IsMute](./is-mute.md) - 检查静音状态

View File

@@ -0,0 +1,44 @@
# SetReverbLevel
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 设置音频监听器的混响等级。
## 函数签名
```cpp
void SetReverbLevel(float level);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `level` | `float` | 混响等级0.0 到 1.00.0 表示无混响1.0 表示完全混响 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void SetupReverb(AudioListenerComponent* listener) {
// 无混响
listener->SetReverbLevel(0.0f);
// 半混响
listener->SetReverbLevel(0.5f);
// 完全混响
listener->SetReverbLevel(1.0f);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [GetReverbLevel](./get-reverb-level.md) - 获取混响等级
- [SetReverb](./set-reverb.md) - 设置混响效果器

View File

@@ -0,0 +1,40 @@
# SetReverb
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 设置音频监听器的混响效果器。
## 函数签名
```cpp
void SetReverb(Audio::AudioMixer* reverb);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `reverb` | `Audio::AudioMixer*` | 混响效果器指针,设置为 nullptr 则禁用混响 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
#include <XCEngine/Audio/AudioMixer.h>
using namespace XCEngine::Components;
using namespace XCEngine::Audio;
void SetupReverbEffect(AudioListenerComponent* listener, AudioMixer* reverbMixer) {
listener->SetReverb(reverbMixer);
listener->SetReverbLevel(0.5f);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [GetReverb](./get-reverb.md) - 获取混响效果器
- [SetReverbLevel](./set-reverb-level.md) - 设置混响等级

View File

@@ -0,0 +1,41 @@
# SetSpeedOfSound
**所属类**: `AudioListenerComponent`
**头文件**: `XCEngine/Components/AudioListenerComponent.h`
**描述**: 设置声音在空气中的传播速度,用于多普勒效应计算。
## 函数签名
```cpp
void SetSpeedOfSound(float metersPerSecond);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `metersPerSecond` | `float` | 声速,单位米/秒,默认值为 343.020度 Celsius 时的声速) |
## 使用示例
```cpp
#include <XCEngine/Components/AudioListenerComponent.h>
using namespace XCEngine::Components;
void SetupSpeedOfSound(AudioListenerComponent* listener) {
// 标准声速20度 Celsius
listener->SetSpeedOfSound(343.0f);
// 水中的声速
listener->SetSpeedOfSound(1480.0f);
}
```
## 相关文档
- [AudioListenerComponent](./audio-listener-component.md) - 音频监听器组件
- [GetSpeedOfSound](./get-speed-of-sound.md) - 获取声速
- [SetDopplerLevel](./set-doppler-level.md) - 设置多普勒等级

View File

@@ -0,0 +1,38 @@
# Get3DParams
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源的3D音频参数。
## 函数签名
```cpp
const Audio::Audio3DParams& Get3DParams() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `const Audio::Audio3DParams&` | 3D音频参数引用 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void Print3DParams(AudioSourceComponent* source) {
const auto& params = source->Get3DParams();
printf("Doppler: %.2f, Spread: %.2f, ReverbZoneMix: %.2f\n",
params.dopplerLevel, params.spread, params.reverbZoneMix);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [Set3DParams](./set-3d-params.md) - 设置3D参数

View File

@@ -0,0 +1,41 @@
# GetClip
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源当前播放的音频片段。
## 函数签名
```cpp
Resources::AudioClip* GetClip() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `Resources::AudioClip*` | 音频片段指针,如果未设置则返回 nullptr |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void CheckCurrentClip(AudioSourceComponent* source) {
auto clip = source->GetClip();
if (clip) {
printf("Current clip: %s\n", clip->GetName().c_str());
} else {
printf("No clip set\n");
}
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetClip](./set-clip.md) - 设置音频片段

View File

@@ -0,0 +1,37 @@
# GetDopplerLevel
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源的多普勒效应等级。
## 函数签名
```cpp
float GetDopplerLevel() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前多普勒等级 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PrintDopplerLevel(AudioSourceComponent* source) {
float level = source->GetDopplerLevel();
printf("Doppler level: %.2f\n", level);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetDopplerLevel](./set-doppler-level.md) - 设置多普勒等级

View File

@@ -0,0 +1,38 @@
# GetDuration
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源当前音频的总时长。
## 函数签名
```cpp
float GetDuration() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 音频总时长,单位秒。如果没有设置音频片段则返回 0.0 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PrintDuration(AudioSourceComponent* source) {
float duration = source->GetDuration();
printf("Duration: %.2f seconds\n", duration);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [GetTime](./get-time.md) - 获取当前播放位置
- [SetClip](./set-clip.md) - 设置音频片段

View File

@@ -0,0 +1,41 @@
# GetOutputMixer
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源的输出混音器。
## 函数签名
```cpp
Audio::AudioMixer* GetOutputMixer() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `Audio::AudioMixer*` | 输出混音器指针,如果未设置则返回 nullptr |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void CheckOutputMixer(AudioSourceComponent* source) {
auto* mixer = source->GetOutputMixer();
if (mixer) {
printf("Output mixer is set\n");
} else {
printf("Using default output\n");
}
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetOutputMixer](./set-output-mixer.md) - 设置输出混音器

View File

@@ -0,0 +1,37 @@
# GetPan
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源的平移值。
## 函数签名
```cpp
float GetPan() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前平移值,-1.0 到 1.0 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PrintPan(AudioSourceComponent* source) {
float pan = source->GetPan();
printf("Pan: %.2f\n", pan);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetPan](./set-pan.md) - 设置平移值

View File

@@ -0,0 +1,37 @@
# GetPitch
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源的音高。
## 函数签名
```cpp
float GetPitch() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前音高1.0 为正常速度 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PrintPitch(AudioSourceComponent* source) {
float pitch = source->GetPitch();
printf("Pitch: %.2f\n", pitch);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetPitch](./set-pitch.md) - 设置音高

View File

@@ -0,0 +1,37 @@
# GetReverbZoneMix
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源的混响区域混合比例。
## 函数签名
```cpp
float GetReverbZoneMix() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前混响混合比例0.0 到 1.0 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PrintReverbZoneMix(AudioSourceComponent* source) {
float mix = source->GetReverbZoneMix();
printf("Reverb zone mix: %.2f\n", mix);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetReverbZoneMix](./set-reverb-zone-mix.md) - 设置混响混合比例

View File

@@ -0,0 +1,37 @@
# GetSpread
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源的扩散角度。
## 函数签名
```cpp
float GetSpread() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前扩散角度(度) |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PrintSpread(AudioSourceComponent* source) {
float spread = source->GetSpread();
printf("Spread: %.1f degrees\n", spread);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetSpread](./set-spread.md) - 设置扩散角度

View File

@@ -0,0 +1,39 @@
# GetTime
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源当前的播放位置。
## 函数签名
```cpp
float GetTime() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前播放位置,单位秒 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PrintCurrentTime(AudioSourceComponent* source) {
float time = source->GetTime();
float duration = source->GetDuration();
printf("%.1f / %.1f seconds\n", time, duration);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetTime](./set-time.md) - 设置播放位置
- [GetDuration](./get-duration.md) - 获取总时长

View File

@@ -0,0 +1,37 @@
# GetVolume
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 获取音频源的音量。
## 函数签名
```cpp
float GetVolume() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `float` | 当前音量,范围 0.0 到 1.0 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PrintVolume(AudioSourceComponent* source) {
float volume = source->GetVolume();
printf("Volume: %.2f\n", volume);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetVolume](./set-volume.md) - 设置音量

View File

@@ -0,0 +1,41 @@
# IsEnergyDetecting
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 检查音频能量检测是否处于活跃状态。
## 函数签名
```cpp
bool IsEnergyDetecting() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `bool` | true 表示正在检测能量false 表示未检测 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void CheckEnergyDetection(AudioSourceComponent* source) {
if (source->IsEnergyDetecting()) {
float energy = source->GetEnergy();
printf("Current energy: %.2f\n", energy);
}
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [StartEnergyDetect](./start-energy-detect.md) - 开始能量检测
- [StopEnergyDetect](./stop-energy-detect.md) - 停止能量检测
- [GetEnergy](./get-energy.md) - 获取当前能量值

View File

@@ -0,0 +1,38 @@
# IsLooping
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 检查音频源是否设置为循环播放。
## 函数签名
```cpp
bool IsLooping() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `bool` | true 表示循环播放false 表示播放一次后停止 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void CheckLoopingStatus(AudioSourceComponent* source) {
if (source->IsLooping()) {
printf("Audio is looping\n");
}
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetLooping](./set-looping.md) - 设置循环播放

View File

@@ -0,0 +1,38 @@
# IsPaused
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 检查音频源是否处于暂停状态。
## 函数签名
```cpp
bool IsPaused() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `bool` | true 表示已暂停false 表示未暂停 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void CheckPausedStatus(AudioSourceComponent* source) {
if (source->IsPaused()) {
printf("Audio is paused\n");
}
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [IsPlaying](./is-playing.md) - 检查是否正在播放

View File

@@ -0,0 +1,40 @@
# IsPlaying
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 检查音频源是否正在播放。
## 函数签名
```cpp
bool IsPlaying() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `bool` | true 表示正在播放false 表示未在播放 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void CheckPlayingStatus(AudioSourceComponent* source) {
if (source->IsPlaying()) {
printf("Audio is playing\n");
} else {
printf("Audio is not playing\n");
}
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [IsPaused](./is-paused.md) - 检查是否暂停

View File

@@ -0,0 +1,38 @@
# IsSpatialize
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 检查音频源是否启用3D空间化。
## 函数签名
```cpp
bool IsSpatialize() const;
```
## 返回值
| 类型 | 描述 |
|------|------|
| `bool` | true 表示启用3D空间化false 表示禁用 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void CheckSpatializeStatus(AudioSourceComponent* source) {
if (source->IsSpatialize()) {
printf("3D spatialization is enabled\n");
}
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [SetSpatialize](./set-spatialize.md) - 设置空间化

View File

@@ -0,0 +1,31 @@
# Pause
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 暂停音频播放。
## 函数签名
```cpp
void Pause();
```
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void PauseAudio(AudioSourceComponent* source) {
source->Pause();
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [Play](./play.md) - 开始播放
- [Stop](./stop.md) - 停止播放

View File

@@ -0,0 +1,31 @@
# Play
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 开始播放音频。
## 函数签名
```cpp
void Play();
```
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void StartPlayback(AudioSourceComponent* source) {
source->Play();
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [Pause](./pause.md) - 暂停播放
- [Stop](./stop.md) - 停止播放

View File

@@ -0,0 +1,39 @@
# SetClip
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源播放的音频片段。
## 函数签名
```cpp
void SetClip(Resources::AudioClip* clip);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `clip` | `Resources::AudioClip*` | 音频片段指针,设置为 nullptr 则清除当前片段 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
#include <XCEngine/Resources/AudioClip/AudioClip.h>
using namespace XCEngine::Components;
void LoadAndPlaySound(AudioSourceComponent* source) {
auto clip = Resources::AudioClip::Load("assets/audio/ explosion.wav");
source->SetClip(clip);
source->Play();
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [GetClip](./get-clip.md) - 获取当前音频片段

View File

@@ -0,0 +1,36 @@
# SetDopplerLevel
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源的多普勒效应等级。
## 函数签名
```cpp
void SetDopplerLevel(float level);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `level` | `float` | 多普勒等级1.0 为默认值0.0 禁用 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void SetupDoppler(AudioSourceComponent* source) {
source->SetDopplerLevel(1.0f);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [GetDopplerLevel](./get-doppler-level.md) - 获取多普勒等级

View File

@@ -0,0 +1,36 @@
# SetLooping
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源是否循环播放。
## 函数签名
```cpp
void SetLooping(bool loop);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `loop` | `bool` | true 启用循环播放false 播放一次后停止 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void SetupLooping(AudioSourceComponent* source, bool shouldLoop) {
source->SetLooping(shouldLoop);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [IsLooping](./is-looping.md) - 检查是否循环播放

View File

@@ -0,0 +1,43 @@
# SetPan
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源的平移值(左右声道分布)。
## 函数签名
```cpp
void SetPan(float pan);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `pan` | `float` | 平移值,-1.0 表示完全左声道0.0 表示居中1.0 表示完全右声道 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void SetupPan(AudioSourceComponent* source) {
// 居中
source->SetPan(0.0f);
// 偏左
source->SetPan(-0.5f);
// 偏右
source->SetPan(0.5f);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [GetPan](./get-pan.md) - 获取平移值

View File

@@ -0,0 +1,43 @@
# SetPitch
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源的音高。
## 函数签名
```cpp
void SetPitch(float pitch);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `pitch` | `float` | 音高0.5 表示半速1.0 表示正常速度2.0 表示双倍速度 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void SetupPitch(AudioSourceComponent* source) {
// 正常音高
source->SetPitch(1.0f);
// 低八度
source->SetPitch(0.5f);
// 高八度
source->SetPitch(2.0f);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [GetPitch](./get-pitch.md) - 获取音高

View File

@@ -0,0 +1,43 @@
# SetReverbZoneMix
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置混响区域混合比例。
## 函数签名
```cpp
void SetReverbZoneMix(float mix);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `mix` | `float` | 混响混合比例0.0 到 1.00.0 表示干声1.0 表示完全混响 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void SetupReverbZoneMix(AudioSourceComponent* source) {
// 干声(无混响)
source->SetReverbZoneMix(0.0f);
// 半湿声
source->SetReverbZoneMix(0.5f);
// 完全混响
source->SetReverbZoneMix(1.0f);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [GetReverbZoneMix](./get-reverb-zone-mix.md) - 获取混响混合比例

View File

@@ -0,0 +1,40 @@
# SetSpatialize
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源是否启用3D空间化。
## 函数签名
```cpp
void SetSpatialize(bool spatialize);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `spatialize` | `bool` | true 启用3D空间化false 禁用2D模式 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void SetupSpatialize(AudioSourceComponent* source) {
// 启用3D空间化环境音
source->SetSpatialize(true);
// 禁用3D空间化UI音效
source->SetSpatialize(false);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [IsSpatialize](./is-spatialize.md) - 检查是否启用空间化

View File

@@ -0,0 +1,43 @@
# SetSpread
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源的扩散角度。
## 函数签名
```cpp
void SetSpread(float spread);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `spread` | `float` | 扩散角度0.0 到 360.0 度0 表示点声源360 表示全向 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void SetupSpread(AudioSourceComponent* source) {
// 点声源
source->SetSpread(0.0f);
// 半全向
source->SetSpread(180.0f);
// 全向
source->SetSpread(360.0f);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [GetSpread](./get-spread.md) - 获取扩散角度

View File

@@ -0,0 +1,41 @@
# SetTime
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 设置音频源的当前播放位置。
## 函数签名
```cpp
void SetTime(float seconds);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `seconds` | `float` | 播放位置,单位秒 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void SeekToPosition(AudioSourceComponent* source, float seconds) {
source->SetTime(seconds);
}
void RewindToStart(AudioSourceComponent* source) {
source->SetTime(0.0f);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [GetTime](./get-time.md) - 获取当前播放位置
- [GetDuration](./get-duration.md) - 获取总时长

View File

@@ -0,0 +1,32 @@
# StartEnergyDetect
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 开始音频能量检测。
## 函数签名
```cpp
void StartEnergyDetect();
```
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void BeginEnergyDetection(AudioSourceComponent* source) {
source->StartEnergyDetect();
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [StopEnergyDetect](./stop-energy-detect.md) - 停止能量检测
- [IsEnergyDetecting](./is-energy-detecting.md) - 检查是否正在检测
- [GetEnergy](./get-energy.md) - 获取当前能量值

View File

@@ -0,0 +1,31 @@
# StopEnergyDetect
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 停止音频能量检测。
## 函数签名
```cpp
void StopEnergyDetect();
```
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
using namespace XCEngine::Components;
void EndEnergyDetection(AudioSourceComponent* source) {
source->StopEnergyDetect();
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [StartEnergyDetect](./start-energy-detect.md) - 开始能量检测
- [IsEnergyDetecting](./is-energy-detecting.md) - 检查是否正在检测

View File

@@ -0,0 +1,42 @@
# Stop
**所属类**: `AudioSourceComponent`
**头文件**: `XCEngine/Components/AudioSourceComponent.h`
**描述**: 停止音频播放。
## 函数签名
```cpp
void Stop(Audio::StopMode mode = Audio::StopMode::Immediate);
```
## 参数
| 参数 | 类型 | 描述 |
|------|------|------|
| `mode` | `Audio::StopMode` | 停止模式,默认为 Immediate立即停止 |
## 使用示例
```cpp
#include <XCEngine/Components/AudioSourceComponent.h>
#include <XCEngine/Audio/AudioTypes.h>
using namespace XCEngine::Components;
void StopAudio(AudioSourceComponent* source) {
source->Stop(Audio::StopMode::Immediate);
}
void FadeOutAndStop(AudioSourceComponent* source) {
source->Stop(Audio::StopMode::FadeOut);
}
```
## 相关文档
- [AudioSourceComponent](./audio-source-component.md) - 音频源组件
- [Play](./play.md) - 开始播放
- [Pause](./pause.md) - 暂停播放

View File

@@ -42,6 +42,7 @@ GameObject 是 XCEngine ECS 架构中的实体Entity代表游戏世
| [`GetComponentInChildren`](get-component-in-children.md) | 在子对象中查找组件 | | [`GetComponentInChildren`](get-component-in-children.md) | 在子对象中查找组件 |
| [`GetComponentInParent`](get-component-in-parent.md) | 在父对象中查找组件 | | [`GetComponentInParent`](get-component-in-parent.md) | 在父对象中查找组件 |
| [`GetComponentsInChildren`](get-components-in-children.md) | 获取所有子对象的指定组件 | | [`GetComponentsInChildren`](get-components-in-children.md) | 获取所有子对象的指定组件 |
| [`RemoveComponent`](remove-component.md) | 移除组件(模板方法) |
### 层级结构 ### 层级结构

View File

@@ -0,0 +1,26 @@
# GameObject::RemoveComponent
移除指定类型的组件。
```cpp
template<typename T>
void RemoveComponent();
bool RemoveComponent(Component* component);
```
模板版本根据类型移除组件参数版本根据指针移除具体组件实例。TransformComponent 无法被移除。
**模板参数:**
- `T` - 组件类型
**参数:**
- `component` - 要移除的组件指针
**返回:** `bool` - 对于指针版本,如果成功移除则返回 true
## 相关文档
- [GameObject 总览](game-object.md)
- [AddComponent](add-component.md)
- [GetComponent](get-component.md)

View File

@@ -21,7 +21,7 @@ void Resize(SizeType newSize, char fillChar);
**示例:** **示例:**
```cpp ```cpp
#include "XCEngine/Containers/String.h" #include "XCEngine/Core/Containers/String.h"
#include <iostream> #include <iostream>
int main() { int main() {

View File

@@ -19,7 +19,7 @@ bool Empty() const;
**示例:** **示例:**
```cpp ```cpp
#include "XCEngine/Containers/String.h" #include "XCEngine/Core/Containers/String.h"
#include <iostream> #include <iostream>
int main() { int main() {

View File

@@ -16,7 +16,7 @@ bool StartsWith(const char* prefix) const;
**示例:** **示例:**
```cpp ```cpp
#include "XCEngine/Containers/String.h" #include "XCEngine/Core/Containers/String.h"
#include <iostream> #include <iostream>
int main() { int main() {

View File

@@ -16,7 +16,7 @@ String Substring(SizeType pos, SizeType len = npos) const;
**示例:** **示例:**
```cpp ```cpp
#include "XCEngine/Containers/String.h" #include "XCEngine/Core/Containers/String.h"
#include <iostream> #include <iostream>
int main() { int main() {

View File

@@ -15,7 +15,7 @@ String ToUpper() const;
**示例:** **示例:**
```cpp ```cpp
#include "XCEngine/Containers/String.h" #include "XCEngine/Core/Containers/String.h"
#include <iostream> #include <iostream>
int main() { int main() {

View File

@@ -14,7 +14,7 @@ String Trim() const;
**示例:** **示例:**
```cpp ```cpp
#include "XCEngine/Containers/String.h" #include "XCEngine/Core/Containers/String.h"
#include <iostream> #include <iostream>
int main() { int main() {

View File

@@ -73,7 +73,7 @@ UniqueRef<T> MakeUnique(Args&&... args);
```cpp ```cpp
#include <XCEngine/Core/Core.h> #include <XCEngine/Core/Core.h>
#include <XCEngine/Containers/String.h> #include <XCEngine/Core/Containers/String.h>
using namespace XCEngine::Core; using namespace XCEngine::Core;

View File

@@ -29,7 +29,7 @@
```cpp ```cpp
#include <XCEngine/Core/FileWriter.h> #include <XCEngine/Core/FileWriter.h>
#include <XCEngine/Containers/String.h> #include <XCEngine/Core/Containers/String.h>
using namespace XCEngine::Core; using namespace XCEngine::Core;

View File

@@ -59,4 +59,4 @@ void ProcessData(Core::uint32 size, const Core::int8* data);
## 相关文档 ## 相关文档
- [SmartPtr](../smartptr/smartptr.md) - 智能指针(该文档暂缺) - [SmartPtr](../smartptr/smartptr.md) - 智能指针

View File

@@ -26,6 +26,7 @@ using namespace XCEngine::Math;
Box box(Vector3(0.0f, 0.0f, 0.0f), Vector3(1.0f, 1.0f, 1.0f)); Box box(Vector3(0.0f, 0.0f, 0.0f), Vector3(1.0f, 1.0f, 1.0f));
Sphere sphere(Vector3(2.0f, 0.0f, 0.0f), 1.0f); Sphere sphere(Vector3(2.0f, 0.0f, 0.0f), 1.0f);
if (box.Intersects(sphere)) { if (box.Intersects(sphere)) {
// 盒体与球体相交
} }
``` ```

View File

@@ -4,7 +4,7 @@
**类型**: `struct` **类型**: `struct`
**头文件**: `XCEngine/Math/OBB.h` **头文件**: `XCEngine/Math/AABB.h`
**描述**: 定向包围盒,支持任意方向旋转的盒状包围体 **描述**: 定向包围盒,支持任意方向旋转的盒状包围体

View File

@@ -4,7 +4,7 @@
**类型**: `module` **类型**: `module`
**头文件**: `XCEngine/Memory/Memory.h` **头文件**: `XCEngine/Memory/MemoryManager.h`
**描述**: XCEngine 的内存管理模块,提供多种内存分配器实现。 **描述**: XCEngine 的内存管理模块,提供多种内存分配器实现。
@@ -55,6 +55,9 @@ Memory 模块提供了一套完整的内存管理解决方案,包括基础分
```cpp ```cpp
#include <XCEngine/Memory/MemoryManager.h> #include <XCEngine/Memory/MemoryManager.h>
// 初始化内存管理器
MemoryManager::Get().Initialize();
// 获取系统分配器 // 获取系统分配器
IAllocator* sysAlloc = MemoryManager::Get().GetSystemAllocator(); IAllocator* sysAlloc = MemoryManager::Get().GetSystemAllocator();

View File

@@ -16,6 +16,8 @@
| 方法 | 描述 | | 方法 | 描述 |
|------|------| |------|------|
| [`ProxyAllocator`](constructor.md) | 构造代理分配器 |
| [`~ProxyAllocator`](~proxy-allocator.md) | 析构函数 |
| [`Allocate`](allocate.md) | 分配内存并记录统计 | | [`Allocate`](allocate.md) | 分配内存并记录统计 |
| [`Free`](free.md) | 释放内存并记录统计 | | [`Free`](free.md) | 释放内存并记录统计 |
| [`Reallocate`](reallocate.md) | 转发到底层分配器 | | [`Reallocate`](reallocate.md) | 转发到底层分配器 |
@@ -26,39 +28,6 @@
| [`GetAllocationCount`](get-allocation-count.md) | 获取分配次数 | | [`GetAllocationCount`](get-allocation-count.md) | 获取分配次数 |
| [`GetName`](get-name.md) | 获取分配器名称 | | [`GetName`](get-name.md) | 获取分配器名称 |
## 构造函数
```cpp
ProxyAllocator(IAllocator* underlying, const char* name);
```
构造一个代理分配器,包装底层分配器并记录分配统计。所有 `Allocate``Free``Reallocate` 调用都会被转发到底层分配器,同时记录统计信息。名称用于日志和报告。
**参数:**
- `underlying` - 被包装的底层分配器,不能为 `nullptr`
- `name` - 代理分配器的名称字符串
**返回:**
**复杂度:** O(1)
**示例:**
```cpp
#include <XCEngine/Memory/MemoryManager.h>
#include <XCEngine/Memory/ProxyAllocator.h>
MemoryManager::Get().Initialize();
// 使用系统分配器作为底层
IAllocator* sysAlloc = MemoryManager::Get().GetSystemAllocator();
ProxyAllocator proxy(sysAlloc, "TempAllocations");
// 通过代理分配
void* ptr = proxy.Allocate(1024);
proxy.Free(ptr);
```
## 相关文档 ## 相关文档
- [Memory 模块总览](../memory.md) - 返回模块总览 - [Memory 模块总览](../memory.md) - 返回模块总览

View File

@@ -0,0 +1,37 @@
# ProxyAllocator::~ProxyAllocator
```cpp
~ProxyAllocator() override;
```
销毁代理分配器。不会释放底层分配器的内存,只是停止统计并转发请求。
**参数:**
**返回:**
**注意:** 析构函数仅销毁代理对象本身,底层分配器需要由用户单独管理。
**示例:**
```cpp
#include <XCEngine/Memory/MemoryManager.h>
#include <XCEngine/Memory/ProxyAllocator.h>
IAllocator* sysAlloc = MemoryManager::Get().GetSystemAllocator();
{
ProxyAllocator proxy(sysAlloc, "ScopedAlloc");
proxy.Allocate(1024);
// 超出作用域时代理被销毁,但底层分配器仍在
}
// 底层分配器仍可继续使用
void* ptr = sysAlloc->Allocate(256);
sysAlloc->Free(ptr);
```
## 相关文档
- [ProxyAllocator 总览](proxy-allocator.md) - 返回类总览
- [`ProxyAllocator`](constructor.md) - 构造函数

View File

@@ -56,4 +56,4 @@ if (result.IsSuccess()) {
- [Material](../material/material.md) - [Material](../material/material.md)
- [IResourceLoader](../iloader/iloader.md) - [IResourceLoader](../iloader/iloader.md)
- [ResourceManager](../resourcemanager/resourcemanager.md) - [ResourceManager](../resource-manager/resource-manager.md)

View File

@@ -56,4 +56,4 @@ if (result.IsSuccess()) {
- [Mesh](../mesh/mesh.md) - [Mesh](../mesh/mesh.md)
- [IResourceLoader](../iloader/iloader.md) - [IResourceLoader](../iloader/iloader.md)
- [ResourceManager](../resourcemanager/resourcemanager.md) - [ResourceManager](../resource-manager/resource-manager.md)

View File

@@ -89,6 +89,6 @@ void Example() {
## 相关文档 ## 相关文档
- [ResourceTypes](./resource-types.md) - [ResourceTypes](../resourcetypes/resourcetypes.md) - 资源类型定义
- [ResourceManager](../resource-manager/resource-manager.md) - [ResourceManager](../resource-manager/resource-manager.md) - 资源管理器
- [ResourcePool](./resource-pool.md) - [Resources 总览](../resources.md) - 返回模块总览

View File

@@ -113,7 +113,7 @@ ResourceManager::Get().RegisterLoader(new TextureLoader());
## 相关文档 ## 相关文档
- [ResourceManager](../resourcemanager/resourcemanager.md) - 资源管理器 - [ResourceManager](../resource-manager/resource-manager.md) - 资源管理器
- [AsyncLoader](../asyncloader/asyncloader.md) - 异步加载器 - [AsyncLoader](../asyncloader/asyncloader.md) - 异步加载器
- [ImportSettings](../importsettings/importsettings.md) - 导入设置 - [ImportSettings](../importsettings/importsettings.md) - 导入设置
- [Resources 总览](../resources.md) - 返回模块总览 - [Resources 总览](../resources.md) - 返回模块总览

View File

@@ -85,5 +85,5 @@ Containers::HashMap<ResourcePath, ResourceHandle<Texture>> textures;
## 相关文档 ## 相关文档
- [ResourceTypes](../resourcetypes/resourcetypes.md) - 资源类型定义 - [ResourceTypes](../resourcetypes/resourcetypes.md) - 资源类型定义
- [ResourceManager](../resourcemanager/resourcemanager.md) - 资源管理器 - [ResourceManager](../resource-manager/resource-manager.md) - 资源管理器
- [Resources 总览](../resources.md) - 返回模块总览 - [Resources 总览](../resources.md) - 返回模块总览

View File

@@ -56,4 +56,4 @@ if (result.IsSuccess()) {
- [Shader](../shader/shader.md) - [Shader](../shader/shader.md)
- [IResourceLoader](../iloader/iloader.md) - [IResourceLoader](../iloader/iloader.md)
- [ResourceManager](../resourcemanager/resourcemanager.md) - [ResourceManager](../resource-manager/resource-manager.md)

View File

@@ -114,6 +114,6 @@ ResourceHandle<Texture> tex = ResourceManager::Get().Load<Texture>("textures/dif
- [ImportSettings](../importsettings/importsettings.md) - 导入设置基类 - [ImportSettings](../importsettings/importsettings.md) - 导入设置基类
- [IResourceLoader](../iloader/iloader.md) - 资源加载器接口 - [IResourceLoader](../iloader/iloader.md) - 资源加载器接口
- [ResourceManager](../resourcemanager/resourcemanager.md) - 资源管理器 - [ResourceManager](../resource-manager/resource-manager.md) - 资源管理器
- [Texture](../texture/texture.md) - 纹理资源类 - [Texture](../texture/texture.md) - 纹理资源类
- [Resources 总览](../resources.md) - 资源模块总览 - [Resources 总览](../resources.md) - 资源模块总览

View File

@@ -154,6 +154,6 @@ auto format = tex.GetFormat();
## 相关文档 ## 相关文档
- [IResource](../iresource/iresource.md) - 资源基类 - [IResource](../iresource/iresource.md) - 资源基类
- [ResourceManager](../resourcemanager/resourcemanager.md) - 资源管理器 - [ResourceManager](../resource-manager/resource-manager.md) - 资源管理器
- [RHITexture](../../rhi/texture/texture.md) - RHI 纹理接口 - [RHITexture](../../rhi/texture/texture.md) - RHI 纹理接口
- [Resources 总览](../resources.md) - 返回模块总览 - [Resources 总览](../resources.md) - 返回模块总览

View File

@@ -25,7 +25,7 @@
| [`CreateSwapChain`](create-swap-chain.md) | 创建交换链 | | [`CreateSwapChain`](create-swap-chain.md) | 创建交换链 |
| [`CreateCommandList`](create-command-list.md) | 创建命令列表 | | [`CreateCommandList`](create-command-list.md) | 创建命令列表 |
| [`CreateCommandQueue`](create-command-queue.md) | 创建命令队列 | | [`CreateCommandQueue`](create-command-queue.md) | 创建命令队列 |
| [`CompileShader`](compile-shader.md) | 编译着色器 | | [`CreateShader`](create-shader.md) | 创建着色器 |
| [`CreatePipelineState`](create-pipeline-state.md) | 创建管线状态 | | [`CreatePipelineState`](create-pipeline-state.md) | 创建管线状态 |
| [`CreateFence`](create-fence.md) | 创建栅栏 | | [`CreateFence`](create-fence.md) | 创建栅栏 |
| [`CreateSampler`](create-sampler.md) | 创建采样器 | | [`CreateSampler`](create-sampler.md) | 创建采样器 |

View File

@@ -31,8 +31,6 @@
| [`GetFramebuffer`](get-framebuffer.md) | 获取帧缓冲 | | [`GetFramebuffer`](get-framebuffer.md) | 获取帧缓冲 |
| [`GetTexture`](get-texture.md) | 获取纹理 | | [`GetTexture`](get-texture.md) | 获取纹理 |
| [`GetMipLevel`](get-mip-level.md) | 获取 Mip 级别 | | [`GetMipLevel`](get-mip-level.md) | 获取 Mip 级别 |
| [`GetWidth`](get-size.md) | 获取宽度 |
| [`GetHeight`](get-size.md) | 获取高度 |
| [`BindFramebuffer`](bind-framebuffer.md) | 绑定帧缓冲 | | [`BindFramebuffer`](bind-framebuffer.md) | 绑定帧缓冲 |
| [`UnbindFramebuffer`](unbind-framebuffer.md) | 解绑帧缓冲 | | [`UnbindFramebuffer`](unbind-framebuffer.md) | 解绑帧缓冲 |

View File

@@ -4,26 +4,20 @@
**继承自**: `RHIDevice` **继承自**: `RHIDevice`
**描述**: OpenGL 设备的实现,基于 GLFW 和 Glad 提供 OpenGL 图形渲染能力。支持创建窗口、管理渲染资源、编译着色器等核心 RHI 功能。 **描述**: OpenGL 设备的实现,基于 Windows 原生窗口HWND和 Glad 提供 OpenGL 图形渲染能力。
## 概述 ## 概述
`OpenGLDevice` 是 XCEngine RHI 模块的 OpenGL 后端实现,通过 GLFW 管理窗口上下文,使用 Glad 加载 OpenGL 函数。它继承自抽象接口 `RHIDevice`,提供与具体图形 API 无关的统一接口。 `OpenGLDevice` 是 XCEngine RHI 模块的 OpenGL 后端实现,通过 Windows HWND 管理窗口上下文,使用 Glad 加载 OpenGL 函数。它继承自抽象接口 `RHIDevice`,提供与具体图形 API 无关的统一接口。
### 主要功能 ### 主要功能
- 基于 GLFW 的窗口管理和事件处理 - 基于 Windows HWND 的窗口管理和事件处理
- OpenGL 3.3 Core Profile 上下文初始化 - OpenGL 3.3 Core Profile 上下文初始化
- 使用 Glad 动态加载 OpenGL 函数 - 使用 Glad 动态加载 OpenGL 函数
- 设备能力查询和信息收集 - 设备能力查询和信息收集
- 渲染资源创建(缓冲区、纹理、着色器等) - 渲染资源创建(缓冲区、纹理、着色器等)
### 版本要求
- OpenGL 3.3 Core Profile
- GLFW 3.0+
- Glad OpenGL 3.3+
## 公共方法 ## 公共方法
| 方法 | 描述 | | 方法 | 描述 |
@@ -32,22 +26,15 @@
| [`~OpenGLDevice`](destructor.md) | 析构函数 | | [`~OpenGLDevice`](destructor.md) | 析构函数 |
| [`Initialize`](initialize.md) | 初始化设备 | | [`Initialize`](initialize.md) | 初始化设备 |
| [`Shutdown`](shutdown.md) | 关闭设备 | | [`Shutdown`](shutdown.md) | 关闭设备 |
| [`CreateRenderWindow`](create-render-window.md) | 创建渲染窗口 |
| [`InitializeWithExistingWindow`](initialize-with-existing-window.md) | 使用现有窗口初始化 | | [`InitializeWithExistingWindow`](initialize-with-existing-window.md) | 使用现有窗口初始化 |
| [`GetWindow`](get-window.md) | 获取 GLFW 窗口指针 | | [`MakeContextCurrent`](make-context-current.md) | 使 OpenGL 上下文为当前上下文 |
| [`GetDC`](get-dc.md) | 获取 Windows 设备上下文 | | [`GetNativeContext`](get-native-context.md) | 获取 OpenGL 渲染上下文句柄 |
| [`GetContext`](get-context.md) | 获取 OpenGL 渲染上下文 |
| [`GetDeviceInfoImpl`](get-device-info-impl.md) | 获取设备信息实现 |
| [`SwapBuffers`](swap-buffers.md) | 交换前后缓冲区 |
| [`PollEvents`](poll-events.md) | 处理窗口事件 |
| [`SetShouldClose`](set-should-close.md) | 设置关闭标志 |
| [`ShouldClose`](should-close.md) | 检查是否应关闭 |
| [`CreateBuffer`](create-buffer.md) | 创建缓冲区 | | [`CreateBuffer`](create-buffer.md) | 创建缓冲区 |
| [`CreateTexture`](create-texture.md) | 创建纹理 | | [`CreateTexture`](create-texture.md) | 创建纹理 |
| [`CreateSwapChain`](create-swap-chain.md) | 创建交换链 | | [`CreateSwapChain`](create-swap-chain.md) | 创建交换链 |
| [`CreateCommandList`](create-command-list.md) | 创建命令列表 | | [`CreateCommandList`](create-command-list.md) | 创建命令列表 |
| [`CreateCommandQueue`](create-command-queue.md) | 创建命令队列 | | [`CreateCommandQueue`](create-command-queue.md) | 创建命令队列 |
| [`CompileShader`](compile-shader.md) | 编译着色器 | | [`CreateShader`](create-shader.md) | 创建着色器 |
| [`CreatePipelineState`](create-pipeline-state.md) | 创建管线状态 | | [`CreatePipelineState`](create-pipeline-state.md) | 创建管线状态 |
| [`CreateFence`](create-fence.md) | 创建栅栏 | | [`CreateFence`](create-fence.md) | 创建栅栏 |
| [`CreateSampler`](create-sampler.md) | 创建采样器 | | [`CreateSampler`](create-sampler.md) | 创建采样器 |
@@ -76,25 +63,17 @@ if (!device.Initialize(desc)) {
} }
// 渲染循环 // 渲染循环
while (!device.ShouldClose()) { // (OpenGL 采用立即模式,渲染逻辑在主循环中执行)
device.PollEvents();
// 渲染逻辑
renderScene();
device.SwapBuffers();
}
// 清理 // 清理
device.Shutdown(); device.Shutdown();
``` ```
### 使用已有 GLFW 窗口 ### 使用已有 Windows 窗口
```cpp ```cpp
GLFWwindow* existingWindow = glfwCreateWindow(1280, 720, "My Window", nullptr, nullptr);
OpenGLDevice device; OpenGLDevice device;
HWND existingWindow = /* 获取 Windows 窗口句柄 */;
if (device.InitializeWithExistingWindow(existingWindow)) { if (device.InitializeWithExistingWindow(existingWindow)) {
// 使用已有窗口继续渲染 // 使用已有窗口继续渲染
} }

View File

@@ -20,7 +20,6 @@
| [`SetRasterizerState`](set-rasterizer-state.md) | 设置光栅化状态 | | [`SetRasterizerState`](set-rasterizer-state.md) | 设置光栅化状态 |
| [`SetViewport`](set-viewport.md) | 设置视口 | | [`SetViewport`](set-viewport.md) | 设置视口 |
| [`SetScissor`](set-scissor.md) | 设置裁剪 | | [`SetScissor`](set-scissor.md) | 设置裁剪 |
| [`SetLogicalOperation`](set-logical-operation.md) | 设置逻辑操作 |
| [`Apply`](apply.md) | 应用管线状态 | | [`Apply`](apply.md) | 应用管线状态 |
| [`ApplyDepthStencil`](apply-depth-stencil.md) | 应用深度模板状态 | | [`ApplyDepthStencil`](apply-depth-stencil.md) | 应用深度模板状态 |
| [`ApplyBlend`](apply-blend.md) | 应用混合状态 | | [`ApplyBlend`](apply-blend.md) | 应用混合状态 |

View File

@@ -24,23 +24,6 @@
| [`Bind`](../../shader/bind.md) | 绑定着色器 | | [`Bind`](../../shader/bind.md) | 绑定着色器 |
| [`Unbind`](../../shader/unbind.md) | 解绑着色器 | | [`Unbind`](../../shader/unbind.md) | 解绑着色器 |
### Uniform 设置方法
| 方法 | 描述 |
|------|------|
| [`SetInt`](../../shader/set-int.md) | 设置整数 uniform |
| [`SetIntArray`](set-int-array.md) | 设置整数数组 uniform |
| [`SetFloat`](../../shader/set-float.md) | 设置浮点数 uniform |
| [`SetFloatArray`](set-float-array.md) | 设置浮点数数组 uniform |
| [`SetVec3`](../../shader/set-vec3.md) | 设置 vec3 uniform (xyz分量) |
| [`SetVec3`](set-vec3-array.md) | 设置 vec3 uniform (数组) |
| [`SetVec4`](../../shader/set-vec4.md) | 设置 vec4 uniform (xyzw分量) |
| [`SetVec4`](set-vec4-array.md) | 设置 vec4 uniform (数组) |
| [`SetMat2`](set-mat2.md) | 设置 mat2 uniform |
| [`SetMat3`](set-mat3.md) | 设置 mat3 uniform |
| [`SetMat4`](../../shader/set-mat4.md) | 设置 mat4 uniform |
| [`SetMat4Array`](set-mat4-array.md) | 设置 mat4 数组 uniform |
### 查询方法 ### 查询方法
| 方法 | 描述 | | 方法 | 描述 |

View File

@@ -24,26 +24,14 @@
| [`OpenGLSwapChain`](constructor.md) | 构造函数 | | [`OpenGLSwapChain`](constructor.md) | 构造函数 |
| [`~OpenGLSwapChain`](destructor.md) | 析构函数 | | [`~OpenGLSwapChain`](destructor.md) | 析构函数 |
| [`Initialize`](initialize.md) | 初始化交换链 | | [`Initialize`](initialize.md) | 初始化交换链 |
| [`Initialize(mode)`](initialize-mode.md) | 使用模式初始化 |
| [`Shutdown`](shutdown.md) | 关闭交换链 | | [`Shutdown`](shutdown.md) | 关闭交换链 |
| [`Present`](present.md) | 呈现画面 | | [`Present`](present.md) | 呈现画面 |
| [`SwapBuffers`](swap-buffers.md) | 交换缓冲 | | [`SwapBuffers`](swap-buffers.md) | 交换缓冲 |
| [`Resize`](resize.md) | 调整交换链大小 | | [`Resize`](resize.md) | 调整交换链大小 |
| [`SetVSync`](set-vsync.md) | 设置垂直同步 |
| [`IsVSync`](is-vsync.md) | 检查是否垂直同步 |
| [`SetFullscreen`](set-fullscreen.md) | 设置全屏模式 |
| [`IsFullscreen`](is-fullscreen.md) | 检查是否全屏 |
| [`ShouldClose`](should-close.md) | 检查是否应关闭 |
| [`SetShouldClose`](set-should-close.md) | 设置关闭标志 |
| [`PollEvents`](poll-events.md) | 处理窗口事件 |
| [`GetCurrentBackBufferIndex`](get-current-back-buffer-index.md) | 获取当前后台缓冲区索引 | | [`GetCurrentBackBufferIndex`](get-current-back-buffer-index.md) | 获取当前后台缓冲区索引 |
| [`GetCurrentBackBuffer`](get-current-back-buffer.md) | 获取当前后台缓冲区 | | [`GetCurrentBackBuffer`](get-current-back-buffer.md) | 获取当前后台缓冲区 |
| [`GetWidth`](get-width.md) | 获取宽度 | | [`GetWidth`](get-width.md) | 获取宽度 |
| [`GetHeight`](get-height.md) | 获取高度 | | [`GetHeight`](get-height.md) | 获取高度 |
| [`GetFramebufferWidth`](get-framebuffer-width.md) | 获取帧缓冲宽度 |
| [`GetFramebufferHeight`](get-framebuffer-height.md) | 获取帧缓冲高度 |
| [`SetFramebufferSize`](set-framebuffer-size.md) | 设置帧缓冲大小 |
| [`GetWindow`](get-window.md) | 获取窗口 |
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 | | [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
## 使用示例 ## 使用示例
@@ -53,13 +41,12 @@
// 创建并初始化 // 创建并初始化
XCEngine::RHI::OpenGLSwapChain swapChain; XCEngine::RHI::OpenGLSwapChain swapChain;
GLFWwindow* window = /* 获取 GLFW 窗口 */; OpenGLDevice* device = /* 获取 OpenGLDevice */;
swapChain.Initialize(window, true); HWND window = /* 获取窗口句柄 */;
swapChain.Initialize(device, window, 1280, 720);
// 游戏循环 // 游戏循环
while (!swapChain.ShouldClose()) { while (true) {
swapChain.PollEvents();
// 渲染逻辑 // 渲染逻辑
Render(); Render();

View File

@@ -10,31 +10,22 @@
## 概述 ## 概述
`RHIShader` 是 XCEngine RHI 模块中的抽象着色器接口类,定义了 GPU 着色器程序的标准 API。该类是所有具体着色器实现如 D3D12Shader、VulkanShader 等)的基类,提供了统一的着色器编译、绑定和参数设置接口。 `RHIShader` 是 XCEngine RHI 模块中的抽象着色器接口类,定义了 GPU 着色器程序的标准 API。该类是所有具体着色器实现如 D3D12Shader、OpenGLShader 等)的基类,提供了统一的着色器编译和元数据查询接口。
设计目的: 设计目的:
- 提供跨平台的着色器抽象 - 提供跨平台的着色器抽象
- 统一着色器资源管理和绑定流程 - 统一着色器编译和资源管理
- 简化渲染管线中着色器的使用 - 简化渲染管线中着色器的使用
## 公共方法 ## 公共方法
| 方法 | 描述 | | 方法 | 描述 |
|------|------| |------|------|
| [`RHIShader`](constructor.md) | 默认构造函数 |
| [`~RHIShader`](destructor.md) | 虚析构函数 |
| [`CompileFromFile`](compile-from-file.md) | 从文件编译着色器 | | [`CompileFromFile`](compile-from-file.md) | 从文件编译着色器 |
| [`Compile`](compile.md) | 从内存数据编译着色器 | | [`Compile`](compile.md) | 从内存数据编译着色器 |
| [`GetType`](get-type.md) | 获取着色器类型 | | [`GetType`](get-type.md) | 获取着色器类型 |
| [`IsValid`](is-valid.md) | 检查着色器是否有效 | | [`IsValid`](is-valid.md) | 检查着色器是否有效 |
| [`Bind`](bind.md) | 绑定着色器到渲染管线 |
| [`Unbind`](unbind.md) | 解绑着色器 |
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 | | [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
| [`SetInt`](set-int.md) | 设置整数 uniform |
| [`SetFloat`](set-float.md) | 设置浮点数 uniform |
| [`SetVec3`](set-vec3.md) | 设置三维向量 uniform |
| [`SetVec4`](set-vec4.md) | 设置四维向量 uniform |
| [`SetMat4`](set-mat4.md) | 设置 4x4 矩阵 uniform |
| [`Shutdown`](shutdown.md) | 释放着色器资源 | | [`Shutdown`](shutdown.md) | 释放着色器资源 |
## 公共属性 ## 公共属性
@@ -67,22 +58,14 @@
using namespace XCEngine::RHI; using namespace XCEngine::RHI;
// 通过 RHIDevice 编译着色器 // 通过 RHIDevice 创建并编译着色器
ShaderCompileDesc vsDesc; ShaderCompileDesc vsDesc;
vsDesc.fileName = L"shaders/vertex.cso"; vsDesc.fileName = L"shaders/vertex.cso";
vsDesc.entryPoint = "VSMain"; vsDesc.entryPoint = "VSMain";
vsDesc.profile = "vs_5_0"; vsDesc.profile = "vs_5_0";
RHIShader* vertexShader = device->CompileShader(vsDesc); RHIShader* vertexShader = device->CreateShader(vsDesc);
if (vertexShader && vertexShader->IsValid()) { if (vertexShader && vertexShader->IsValid()) {
vertexShader->Bind();
// 设置 uniform 参数
float modelMatrix[16] = { /* 4x4 模型矩阵数据 */ };
vertexShader->SetMat4("u_modelMatrix", modelMatrix);
// 渲染... // 渲染...
vertexShader->Unbind();
} }
if (vertexShader) { if (vertexShader) {

View File

@@ -14,7 +14,6 @@
主要职责: 主要职责:
- 管理前后台缓冲区切换 - 管理前后台缓冲区切换
- 处理窗口全屏/窗口化模式切换
- 协调垂直同步呈现 - 协调垂直同步呈现
- 提供原生 API 句柄供高级用法 - 提供原生 API 句柄供高级用法
@@ -22,25 +21,17 @@
| 方法 | 描述 | | 方法 | 描述 |
|------|------| |------|------|
| [`RHISwapChain`](constructor.md) | 默认构造函数 |
| [`~RHISwapChain`](destructor.md) | 虚析构函数 | | [`~RHISwapChain`](destructor.md) | 虚析构函数 |
| [`Shutdown`](shutdown.md) | 关闭并释放资源 | | [`Shutdown`](shutdown.md) | 关闭并释放资源 |
| [`GetCurrentBackBufferIndex`](get-current-back-buffer-index.md) | 获取当前后台缓冲区索引 | | [`GetCurrentBackBufferIndex`](get-current-back-buffer-index.md) | 获取当前后台缓冲区索引 |
| [`GetCurrentBackBuffer`](get-current-back-buffer.md) | 获取当前后台缓冲区 | | [`GetCurrentBackBuffer`](get-current-back-buffer.md) | 获取当前后台缓冲区 |
| [`Present`](present.md) | 呈现画面 | | [`Present`](present.md) | 呈现画面 |
| [`Resize`](resize.md) | 调整交换链大小 | | [`Resize`](resize.md) | 调整交换链大小 |
| [`SetFullscreen`](set-fullscreen.md) | 设置全屏模式 |
| [`IsFullscreen`](is-fullscreen.md) | 检查是否全屏 |
| [`ShouldClose`](should-close.md) | 检查是否应关闭 |
| [`SetShouldClose`](set-should-close.md) | 设置关闭标志 |
| [`PollEvents`](poll-events.md) | 处理窗口事件 |
| [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 | | [`GetNativeHandle`](get-native-handle.md) | 获取原生句柄 |
## 使用示例 ## 使用示例
```cpp ```cpp
while (!swapChain->ShouldClose()) {
swapChain->PollEvents();
RHITexture* backBuffer = swapChain->GetCurrentBackBuffer(); RHITexture* backBuffer = swapChain->GetCurrentBackBuffer();
commandList->Reset(); commandList->Reset();
commandList->SetRenderTargets(1, &backBuffer, nullptr); commandList->SetRenderTargets(1, &backBuffer, nullptr);
@@ -48,7 +39,6 @@ while (!swapChain->ShouldClose()) {
commandList->Close(); commandList->Close();
commandQueue->ExecuteCommandLists(1, (void**)&commandList); commandQueue->ExecuteCommandLists(1, (void**)&commandList);
swapChain->Present(1, 0); swapChain->Present(1, 0);
}
``` ```
## 相关文档 ## 相关文档

View File

@@ -54,4 +54,4 @@ TaskSystem::Get().Submit([]() {
- [ITask](../task/task.md) - 任务基类 - [ITask](../task/task.md) - 任务基类
- [TaskGroup](../task-group/task-group.md) - 任务组 - [TaskGroup](../task-group/task-group.md) - 任务组
- [TaskSystem](../task-system/task-system.md) - 任务系统 - [TaskSystem](../task-system/task-system.md) - 任务系统
- [../threading/threading.md](../threading.md) - 模块总览 - [../threading.md](../threading.md) - 模块总览

View File

@@ -60,4 +60,4 @@ int main() {
- [SpinLock](../spinlock/spinlock.md) - 自旋锁 - [SpinLock](../spinlock/spinlock.md) - 自旋锁
- [ReadWriteLock](../read-write-lock/read-write-lock.md) - 读写锁 - [ReadWriteLock](../read-write-lock/read-write-lock.md) - 读写锁
- [TaskSystem](../task-system/task-system.md) - 任务系统 - [TaskSystem](../task-system/task-system.md) - 任务系统
- [../threading/threading.md](../threading.md) - 模块总览 - [../threading.md](../threading.md) - 模块总览

View File

@@ -33,4 +33,4 @@ TaskSystem::Get().Initialize(config);
## 相关文档 ## 相关文档
- [TaskSystem](../task-system/task-system.md) - 任务系统 - [TaskSystem](../task-system/task-system.md) - 任务系统
- [../threading/threading.md](../threading.md) - 模块总览 - [../threading.md](../threading.md) - 模块总览

View File

@@ -78,4 +78,4 @@ TaskSystem::Get().Shutdown();
- [LambdaTask](../lambda-task/lambda-task.md) - Lambda 任务 - [LambdaTask](../lambda-task/lambda-task.md) - Lambda 任务
- [TaskGroup](../task-group/task-group.md) - 任务组 - [TaskGroup](../task-group/task-group.md) - 任务组
- [TaskSystemConfig](../task-system-config/task-system-config.md) - 配置 - [TaskSystemConfig](../task-system-config/task-system-config.md) - 配置
- [../threading/threading.md](../threading.md) - 模块总览 - [../threading.md](../threading.md) - 模块总览

View File

@@ -90,4 +90,4 @@ TaskSystem::Get().Submit(std::unique_ptr<ITask>(task));
- [LambdaTask](../lambda-task/lambda-task.md) - Lambda 任务封装 - [LambdaTask](../lambda-task/lambda-task.md) - Lambda 任务封装
- [TaskGroup](../task-group/task-group.md) - 任务组 - [TaskGroup](../task-group/task-group.md) - 任务组
- [TaskSystem](../task-system/task-system.md) - 任务系统 - [TaskSystem](../task-system/task-system.md) - 任务系统
- [../threading/threading.md](../threading.md) - 模块总览 - [../threading.md](../threading.md) - 模块总览