MCPcopy Create free account
hub / github.com/bfbbdecomp/bfbb / xShadowSimple_CacheInit

Function xShadowSimple_CacheInit

src/SB/Core/x/xShadowSimple.cpp:27–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25static RwMatrixTag* sModelMat;
26
27extern xGrid colls_grid;
28extern xGrid colls_oso_grid;
29extern xGrid npcs_grid;
30extern xQCControl xqc_def_ctrl;
31
32static 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
68static RpCollisionTriangle* shadowRayModelCB(RpIntersection* isx, RpCollisionTriangle* tri,
69 F32 dist, void* data)
70{
71 return shadowRayCB(isx, NULL, tri, dist, data);
72}
73
74static 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 {

Callers 4

InitMethod · 0.70
xEntBoulder_InitFunction · 0.70
zEntPlayer_InitFunction · 0.50
zEntPickupInitFunction · 0.50

Calls 3

xSTAssetCountByTypeFunction · 0.70
xSTFindAssetByTypeFunction · 0.70
xSTFindAssetFunction · 0.70

Tested by

no test coverage detected