34 |
params.setParam(argv[i], argv[i+1]); |
params.setParam(argv[i], argv[i+1]); |
35 |
} |
} |
36 |
|
|
37 |
float *data = new float[width*height*depth*ncomp]; |
int d = (depth==0 ? 1 : depth); |
38 |
for(int i=0; i<width*height*depth*ncomp; i++) |
|
39 |
|
float *data = new float[width*height*d*ncomp]; |
40 |
|
for(int i=0; i<width*height*d*ncomp; i++) |
41 |
data[i] = 0.0001; |
data[i] = 0.0001; |
42 |
bin_texture->render(¶ms, width, height, depth, ncomp, data); |
bin_texture->render(¶ms, width, height, depth, ncomp, data); |
43 |
|
|
44 |
|
|
45 |
if(bytes) { |
if(bytes) { |
46 |
unsigned char *bdata = new unsigned char[width*height*depth*ncomp]; |
unsigned char *bdata = new unsigned char[width*height*d*ncomp]; |
47 |
for(int i=0; i<width*height*depth*ncomp; i++) { |
for(int i=0; i<width*height*d*ncomp; i++) { |
48 |
int v = (int)( 255 * data[i] ); |
int v = (int)( 255 * data[i] ); |
49 |
if(v > 255) v = 255; |
if(v > 255) v = 255; |
50 |
if(v < 0) v = 0; |
if(v < 0) v = 0; |
51 |
bdata[i] = v; |
bdata[i] = v; |
52 |
} |
} |
53 |
fwrite(bdata, sizeof(unsigned char), width*height*depth*ncomp, stdout); |
fwrite(bdata, sizeof(unsigned char), width*height*d*ncomp, stdout); |
54 |
} else { |
} else { |
55 |
fwrite(data, sizeof(float), width*height*depth*ncomp, stdout); |
fwrite(data, sizeof(float), width*height*d*ncomp, stdout); |
56 |
} |
} |
57 |
} |
} |