3 Copyright (C) 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.
38 static const char className[];
39 static const luaL_reg methods[];
44 static int gc_object(lua_State *L);
46 static int l_get2d(lua_State *L);
47 static int l_get3d(lua_State *L);
50 LuaPerlinNoise(int a_seed, int a_octaves, float a_persistence,
55 // LuaPerlinNoise(seed, octaves, persistence, scale)
56 // Creates an LuaPerlinNoise and leaves it on top of stack
57 static int create_object(lua_State *L);
59 static LuaPerlinNoise* checkobject(lua_State *L, int narg);
61 static void Register(lua_State *L);
67 class LuaPerlinNoiseMap
71 static const char className[];
72 static const luaL_reg methods[];
74 static int gc_object(lua_State *L);
76 static int l_get2dMap(lua_State *L);
77 static int l_get2dMap_flat(lua_State *L);
78 static int l_get3dMap(lua_State *L);
79 static int l_get3dMap_flat(lua_State *L);
82 LuaPerlinNoiseMap(NoiseParams *np, int seed, v3s16 size);
86 // LuaPerlinNoiseMap(np, size)
87 // Creates an LuaPerlinNoiseMap and leaves it on top of stack
88 static int create_object(lua_State *L);
90 static LuaPerlinNoiseMap *checkobject(lua_State *L, int narg);
92 static void Register(lua_State *L);
100 class LuaPseudoRandom
103 PseudoRandom m_pseudo;
105 static const char className[];
106 static const luaL_reg methods[];
108 // Exported functions
111 static int gc_object(lua_State *L);
113 // next(self, min=0, max=32767) -> get next value
114 static int l_next(lua_State *L);
117 LuaPseudoRandom(int seed);
121 const PseudoRandom& getItem() const;
122 PseudoRandom& getItem();
124 // LuaPseudoRandom(seed)
125 // Creates an LuaPseudoRandom and leaves it on top of stack
126 static int create_object(lua_State *L);
128 static LuaPseudoRandom* checkobject(lua_State *L, int narg);
130 static void Register(lua_State *L);
133 NoiseParams *read_noiseparams(lua_State *L, int index);
135 #endif /* L_NOISE_H_ */