30 lines
438 B
Markdown
30 lines
438 B
Markdown
|
|
# Shader::AddAttribute
|
||
|
|
|
||
|
|
```cpp
|
||
|
|
void AddAttribute(const ShaderAttribute& attribute)
|
||
|
|
```
|
||
|
|
|
||
|
|
添加顶点属性描述。
|
||
|
|
|
||
|
|
**参数:**
|
||
|
|
- `attribute` - 属性描述结构体
|
||
|
|
|
||
|
|
**返回:** 无
|
||
|
|
|
||
|
|
**复杂度:** 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) - 返回类总览
|