Files
XCEngine/docs/api/resources/shader/addattribute.md

32 lines
489 B
Markdown

# Shader::AddAttribute
```cpp
void AddAttribute(const ShaderAttribute& attribute)
```
添加顶点属性描述。
**参数:**
- `attribute` - 属性描述结构体
**返回:**
**线程安全:** ❌ 非线程安全
**复杂度:** Amortized O(1)
**示例:**
```cpp
ShaderAttribute attr;
attr.name = "position";
attr.location = 0;
attr.size = sizeof(float) * 3;
attr.type = 0;
vs->AddAttribute(attr);
```
## 相关文档
- [Shader 总览](shader.md) - 返回类总览