blob: 64288ad3a17d8bc5517a95b14eb1146b48e7ec27 (
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
|
#pragma once
#include "types.h"
#include "Shader.h"
#include "mathlib.h"
struct Camera3d;
struct WebglContext;
struct Renderer3d {
uint32 shader;
struct {
int32 position;
int32 color;
int32 normal;
} attributes;
struct {
int32 projection;
int32 view;
int32 model;
} uniforms;
void load(WebglContext* context);
void render(Camera3d* camera);
void unload();
};
struct Vertex3d {
Vector3 position;
Vector3 normal;
Vector4 color;
};
struct Mesh3d {
uint32 vao;
uint32 vbo;
uint32 ebo;
uint32 numIndices = 0;
Mat4x4 model;
void load(Vertex3d* vertices, uint32 numVertices, uint32* indices, uint32 numIndices, Renderer3d* renderer);
void render(Renderer3d* renderer, GLenum drawType = GL_TRIANGLES);
void unload();
};
|