summaryrefslogtreecommitdiff
path: root/include/render/mesh.h
blob: bf8c1ee1de1261792ac7749d26f68bde99181eb2 (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
#ifndef _RENDER_MESH_H_
#define _RENDER_MESH_H_

#include <vulkan/vulkan.h>
#include <stdint.h>
#include "render/buffer.h"

#include "linmath.h"

struct renderer;

struct vec3 {
	float x, y, z;
};

struct vec4 {
	float x, y, z, w;
};

struct ubo {
	mat4x4 model;
	mat4x4 view;
	mat4x4 proj;
	uint32_t max_frags;
};

struct vertex {
	struct vec3 position;
	struct vec3 normal;
	struct vec4 color;
};

struct mesh {
	struct buffer vertex;
	struct buffer index;
	mat4x4 position;
	size_t index_count;
};

struct mesh upload_mesh(struct renderer *ren, size_t vertex_count, struct vertex vertices[vertex_count],
		size_t index_count, uint32_t indices[index_count], struct vec3 position);
void mesh_destroy(struct renderer *ren, struct mesh *mesh);

#endif