mesh.h 2.2 KB

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