gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/libpaper papermill.py texops_NV2X.py te...


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/libpaper papermill.py texops_NV2X.py te...
Date: Tue, 15 Oct 2002 09:52:04 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/15 09:52:04

Modified files:
        gfx/libpaper   : papermill.py texops_NV2X.py texops_STD.py 
                         textures.py 

Log message:
        Use NV25 offset textures with random offset matrices

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/papermill.py.diff?tr1=1.50&tr2=1.51&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texops_NV2X.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/texops_STD.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libpaper/textures.py.diff?tr1=1.28&tr2=1.29&r1=text&r2=text

Patches:
Index: gzz/gfx/libpaper/papermill.py
diff -c gzz/gfx/libpaper/papermill.py:1.50 gzz/gfx/libpaper/papermill.py:1.51
*** gzz/gfx/libpaper/papermill.py:1.50  Tue Oct 15 08:03:48 2002
--- gzz/gfx/libpaper/papermill.py       Tue Oct 15 09:52:04 2002
***************
*** 64,85 ****
      
  dbg = 0
  
- def randvec(rnd): return [rnd.nextDouble() for i in range(0,3)]
- 
- def randunitvec(rnd):
-     x = 2 * rnd.nextDouble() - 1
-     y = 2 * rnd.nextDouble() - 1
-     z = 2 * rnd.nextDouble() - 1
-     m = 1./Math.sqrt(x*x+y*y+z*z)*.5
-     return [m * x + .5, m * y + .5, m * z + .5]
- 
- 
  def selectRandom(list, gen):
      return list[gen.nextInt(len(list))]
  
- def selectDet(list, type):
-     return ( list[type % len(list)], type / len(list) )
- 
  def setSolidPass(pas, color):
      pas.setSetupcode("""
          PushAttrib ENABLE_BIT TEXTURE_BIT
--- 64,72 ----
***************
*** 200,206 ****
              """
                  
          code += (
!             sh.setupCode() + 
              comb.setupCode(sh.getRGBoutputs(), sh.getRGBoutputscales(), 
colors, rnd, trans)
          )
  
--- 187,193 ----
              """
                  
          code += (
!             sh.setupCode(rnd) + 
              comb.setupCode(sh.getRGBoutputs(), sh.getRGBoutputscales(), 
colors, rnd, trans)
          )
  
Index: gzz/gfx/libpaper/texops_NV2X.py
diff -c gzz/gfx/libpaper/texops_NV2X.py:1.5 gzz/gfx/libpaper/texops_NV2X.py:1.6
*** gzz/gfx/libpaper/texops_NV2X.py:1.5 Tue Oct 15 08:24:26 2002
--- gzz/gfx/libpaper/texops_NV2X.py     Tue Oct 15 09:52:04 2002
***************
*** 40,50 ****
        ("T2", "RGB2"),
        ("T2", "RGB2"),
      ],
!     [   ("T2", "DSDT"),
!         ("O", "FOOBAR")
      ],
!     [   ("T2", "DSDT_HILO"),
!         ("OH", "FOOBAR")
      ]
  ]
  
--- 40,56 ----
        ("T2", "RGB2"),
        ("T2", "RGB2"),
      ],
!     [
!         ("T2", "DSDT"),
!         ("O", "RGB2"),
!         ("T2", "DSDT"),
!         ("O", "RGB2")
      ],
!     [
!         ("T2", "DSDT_HILO"),
!         ("OH", "RGB2"),
!         ("T2", "DSDT_HILO"),
!         ("OH", "RGB2"),
      ]
  ]
  
***************
*** 88,96 ****
      pass
  
  class ShaderPass:
!     def __init__(self, shaderType):
        self.st = shaderType
        self.tex = [None for texunit in shaderType]
      def getTextureTypes(self):
        "Get the texture type names (D2, R2 ...) for the texture units."
        return [texunit[1] for texunit in self.st]
--- 94,103 ----
      pass
  
  class ShaderPass:
!     def __init__(self, shaderType, maxaniso):
        self.st = shaderType
        self.tex = [None for texunit in shaderType]
+         self.maxaniso = maxaniso
      def getTextureTypes(self):
        "Get the texture type names (D2, R2 ...) for the texture units."
        return [texunit[1] for texunit in self.st]
***************
*** 99,105 ****
        return [shaderTexgenTypes[texunit[0]] for texunit in self.st]
      def setTexture(self, ind, tex):
        self.tex[ind] = tex
!     def setupCode(self):
        c = """
            Enable TEXTURE_SHADER_NV
        """
--- 106,112 ----
        return [shaderTexgenTypes[texunit[0]] for texunit in self.st]
      def setTexture(self, ind, tex):
        self.tex[ind] = tex
!     def setupCode(self, rnd):
        c = """
            Enable TEXTURE_SHADER_NV
        """
***************
*** 113,118 ****
--- 120,126 ----
                TexEnv TEXTURE_SHADER_NV SHADER_OPERATION_NV %(op)s
  
            """ % locals()
+ 
            if target != None:
                  texid = self.tex[t].getTexId()
                  minfilter = self.tex[t].minfilter
***************
*** 131,136 ****
--- 139,162 ----
                c += """
                    TexEnv TEXTURE_SHADER_NV PREVIOUS_TEXTURE_INPUT_NV TEXTURE%s
                """ % (self.st[t][2])
+ 
+             if shortOp in [ "O", "OH" ]:
+                 hyper = rnd.nextGaussian()
+                 mat = ( rnd.nextGaussian()*hyper,
+                         rnd.nextGaussian()*hyper,
+                         rnd.nextGaussian()*hyper,
+                         rnd.nextGaussian()*hyper )
+                 c += """
+                     TexEnv TEXTURE_SHADER_NV OFFSET_TEXTURE_MATRIX_NV %s %s 
%s %s
+                 """ % mat
+             
+ 
+         if self.maxaniso != None:
+             maxaniso = self.maxaniso
+             c += """
+               TexParameter %(target)s TEXTURE_MAX_ANISOTROPY_EXT %(maxaniso)s
+             """ % locals()
+ 
        return c
      def getRGBoutputs(self):
        """A list of the texture units whose outputs are useful in
***************
*** 143,148 ****
          return [self.tex[i].scale for i in self.getRGBoutputs()]
  
  def makeNormalShaderPass(maxaniso = None):
!     # XXX: TODO: implement maxaniso as in texops_STD
!     #return ShaderPass(shaderTypes[3])
!     return ShaderPass(shaderTypes[5])
--- 169,172 ----
          return [self.tex[i].scale for i in self.getRGBoutputs()]
  
  def makeNormalShaderPass(maxaniso = None):
!     return ShaderPass(shaderTypes[5], maxaniso)
Index: gzz/gfx/libpaper/texops_STD.py
diff -c gzz/gfx/libpaper/texops_STD.py:1.5 gzz/gfx/libpaper/texops_STD.py:1.6
*** gzz/gfx/libpaper/texops_STD.py:1.5  Fri Oct 11 07:08:42 2002
--- gzz/gfx/libpaper/texops_STD.py      Tue Oct 15 09:52:04 2002
***************
*** 24,30 ****
        return [i for i in range(0,len(self.st))]
      def getRGBoutputscales(self):
          return [self.tex[i].scale for i in range(0,len(self.st))]
!     def setupCode(self):
        c = ""
        for t in range(0,len(self.st)):
            target = self.st[t][0]
--- 24,30 ----
        return [i for i in range(0,len(self.st))]
      def getRGBoutputscales(self):
          return [self.tex[i].scale for i in range(0,len(self.st))]
!     def setupCode(self, rnd):
        c = ""
        for t in range(0,len(self.st)):
            target = self.st[t][0]
Index: gzz/gfx/libpaper/textures.py
diff -c gzz/gfx/libpaper/textures.py:1.28 gzz/gfx/libpaper/textures.py:1.29
*** gzz/gfx/libpaper/textures.py:1.28   Tue Oct 15 08:24:26 2002
--- gzz/gfx/libpaper/textures.py        Tue Oct 15 09:52:04 2002
***************
*** 156,180 ****
                      "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"]]),
          ])
  
      ptextures["DSDT"] = map(NamedTexture, [ 
!         { "name" : "dsdtn",
!           "args" : [512, 512, 0, 2,
!                     "DSDT_NV", "DSDT_NV",
!                     "noise", ["type", "normal", "freq", "10", "scale", "0.2", 
"bias", ".5"]]
            },
          ])
  
      ptextures["DSDT_HILO"] = map(NamedTexture, [ 
!         { "name" : "dsdtn",
!           "args" : [512, 512, 0, 2,
!                     "SIGNED_HILO_NV", "HILO_NV",
!                     "noise", ["type", "normal", "freq", "10", "scale", "0.2", 
"bias", ".5"]]
!           },
          ])
  
      ptextures["FOOBAR"] = [ ptextures["RGB2"][-1] ]
--- 156,177 ----
                      "SIGNED_HILO_NV", "HILO_NV",  # XXX signed
                      "waves", ["abs", "1", "freq0", "2", "freq1", "3"]],
            },
          ])
  
      ptextures["DSDT"] = map(NamedTexture, [ 
!         { "name" : "dsdtw1",
!           "args" : [512, 512, 0, 2, "DSDT_NV", "DSDT_NV", "fnoise",
!                     ["scale", ".43", "freq", "1", "df", ".3", "bias", "0.5",
!                      "seed", "2323" ]],
            },
          ])
  
      ptextures["DSDT_HILO"] = map(NamedTexture, [ 
!         { "name" : "dsdtw1",
!           "args" : [512, 512, 0, 2, "SIGNED_HILO_NV", "HILO_NV", "fnoise",
!                     ["scale", ".43", "freq", "1", "df", ".3", "bias", "0.5",
!                      "seed", "2323" ]],
!           }
          ])
  
      ptextures["FOOBAR"] = [ ptextures["RGB2"][-1] ]




reply via email to

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