task that renders a single screen tile */
| 1603 | |
| 1604 | /* task that renders a single screen tile */ |
| 1605 | void renderPixelStandard(const TutorialData& data, |
| 1606 | int x, int y, |
| 1607 | int* pixels, |
| 1608 | const unsigned int width, |
| 1609 | const unsigned int height, |
| 1610 | const float time, |
| 1611 | const ISPCCamera& camera, |
| 1612 | RayStats& stats, |
| 1613 | const RTCFeatureFlags features) |
| 1614 | { |
| 1615 | RandomSampler sampler; |
| 1616 | |
| 1617 | Vec3fa L = Vec3fa(0.0f); |
| 1618 | |
| 1619 | for (int i=0; i<data.spp; i++) |
| 1620 | { |
| 1621 | RandomSampler_init(sampler, x, y, data.accu_count*data.spp+i); |
| 1622 | |
| 1623 | /* calculate pixel color */ |
| 1624 | float fx = x + RandomSampler_get1D(sampler); |
| 1625 | float fy = y + RandomSampler_get1D(sampler); |
| 1626 | L = L + renderPixelFunction(data,fx,fy,sampler,camera,stats,features); |
| 1627 | } |
| 1628 | L = L/(float)data.spp; |
| 1629 | |
| 1630 | /* write color to framebuffer */ |
| 1631 | Vec3ff accu_color = data.accu[y*width+x] + Vec3ff(L.x,L.y,L.z,1.0f); data.accu[y*width+x] = accu_color; |
| 1632 | float f = rcp(max(0.001f,accu_color.w)); |
| 1633 | unsigned int r = (unsigned int) (255.01f * clamp(accu_color.x*f,0.0f,1.0f)); |
| 1634 | unsigned int g = (unsigned int) (255.01f * clamp(accu_color.y*f,0.0f,1.0f)); |
| 1635 | unsigned int b = (unsigned int) (255.01f * clamp(accu_color.z*f,0.0f,1.0f)); |
| 1636 | pixels[y*width+x] = (b << 16) + (g << 8) + r; |
| 1637 | } |
| 1638 | |
| 1639 | /* task that renders a single screen tile */ |
| 1640 | void renderTileTask (int taskIndex, int threadIndex, int* pixels, |
no test coverage detected