[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [11816] branches/soc-2007-maike/source/ blender/src/glsl_util.c: Change in float to string conversion due to negative values not to lose precision

Miguel Torres Lima torreslima at gmail.com
Fri Aug 24 20:33:38 CEST 2007


Revision: 11816
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=11816
Author:   maike
Date:     2007-08-24 20:33:38 +0200 (Fri, 24 Aug 2007)

Log Message:
-----------
Change in float to string conversion due to negative values not to lose precision

Modified Paths:
--------------
    branches/soc-2007-maike/source/blender/src/glsl_util.c

Modified: branches/soc-2007-maike/source/blender/src/glsl_util.c
===================================================================
--- branches/soc-2007-maike/source/blender/src/glsl_util.c	2007-08-24 18:32:30 UTC (rev 11815)
+++ branches/soc-2007-maike/source/blender/src/glsl_util.c	2007-08-24 18:33:38 UTC (rev 11816)
@@ -163,7 +163,10 @@
     }
     else if(type == GFLOAT){
       tmp_float = (float) va_arg(ap, double);
-      tmp_str = MEM_mallocN(sizeof(char) * 9, "GLSL float");
+      if(tmp_float > 0.0)
+	tmp_str = MEM_mallocN(sizeof(char) * 9, "GLSL float");
+      else
+	tmp_str = MEM_mallocN(sizeof(char) * 10, "GLSL neg float");
       sprintf(tmp_str, "%f", tmp_float);
 
       code = glsl_concat_strings(code, tmp_str);





More information about the Bf-blender-cvs mailing list