Bump engine submodule and fix signed integers normalisation.
This commit is contained in:
parent
ccc168c896
commit
4783f0ba2d
2
engine
2
engine
@ -1 +1 @@
|
|||||||
Subproject commit 59d13684be90b9f942e68b478ab60755b528c8f5
|
Subproject commit f463db316fc9eae9f26a83605d1c05f662b6e7de
|
@ -219,9 +219,12 @@ class ObjArchive(Archive):
|
|||||||
assert name not in self.vertices_db.keys()
|
assert name not in self.vertices_db.keys()
|
||||||
#TODO: move to math
|
#TODO: move to math
|
||||||
def pack_10(_x):
|
def pack_10(_x):
|
||||||
return round(_x * (512.0 if _x < 0.0 else 511.0)) & 1023
|
assert _x >= -1.0 and _x <= 1.0
|
||||||
|
return round(_x * 511.0) & 1023
|
||||||
|
# return ((round(_x * 1023.0) - 1) // 2) & 1023
|
||||||
def pack_u10(_x):
|
def pack_u10(_x):
|
||||||
return round(_x * 1023.0) & 1023
|
assert _x >= 0.0 and _x <= 1.0
|
||||||
|
return round(_x * 1023.0)
|
||||||
def pack_vertex(_px, _py, _pz, _nx, _ny, _nz, _s, _t, _tl):
|
def pack_vertex(_px, _py, _pz, _nx, _ny, _nz, _s, _t, _tl):
|
||||||
n = (pack_10(_nz) << 20) | (pack_10(_ny) << 10) | pack_10(_nx)
|
n = (pack_10(_nz) << 20) | (pack_10(_ny) << 10) | pack_10(_nx)
|
||||||
t = ((_tl & 1023) << 20) | (pack_u10(_t) << 10) | pack_u10(_s)
|
t = ((_tl & 1023) << 20) | (pack_u10(_t) << 10) | pack_u10(_s)
|
||||||
|
Loading…
Reference in New Issue
Block a user