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

feat: update uv_to_texture_space function #5

Merged
merged 8 commits into from
Nov 24, 2023
Merged

Conversation

TechyDaniel
Copy link
Contributor

@TechyDaniel TechyDaniel commented Nov 16, 2023

Description

This PR introduces the uv_to_texture_space function, designed to convert UV coordinates to texture space coordinates. The function is capable of handling specific vertex indices or processing all vertices in the mesh. It includes robust validation checks to handle out-of-range UV coordinates, ensuring that UV coordinates are within the standard [0, 1] range. Additionally, the PR includes a comprehensive suite of unit tests to validate the functionality of this new function under various scenarios.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

The updated function was tested with a series of new unit tests that were added to the existing test suite. These tests include scenarios where UV coordinates are out of the standard range and where indices do not have corresponding UVs. All tests pass, confirming the correctness of the changes.

  • Added new unit tests for out-of-range UV coordinates
  • Added new unit tests for vertices without corresponding UVs

Test Configuration:
Tests were performed using the project's standard test environment.

Checklist

  • I confirm that the changes meet the user experience and goals outlined in the design plan (if there is one).
  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have updated any version info, if necessary.
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Modify the function to handle edge cases and improve tests.
@TechyDaniel TechyDaniel self-assigned this Nov 16, 2023
@TechyDaniel TechyDaniel marked this pull request as ready for review November 16, 2023 17:21
Copy link
Collaborator

@Olaf-Wolf3D Olaf-Wolf3D left a comment

Choose a reason for hiding this comment

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

a bit of refactoring needed.

src/readyplayerme/meshops/types.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
tests/readyplayerme/meshops/unit/test_mesh.py Outdated Show resolved Hide resolved
tests/readyplayerme/meshops/unit/test_mesh.py Outdated Show resolved Hide resolved
@Olaf-Wolf3D Olaf-Wolf3D marked this pull request as draft November 17, 2023 17:21
@TechyDaniel TechyDaniel marked this pull request as ready for review November 20, 2023 15:35
src/readyplayerme/meshops/types.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/types.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
- Add function to convert UV coordinates to texture space pixel coordinates.
- Ensure correct handling of edge cases including wrapping of out-of-range UVs.
- Include comprehensive tests to validate functionality across various scenarios.
@TechyDaniel TechyDaniel marked this pull request as draft November 21, 2023 21:55
@TechyDaniel TechyDaniel marked this pull request as ready for review November 21, 2023 21:55
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
src/readyplayerme/meshops/mesh.py Outdated Show resolved Hide resolved
- now if the indices are none it creates a list of the length of UVs and selects them all.
- added a test for 0 px image.
@TechyDaniel TechyDaniel marked this pull request as draft November 23, 2023 16:49
@TechyDaniel TechyDaniel marked this pull request as ready for review November 23, 2023 16:49
func now called uv_to_image_coords, removed unnecessary code
@Olaf-Wolf3D Olaf-Wolf3D marked this pull request as draft November 24, 2023 15:02
@Olaf-Wolf3D Olaf-Wolf3D marked this pull request as ready for review November 24, 2023 15:02
@Olaf-Wolf3D Olaf-Wolf3D merged commit df10367 into main Nov 24, 2023
1 check passed
@Olaf-Wolf3D Olaf-Wolf3D deleted the feat/UV_to_texCoord branch November 24, 2023 15:13
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