Line | Count | Source |
1 | | #include "client/outline.h" |
2 | | |
3 | | #include <raylib.h> |
4 | | #include <raymath.h> |
5 | | #include <rlgl.h> |
6 | | |
7 | | #include <vector> |
8 | | |
9 | | namespace nanommo { |
10 | | |
11 | 0 | void DrawOutline(const Model& model, const Matrix& transform, Shader shader) { |
12 | | // A copy of the model, with the outline's shader in its materials, so that |
13 | | // raylib draws it posed, with its bones, as it does the model. |
14 | 0 | std::vector<Material> materials(model.materials, |
15 | 0 | model.materials + model.materialCount); |
16 | 0 | for (Material& material : materials) { |
17 | 0 | material.shader = shader; |
18 | 0 | } |
19 | 0 | Model hull = model; |
20 | 0 | hull.materials = materials.data(); |
21 | 0 | hull.transform = MatrixMultiply(model.transform, transform); |
22 | 0 | rlSetCullFace(RL_CULL_FACE_FRONT); |
23 | | DrawModel(hull, {0.0f, 0.0f, 0.0f}, 1.0f, WHITE); |
24 | 0 | rlSetCullFace(RL_CULL_FACE_BACK); |
25 | 0 | } |
26 | | |
27 | | } // namespace nanommo |