mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-09 07:47:42 +00:00
Added distinct-normal vertex extraction
This commit is contained in:
@@ -28,6 +28,11 @@ void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
|
||||
" if loop.vert.index == vert_idx:\n"
|
||||
" return loop\n"
|
||||
"\n"
|
||||
"def eq_normals(n1, n2):\n"
|
||||
" if n1[0] == n2[0] and n1[1] == n2[1] and n1[2] == n2[2]:\n"
|
||||
" return True\n"
|
||||
" return False\n"
|
||||
"\n"
|
||||
"def add_triangle(bm, vert_seq, vert_indices, norm_seq, norm_indices, mat_nr, od_list):\n"
|
||||
" if len(set(vert_indices)) != 3:\n"
|
||||
" return None, None\n"
|
||||
@@ -37,6 +42,11 @@ void InitGeomBlenderContext(HECL::BlenderConnection::PyOutStream& os,
|
||||
" verts = [vert_seq[i] for i in vert_indices]\n"
|
||||
" norms = [norm_seq[i] for i in norm_indices]\n"
|
||||
"\n"
|
||||
" for i in range(3):\n"
|
||||
" if not eq_normals(verts[i].normal, norms[i]):\n"
|
||||
" verts[i] = bm.verts.new(verts[i].co, verts[i])\n"
|
||||
" vert_seq.ensure_lookup_table()\n"
|
||||
"\n"
|
||||
" # Make the face\n"
|
||||
" face = bm.faces.get(verts)\n"
|
||||
"\n"
|
||||
|
||||
Reference in New Issue
Block a user