docs: update resources API docs
This commit is contained in:
59
docs/api/resources/mesh-loader/index.md
Normal file
59
docs/api/resources/mesh-loader/index.md
Normal file
@@ -0,0 +1,59 @@
|
||||
# MeshLoader
|
||||
|
||||
## 命名空间
|
||||
|
||||
`XCEngine::Resources`
|
||||
|
||||
## 类型
|
||||
|
||||
类 (Class)
|
||||
|
||||
## 描述
|
||||
|
||||
网格资源加载器,负责从磁盘加载 `.fbx`、`.obj`、`.gltf`、`.glb`、`.dae` 和 `.stl` 格式的网格资源文件。
|
||||
|
||||
## 概述
|
||||
|
||||
`MeshLoader` 继承自 `IResourceLoader`,实现了网格资源的加载功能。它支持多种主流 3D 模型文件格式,能够读取文件数据并创建 `Mesh` 对象。加载过程中会提取资源的基本信息(路径、名称、GUID)并设置内存占用。当前实现专注于文件读取和基础资源创建,具体网格数据解析由 `Mesh` 类完成。
|
||||
|
||||
## 公共方法
|
||||
|
||||
| 方法 | 签名 | 描述 |
|
||||
|------|------|------|
|
||||
| [MeshLoader](methods/constructor.md) | `MeshLoader()` | 默认构造函数 |
|
||||
| [~MeshLoader](methods/destructor.md) | `virtual ~MeshLoader()` | 析构函数 |
|
||||
| [GetResourceType](methods/get-resource-type.md) | `ResourceType GetResourceType() const` | 返回资源类型为 Mesh |
|
||||
| [GetSupportedExtensions](methods/get-supported-extensions.md) | `Array<String> GetSupportedExtensions() const` | 返回支持的扩展名列表 |
|
||||
| [CanLoad](methods/can-load.md) | `bool CanLoad(const String& path) const` | 检查给定路径是否可被加载 |
|
||||
| [Load](methods/load.md) | `LoadResult Load(const String& path, const ImportSettings* settings = nullptr)` | 加载指定路径的网格资源 |
|
||||
| [GetDefaultSettings](methods/get-default-settings.md) | `ImportSettings* GetDefaultSettings() const` | 返回默认导入设置 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
#include "Resources/MeshLoader.h"
|
||||
#include "Resources/ResourceManager.h"
|
||||
|
||||
using namespace XCEngine::Resources;
|
||||
|
||||
// 通过 ResourceManager 加载网格
|
||||
auto meshHandle = ResourceManager::Get().Load<Mesh>("assets/models/player.fbx");
|
||||
if (meshHandle.IsValid()) {
|
||||
Mesh* mesh = meshHandle.Get();
|
||||
// 使用网格...
|
||||
}
|
||||
|
||||
// 直接使用 MeshLoader
|
||||
MeshLoader loader;
|
||||
LoadResult result = loader.Load("assets/models/player.obj");
|
||||
if (result.IsSuccess()) {
|
||||
Mesh* mesh = static_cast<Mesh*>(result.GetResource());
|
||||
// 使用网格...
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Mesh](../mesh/mesh.md)
|
||||
- [IResourceLoader](../iloader/iloader.md)
|
||||
- [ResourceManager](../resourcemanager/resourcemanager.md)
|
||||
Reference in New Issue
Block a user