Exemple #1
0
def place_sign(
    vmf: VMF,
    faces: Iterable[Side],
    sign: Sign,
    pos: Vec,
    normal: Vec,
    forward: Vec,
    rotate: bool = True,
) -> None:
    """Place the sign into the map."""

    if rotate and normal.z == 0:
        # On the wall, point upward.
        forward = Vec(0, 0, 1)

    texture = sign.overlay
    if texture.startswith('<') and texture.endswith('>'):
        texture = vbsp.get_tex(texture[1:-1])

    width, height = SIZES[sign.type]
    over = make_overlay(
        vmf,
        -normal,
        pos,
        uax=-width * Vec.cross(normal, forward).norm(),
        vax=-height * forward,
        material=texture,
        surfaces=faces,
    )

    over['startu'] = '1'
    over['endu'] = '0'

    vbsp.IGNORED_OVERLAYS.add(over)
Exemple #2
0
    def _make_overlay(
        self,
        vmf: VMF,
        segment: Segment,
        pos: Vec,
        uax: Vec,
        vax: Vec,
        mat: AntTex,
    ) -> None:
        """Construct an antline overlay at this position."""
        overlay = make_overlay(
            vmf,
            segment.normal,
            pos,
            uax,
            vax,
            mat.texture,
            [],
            u_repeat=(uax.mag() / 16) * mat.scale,
        )
        if not mat.static:
            overlay['targetname'] = self.name

        for tile in segment.tiles:
            tile.bind_overlay(overlay)
Exemple #3
0
def place_sign(
    vmf: VMF,
    faces: Iterable[Side],
    sign: Sign,
    pos: Vec,
    normal: Vec,
    forward: Vec,
    rotate: bool = True,
) -> Entity:
    """Place the sign into the map."""
    if rotate and abs(normal.z) < 0.1:
        # On the wall, point upward.
        forward = Vec(0, 0, 1)

    texture = sign.overlay
    if texture.startswith('<') and texture.endswith('>'):
        gen, tex_name = texturing.parse_name(texture[1:-1])
        texture = gen.get(pos, tex_name)

    width, height = SIZES[sign.type]
    over = make_overlay(
        vmf,
        -normal,
        pos,
        uax=-width * Vec.cross(normal, forward).norm(),
        vax=-height * forward,
        material=texture,
        surfaces=faces,
    )
    vbsp.IGNORED_OVERLAYS.add(over)

    over['startu'] = '1'
    over['endu'] = '0'

    return over