/[gzz]/gzz/gfx/demo/irregu4.py
ViewVC logotype

Diff of /gzz/gfx/demo/irregu4.py

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

revision 1.3 by jvk, Mon Nov 11 14:51:09 2002 UTC revision 1.4 by jvk, Mon Nov 11 15:37:13 2002 UTC
# Line 29  class IrreguScene: Line 29  class IrreguScene:
29          self.xs = 1          self.xs = 1
30          self.ys = 1          self.ys = 1
31          self.scale = 1          self.scale = 1
32            
33            self.flags = 255
34    
35            self.initcode()
36    
37        def initcode(self):
38          code = combinercode("""          code = combinercode("""
39                  PushAttrib ENABLE_BIT TEXTURE_BIT                  PushAttrib ENABLE_BIT TEXTURE_BIT
40                    
# Line 191  class IrreguScene: Line 196  class IrreguScene:
196          border1 = .5          border1 = .5
197          ripple_scale = .25          ripple_scale = .25
198    
199          self.inner = GLRen.createIrregularEdge(          SLICE = (SLICE_2D, SLICE_1D)[self.flags >> 4 & 1]
200              texscale, linewidth, scale_pow, border0, border1, ripple_scale,  
             "1 1 1 1", "0 0 0 0", 0, 0,  
             Y_SECCOLOR + SLICE_1D,  
             inner_code, 1.0);  
201          self.outer = GLRen.createIrregularEdge(          self.outer = GLRen.createIrregularEdge(
202              texscale, linewidth, scale_pow, border0, border1, ripple_scale,              texscale, linewidth, scale_pow, border0, border1, ripple_scale,
203              "1 1 1 1", "0 0 0 0", 3, 0,              "1 1 1 1", "0 0 0 0", 3, 0,
204              Y_SECCOLOR + SLICE_1D + DOTVEC_COLOR + INTERP_DOTVEC,              Y_SECCOLOR + SLICE + DOTVEC_COLOR + INTERP_DOTVEC,
205              outer_code, 1.0);              outer_code, 1.0);
206    
207          if (GL.getGLFloat("MAX_GENERAL_COMBINERS_NV")[0] >= 4 and          if (GL.getGLFloat("MAX_GENERAL_COMBINERS_NV")[0] >= 4 and
# Line 210  class IrreguScene: Line 212  class IrreguScene:
212              self.outer = GLRen.createIrregularEdge(              self.outer = GLRen.createIrregularEdge(
213                  texscale, linewidth, scale_pow, border0, border1, ripple_scale,                  texscale, linewidth, scale_pow, border0, border1, ripple_scale,
214                  "1 1 1 1", "0 0 0 0", 0, 1,                  "1 1 1 1", "0 0 0 0", 0, 1,
215                  Y_SECCOLOR + SLICE_1D,                  Y_SECCOLOR + SLICE,
216                  outer_code, 1.0);                  outer_code, 1.0);
217    
218            stdcode = """
219                PushAttrib ENABLE_BIT TEXTURE_BIT
220                BindTexture TEXTURE_2D %s
221                TexParameter TEXTURE_2D TEXTURE_MIN_FILTER LINEAR_MIPMAP_LINEAR
222                TexParameter TEXTURE_2D TEXTURE_MAG_FILTER LINEAR
223                Enable TEXTURE_2D
224                TexEnv TEXTURE_ENV TEXTURE_ENV_MODE ADD
225                Enable ALPHA_TEST
226                AlphaFunc GEQUAL 1.0
227                """  % texINTENSITY.getTexId()
228                    
229            if (self.flags & 1) == 0:
230                stdcode += "Disable TEXTURE_2D\n"
231            if (self.flags & 4) == 0:
232                stdcode += "Disable ALPHA_TEST\n"
233                
234            self.inner = GLRen.createIrregularEdge(
235                texscale, linewidth, scale_pow, border0, border1, ripple_scale,
236                ("0 0 0 0", "1 1 1 1")[self.flags >> 1 & 1], "0 0 0 0", 0, 0,
237                SLICE + Y_COLOR, stdcode, 1.0);
238    
239    
240      def scene(self, vs):      def scene(self, vs):
241          putnoc(vs, self.bg)          putnoc(vs, self.bg)
242    
# Line 230  class IrreguScene: Line 254  class IrreguScene:
254                                         self.scale * 150)                                         self.scale * 150)
255          vs.matcher.add(cs1, "1")          vs.matcher.add(cs1, "1")
256    
257          vs.map.put(self.outer, cs1, cs2)          if self.flags & 8:
258          vs.map.put(self.inner, cs1, cs2)              vs.map.put(self.outer, cs1, cs2)
259    
260            if self.flags & 7:
261                vs.map.put(self.inner, cs1, cs2)
262    
263            print "1: ADD TEXTURE", self.flags >> 0& 1
264            print "2: ADD COLOR", self.flags >> 1 & 1
265            print "3: ALPHA_TEST", self.flags >> 2 & 1
266            print "4: OUTER EDGE", self.flags >> 3 & 1
267            print "5: 1D SLICE", self.flags >> 4 & 1
268    
269      def key(self, k):      def key(self, k):
270          if 0: pass          if 0: pass
# Line 249  class IrreguScene: Line 282  class IrreguScene:
282          elif k == "Y": self.ys -= .1          elif k == "Y": self.ys -= .1
283          elif k == "+": self.scale += .1          elif k == "+": self.scale += .1
284          elif k == "-": self.scale -= .1          elif k == "-": self.scale -= .1
285            elif "1" <= k <= "9":
286                self.flags ^= 1 << int(k) - 1
287                self.initcode()
288            
289    
290    
291  currentScene = IrreguScene()  currentScene = IrreguScene()

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

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