]> git.lizzy.rs Git - dragonfireclient.git/blob - src/mesh.h
Document zoom_fov in settingtypes.txt and minetest.conf.example
[dragonfireclient.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 "nodedef.h"
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         Multiplies each vertex coordinate by the specified scaling factors
37         (componentwise vector multiplication).
38 */
39 void scaleMesh(scene::IMesh *mesh, v3f scale);
40
41 /*
42         Translate each vertex coordinate by the specified vector.
43 */
44 void translateMesh(scene::IMesh *mesh, v3f vec);
45
46 /*
47         Set a constant color for all vertices in the mesh
48 */
49 void setMeshColor(scene::IMesh *mesh, const video::SColor &color);
50
51 /*
52         Shade mesh faces according to their normals
53 */
54
55 void shadeMeshFaces(scene::IMesh *mesh);
56
57 /*
58         Set the color of all vertices in the mesh.
59         For each vertex, determine the largest absolute entry in
60         the normal vector, and choose one of colorX, colorY or
61         colorZ accordingly.
62 */
63 void setMeshColorByNormalXYZ(scene::IMesh *mesh,
64                 const video::SColor &colorX,
65                 const video::SColor &colorY,
66                 const video::SColor &colorZ);
67 /*
68         Rotate the mesh by 6d facedir value.
69         Method only for meshnodes, not suitable for entities.
70 */
71 void rotateMeshBy6dFacedir(scene::IMesh *mesh, int facedir);
72
73 /*
74         Rotate the mesh around the axis and given angle in degrees.
75 */
76 void rotateMeshXYby (scene::IMesh *mesh, f64 degrees);
77 void rotateMeshXZby (scene::IMesh *mesh, f64 degrees);
78 void rotateMeshYZby (scene::IMesh *mesh, f64 degrees); 
79  
80 /*
81         Clone the mesh.
82 */
83 scene::IMesh* cloneMesh(scene::IMesh *src_mesh);
84
85 /*
86         Convert nodeboxes to mesh.
87         boxes - set of nodeboxes to be converted into cuboids
88         uv_coords[24] - table of texture uv coords for each cuboid face
89         expand - factor by which cuboids will be resized
90 */
91 scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
92                 const f32 *uv_coords = NULL, float expand = 0);
93
94 /*
95         Update bounding box for a mesh.
96 */
97 void recalculateBoundingBox(scene::IMesh *src_mesh);
98
99 /*
100         Vertex cache optimization according to the Forsyth paper:
101         http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
102         Ported from irrlicht 1.8
103 */
104 scene::IMesh* createForsythOptimizedMesh(const scene::IMesh *mesh);
105
106 #endif