Skip to content

Commit

Permalink
Disable the weight error correction
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryOfCarim committed Nov 24, 2024
1 parent c406ee4 commit 4b19d73
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions albam/engines/mtfw/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -1112,6 +1112,7 @@ def _serialize_groups(src_mod, dst_mod):

def _check_weights(weights, max_weights):
_weights = []
correction = False # It doesn't look like it needed at all
i = max_weights - 4
weights.extend([0] * (max_weights - len(weights)))
if max_weights in [1, 2]:
Expand All @@ -1126,12 +1127,17 @@ def _check_weights(weights, max_weights):
_weights.append(unpack("e", pack("e", weights[i + 2]))[0])
_weights.append(weights[i + 3])
excess = 1.0 - sum(_weights)
if excess < 0:
# print(excess)
# print("1/255 is {}".format(abs(excess)//0.003922))
# print("1/32767 is {}".format(abs(excess)//0.000031))
# print("half float is {}".format(abs(excess)//0.000001))
# print("wt6 is {}".format(_weights[5]))
if excess < 0 and correction:
_excess = abs(excess)
if _excess >= 0.003922:
print("1/255 is {}".format(abs(excess) // 0.003922))
_excess = _excess - (_excess // 0.003922) * 0.003922
if _excess >= 0.000031:
print("1/32767 is {}".format(abs(excess)//0.000031))
_excess = _excess - (_excess // 0.000031) * 0.000031
if _excess >= 0.000001:
print("half float is {}".format(abs(excess)//0.000001))
_excess = _excess - (_excess // 0.000001) * 0.000001
if _weights[i + 2] > abs(excess):
_weights[i + 2] = _weights[i + 2] + excess
return _weights
Expand Down

0 comments on commit 4b19d73

Please sign in to comment.