-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement mmBoundTemplate::ComputeEdges() #156
base: master
Are you sure you want to change the base?
Conversation
Unsure about the line: `v1 = *((__int16 *)&this->Polygons[j + 1].MtlIndex + num_verts);`
total_verts += Polygons[i].GetNumVerts(); | ||
} | ||
|
||
i32* edge_1s = new i32[4 * total_verts]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code allocates 4 * total_verts
bytes, which is just total_verts
ints.
i32 v1 = poly.MtlIndex + num_verts; // ? | ||
// Original line: v1 = *((__int16 *)&this->Polygons[j + 1].MtlIndex + num_verts); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's doing poly.VertIndices[num_verts - 1]
(MtlIndex is stored 2 bytes before the VertIndices)
if (!EdgeInList(v1, v2, num_edges, edge_1s, edge_2s)) | ||
{ | ||
edge_1s[num_edges] = v1; | ||
edge_2s[num_edges++] = v2; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather move the num_edges++
to a separate line after, since multiple things rely on it in this branch.
|
||
i32 num_edges = 0; | ||
|
||
for (i32 j = 0; j < NumPolys; ++j) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can use i
, since the previous one isn't used at this point.
Unsure about the line:
v1 = *((__int16 *)&this->Polygons[j + 1].MtlIndex + num_verts);