Beispiel #1
0
    def _side_color(
        self,
        side: Side,
        normal: Vec,
        min_pos: Vec,
        used_tex_func: Callable[[str], None],
    ) -> None:
        """Output the side texture for fields.

        used_tex_func is called with each material we use.
        """
        if not self.side_color:
            # Just apply nodraw.
            side.mat = const.Tools.NODRAW
            return

        # Produce a hex colour string, and use that as the material name.
        side.mat = 'BEE2/fizz_sides/side_color_{:02X}{:02X}{:02X}'.format(
            round(self.side_color.x * 255),
            round(self.side_color.y * 255),
            round(self.side_color.z * 255),
        )
        used_tex_func(side.mat)

        # FLip orientation if needed.
        if not side.uaxis.vec().dot(normal):
            side.vaxis, side.uaxis = side.uaxis, side.vaxis
        # The texture width is 32 pixels.
        side.scale = self.thickness / 32
        side.uaxis.offset = 16 + 2 * self.thickness * side.uaxis.vec().dot(
            min_pos) % 32
Beispiel #2
0
    def _side_color(self, side: Side, normal: Vec, min_pos: Vec,
                    used_tex_func):
        """Output the side texture for fields."""
        if not self.side_color:
            # Just apply nodraw.
            side.mat = const.Tools.NODRAW
            return

        import vbsp

        # Produce a hex colour string, and use that as the material name.
        side.mat = 'BEE2/fizz_sides/side_color_{:02X}{:02X}{:02X}'.format(
            round(self.side_color.x * 255),
            round(self.side_color.y * 255),
            round(self.side_color.z * 255),
        )
        used_tex_func(side.mat)

        # Pack the file.
        vbsp.PACK_FILES.add('materials/{}.vmt'.format(side.mat))
        # Pack the auxiliary texture needed.
        vbsp.PACK_FILES.add('materials/BEE2/fizz/fizz_side.vtf')

        # FLip orientation if needed.
        if not side.uaxis.vec().dot(normal):
            side.vaxis, side.uaxis = side.uaxis, side.vaxis
        # The texture width is 32 pixels.
        side.scale = self.thickness / 32
        side.uaxis.offset = 16 + 2 * self.thickness * side.uaxis.vec().dot(
            min_pos) % 32
Beispiel #3
0
    def _side_color(
        self,
        side: Side,
        normal: Vec,
        min_pos: Vec,
        used_tex_func: Callable[[str], None],
    ) -> None:
        """Output the side texture for fields.

        used_tex_func is called with each material we use.
        """
        if not self.side_color:
            # Just apply nodraw.
            side.mat = const.Tools.NODRAW
            return

        # Produce a hex colour string, and use that as the material name.
        side.mat = 'bee2/fizz_sides/side_color_{:02X}{:02X}{:02X}'.format(
            round(self.side_color.x * 255),
            round(self.side_color.y * 255),
            round(self.side_color.z * 255),
        )
        used_tex_func(side.mat)

        # FLip orientation if needed.
        if not side.uaxis.vec().dot(normal):
            side.vaxis, side.uaxis = side.uaxis, side.vaxis
        # The texture width is 32 pixels.
        side.scale = self.thickness / 32
        side.uaxis.offset = 16 + 2 * self.thickness * side.uaxis.vec().dot(min_pos) % 32
Beispiel #4
0
def fix_base_brush(vmf: VMF, solid: Solid, face: Side):
    """Retexture the brush forming the bottom of a pit."""
    if SETTINGS['skybox'] != '':
        face.mat = 'tools/toolsskybox'
    else:
        # We have a pit shell, we don't want a bottom.
        vmf.remove_brush(solid)
Beispiel #5
0
def fix_base_brush(vmf: VMF, solid: Solid, face: Side):
    """Retexture the brush forming the bottom of a pit."""
    if SETTINGS['skybox'] != '':
        face.mat = 'tools/toolsskybox'
        vbsp.IGNORED_FACES.add(face)
    else:
        # We have a pit shell, we don't want a bottom.
        vmf.remove_brush(solid)
Beispiel #6
0
def apply(cat: GenCat,
          face: Side,
          tex_name: str,
          portalable: Portalable = None,
          normal: Vec = None,
          loc: Vec = None):
    """Apply directly to a face, optionally using that to retrieve the location."""
    if cat is GenCat.SPECIAL or cat is GenCat.OVERLAYS:
        generator = GENERATORS[cat]
    else:
        if normal is None:
            normal = face.normal()
            normal.z = -normal.z
        generator = gen(cat, normal, portalable)

    if loc is None:
        loc = face.get_origin()

    face.mat = generator.get(loc, tex_name)
Beispiel #7
0
 def apply(self, face: Side, *, change_mat=True):
     """Apply the template to a face."""
     mat, face.uaxis, face.vaxis, face.ham_rot = self[face.normal().as_tuple()]
     if change_mat:
         face.mat = mat