Delete cube Faces one by one.

Software: Away3D 4.x

Babylon, Jr. Member
Posted: 09 October 2012 02:36 AM   Total Posts: 39

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 (0<= _segmentsWi++) {
    outer_pos 
= -hw i*dw;
    
    for (
0<= _segmentsDj++) {
     
// 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 (
&& j{
      tl 
inc * ((i-1) * (_segmentsD 1) + (j-1));
      
tr inc * (* (_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

   
   

X

Away3D Forum

Member Login

Username

Password

Remember_me



X