3 Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
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.
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.
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.
23 #include "irrlichttypes_extrabloated.h"
27 * Applies shading to a color based on the surface's
30 void applyFacesShading(video::SColor &color, const v3f &normal);
33 Create a new cube mesh.
34 Vertices are at (+-scale.X/2, +-scale.Y/2, +-scale.Z/2).
36 The resulting mesh has 6 materials (up, down, right, left, back, front)
37 which must be defined by the caller.
39 scene::IAnimatedMesh* createCubeMesh(v3f scale);
42 Multiplies each vertex coordinate by the specified scaling factors
43 (componentwise vector multiplication).
45 void scaleMesh(scene::IMesh *mesh, v3f scale);
48 Translate each vertex coordinate by the specified vector.
50 void translateMesh(scene::IMesh *mesh, v3f vec);
53 * Sets a constant color for all vertices in the mesh buffer.
55 void setMeshBufferColor(scene::IMeshBuffer *buf, const video::SColor &color);
58 Set a constant color for all vertices in the mesh
60 void setMeshColor(scene::IMesh *mesh, const video::SColor &color);
63 * Overwrites the color of a mesh buffer.
64 * The color is darkened based on the normal vector of the vertices.
66 void colorizeMeshBuffer(scene::IMeshBuffer *buf, const video::SColor *buffercolor);
69 Set the color of all vertices in the mesh.
70 For each vertex, determine the largest absolute entry in
71 the normal vector, and choose one of colorX, colorY or
74 void setMeshColorByNormalXYZ(scene::IMesh *mesh,
75 const video::SColor &colorX,
76 const video::SColor &colorY,
77 const video::SColor &colorZ);
79 void setMeshColorByNormal(scene::IMesh *mesh, const v3f &normal,
80 const video::SColor &color);
83 Rotate the mesh by 6d facedir value.
84 Method only for meshnodes, not suitable for entities.
86 void rotateMeshBy6dFacedir(scene::IMesh *mesh, int facedir);
89 Rotate the mesh around the axis and given angle in degrees.
91 void rotateMeshXYby (scene::IMesh *mesh, f64 degrees);
92 void rotateMeshXZby (scene::IMesh *mesh, f64 degrees);
93 void rotateMeshYZby (scene::IMesh *mesh, f64 degrees);
96 * Clone the mesh buffer.
97 * The returned pointer should be dropped.
99 scene::IMeshBuffer* cloneMeshBuffer(scene::IMeshBuffer *mesh_buffer);
104 scene::SMesh* cloneMesh(scene::IMesh *src_mesh);
107 Convert nodeboxes to mesh. Each tile goes into a different buffer.
108 boxes - set of nodeboxes to be converted into cuboids
109 uv_coords[24] - table of texture uv coords for each cuboid face
110 expand - factor by which cuboids will be resized
112 scene::IMesh* convertNodeboxesToMesh(const std::vector<aabb3f> &boxes,
113 const f32 *uv_coords = NULL, float expand = 0);
116 Update bounding box for a mesh.
118 void recalculateBoundingBox(scene::IMesh *src_mesh);
121 Vertex cache optimization according to the Forsyth paper:
122 http://home.comcast.net/~tom_forsyth/papers/fast_vert_cache_opt.html
123 Ported from irrlicht 1.8
125 scene::IMesh* createForsythOptimizedMesh(const scene::IMesh *mesh);