| 25 | static RwMatrixTag* sModelMat; |
| 26 | |
| 27 | extern xGrid colls_grid; |
| 28 | extern xGrid colls_oso_grid; |
| 29 | extern xGrid npcs_grid; |
| 30 | extern xQCControl xqc_def_ctrl; |
| 31 | |
| 32 | static RpCollisionTriangle* shadowRayCB(RpIntersection*, RpWorldSector*, RpCollisionTriangle* tri, |
| 33 | F32 dist, void* data) |
| 34 | { |
| 35 | xVec3 xformnorm; |
| 36 | xVec3* norm = NULL; |
| 37 | F32* testdist; |
| 38 | xShadowSimpleCache* cache = (xShadowSimpleCache*)data; |
| 39 | |
| 40 | if (sModelMat) |
| 41 | { |
| 42 | testdist = &cache->shadowHeight; |
| 43 | xMat3x3RMulVec(&xformnorm, (xMat3x3*)sModelMat, (xVec3*)&tri->normal); |
| 44 | xVec3Normalize(&xformnorm, &xformnorm); |
| 45 | norm = &xformnorm; |
| 46 | } |
| 47 | else |
| 48 | { |
| 49 | testdist = &cache->envHeight; |
| 50 | norm = (xVec3*)&tri->normal; |
| 51 | } |
| 52 | |
| 53 | if (dist >= *testdist || (norm->y < 0.0871557f)) |
| 54 | { |
| 55 | return tri; |
| 56 | } |
| 57 | |
| 58 | *testdist = dist; |
| 59 | |
| 60 | cache->poly.vert[0] = *((xVec3*)tri->vertices[0]); |
| 61 | cache->poly.vert[1] = *((xVec3*)tri->vertices[1]); |
| 62 | cache->poly.vert[2] = *((xVec3*)tri->vertices[2]); |
| 63 | cache->poly.norm = *((xVec3*)&tri->normal); |
| 64 | |
| 65 | return tri; |
| 66 | } |
| 67 | |
| 68 | static RpCollisionTriangle* shadowRayModelCB(RpIntersection* isx, RpCollisionTriangle* tri, |
| 69 | F32 dist, void* data) |
| 70 | { |
| 71 | return shadowRayCB(isx, NULL, tri, dist, data); |
| 72 | } |
| 73 | |
| 74 | static S32 shadowRayEntCB(xEnt* ent, void* data) |
| 75 | { |
| 76 | if (!(ent->baseFlags & 0x10)) |
| 77 | { |
| 78 | return 1; |
| 79 | } |
| 80 | |
| 81 | if (((shadowRayEntData*)data)->cache->flags & 8) |
| 82 | { |
| 83 | if (ent->baseType == 0x2b) |
| 84 | { |
no test coverage detected