summaryrefslogtreecommitdiff
path: root/Runtime/Graphics/VertexAttribute.h
diff options
context:
space:
mode:
Diffstat (limited to 'Runtime/Graphics/VertexAttribute.h')
-rw-r--r--Runtime/Graphics/VertexAttribute.h18
1 files changed, 17 insertions, 1 deletions
diff --git a/Runtime/Graphics/VertexAttribute.h b/Runtime/Graphics/VertexAttribute.h
index 2e6e59f..4e50a1a 100644
--- a/Runtime/Graphics/VertexAttribute.h
+++ b/Runtime/Graphics/VertexAttribute.h
@@ -21,10 +21,26 @@ enum VertexAttrFormat
struct VertexAttributeDescriptor
{
- const void* pointer; // 内存地址或显存中相对VBO的偏移值
+ // for default vertex layout
+ VertexAttributeDescriptor() {}
+ // for custom vertex layout
+ VertexAttributeDescriptor(int startOff, uint num, uint fmt, uint16 strd, bool normalized = false)
+ {
+ startOffset = startOff;
+ componentNum = num;
+ componentFormat = fmt;
+ stride = strd;
+ normalize = normalized;
+ }
+
+ union {
+ const void* pointer; // 内存地址或显存中相对VBO的偏移值
+ int startOffset;
+ };
uint componentNum; // 向量维度1,2,3,4
uint componentFormat; // 每个分量的类型
uint16 stride; // 间隔
+ bool normalize; // 是否归一化,只用于CustomVertexLayout
};
namespace VertexAttribute