gzz-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gzz-commits] gzz/gfx demo/gldemo.py demo/papertest.py demo/t...


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx demo/gldemo.py demo/papertest.py demo/t...
Date: Fri, 11 Oct 2002 06:37:59 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/11 06:37:58

Modified files:
        gfx/demo       : gldemo.py papertest.py texlab.py 
        gfx/libpaper   : papermill.py textures.py 
Added files:
        gfx/libpaper   : texcache.py 

Log message:
        Get rid of my_import in libpaper, just use standard import. All 
gfx.modules will get deleted and reloaded with "r", so do not store nontrivial 
data in modules. (There is a "__do_not_delete__" kluge for special modules, but 
such modules must reload their dependencies themselves)

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/gldemo.py.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/papertest.py.diff?tr1=1.39&tr2=1.40&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/texlab.py.diff?tr1=1.9&tr2=1.10&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texcache.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/papermill.py.diff?tr1=1.41&tr2=1.42&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/textures.py.diff?tr1=1.24&tr2=1.25&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/gldemo.py
diff -c gzz/gfx/demo/gldemo.py:1.41 gzz/gfx/demo/gldemo.py:1.42
*** gzz/gfx/demo/gldemo.py:1.41 Wed Oct  9 06:32:17 2002
--- gzz/gfx/demo/gldemo.py      Fri Oct 11 06:37:58 2002
***************
*** 229,251 ****
      print "RELOAD"
  
      if 1:
!         # Reload gfx.* modules
          mods = sys.modules.keys()
          mods.sort()
  
          # XXX: simply deleting the modules forces a reload,
          # but some modules may want to cache data in globals over reloads
!         #for mod in mods:
!         #    del sys.modules[mod]
  
          # XXX: need to reload twice so that "from foo import bar"
          # in a reloaded module can get the newer version even if
          # foo is later in the list and has not yet been reloaded
!         for iter in range(0,2):
!             for mod in mods:
!                 if mod[:4] == "gfx." and hasattr(sys.modules[mod], 
"__file__"):
!                     print "Reloading", mod
!                     reload(sys.modules[mod])
      
      try:
        exec open(scenefile) in globals(), globals()
--- 229,265 ----
      print "RELOAD"
  
      if 1:
!         # Force reload of all gfx.* modules
!         
          mods = sys.modules.keys()
          mods.sort()
  
          # XXX: simply deleting the modules forces a reload,
          # but some modules may want to cache data in globals over reloads
!         # so we check for a "__do_not_delete__" directive.
!         # Note: such modules must reload dependencies themselves
!         
!         for modname in mods:
!             mod = sys.modules[modname]
!             if hasattr(mod, "__do_not_delete__"):
!                 print "Reloading", modname
!                 reload(mod)
!                 
!         for modname in mods:
!             mod = sys.modules[modname]
!             if not hasattr(mod, "__do_not_delete__"):
!                 if modname[:4] == "gfx." and hasattr(mod, "__file__"):
!                     print "Deleting", modname
!                     del sys.modules[modname]
  
          # XXX: need to reload twice so that "from foo import bar"
          # in a reloaded module can get the newer version even if
          # foo is later in the list and has not yet been reloaded
!         #for iter in range(0,2):
!         #    for mod in mods:
!         #        if mod[:4] == "gfx." and hasattr(sys.modules[mod], 
"__file__"):
!         #            print "Reloading", mod
!         #            reload(sys.modules[mod])
      
      try:
        exec open(scenefile) in globals(), globals()
Index: gzz/gfx/demo/papertest.py
diff -c gzz/gfx/demo/papertest.py:1.39 gzz/gfx/demo/papertest.py:1.40
*** gzz/gfx/demo/papertest.py:1.39      Tue Oct  8 11:12:29 2002
--- gzz/gfx/demo/papertest.py   Fri Oct 11 06:37:58 2002
***************
*** 25,35 ****
  def ignore(s):
      return ""
  
- import gfx.libutil.myimport
- reload(gfx.libutil.myimport)
- from gfx.libutil.myimport import my_import
- 
- my_import("gfx.libpaper.papermill")
  from gfx.libpaper.papermill import ThePaperMill
  
  benchmark = 0
--- 25,30 ----
Index: gzz/gfx/demo/texlab.py
diff -c gzz/gfx/demo/texlab.py:1.9 gzz/gfx/demo/texlab.py:1.10
*** gzz/gfx/demo/texlab.py:1.9  Thu Oct 10 10:35:26 2002
--- gzz/gfx/demo/texlab.py      Fri Oct 11 06:37:58 2002
***************
*** 35,41 ****
      [2, 2, 0, 4, "RGBA", "RGBA", "geometric", ["type", "6"]],
      ]
  
! from gfx.libpaper.textures import getCachedTexture
  
  
  if not globals().has_key("ind"): ind = 0
--- 35,41 ----
      [2, 2, 0, 4, "RGBA", "RGBA", "geometric", ["type", "6"]],
      ]
  
! from gfx.libpaper.texcache import getCachedTexture
  
  
  if not globals().has_key("ind"): ind = 0
Index: gzz/gfx/libpaper/papermill.py
diff -c gzz/gfx/libpaper/papermill.py:1.41 gzz/gfx/libpaper/papermill.py:1.42
*** gzz/gfx/libpaper/papermill.py:1.41  Thu Oct 10 09:36:45 2002
--- gzz/gfx/libpaper/papermill.py       Fri Oct 11 06:37:58 2002
***************
*** 1,19 ****
! #initialized = 0
  
! import gfx.libutil.myimport
! reload(gfx.libutil.myimport)
! from gfx.libutil.myimport import my_import
! 
! my_import("gfx.libpaper.textures")
  from gfx.libpaper.textures import Textures
  
! my_import("gfx.libpaper.colors")
  from gfx.libpaper.colors import Colors
  
! my_import("gfx.libpaper.texcoords")
  from gfx.libpaper.texcoords import TexGenXYRepeatUnit
  
! my_import("gfx.libpaper.params")
  from gfx.libpaper.params import *
  
  from gzz.gfx.gl import GL,GLRen,Paper,PaperMill
--- 1,17 ----
! #import gfx.libutil.myimport
! #reload(gfx.libutil.myimport)
! #from gfx.libutil.myimport import my_import
  
! #my_import("gfx.libpaper.textures")
  from gfx.libpaper.textures import Textures
  
! #my_import("gfx.libpaper.colors")
  from gfx.libpaper.colors import Colors
  
! #my_import("gfx.libpaper.texcoords")
  from gfx.libpaper.texcoords import TexGenXYRepeatUnit
  
! #my_import("gfx.libpaper.params")
  from gfx.libpaper.params import *
  
  from gzz.gfx.gl import GL,GLRen,Paper,PaperMill
***************
*** 40,50 ****
      # XXX Should check separately for texture_shader2,
      # otherwise it'll be SLOW.
      if dbg: print "Using NV20 texture shaders"
!     my_import("gfx.libpaper.texops_NV2X")
      from gfx.libpaper.texops_NV2X import *    
  else:
      if dbg: print "Using unextended OpenGL texture accesses"
!     my_import("gfx.libpaper.texops_STD")
      from gfx.libpaper.texops_STD import *
  
  
--- 38,48 ----
      # XXX Should check separately for texture_shader2,
      # otherwise it'll be SLOW.
      if dbg: print "Using NV20 texture shaders"
!     #my_import("gfx.libpaper.texops_NV2X")
      from gfx.libpaper.texops_NV2X import *    
  else:
      if dbg: print "Using unextended OpenGL texture accesses"
!     #my_import("gfx.libpaper.texops_STD")
      from gfx.libpaper.texops_STD import *
  
  
***************
*** 56,72 ****
      if maxcomb < 4:
          # use NV10 version
          if dbg: print "Using NV10 combiners ",maxcomb
!         my_import("gfx.libpaper.texcomb_NV1X")
          from gfx.libpaper.texcomb_NV1X import *
      else:
          # use NV20 version
          if dbg: print "Using NV20 combiners ",maxcomb
!         my_import("gfx.libpaper.texcomb_NV2X")
          from gfx.libpaper.texcomb_NV2X import *
  else:
      # Must use OpenGL 1.1 specified calls.
      print "NEED FIX - DOES _NOT_ WORK : Using OpenGL 1.1 texenv and blending"
!     my_import("gfx.libpaper.texcomb_GL1_1")
      
  
  dbg = 0
--- 54,70 ----
      if maxcomb < 4:
          # use NV10 version
          if dbg: print "Using NV10 combiners ",maxcomb
!         #my_import("gfx.libpaper.texcomb_NV1X")
          from gfx.libpaper.texcomb_NV1X import *
      else:
          # use NV20 version
          if dbg: print "Using NV20 combiners ",maxcomb
!         #my_import("gfx.libpaper.texcomb_NV2X")
          from gfx.libpaper.texcomb_NV2X import *
  else:
      # Must use OpenGL 1.1 specified calls.
      print "NEED FIX - DOES _NOT_ WORK : Using OpenGL 1.1 texenv and blending"
!     #my_import("gfx.libpaper.texcomb_GL1_1")
      
  
  dbg = 0
***************
*** 110,117 ****
      pas.setTeardowncode("PopAttrib")
  
  class ThePaperMill(PaperMill):
-     #initialize()
- 
      def getPaper(self, seed, passmask=[1,1,1,1,1,1,1]):
          reg = Registry()
          
--- 108,113 ----
Index: gzz/gfx/libpaper/textures.py
diff -c gzz/gfx/libpaper/textures.py:1.24 gzz/gfx/libpaper/textures.py:1.25
*** gzz/gfx/libpaper/textures.py:1.24   Thu Oct 10 10:35:26 2002
--- gzz/gfx/libpaper/textures.py        Fri Oct 11 06:37:58 2002
***************
*** 17,57 ****
  
  ptextures = {}
  
! # XXX: where should this code be? --------------
! 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
! # ----------------------------------------------
! 
  
  class NamedTexture:
      def __init__(self, dict):
--- 17,23 ----
  
  ptextures = {}
  
! from gfx.libpaper.texcache import getCachedTexture
  
  class NamedTexture:
      def __init__(self, dict):




reply via email to

[Prev in Thread] Current Thread [Next in Thread]