/[gzz]/gzz/gfx/libtexture/geometric.texture
ViewVC logotype

Diff of /gzz/gfx/libtexture/geometric.texture

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.3 by jvk, Tue Oct 8 16:09:54 2002 UTC revision 1.4 by jvk, Wed Oct 9 14:07:27 2002 UTC
# Line 46  float triangle(float x) { Line 46  float triangle(float x) {
46    return 1 - 2 * fabs(x - .5);    return 1 - 2 * fabs(x - .5);
47  }  }
48    
49    float stripe(float x) {
50      x -= floor(x);
51      return (x < .4999999);
52    }
53    
54  void GENERATE(TextureParam *params, int width, int height, int depth, int components, float *data) {  void GENERATE(TextureParam *params, int width, int height, int depth, int components, float *data) {
55       FPARAM(type, 0)      FPARAM(type, 0);
56        FPARAM(scale, 1);
57        FPARAM(bias, 0);
58      if(components > 4) return;      if(components > 4) return;
59            
60    
# Line 97  void GENERATE(TextureParam *params, int Line 104  void GENERATE(TextureParam *params, int
104            if (components >= 3) data[ind++] = triangle(y);            if (components >= 3) data[ind++] = triangle(y);
105            if (components >= 4) data[ind++] = triangle(.5 + y);            if (components >= 4) data[ind++] = triangle(.5 + y);
106            break;            break;
107            case 6:
108              if (components >= 1) data[ind++] = stripe(x);
109              if (components >= 2) data[ind++] = stripe(1 - xstep - x);
110              if (components >= 3) data[ind++] = stripe(y);
111              if (components >= 4) data[ind++] = stripe(1 - ystep - y);
112              break;
113                        
114          }          }
115        }        }
116      }      }
117    
118        for(int i = 0; i < width * height * depth * components; i++) {
119          data[i] = data[i] * scale + bias;
120        }
121        
122  }  }

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26