fix: encapsulate OpenGL types in VertexAttribute to eliminate raw GL API usage in tests
- Add VertexAttributeType and VertexAttributeNormalized enums in OpenGLVertexArray.h - Add ToGLAttributeType() converter in OpenGLVertexArray.cpp - Remove glActiveTexture() call from quad test (already handled by texture.Bind()) - Remove #include <glad/glad.h> from triangle test - Update unit tests to use encapsulated enums All three OpenGL integration tests (minimal, triangle, quad) pass with 0% pixel difference.
This commit is contained in:
36
docs/api/resources/audio-loader/can-load.md
Normal file
36
docs/api/resources/audio-loader/can-load.md
Normal file
@@ -0,0 +1,36 @@
|
||||
# AudioLoader::CanLoad
|
||||
|
||||
## 方法签名
|
||||
|
||||
```cpp
|
||||
bool CanLoad(const Containers::String& path) const override;
|
||||
```
|
||||
|
||||
## 详细描述
|
||||
|
||||
根据文件扩展名判断此加载器是否能处理指定路径的资源。检测时先提取路径扩展名(小写),再与支持列表逐一比对。
|
||||
|
||||
## 参数
|
||||
|
||||
| 参数 | 类型 | 描述 |
|
||||
|------|------|------|
|
||||
| `path` | `const Containers::String&` | 资源文件的完整或相对路径 |
|
||||
|
||||
## 返回值
|
||||
|
||||
`bool` - 如果扩展名在支持列表中返回 `true`,否则返回 `false`。
|
||||
|
||||
## 示例
|
||||
|
||||
```cpp
|
||||
AudioLoader loader;
|
||||
|
||||
// 正确识别支持的格式
|
||||
bool canLoad1 = loader.CanLoad("assets/audio/bgm.ogg"); // true
|
||||
bool canLoad2 = loader.CanLoad("sound_effect.wav"); // true
|
||||
bool canLoad3 = loader.CanLoad("music.mp3"); // true
|
||||
|
||||
// 识别不支持的格式
|
||||
bool canLoad4 = loader.CanLoad("video.avi"); // false
|
||||
bool canLoad5 = loader.CanLoad("document.pdf"); // false
|
||||
```
|
||||
Reference in New Issue
Block a user