Преглед на файлове

*** empty log message ***

David Rose преди 25 години
родител
ревизия
62fc8c17dc
променени са 4 файла, в които са добавени 20 реда и са изтрити 4 реда
  1. 1 1
      direct/src/gui/Button.py
  2. 1 1
      direct/src/gui/Frame.py
  3. 1 1
      direct/src/gui/Sign.py
  4. 17 1
      direct/src/showbase/ShowBase.py

+ 1 - 1
direct/src/gui/Button.py

@@ -5,7 +5,7 @@ import GuiLabel
 import GuiButton
 import Vec3
 
-guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node())
+guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node())
 font = (loader.loadModelOnce("phase_3/models/fonts/ttf-comic")).node()
 
 class Button(DirectObject):

+ 1 - 1
direct/src/gui/Frame.py

@@ -4,7 +4,7 @@ import GuiManager
 import GuiFrame
 import Vec3
 
-guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node())
+guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node())
 font = (loader.loadModelOnce("phase_3/models/fonts/ttf-comic")).node()
 
 class Frame(DirectObject):

+ 1 - 1
direct/src/gui/Sign.py

@@ -3,7 +3,7 @@ from DirectObject import *
 import GuiSign
 import GuiManager
 
-guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node())
+guiMgr = GuiManager.GuiManager.getPtr(base.win, base.mak.node(), base.renderGui.node())
 
 class Sign(DirectObject):
 

+ 17 - 1
direct/src/showbase/ShowBase.py

@@ -49,7 +49,6 @@ class ShowBase:
                                       self.dataRoot.node(),
                                       self.initialState)
 
-        self.render2d = NodePath(setupPanda2d(self.win))
         # This is a list of cams associated with the display region's cameras
         self.camList = []
         for camera in self.cameraList:
@@ -57,6 +56,23 @@ class ShowBase:
         # Set the default camera
         self.cam = self.camera.find('**/+Camera')
 
+        # Set up a 2-d layer for drawing things behind Gui labels.
+        self.render2d = NodePath(setupPanda2d(self.win))
+
+        # Set up another 2-d layer for drawing the Gui labels themselves.
+        self.renderGui = NodePath(setupPanda2d(self.win))
+
+        # Set up an auxiliary 3-d layer for rendering floating heads
+        # or other 3-d objects on top of text or widgets in the 2-d
+        # layer.  We set it up with a camera that specifically shares
+        # the projection with the default camera, so that when we
+        # change the default camera's parameters, it changes this one
+        # too.
+        self.renderAux = NodePath(NamedNode('renderAux'))
+        self.camAux = self.renderAux.attachNewNode(Camera('camAux'))
+        self.camAux.node().shareProjection(self.cam.node().getProjection())
+        addRenderLayer(self.win, self.renderAux.node(), self.camAux.node())
+
         # We create both a MouseAndKeyboard object and a MouseWatcher object
         # for the window.  The MouseAndKeyboard generates mouse events and
         # mouse button/keyboard events; the MouseWatcher passes them through