Exemplo n.º 1
0
    def normalize_angles(self):
        self.yaw = glm.mod(self.yaw, 360)
        if self.yaw < 0:
            self.yaw += 360

        self.pitch = glm.mod(self.pitch, 360)
        if self.pitch < 0:
            self.pitch += 360
Exemplo n.º 2
0
    def processMouse(self, xpos, ypos):
        if self._lastX is None or self._lastY is None:
            self._lastX = xpos
            self._lastY = ypos

        xoffset = xpos - self._lastX
        yoffset = self._lastY - ypos
        self._lastX = xpos
        self._lastY = ypos

        xoffset *= self.sensitivity
        yoffset *= self.sensitivity

        self._yaw = glm.mod(self._yaw + xoffset, 360)
        self._pitch += yoffset

        self._pitch = min(self._pitch, 90.0)
        self._pitch = max(self._pitch, -90.0)

        direction = glm.vec3(
            math.cos(glm.radians(self._yaw)) *
            math.cos(glm.radians(self._pitch)),
            math.sin(glm.radians(self._pitch)),
            math.sin(
                glm.radians(self._yaw) * math.cos(glm.radians(self._pitch))))
        self.front = glm.normalize(direction)
Exemplo n.º 3
0
	def __init__(self, pos: glm.vec3, size: glm.vec3, rotation: glm.vec3):
		self._pos = pos
		self._size = size
		self._rot = glm.mod(rotation, 360.0)
		self._rotHint = rotation

		self.__posChanged = True
		self.__sizeChanged = True
		self.__rotChanged = True

		self.matrix = glm.mat4(1.0)

		self._transMat = glm.mat4(1.0)
		self._scaleMat = glm.mat4(1.0)
		self._rotQuat = glm.quat(self._rot)
		
		self.RecalculateMatrices()
    def processMouse(self, xpos, ypos):
        if self._lastX is None or self._lastY is None:
            self._lastX = xpos
            self._lastY = ypos

        xoffset = xpos - self._lastX
        yoffset = self._lastY - ypos
        self._lastX = xpos
        self._lastY = ypos

        xoffset *= self.sensitivity
        yoffset *= self.sensitivity

        self.yaw = glm.mod(self.yaw + xoffset, 360)
        self.pitch += yoffset
        self.pitch = min(self.pitch, 89.0)
        self.pitch = max(self.pitch, -89.0)

        self.pos = self.radius * glm.vec3(math.cos(glm.radians(self.yaw)) * math.cos(glm.radians(self.pitch)),
                math.sin(glm.radians(self.pitch)),
                math.sin(glm.radians(self.yaw) * math.cos(glm.radians(self.pitch))))
Exemplo n.º 5
0
 def update(self, dt):
     self.pos += self.vel / dt
     self.pos = glm.mod(self.pos, 2.0 * math.pi)
     self.age += dt
     if (self.age > self.eol):
         self.__init__()
Exemplo n.º 6
0
	def rotation(self, val: glm.vec3):
		self._rot = glm.mod(val, 360.0)
		self._rotHint = val
		self.__rotChanged = True