本文整理汇总了Python中srctools.Vec.other_axes方法的典型用法代码示例。如果您正苦于以下问题:Python Vec.other_axes方法的具体用法?Python Vec.other_axes怎么用?Python Vec.other_axes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类srctools.Vec
的用法示例。
在下文中一共展示了Vec.other_axes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: make_barriers
# 需要导入模块: from srctools import Vec [as 别名]
# 或者: from srctools.Vec import other_axes [as 别名]
def make_barriers(vmf: VMF, get_tex: Callable[[str], str]):
"""Make barrier entities. get_tex is vbsp.get_tex."""
glass_temp = template_brush.get_scaling_template(
vbsp_options.get(str, "glass_template")
)
grate_temp = template_brush.get_scaling_template(
vbsp_options.get(str, "grating_template")
)
# Avoid error without this package.
if HOLES:
# Grab the template solids we need.
hole_temp = template_brush.get_template(
vbsp_options.get(str, 'glass_hole_temp')
)
hole_world, hole_detail, _ = hole_temp.visgrouped({'small'})
hole_temp_small = hole_world + hole_detail
hole_world, hole_detail, _ = hole_temp.visgrouped({'large'})
hole_temp_large = hole_world + hole_detail
hole_world, hole_detail, _ = hole_temp.visgrouped({'large_corner'})
hole_temp_corner = hole_world + hole_detail
else:
hole_temp_small = hole_temp_large = hole_temp_corner = None
floorbeam_temp = vbsp_options.get(str, 'glass_floorbeam_temp')
if vbsp_options.get_itemconf('BEE_PELLET:PelletGrating', False):
# Merge together these existing filters in global_pti_ents
vmf.create_ent(
origin=vbsp_options.get(Vec, 'global_pti_ents_loc'),
targetname='@grating_filter',
classname='filter_multi',
filtertype=0,
negated=0,
filter01='@not_pellet',
filter02='@not_paint_bomb',
)
else:
# Just skip paint bombs.
vmf.create_ent(
origin=vbsp_options.get(Vec, 'global_pti_ents_loc'),
targetname='@grating_filter',
classname='filter_activator_class',
negated=1,
filterclass='prop_paint_bomb',
)
# Group the positions by planes in each orientation.
# This makes them 2D grids which we can optimise.
# (normal_dist, positive_axis, type) -> [(x, y)]
slices = defaultdict(set) # type: Dict[Tuple[Tuple[float, float, float], bool, BarrierType], Set[Tuple[float, float]]]
# We have this on the 32-grid so we can cut squares for holes.
for (origin, normal), barr_type in BARRIERS.items():
origin = Vec(origin)
normal = Vec(normal)
norm_axis = normal.axis()
u, v = origin.other_axes(norm_axis)
norm_pos = Vec.with_axes(norm_axis, origin)
slice_plane = slices[
norm_pos.as_tuple(), # distance from origin to this plane.
normal[norm_axis] > 0,
barr_type,
]
for u_off in [-48, -16, 16, 48]:
for v_off in [-48, -16, 16, 48]:
slice_plane.add((
(u + u_off) // 32,
(v + v_off) // 32,
))
# Remove pane sections where the holes are. We then generate those with
# templates for slanted parts.
for (origin, normal), hole_type in HOLES.items():
barr_type = BARRIERS[origin, normal]
origin = Vec(origin)
normal = Vec(normal)
norm_axis = normal.axis()
u, v = origin.other_axes(norm_axis)
norm_pos = Vec.with_axes(norm_axis, origin)
slice_plane = slices[
norm_pos.as_tuple(),
normal[norm_axis] > 0,
barr_type,
]
if hole_type is HoleType.LARGE:
offsets = (-80, -48, -16, 16, 48, 80)
hole_temp = hole_temp_large.copy()
else:
offsets = (-16, 16)
hole_temp = hole_temp_small.copy()
for u_off in offsets:
for v_off in offsets:
# Skip the corners on large holes.
# Those aren't actually used, so skip them. That way
# we can have them diagonally or without glass in the corner.
if u_off in (-80, 80) and v_off in (-80, 80):
continue
slice_plane.discard((
#.........这里部分代码省略.........