| 849 | } |
| 850 | |
| 851 | U32 iRayHitsEnv(const xRay3* r, const xEnv* env, xCollis* coll) |
| 852 | { |
| 853 | RpIntersection isx; |
| 854 | isx.type = rpINTERSECTLINE; |
| 855 | if (r->flags & 0x400) |
| 856 | { |
| 857 | isx.t.line.start.x = (r->dir.x * r->min_t); |
| 858 | isx.t.line.start.x += r->origin.x; |
| 859 | isx.t.line.start.y = (r->dir.y * r->min_t); |
| 860 | isx.t.line.start.y += r->origin.y; |
| 861 | isx.t.line.start.z = (r->dir.z * r->dir.z); |
| 862 | isx.t.line.start.z += r->origin.z; |
| 863 | } |
| 864 | else |
| 865 | { |
| 866 | isx.t.line.start.x = r->origin.x; |
| 867 | isx.t.line.start.y = r->origin.y; |
| 868 | isx.t.line.start.z = r->origin.z; |
| 869 | } |
| 870 | |
| 871 | if (r->flags & 0x800) |
| 872 | { |
| 873 | F32 len; |
| 874 | if (r->flags & 0x400) |
| 875 | { |
| 876 | len = r->max_t - r->min_t; |
| 877 | } |
| 878 | else |
| 879 | { |
| 880 | len = r->max_t; |
| 881 | } |
| 882 | |
| 883 | isx.t.line.end.x = r->dir.x * len; |
| 884 | isx.t.line.end.y = r->dir.y * len; |
| 885 | isx.t.line.end.z = r->dir.z * len; |
| 886 | } |
| 887 | else |
| 888 | { |
| 889 | isx.t.line.end.x = r->dir.x; |
| 890 | isx.t.line.end.y = r->dir.y; |
| 891 | isx.t.line.end.z = r->dir.z; |
| 892 | } |
| 893 | |
| 894 | isx.t.line.end.x = isx.t.line.start.x + isx.t.line.end.x; |
| 895 | isx.t.line.end.y = isx.t.line.start.y + isx.t.line.end.y; |
| 896 | isx.t.line.end.z = isx.t.line.start.z + isx.t.line.end.z; |
| 897 | coll->flags &= ~1; |
| 898 | coll->dist = FLOAT_MAX; |
| 899 | cbray = *r; |
| 900 | |
| 901 | if ((r->flags & 0x800) == 0) |
| 902 | { |
| 903 | cbray.max_t = 1.0f; |
| 904 | } |
| 905 | if (r->flags & 0x400) |
| 906 | { |
| 907 | cbray.max_t -= cbray.min_t; |
| 908 | } |
no test coverage detected