本文整理汇总了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;
}
示例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; // */
}
示例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);
}
}
}
}
示例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;
}