some basic cleanup to split up universe and remove it as a dependency
This commit is contained in:
parent
874edff55a
commit
1898b5ce49
4 changed files with 37 additions and 36 deletions
|
@ -333,7 +333,6 @@ class RenderLayer(object):
|
|||
def render(self):
|
||||
self.material.bind()
|
||||
glPushMatrix()
|
||||
glTranslatef(500.0, 300.0, 0.0)
|
||||
glScalef(*self.scale)
|
||||
self.mesh.draw(self.material.texcoords)
|
||||
glPopMatrix()
|
||||
|
|
12
roc_main.py
12
roc_main.py
|
@ -6,18 +6,18 @@ import video
|
|||
import shader
|
||||
import inputs
|
||||
import models
|
||||
import universe
|
||||
from OpenGL.GL import *
|
||||
|
||||
|
||||
def set_universe(new_universe):
|
||||
global universe
|
||||
universe = new_universe
|
||||
global g_universe
|
||||
g_universe = new_universe
|
||||
|
||||
universe = universe.test_universe()
|
||||
g_universe = None
|
||||
|
||||
|
||||
def mainloop():
|
||||
global universe
|
||||
global g_universe
|
||||
|
||||
gametimer.start_loop()
|
||||
while True:
|
||||
|
@ -42,6 +42,6 @@ def mainloop():
|
|||
|
||||
video.predraw()
|
||||
|
||||
universe.frame()
|
||||
g_universe.frame()
|
||||
|
||||
video.next_frame()
|
||||
|
|
28
roc_test.py
28
roc_test.py
|
@ -1,4 +1,32 @@
|
|||
import roc
|
||||
|
||||
class test_universe(base_universe):
|
||||
def frame(self):
|
||||
# pink triangle
|
||||
glBegin(GL_TRIANGLE_STRIP)
|
||||
glNormal3f(0.0, 0.0, 1.0)
|
||||
glColor4f(1.0, 0.0, 0.5, 1.0)
|
||||
glVertex3f( 20.0, 50.0, 1.0)
|
||||
glVertex3f( 20.0, 600.0, 1.0)
|
||||
glVertex3f( 400.0, 50.0, 1.0)
|
||||
glEnd()
|
||||
|
||||
# yellow square
|
||||
glBegin(GL_TRIANGLE_STRIP)
|
||||
glNormal3f(0.0, 0.0, 1.0)
|
||||
glColor4f(1.0, 1.0, 0.0, 1.0)
|
||||
glVertex3f( 150.0, 20.0, -50.0)
|
||||
glVertex3f( 150.0, 400.0, -50.0)
|
||||
glVertex3f( 360.0, 20.0, -50.0)
|
||||
glVertex3f( 360.0, 400.0, -50.0)
|
||||
glEnd()
|
||||
|
||||
# texture test
|
||||
mdl = models.mgr.create("m_test")
|
||||
mdl.render()
|
||||
|
||||
|
||||
|
||||
roc.init2d()
|
||||
roc.set_universe(test_universe())
|
||||
roc.main()
|
32
universe.py
32
universe.py
|
@ -20,39 +20,13 @@ class base_universe(object):
|
|||
def render(self):
|
||||
pass
|
||||
|
||||
class test_universe(base_universe):
|
||||
def frame(self):
|
||||
# pink triangle
|
||||
glBegin(GL_TRIANGLE_STRIP)
|
||||
glNormal3f(0.0, 0.0, 1.0)
|
||||
glColor4f(1.0, 0.0, 0.5, 1.0)
|
||||
glVertex3f( 20.0, 50.0, 1.0)
|
||||
glVertex3f( 20.0, 600.0, 1.0)
|
||||
glVertex3f( 400.0, 50.0, 1.0)
|
||||
glEnd()
|
||||
|
||||
# yellow square
|
||||
glBegin(GL_TRIANGLE_STRIP)
|
||||
glNormal3f(0.0, 0.0, 1.0)
|
||||
glColor4f(1.0, 1.0, 0.0, 1.0)
|
||||
glVertex3f( 150.0, 20.0, -50.0)
|
||||
glVertex3f( 150.0, 400.0, -50.0)
|
||||
glVertex3f( 360.0, 20.0, -50.0)
|
||||
glVertex3f( 360.0, 400.0, -50.0)
|
||||
glEnd()
|
||||
|
||||
# texture test
|
||||
mdl = models.mgr.create("m_test")
|
||||
mdl.render()
|
||||
|
||||
|
||||
|
||||
class tiled_universe(base_universe):
|
||||
def __init__(self):
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
def init(self):
|
||||
pass
|
||||
|
||||
def frame(self):
|
||||
pass
|
||||
pass
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue