《光线跟踪算法技术》代码4.1解释
首先上代码: 1void World::render_scene(void) const { 2 RGBColor pixel_color; 3 Ray ray; 4 float zw = 100.0; 5 int n = (int)sqrt((float)vp.num_samples); 6 Point2D pp; // sample point on a pixel 7 8 open_window(vp.hres,vp.vres); 9 ray.d = Vector3D(0,0,-1); 10 11 for (int r = 0; r < vp.vres; r++) // up 12 for (int c = 0; c < vp.hres; c++) { // across 13 pixel_color = black; 14 15 for (int p = 0; p < n; p++) // up pixel 16 for (int q = 0; q < n; q++) { // across pixel