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

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

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

revision 1.8 by jvk, Thu Oct 24 11:36:25 2002 UTC revision 1.9 by jvk, Fri Oct 25 08:48:12 2002 UTC
# Line 45  void GENERATE(TextureParam *params, int Line 45  void GENERATE(TextureParam *params, int
45      // Ripple amplitude in texture coordinates      // Ripple amplitude in texture coordinates
46      FPARAM(ripple_scale, 0.25);      FPARAM(ripple_scale, 0.25);
47    
48      if(components != 4) return;      float *origdata = data;
49        if(components != 4) {
50            if (components != 1) return;
51            data = new float[width * height * depth * 4];
52        }
53    
54      if(depth != 1) return;      if(depth != 1) return;
55      if(width != height) return;      if(width != height) return;
56            
# Line 58  void GENERATE(TextureParam *params, int Line 63  void GENERATE(TextureParam *params, int
63          char s[1000];          char s[1000];
64          sprintf(s, "gfx/libtexture/sawnoise.bin %d %d %d %d "          sprintf(s, "gfx/libtexture/sawnoise.bin %d %d %d %d "
65                  "bias 0.5 scale 0.15 freq 1 df 2 scale2 0.25 freq2 10 df2 .5",                  "bias 0.5 scale 0.15 freq 1 df 2 scale2 0.25 freq2 10 df2 .5",
66                  width, height, depth, components);                  width, height, depth, 4);
67                    
68          fprintf(stderr, "popen: %s", s);          fprintf(stderr, "popen: %s", s);
69                    
# Line 69  void GENERATE(TextureParam *params, int Line 74  void GENERATE(TextureParam *params, int
74              return;              return;
75          }          }
76    
77          fread(data, sizeof(float), width * height * depth * components, f);          fread(data, sizeof(float), width * height * depth * 4, f);
78          pclose(f);          pclose(f);
79          fprintf(stderr, "\n");          fprintf(stderr, "\n");
80      }      }
# Line 93  void GENERATE(TextureParam *params, int Line 98  void GENERATE(TextureParam *params, int
98          }                }      
99      }      }
100            
101        if (components == 4)
102      for (int comp = 0; comp < 3; comp++) {      for (int comp = 0; comp < 3; comp++) {
103          float dx = cos(comp * 2*M_PI / 3);          float dx = cos(comp * 2*M_PI / 3);
104          float dy = sin(comp * 2*M_PI / 3);          float dy = sin(comp * 2*M_PI / 3);
# Line 129  void GENERATE(TextureParam *params, int Line 135  void GENERATE(TextureParam *params, int
135                  data[i+3]);                  data[i+3]);
136      }      }
137  #endif  #endif
138    
139        if (components != 4) {
140            /* components == 1 */
141            for (int i = 0; i < width * height * depth; i++)
142                origdata[i] = data[4 * i + 3];
143            delete[] data;
144        }
145  }  }
146    
147    

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

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