Skip to content

Commit

Permalink
Add normals & tangents to generated mesh to fix 4.2 error spam
Browse files Browse the repository at this point in the history
  • Loading branch information
TokisanGames committed Nov 17, 2023
1 parent 0fddc5e commit fc2f60d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/geoclipmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,16 @@ RID GeoClipMap::_create_mesh(PackedVector3Array p_vertices, PackedInt32Array p_i
arrays[RenderingServer::ARRAY_VERTEX] = p_vertices;
arrays[RenderingServer::ARRAY_INDEX] = p_indices;

PackedVector3Array normals;
normals.resize(p_vertices.size());
normals.fill(Vector3(0, 1, 0));
arrays[RenderingServer::ARRAY_NORMAL] = normals;

PackedFloat32Array tangents;
tangents.resize(p_vertices.size() * 4);
tangents.fill(0.0f);
arrays[RenderingServer::ARRAY_TANGENT] = tangents;

LOG(DEBUG, "Creating mesh via the Rendering server");
RID mesh = RS->mesh_create();
RS->mesh_add_surface_from_arrays(mesh, RenderingServer::PRIMITIVE_TRIANGLES, arrays);
Expand Down

0 comments on commit fc2f60d

Please sign in to comment.