本文整理汇总了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