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

Color transform fix, closes #2192 #2195

Merged
merged 2 commits into from
Dec 4, 2018

Conversation

JoeCreates
Copy link
Member

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, each colored and hasColorOffsets 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.

@@ -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;
Copy link
Member

Choose a reason for hiding this comment

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

?

Copy link
Member Author

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.

@larsiusprime
Copy link
Member

Much thanks, I'm going to give this a test locally.

@larsiusprime
Copy link
Member

It works! It works! Oh man I'm so happy @JoeCreates . Where shall I send the bounty?

@Gama11
Copy link
Member

Gama11 commented Dec 4, 2018

Thanks!

@Gama11 Gama11 merged commit 5d92ab0 into HaxeFlixel:dev Dec 4, 2018
@Gama11
Copy link
Member

Gama11 commented Jan 22, 2019

Hm, I thought this would fix that issue in the FlxMouseEventManager demo, but it seems it hasn't... :/

http://haxeflixel.com/demos/FlxMouseEventManager/

@Gama11
Copy link
Member

Gama11 commented Jan 22, 2019

Looks like that might be the same issue as #2158.

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