From 1b6f71b2777bdc74d63f988346a8cfee766718b0 Mon Sep 17 00:00:00 2001 From: chai Date: Thu, 28 Oct 2021 00:47:35 +0800 Subject: +DefaultVertexLayout --- Runtime/Graphics/VertexAttribute.h | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Runtime/Graphics/VertexAttribute.h (limited to 'Runtime/Graphics/VertexAttribute.h') diff --git a/Runtime/Graphics/VertexAttribute.h b/Runtime/Graphics/VertexAttribute.h new file mode 100644 index 0000000..2e6e59f --- /dev/null +++ b/Runtime/Graphics/VertexAttribute.h @@ -0,0 +1,35 @@ +#pragma once + +#include + +#include "../Utilities/UtilMacros.h" +#include "../Shaders/ShaderChannel.h" + +#include "OpenGL.h" +#include "GPUDataBuffer.h" + +// component format +enum VertexAttrFormat +{ + VertexAttrFormat_Float = 0, // position\normal\tangent\uv\uv2\uv3\uv4 + VertexAttrFormat_Float16 = 1, + VertexAttrFormat_Color = 2, // color + VertexAttrFormat_Byte = 3, + + VertexAttrFormat_Count = 4 +}; + +struct VertexAttributeDescriptor +{ + const void* pointer; // 内存地址或显存中相对VBO的偏移值 + uint componentNum; // 向量维度1,2,3,4 + uint componentFormat; // 每个分量的类型 + uint16 stride; // 间隔 +}; + +namespace VertexAttribute +{ + + extern GLenum ConvertAttrFormatToGLFormat(uint fmt); + +} -- cgit v1.1-26-g67d0