docs: update resources API docs
This commit is contained in:
@@ -6,32 +6,39 @@ bool Create(Core::uint32 width, Core::uint32 height, Core::uint32 depth,
|
||||
const void* data, size_t dataSize)
|
||||
```
|
||||
|
||||
创建纹理资源。设置纹理的尺寸、格式和像素数据,并分配 GPU 资源。
|
||||
创建纹理资源。设置纹理的尺寸、格式和像素数据。
|
||||
|
||||
**参数:**
|
||||
- `width` - 纹理宽度(像素)
|
||||
- `height` - 纹理高度(像素)
|
||||
- `depth` - 纹理深度(3D 纹理设为 1)
|
||||
- `mipLevels` - Mipmap 级别数
|
||||
- `type` - 纹理类型
|
||||
- `format` - 纹理格式
|
||||
- `data` - 像素数据指针
|
||||
- `dataSize` - 像素数据大小
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `width` | `Core::uint32` | 纹理宽度(像素) |
|
||||
| `height` | `Core::uint32` | 纹理高度(像素) |
|
||||
| `depth` | `Core::uint32` | 纹理深度(3D 纹理设为 1) |
|
||||
| `mipLevels` | `Core::uint32` | Mipmap 级别数 |
|
||||
| `type` | `TextureType` | 纹理类型 |
|
||||
| `format` | `TextureFormat` | 纹理格式 |
|
||||
| `data` | `const void*` | 像素数据指针(可为 nullptr) |
|
||||
| `dataSize` | `size_t` | 像素数据大小 |
|
||||
|
||||
**返回:** 创建成功返回 true
|
||||
|
||||
**复杂度:** O(n),n 为像素数量
|
||||
**复杂度:** O(n),n 为像素数据大小
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
bool ok = tex.Create(
|
||||
1024, 1024, 1, 0,
|
||||
1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
pixelData, pixelDataSize
|
||||
);
|
||||
|
||||
if (ok) {
|
||||
// 纹理创建成功
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
@@ -8,15 +8,18 @@ bool GenerateMipmaps()
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 生成成功返回 true
|
||||
**返回:** 生成成功返回 true;当前始终返回 false(stub 实现)
|
||||
|
||||
**复杂度:** O(n)
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1, TextureType::Texture2D, TextureFormat::RGBA8_UNORM, data, size);
|
||||
tex.GenerateMipmaps();
|
||||
|
||||
// 注意:当前实现返回 false,Mipmap 生成功能尚未完成
|
||||
bool success = tex.GenerateMipmaps();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
36
docs/api/resources/texture/getarraysize.md
Normal file
36
docs/api/resources/texture/getarraysize.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Texture::GetArraySize
|
||||
|
||||
```cpp
|
||||
Core::uint32 GetArraySize() const
|
||||
```
|
||||
|
||||
获取纹理数组大小。对于非数组纹理返回 1。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 纹理数组大小
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
Core::uint32 arraySize = tex.GetArraySize(); // 返回 1
|
||||
|
||||
Texture texArray;
|
||||
texArray.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2DArray,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
Core::uint32 arraySizeArray = texArray.GetArraySize(); // 返回数组长度
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [GetTextureType](gettexturetype.md) - 获取纹理类型
|
||||
37
docs/api/resources/texture/getdepth.md
Normal file
37
docs/api/resources/texture/getdepth.md
Normal file
@@ -0,0 +1,37 @@
|
||||
# Texture::GetDepth
|
||||
|
||||
```cpp
|
||||
Core::uint32 GetDepth() const
|
||||
```
|
||||
|
||||
获取纹理深度。对于 3D 纹理返回体积深度,对于 2D 纹理返回 1。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 纹理深度(像素)
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex2D;
|
||||
tex2D.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
Core::uint32 depth2D = tex2D.GetDepth(); // 返回 1
|
||||
|
||||
Texture tex3D;
|
||||
tex3D.Create(64, 64, 32, 1,
|
||||
TextureType::Texture3D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
Core::uint32 depth3D = tex3D.GetDepth(); // 返回 32
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [GetWidth](getwidth.md) - 获取纹理宽度
|
||||
- [GetHeight](getheight.md) - 获取纹理高度
|
||||
29
docs/api/resources/texture/getformat.md
Normal file
29
docs/api/resources/texture/getformat.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Texture::GetFormat
|
||||
|
||||
```cpp
|
||||
TextureFormat GetFormat() const
|
||||
```
|
||||
|
||||
获取纹理像素格式。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** `TextureFormat` 枚举值
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
TextureFormat format = tex.GetFormat(); // 返回 TextureFormat::RGBA8_UNORM
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [TextureFormat 枚举](./texture.md#textureformat) - 格式枚举说明
|
||||
30
docs/api/resources/texture/getheight.md
Normal file
30
docs/api/resources/texture/getheight.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Texture::GetHeight
|
||||
|
||||
```cpp
|
||||
Core::uint32 GetHeight() const
|
||||
```
|
||||
|
||||
获取纹理高度。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 纹理高度(像素)
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
tex.Create(1024, 512, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
|
||||
Core::uint32 height = tex.GetHeight(); // 返回 512
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [GetWidth](getwidth.md) - 获取纹理宽度
|
||||
32
docs/api/resources/texture/getmiplevels.md
Normal file
32
docs/api/resources/texture/getmiplevels.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Texture::GetMipLevels
|
||||
|
||||
```cpp
|
||||
Core::uint32 GetMipLevels() const
|
||||
```
|
||||
|
||||
获取 Mipmap 级别数。Mipmap 是纹理的多级渐远表示,用于在不同距离时提供合适的细节级别。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** Mipmap 级别数
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
Core::uint32 mips = tex.GetMipLevels(); // 返回 1
|
||||
|
||||
tex.GenerateMipmaps(); // 如果实现生成多级 mipmap
|
||||
Core::uint32 mipsAfter = tex.GetMipLevels(); // 可能返回 > 1
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [GenerateMipmaps](generatemipmaps.md) - 生成 Mipmap 链
|
||||
36
docs/api/resources/texture/getpixeldata.md
Normal file
36
docs/api/resources/texture/getpixeldata.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# Texture::GetPixelData
|
||||
|
||||
```cpp
|
||||
const void* GetPixelData() const
|
||||
```
|
||||
|
||||
获取纹理像素数据指针。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 像素数据指针,如果纹理未创建或无效返回 `nullptr`
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
// 假设已有像素数据
|
||||
std::vector<uint8_t> pixels(1024 * 1024 * 4, 255);
|
||||
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
pixels.data(), pixels.size());
|
||||
|
||||
const void* data = tex.GetPixelData();
|
||||
if (data != nullptr) {
|
||||
// 可以读取像素数据
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [GetPixelDataSize](getpixeldatasize.md) - 获取像素数据大小
|
||||
32
docs/api/resources/texture/getpixeldatasize.md
Normal file
32
docs/api/resources/texture/getpixeldatasize.md
Normal file
@@ -0,0 +1,32 @@
|
||||
# Texture::GetPixelDataSize
|
||||
|
||||
```cpp
|
||||
size_t GetPixelDataSize() const
|
||||
```
|
||||
|
||||
获取纹理像素数据大小(字节)。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 像素数据大小(字节)
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
std::vector<uint8_t> pixels(1024 * 1024 * 4, 255);
|
||||
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
pixels.data(), pixels.size());
|
||||
|
||||
size_t size = tex.GetPixelDataSize(); // 返回 4194304 (1024*1024*4)
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [GetPixelData](getpixeldata.md) - 获取像素数据指针
|
||||
29
docs/api/resources/texture/gettexturetype.md
Normal file
29
docs/api/resources/texture/gettexturetype.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Texture::GetTextureType
|
||||
|
||||
```cpp
|
||||
TextureType GetTextureType() const
|
||||
```
|
||||
|
||||
获取纹理类型。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** `TextureType` 枚举值
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
TextureType type = tex.GetTextureType(); // 返回 TextureType::Texture2D
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [GetArraySize](getarraysize.md) - 获取数组大小
|
||||
29
docs/api/resources/texture/getusage.md
Normal file
29
docs/api/resources/texture/getusage.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Texture::GetUsage
|
||||
|
||||
```cpp
|
||||
TextureUsage GetUsage() const
|
||||
```
|
||||
|
||||
获取纹理用途标志。用途标志可组合使用。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** `TextureUsage` 枚举值
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
TextureUsage usage = tex.GetUsage(); // 返回 TextureUsage::ShaderResource
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [TextureUsage 枚举](./texture.md#textureusage) - 用途枚举说明
|
||||
30
docs/api/resources/texture/getwidth.md
Normal file
30
docs/api/resources/texture/getwidth.md
Normal file
@@ -0,0 +1,30 @@
|
||||
# Texture::GetWidth
|
||||
|
||||
```cpp
|
||||
Core::uint32 GetWidth() const
|
||||
```
|
||||
|
||||
获取纹理宽度。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 纹理宽度(像素)
|
||||
|
||||
**线程安全:** ✅
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
tex.Create(1024, 512, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
|
||||
Core::uint32 width = tex.GetWidth(); // 返回 1024
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [GetHeight](getheight.md) - 获取纹理高度
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
**命名空间**: `XCEngine::Resources`
|
||||
|
||||
**类型**: `class`
|
||||
**类型**: `class` (inherits from `IResource`)
|
||||
|
||||
**头文件**: `XCEngine/Resources/Texture.h`
|
||||
|
||||
**描述**: 纹理资源类,管理 2D/3D 纹理和立方体贴图的像素数据。
|
||||
|
||||
@@ -79,74 +81,74 @@
|
||||
|
||||
## 公共方法
|
||||
|
||||
### 基础属性
|
||||
### 构造与析构
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| `ResourceType GetType() const` | 返回 `ResourceType::Texture` |
|
||||
| `const Containers::String& GetName() const` | 获取纹理名称 |
|
||||
| `const Containers::String& GetPath() const` | 获取纹理路径 |
|
||||
| `ResourceGUID GetGUID() const` | 获取全局唯一标识符 |
|
||||
| `bool IsValid() const` | 检查纹理是否有效 |
|
||||
| `size_t GetMemorySize() const` | 获取内存大小 |
|
||||
| `void Release()` | 释放纹理引用 |
|
||||
| [`Texture`](texture_constructor.md) | 默认构造函数 |
|
||||
| [`~Texture`](texture_destructor.md) | 析构函数 |
|
||||
|
||||
### IResource 实现
|
||||
|
||||
继承自 `IResource` 接口。
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| [`GetType`](../iresource/gettype.md) | 返回 `ResourceType::Texture` |
|
||||
| [`GetName`](../iresource/getname.md) | 获取纹理名称 |
|
||||
| [`GetPath`](../iresource/getpath.md) | 获取纹理路径 |
|
||||
| [`GetGUID`](../iresource/getguid.md) | 获取全局唯一标识符 |
|
||||
| [`IsValid`](../iresource/isvalid.md) | 检查纹理是否有效 |
|
||||
| [`GetMemorySize`](../iresource/getmemorysize.md) | 获取内存大小 |
|
||||
| [`Release`](../iresource/release.md) | 释放纹理引用 |
|
||||
|
||||
### 纹理属性
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| `Core::uint32 GetWidth() const` | 获取纹理宽度(像素) |
|
||||
| `Core::uint32 GetHeight() const` | 获取纹理高度(像素) |
|
||||
| `Core::uint32 GetDepth() const` | 获取纹理深度(3D 纹理) |
|
||||
| `Core::uint32 GetMipLevels() const` | 获取 Mipmap 级别数 |
|
||||
| `Core::uint32 GetArraySize() const` | 获取数组大小 |
|
||||
| `TextureType GetTextureType() const` | 获取纹理类型 |
|
||||
| `TextureFormat GetFormat() const` | 获取纹理格式 |
|
||||
| `TextureUsage GetUsage() const` | 获取纹理用途标志 |
|
||||
| [`GetWidth`](getwidth.md) | 获取纹理宽度(像素) |
|
||||
| [`GetHeight`](getheight.md) | 获取纹理高度(像素) |
|
||||
| [`GetDepth`](getdepth.md) | 获取纹理深度(3D 纹理) |
|
||||
| [`GetMipLevels`](getmiplevels.md) | 获取 Mipmap 级别数 |
|
||||
| [`GetArraySize`](getarraysize.md) | 获取数组大小 |
|
||||
| [`GetTextureType`](gettexturetype.md) | 获取纹理类型 |
|
||||
| [`GetFormat`](getformat.md) | 获取纹理格式 |
|
||||
| [`GetUsage`](getusage.md) | 获取纹理用途标志 |
|
||||
|
||||
### 像素数据
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| `const void* GetPixelData() const` | 获取像素数据指针 |
|
||||
| `size_t GetPixelDataSize() const` | 获取像素数据大小 |
|
||||
| [`GetPixelData`](getpixeldata.md) | 获取像素数据指针 |
|
||||
| [`GetPixelDataSize`](getpixeldatasize.md) | 获取像素数据大小 |
|
||||
|
||||
### 创建与操作
|
||||
|
||||
| 方法 | 描述 |
|
||||
|------|------|
|
||||
| `bool Create(Core::uint32 width, Core::uint32 height, Core::uint32 depth, Core::uint32 mipLevels, TextureType type, TextureFormat format, const void* data, size_t dataSize)` | 创建纹理 |
|
||||
| `bool GenerateMipmaps()` | 生成 Mipmap(当前返回 false - stub) |
|
||||
|
||||
## 实现说明
|
||||
|
||||
**注意**: `Create()` 方法中 `mipLevels` 参数为 0 时不会自动计算所有级别。`GenerateMipmaps()` 当前返回 false,为 stub 实现。
|
||||
| [`Create`](create.md) | 创建纹理 |
|
||||
| [`GenerateMipmaps`](generatemipmaps.md) | 生成 Mipmap 链 |
|
||||
|
||||
## 使用示例
|
||||
|
||||
```cpp
|
||||
// 加载纹理
|
||||
ResourceHandle<Texture> tex = ResourceManager::Get().Load<Texture>("textures/player.png");
|
||||
|
||||
// 手动创建纹理
|
||||
Texture tex;
|
||||
bool created = tex.Create(
|
||||
1024, // 宽度
|
||||
1024, // 高度
|
||||
1, // 深度
|
||||
0, // Mipmap 级别(0=全部)
|
||||
TextureType::Texture2D, // 类型
|
||||
TextureFormat::RGBA8_UNORM, // 格式
|
||||
1, // Mipmap 级别数
|
||||
TextureType::Texture2D, // 类型
|
||||
TextureFormat::RGBA8_UNORM, // 格式
|
||||
pixelData, // 像素数据
|
||||
pixelDataSize // 数据大小
|
||||
);
|
||||
|
||||
// 生成 Mipmap
|
||||
tex.GenerateMipmaps();
|
||||
|
||||
// 访问纹理属性
|
||||
uint32_t w = tex.GetWidth();
|
||||
uint32_t h = tex.GetHeight();
|
||||
auto format = tex.GetFormat();
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
@@ -154,8 +156,4 @@ uint32_t h = tex.GetHeight();
|
||||
- [IResource](../iresource/iresource.md) - 资源基类
|
||||
- [ResourceManager](../resourcemanager/resourcemanager.md) - 资源管理器
|
||||
- [RHITexture](../../rhi/texture/texture.md) - RHI 纹理接口
|
||||
- [Resources 总览](../resources.md) - 返回模块总览
|
||||
|
||||
## 实现说明
|
||||
|
||||
**注意**: `TextureLoader::Load()` 仅为示例实现,不解析 PNG/JPG 等格式的实际图像数据,仅创建空纹理对象。
|
||||
- [Resources 总览](../resources.md) - 返回模块总览
|
||||
29
docs/api/resources/texture/texture_constructor.md
Normal file
29
docs/api/resources/texture/texture_constructor.md
Normal file
@@ -0,0 +1,29 @@
|
||||
# Texture::Texture
|
||||
|
||||
```cpp
|
||||
Texture()
|
||||
```
|
||||
|
||||
默认构造函数。创建一个无效的 Texture 对象,需要调用 `Create` 方法进行初始化。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
Texture tex;
|
||||
// tex 此时无效,需要调用 Create 方法
|
||||
bool ok = tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [Create](create.md) - 创建纹理方法
|
||||
31
docs/api/resources/texture/texture_destructor.md
Normal file
31
docs/api/resources/texture/texture_destructor.md
Normal file
@@ -0,0 +1,31 @@
|
||||
# Texture::~Texture
|
||||
|
||||
```cpp
|
||||
virtual ~Texture()
|
||||
```
|
||||
|
||||
析构函数。释放纹理占用的资源。
|
||||
|
||||
**参数:** 无
|
||||
|
||||
**返回:** 无
|
||||
|
||||
**线程安全:** ❌
|
||||
|
||||
**示例:**
|
||||
|
||||
```cpp
|
||||
{
|
||||
Texture tex;
|
||||
tex.Create(1024, 1024, 1, 1,
|
||||
TextureType::Texture2D,
|
||||
TextureFormat::RGBA8_UNORM,
|
||||
nullptr, 0);
|
||||
// tex 超出作用域时自动调用析构函数释放资源
|
||||
}
|
||||
```
|
||||
|
||||
## 相关文档
|
||||
|
||||
- [Texture 总览](texture.md) - 返回类总览
|
||||
- [Release](../iresource/release.md) - 手动释放资源方法
|
||||
Reference in New Issue
Block a user