3 Copyright (C) 2010-2013 kwolekr, Ryan Kwolek <kwolekr@minetest.net>
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.
20 #ifndef MG_DECORATION_HEADER
21 #define MG_DECORATION_HEADER
28 class ManualMapVoxelManipulator;
38 #define DECO_PLACE_CENTER_X 0x01
39 #define DECO_PLACE_CENTER_Y 0x02
40 #define DECO_PLACE_CENTER_Z 0x04
42 extern FlagDesc flagdesc_deco_schematic[];
53 CutoffData(s16 x, s16 y, s16 z, s16 h) {
60 class Decoration : public GenElement {
62 INodeDefManager *ndef;
65 std::vector<content_t> c_place_on;
71 //std::list<CutoffData> cutoffs;
72 //JMutex cutoff_mutex;
75 virtual ~Decoration();
77 size_t placeDeco(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
78 size_t placeCutoffs(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
80 virtual size_t generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p) = 0;
81 virtual int getHeight() = 0;
84 class DecoSimple : public Decoration {
86 std::vector<content_t> c_decos;
87 std::vector<content_t> c_spawnby;
94 bool canPlaceDecoration(ManualMapVoxelManipulator *vm, v3s16 p);
95 virtual size_t generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p);
96 virtual int getHeight();
99 class DecoSchematic : public Decoration {
103 Schematic *schematic;
104 std::string filename;
108 virtual size_t generate(Mapgen *mg, PseudoRandom *pr, s16 max_y, v3s16 p);
109 virtual int getHeight();
114 class DecoLSystem : public Decoration {
116 virtual void generate(Mapgen *mg, u32 blockseed, v3s16 nmin, v3s16 nmax);
120 class DecorationManager : public GenElementManager {
122 static const char *ELEMENT_TITLE;
123 static const size_t ELEMENT_LIMIT = 0x10000;
125 DecorationManager(IGameDef *gamedef) {}
126 ~DecorationManager() {}
128 Decoration *create(int type)
132 return new DecoSimple;
134 return new DecoSchematic;
136 // return new DecoLSystem;
142 size_t placeAllDecos(Mapgen *mg, u32 seed, v3s16 nmin, v3s16 nmax);