2 pos = glm.vec3(0, 0, 0),
3 up = glm.vec3(0, 1, 0),
4 world_up = glm.vec3(0, 1, 0),
5 front = glm.vec3(0, 0, -1),
8 function camera:get_view_matrix()
9 return glm.look_at(self.pos, self.pos + self.front, self.up)
12 function camera:update(yaw, pitch)
13 yaw, pitch = math.rad(yaw), math.rad(glm.clamp(pitch, -89.0, 89.0))
14 self.front = glm.vec3(math.cos(yaw)*math.cos(pitch), math.sin(pitch), math.sin(yaw)*math.cos(pitch)):normalize()
15 --self.front = glm.vec3(math.cos(yaw), math.sin(pitch), math.sin(yaw)):normalize()
16 self.right = (self.front % self.world_up):normalize()
17 self.up = (self.right % self.front):normalize()