1234567891011121314151617181920212223242526272829303132333435363738 |
- from OpenGL.GL import *
- from OpenGL.GLU import *
- from characteristic import Characteristic
- from transform import Transform
- class Object:
- pos = 0
- col = 0
- loc = 0
- def __init__(self):
- self.characteristics = []
- def draw(self):
- transform = 0
- for char in self.characteristics:
- if char.name == "transform":
- transform = char
- # if transform
- if transform != 0:
- glPushMatrix()
- glMultMatrixf( transform.matrix )
- # draw
- glBegin(GL_TRIANGLES)
- for vertex in self.pos:
- glColor3fv(self.col)
- glVertex3fv(vertex)
- glEnd()
- # end transform
- if transform != 0:
- glPopMatrix()
- def AddCharacteristic(self, characteristic):
- self.characteristics.append( characteristic )
|