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

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

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

revision 1.17 by jvk, Wed Oct 9 14:07:27 2002 UTC revision 1.18 by jvk, Thu Oct 10 14:14:37 2002 UTC
# Line 4  Line 4 
4  from gfx.libutil import nvcode  from gfx.libutil import nvcode
5    
6  from gfx.libcolor.spaces import RGBtoLAB  from gfx.libcolor.spaces import RGBtoLAB
7    
8    from math import exp
9            
10  class TransparentCombinerPass:  class TransparentCombinerPass:
11      def setupCode(self, texinputs, texscales, colors, rnd, trans = 0):      def setupCode(self, texinputs, texscales, colors, rnd, trans = 0):
# Line 51  class TransparentCombinerPass: Line 53  class TransparentCombinerPass:
53          type = rnd.nextInt(3)          type = rnd.nextInt(3)
54          # types: 0=BAND-LIKE, 1=3-COL-LERP, 2=FRACTION-LINE          # types: 0=BAND-LIKE, 1=3-COL-LERP, 2=FRACTION-LINE
55    
56            # Random scaling of (dot) products
57            rndscale1 = exp(.3*rnd.nextGaussian())
58            rndscale2 = exp(.3*rnd.nextGaussian())
59    
60          def avg(*args):          def avg(*args):
61              sum = 0              sum = 0
62              for arg in args: sum += arg              for arg in args: sum += arg
# Line 58  class TransparentCombinerPass: Line 64  class TransparentCombinerPass:
64                    
65          # Then, select the combiner path type.          # Then, select the combiner path type.
66          if type == 0:          if type == 0:
67              scale = nvcode.combinerscale(avg(*texscales) * 8.0)              scale = nvcode.combinerscale(avg(*texscales) * 8.0 * rndscale1)
68    
69              # Band-like texture.              # Band-like texture.
70              #              #
# Line 101  class TransparentCombinerPass: Line 107  class TransparentCombinerPass:
107                  FCI G %(finalG)s UNSIGNED_INVERT_NV BLUE                  FCI G %(finalG)s UNSIGNED_INVERT_NV BLUE
108              """)              """)
109          elif type == 1:          elif type == 1:
110              scale = nvcode.combinerscale(avg(*texscales) * 8.0)              scale = nvcode.combinerscale(avg(*texscales) * 8.0 * rndscale1)
111              alphascale = nvcode.combinerscale(1.0)              alphascale = nvcode.combinerscale(1.0)
112                            
113              # Interpolate between three colors:              # Interpolate between three colors:
# Line 149  class TransparentCombinerPass: Line 155  class TransparentCombinerPass:
155                  FCI G %(finalG)s ALPHA                  FCI G %(finalG)s ALPHA
156              """)              """)
157          else:          else:
158              scale = nvcode.combinerscale(avg(*texscales) * 4.0)              scale = nvcode.combinerscale(avg(*texscales) * 4.0 * rndscale1)
159    
160              # Interpolate on the fraction line c0,c1,c2:              # Interpolate on the fraction line c0,c1,c2:
161              # d0 = t0 . t1              # d0 = t0 . t1

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

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