当前位置: 首页>>代码示例>>C++>>正文


C++ AreaStore类代码示例

本文整理汇总了C++中AreaStore的典型用法代码示例。如果您正苦于以下问题:C++ AreaStore类的具体用法?C++ AreaStore怎么用?C++ AreaStore使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AreaStore类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: checkobject

// insert_area(edge1, edge2, data)
int LuaAreaStore::l_insert_area(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;

	LuaAreaStore *o = checkobject(L, 1);
	AreaStore *ast = o->as;

	Area a;

	a.minedge = check_v3s16(L, 2);
	a.maxedge = check_v3s16(L, 3);

	a.extremifyEdges();
	a.id = ast->getFreeId(a.minedge, a.maxedge);

	if (a.id == AREA_ID_INVALID) {
		// couldn't get free id
		lua_pushnil(L);
		return 1;
	}

	size_t d_len;
	const char *data = luaL_checklstring(L, 4, &d_len);

	a.data = std::string(data, d_len);

	ast->insertArea(a);

	lua_pushnumber(L, a.id);
	return 1;
}
开发者ID:BlockMen,项目名称:minetest,代码行数:32,代码来源:l_areastore.cpp

示例2: cacheMiss

void AreaStore::cacheMiss(void *data, const v3s16 &mpos, std::vector<Area *> *dest)
{
	AreaStore *as = (AreaStore *)data;
	u8 r = as->m_cacheblock_radius;

	// get the points at the edges of the mapblock
	v3s16 minedge(mpos.X * r, mpos.Y * r, mpos.Z * r);
	v3s16 maxedge(
		minedge.X + r - 1,
		minedge.Y + r - 1,
		minedge.Z + r - 1);

	as->getAreasInArea(dest, minedge, maxedge, true);

	/* infostream << "Cache miss with " << dest->size() << " areas, between ("
			<< minedge.X << ", " << minedge.Y << ", " << minedge.Z
			<< ") and ("
			<< maxedge.X << ", " << maxedge.Y << ", " << maxedge.Z
			<< ")" << std::endl; // */
}
开发者ID:Caellian,项目名称:minetest,代码行数:20,代码来源:areastore.cpp

示例3: isRelevant

void FoliageBase::TerrainHandler_LayerUpdated(const Terrain::TerrainShader* shader, const AreaStore& areas)
{
  if (mPagedGeometry) {
    //check if the layer update affects this layer, either if it's the actual layer, or one of the dependent layers
    bool isRelevant(0);
    if (&shader->getLayerDefinition() == &mTerrainLayerDefinition) {
      isRelevant = true;
    } else {
      if (std::find(mDependentDefinitions.begin(), mDependentDefinitions.end(), &shader->getLayerDefinition()) != mDependentDefinitions.end()) {
        isRelevant = true;
      }
    }
    if (isRelevant) {
      for (AreaStore::const_iterator I = areas.begin(); I != areas.end(); ++I) {
        const Ogre::TRect<Ogre::Real> ogreExtent(Convert::toOgre(*I));
        mPagedGeometry->reloadGeometryPages(ogreExtent);
      }
    }
  }
}
开发者ID:junrw,项目名称:ember-gsoc2012,代码行数:20,代码来源:FoliageBase.cpp

示例4: checkobject

// insert_area(edge1, edge2, data, id)
int LuaAreaStore::l_insert_area(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;

	LuaAreaStore *o = checkobject(L, 1);
	AreaStore *ast = o->as;

	Area a(check_v3s16(L, 2), check_v3s16(L, 3));

	size_t d_len;
	const char *data = luaL_checklstring(L, 4, &d_len);

	a.data = std::string(data, d_len);

	if (lua_isnumber(L, 5))
		a.id = lua_tonumber(L, 5);

	if (!ast->insertArea(&a))
		return 0;

	lua_pushnumber(L, a.id);
	return 1;
}
开发者ID:Bremaweb,项目名称:minetest,代码行数:24,代码来源:l_areastore.cpp


注:本文中的AreaStore类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。