gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx/demo paperbasis.py


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx/demo paperbasis.py
Date: Mon, 16 Sep 2002 02:14:42 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/09/16 02:14:41

Modified files:
        gfx/demo       : paperbasis.py 

Log message:
        Add keys 1/3/2 for changing tex0/tex1 dot vectors and color vectors; 
Also, F1/F3/F2 key order changed so that F2 controls the intersection

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/paperbasis.py.diff?tr1=1.5&tr2=1.6&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/paperbasis.py
diff -c gzz/gfx/demo/paperbasis.py:1.5 gzz/gfx/demo/paperbasis.py:1.6
*** gzz/gfx/demo/paperbasis.py:1.5      Mon Sep 16 01:33:35 2002
--- gzz/gfx/demo/paperbasis.py  Mon Sep 16 02:14:41 2002
***************
*** 21,33 ****
  
  tex0codes = {
      "ALL" : "",
!     "RGB" : """
!     ActiveTexture TEXTURE1
!     Disable TEXTURE_2D
!     Disable REGISTER_COMBINERS_NV
!     Color 1 1 1
!     SecondaryColorEXT 0 0 0
!     """,
      "DOT" : nvcode.combinercode("""
      CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1
  
--- 21,34 ----
  
  tex0codes = {
      "ALL" : "",
!     "RGB" : nvcode.combinercode("""
!     CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1 # Cannot be 0
!     FCI A ZERO UNSIGNED_IDENTITY_NV RGB
!     FCI B ZERO UNSIGNED_IDENTITY_NV RGB
!     FCI C ZERO UNSIGNED_IDENTITY_NV RGB
!     FCI D TEXTURE0 UNSIGNED_IDENTITY_NV RGB
!     FCI G ZERO UNSIGNED_INVERT_NV ALPHA
!     """),
      "DOT" : nvcode.combinercode("""
      CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1
  
***************
*** 46,58 ****
      }
  tex1codes = {
      "ALL" : "",
!     "RGB" : """
!     ActiveTexture TEXTURE0
!     Disable TEXTURE_2D
!     Disable REGISTER_COMBINERS_NV
!     Color 1 1 1
!     SecondaryColorEXT 0 0 0
!     """,
      "DOT" : nvcode.combinercode("""
      CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1
      
--- 47,60 ----
      }
  tex1codes = {
      "ALL" : "",
!     "RGB" : nvcode.combinercode("""
!     CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1 # Cannot be 0
!     FCI A ZERO UNSIGNED_IDENTITY_NV RGB
!     FCI B ZERO UNSIGNED_IDENTITY_NV RGB
!     FCI C ZERO UNSIGNED_IDENTITY_NV RGB
!     FCI D TEXTURE1 UNSIGNED_IDENTITY_NV RGB
!     FCI G ZERO UNSIGNED_INVERT_NV ALPHA
!     """),
      "DOT" : nvcode.combinercode("""
      CombinerParameterNV NUM_GENERAL_COMBINERS_NV 1
      
***************
*** 91,103 ****
  tex1comb = "ALL"
  isectcomb = "ALL"
  
! def getpaper(seed):
      pap = ThePaperMill().getPaper(seed, passmask=passmask)
  
      return GZZGL.createBasisPaperQuad(pap, -1, -1, 1, 1,
!                                       tex0codes[tex0comb],
!                                       tex1codes[tex1comb],
!                                       isectcodes[isectcomb])
  
  rng = java.util.Random()
  
--- 93,125 ----
  tex1comb = "ALL"
  isectcomb = "ALL"
  
! def getpaper(seed, vecseed0 = 0, vecseed1 = 0, colseed = 0):
      pap = ThePaperMill().getPaper(seed, passmask=passmask)
  
+     constcode = ""
+     if colseed:
+       colors = Colors(colseed)
+       c0,c1,c2,c3 = [ colors.getColorStr(i) for i in range(0,4) ]
+         constcode += """
+         Color %(c0)s
+         SecondaryColorEXT %(c1)s
+         Fog FOG_COLOR %(c2)s
+         """ % locals()
+     if vecseed0:
+       colors = Colors(vecseed0)
+         constcode += ("CombinerParameterNV CONSTANT_COLOR0_NV %s\n"
+                       % (colors.getNVDP3VecStr(0)))
+     if vecseed1:
+       colors = Colors(vecseed1)
+         constcode += ("CombinerParameterNV CONSTANT_COLOR1_NV %s\n"
+                       % (colors.getNVDP3VecStr(1)))
+     print seed, vecseed0, vecseed1, colseed
+     print constcode
+ 
      return GZZGL.createBasisPaperQuad(pap, -1, -1, 1, 1,
!                                       tex0codes[tex0comb] + constcode,
!                                       tex1codes[tex1comb] + constcode,
!                                       isectcodes[isectcomb] + constcode)
  
  rng = java.util.Random()
  
***************
*** 109,118 ****
        self.bgcolor = (0.7, 0.8, 0.6)
  
          self.seed = 0
!       self.pq = None
  
      def initpaper(self):
!         self.pq = getpaper(self.seed)
  
      def key(self, k):
          global tex0comb,tex1comb,isectcomb
--- 131,144 ----
        self.bgcolor = (0.7, 0.8, 0.6)
  
          self.seed = 0
!         self.vecseed0 = 0
!         self.vecseed1 = 0
!         self.colseed = 0
!         self.initpaper()
  
      def initpaper(self):
!         self.pq = getpaper(self.seed, self.vecseed0, self.vecseed1, 
self.colseed)
!       AbstractUpdateManager.setNoAnimation()
  
      def key(self, k):
          global tex0comb,tex1comb,isectcomb
***************
*** 120,125 ****
--- 146,164 ----
          oldseed = self.seed
          if k == "v":
              self.seed = rng.nextInt(2000000000)
+             self.vecseed0 = 0
+             self.vecseed1 = 0
+             self.colseed = 0
+             self.initpaper()
+         elif k == "1":
+             self.vecseed0 = rng.nextInt(2000000000)
+             self.initpaper()
+         elif k == "3":
+             self.vecseed1 = rng.nextInt(2000000000)
+             self.initpaper()
+         elif k == "2":
+             self.colseed = rng.nextInt(2000000000)
+             self.initpaper()
          elif k == "Up": y0 -= 20
          elif k == "Down": y0 += 20
          elif k == "Left": x0 -= 20
***************
*** 129,150 ****
              tex0comb = list[(list.index(tex0comb) + 1) % len(list)]
              print "Using", tex0comb, tex1comb, isectcomb, "combiners"
              self.initpaper()
!         elif k == "F2":
              list = tex1codes.keys()
              tex1comb = list[(list.index(tex1comb) + 1) % len(list)]
              print "Using", tex0comb, tex1comb, isectcomb, "combiners"
              self.initpaper()
!         elif k == "F3":
              list = isectcodes.keys()
              isectcomb = list[(list.index(isectcomb) + 1) % len(list)]
              print "Using", tex0comb, tex1comb, isectcomb, "combiners"
              self.initpaper()
- 
-         if oldseed != self.seed:
-           self.pq = None
-             AbstractUpdateManager.setNoAnimation()
-             AbstractUpdateManager.chg()
- 
            
      def scene(self, vs):
        if not self.pq: self.initpaper()
--- 168,183 ----
              tex0comb = list[(list.index(tex0comb) + 1) % len(list)]
              print "Using", tex0comb, tex1comb, isectcomb, "combiners"
              self.initpaper()
!         elif k == "F3":
              list = tex1codes.keys()
              tex1comb = list[(list.index(tex1comb) + 1) % len(list)]
              print "Using", tex0comb, tex1comb, isectcomb, "combiners"
              self.initpaper()
!         elif k == "F2":
              list = isectcodes.keys()
              isectcomb = list[(list.index(isectcomb) + 1) % len(list)]
              print "Using", tex0comb, tex1comb, isectcomb, "combiners"
              self.initpaper()
            
      def scene(self, vs):
        if not self.pq: self.initpaper()




reply via email to

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