本文整理汇总了C++中BiomeManager::getBiomeFromNoiseOriginal方法的典型用法代码示例。如果您正苦于以下问题:C++ BiomeManager::getBiomeFromNoiseOriginal方法的具体用法?C++ BiomeManager::getBiomeFromNoiseOriginal怎么用?C++ BiomeManager::getBiomeFromNoiseOriginal使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BiomeManager
的用法示例。
在下文中一共展示了BiomeManager::getBiomeFromNoiseOriginal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l_get_biome_data
// get_biome_data(pos)
// returns a table containing the biome id, heat and humidity at the position
int ModApiMapgen::l_get_biome_data(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
v3s16 pos = read_v3s16(L, 1);
NoiseParams np_heat;
NoiseParams np_heat_blend;
NoiseParams np_humidity;
NoiseParams np_humidity_blend;
MapSettingsManager *settingsmgr =
getServer(L)->getEmergeManager()->map_settings_mgr;
if (!settingsmgr->getMapSettingNoiseParams("mg_biome_np_heat",
&np_heat) ||
!settingsmgr->getMapSettingNoiseParams("mg_biome_np_heat_blend",
&np_heat_blend) ||
!settingsmgr->getMapSettingNoiseParams("mg_biome_np_humidity",
&np_humidity) ||
!settingsmgr->getMapSettingNoiseParams("mg_biome_np_humidity_blend",
&np_humidity_blend))
return 0;
std::string value;
if (!settingsmgr->getMapSetting("seed", &value))
return 0;
std::istringstream ss(value);
u64 seed;
ss >> seed;
BiomeManager *bmgr = getServer(L)->getEmergeManager()->biomemgr;
if (!bmgr)
return 0;
float heat = bmgr->getHeatAtPosOriginal(pos, np_heat, np_heat_blend, seed);
if (!heat)
return 0;
float humidity = bmgr->getHumidityAtPosOriginal(pos, np_humidity,
np_humidity_blend, seed);
if (!humidity)
return 0;
Biome *biome = (Biome *)bmgr->getBiomeFromNoiseOriginal(heat, humidity, pos.Y);
if (!biome || biome->index == OBJDEF_INVALID_INDEX)
return 0;
lua_newtable(L);
lua_pushinteger(L, biome->index);
lua_setfield(L, -2, "biome");
lua_pushnumber(L, heat);
lua_setfield(L, -2, "heat");
lua_pushnumber(L, humidity);
lua_setfield(L, -2, "humidity");
return 1;
}