5 |
|
|
6 |
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) { |
7 |
|
|
8 |
|
FPARAM(scale, 1.0); |
9 |
|
FPARAM(bias, 0); |
10 |
|
|
11 |
const char *file = params->getString("file", ""); |
const char *file = params->getString("file", ""); |
12 |
FILE *f = fopen(file, "r"); |
FILE *f = fopen(file, "r"); |
13 |
if (!f) { |
if (!f) { |
42 |
j < y || j >= y + height || |
j < y || j >= y + height || |
43 |
k < z || k >= z + depth) continue; |
k < z || k >= z + depth) continue; |
44 |
|
|
45 |
if (components >= 1) data[ind++] = foo[0%c]; |
if (components >= 1) data[ind++] = scale*foo[0%c]+bias; |
46 |
if (components >= 2) data[ind++] = foo[1%c]; |
if (components >= 2) data[ind++] = scale*foo[1%c]+bias; |
47 |
if (components >= 3) data[ind++] = foo[2%c]; |
if (components >= 3) data[ind++] = scale*foo[2%c]+bias; |
48 |
if (components >= 4) data[ind++] = foo[3%c]; |
if (components >= 4) data[ind++] = scale*foo[3%c]+bias; |
49 |
} |
} |
50 |
} |
} |
51 |
} |
} |