]> git.lizzy.rs Git - minetest.git/blob - src/mesh.h
Works for debian and a few other distributions but fails for even more so back to...
[minetest.git] / src / mesh.h
1 /*
2 Minetest
3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation; either version 2.1 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MESH_HEADER
21 #define MESH_HEADER
22
23 #include "irrlichttypes_extrabloated.h"
24 #include <string>
25
26 /*
27         Create a new cube mesh.
28         Vertices are at (+-scale.X/2, +-scale.Y/2, +-scale.Z/2).
29
30         The resulting mesh has 6 materials (up, down, right, left, back, front)
31         which must be defined by the caller.
32 */
33 scene::IAnimatedMesh* createCubeMesh(v3f scale);
34
35 /*
36         Create a new extruded mesh from a texture.
37         Maximum bounding box is (+-scale.X/2, +-scale.Y/2, +-scale.Z).
38         Thickness is in Z direction.
39
40         The resulting mesh has 1 material which must be defined by the caller.
41 */
42 scene::IAnimatedMesh* createExtrudedMesh(video::ITexture *texture,
43                 video::IVideoDriver *driver, v3f scale);
44
45 /*
46         Multiplies each vertex coordinate by the specified scaling factors
47         (componentwise vector multiplication).
48 */
49 void scaleMesh(scene::IMesh *mesh, v3f scale);
50
51 /*
52         Translate each vertex coordinate by the specified vector.
53 */
54 void translateMesh(scene::IMesh *mesh, v3f vec);
55
56 /*
57         Set a constant color for all vertices in the mesh
58 */
59 void setMeshColor(scene::IMesh *mesh, const video::SColor &color);
60
61 /*
62         Set the color of all vertices in the mesh.
63         For each vertex, determine the largest absolute entry in
64         the normal vector, and choose one of colorX, colorY or
65         colorZ accordingly.
66 */
67 void setMeshColorByNormalXYZ(scene::IMesh *mesh,
68                 const video::SColor &colorX,
69                 const video::SColor &colorY,
70                 const video::SColor &colorZ);
71
72 #endif