gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx demo/irregu3.py libtexture/Texture_pipe...


From: Janne V. Kujala
Subject: [Gzz-commits] gzz/gfx demo/irregu3.py libtexture/Texture_pipe...
Date: Thu, 24 Oct 2002 07:36:25 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Janne V. Kujala <address@hidden>        02/10/24 07:36:25

Modified files:
        gfx/demo       : irregu3.py 
        gfx/libtexture : Texture_pipetexture.cxx irregu.texture 

Log message:
        Use the irregu2 texture in irregu3

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/demo/irregu3.py.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/Texture_pipetexture.cxx.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/irregu.texture.diff?tr1=1.7&tr2=1.8&r1=text&r2=text

Patches:
Index: gzz/gfx/demo/irregu3.py
diff -u gzz/gfx/demo/irregu3.py:1.15 gzz/gfx/demo/irregu3.py:1.16
--- gzz/gfx/demo/irregu3.py:1.15        Wed Oct 23 09:35:30 2002
+++ gzz/gfx/demo/irregu3.py     Thu Oct 24 07:36:25 2002
@@ -180,6 +180,12 @@
         i0 = tex.getTexId()
         i1 = texinv.getTexId()
 
+        vs.map.put(getDListNocoords("""
+            PushMatrix
+
+            MultMatrix  1 0 0 0  0 1 0 0  0 0 1 0  0 0 0 1
+        """))
+
         vs.map.put(getDList(getIrregu(i0,x0,-1,x1,-1,1, texscale, self.angle) +
                             getIrregu(i0,+1,y0,+1,y1,1, texscale, self.angle) +
                             getIrregu(i1,x1,+1,x0,+1,1, texscale, self.angle) +
@@ -191,6 +197,10 @@
                             getIrregu(i1,x1,+1,x0,+1,0, texscale, self.angle) +
                             getIrregu(i1,-1,y1,-1,y0,0, texscale, self.angle) +
                             "Color 1 1 1" + paint), cs3)
+
+        vs.map.put(getDListNocoords("""
+            PopMatrix
+        """))
 
     def key(self, k):
         if k == "+": self.scale *= 1.4142135623731; print round(self.scale)
Index: gzz/gfx/libtexture/Texture_pipetexture.cxx
diff -u gzz/gfx/libtexture/Texture_pipetexture.cxx:1.1 
gzz/gfx/libtexture/Texture_pipetexture.cxx:1.2
--- gzz/gfx/libtexture/Texture_pipetexture.cxx:1.1      Wed Aug  7 06:24:00 2002
+++ gzz/gfx/libtexture/Texture_pipetexture.cxx  Thu Oct 24 07:36:25 2002
@@ -5,7 +5,7 @@
 #include <stdarg.h>
 #include <iostream>
 
-using std::cout;
+using std::cerr;
 using std::string;
 
 #include "Texture.hxx"
@@ -32,13 +32,13 @@
       s += wbuf;
       s += params->getParamString();
 
-      cout << "popen: "<<s<<"\n";
+      cerr << "popen: "<<s<<"\n";
 
       // XXX SECURITY
       FILE *f = popen(s.c_str(), "r");
 
       if(f == 0) {
-         cout << "POPEN FAILED!!! "<<strerror(errno)<<"\n";
+         cerr << "POPEN FAILED!!! "<<strerror(errno)<<"\n";
          return;
       }
 
Index: gzz/gfx/libtexture/irregu.texture
diff -u gzz/gfx/libtexture/irregu.texture:1.7 
gzz/gfx/libtexture/irregu.texture:1.8
--- gzz/gfx/libtexture/irregu.texture:1.7       Tue Oct 22 04:21:50 2002
+++ gzz/gfx/libtexture/irregu.texture   Thu Oct 24 07:36:25 2002
@@ -1,5 +1,6 @@
 // -*-C++-*-
 #include <math.h>
+#include <stdio.h>
 
 #define FPARAM(name, default) float name = params->getFloat(#name, default);
 
@@ -45,6 +46,7 @@
     FPARAM(ripple_scale, 0.25); 
 
     if(components != 4) return;
+    if(depth != 1) return;
     if(width != height) return;
     
     int ind=0, i, j;
@@ -52,10 +54,38 @@
     float xstep = 1.0 / width;
     float ystep = 1.0 / height;
 
+    {
+       char s[1000];
+       sprintf(s, "gfx/libtexture/sawnoise.bin %d %d %d %d "
+               "bias 0.5 scale 0.15 freq 1 df 2 scale2 0.25 freq2 10 df2 .5",
+               width, height, depth, components);
+       
+       fprintf(stderr, "popen: %s", s);
+       
+       // XXX SECURITY
+       FILE *f = popen(s, "r");
+       if(f == 0) {
+           perror("POPEN FAILED!!!");
+           return;
+       }
+
+       fread(data, sizeof(float), width * height * depth * components, f);
+       pclose(f);
+       fprintf(stderr, "\n");
+    }
+
     ind = 3;
     for (j = 0, y = 0; j < height; j++, y += ystep) {  
        for (i = 0, x = 0; i < width; i++, x += xstep) {
-           data[ind] = INVERT(invert, func(x,y)) * scale + bias;
+           float f = INVERT(invert, /*func(x,y)*/data[ind]);
+           if (f > 1) f = 1;
+           if (f < 0) f = 0;
+
+           // Scale down to make space for the border
+           f *= (1 - radius / (width * ripple_scale));
+           if (f < 0) f = 0;
+
+           data[ind] = f * scale + bias;
 
            // Add outer edge to quantized inner edge
            data[ind] = floor(data[ind] * 255.0 + 0.5) / 255.0;




reply via email to

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