本文整理汇总了C++中Square::SetTopRight方法的典型用法代码示例。如果您正苦于以下问题:C++ Square::SetTopRight方法的具体用法?C++ Square::SetTopRight怎么用?C++ Square::SetTopRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Square
的用法示例。
在下文中一共展示了Square::SetTopRight方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadMesh
// Load functions are performed on initialization
void TextureCorridor::LoadMesh(int corridorType)
{
for (int i = 0; i < squareList.size(); ++i)
delete squareList[i];
squareList.clear();
Square* square = new Square;
vector<float> xValues = { corridorWidth,corridorWidth, 2.0f*corridorWidth, 2.0f*corridorWidth, corridorWidth };
square->SetScaling(2.0f*corridorWidth, 60*wallHeight);
square->SetRotation(-90.0f, 0.0f, 0.0f);
square->SetPosition(0.0f, 0.0f, -(corridorDepth-wallHeight));
square->SetTextureID(textureMap["floor"]);
squareList.push_back(square);
switch (corridorType)
{
// Straight corridor
case 1:
for (size_t wallIndex = 1; wallIndex <= 60; ++wallIndex)
{
float x1 = corridorWidth;
float x2 = corridorWidth;
float y1 = wallHeight ;
float y2 = 0.0f;
float z1 = -((wallIndex - 1)*wallHeight);
float z2 = z1 - wallHeight;
string texname = "tex" + to_string(((wallIndex - 1) % nTextures) + 1);
// left wall #1
square = new Square;
square->SetTopLeft(x1, y1, z1);;
square->SetBottomLeft(x1, y2, z1);
square->SetTopRight(x2, y1, z2);
square->SetBottomRight(x2, y2, z2);
square->SetTextureID(textureMap[texname]);
square->Apply();
squareList.push_back(square);
// right wall
square = new Square;
square->SetTopLeft(-x1, y1, z1);;
square->SetBottomLeft(-x1, y2, z1);
square->SetTopRight(-x2, y1, z2);
square->SetBottomRight(-x2, y2, z2);
square->SetTextureID(textureMap[texname]);
square->Apply();
squareList.push_back(square);
}
break;
// Corridor with varying geometry
case 2:
for (size_t wallIndex = 1; wallIndex <= 60; ++wallIndex)
{
float x1 = xValues[(wallIndex - 1) % xValues.size()];
float x2 = xValues[(wallIndex) % xValues.size()];
float y1 = wallHeight;
float y2 = 0.0f;
float z1 = -((wallIndex - 1)*wallHeight);
float z2 = z1 - wallHeight;
string texname = "tex" + to_string(((wallIndex - 1) % nTextures) + 1);
// left wall #1
square = new Square;
square->SetTopLeft(x1, y1, z1);;
square->SetBottomLeft(x1, y2, z1);
square->SetTopRight(x2, y1, z2);
square->SetBottomRight(x2, y2, z2);
square->SetTextureID(textureMap[texname]);
square->Apply();
squareList.push_back(square);
// right wall
square = new Square;
square->SetTopLeft(-x1, y1, z1);;
square->SetBottomLeft(-x1, y2, z1);
square->SetTopRight(-x2, y1, z2);
square->SetBottomRight(-x2, y2, z2);
square->SetTextureID(textureMap[texname]);
square->Apply();
squareList.push_back(square);
}
break;
default:
break;
}
}