/[gzz]/gzz/gfx/libpaper/texcache.py
ViewVC logotype

Diff of /gzz/gfx/libpaper/texcache.py

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

revision 1.2 by jvk, Fri Oct 11 11:08:42 2002 UTC revision 1.3 by jvk, Fri Oct 25 08:28:05 2002 UTC
# Line 13  import os Line 13  import os
13  if not globals().has_key("texcache"):  if not globals().has_key("texcache"):
14      texcache = {}      texcache = {}
15            
16  def getCachedTexture(args):  def getCachedTexture(args, shade_all_levels = 0):
17      global texcache      global texcache
18    
19      name = args[6]      name = args[6]
# Line 27  def getCachedTexture(args): Line 27  def getCachedTexture(args):
27      if srctime > bintime:      if srctime > bintime:
28          os.system("make -C gfx/libtexture " + name + ".bin")          os.system("make -C gfx/libtexture " + name + ".bin")
29                    
30      key = str(args)      key = str((args,shade_all_levels))
31      if texcache.has_key(key) and texcache[(key,"ctime")] == srctime:      if texcache.has_key(key) and texcache[(key,"ctime")] == srctime:
32          #print "Returning cached texture"          #print "Returning cached texture"
33          return texcache[key]          return texcache[key]
34    
35      tex = GL.createTexture()      tex = GL.createTexture()
36      res = tex.shade(*args)      if shade_all_levels:
37            res = tex.shade_all_levels(*args)
38        else:
39            res = tex.shade(*args)
40            
41      texcache[key] = tex      texcache[key] = tex
42      texcache[(key,"ctime")] = srctime      texcache[(key,"ctime")] = srctime
43      print "SHADER: ", res, tex.getTexId()      print "SHADER: ", res, tex.getTexId()

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

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