Closed pSi-X closed 8 years ago
Thanks for reporting this, but.. if you set "texture.repeat=true" and the variable "repeat = true" when you call the constructor of TextureVertexColorFragmentShader, "shouldRepeat" will become true, yes?
I agree it's not a pretty solution, but it should at least give the correct functionality, I think?
Maybe that variant is correct:
var shouldRepeat:Boolean = texture == null ? repeat : (texture.repeat || repeat);
But yes, this solution repairs situation with TextureMaterial and TextureVertexColorFragmentShader :)
Please close the issue and to commit with such a decision:
var shouldRepeat:Boolean = texture == null ? repeat : (texture.repeat || repeat);
Thank you! :)
This is a poorly designed API. The correct way to use this would be to force the person calling the method to specify the "repeat" argument to true or false. This is a good example where an argument with a default value causes problems.
To be honest, I don't want to change the API since that might cause backwards compatability issues. What situation do you have where you can't get the correct values to be set?
If you need the "shouldRepeat" to be set to either true or false, you can currently make that happen by setting values in the constructor appropriately, right?
If not, please show me a code example where things go wrong.
In the class TextureMaterial creates an instance of the class TextureVertexColorFragmentShader without repetition, and the default value false
, so the value shouldRepeat var shouldRepeat:Boolean = texture == null ? repeat : ( texture.repeat ? repeat : false)
always is false
:
public function TextureMaterial(texture:Texture, color:uint = 0xFFFFFF, premultipliedAlpha:Boolean = true) {
super(new StandardVertexShader(), new TextureVertexColorFragmentShader(texture));
...
}
And when I use the TextureMaterial, even if the texture.repeat == true, repeat value is taken by default, which is false.
P.s. Sorry for my english :)
I have updated the TextureMaterial to take more arguments, that gets sent to the TextureVertexColorFragmentShader.
This should give you the flexibility you need without sacrificing backwards compatibility.
Thank you very much, now works as needed! ^_^
But now, an extra comma after texture,,
:
super(new StandardVertexShader(), new TextureVertexColorFragmentShader(texture,, mipmapping, repeat, smoothing ));
https://github.com/StarlingGraphics/Starling-Extension-Graphics/issues/143
Hi, sory my bad English :) I encountered a problem that can be seen in the screenshot:
When I started to dig deeper, I found a bug in the class TextureVertexColorFragmentShader:
It is a repeat of the texture will never be taken. Please fix this bug.
Best regards, pSi-X