/[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.25 by jvk, Fri Oct 11 10:37:58 2002 UTC revision 1.26 by jvk, Tue Oct 15 11:36:33 2002 UTC
# Line 28  class NamedTexture: Line 28  class NamedTexture:
28    
29          # Update from specified values          # Update from specified values
30          self.__dict__.update(dict)          self.__dict__.update(dict)
31            
32          print "Generating texture: ", self.name, self.args          # Generate textures lazily
33          self.texture = getCachedTexture(self.args)          if 0:
34                print "Generating texture: ", self.name, self.args
35                self.texture = getCachedTexture(self.args)
36    
37      def getTexId(self):      def getTexId(self):
38            if not hasattr(self, "texture"):
39                print "Generating texture: ", self.name, self.args
40                self.texture = getCachedTexture(self.args)
41          return self.texture.getTexId()          return self.texture.getTexId()
42    
43      def getName(self):      def getName(self):
44          return self.name          return self.name
45    
 tres = 128  
46    
47  initialized = 0  initialized = 0
48  def init():  def init():
49      global initialized      global initialized
50      initialized = 1      initialized = 1
51      global ptextures      global ptextures
52    
53        tres = 128
54      ptextures["RGB2"] = map(NamedTexture, filter(lambda dict: dict["name"] in [      ptextures["RGB2"] = map(NamedTexture, filter(lambda dict: dict["name"] in [
55          "rgbw1",          "rgbw1",
56          "rgbw2",          "rgbw2",
# Line 130  def init(): Line 138  def init():
138           "magfilter" : "NEAREST",           "magfilter" : "NEAREST",
139           },           },
140          ]))          ]))
141    
142        ptextures["DOT2"] = map(NamedTexture, [
143            { "name" : "dotprodn",
144              "args" : [512, 512, 0, 2,
145                        "SIGNED_HILO_NV", "HILO_NV",  # XXX signed
146                        "noise", ["type", "normal", "freq", "10", "scale", "0.1"]]
147              },
148            
149            { "name" : "dotprodt",
150              "args" : [512, 512, 0, 2,
151                        "SIGNED_HILO_NV", "HILO_NV",  # XXX signed
152                        "noise", ["type", "turbulence", "freq", "40"]] },
153            
154            { "name" : "dotprodw",
155              "args" : [512, 512, 0, 2,
156                        "SIGNED_HILO_NV", "HILO_NV",  # XXX signed
157                        "waves", ["abs", "1", "freq0", "2", "freq1", "3"]],
158              },
159                    #("dotprodrd", [128, 128, 0, 2,
160                    #              "SIGNED_HILO_NV", "HILO_NV",  # XXX signed
161                    #              "rd1", ["iter", "3000", "F", ".04", "k", ".06"]]),
162            ])
163            
164  def getPaperTexture(type, gen):  def getPaperTexture(type, gen):
165      return selectRandom(ptextures[type], gen)      return selectRandom(ptextures[type], gen)
# Line 180  class Textures: Line 210  class Textures:
210          return [ self.getPaperTexture(type, gen) for type in types ]          return [ self.getPaperTexture(type, gen) for type in types ]
211    
212  if 0:  if 0:
             rgbTextures = [  
                 #("debug", [512, 512, 0, 3,  
                 #          "RGB", "RGB",  
                 #          "debuggrid", []]),  
                 ("rgbn", [512, 512, 0, 3,  
                           "RGB", "RGB",  
                           "noise", ["type", "normal", "freq", "20", "bias", "0.5"]]),  
                 ("rgbl", [512, 512, 0, 3,  
                           "RGB", "RGB",  
                           "lines1", ["linewidth", "0.1"]]),  
                 ("rgbw", [512, 512, 0, 3,  
                           "RGB", "RGB",  
                           "waves", ["abs", "1", "freq0", "1", "freq1", "1"]]),  
                 ]  
   
213              rgb3DTextures = [              rgb3DTextures = [
214                  ("rgbw", [64, 64, 64, 1,                  ("rgbw", [64, 64, 64, 1,
215                            "LUMINANCE", "LUMINANCE",                            "LUMINANCE", "LUMINANCE",
# Line 205  if 0: Line 220  if 0:
220                                    
221                 ]                 ]
222    
             dotTextures = [  
                 ("dotprodn", [512, 512, 0, 2,  
                               "SIGNED_HILO_NV", "HILO_NV",  # XXX signed  
                               "noise", ["type", "normal", "freq", "10", "scale", "0.1"]]),  
                 ("dotprodt", [512, 512, 0, 2,  
                               "SIGNED_HILO_NV", "HILO_NV",  # XXX signed  
                               "noise", ["type", "turbulence", "freq", "40"]]),  
                 ("dotprodw", [512, 512, 0, 2,  
                               "SIGNED_HILO_NV", "HILO_NV",  # XXX signed  
                               "waves", ["abs", "1", "freq0", "2", "freq1", "3"]]),  
                 #("dotprodrd", [128, 128, 0, 2,  
                 #              "SIGNED_HILO_NV", "HILO_NV",  # XXX signed  
                 #              "rd1", ["iter", "3000", "F", ".04", "k", ".06"]]),  
                 ]  
               
             self.textures = {  
                 #"R2": [ NamedTexture(name, args) for (name, args) in rgbTextures ],  
                 "R3": [ NamedTexture(name, args) for (name, args) in rgb3DTextures ],                  
                 #"D2": [ NamedTexture(name, args) for (name, args) in dotTextures ],  
             }  
               

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

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