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

Generate Missing Texture Texture #116

Merged
merged 2 commits into from
Apr 19, 2024

Conversation

TheBrokenRail
Copy link
Contributor

This generates a proper "missing texture" texture when one fails to load.

IMO this is way better than everything just defaulting to black. (Seriously, if you don't have assets loaded, the entire title-screen will be 100% black and it isn't that clear what the error is.)

This will also stop ReMCPE from spamming the console with error messages when it can't find a texture. (This issue was caused by it trying to load the texture every frame, but now it will only try to load it once.)

Screenshot:
Screenshot from 2024-01-23 22-18-53

t.m_pixels[2] = 0xff000000;
}

int result = assignTexture(name, t);
Copy link
Contributor

Choose a reason for hiding this comment

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

It looks like -1 was originally returned here to indicate an error occurred loading the texture. Surely there's a way to still allow for error detection & "texture not found" warnings while still keeping the placeholder textures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since a texture is now always assigned, IMO, there's no reason for Textures to propagate the error.

Also, warnings still work. They're printed by AppPlatform.

Copy link
Contributor

Choose a reason for hiding this comment

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

As long as warnings still work, then I don't really see any downsides here. Looks all good!

Copy link
Member

Choose a reason for hiding this comment

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

BTW, you should probably replace the duplicate t.m_pixels check with an if-else branching statement.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

What duplicate check?

Copy link
Member

Choose a reason for hiding this comment

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

Oh! Sorry, I was looking in my mail and saw something that looked like this. Totally didn't see the - and + signs, sorry
image

source/client/renderer/Textures.cpp Outdated Show resolved Hide resolved
@iProgramMC iProgramMC merged commit fefcf95 into ReMinecraftPE:master Apr 19, 2024
6 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.

3 participants