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: Textures, uv coordinates and light source not updating properly. #1872

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

paxcut
Copy link
Contributor

@paxcut paxcut commented Aug 25, 2024

Problem description

The only time textures would update was through the file picker. Once UV coordinates were used, disabling them didn't have any effect because the vertex array didn't invalidate the corresponding buffer array. When shouldUpdate is true, the light source needs to know as well, otherwise it will set the ___location at 0,0.

Implementation description

Textures were fixed by creating a member variable that holds the file name of the texture used in the last model rendering.

Instead of invalidating buffer arrays it is much simpler to define a default UV coordinate set for the case when no UV is specified. if a texture is not present then the values of UV will not be used. If there is a texture it must be a minimum of 1 pixel in size. So we choose the UV coordinates so that every vertex gets assigned the color at the 0,0 coordinate of the texture.

When shouldUpdate is on, we also turn shouldUpdateLightSource on.

Also included are some formatting changes that are purely aesthetic.

paxcut and others added 3 commits August 25, 2024 07:29
The only time textures would update was through the file picker. Once uv coordinates were used, disabling them didn't have any effect because the vertex array didn't invalidate the corresponding buffer array. When shouldUpdate is true, the light source needs to know as well, otherwise it will set the ___location at 0,0.

Textures were fixed by creating a member variable that holds the file name of the texture used in the last model rendering.

Instead of invalidating buffer arrays it is much simpler to define a default uv coordinate set for the case when no un is specified. if a texture is not present then the values of uv will not be used. If there is a texture it must be a minimum of 1 pixel in size. So we choose the uv coordinates so that every vertex gets assigned the color at the 0,0 coordinate of the texture.

When shouldUpdate is on, we also turn shouldUpdateLightSource on.

Also included are some formatting changes that are purely aesthetical.
@WerWolv
Copy link
Owner

WerWolv commented Sep 15, 2024

Might have merged the other PRs in the wrong order, sorry. There's a few merge conflicts here now

@paxcut
Copy link
Contributor Author

paxcut commented Sep 15, 2024

No problem, I'll take a look at it now.

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