24 |
data[(ix1 + w * iy1) * c] * fx * fy; |
data[(ix1 + w * iy1) * c] * fx * fy; |
25 |
} |
} |
26 |
|
|
27 |
|
void tr(char *s, char a, char b) { |
28 |
|
while ((s = strchr(s, a)) != 0) *s = b; |
29 |
|
} |
30 |
|
|
31 |
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) { |
32 |
FPARAM(bias, 0); |
FPARAM(bias, 0); |
33 |
FPARAM(scale, 1); |
FPARAM(scale, 1); |
61 |
float xstep = 1.0 / width; |
float xstep = 1.0 / width; |
62 |
float ystep = 1.0 / height; |
float ystep = 1.0 / height; |
63 |
|
|
64 |
|
const char *texture = params->getString("texture", "sawnoise"); |
65 |
|
char *texparams = strdup(params->getString("params", |
66 |
|
"bias,0.5,scale,0.15,freq,1,df,2,scale2,0.25,freq2,10,df2,.5")); |
67 |
|
|
68 |
|
tr(texparams, ',', ' '); |
69 |
|
|
70 |
{ |
{ |
71 |
char s[1000]; |
char s[1000]; |
72 |
sprintf(s, "gfx/libtexture/%s %d %d %d %d %s", |
sprintf(s, "gfx/libtexture/%s.bin %d %d %d %d %s", |
73 |
params->getString("texture", "sawnoise.bin"), |
texture, |
74 |
width, height, depth, 4, |
width, height, depth, 4, |
75 |
params->getString("params", "bias 0.5 scale 0.15 freq 1 df 2 scale2 0.25 freq2 10 df2 .5")); |
texparams); |
76 |
fprintf(stderr, "popen: %s", s); |
fprintf(stderr, "popen: %s", s); |
77 |
|
|
78 |
// XXX SECURITY |
// XXX SECURITY |