forked from Vogtinator/nGL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gldrawarray.h
27 lines (22 loc) · 1.04 KB
/
gldrawarray.h
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
#ifndef GLDRAWARRAY_H
#define GLDRAWARRAY_H
#include "gl.h"
struct IndexedVertex {
unsigned int index;
GLFix u, v;
COLOR c;
IndexedVertex(unsigned int index, GLFix u, GLFix v, COLOR c) : index{index}, u{u}, v{v}, c{c} {}
};
struct ProcessedPosition {
VECTOR3 transformed;
VECTOR3 perspective;
bool perspective_available;
};
/* Faster way to draw a mesh.
* vertices: Array of IndexedVertex with size count_vertices
* positions: Array of VECTOR3 with size count_positions the IndexedVertex's refer to
* processed: Array of ProcessedVertex with size count_positions. Allocate and free it yourself.
* reset_processed: Set to false if you want to use the same positions with the same transformation. Default is true.
* draw_mode: GL_TRIANGLES or GL_QUADS */
void nglDrawArray(const IndexedVertex *vertices, const unsigned int count_vertices, const VECTOR3 *positions, const unsigned int count_positions, ProcessedPosition *processed, const GLDrawMode draw_mode = GL_TRIANGLES, const bool reset_processed = true);
#endif // GLDRAWARRAY_H