Project

General

Profile

« Previous | Next » 

Revision af27df87

Added by Leszek Koltunski about 7 years ago

A lot of different fixes.

A lot of issues still there:

1) if we only render part of the tree, tree isomorphism will sometimes not work correctly
2) when we change Effects that are inside Trees mid-render, even if we detach() the affected parts of the Tree first, for the last frame the new Effects will be used
3) Something is wrong wil the System FBOs after app restart (Blur & MultiBlur apps work erratically)

View differences:

src/main/java/org/distorted/library/DistortedSurface.java
38 38
  private static boolean mToDo = false;
39 39
  private static LinkedList<DistortedSurface> mDoneList = new LinkedList<>();
40 40
  private static LinkedList<DistortedSurface> mToDoList = new LinkedList<>();
41
  private static long mNextID = 0;
41
  private static long mNextClientID = 0;
42
  private static long mNextSystemID = 0;
42 43

  
43 44
  private long mID;
44 45
  private boolean mMarked;
46
  private boolean mSystem;
45 47
  int[] mColorH = new int[1];
46 48
  int mSizeX, mSizeY;  // in screen space
47 49

  
......
93 95
    for(int i=0; i<num; i++)
94 96
      {
95 97
      surface = mDoneList.removeFirst();
98
      if( surface.mSystem ) mToDoList.add(surface);
99
      }
100

  
101
    num = mToDoList.size();
102

  
103
    for(int i=0; i<num; i++)
104
      {
105
      surface = mToDoList.get(i);
96 106

  
97
      if( !surface.mMarked )
107
      if( !surface.mSystem )
98 108
        {
99
        surface.recreate();
100
        mToDoList.add(surface);
109
        mDoneList.remove(i);
110
        i--;
111
        num--;
101 112
        }
102 113
      }
103 114

  
104
    mToDo = true;
105
    mNextID = 0;
115
    mToDo = (num>0);
116
    mNextClientID = 0;
106 117
    }
107 118

  
108 119
///////////////////////////////////////////////////////////////////////////////////////////////////
......
118 129

  
119 130
///////////////////////////////////////////////////////////////////////////////////////////////////
120 131

  
121
  DistortedSurface(int width, int height, int color)
132
  @SuppressWarnings("unused")
133
  static void debugLists()
134
    {
135
    android.util.Log.e("Surface", "Done list:");
136
    debugList(mDoneList);
137
    android.util.Log.e("Surface", "ToDo list:");
138
    debugList(mToDoList);
139
    }
140

  
141
///////////////////////////////////////////////////////////////////////////////////////////////////
142

  
143
  private static void debugList(LinkedList<DistortedSurface> list)
144
    {
145
    DistortedSurface surface;
146
    String str;
147

  
148
    int num = list.size();
149

  
150
    for(int i=0; i<num; i++)
151
      {
152
      surface = list.get(i);
153

  
154
      if( surface instanceof DistortedFramebuffer ) str = (i+": Framebuffer ");
155
      else if( surface instanceof DistortedTexture) str = (i+": Texture     ");
156
      else if( surface instanceof DistortedScreen ) str = (i+": Screen      ");
157
      else                                          str = (i+": UNKNOWN     ");
158

  
159
      str += ("("+surface.getWidth()+","+surface.getHeight()+") surfaceID:"+surface.getID());
160

  
161
      android.util.Log.e("Surface", str);
162
      }
163
    }
164

  
165
///////////////////////////////////////////////////////////////////////////////////////////////////
166

  
167
  DistortedSurface(int width, int height, int color, boolean system)
122 168
    {
123 169
    mSizeX    = width ;
124 170
    mSizeY    = height;
125 171
    mColorH[0]= color;
126 172
    mMarked   = false;
127
    mID       = mNextID++;
173
    mID       = system ? --mNextSystemID : ++mNextClientID;
174
    mSystem   = system;
128 175

  
129 176
    if( color!=DONT_CREATE )
130 177
      {

Also available in: Unified diff