Esempio n. 1
0
 @Override
 public void sortChildren(final IEntityComparator pEntityComparator) {
   if (this.mChildren == null) {
     return;
   }
   ZIndexSorter.getInstance().sort(this.mChildren, pEntityComparator);
 }
Esempio n. 2
0
 @Override
 public void sortChildren(final boolean pImmediate) {
   if (this.mChildren == null) {
     return;
   }
   if (pImmediate) {
     ZIndexSorter.getInstance().sort(this.mChildren);
   } else {
     this.mChildrenSortPending = true;
   }
 }
Esempio n. 3
0
  protected void onManagedDraw(final GLState pGLState, final Camera pCamera) {
    pGLState.pushModelViewGLMatrix();
    {
      this.onApplyTransformations(pGLState);

      final SmartList<IEntity> children = this.mChildren;
      if ((children == null) || !this.mChildrenVisible) {
        /* Draw only self. */
        this.preDraw(pGLState, pCamera);
        this.draw(pGLState, pCamera);
        this.postDraw(pGLState, pCamera);
      } else {
        if (this.mChildrenSortPending) {
          ZIndexSorter.getInstance().sort(this.mChildren);
          this.mChildrenSortPending = false;
        }

        final int childCount = children.size();
        int i = 0;

        {
            /* Draw children behind this Entity. */
          for (; i < childCount; i++) {
            final IEntity child = children.get(i);
            if (child.getZIndex() < 0) {
              child.onDraw(pGLState, pCamera);
            } else {
              break;
            }
          }
        }

        /* Draw self. */
        this.preDraw(pGLState, pCamera);
        this.draw(pGLState, pCamera);
        this.postDraw(pGLState, pCamera);

        {
            /* Draw children in front of this Entity. */
          for (; i < childCount; i++) {
            try {
              children.get(i).onDraw(pGLState, pCamera);
            } catch (IndexOutOfBoundsException ex) {

            }
          }
        }
      }
    }
    pGLState.popModelViewGLMatrix();
  }