Bugs 12196 & 12154 fixed: There were no log-scales with Fec & Fac3d.
[scilab.git] / scilab / modules / graphic_objects / src / cpp / TriangleMeshFecDataDecomposer.cpp
index 150b6ef..c834fd7 100644 (file)
@@ -45,13 +45,39 @@ void TriangleMeshFecDataDecomposer::fillVertices(char* id, float* buffer, int bu
 
     for (int i = 0; i < numVertices; i++)
     {
-        buffer[elementsSize*i] = (float)coordinates[3*i];
-        buffer[elementsSize*i +1] = (float)coordinates[3*i+1];
-        buffer[elementsSize*i +2] = (float)coordinates[3*i+2];
+        if (coordinateMask & 0x1)
+        {
+            double xi = coordinates[3 * i];
+            if (logMask & 0x1)
+            {
+                xi = DecompositionUtils::getLog10Value(xi);
+            }
+            buffer[elementsSize * i] = (float)(xi * scale[0] + translation[0]);
+        }
 
-        if (elementsSize == 4)
+        if (coordinateMask & 0x2)
+        {
+            double yi = coordinates[3 * i + 1];
+            if (logMask & 0x2)
+            {
+                yi = DecompositionUtils::getLog10Value(yi);
+            }
+            buffer[elementsSize * i + 1] = (float)(yi * scale[1] + translation[1]);
+        }
+
+        if (coordinateMask & 0x4)
+        {
+            double zi = coordinates[3 * i + 2];
+            if (logMask & 0x4)
+            {
+                zi = DecompositionUtils::getLog10Value(zi);
+            }
+            buffer[elementsSize * i + 2] = (float)(zi * scale[2] + translation[2]);
+        }
+
+        if (elementsSize == 4 && (coordinateMask & 0x8))
         {
-            buffer[elementsSize*i +3] = 1.0;
+            buffer[elementsSize * i + 3] = 1.0;
         }
     }
 
@@ -90,11 +116,11 @@ void TriangleMeshFecDataDecomposer::fillTextureCoordinates(char* id, float* buff
 
     if (colorRange[0] != 0 || colorRange[1] != 0)
     {
-      colorsNumber = (double) (1 + colorRange[1] - colorRange[0]);
+        colorsNumber = (double) (1 + colorRange[1] - colorRange[0]);
     }
     else
     {
-      colorsNumber = (double) colormapSize;
+        colorsNumber = (double) colormapSize;
     }
 
     /** To take into account the presence of exterior colors:
@@ -278,7 +304,7 @@ void TriangleMeshFecDataDecomposer::fillColors(char* id, float* buffer, int buff
         }
         else
         {
-                /* To do: replace 0.5 by a macro-definition */
+            /* To do: replace 0.5 by a macro-definition */
             ColorComputer::getColor(values[i], minValue, valueRange, 0.5, colormap, minColorIndex, maxColorIndex, colormapSize, &buffer[bufferOffset]);
         }