diff options
author | chai <chaifix@163.com> | 2019-12-04 00:07:32 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-12-04 00:07:32 +0800 |
commit | 2e82e2ddd0852b8063a3d6645366f53ee844e273 (patch) | |
tree | 41ec10760f2d2c9f1f782a918f48e1287da2a4b4 /src/core/vert.h |
+init
Diffstat (limited to 'src/core/vert.h')
-rw-r--r-- | src/core/vert.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/core/vert.h b/src/core/vert.h new file mode 100644 index 0000000..a2fdb74 --- /dev/null +++ b/src/core/vert.h @@ -0,0 +1,48 @@ +#ifndef _SOFTSHADEROOM_VERT_H_ +#define _SOFTSHADEROOM_VERT_H_ + +#include "mem.h" +#include "color.h" +#include "../math/math.h" +#include "../util/type.h" +#include "../util/assert.h" + +//typedef uint Color; // ARGB by default + +typedef uint Color; // ARGB by default + +#define COLOR_A(c) ((c >> 24) & 0xff) +#define COLOR_R(c) ((c >> 16) & 0xff) +#define COLOR_G(c) ((c >> 8) & 0xff) +#define COLOR_B(c) (c & 0xff) + +typedef Vec4 Color32; // 4个float的颜色 + +Color color32_tocolor(Color32* c); +void color_tocolor32(Color c, Color32* out); +void color32_saturate(Color32* c); + +enum VertMask { + VERTMASK_POSITION = 1 , + VERTMASK_NORMAL = 1 << 1, + VERTMASK_COLOR = 1 << 2, + VERTMASK_TANGENT = 1 << 3, + VERTMASK_UV = 1 << 4, +}; + +/*标准的顶点结构,禁止修改*/ +typedef struct Vert { + uint index; + uint comp; + Vec3* position; + Vec3* normal; + Vec3* tangent; + Vec2* uv; + Color color; +} Vert; + +Vert* vert_new(uint comp); /*新建vert*/ +void vert_init(Vert* v, uint comp); /*如果某些component没创建,创建它*/ +void vert_free(Vert* v); /*释放vert*/ + +#endif
\ No newline at end of file |