本文整理汇总了C++中Cube::getFace方法的典型用法代码示例。如果您正苦于以下问题:C++ Cube::getFace方法的具体用法?C++ Cube::getFace怎么用?C++ Cube::getFace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cube
的用法示例。
在下文中一共展示了Cube::getFace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateDeletedVoxelNeighbors
void updateDeletedVoxelNeighbors(int x, int y, int z, std::vector<Triangle>& v, T empty) {
int offset[6][3] = {
{ 0, -1, 0 },
{ 0, 1, 0 },
{ -1, 0, 0 },
{ 0, 0, 1 },
{ 1, 0, 0 },
{ 0, 0, -1 }
};
for(int i = 0; i < 6; ++i) {
int xx = x + offset[i][0];
int yy = y + offset[i][1];
int zz = z + offset[i][2];
if(validPos(xx, yy, zz) && get(xx, yy, zz) != 0 && shouldGeneratePoly(xx, yy, zz, Cube::oppositeFace(i), empty)) {
TriangleRun* run = &triangle_run[index(xx, yy, zz)];
while(run->next) {
run = run->next;
}
TriangleRun* new_run = new TriangleRun;
new_run->start = v.size();
new_run->end = (int)v.size() - 1;
Cube c;
c.x_size = grid_dx;
c.y_size = grid_dy;
c.z_size = grid_dz;
c.setPos(glm::vec3(xx * grid_dx, yy * grid_dy, zz * grid_dz));
Quad q;
Triangle a, b;
c.getFace(Cube::oppositeFace(i)).triangulate(a, b);
v.push_back(a);
v.push_back(b);
new_run->end += 2;
run->next = new_run;
}
}
}
示例2: triangulate
std::vector<Triangle> triangulate(T empty) {
T* ptr = data;
std::vector<Triangle> t;
for(int z = 0; z < z_size; ++z) {
for(int y = 0; y < y_size; ++y) {
for(int x = 0; x < x_size; ++x) {
if(*ptr != empty) {
int pos = ptr - data;
triangle_run[pos].start = t.size();
triangle_run[pos].end = (int)t.size() - 1;
for(int i = 0; i < 6; ++i) {
Cube c;
c.x_size = grid_dx;
c.y_size = grid_dy;
c.z_size = grid_dz;
c.setPos(glm::vec3(x * grid_dx, y * grid_dy, z * grid_dz));
if(shouldGeneratePoly(x, y, z, i, empty)) {
Quad q;
Triangle a, b;
c.getFace(i).triangulate(a, b);
t.push_back(a);
t.push_back(b);
triangle_run[pos].end += 2;
}
}
}
++ptr;
}
}
}
return t;
}