本文整理汇总了C++中Coords::y方法的典型用法代码示例。如果您正苦于以下问题:C++ Coords::y方法的具体用法?C++ Coords::y怎么用?C++ Coords::y使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Coords
的用法示例。
在下文中一共展示了Coords::y方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: blockToChunkCoords
Coords ChunkManager::blockToChunkCoords(Coords in)
{
int newX = std::floor((float)in.x() / (float)Chunk::chunkWidth);
int newY = std::floor((float)in.y() / (float)Chunk::chunkWidth);
int newZ = std::floor((float)in.z() / (float)Chunk::chunkHeight);
Coords result = Coords(newX, newY, newZ);
return result;
}
示例2: setCenterChunk
void ChunkManager::setCenterChunk(Coords center, bool force)
{
if (center == _center && !force) return;
_center = center;
//Delete out-of-range chunks
for (chunkMap_type::iterator it = _chunkMap.begin(); it != _chunkMap.end(); /* No increment */)
{
if (it->first.dist_squared_2D(center) > _visibility * _visibility)
{
delete it->second;
it = _chunkMap.erase(it); //returns next element
}
else
{
it++;
}
}
//load missing chunks
for (int x = center.x() - _visibility; x <= center.x() + _visibility; x++)
{
for (int y = center.y() - _visibility; y <= center.y() + _visibility; y++)
{
for (int z = 0; z <= BlockGrid::gridHeight / Chunk::chunkHeight; z++)
{
if (z < 0) z = 0; //ensure we don't go too low
Coords coords(x, y, z);
if (coords.dist_squared_2D(center) < _visibility * _visibility)
{
Coords coords(x, y, z);
chunkMap_type::iterator it = _chunkMap.find(coords);
if (it == _chunkMap.end())
{
chunkLoader.requestLoadChunk(coords);
//_dirtyChunks.push_front(chunk);
}
}
}
}
}
}