Jump to content

setLayerTransform's strange behavior in double precision


photo

Recommended Posts

I have a compass script, which have these codes:

vec3 pos = imgSize * -s;
mat4 trans = translate(pos) * scale(vec3(s));
compass.setLayerTransform(nPlateLayer, trans);

 

you can see I'm using mat4 not dmat4, but engine keeps told me Variable::getMat4Safe(): can't convert dmat4 to mat4, why?? if I comment the setLayerTransform, then script runs, but of course, the compass WidgetSprite was placed with wrong position and scale.

 

I've also checked the sample

sprite.setLayerTransform(i + 1,translate(positions[i]) * scale(vec3(scales[i])) * rotate);

 

It's really confusing me . :)

Link to comment

Variable::getMat4Safe(): can't convert dmat4 to mat4 indicates that variable trans has actual type dmat4 (even if you declared it with mat4 hint, keep in mind its just a hint). Explicit casting to mat4 converts trans to the required input format for Sprite.setLayerTransform(mat4).

 

Some previous operation seems to have caused an implicit type conversion to double format. Post your code before

.... # give details on imgSize and s declaration and init
....
vec3 pos = imgSize * -s;

Link to comment
×
×
  • Create New...