本文整理匯總了Python中srctools.Vec.dot方法的典型用法代碼示例。如果您正苦於以下問題:Python Vec.dot方法的具體用法?Python Vec.dot怎麽用?Python Vec.dot使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類srctools.Vec
的用法示例。
在下文中一共展示了Vec.dot方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _texture_fit
# 需要導入模塊: from srctools import Vec [as 別名]
# 或者: from srctools.Vec import dot [as 別名]
def _texture_fit(
self,
side: Side,
tex_size: float,
field_length: float,
fizz: Fizzler,
neg: Vec,
pos: Vec,
is_laserfield=False,
) -> None:
"""Calculate the texture offsets required for fitting a texture."""
if side.vaxis.vec() != -fizz.up_axis:
# Rotate it
rot_angle = side.normal().rotation_around()
for _ in range(4):
side.uaxis = side.uaxis.rotate(rot_angle)
side.vaxis = side.vaxis.rotate(rot_angle)
if side.vaxis.vec() == -fizz.up_axis:
break
else:
LOGGER.warning("Can't fix rotation for {} -> {}", side.vaxis, fizz.up_axis)
side.uaxis.offset = -(tex_size / field_length) * neg.dot(side.uaxis.vec())
side.vaxis.offset = -(tex_size / 128) * neg.dot(side.vaxis.vec())
# The above fits it correctly, except it's vertically half-offset.
# For laserfields that's what we want, for fizzlers we want it normal.
if not is_laserfield:
side.vaxis.offset += tex_size / 2
side.uaxis.scale = field_length / tex_size
side.vaxis.scale = 128 / tex_size
side.uaxis.offset %= tex_size
side.vaxis.offset %= tex_size