|
|
@@ -1151,7 +1151,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
Creates the render scene graph, the primary scene graph for
|
|
|
rendering 3-d geometry.
|
|
|
"""
|
|
|
- ## This is the root of the 3-D scene graph.
|
|
|
+ #: This is the root of the 3-D scene graph.
|
|
|
self.render = NodePath('render')
|
|
|
self.render.setAttrib(RescaleNormalAttrib.makeDefault())
|
|
|
|
|
|
@@ -1170,7 +1170,7 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
# for the benefit of creating DirectGui elements before ShowBase.
|
|
|
from . import ShowBaseGlobal
|
|
|
|
|
|
- ## This is the root of the 2-D scene graph.
|
|
|
+ #: This is the root of the 2-D scene graph.
|
|
|
self.render2d = ShowBaseGlobal.render2d
|
|
|
|
|
|
# Set up some overrides to turn off certain properties which
|
|
|
@@ -1191,12 +1191,12 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
self.render2d.setMaterialOff(1)
|
|
|
self.render2d.setTwoSided(1)
|
|
|
|
|
|
- ## The normal 2-d DisplayRegion has an aspect ratio that
|
|
|
- ## matches the window, but its coordinate system is square.
|
|
|
- ## This means anything we parent to render2d gets stretched.
|
|
|
- ## For things where that makes a difference, we set up
|
|
|
- ## aspect2d, which scales things back to the right aspect
|
|
|
- ## ratio along the X axis (Z is still from -1 to 1)
|
|
|
+ #: The normal 2-d DisplayRegion has an aspect ratio that
|
|
|
+ #: matches the window, but its coordinate system is square.
|
|
|
+ #: This means anything we parent to render2d gets stretched.
|
|
|
+ #: For things where that makes a difference, we set up
|
|
|
+ #: aspect2d, which scales things back to the right aspect
|
|
|
+ #: ratio along the X axis (Z is still from -1 to 1)
|
|
|
self.aspect2d = ShowBaseGlobal.aspect2d
|
|
|
|
|
|
aspectRatio = self.getAspectRatio()
|
|
|
@@ -1204,13 +1204,13 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
|
|
|
self.a2dBackground = self.aspect2d.attachNewNode("a2dBackground")
|
|
|
|
|
|
- ## The Z position of the top border of the aspect2d screen.
|
|
|
+ #: The Z position of the top border of the aspect2d screen.
|
|
|
self.a2dTop = 1.0
|
|
|
- ## The Z position of the bottom border of the aspect2d screen.
|
|
|
+ #: The Z position of the bottom border of the aspect2d screen.
|
|
|
self.a2dBottom = -1.0
|
|
|
- ## The X position of the left border of the aspect2d screen.
|
|
|
+ #: The X position of the left border of the aspect2d screen.
|
|
|
self.a2dLeft = -aspectRatio
|
|
|
- ## The X position of the right border of the aspect2d screen.
|
|
|
+ #: The X position of the right border of the aspect2d screen.
|
|
|
self.a2dRight = aspectRatio
|
|
|
|
|
|
self.a2dTopCenter = self.aspect2d.attachNewNode("a2dTopCenter")
|
|
|
@@ -1250,9 +1250,9 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
self.a2dBottomRight.setPos(self.a2dRight, 0, self.a2dBottom)
|
|
|
self.a2dBottomRightNs.setPos(self.a2dRight, 0, self.a2dBottom)
|
|
|
|
|
|
- ## This special root, pixel2d, uses units in pixels that are relative
|
|
|
- ## to the window. The upperleft corner of the window is (0, 0),
|
|
|
- ## the lowerleft corner is (xsize, -ysize), in this coordinate system.
|
|
|
+ #: This special root, pixel2d, uses units in pixels that are relative
|
|
|
+ #: to the window. The upperleft corner of the window is (0, 0),
|
|
|
+ #: the lowerleft corner is (xsize, -ysize), in this coordinate system.
|
|
|
self.pixel2d = self.render2d.attachNewNode(PGTop("pixel2d"))
|
|
|
self.pixel2d.setPos(-1, 0, 1)
|
|
|
xsize, ysize = self.getSize()
|
|
|
@@ -1282,25 +1282,25 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
self.render2dp.setMaterialOff(1)
|
|
|
self.render2dp.setTwoSided(1)
|
|
|
|
|
|
- ## The normal 2-d DisplayRegion has an aspect ratio that
|
|
|
- ## matches the window, but its coordinate system is square.
|
|
|
- ## This means anything we parent to render2dp gets stretched.
|
|
|
- ## For things where that makes a difference, we set up
|
|
|
- ## aspect2dp, which scales things back to the right aspect
|
|
|
- ## ratio along the X axis (Z is still from -1 to 1)
|
|
|
+ #: The normal 2-d DisplayRegion has an aspect ratio that
|
|
|
+ #: matches the window, but its coordinate system is square.
|
|
|
+ #: This means anything we parent to render2dp gets stretched.
|
|
|
+ #: For things where that makes a difference, we set up
|
|
|
+ #: aspect2dp, which scales things back to the right aspect
|
|
|
+ #: ratio along the X axis (Z is still from -1 to 1)
|
|
|
self.aspect2dp = self.render2dp.attachNewNode(PGTop("aspect2dp"))
|
|
|
self.aspect2dp.node().setStartSort(16384)
|
|
|
|
|
|
aspectRatio = self.getAspectRatio()
|
|
|
self.aspect2dp.setScale(1.0 / aspectRatio, 1.0, 1.0)
|
|
|
|
|
|
- ## The Z position of the top border of the aspect2dp screen.
|
|
|
+ #: The Z position of the top border of the aspect2dp screen.
|
|
|
self.a2dpTop = 1.0
|
|
|
- ## The Z position of the bottom border of the aspect2dp screen.
|
|
|
+ #: The Z position of the bottom border of the aspect2dp screen.
|
|
|
self.a2dpBottom = -1.0
|
|
|
- ## The X position of the left border of the aspect2dp screen.
|
|
|
+ #: The X position of the left border of the aspect2dp screen.
|
|
|
self.a2dpLeft = -aspectRatio
|
|
|
- ## The X position of the right border of the aspect2dp screen.
|
|
|
+ #: The X position of the right border of the aspect2dp screen.
|
|
|
self.a2dpRight = aspectRatio
|
|
|
|
|
|
self.a2dpTopCenter = self.aspect2dp.attachNewNode("a2dpTopCenter")
|
|
|
@@ -1324,9 +1324,9 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
self.a2dpBottomLeft.setPos(self.a2dpLeft, 0, self.a2dpBottom)
|
|
|
self.a2dpBottomRight.setPos(self.a2dpRight, 0, self.a2dpBottom)
|
|
|
|
|
|
- ## This special root, pixel2d, uses units in pixels that are relative
|
|
|
- ## to the window. The upperleft corner of the window is (0, 0),
|
|
|
- ## the lowerleft corner is (xsize, -ysize), in this coordinate system.
|
|
|
+ #: This special root, pixel2dp, uses units in pixels that are relative
|
|
|
+ #: to the window. The upperleft corner of the window is (0, 0),
|
|
|
+ #: the lowerleft corner is (xsize, -ysize), in this coordinate system.
|
|
|
self.pixel2dp = self.render2dp.attachNewNode(PGTop("pixel2dp"))
|
|
|
self.pixel2dp.node().setStartSort(16384)
|
|
|
self.pixel2dp.setPos(-1, 0, 1)
|
|
|
@@ -1647,11 +1647,11 @@ class ShowBase(DirectObject.DirectObject):
|
|
|
|
|
|
mw = self.buttonThrowers[0].getParent()
|
|
|
|
|
|
- ## A special ButtonThrower to generate keyboard events and
|
|
|
- ## include the time from the OS. This is separate only to
|
|
|
- ## support legacy code that did not expect a time parameter; it
|
|
|
- ## will eventually be folded into the normal ButtonThrower,
|
|
|
- ## above.
|
|
|
+ #: A special ButtonThrower to generate keyboard events and
|
|
|
+ #: include the time from the OS. This is separate only to
|
|
|
+ #: support legacy code that did not expect a time parameter; it
|
|
|
+ #: will eventually be folded into the normal ButtonThrower,
|
|
|
+ #: above.
|
|
|
self.timeButtonThrower = mw.attachNewNode(ButtonThrower('timeButtons'))
|
|
|
self.timeButtonThrower.node().setPrefix('time-')
|
|
|
self.timeButtonThrower.node().setTimeFlag(1)
|