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

Function xPartitionVolume

src/SB/Core/x/xPartition.cpp:42–79  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40}
41
42void xPartitionVolume(_tagPartition* part, xVolume* volume, S32 x_spaces, S32 y_spaces,
43 S32 z_spaces)
44{
45 memset(part, 0, sizeof(_tagPartition));
46 xBound* xb = volume->GetBound();
47 xBox* bb = &xb->box.box;
48 part->min = bb->lower;
49 part->max = bb->upper;
50
51 F32 dx = part->max.x - part->min.x;
52 F32 dy = part->max.y - part->min.y;
53 F32 dz = part->max.z - part->min.z;
54
55 part->total_x = x_spaces;
56 part->total_y = y_spaces;
57 part->total_z = z_spaces;
58
59 part->space_dim.x = dx / part->total_x;
60 part->space_dim.y = dy / part->total_y;
61 part->space_dim.z = dz / part->total_z;
62
63 part->space = (_tagPartSpace*)xMemAlloc(
64 gActiveHeap, sizeof(_tagPartSpace) * part->total_x * part->total_y * part->total_z, 0);
65
66 for (S32 z = 0; z < z_spaces; z++)
67 {
68 for (S32 y = 0; y < y_spaces; y++)
69 {
70 for (S32 x = 0; x < x_spaces; x++)
71 {
72 S32 idx = xPartitionGetTrueIdx(part, x, y, z);
73 PartitionSpaceReset(&part->space[idx]);
74 }
75 }
76 }
77
78 PartitionSpaceReset(&part->global);
79}
80
81void xPartitionWorld(_tagPartition* part, xEnv* env, S32 x_spaces, S32 y_spaces, S32 z_spaces)
82{

Callers 1

zLightResetAllFunction · 0.50

Calls 5

memsetFunction · 0.85
xPartitionGetTrueIdxFunction · 0.85
PartitionSpaceResetFunction · 0.85
GetBoundMethod · 0.80
xMemAllocFunction · 0.70

Tested by

no test coverage detected