model-converter-python/d3/camera.py

20 lines
585 B
Python
Raw Normal View History

2016-11-25 11:53:35 +01:00
#!/usr/bin/env python3
2016-11-25 14:28:39 +01:00
from .conv.model import Vertex
2016-11-25 11:53:35 +01:00
from OpenGL.GL import *
from OpenGL.GLU import *
class Camera:
def __init__(self, position = None, target = None, up = None):
self.position = Vertex() if position is None else position
self.target = Vertex() if target is None else target
self.up = Vertex(0.0,1.0,0.0) if up is None else target
def look(self):
gluLookAt(
self.position.x, self.position.y, self.position.z,
self.target.x, self.target.y, self.target.z,
self.up.x, self.up.y, self.up.z)