Changeset 57
- Timestamp:
- 02/17/10 08:21:16 (2 years ago)
- Files:
-
- trunk/camera.d (modified) (3 diffs)
- trunk/scene/fractal.d (modified) (1 diff)
- trunk/test21.sc (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/camera.d
r56 r57 37 37 res.lights = lights; res.iters = i_iters; res.max = max; res.cont = continuous; res.maxdepth = i_depth; 38 38 res.loop = loop; res.loops = loops; 39 res.fov = fov; 39 40 return res; 40 41 } … … 45 46 Light[] lights; 46 47 vec pos, lookat, up, left, lp; 48 float fov; 47 49 int width, height; 48 50 void setUp(vec v) { … … 118 120 119 121 ray.cam_origin = pos; 122 ray.angle = fov * PI180 / .max(width, height); 120 123 if (bit_isnan(ray.angle)) { 121 124 ray.angle = float.epsilon; trunk/scene/fractal.d
r55 r57 154 154 cur += dist; 155 155 float localε = ε; 156 /*logln("Local ε at ", cur, " => ", ray.at(cur), ": ", ray.radius(cur), " * ", localε, 157 "; ray angle ", ray.angle, 158 ", ray origin ", ray.cam_origin, 159 ", distance ", (ray.cam_origin - ray.at(cur)).length 160 );*/ 156 161 if (adapt) 157 162 localε *= ray.radius(cur); 158 if (localε < float.epsilon) 163 164 if (localε !> float.epsilon) 159 165 localε = float.epsilon; // just to be sure 160 // logln("Local ε at ", ray.at(cur), ": ", localε, "; ray angle ", ray.angle, ", ray origin ", ray.cam_origin);161 166 162 if (dist !> localε) { // NOT < .. workaround for nans167 if (dist < localε) { 163 168 auto norm = getGrad(ray.at(cur), localε).normalized; 164 169 165 if (norm.dot(ray.dir) > 0 && iters--) {170 if (norm.dot(ray.dir) > 0 && max_steps--) { 166 171 cur += localε - dist; // definitely move away at least this much 167 172 continue; // we're pointed AWAY. Not stopping. 168 173 } 169 174 // don't produce a hit if we're clearly moving away 170 if ( iters) hit.set(cur, true, norm);175 if (max_steps) hit.set(cur, true, norm); 171 176 return; 172 177 }
