Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KcRobin9
Copy link
Collaborator

Unsure about the line:

v1 = *((__int16 *)&this->Polygons[j + 1].MtlIndex + num_verts);

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];
Copy link
Owner

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.

Comment on lines +54 to +55
i32 v1 = poly.MtlIndex + num_verts; // ?
// Original line: v1 = *((__int16 *)&this->Polygons[j + 1].MtlIndex + num_verts);
Copy link
Owner

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;
Copy link
Owner

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)
Copy link
Owner

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants