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

Fix mipmapping regression #98

Merged
merged 3 commits into from
Nov 9, 2024

Conversation

yogwoggf
Copy link
Contributor

@yogwoggf yogwoggf commented Nov 9, 2024

Fixes #96

PR Type (tick all that are applicable)

  • Bug Fix
  • New Feature (doesn't break Module <-> Lua compatibility)
  • New Feature (breaks Module <-> Lua compatibility)
  • Documentation Update Required

Tested Targets (only applicable for changes to the binary module, delete otherwise)

  • windows-x64-release
  • windows-x86-release

Checklist

  • I have read and understand the contributing guidelines
  • I have tested all aspects of this PR (not required)

Description
Properly passes the UVs of any world/model triangle into the TriangleBackfaceCull class so that the data is intact once it calls ComputeNormalAndLoD()

Copy link
Owner

@Derpius Derpius left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Couple of small comments

@@ -94,7 +101,7 @@ Mesh::Mesh(
tri.tangents[j] = glm::normalize(glm::vec3(tri.e1[0], tri.e1[1], tri.e1[2]));
}

tri.uvs[j] = glm::vec2(verts[j]->texCoord.x, verts[j]->texCoord.y);
tri.uvs[j] = uvs[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 shouldn't be needed now that it's passed to the constructor right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, my mistake

const bool oneSided = false
) : p0(p0), e1(p0 - p1), e2(p2 - p0), material(material), oneSided(oneSided)
) : p0(p0), e1(p0 - p1), e2(p2 - p0), material(material), uvs(), oneSided(oneSided)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this empty initialisation doing anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No

Comment on lines 413 to 415
memcpy(tri.normals, normals + vi0, sizeof(glm::vec3) * 3);
memcpy(tri.tangents, tangents + vi0, sizeof(glm::vec3) * 3);
memcpy(tri.uvs, uvs + vi0, sizeof(glm::vec2) * 3);
memcpy(tri.alphas, alphas + vi0, sizeof(float) * 3);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be ideal to pass the other data in via the constructor too, but not gonna make you do that

@Derpius
Copy link
Owner

Derpius commented Nov 9, 2024

No idea why the build is failing now due to vcpkg (the repository has never used it)

@yogwoggf yogwoggf requested a review from Derpius November 9, 2024 22:48
@Derpius Derpius merged commit 06ba9ee into Derpius:master Nov 9, 2024
0 of 2 checks passed
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.

[bug] Regression in mipmapping calcs
2 participants