bool  QGraphicsEllipseItem_QtDShell::__override_isObscuredBy(const QGraphicsItem*  item0, bool static_call) const
{
    if (static_call) {
        return QGraphicsEllipseItem::isObscuredBy((const QGraphicsItem* )item0);
    } else {
        return isObscuredBy((const QGraphicsItem* )item0);
    }
}
Beispiel #2
0
//--------------------------------------------------------------
// count triangles in the blob
void BrickBlob::countTriangles(
  BrickBuffers& buffers)
{
  int cubeCount = 0;
  int shapeCount = 0;
  int transCount = 0;

  for (int x = 0; x < BRICKBLOB_CELLS; x++)
  {
    for (int y = 0; y < BRICKBLOB_CELLS; y++)
    {
      for (int z = 0; z < BRICKBLOB_CELLS; z++)
      {
        WORD brickType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y, z)];
        if (brickType == 0)
          continue;
        BrickDefn* brickDefn = m_brickSet->m_defns[MAJOR_CODE(brickType)];
        WORD otherType;

        switch (brickDefn->m_shape)
        {
          case SHAPE_CUBE:
            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x-1, y, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_XMIN))
            {
              if (brickDefn->m_hasTransparent)
                transCount++;  // rectangles
              else cubeCount++;  // rectangles
            }
            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x+1, y, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_XMAX))
            {
              if (brickDefn->m_hasTransparent)
                transCount++;  // rectangles
              else cubeCount++;  // rectangles
            }
            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y-1, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_YMIN))
            {
              if (brickDefn->m_hasTransparent)
                transCount++;  // rectangles
              else cubeCount++;  // rectangles
            }
            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y+1, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_YMAX))
            {
              if (brickDefn->m_hasTransparent)
                transCount++;  // rectangles
              else cubeCount++;  // rectangles
            }
            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y, z-1)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_ZMIN))
            {
              if (brickDefn->m_hasTransparent)
                transCount++;  // rectangles
              else cubeCount++;  // rectangles
            }
            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y, z+1)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_ZMAX))
            {
              if (brickDefn->m_hasTransparent)
                transCount++;  // rectangles
              else cubeCount++;  // rectangles
            }
            break;

          case SHAPE_SLAB:
          case SHAPE_CAP:
            // brickDefn for slabs and caps have sides set transparent so they will be
            // obscured only by another brick of the same type
            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x-1, y, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_XMIN))
              cubeCount++;  // rectangles

            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x+1, y, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_XMAX))
              cubeCount++;  // rectangles

            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y-1, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_YMIN))
              cubeCount++;  // rectangles

            // cap and slab are never obscured on top
            cubeCount++;  // rectangles

            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y, z-1)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_ZMIN))
              cubeCount++;  // rectangles

            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y, z+1)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_ZMAX))
              cubeCount++;  // rectangles
            break;

          case SHAPE_STAIR:
            // bottom of stair can be obscured, but sides and top depend
            // on orientation of stairs, so just draw them always
            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y-1, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_YMIN))
              cubeCount++;  // rectangles

            // always draw top (3 rects), left and right sides (2 rects each) and 
            // front and back (1 rect each)
            cubeCount += 3 + 2*2 + 2*1;  // rectangles
            break;

          case SHAPE_COLUMN:
            // sides of a column are never obscured
            cubeCount += 4;  // outside faces

            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y-1, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_YMIN))
              cubeCount++;  // rectangles

            otherType = m_bricks[BRICK_CELL(BRICKBLOB_SIZE, x, y+1, z)];
            if (!isObscuredBy(brickType, brickDefn, otherType, BRICK_FACE_YMAX))
              cubeCount++;  // rectangles
            break;

          case SHAPE_DEFN:
          {
            BrickSubDefn* subDefn = brickDefn->m_subDefns[MINOR_CODE(brickType)];
            if (subDefn == NULL)
              subDefn = brickDefn->m_subDefns[0];
            shapeCount += subDefn->m_shapeDefn->m_len;
            break;
          }
        }
      }
    }
  }

  buffers.m_cubeCount = cubeCount;
  buffers.m_shapeCount = shapeCount;
  buffers.m_transCount = transCount;
}
bool DhQGraphicsItemGroup::DvhisObscuredBy(const QGraphicsItem* x1) const {
  return isObscuredBy(x1);
}
bool DhQGraphicsEllipseItem::DvhisObscuredBy(const QGraphicsItem* x1) const {
  return isObscuredBy(x1);
}