/[gzz]/gzz/gzz/gfx/gl/MipzipLoader.java
ViewVC logotype

Diff of /gzz/gzz/gfx/gl/MipzipLoader.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by tjl, Fri Jan 17 19:44:34 2003 UTC revision 1.9 by tjl, Sat Jan 18 13:30:58 2003 UTC
# Line 201  public class MipzipLoader { Line 201  public class MipzipLoader {
201                                  Background bg, float priority) {                                  Background bg, float priority) {
202          if(dbg) pa("MipzipLoader "+this+" goal "+level+          if(dbg) pa("MipzipLoader "+this+" goal "+level+
203                          " now at "+currentBaseLevel);                          " now at "+currentBaseLevel);
204          this.goalBaseLevel = level;          if(level != goalBaseLevel) {
205          this.bg = bg;              this.goalBaseLevel = level;
206          this.priority = priority;              this.bg = bg;
207          bg.addTask(r_runBg, priority);              this.priority = priority;
208                bg.addTask(r_runBg, priority);
209            }
210      }      }
211    
212      private Runnable r_runBg = new Runnable() {      private Runnable r_runBg = new Runnable() {
# Line 229  public class MipzipLoader { Line 231  public class MipzipLoader {
231                  try {                  try {
232                      levels[i].loadData();                      levels[i].loadData();
233                      AbstractUpdateManager.doWhenIdle(                      AbstractUpdateManager.doWhenIdle(
234                              levels[i], priority);                              levels[i], priority - .1f * i);
235                        AbstractUpdateManager.chg();
236                      bg.addTask(r_runBg, priority);                      bg.addTask(r_runBg, priority);
237                  } catch(IOException e) {                  } catch(IOException e) {
238                      pa("Exception while loading mipzip data "+e);                      pa("Exception while loading mipzip data "+e);
# Line 246  public class MipzipLoader { Line 249  public class MipzipLoader {
249      // If yes, discard and reschedule.      // If yes, discard and reschedule.
250      // Then, set base level and return.      // Then, set base level and return.
251      synchronized private void runGL() {      synchronized private void runGL() {
252          if(dbg) pa("MipzipLoader "+this+" runGL!!");          if(dbg) pa("MipzipLoader "+this+" runGL!! "+
253                            goalBaseLevel);
254          for(int i=0; i<goalBaseLevel && i < levels.length-1;          for(int i=0; i<goalBaseLevel && i < levels.length-1;
255                                                  i++) {                                                  i++) {
256              if(levels[i].state != STATE_NONE) {              if(levels[i].state != STATE_NONE) {
257                    if(dbg) pa("MipzipLoader "+this+" discard: "+
258                            i+" "+levels[i].state+" "+
259                            currentBaseLevel);
260                  if(currentBaseLevel <= i)                  if(currentBaseLevel <= i)
261                      setBaseLevel(i+1);                      setBaseLevel(i+1);
262                  levels[i].discard();                  levels[i].discard();
# Line 258  public class MipzipLoader { Line 265  public class MipzipLoader {
265                  return;                  return;
266              }              }
267          }          }
268            if(dbg) pa("MipzipLoader "+this+" no discards");
269    
270          // Find first texture that has not been teximaged.          // Find first texture that has not been teximaged.
271          for(int i=levels.length-1; i >= goalBaseLevel && i >= 0;          int i = levels.length-1;
272            for(;i >= goalBaseLevel && i >= 0;
273                      i--) {                      i--) {
274              if(levels[i].state != STATE_INTEXTURE) {              if(levels[i].state != STATE_INTEXTURE)
275                  setBaseLevel(i+1);                  break;
276              }          }
277    
278            if(dbg) pa("MipzipLoader "+this+" firstNotIn!! "+ i);
279            if(currentBaseLevel != i+1) {
280                setBaseLevel(i+1);
281                AbstractUpdateManager.chg();
282                return;
283          }          }
284      }      }
285    
# Line 380  public class MipzipLoader { Line 395  public class MipzipLoader {
395          }          }
396          bitsPerTexel = GL.bitsPerTexel(texFormat);          bitsPerTexel = GL.bitsPerTexel(texFormat);
397          if(bitsPerTexel < 0) {          if(bitsPerTexel < 0) {
398              if(dbg) pa("Warning: memory consumption for "+texFormat+" not known, assuming 32bpt");              if(dbg) pa("Warning: memory consumption for "+
399                            texFormat+" not known, assuming 32bpt");
400              bitsPerTexel = 32;              bitsPerTexel = 32;
401          }          }
402          currentBaseLevel = levels.length;          currentBaseLevel = levels.length;
403      }      }
404    
405        public String toString() {
406            StringBuffer b = new StringBuffer();
407            b.append(super.toString());
408            b.append("  ");
409            for(int i=0; i<levels.length; i++)
410                b.append(levels[i].state);
411            return b.toString();
412        }
413    
414  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26