Browse Source

Merge pull request #91372 from clayjohn/RS-blend-shape-tangent

Enable tangents in blend shape format when using normals
Rémi Verschelde 1 year ago
parent
commit
3ebef6ce7a
1 changed files with 4 additions and 0 deletions
  1. 4 0
      servers/rendering_server.cpp

+ 4 - 0
servers/rendering_server.cpp

@@ -1226,6 +1226,10 @@ Error RenderingServer::mesh_create_surface_data_from_arrays(SurfaceData *r_surfa
 					bsformat |= (1 << j);
 					bsformat |= (1 << j);
 				}
 				}
 			}
 			}
+			if (bsformat & RS::ARRAY_FORMAT_NORMAL) {
+				// We must use tangents if using normals.
+				bsformat |= RS::ARRAY_FORMAT_TANGENT;
+			}
 
 
 			ERR_FAIL_COND_V_MSG(bsformat != (format & RS::ARRAY_FORMAT_BLEND_SHAPE_MASK), ERR_INVALID_PARAMETER, "Blend shape format must match the main array format for Vertex, Normal and Tangent arrays.");
 			ERR_FAIL_COND_V_MSG(bsformat != (format & RS::ARRAY_FORMAT_BLEND_SHAPE_MASK), ERR_INVALID_PARAMETER, "Blend shape format must match the main array format for Vertex, Normal and Tangent arrays.");
 		}
 		}