/[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.18 by jvk, Tue Oct 8 15:12:29 2002 UTC revision 1.19 by jvk, Tue Oct 8 16:09:54 2002 UTC
# Line 54  def getCachedTexture(args): Line 54  def getCachedTexture(args):
54    
55    
56  class NamedTexture:  class NamedTexture:
57      def __init__(self, name, args):      def __init__(self, dict):
58          print "Generating texture: ",name, args          # Add default values below
59          #self.texture = GL.createTexture()          self.continuous = 1
60          #res = self.texture.shade(*args)  
61          #print "SHADER: ", res, self.texture.getTexId()          # Update from specified values
62          self.texture = getCachedTexture(args)          self.__dict__.update(dict)
63          self.name = name          
64            print "Generating texture: ", self.name, self.args
65            self.texture = getCachedTexture(self.args)
66      def getTexId(self):      def getTexId(self):
67          return self.texture.getTexId()          return self.texture.getTexId()
68      def getName(self):      def getName(self):
# Line 73  def init(): Line 75  def init():
75      global initialized      global initialized
76      initialized = 1      initialized = 1
77      global ptextures      global ptextures
78      ptextures["RGB2"] = [      ptextures["RGB2"] = map(NamedTexture, [
79          apply(NamedTexture, i) for i in [          {"name" : "rgbw1",
80          ("rgbw1", [tres, tres, 0, 3, "RGB", "RGB",           "args" : [tres, tres, 0, 3, "RGB", "RGB", "fnoise",
81                     "fnoise", ["scale", "2.5", "freq", "1", "df", "2", "bias", "0.5"]]),                     ["scale", "2.5", "freq", "1", "df", "2", "bias", "0.5"]],
82          ("rgbw2", [tres, tres, 0, 3, "RGB", "RGB",           },
83                     "fnoise", ["scale", ".43", "freq", "1", "df", "2", "bias", "0.5", "seed", "1412"]]),          
84                    {"name" : "rgbw2",
85          ("turb", [tres, tres, 0, 3, "RGB", "RGB",           "args" : [tres, tres, 0, 3, "RGB", "RGB", "fnoise",
86                    "fnoise", ["turb", "1", "scale", ".3", "freq", "1", "freq2", "100", "df", "2", "bias", "0"]]),                     ["scale", ".43", "freq", "1", "df", "2", "bias", "0.5",
87                                "seed", "1412"]],
88          ("pyramid", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "0"]]),           },
89          ("checkerboard", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "1"]]),          
90          ("cone", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "2"]]),          {"name" : "turb",
91          ("checkerboard2", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "3"]]),           "args" : [tres, tres, 0, 3, "RGB", "RGB", "fnoise",
92          ("saw", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "4"]]),                     ["turb", "1", "scale", ".3", "freq", "1",
93          ("triangle", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "5"]]),                      "freq2", "100", "df", "2", "bias", "0"]],
94          ]]           },
95            
96            {"name" : "pyramid",
97             "args" : [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "0"]],
98             },
99            
100            {"name" : "checkerboard",
101             "args" : [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "1"]],
102             "continuous" : 0,
103             },
104            
105            {"name" : "cone",
106             "args" : [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "2"]],
107             },
108            
109            {"name" : "checkerboard2",
110             "args" : [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "3"]],
111             "continuous" : 0,
112             },
113            
114            {"name" : "saw",
115             "args" : [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "4"]],
116             "continuous" : 0,
117             },
118            
119            {"name" : "triangle",
120             "args" : [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "5"]],
121             },
122            ])
123            
124  def getPaperTexture(type, gen):  def getPaperTexture(type, gen):
125      return selectRandom(ptextures[type], gen)      return selectRandom(ptextures[type], gen)

Legend:
Removed from v.1.18  
changed lines
  Added in v.1.19

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