Raytracing speed again, this time with gdc.

downs default_357-line at yahoo.de
Wed Nov 7 10:58:52 PST 2007


dominik wrote:
> "downs" <default_357-line at yahoo.de> wrote in message 
> news:fgskq5$1p5n$1 at digitalmars.com...
>>  writefln("P5\n", n, " ", n, "\n255");
>>  for (int y=n-1; y>=0; --y)
>>    for (int x=0; x<n; ++x) {
>>      double g=0;
>>      for (int d=0; d<ss*ss; ++d) {
>>        auto dir=Vec(x+(d%ss)*1.0/ss-n/2.0, y+(d/ss)*1.0/ss-n/2.0, 
>> n).unitise();
>> g += ray_trace(light, Ray(Vec(0, 0, -4), dir), s);
>>      }
>>      printf("%c", cast(ubyte)(0.5 + 255.0 * g / (ss*ss)));
>>    }
>> }
> 
> what kind of output is this? how do you view result? 
> 
> 
PGM. Gwenview and Konqueror can display it, as well as any decent image
viewer.

http://en.wikipedia.org/wiki/Portable_pixmap

 --downs


More information about the Digitalmars-d-learn mailing list