本文整理汇总了C++中Sector::GetTextureName方法的典型用法代码示例。如果您正苦于以下问题:C++ Sector::GetTextureName方法的具体用法?C++ Sector::GetTextureName怎么用?C++ Sector::GetTextureName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sector
的用法示例。
在下文中一共展示了Sector::GetTextureName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GenerateGrass
void WorldRenderer::GenerateGrass(const Vector2UINT& sectorCoords)
{
// Grass Turned Off
if ( !zGrassDensity )
{
return;
}
// Delete previous grass if existing.
auto grassIterator = this->zGrass.find(sectorCoords);
// Create Sector Rect
Rect sectorRect;
sectorRect.topLeft.x = (float)sectorCoords.x * FSECTOR_WORLD_SIZE;
sectorRect.topLeft.y = (float)sectorCoords.y * FSECTOR_WORLD_SIZE;
sectorRect.size.x = FSECTOR_WORLD_SIZE;
sectorRect.size.y = FSECTOR_WORLD_SIZE;
// Check if inside clip range
Circle clipCircle(zGraphics->GetCamera()->GetPosition().GetXZ(), zGrassFarDistance);
// Check Intersection
if ( !DoesIntersect(sectorRect, clipCircle) )
{
if ( grassIterator != this->zGrass.end() )
{
// Remove from graphics engine.
this->zGraphics->DeleteBillboardCollection(grassIterator->second);
// Remove from map.
this->zGrass.erase(grassIterator);
}
return;
}
// Delete Old Grass
if( grassIterator != this->zGrass.end() )
{
// Remove from graphics engine.
this->zGraphics->DeleteBillboardCollection(grassIterator->second);
// Reset
grassIterator->second = 0;
}
// First check if the sector has any grass texture
Sector* sector = this->zWorld->GetSector(sectorCoords);
bool found = false;
for(unsigned int i = 0; i < SECTOR_BLEND_CHANNELS && !found; ++i)
{
if(strcmp(sector->GetTextureName(i), "01_v02-Moss.png") == 0)
{
found = true;
}
else if(strcmp(sector->GetTextureName(i), "06_v01-MossDark.png") == 0)
{
found = true;
}
else if(strcmp(sector->GetTextureName(i), "07_v01-MossLight.png") == 0)
{
found = true;
}
}
// No Grass Textures Found
if(!found)
{
return;
}
float width = FSECTOR_WORLD_SIZE;
float depth = FSECTOR_WORLD_SIZE;
unsigned int sqrtGrassDensity = (unsigned int)sqrt((long)this->zGrassDensity);
float xDiff = width / sqrtGrassDensity;
float zDiff = depth / sqrtGrassDensity;
Vector2 grassPos = Vector2(0.0f);
Vector2 terrainPosXZ = sectorRect.topLeft;
float blendValueGrassLight = 0.0f;
float blendValueGrassMedium = 0.0f;
float blendValueGrassDark = 0.0f;
float blendThreshHold = 0.32f;
const static float RGB_MIN_MAX = 50.0f / 255.0f;
Vector3* positions = new Vector3[this->zGrassDensity];
Vector2* sizes = new Vector2[this->zGrassDensity];
Vector3* colors = new Vector3[this->zGrassDensity];
fast_rand_seed = sectorCoords.x + sectorCoords.y;
float rndMaxInv = 1.0f / (float)RAND_MAX;
float grassWidth = 0.0f;
float grassHeight = 0.0f;
float terrainY = 0.0f;
Vector2 offsetVector = Vector2(xDiff, zDiff) * 0.5f;
unsigned int index = 0;
float totBlendValue = 0.0f;
//Values taken from average texture color.
Vector3 colorGrassLight = Vector3(91.0f, 131.0f, 65.0f) / 255.0f;
Vector3 colorGrassMedium = Vector3(107.0f, 142.0f, 77.0f) / 255.0f;
Vector3 colorGrassDark = Vector3(68.0f, 104.0f, 45.0f) / 255.0f;
//.........这里部分代码省略.........