aboutsummaryrefslogtreecommitdiff
path: root/libs/basic_games/games/stalkeranomaly/XRMath.py
blob: 355fcaf69211935c111c5b63599098a2c30320ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
class IVec3:
    def __init__(self, x: float, y: float, z: float):
        self.x = x
        self.y = y
        self.z = z

    def __str__(self) -> str:
        return f"{self.x}, {self.y}, {self.z}"


class IVec4(IVec3):
    def __init__(self, x: float, y: float, z: float, w: float):
        super().__init__(x, y, z)
        self.w = w

    def __str__(self) -> str:
        return f"{self.x}, {self.y}, {self.z}, f{self.w}"


class IFlag:
    def __init__(self, flag: int):
        self._flag = flag

    def __str__(self) -> str:
        return str(self._flag)

    def assign(self, mask: int):
        self._flag = mask

    def has(self, mask: int) -> bool:
        return bool((self._flag & mask) == mask)

    def set(self, mask: int) -> None:
        self._flag |= mask

    def remove(self, mask: int) -> None:
        self._flag &= ~mask