WIP
| 95 | |
| 96 | // WIP |
| 97 | void zLOD_Setup(void) |
| 98 | { |
| 99 | sTableCount = 0; |
| 100 | sTableList = NULL; |
| 101 | sManagerCount = 0; |
| 102 | |
| 103 | U32 assetCount = xSTAssetCountByType('LODT'); |
| 104 | if (assetCount == 0) |
| 105 | { |
| 106 | return; |
| 107 | } |
| 108 | |
| 109 | for (U32 i = 0; i < assetCount; i++) |
| 110 | { |
| 111 | U32 tmpSize; |
| 112 | S32* asset = (S32*)xSTFindAssetByType('LODT', i, &tmpSize); |
| 113 | sTableCount += *asset; |
| 114 | } |
| 115 | |
| 116 | if (sTableCount == 0) |
| 117 | { |
| 118 | return; |
| 119 | } |
| 120 | |
| 121 | zLODTable* tableCurr = (zLODTable*)xMemAlloc(gActiveHeap, sTableCount * sizeof(zLODTable), 0); |
| 122 | sTableList = tableCurr; |
| 123 | |
| 124 | for (U32 i = 0; i < assetCount; i++) |
| 125 | { |
| 126 | U32 tmpSize; |
| 127 | S32* asset = (S32*)xSTFindAssetByType('LODT', i, &tmpSize); |
| 128 | memcpy(tableCurr, asset + 1, (*asset) * sizeof(zLODTable)); |
| 129 | tableCurr += *asset; |
| 130 | } |
| 131 | |
| 132 | tableCurr = sTableList; |
| 133 | for (U32 i = 0; i < sTableCount; i++, tableCurr++) |
| 134 | { |
| 135 | tableCurr->noRenderDist *= tableCurr->noRenderDist; |
| 136 | |
| 137 | if (tableCurr->baseBucket) |
| 138 | { |
| 139 | RpAtomic* model = (RpAtomic*)xSTFindAsset((U32)tableCurr->baseBucket, NULL); |
| 140 | tableCurr->baseBucket = model ? xModelBucket_GetBuckets(model) : NULL; |
| 141 | } |
| 142 | |
| 143 | for (U32 j = 0; j < 3; j++) |
| 144 | { |
| 145 | if (tableCurr->lodBucket[j]) |
| 146 | { |
| 147 | RpAtomic* model = (RpAtomic*)xSTFindAsset((U32)tableCurr->lodBucket[j], NULL); |
| 148 | tableCurr->lodBucket[j] = model ? xModelBucket_GetBuckets(model) : NULL; |
| 149 | } |
| 150 | tableCurr->lodDist[j] *= tableCurr->lodDist[j]; |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | sManagerCount = 0; |
no test coverage detected