Cycles: use mesh normals computed by Blender instead of computing our own,

solves an issue with poor mesh geometry.
This commit is contained in:
Brecht Van Lommel
2011-10-16 17:00:48 +00:00
parent 5c3d8c1eb6
commit 7b1ef0f416

View File

@@ -65,6 +65,13 @@ static void create_mesh(Scene *scene, Mesh *mesh, BL::Mesh b_mesh, const vector<
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;