-
Notifications
You must be signed in to change notification settings - Fork 432
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
Color transform fix, closes #2192 #2195
Conversation
…shader valid colorMultipliers
8dad914
to
1b310b2
Compare
@@ -12,7 +12,7 @@ import openfl.Vector; | |||
|
|||
class FlxDrawQuadsItem extends FlxDrawBaseItem<FlxDrawQuadsItem> | |||
{ | |||
static inline var VERTICES_PER_QUAD = #if (openfl >= "8.5.0") 4 #else 6 #end; | |||
static inline var VERTICES_PER_QUAD = #if (openfl >= "8.5.0") 1 #else 1 #end; |
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.
?
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.
Sorry, I didn't mean to push that but accidentally did when I did the force ppush to fix the codeclimate issue. It's probably worth looking at first, though, tbh. I'm not sure the looping is necessary.
1b310b2
to
52a2a93
Compare
52a2a93
to
2ac362c
Compare
Much thanks, I'm going to give this a test locally. |
It works! It works! Oh man I'm so happy @JoeCreates . Where shall I send the bounty? |
Thanks! |
Hm, I thought this would fix that issue in the FlxMouseEventManager demo, but it seems it hasn't... :/ |
Looks like that might be the same issue as #2158. |
There were two issues in #2192.
Firstly, the color transform was being applied twice because the generated graphics were not being set to unique.
Secondly was the actual shader issue. The problem was that the shader applies the offsets and multipliers based off of a single flag,
hasColorTransform
. However, in actually populating the values to be used for these, eachcolored
andhasColorOffsets
are checked individually to populate the inputs for the shader.In the case of a transform with multipliers but no offsets, this was fine, because the lack of offsets had no affect on the result as they effectively default to 0. In the case of offsets but no multipliers, however, treating the multipliers as 0 by default resulted in a black sprite.
I had two options for resolving this. One was to split up the application of offsets and multipliers in the shader and pass in two flag,s one for each, or make it so that if either are true when we are giving the shader the inputs that we populate both inputs instead of only one.
I opted for the latter solution as this means that the shader interface does not change, and I wasn't sure what else might have broken if I did change the shader interface.