Changeset View
Changeset View
Standalone View
Standalone View
intern/cycles/kernel/bvh/util.h
| Show First 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | ccl_device_inline void sort_intersections_and_normals(ccl_private Intersection *hits, | ||||
| ccl_private float3 *Ng, | ccl_private float3 *Ng, | ||||
| uint num_hits) | uint num_hits) | ||||
| { | { | ||||
| bool swapped; | bool swapped; | ||||
| do { | do { | ||||
| swapped = false; | swapped = false; | ||||
| for (int j = 0; j < num_hits - 1; ++j) { | for (int j = 0; j < num_hits - 1; ++j) { | ||||
| if (hits[j].t > hits[j + 1].t) { | if (hits[j].t > hits[j + 1].t) { | ||||
| struct Intersection tmp_hit = hits[j]; | Intersection tmp_hit = hits[j]; | ||||
| float3 tmp_Ng = Ng[j]; | float3 tmp_Ng = Ng[j]; | ||||
| hits[j] = hits[j + 1]; | hits[j] = hits[j + 1]; | ||||
| Ng[j] = Ng[j + 1]; | Ng[j] = Ng[j + 1]; | ||||
| hits[j + 1] = tmp_hit; | hits[j + 1] = tmp_hit; | ||||
| Ng[j + 1] = tmp_Ng; | Ng[j + 1] = tmp_Ng; | ||||
| swapped = true; | swapped = true; | ||||
| } | } | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 118 Lines • Show Last 20 Lines | |||||