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.
37 static const char className[];
38 static const luaL_reg methods[];
43 static int gc_object(lua_State *L);
45 static int l_get2d(lua_State *L);
46 static int l_get3d(lua_State *L);
49 LuaPerlinNoise(int a_seed, int a_octaves, float a_persistence,
54 // LuaPerlinNoise(seed, octaves, persistence, scale)
55 // Creates an LuaPerlinNoise and leaves it on top of stack
56 static int create_object(lua_State *L);
58 static LuaPerlinNoise* checkobject(lua_State *L, int narg);
60 static void Register(lua_State *L);
66 class LuaPerlinNoiseMap
70 static const char className[];
71 static const luaL_reg methods[];
73 static int gc_object(lua_State *L);
75 static int l_get2dMap(lua_State *L);
77 static int l_get3dMap(lua_State *L);
80 LuaPerlinNoiseMap(NoiseParams *np, int seed, v3s16 size);
84 // LuaPerlinNoiseMap(np, size)
85 // Creates an LuaPerlinNoiseMap and leaves it on top of stack
86 static int create_object(lua_State *L);
88 static LuaPerlinNoiseMap *checkobject(lua_State *L, int narg);
90 static void Register(lua_State *L);
101 PseudoRandom m_pseudo;
103 static const char className[];
104 static const luaL_reg methods[];
106 // Exported functions
109 static int gc_object(lua_State *L);
111 // next(self, min=0, max=32767) -> get next value
112 static int l_next(lua_State *L);
115 LuaPseudoRandom(int seed);
119 const PseudoRandom& getItem() const;
120 PseudoRandom& getItem();
122 // LuaPseudoRandom(seed)
123 // Creates an LuaPseudoRandom and leaves it on top of stack
124 static int create_object(lua_State *L);
126 static LuaPseudoRandom* checkobject(lua_State *L, int narg);
128 static void Register(lua_State *L);
131 NoiseParams *read_noiseparams(lua_State *L, int index);
133 #endif /* LUA_PERLIN_H_ */