本文整理汇总了C++中QuadTree::setTreeData方法的典型用法代码示例。如果您正苦于以下问题:C++ QuadTree::setTreeData方法的具体用法?C++ QuadTree::setTreeData怎么用?C++ QuadTree::setTreeData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuadTree
的用法示例。
在下文中一共展示了QuadTree::setTreeData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createObjects
//.........这里部分代码省略.........
//for (int x = 0; x < 6; x++)//dessa rader verkar inte göra något
//nrOfVertexDrawn = triangleVertices.size();
//creates the quad for DeferredRendering
finalShit[0] = { -1.0f, 1.0f, 0.0f, 0.0f,0.0f };
finalShit[1] = { 1.0f, -1.0f, 0.0f, 1.0f,1.0f };
finalShit[2] = { -1.0f, -1.0f, 0.0f, 0.0f,1.0f };
// 1.0 1.0
finalShit[3] = { -1.0f, 1.0f, 0.0f, 0.0f,0.0f };
finalShit[4] = { 1.0f, 1.0f, 0.0f, 1.0f,0.0f };
finalShit[5] = { 1.0f, -1.0f, 0.0f, 1.0f,1.0f };
//creates the vertexBuffer for the quad
D3D11_BUFFER_DESC bufferDesc;
memset(&bufferDesc, 0, sizeof(bufferDesc));
bufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bufferDesc.Usage = D3D11_USAGE_DEFAULT;
bufferDesc.ByteWidth = sizeof(finalShit);
D3D11_SUBRESOURCE_DATA data;
memset(&data, 0, sizeof(data));
data.pSysMem = finalShit;
HRESULT hr = gDevice->CreateBuffer(&bufferDesc, &data, &quadVertexBuffer);
/*
<<<<<<< HEAD
//creates all the Objects
/*int xMax = 6;
int yMax = 3;
int zMax = 6;
for (int x = 0; x < xMax; x++)
{
for (int y = 0; y < yMax; y++)
{
for (int z = 0; z < zMax; z++)
{
if (x == 0 || x == xMax - 1 || y == 0 || y == yMax - 1 || z == 0 || z == zMax - 1)
{
//creates an object
objects.push_back(Object(triangleVertices, Vector3((2.0f * x), (2.0f * y), (2.0f * z)), gDevice, fromFile.getImageFile(), "cube_box_NormalMap.png"));
nrOfObjects++;
}
}
}
}*/
/*
for (int i = 0; i < 5; i++)
{
objects.push_back(Object(triangleVertices, Vector3(rand() % 6, 0, 6), gDevice, fromFile.getImageFile(), "cube_box_NormalMap.png"));
nrOfObjects++;
}
*/
objects.push_back(Object(triangleVertices, Vector3((1.0f), (0.0f), (1.0f)), gDevice, fromFile.getImageFile(), "cube_box_NormalMap.png", objNr++));
objects.push_back(Object(triangleVertices, Vector3((3.0f), (0.0f), (1.0f)), gDevice, fromFile.getImageFile(), "cube_box_NormalMap.png", objNr++));
//creating the floor
/*for (int i = 0; i < 10; i++)
{
float x = i;
for (int j = 0; j < 10; j++)
{
float y = j;
objects.push_back(Object(triangleVertices, Vector3((x), (-2.0f), (y)), gDevice, fromFile.getImageFile(), "cube_box_NormalMap.png", objNr++));
}
}*/
int maxZ = terrain->getLength();
int maxX = terrain->getWidth();
for (int i = 1; i < objects.size(); i++)
{
float highest = 0;
for (int j = 0; j < 4; j++)//selecting the highest pos in the square
{
float compare = terrain->getY(
(int)floorf(objects[i].getPosition().x + j),
(int)floorf(objects[i].getPosition().z + j));
if (highest < compare)
{
highest = compare;
}
}
objects[i].setPosY(highest);
}
quadTree.setTreeData(objects); //splits all the objects into the quads in the quadtree
#pragma endregion
}