Greetings,
So a cube has 6 faces. I’d like to be able to delete a particular face at any time. How would I go about doing this? Vertice data?
So I’ve been looking at CubeGeometry.as and I’ve learned a little bit about the code..
And I end up with this
for (i = 0; i <= _segmentsW; i++) {
outer_pos = -hw + i*dw;
for (j = 0; j <= _segmentsD; j++) {
// top
vertexNormals[vidx] = 0;
vertexTangents[vidx] = 1;
vertices[vidx++] = outer_pos;
vertexNormals[vidx] = 1;
vertexTangents[vidx] = 0;
vertices[vidx++] = hh;
vertexNormals[vidx] = 0;
vertexTangents[vidx] = 0;
vertices[vidx++] = -hd + j*dd;
// bottom
vertexNormals[vidx] = 0;
vertexTangents[vidx] = 1;
vertices[vidx++] = outer_pos;
vertexNormals[vidx] = -1;
vertexTangents[vidx] = 0;
vertices[vidx++] = -hh;
vertexNormals[vidx] = 0;
vertexTangents[vidx] = 0;
vertices[vidx++] = -hd + j*dd;
if (i && j) {
tl = inc + 2 * ((i-1) * (_segmentsD + 1) + (j-1));
tr = inc + 2 * (i * (_segmentsD + 1) + (j-1));
bl = tl + 2;
br = tr + 2;
indices[fidx++] = tl;
indices[fidx++] = bl;
indices[fidx++] = br;
indices[fidx++] = tl;
indices[fidx++] = br;
indices[fidx++] = tr;
}
}
}
inc += 2*(_segmentsW + 1)*(_segmentsD + 1);
target.updateVertexData(vertices);
target.updateVertexNormalData(vertexNormals);
target.updateVertexTangentData(vertexTangents);
target.updateIndexData(indices);
Basically delete all the other faces, it seems the if i and j statement is what causes the face to be drawn, and it seems any given face needs both the
//top //bottom
commented codes to draw any 1 face.
So now my code inside cubegeometry draws just the bottom face..
Now when I compare poly count, it remains the same as if it drew the whole cube.
So what causes the poly count to stay at 12? And am I getting a performance boost by just drawing a certain peice of the cube even though the poly count stays the same?
Thanks,
B