-
Notifications
You must be signed in to change notification settings - Fork 52
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
Generate Missing Texture Texture #116
Conversation
source/client/renderer/Textures.cpp
Outdated
t.m_pixels[2] = 0xff000000; | ||
} | ||
|
||
int result = assignTexture(name, t); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What duplicate check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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: