Merge pull request #84252 from clayjohn/ensure_tangents
Enhance checks and user experience around tangent arrays in meshes.
This commit is contained in:
commit
44a54f4500
12 changed files with 127 additions and 19 deletions
|
|
@ -259,6 +259,11 @@ void RasterizerSceneGLES3::_geometry_instance_add_surface_with_material(Geometry
|
|||
sdcache->sort.shader_id = p_shader_id;
|
||||
sdcache->sort.geometry_id = p_mesh.get_local_index();
|
||||
sdcache->sort.priority = p_material->priority;
|
||||
|
||||
GLES3::Mesh::Surface *s = reinterpret_cast<GLES3::Mesh::Surface *>(sdcache->surface);
|
||||
if (p_material->shader_data->uses_tangent && !(s->format & RS::ARRAY_FORMAT_TANGENT)) {
|
||||
WARN_PRINT_ED("Attempting to use a shader that requires tangents with a mesh that doesn't contain tangents. Ensure that meshes are imported with the 'ensure_tangents' option. If creating your own meshes, add an `ARRAY_TANGENT` array (when using ArrayMesh) or call `generate_tangents()` (when using SurfaceTool).");
|
||||
}
|
||||
}
|
||||
|
||||
void RasterizerSceneGLES3::_geometry_instance_add_surface_with_material_chain(GeometryInstanceGLES3 *ginstance, uint32_t p_surface, GLES3::SceneMaterialData *p_material_data, RID p_mat_src, RID p_mesh) {
|
||||
|
|
|
|||
|
|
@ -2924,6 +2924,8 @@ void SceneShaderData::set_code(const String &p_code) {
|
|||
|
||||
actions.usage_flag_pointers["TANGENT"] = &uses_tangent;
|
||||
actions.usage_flag_pointers["BINORMAL"] = &uses_tangent;
|
||||
actions.usage_flag_pointers["ANISOTROPY"] = &uses_tangent;
|
||||
actions.usage_flag_pointers["ANISOTROPY_FLOW"] = &uses_tangent;
|
||||
actions.usage_flag_pointers["COLOR"] = &uses_color;
|
||||
actions.usage_flag_pointers["UV"] = &uses_uv;
|
||||
actions.usage_flag_pointers["UV2"] = &uses_uv2;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue