docs: update resources API docs
This commit is contained in:
41
docs/api/resources/mesh/get-guid.md
Normal file
41
docs/api/resources/mesh/get-guid.md
Normal file
@@ -0,0 +1,41 @@
|
||||
# Mesh::GetGUID
|
||||
|
||||
```cpp
|
||||
ResourceGUID GetGUID() const override;
|
||||
```
|
||||
|
||||
返回网格资源的全局唯一标识符(GUID)。GUID 在资源创建时分配,用于资源系统的唯一标识和查找。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** `ResourceGUID` - 资源的全局唯一标识符
|
||||
|
||||
**异常:** 无
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**复杂度:** O(1)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
#include "XCEngine/Resources/Mesh.h"
|
||||
|
||||
using namespace XCEngine::Resources;
|
||||
|
||||
Mesh mesh;
|
||||
IResource::ConstructParams params;
|
||||
params.name = "Character_Hero";
|
||||
params.path = "assets/meshes/hero.mesh";
|
||||
params.guid = ResourceGUID::Generate(params.path);
|
||||
mesh.Initialize(params);
|
||||
|
||||
ResourceGUID guid = mesh.GetGUID();
|
||||
if (guid.IsValid()) {
|
||||
// GUID 有效
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [类总览](mesh.md) - 返回类总览
|
||||
Reference in New Issue
Block a user