nanoMMO 0.97.8
Building an MMO: The Engineering Series
Loading...
Searching...
No Matches
trees.h
Go to the documentation of this file.
1#ifndef NANOMMO_CLIENT_TREES_H_
2#define NANOMMO_CLIENT_TREES_H_
3
4#include <raylib.h>
5
6#include <string>
7#include <vector>
8
9#include "client/triangles.h"
10#include "terrain/terrain.h"
11
12namespace nanommo {
13
14/// In metres, before each tree's own scale.
15constexpr float kTreeHeight = 5.0f;
16
17std::string TreesFolder();
18
19struct Face {
20 Vector3 a;
21 Vector3 b;
22 Vector3 c;
23 Color color;
24};
25
26/// The model's triangles, standing on y = 0 and a metre tall, each in the
27/// colour of its texture under the middle of the face. None if the file
28/// isn't there.
29std::vector<Face> LoadFaces(const std::string& path);
30
31/// Sizes the model, turns it, and stands it on the ground.
32Matrix TreeTransform(const Tree& tree, const Terrain& terrain);
33
34/// Adds the faces, moved by the transform, with their colours multiplied by
35/// the tint.
36void AddFaces(Triangles& triangles, const std::vector<Face>& faces,
37 const Matrix& transform, Color tint);
38
39} // namespace nanommo
40
41#endif // NANOMMO_CLIENT_TREES_H_
Definition chat.cc:9
std::vector< Face > LoadFaces(const std::string &path)
Definition trees.cc:30
void AddFaces(Triangles &triangles, const std::vector< Face > &faces, const Matrix &transform, Color tint)
Definition trees.cc:78
std::string TreesFolder()
Definition trees.cc:26
Matrix TreeTransform(const Tree &tree, const Terrain &terrain)
Sizes the model, turns it, and stands it on the ground.
Definition trees.cc:71
constexpr float kTreeHeight
In metres, before each tree's own scale.
Definition trees.h:15
Vector3 b
Definition trees.h:21
Vector3 c
Definition trees.h:22
Color color
Definition trees.h:23
Vector3 a
Definition trees.h:20