|
![](/i/fill.gif) |
Thanks very largely to the help I have received here (and thank you all _very_
much for it), I have got stage one of the simulation into developement. The sim
can be fed large scale images and convert them into a text file filled with
numbers.
Somewhere however, there is a bug in the coding which causes all the numbers in
the generated file to be the same. :(
Following is the snippet with all the relevant code. (Is code the right word?)
/*Image Import/Export
Section--------------------------------------------------------------------*/
//eval_pigment copied from "functions.inc" to reduce parse overhead time
#macro eval_pigment(pigm, vec)
#local fn = function { pigment { pigm } }
#local result = (fn(vec.x, vec.y, vec.z));
result
#end
#declare ColImg = pigment {
image_map {
jpeg ".jpg"//image name deleted for security ;)
}
}
#declare ImgTraceObj = plane {
-z, 0
pigment {
ColImg
}
}
#declare Res = max_extent(ColImg);
#debug concat("Resolution of image is ", vstr(2, Res, ",", 0, 0), ".\n")
#fopen TmpImg "ImgColArray.txt" write
#declare Xres = Res.x;
#declare Yres = Res.y;
#declare XCount = 0;
#write(TmpImg, "array[", Xres, "] [", Yres, "] {\n")
#while(XCount<Xres)
#declare YCount = 0;
#write(TmpImg, " {")
#while(YCount<Yres)
#declare TmpCol = eval_pigment(ColImg, <XCount, YCount, 0>);
#write(TmpImg, " ", vstr(3, TmpCol, ",", 0, 5), ", ")
#declare YCount=YCount+1;
#end
#write(TmpImg, " }\n")
#declare XCount=XCount+1;
#end
#write(TmpImg, "}")
/*-----------------------------------------------------------------------------------------------*/
I haven't had time to go through it and debug & search the docs myself, I
finished it in a hurry, and on top of that, I'm getting ready for return to
studies, as well as possibly starting a new job. :(
Regards
D103
Post a reply to this message
|
![](/i/fill.gif) |