[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [41062] branches/cycles/intern/cycles/ blender/blender_mesh.cpp: Cycles: use mesh normals computed by Blender instead of computing our own,

Brecht Van Lommel brechtvanlommel at pandora.be
Sun Oct 16 19:00:49 CEST 2011


Revision: 41062
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=41062
Author:   blendix
Date:     2011-10-16 17:00:48 +0000 (Sun, 16 Oct 2011)
Log Message:
-----------
Cycles: use mesh normals computed by Blender instead of computing our own,
solves an issue with poor mesh geometry.

Modified Paths:
--------------
    branches/cycles/intern/cycles/blender/blender_mesh.cpp

Modified: branches/cycles/intern/cycles/blender/blender_mesh.cpp
===================================================================
--- branches/cycles/intern/cycles/blender/blender_mesh.cpp	2011-10-16 16:53:24 UTC (rev 41061)
+++ branches/cycles/intern/cycles/blender/blender_mesh.cpp	2011-10-16 17:00:48 UTC (rev 41062)
@@ -65,6 +65,13 @@
 	for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v)
 		mesh->verts.push_back(get_float3(v->co()));
 
+	/* create vertex normals */
+	Attribute *attr_N = mesh->attributes.add(Attribute::STD_VERTEX_NORMAL);
+	float3 *N = attr_N->data_float3();
+
+	for(b_mesh.vertices.begin(v); v != b_mesh.vertices.end(); ++v, ++N)
+		*N= get_float3(v->normal());
+
 	/* create faces */
 	BL::Mesh::faces_iterator f;
 	vector<int> nverts;




More information about the Bf-blender-cvs mailing list