Calculate the bounding radius.

The calculated radius is a smidge (0.05) smaller than the original
(invisibl.mdl), but I think that's due to the difference in source data: id
used the original models, I'm using their output.
This commit is contained in:
Bill Currie 2011-09-24 13:03:18 +09:00
parent 3b33d8dade
commit 07b5db64c6

View file

@ -136,6 +136,8 @@ def scale_verts(mdl):
for f in mdl.frames:
tf.add_frame(f, 0.0) # let the frame class do the dirty work for us
size = Vector(tf.maxs) - Vector(tf.mins)
rsqr = tuple(map(lambda a, b: max(abs(a), abs(b)) ** 2, tf.mins, tf.maxs))
mdl.boundingradius = (rsqr[0] + rsqr[1] + rsqr[2]) ** 0.5
mdl.scale_origin = tf.mins
mdl.scale = tuple(map(lambda x: x / 255.0, size))
for f in mdl.frames: