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

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

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

revision 1.24 by jvk, Thu Oct 10 14:35:26 2002 UTC revision 1.25 by jvk, Fri Oct 11 10:37:58 2002 UTC
# Line 17  isNV2X = 0 Line 17  isNV2X = 0
17    
18  ptextures = {}  ptextures = {}
19    
20  # XXX: where should this code be? --------------  from gfx.libpaper.texcache import getCachedTexture
 from gzz.gfx.gl import GL  
 from gfx.libutil.myimport import get_file_ctime  
 import os  
 if "texcache" not in globals().keys():  
     texcache = {}  
       
 def getCachedTexture(args):  
     global texcache  
   
     name = args[6]  
     file = "gfx/libtexture/" + name  
     binfile = file + ".bin"  
     srcfile = file + ".texture"  
   
     bintime = get_file_ctime(binfile)  
     srctime = get_file_ctime(srcfile)  
   
     if srctime > bintime:  
         os.system("make -C gfx/libtexture " + name + ".bin")  
         bintime = get_file_ctime(binfile)  
           
     key = str(args)  
     if texcache.has_key(key) and texcache[(key,"ctime")] == srctime:  
         #print "Returning cached texture"  
         return texcache[key]  
   
     tex = GL.createTexture()  
     res = tex.shade(*args)  
     texcache[key] = tex  
     texcache[(key,"ctime")] = srctime  
     print "SHADER: ", res, tex.getTexId()  
     return tex  
 # ----------------------------------------------  
   
21    
22  class NamedTexture:  class NamedTexture:
23      def __init__(self, dict):      def __init__(self, dict):

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

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