anthony.liot Posted April 11, 2012 Share Posted April 11, 2012 I have an very weird bug, on windows and not on OSX. I use renderLine3D visualizer and work well when i use debug version of Unigine, but if i am with release version my visualizer is black. I change in renderLine3D function ftos by ftoi and work well. He seem the problem come with the IntDouble type but i don't understand why. Thanks Link to comment
frustum Posted April 12, 2012 Share Posted April 12, 2012 There is only one signature of int Math::ftos(float) function. This function converts floating point number into the 16bit integer. This function is used for particles rendering and there are no visual bugs with particles. How you use this function? Link to comment
anthony.liot Posted April 12, 2012 Author Share Posted April 12, 2012 It's very weird because Math::ftos is use in a lot of function ... i.e. : image_vec4_to_pixel / visualizer / widgetdialogcolor / grass / clouds MathLib.spu.h INLINE int Math::ftos(float v) { return static_cast<int>(v); } MathLib.h INLINE int Math::ftos(float v) { #ifdef _CELLOS_LV2 return __fctiwz(v); #elif _WIN64 return static_cast<int>(v); #else IntDouble i = (68719476736.0 * 1.5) + v; #ifdef USE_BIG_ENDIAN return i.i[1] >> 16; #else return i.i[0] >> 16; #endif #endif } My bug is in this function : void Visualizer::renderLine3D(const Vec3 &v0,const Vec3 &v1,const vec4 &color) { if(enabled == 0) return; AtomicLock atomic(&lock); Line l; l.color[0] = Math::ftos(color.x * 255.0f); l.color[1] = Math::ftos(color.y * 255.0f); l.color[2] = Math::ftos(color.z * 255.0f); l.color[3] = Math::ftos(color.w * 255.0f); l.xyz[0] = vec3(modelview * v0); l.xyz[1] = vec3(modelview * v1); lines_3d.append(l); } if i change by void Visualizer::renderLine3D(const Vec3 &v0,const Vec3 &v1,const vec4 &color) { if(enabled == 0) return; AtomicLock atomic(&lock); Line l; l.color[0] = Math::ftoi(color.x * 255.0f); l.color[1] = Math::ftoi(color.y * 255.0f); l.color[2] = Math::ftoi(color.z * 255.0f); l.color[3] = Math::ftoi(color.w * 255.0f); l.xyz[0] = vec3(modelview * v0); l.xyz[1] = vec3(modelview * v1); lines_3d.append(l); } that work. Link to comment
frustum Posted April 12, 2012 Share Posted April 12, 2012 Try to pass saturated color into the renderLine3D() function: renderLine3D(p0,p1,saturate(color)); I will add bound checking inside visualizer functions. Link to comment
Recommended Posts