gzz-commits
[Top][All Lists]
Advanced

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

[Gzz-commits] gzz/gfx libcoords/Coords.cxx libtexture/fnoise....


From: Tuomas J. Lukka
Subject: [Gzz-commits] gzz/gfx libcoords/Coords.cxx libtexture/fnoise....
Date: Mon, 30 Sep 2002 08:53:33 -0400

CVSROOT:        /cvsroot/gzz
Module name:    gzz
Changes by:     Tuomas J. Lukka <address@hidden>        02/09/30 08:53:33

Modified files:
        gfx/libcoords  : Coords.cxx 
        gfx/libtexture : fnoise.texture 

Log message:
        Scale

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libcoords/Coords.cxx.diff?tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gzz/gzz/gfx/libtexture/fnoise.texture.diff?tr1=1.3&tr2=1.4&r1=text&r2=text

Patches:
Index: gzz/gfx/libcoords/Coords.cxx
diff -c gzz/gfx/libcoords/Coords.cxx:1.15 gzz/gfx/libcoords/Coords.cxx:1.16
*** gzz/gfx/libcoords/Coords.cxx:1.15   Mon Sep 30 04:15:42 2002
--- gzz/gfx/libcoords/Coords.cxx        Mon Sep 30 08:53:33 2002
***************
*** 130,136 ****
        }
      };
  
!     ;
      ;
  
      /** Distorted coordinate system.
--- 130,174 ----
        }
      };
  
!     /** Rotation around 3D vector.
!      * Params: x, y, z, angle
!      */
!     class RotateXYZCoords : public CoordSys {
!       ZVec vec; float s, c;
!     public:
!       enum { NParams = 4 };
!       virtual void setParams(float *params) {
!           CoordSys::setParams(params);
! 
!           s = sin(params[3] * M_PI / 180);
!           c = cos(params[3] * M_PI / 180);
!       }
!       /** Perform the internal transformation of this 
!        * coordsys.
!        */
!       void tr(const ZPt &from, ZPt &to) const {
! 
!           to.x = c * from.x + s * from.y; 
!           to.y = -s * from.x + c * from.y; 
!           to.z = from.z;
!       }
!       virtual ZPt transform(const ZPt &p) const {
!           ZPt mp;
!           tr(p, mp);
!           return super->transform(mp);
!       }
!       virtual void vertex(const ZPt &p) const {
!           ZPt mp;
!           tr(p, mp);
!           super->vertex(mp);
!       }
!       virtual bool canPerformGL() { return super->canPerformGL(); }
!         virtual bool performGL() {
!           if(!super->performGL()) return false;
!           glRotatef(params[0], vec.x, vec.y, vec.z);
!           return true;
!       }
!     } ;
      ;
  
      /** Distorted coordinate system.
Index: gzz/gfx/libtexture/fnoise.texture
diff -c gzz/gfx/libtexture/fnoise.texture:1.3 
gzz/gfx/libtexture/fnoise.texture:1.4
*** gzz/gfx/libtexture/fnoise.texture:1.3       Fri Sep 27 11:56:42 2002
--- gzz/gfx/libtexture/fnoise.texture   Mon Sep 30 08:53:33 2002
***************
*** 26,31 ****
--- 26,33 ----
            ysin[1][f][j] = cos(j/(float)height * f * M_PI * 2);
      }
      
+     float sumsq[components];
+     for(int i=0; i<components; i++) sumsq[i] = 0;
      
      if(depth < 2) {
        // 2D
***************
*** 38,45 ****
            for(int xsc = 0; xsc < 2; xsc++) {
              for(int ysc = 0; ysc < 2; ysc++) {
                float coeff[components];
!               for(int co = 0; co < components; co++)
                    coeff[co] = drand()-0.5;
                int ind = 0;
                for (int j = 0; j < height; j++) {
                  for (int i = 0; i < width; i++) {
--- 40,49 ----
            for(int xsc = 0; xsc < 2; xsc++) {
              for(int ysc = 0; ysc < 2; ysc++) {
                float coeff[components];
!               for(int co = 0; co < components; co++) {
                    coeff[co] = drand()-0.5;
+                   sumsq[co] += coeff[co] * coeff[co];
+               }
                int ind = 0;
                for (int j = 0; j < height; j++) {
                  for (int i = 0; i < width; i++) {
***************
*** 51,56 ****
--- 55,69 ----
            }
          }
        }
+       int ind = 0;
+       for (int j = 0; j < height; j++) {
+         for (int i = 0; i < width; i++) {
+           for(int co = 0; co < components; co++) {
+               data[ind++] /= sumsq[co];
+           }
+         }
+       }
+       
      } else {
        float zsin[width][nf];
        // 3D




reply via email to

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