gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx demo/texlab.py libpaper/textures.py lib...


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx demo/texlab.py libpaper/textures.py lib...
Date: Tue, 08 Oct 2002 06:29:53 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/08 06:29:53

Modified files:
        gfx/demo       : texlab.py 
        gfx/libpaper   : textures.py 
        gfx/libtexture : geometric.texture 

Log message:
        Add 4=saw and 5=triangle geometric.texture types

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/texlab.py.diff?tr1=1.3&tr2=1.4&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/textures.py.diff?tr1=1.16&tr2=1.17&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/geometric.texture.diff?tr1=1.1&tr2=1.2&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/texlab.py
diff -c gzz/gfx/demo/texlab.py:1.3 gzz/gfx/demo/texlab.py:1.4
*** gzz/gfx/demo/texlab.py:1.3  Fri Oct  4 09:18:18 2002
--- gzz/gfx/demo/texlab.py      Tue Oct  8 06:29:52 2002
***************
*** 3,9 ****
  
  import math
  
! tex = GL.createTexture()
  
  
  #tex.shade(256, 256, 0, 3, "RGB", "RGB", "fnoise",
--- 3,9 ----
  
  import math
  
! #tex = GL.createTexture()
  
  
  #tex.shade(256, 256, 0, 3, "RGB", "RGB", "fnoise",
***************
*** 11,23 ****
  #tex.shade(256, 256, 0, 3, "RGB", "RGB", "fnoise",
  #          ["scale", "2.5", "freq", "1", "df", "2", "bias", "0.5"])
  
! tex.shade(256, 256, 0, 4, "RGBA", "RGBA", "geometric", ["type", "0"])
! 
  
  
  #tex.shade(256, 256, 0, 3, "RGB", "RGB", "fnoise",
  #          ["turb", "1", "scale", ".3", "freq", "1", "freq2", "100", "df", 
"2", "bias", "0"])
  
  
  class TexLabScene:
      def __init__(self):
--- 11,28 ----
  #tex.shade(256, 256, 0, 3, "RGB", "RGB", "fnoise",
  #          ["scale", "2.5", "freq", "1", "df", "2", "bias", "0.5"])
  
! #tex.shade(256, 256, 0, 4, "RGBA", "RGBA", "geometric", ["type", "4"])
  
  
  #tex.shade(256, 256, 0, 3, "RGB", "RGB", "fnoise",
  #          ["turb", "1", "scale", ".3", "freq", "1", "freq2", "100", "df", 
"2", "bias", "0"])
  
+ from gfx.libpaper.textures import getCachedTexture
+ 
+ tex = getCachedTexture([256, 256, 0, 4, "RGBA", "RGBA", "geometric", ["type", 
"5"]])
+ 
+ 
+ 
  
  class TexLabScene:
      def __init__(self):
***************
*** 29,35 ****
        putnoc(vs, background((0.5,0.5,0.5)))
  
  
!       cs = vs.coords.affineCoordsys(0, 1, 100, 100, 400, 0, 0, 400)
          vs.matcher.add(cs, "foo")
  
        vs.map.put(getDList("""
--- 34,40 ----
        putnoc(vs, background((0.5,0.5,0.5)))
  
  
!       cs = vs.coords.affineCoordsys(0, 1, 100, 100, 256, 0, 0, 256)
          vs.matcher.add(cs, "foo")
  
        vs.map.put(getDList("""
Index: gzz/gfx/libpaper/textures.py
diff -c gzz/gfx/libpaper/textures.py:1.16 gzz/gfx/libpaper/textures.py:1.17
*** gzz/gfx/libpaper/textures.py:1.16   Mon Oct  7 12:29:29 2002
--- gzz/gfx/libpaper/textures.py        Tue Oct  8 06:29:52 2002
***************
*** 87,92 ****
--- 87,94 ----
          ("checkerboard", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", 
"1"]]),
          ("cone", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "2"]]),
          ("checkerboard2", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", 
"3"]]),
+         ("saw", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", "4"]]),
+         ("triangle", [64, 64, 0, 3, "RGB", "RGB", "geometric", ["type", 
"5"]]),
          ]]
      
  def getPaperTexture(type, gen):
Index: gzz/gfx/libtexture/geometric.texture
diff -c gzz/gfx/libtexture/geometric.texture:1.1 
gzz/gfx/libtexture/geometric.texture:1.2
*** gzz/gfx/libtexture/geometric.texture:1.1    Mon Sep 30 12:23:21 2002
--- gzz/gfx/libtexture/geometric.texture        Tue Oct  8 06:29:52 2002
***************
*** 37,42 ****
--- 37,51 ----
    return x < .5 && y < .5;
  }
  
+ float saw(float x) {
+   return x - floor(x);
+ }
+ 
+ float triangle(float x) {
+   x -= floor(x);
+   return 1 - 2 * fabs(x - .5);
+ }
+ 
  void GENERATE(TextureParam *params, int width, int height, int depth, int 
components, float *data) {
       FPARAM(type, 0)
      if(components > 4) return;
***************
*** 74,79 ****
--- 83,100 ----
          if (components >= 2) data[ind++] = checkerboard2(x + .5, y);
          if (components >= 3) data[ind++] = checkerboard2(x, y + .5);
          if (components >= 4) data[ind++] = checkerboard2(x + .5, y + .5);
+         break;
+       case 4:
+         if (components >= 1) data[ind++] = saw(x);
+         if (components >= 2) data[ind++] = saw(1 - x);
+         if (components >= 3) data[ind++] = saw(y);
+         if (components >= 4) data[ind++] = saw(1 - y);
+         break;
+       case 5:
+         if (components >= 1) data[ind++] = triangle(x);
+         if (components >= 2) data[ind++] = triangle(.5 + x);
+         if (components >= 3) data[ind++] = triangle(y);
+         if (components >= 4) data[ind++] = triangle(.5 + y);
          break;
          
        }




reply via email to

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