blob: a2fdb74582496b1f5d7f1b27c3d3b18a2df149a4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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
|