Esempio n. 1
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
Esempio n. 2
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
Esempio n. 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