forked from ixchow/15-466-f17-base2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Meshes.hpp
31 lines (25 loc) · 791 Bytes
/
Meshes.hpp
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
#pragma once
#include "GL.hpp"
#include <map>
//Mesh is a lightweight handle to some OpenGL vertex data:
struct Mesh {
GLuint vao = 0;
GLuint start = 0;
GLuint count = 0;
};
//"Meshes" loads a collection of meshes and builds VAOs for 'em
// you pass in a 'Bindings' object to specify which attributes to bind where
struct Meshes {
struct Attributes {
GLuint Position = -1U;
GLuint Normal = -1U;
};
//add meshes from a file; use the indicated indices for attribute locations:
// note: will throw if file fails to read.
void load(std::string const &filename, Attributes const &attributes);
//look up a particular mesh in the DB:
// note: will throw if mesh not found.
Mesh const &get(std::string const &name) const;
//internals:
std::map< std::string, Mesh > meshes;
};