Line data Source code
1 : /*
2 : Minetest
3 : Copyright (C) 2010-2014 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 WIELDMESH_HEADER
21 : #define WIELDMESH_HEADER
22 :
23 : #include "irrlichttypes_extrabloated.h"
24 : #include <string>
25 :
26 : struct ItemStack;
27 : class IGameDef;
28 : class ITextureSource;
29 : struct TileSpec;
30 :
31 : /*
32 : Wield item scene node, renders the wield mesh of some item
33 : */
34 : class WieldMeshSceneNode: public scene::ISceneNode
35 : {
36 : public:
37 : WieldMeshSceneNode(scene::ISceneNode *parent, scene::ISceneManager *mgr,
38 : s32 id = -1, bool lighting = false);
39 : virtual ~WieldMeshSceneNode();
40 :
41 : void setCube(const TileSpec tiles[6],
42 : v3f wield_scale, ITextureSource *tsrc);
43 : void setExtruded(const std::string &imagename,
44 : v3f wield_scale, ITextureSource *tsrc, u8 num_frames);
45 : void setItem(const ItemStack &item, IGameDef *gamedef);
46 :
47 : // Sets the vertex color of the wield mesh.
48 : // Must only be used if the constructor was called with lighting = false
49 : void setColor(video::SColor color);
50 :
51 : virtual void render();
52 :
53 0 : virtual const core::aabbox3d<f32>& getBoundingBox() const
54 0 : { return m_bounding_box; }
55 :
56 : private:
57 : void changeToMesh(scene::IMesh *mesh);
58 :
59 : // Child scene node with the current wield mesh
60 : scene::IMeshSceneNode *m_meshnode;
61 : video::E_MATERIAL_TYPE m_material_type;
62 :
63 : // True if EMF_LIGHTING should be enabled.
64 : bool m_lighting;
65 :
66 : bool m_enable_shaders;
67 : bool m_anisotropic_filter;
68 : bool m_bilinear_filter;
69 : bool m_trilinear_filter;
70 :
71 : // Bounding box culling is disabled for this type of scene node,
72 : // so this variable is just required so we can implement
73 : // getBoundingBox() and is set to an empty box.
74 : core::aabbox3d<f32> m_bounding_box;
75 : };
76 :
77 : #endif
|