Add hard-coded flag for rendering without display lists.
This commit is contained in:
parent
6591ed97aa
commit
60923091a8
@ -16,6 +16,7 @@ from mcedit2.util.glutils import DisplayList
|
|||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
DEBUG_NO_DISPLAYLISTS = False
|
||||||
|
|
||||||
class RenderNode(object):
|
class RenderNode(object):
|
||||||
|
|
||||||
@ -80,6 +81,12 @@ class RenderNode(object):
|
|||||||
def getList(self):
|
def getList(self):
|
||||||
return self.displayList.getList()
|
return self.displayList.getList()
|
||||||
|
|
||||||
|
if DEBUG_NO_DISPLAYLISTS:
|
||||||
|
def callList(self):
|
||||||
|
with self.enterStates():
|
||||||
|
self.drawSelf()
|
||||||
|
self.debugDrawChildren()
|
||||||
|
else:
|
||||||
def callList(self):
|
def callList(self):
|
||||||
self.displayList.call()
|
self.displayList.call()
|
||||||
|
|
||||||
@ -91,6 +98,8 @@ class RenderNode(object):
|
|||||||
|
|
||||||
for state in self.sceneNode.states:
|
for state in self.sceneNode.states:
|
||||||
state.compile()
|
state.compile()
|
||||||
|
|
||||||
|
if not DEBUG_NO_DISPLAYLISTS:
|
||||||
self.displayList.compile(self.draw)
|
self.displayList.compile(self.draw)
|
||||||
|
|
||||||
@contextmanager
|
@contextmanager
|
||||||
@ -104,11 +113,13 @@ class RenderNode(object):
|
|||||||
state.exit()
|
state.exit()
|
||||||
|
|
||||||
def draw(self):
|
def draw(self):
|
||||||
|
log.debug("Compiling renderNode for %s", self.sceneNode)
|
||||||
|
|
||||||
with self.enterStates():
|
with self.enterStates():
|
||||||
self.drawSelf()
|
self.drawSelf()
|
||||||
self.drawChildren()
|
self.callChildren()
|
||||||
|
|
||||||
def drawChildren(self):
|
def callChildren(self):
|
||||||
if len(self.children):
|
if len(self.children):
|
||||||
lists = [node.getList()
|
lists = [node.getList()
|
||||||
for node in self.children
|
for node in self.children
|
||||||
@ -121,6 +132,12 @@ class RenderNode(object):
|
|||||||
log.exception("Error calling child lists: %s", e)
|
log.exception("Error calling child lists: %s", e)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
def debugDrawChildren(self):
|
||||||
|
if len(self.children):
|
||||||
|
for node in self.children:
|
||||||
|
node.callList()
|
||||||
|
|
||||||
|
|
||||||
def drawSelf(self):
|
def drawSelf(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user