Predict param2 of facedir nodes and attachment of attached_node nodes
[oweals/minetest.git] / src / farmesh.h
1 /*
2 Part of 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 FARMESH_HEADER
21 #define FARMESH_HEADER
22
23 /*
24         A quick messy implementation of terrain rendering for a long
25         distance according to map seed
26 */
27
28 #include "irrlichttypes_extrabloated.h"
29
30 #define FARMESH_MATERIAL_COUNT 2
31
32 class Client;
33
34 class FarMesh : public scene::ISceneNode
35 {
36 public:
37         FarMesh(
38                         scene::ISceneNode* parent,
39                         scene::ISceneManager* mgr,
40                         s32 id,
41                         u64 seed,
42                         Client *client
43         );
44
45         ~FarMesh();
46
47         /*
48                 ISceneNode methods
49         */
50
51         virtual void OnRegisterSceneNode();
52
53         virtual void render();
54         
55         virtual const core::aabbox3d<f32>& getBoundingBox() const
56         {
57                 return m_box;
58         }
59
60         virtual u32 getMaterialCount() const;
61
62         virtual video::SMaterial& getMaterial(u32 i);
63         
64         /*
65                 Other stuff
66         */
67
68         void step(float dtime);
69
70         void update(v2f camera_p, float brightness, s16 render_range);
71
72 private:
73         video::SMaterial m_materials[FARMESH_MATERIAL_COUNT];
74         core::aabbox3d<f32> m_box;
75         float m_cloud_y;
76         float m_brightness;
77         u64 m_seed;
78         v2f m_camera_pos;
79         float m_time;
80         Client *m_client;
81         s16 m_render_range;
82 };
83
84 #endif
85