nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
triangles.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_TRIANGLES_H_
2#define NANOMMO_CLIENT_TRIANGLES_H_
3
4#include <raylib.h>
5
6#include <vector>
7
8namespace nanommo {
9
10/// Pointing out of the side where the corners go anticlockwise, which is the
11/// side OpenGL draws.
12Vector3 FaceNormal(Vector3 a, Vector3 b, Vector3 c);
13
14/// Triangles that share no corners, so that each has its face's normal, and
15/// the light shades each face flat, like a low-poly model.
16class Triangles {
17 public:
18 void Add(Vector3 a, Vector3 b, Vector3 c, Color color);
19
20 int size() const { return static_cast<int>(colors_.size() / 12); }
21
22 /// Hands them to the GPU, as a mesh for LoadModelFromMesh.
23 Mesh Upload() const;
24
25 private:
26 std::vector<float> positions_;
27 std::vector<float> normals_;
28 std::vector<unsigned char> colors_;
29};
30
31} // namespace nanommo
32
33#endif // NANOMMO_CLIENT_TRIANGLES_H_
void Add(Vector3 a, Vector3 b, Vector3 c, Color color)
Definition triangles.cc:27
int size() const
Definition triangles.h:20
Mesh Upload() const
Hands them to the GPU, as a mesh for LoadModelFromMesh.
Definition triangles.cc:36
Definition chat.cc:9
Vector3 FaceNormal(Vector3 a, Vector3 b, Vector3 c)
Definition triangles.cc:22