mirror of
https://github.com/Relintai/broken_seals.git
synced 2025-01-25 14:19:19 +01:00
Added warning message when a normal ends up being zero to mdr ed's generate normal. Also set a proper default in this case.
This commit is contained in:
parent
ea1bf7020c
commit
0fc1da3def
@ -772,6 +772,10 @@ static func generate_normals_arrs(arrays : Array) -> Array:
|
|||||||
|
|
||||||
var n = Plane(v0, v1, v2).normal
|
var n = Plane(v0, v1, v2).normal
|
||||||
|
|
||||||
|
if n.is_equal_approx(Vector3()):
|
||||||
|
print("Warning face's normal is zero! " + str(Vector3(i0, i1, i2)))
|
||||||
|
n = Vector3(0, 0, 1)
|
||||||
|
|
||||||
if nc[i0] == 0:
|
if nc[i0] == 0:
|
||||||
nc[i0] = 1
|
nc[i0] = 1
|
||||||
normals[i0] = n
|
normals[i0] = n
|
||||||
@ -804,7 +808,6 @@ static func generate_normals_mdr(mdr : MeshDataResource) -> void:
|
|||||||
if arrays[ArrayMesh.ARRAY_INDEX] == null:
|
if arrays[ArrayMesh.ARRAY_INDEX] == null:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
if arrays.size() != ArrayMesh.ARRAY_MAX:
|
||||||
arrays.resize(ArrayMesh.ARRAY_MAX)
|
arrays.resize(ArrayMesh.ARRAY_MAX)
|
||||||
|
|
||||||
@ -829,6 +832,10 @@ static func generate_normals_mdr(mdr : MeshDataResource) -> void:
|
|||||||
|
|
||||||
var n = Plane(v0, v1, v2).normal
|
var n = Plane(v0, v1, v2).normal
|
||||||
|
|
||||||
|
if n.is_equal_approx(Vector3()):
|
||||||
|
print("Warning face's normal is zero! " + str(Vector3(i0, i1, i2)))
|
||||||
|
n = Vector3(0, 0, 1)
|
||||||
|
|
||||||
if nc[i0] == 0:
|
if nc[i0] == 0:
|
||||||
nc[i0] = 1
|
nc[i0] = 1
|
||||||
normals[i0] = n
|
normals[i0] = n
|
||||||
|
Loading…
Reference in New Issue
Block a user