diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2015-03-07 04:35:54 +0300 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2015-03-09 06:53:11 +0300 |
commit | a0fa3de267f8c09ed6c7a72716d9dab49dfd4c2c (patch) | |
tree | 8ac942e75b507a31e83e67d8f780e1536cbf9d34 /source/blender/freestyle | |
parent | ec180218678be5704d31532fff8c20d2356b8f02 (diff) |
Fix T43624: Freestyle uses wrong colour on second Line Set with textured lines in Cycles.
This is a regression introduced by rBd8b00a3bf5c1 (Freestyle: memory
consumption optimization in stroke rendering).
The issue was caused by uninitialized MPoly::mat_nr values. Before the
stroke rendering optimization, individual Freestyle strokes were
represented by distinct mesh objects, and thus MPoly::mat_nr was left
unset (i.e., was always zero). Now that the stroke rendering optimization
has been done and mesh objects may represent multiple strokes of different
materials, MPoly::mat_nr had to be properly set to the material index that
refers to the material of the poly face.
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r-- | source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp index 70de246a8de..f304e8ae9bd 100644 --- a/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/blender_interface/BlenderStrokeRenderer.cpp @@ -730,7 +730,6 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) it != itend; ++it) { mesh->mat[material_index] = (*it)->getMaterial(); - material_index++; vector<Strip*>& strips = (*it)->getStrips(); for (vector<Strip*>::const_iterator s = strips.begin(), send = strips.end(); s != send; ++s) { @@ -811,6 +810,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) // poly polys->loopstart = loop_index; polys->totloop = 3; + polys->mat_nr = material_index; ++polys; // Even and odd loops connect triangles vertices differently @@ -909,6 +909,7 @@ void BlenderStrokeRenderer::GenerateStrokeMesh(StrokeGroup *group, bool hasTex) } } // loop over strip vertices } // loop over strips + material_index++; } // loop over strokes test_object_materials(freestyle_bmain, (ID *)mesh); |