haxiomic / vector-math

Shader-math in haxe: library for GLSL vector operations, complete with swizzles and all
MIT License
39 stars 7 forks source link

Fix hxcpp attribute definitions occurs #17

Closed rainyt closed 1 year ago

rainyt commented 3 years ago

It seems to have recreated a variable from the time it was obtained, but it should actually be ignored.

Test Haxe:

var v_color:Vec4 = vec4(1,0,0,1);
v_color.a = v_color.r + 0.5;
v_color.a = 2 + 0.5;
v_color.a = 1 + 0.5;
haxiomic commented 3 years ago

Hey, I’ll investigate this more thoroughly to this soon, life is very hectic for me this week

The reason for var self is because if $expr is not-trivial, it could be doing complex things like mutating state and having it copied several times can lead to issues (which is what made me add var self to begin with)

this should work but the bug you’re seeing looks to be a haxe/hxcpp issue - if you can make a small reproducible example it would be great to open an issue on the haxe repository and see if we can get it resolved in the compiler

haxiomic commented 1 year ago

I think this is resolved thanks to compiler changes, closing (see #16)