Fix part of T50634: Hair Primitive as Triangles + Hair shader with a texture = crash
authorSergey Sharybin <sergey.vfx@gmail.com>
Mon, 27 Feb 2017 12:39:23 +0000 (13:39 +0100)
committerSergey Sharybin <sergey.vfx@gmail.com>
Mon, 27 Feb 2017 14:21:14 +0000 (15:21 +0100)
Wrong formula was used to calculate needed verts and tris to be reserved.

intern/cycles/blender/blender_curves.cpp

index 9214882bb9b08d4bbd377230c79fa9551df5cabb..7365f39aaaec2ad81ac9ba961702591aec330a8d 100644 (file)
@@ -434,8 +434,8 @@ static void ExportCurveTriangleGeometry(Mesh *mesh,
                        if(CData->curve_keynum[curve] <= 1 || CData->curve_length[curve] == 0.0f)
                                continue;
 
-                       numverts += (CData->curve_keynum[curve] - 2)*2*resolution + resolution;
-                       numtris += (CData->curve_keynum[curve] - 2)*resolution;
+                       numverts += (CData->curve_keynum[curve] - 1)*resolution + resolution;
+                       numtris += (CData->curve_keynum[curve] - 1)*2*resolution;
                }
        }