Project

General

Profile

« Previous | Next » 

Revision 178983f4

Added by Leszek Koltunski over 1 year ago

Remove the requirement that not-postprocessed children in the render scene must be in the first bucket.
Seriously simplify renderChildren().

View differences:

src/main/java/org/distorted/library/main/InternalChildrenList.java
99 99
// Can make this logarithmic but the typical number of children is very small anyway.
100 100
//
101 101
// We want to keep same buckets next to each other, while avoiding changes in order of the children
102
// (if possible!) We want to keep bucket=0 (i.e. the non-postprocessed children) at the beginning.
102
// (if possible!)
103
// 2022/10/25: removed keeping bucket 0 (i.e. non-postprocessed children) always in the front -
104
// we don't need it (given the fixes to renderChildren() )
103 105

  
104 106
  private void addSortingByBuckets(DistortedNode newChild)
105 107
    {
106 108
    int i;
107 109
    long bucket = newChild.getBucket();
108
    boolean sameBucket = false;
110
    boolean thisSame,lastSame = false;
109 111

  
110 112
    for(i=0; i<mNumChildren; i++)
111 113
      {
112
      if( mChildren.get(i).getBucket() == bucket )
113
        {
114
        sameBucket=true;
115
        }
116
      else if( sameBucket || bucket==0 )
117
        {
118
        break;
119
        }
114
      thisSame= (mChildren.get(i).getBucket()==bucket);
115
      if( lastSame && !thisSame ) break;
116
      lastSame = thisSame;
120 117
      }
121 118

  
122 119
    mChildren.add(i,newChild);

Also available in: Unified diff