Sfoglia il codice sorgente

Merge branch 'master' of github.com:panda3d/panda3d into webgl-port

rdb 10 anni fa
parent
commit
ae84484547

+ 14 - 3
direct/src/actor/Actor.py

@@ -3,6 +3,7 @@
 __all__ = ['Actor']
 
 from panda3d.core import *
+from panda3d.core import Loader as PandaLoader
 from direct.showbase.DirectObject import DirectObject
 from direct.directnotify import DirectNotifyGlobal
 import types
@@ -160,6 +161,8 @@ class Actor(DirectObject, NodePath):
         # initialize our NodePath essence
         NodePath.__init__(self)
 
+        self.loader = PandaLoader.getGlobalPtr()
+
         # Set the mergeLODBundles flag.  If this is true, all
         # different LOD's will be merged into a single common bundle
         # (joint hierarchy).  All LOD's will thereafter share the same
@@ -1901,14 +1904,22 @@ class Actor(DirectObject, NodePath):
                 loaderOptions = LoaderOptions(loaderOptions)
                 loaderOptions.setFlags(loaderOptions.getFlags() & ~LoaderOptions.LFNoRamCache)
 
+            if okMissing is not None:
+                if okMissing:
+                    loaderOptions.setFlags(loaderOptions.getFlags() & ~LoaderOptions.LFReportErrors)
+                else:
+                    loaderOptions.setFlags(loaderOptions.getFlags() | LoaderOptions.LFReportErrors)
+
             # Pass loaderOptions to specify that we want to
             # get the skeleton model.  This only matters to model
             # files (like .mb) for which we can choose to extract
             # either the skeleton or animation, or neither.
-            model = loader.loadModel(modelPath, loaderOptions = loaderOptions, okMissing = okMissing)
+            model = self.loader.loadSync(Filename(modelPath), loaderOptions)
+            if model is not None:
+                model = NodePath(model)
 
         if (model == None):
-            raise StandardError, "Could not load Actor model %s" % (modelPath)
+            raise IOError("Could not load Actor model %s" % (modelPath))
 
         if (model.node().isOfType(Character.getClassType())):
             bundleNP = model
@@ -2370,7 +2381,7 @@ class Actor(DirectObject, NodePath):
             # operation that will complete in the background, but if so it
             # will still return a usable AnimControl.
             animControl = bundle.loadBindAnim(
-                loader.loader, Filename(anim.filename), -1,
+                self.loader, Filename(anim.filename), -1,
                 subpartDef.subset, allowAsyncBind and self.allowAsyncBind)
 
         if not animControl:

+ 2 - 0
direct/src/directbase/DirectStart.py

@@ -1,3 +1,5 @@
+""" This is a deprecated module that creates a global instance of ShowBase. """
+
 __all__ = []
 print('Using deprecated DirectStart interface.')
 

File diff suppressed because it is too large
+ 486 - 355
direct/src/directscripts/Doxyfile.cxx


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

@@ -115,7 +115,7 @@ class DirectDialog(DirectFrame):
             ('fadeScreen',        0,             None),
             ('command',           None,          None),
             ('extraArgs',         [],            None),
-            ('sortOrder',    NO_FADE_SORT_INDEX, None),
+            ('sortOrder',    DGG.NO_FADE_SORT_INDEX, None),
             )
         # Merge keyword options with default options
         self.defineoptions(kw, optiondefs, dynamicGroups = ("button",))

+ 3 - 0
direct/src/gui/DirectGuiGlobals.py

@@ -87,6 +87,9 @@ IMAGE_SORT_INDEX = 10
 GEOM_SORT_INDEX = 20
 TEXT_SORT_INDEX = 30
 
+FADE_SORT_INDEX = 1000
+NO_FADE_SORT_INDEX = 2000
+
 # Handy conventions for organizing top-level gui objects in loose buckets.
 BACKGROUND_SORT_INDEX = -100
 MIDGROUND_SORT_INDEX = 0

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

@@ -33,7 +33,7 @@ class DirectWaitBar(DirectFrame):
             ('barColor',       (1, 0, 0, 1),       self.setBarColor),
             ('barTexture',     None,               self.setBarTexture),
             ('barRelief',      DGG.FLAT,           self.setBarRelief),
-            ('sortOrder',      NO_FADE_SORT_INDEX, None),
+            ('sortOrder',      DGG.NO_FADE_SORT_INDEX, None),
             )
         if 'text' in kw:
             textoptiondefs = (

+ 4 - 3
direct/src/interval/Interval.py

@@ -5,6 +5,7 @@ __all__ = ['Interval']
 from direct.directnotify.DirectNotifyGlobal import directNotify
 from direct.showbase.DirectObject import DirectObject
 from direct.task.Task import Task, TaskManager
+from direct.task.TaskManagerGlobal import taskMgr
 from panda3d.core import *
 from panda3d.direct import *
 from direct.extensions_native import CInterval_extensions
@@ -289,13 +290,13 @@ class Interval(DirectObject):
             self.__endT = endT
             self.__endTAtEnd = 0
 
-        self.__clockStart = globalClock.getFrameTime()
+        self.__clockStart = ClockObject.getGlobalClock().getFrameTime()
         self.__playRate = playRate
         self.__doLoop = doLoop
         self.__loopCount = 0
 
     def setupResume(self):
-        now = globalClock.getFrameTime()
+        now = ClockObject.getGlobalClock().getFrameTime()
         if self.__playRate > 0:
             self.__clockStart = now - ((self.getT() - self.__startT) / self.__playRate)
         elif self.__playRate < 0:
@@ -303,7 +304,7 @@ class Interval(DirectObject):
         self.__loopCount = 0
 
     def stepPlay(self):
-        now = globalClock.getFrameTime()
+        now = ClockObject.getGlobalClock().getFrameTime()
         if self.__playRate >= 0:
             t = (now - self.__clockStart) * self.__playRate + self.__startT
 

+ 17 - 15
direct/src/showbase/BufferViewer.py

@@ -4,6 +4,7 @@ __all__ = ['BufferViewer']
 
 from panda3d.core import *
 from direct.task import Task
+from direct.task.TaskManagerGlobal import taskMgr
 from direct.directnotify.DirectNotifyGlobal import *
 from direct.showbase.DirectObject import DirectObject
 import math
@@ -11,7 +12,7 @@ import math
 class BufferViewer(DirectObject):
     notify = directNotify.newCategory('BufferViewer')
 
-    def __init__(self):
+    def __init__(self, win, parent):
         """Access: private.  Constructor."""
         self.enabled = 0
         size = ConfigVariableDouble('buffer-viewer-size', '0 0')
@@ -23,13 +24,14 @@ class BufferViewer(DirectObject):
         self.exclude = "none"
         self.cullbin = "fixed"
         self.cullsort = 10000
-        self.renderParent = render2d
+        self.win = win
+        self.engine = GraphicsEngine.getGlobalPtr()
+        self.renderParent = parent
         self.cards = []
         self.cardindex = 0
         self.cardmaker = CardMaker("cubemaker")
         self.cardmaker.setFrame(-1,1,-1,1)
         self.task = 0
-        self.window = 0
         self.dirty = 1
         self.accept("render-texture-targets-changed", self.refreshReadout)
         if (ConfigVariableBool("show-buffers", 0).getValue()):
@@ -198,7 +200,7 @@ class BufferViewer(DirectObject):
                 win = x.getWindow(iwin)
                 self.analyzeTextureSet(win, set)
         elif (x=="all"):
-            self.analyzeTextureSet(base.graphicsEngine, set)
+            self.analyzeTextureSet(self.engine, set)
         else: return
 
 
@@ -279,8 +281,8 @@ class BufferViewer(DirectObject):
         # Generate a list of cards and the corresponding windows.
         cards = []
         wins = []
-        for iwin in range(base.graphicsEngine.getNumWindows()):
-            win = base.graphicsEngine.getWindow(iwin)
+        for iwin in range(self.engine.getNumWindows()):
+            win = self.engine.getWindow(iwin)
             for itex in range(win.countTextures()):
                 tex = win.getTexture(itex)
                 if (tex in include) and (tex not in exclude):
@@ -358,16 +360,16 @@ class BufferViewer(DirectObject):
         bordersize = 4.0
 
         if (float(self.sizex)==0.0) and (float(self.sizey)==0.0):
-            sizey = int(0.4266666667 * base.win.getYSize())
+            sizey = int(0.4266666667 * self.win.getYSize())
             sizex = (sizey * aspectx) // aspecty
-            v_sizey = (base.win.getYSize() - (rows-1) - (rows*2)) // rows
+            v_sizey = (self.win.getYSize() - (rows-1) - (rows*2)) // rows
             v_sizex = (v_sizey * aspectx) // aspecty
             if (v_sizey < sizey) or (v_sizex < sizex):
                 sizey = v_sizey
                 sizex = v_sizex
 
             adjustment = 2
-            h_sizex = float (base.win.getXSize() - adjustment) / float (cols)
+            h_sizex = float (self.win.getXSize() - adjustment) / float (cols)
 
             h_sizex -= bordersize
             if (h_sizex < 1.0):
@@ -378,16 +380,16 @@ class BufferViewer(DirectObject):
                 sizey = h_sizey
                 sizex = h_sizex
         else:
-            sizex = int(self.sizex * 0.5 * base.win.getXSize())
-            sizey = int(self.sizey * 0.5 * base.win.getYSize())
+            sizex = int(self.sizex * 0.5 * self.win.getXSize())
+            sizey = int(self.sizey * 0.5 * self.win.getYSize())
             if (sizex == 0): sizex = (sizey*aspectx) // aspecty
             if (sizey == 0): sizey = (sizex*aspecty) // aspectx
 
         # Convert from pixels to render2d-units.
-        fsizex = (2.0 * sizex) / float(base.win.getXSize())
-        fsizey = (2.0 * sizey) / float(base.win.getYSize())
-        fpixelx = 2.0 / float(base.win.getXSize())
-        fpixely = 2.0 / float(base.win.getYSize())
+        fsizex = (2.0 * sizex) / float(self.win.getXSize())
+        fsizey = (2.0 * sizey) / float(self.win.getYSize())
+        fpixelx = 2.0 / float(self.win.getXSize())
+        fpixely = 2.0 / float(self.win.getYSize())
 
         # Choose directional offsets
         if (self.position == "llcorner"):

+ 4 - 10
direct/src/showbase/EventManager.py

@@ -7,15 +7,12 @@ from MessengerGlobal import *
 from direct.directnotify.DirectNotifyGlobal import *
 from direct.task.TaskManagerGlobal import taskMgr
 from panda3d.core import PStatCollector, EventQueue, EventHandler
+from panda3d.core import ConfigVariableBool
 
 class EventManager:
 
     notify = None
 
-    # delayed import, since this is imported by the Toontown Launcher
-    # before the complete PandaModules have been downloaded.
-    PStatCollector = None
-
     def __init__(self, eventQueue = None):
         """
         Create a C++ event queue and handler
@@ -27,15 +24,12 @@ class EventManager:
         self.eventQueue = eventQueue
         self.eventHandler = None
 
-        self._wantPstats = None # no config at this point
+        self._wantPstats = ConfigVariableBool('pstats-eventmanager', False)
 
     def doEvents(self):
         """
         Process all the events on the C++ event queue
         """
-        if self._wantPstats is None:
-            self._wantPstats = config.GetBool('pstats-eventmanager', 0)
-            EventManager.PStatCollector = PStatCollector
         # use different methods for handling events with and without pstats tracking
         # for efficiency
         if self._wantPstats:
@@ -141,10 +135,10 @@ class EventManager:
                 hyphen = name.find('-')
                 if hyphen >= 0:
                     name = name[0:hyphen]
-                pstatCollector = EventManager.PStatCollector('App:Show code:eventManager:' + name)
+                pstatCollector = PStatCollector('App:Show code:eventManager:' + name)
                 pstatCollector.start()
                 if self.eventHandler:
-                    cppPstatCollector = EventManager.PStatCollector(
+                    cppPstatCollector = PStatCollector(
                         'App:Show code:eventManager:' + name + ':C++')
 
             if paramList:

+ 9 - 7
direct/src/showbase/OnScreenDebug.py

@@ -9,8 +9,10 @@ from direct.gui import OnscreenText
 from direct.directtools import DirectUtil
 
 class OnScreenDebug:
+
+    enabled = ConfigVariableBool("on-screen-debug-enabled", False)
+
     def __init__(self):
-        self.enabled = config.GetBool("on-screen-debug-enabled", 0)
         self.onScreenText = None
         self.frame = 0
         self.text = ""
@@ -20,17 +22,17 @@ class OnScreenDebug:
         if self.onScreenText:
             return
 
-        fontPath = config.GetString("on-screen-debug-font", "cmtt12")
-        fontScale = config.GetFloat("on-screen-debug-font-scale", 0.05)
+        fontPath = ConfigVariableString("on-screen-debug-font", "cmtt12").value
+        fontScale = ConfigVariableDouble("on-screen-debug-font-scale", 0.05).value
 
         color = {
             "black": Vec4(0, 0, 0, 1),
             "white": Vec4(1, 1, 1, 1),
             }
-        fgColor = color[config.GetString("on-screen-debug-fg-color", "white")]
-        bgColor = color[config.GetString("on-screen-debug-bg-color", "black")]
-        fgColor.setW(config.GetFloat("on-screen-debug-fg-alpha", 0.85))
-        bgColor.setW(config.GetFloat("on-screen-debug-bg-alpha", 0.85))
+        fgColor = color[ConfigVariableString("on-screen-debug-fg-color", "white").value]
+        bgColor = color[ConfigVariableString("on-screen-debug-bg-color", "black").value]
+        fgColor.setW(ConfigVariableDouble("on-screen-debug-fg-alpha", 0.85).value)
+        bgColor.setW(ConfigVariableDouble("on-screen-debug-bg-alpha", 0.85).value)
 
         font = loader.loadFont(fontPath)
         if not font.isValid():

+ 4 - 8
direct/src/showbase/PythonUtil.py

@@ -2614,14 +2614,10 @@ class HierarchyException(Exception):
 # __dev__ is not defined at import time, call this after it's defined
 def recordFunctorCreationStacks():
     global Functor
-    from panda3d.direct import get_config_showbase
-    config = get_config_showbase()
-    # off by default, very slow
-    if __dev__ and config.GetBool('record-functor-creation-stacks', 0):
-        if not hasattr(Functor, '_functorCreationStacksRecorded'):
-            Functor = recordCreationStackStr(Functor)
-            Functor._functorCreationStacksRecorded = True
-            Functor.__call__ = Functor._exceptionLoggedCreationStack__call__
+    if not hasattr(Functor, '_functorCreationStacksRecorded'):
+        Functor = recordCreationStackStr(Functor)
+        Functor._functorCreationStacksRecorded = True
+        Functor.__call__ = Functor._exceptionLoggedCreationStack__call__
 
 def formatTimeCompact(seconds):
     # returns string in format '1d3h22m43s'

+ 20 - 19
direct/src/showbase/ShowBase.py

@@ -1,4 +1,6 @@
-"""Undocumented Module"""
+""" This module contains ShowBase, an application framework responsible
+for opening a graphical display, setting up input devices and creating
+the scene graph. """
 
 __all__ = ['ShowBase', 'WindowControls']
 
@@ -44,9 +46,6 @@ if __debug__:
 import OnScreenDebug
 import AppRunnerGlobal
 
-builtins.FADE_SORT_INDEX = 1000
-builtins.NO_FADE_SORT_INDEX = 2000
-
 def legacyRun():
     builtins.base.notify.warning("run() is deprecated, use base.run() instead")
     builtins.base.run()
@@ -331,7 +330,7 @@ class ShowBase(DirectObject.DirectObject):
             # assigned to a single CPU
             autoAffinity = self.config.GetBool('auto-single-cpu-affinity', 0)
             affinity = None
-            if autoAffinity and ('clientIndex' in builtins.__dict__):
+            if autoAffinity and hasattr(builtins, 'clientIndex'):
                 affinity = abs(int(builtins.clientIndex))
             else:
                 affinity = self.config.GetInt('client-cpu-affinity', -1)
@@ -342,7 +341,7 @@ class ShowBase(DirectObject.DirectObject):
                 TrueClock.getGlobalPtr().setCpuAffinity(1 << (affinity % 32))
 
         # Make sure we're not making more than one ShowBase.
-        if 'base' in builtins.__dict__:
+        if hasattr(builtins, 'base'):
             raise StandardError, "Attempt to spawn multiple ShowBase instances!"
 
         # DO NOT ADD TO THIS LIST.  We're trying to phase out the use of
@@ -374,24 +373,26 @@ class ShowBase(DirectObject.DirectObject):
         builtins.wantUberdog = self.config.GetBool('want-uberdog', 1)
         if __debug__:
             builtins.deltaProfiler = DeltaProfiler.DeltaProfiler("ShowBase")
-        builtins.onScreenDebug = OnScreenDebug.OnScreenDebug()
+        self.onScreenDebug = OnScreenDebug.OnScreenDebug()
+        builtins.onScreenDebug = self.onScreenDebug
 
         if self.wantRender2dp:
             builtins.render2dp = self.render2dp
             builtins.aspect2dp = self.aspect2dp
             builtins.pixel2dp = self.pixel2dp
 
-        if __dev__:
-            ShowBase.notify.debug('__dev__ == %s' % __dev__)
+        if self.__dev__:
+            ShowBase.notify.debug('__dev__ == %s' % self.__dev__)
         else:
-            ShowBase.notify.info('__dev__ == %s' % __dev__)
+            ShowBase.notify.info('__dev__ == %s' % self.__dev__)
 
         self.createBaseAudioManagers()
 
         # set up recording of Functor creation stacks in __dev__
-        PythonUtil.recordFunctorCreationStacks()
+        if self.__dev__ and self.config.GetBool('record-functor-creation-stacks', False):
+            PythonUtil.recordFunctorCreationStacks()
 
-        if __dev__ or self.config.GetBool('want-e3-hacks', False):
+        if self.__dev__ or self.config.GetBool('want-e3-hacks', False):
             if self.config.GetBool('track-gui-items', True):
                 # dict of guiId to gui item, for tracking down leaks
                 self.guiItems = {}
@@ -432,9 +433,10 @@ class ShowBase(DirectObject.DirectObject):
 
         # Offscreen buffer viewing utility.
         # This needs to be allocated even if the viewer is off.
-        self.bufferViewer = BufferViewer()
         if self.wantRender2dp:
-            self.bufferViewer.setRenderParent(self.render2dp)
+            self.bufferViewer = BufferViewer(self.win, self.render2dp)
+        else:
+            self.bufferViewer = BufferViewer(self.win, self.render2d)
 
         if self.windowType != 'none':
             if fStartDirect: # [gjeon] if this is False let them start direct manually
@@ -1886,7 +1888,7 @@ class ShowBase(DirectObject.DirectObject):
     def __igLoop(self, state):
         # We render the watch variables for the onScreenDebug as soon
         # as we reasonably can before the renderFrame().
-        onScreenDebug.render()
+        self.onScreenDebug.render()
 
         if self.recorder:
             self.recorder.recordFrame()
@@ -1900,7 +1902,7 @@ class ShowBase(DirectObject.DirectObject):
 
         # We clear the text buffer for the onScreenDebug as soon
         # as we reasonably can after the renderFrame().
-        onScreenDebug.clear()
+        self.onScreenDebug.clear()
 
         if self.recorder:
             self.recorder.playFrame()
@@ -1925,12 +1927,11 @@ class ShowBase(DirectObject.DirectObject):
     def __igLoopSync(self, state):
         # We render the watch variables for the onScreenDebug as soon
         # as we reasonably can before the renderFrame().
-        onScreenDebug.render()
+        self.onScreenDebug.render()
 
         if self.recorder:
             self.recorder.recordFrame()
 
-
         self.cluster.collectData()
 
         # Finally, render the frame.
@@ -1942,7 +1943,7 @@ class ShowBase(DirectObject.DirectObject):
 
         # We clear the text buffer for the onScreenDebug as soon
         # as we reasonably can after the renderFrame().
-        onScreenDebug.clear()
+        self.onScreenDebug.clear()
 
         if self.recorder:
             self.recorder.playFrame()

+ 8 - 7
direct/src/showbase/Transitions.py

@@ -4,6 +4,7 @@ __all__ = ['Transitions']
 
 from panda3d.core import *
 from direct.gui.DirectGui import *
+from direct.gui import DirectGuiGlobals as DGG
 from direct.interval.LerpInterval import LerpColorScaleInterval, LerpColorInterval, LerpScaleInterval, LerpPosInterval
 from direct.interval.MetaInterval import Sequence, Parallel
 from direct.interval.FunctionInterval import Func
@@ -91,7 +92,7 @@ class Transitions:
         """
         #self.noTransitions() masad: this creates a one frame pop, is it necessary?
         self.loadFade()
-        transitionIval = Sequence(Func(self.fade.reparentTo, aspect2d, FADE_SORT_INDEX),
+        transitionIval = Sequence(Func(self.fade.reparentTo, aspect2d, DGG.FADE_SORT_INDEX),
                                   Func(self.fade.showThrough),  # in case aspect2d is hidden for some reason
                                   self.lerpFunc(self.fade, t,
                                                 self.alphaOff,
@@ -112,7 +113,7 @@ class Transitions:
         self.noTransitions()
         self.loadFade()
 
-        transitionIval = Sequence(Func(self.fade.reparentTo,aspect2d,FADE_SORT_INDEX),
+        transitionIval = Sequence(Func(self.fade.reparentTo,aspect2d,DGG.FADE_SORT_INDEX),
                                   Func(self.fade.showThrough),  # in case aspect2d is hidden for some reason
                                   self.lerpFunc(self.fade, t,
                                                 self.alphaOn,
@@ -164,7 +165,7 @@ class Transitions:
             # Fade out immediately with no lerp
             self.noTransitions()
             self.loadFade()
-            self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
+            self.fade.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
             self.fade.setColor(self.alphaOn)
         elif ConfigVariableBool('no-loading-screen', False):
             if finishIval:
@@ -188,7 +189,7 @@ class Transitions:
         #print "transitiosn: fadeScreen"
         self.noTransitions()
         self.loadFade()
-        self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
+        self.fade.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
         self.fade.setColor(self.alphaOn[0],
                            self.alphaOn[1],
                            self.alphaOn[2],
@@ -203,7 +204,7 @@ class Transitions:
         #print "transitiosn: fadeScreenColor"
         self.noTransitions()
         self.loadFade()
-        self.fade.reparentTo(aspect2d, FADE_SORT_INDEX)
+        self.fade.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
         self.fade.setColor(color)
 
     def noFade(self):
@@ -245,7 +246,7 @@ class Transitions:
         if (t == 0):
             self.iris.detachNode()
         else:
-            self.iris.reparentTo(aspect2d, FADE_SORT_INDEX)
+            self.iris.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
 
             self.transitionIval = Sequence(LerpScaleInterval(self.iris, t,
                                                    scale = 0.18,
@@ -272,7 +273,7 @@ class Transitions:
             self.iris.detachNode()
             self.fadeOut(0)
         else:
-            self.iris.reparentTo(aspect2d, FADE_SORT_INDEX)
+            self.iris.reparentTo(aspect2d, DGG.FADE_SORT_INDEX)
 
             self.transitionIval = Sequence(LerpScaleInterval(self.iris, t,
                                                    scale = 0.01,

+ 3 - 3
direct/src/task/Task.py

@@ -707,12 +707,12 @@ class TaskManager:
     def _getRandomTask(self):
         # Figure out when the next frame is likely to expire, so we
         # won't grab any tasks that are sleeping for a long time.
-        now = globalClock.getFrameTime()
-        avgFrameRate = globalClock.getAverageFrameRate()
+        now = self.globalClock.getFrameTime()
+        avgFrameRate = self.globalClock.getAverageFrameRate()
         if avgFrameRate < .00001:
             avgFrameDur = 0.
         else:
-            avgFrameDur = (1. / globalClock.getAverageFrameRate())
+            avgFrameDur = (1. / self.globalClock.getAverageFrameRate())
         next = now + avgFrameDur
 
         # Now grab a task at random, until we find one that we like.

+ 1 - 1
makepanda/makepanda.py

@@ -4069,7 +4069,7 @@ if (not RUNTIME):
   TargetAdd('core.pyd', input='p3display_pythonGraphicsWindowProc.obj')
 
   TargetAdd('core.pyd', input='core_module.obj')
-  TargetAdd('core.pyd', input='libp3tinyxml.ilb')
+  #TargetAdd('core.pyd', input='libp3tinyxml.ilb')
   TargetAdd('core.pyd', input='libp3interrogatedb.dll')
   TargetAdd('core.pyd', input=COMMON_PANDA_LIBS)
   TargetAdd('core.pyd', opts=['PYTHON', 'WINSOCK2'])

+ 3 - 0
panda/src/framework/windowFramework.cxx

@@ -1283,6 +1283,9 @@ load_image_as_model(const Filename &filename) {
   // Yes, it is an image file; make a texture out of it.
   tex->set_minfilter(SamplerState::FT_linear_mipmap_linear);
   tex->set_magfilter(SamplerState::FT_linear);
+  tex->set_wrap_u(SamplerState::WM_clamp);
+  tex->set_wrap_v(SamplerState::WM_clamp);
+  tex->set_wrap_w(SamplerState::WM_clamp);
 
   // Ok, now make a polygon to show the texture.
   bool has_alpha = true;

+ 7 - 7
panda/src/glstuff/glGraphicsStateGuardian_src.cxx

@@ -8358,7 +8358,7 @@ get_external_image_format(Texture *tex) const {
 #endif
 
   case Texture::F_alpha:
-#ifdef SUPPORT_FIXED_FUNCTION
+#if defined(SUPPORT_FIXED_FUNCTION) || defined(OPENGLES)
     return GL_ALPHA;
 #else
     return GL_RED;
@@ -8403,7 +8403,7 @@ get_external_image_format(Texture *tex) const {
 
   case Texture::F_luminance:
   case Texture::F_sluminance:
-#ifdef SUPPORT_FIXED_FUNCTION
+#if defined(SUPPORT_FIXED_FUNCTION) || defined(OPENGLES)
     return GL_LUMINANCE;
 #else
     return GL_RED;
@@ -8411,7 +8411,7 @@ get_external_image_format(Texture *tex) const {
   case Texture::F_luminance_alphamask:
   case Texture::F_luminance_alpha:
   case Texture::F_sluminance_alpha:
-#ifdef SUPPORT_FIXED_FUNCTION
+#if defined(SUPPORT_FIXED_FUNCTION) || defined(OPENGLES)
     return GL_LUMINANCE_ALPHA;
 #else
     return GL_RG;
@@ -8989,14 +8989,14 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
 #endif
 
   case Texture::F_alpha:
-#ifdef SUPPORT_FIXED_FUNCTION
+#if defined(SUPPORT_FIXED_FUNCTION) || defined(OPENGLES)
     return force_sized ? GL_ALPHA8 : GL_ALPHA;
 #else
     return force_sized ? GL_R8 : GL_RED;
 #endif
 
   case Texture::F_luminance:
-#ifdef SUPPORT_FIXED_FUNCTION
+#if defined(SUPPORT_FIXED_FUNCTION) || defined(OPENGLES)
 #ifndef OPENGLES
     if (tex->get_component_type() == Texture::T_float) {
       return GL_LUMINANCE16F_ARB;
@@ -9014,7 +9014,7 @@ get_internal_image_format(Texture *tex, bool force_sized) const {
 #endif
   case Texture::F_luminance_alpha:
   case Texture::F_luminance_alphamask:
-#ifdef SUPPORT_FIXED_FUNCTION
+#if defined(SUPPORT_FIXED_FUNCTION) || defined(OPENGLES)
 #ifndef OPENGLES
     if (tex->get_component_type() == Texture::T_float || tex->get_component_type() == Texture::T_unsigned_short) {
       return GL_LUMINANCE_ALPHA16F_ARB;
@@ -11553,7 +11553,7 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) {
     }
 #endif
 
-#if !defined(SUPPORT_FIXED_FUNCTION) && !defined(OPENGLES_2)
+#if !defined(SUPPORT_FIXED_FUNCTION) && !defined(OPENGLES)
     // Do we need to apply a swizzle mask to emulate these deprecated
     // texture formats?
     switch (tex->get_format()) {

+ 17 - 12
panda/src/pnmimagetypes/bmp.h

@@ -32,6 +32,10 @@ static unsigned long BMPoffbits(int classv, unsigned long bitcount);
 
 #define C_WIN   1
 #define C_OS2   2
+#define C_WINV2 3
+#define C_WINV3 4
+#define C_WINV4 5
+#define C_WINV5 6
 
 static char     er_internal[] = "%s: internal error!";
 
@@ -41,8 +45,12 @@ BMPlenfileheader(int classv)
         switch (classv)
         {
         case C_WIN:
-                return 14;
         case C_OS2:
+        case C_WINV2:
+        case C_WINV3:
+        case C_WINV4:
+        case C_WINV5:
+                return 14;
                 return 14;
         default:
                 pm_error(er_internal, "BMPlenfileheader");
@@ -59,6 +67,14 @@ BMPleninfoheader(int classv)
                 return 40;
         case C_OS2:
                 return 12;
+        case C_WINV2:
+                return 52;
+        case C_WINV3:
+                return 56;
+        case C_WINV4:
+                return 108;
+        case C_WINV5:
+                return 124;
         default:
                 pm_error(er_internal, "BMPleninfoheader");
                 return 0;
@@ -107,17 +123,6 @@ BMPlenline(int classv, unsigned long bitcount, unsigned long x)
 {
         unsigned long   bitsperline;
 
-        switch (classv)
-        {
-        case C_WIN:
-                break;
-        case C_OS2:
-                break;
-        default:
-                pm_error(er_internal, "BMPlenline");
-                return 0;
-        }
-
         bitsperline = x * bitcount;
 
         /*

+ 58 - 31
panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx

@@ -191,37 +191,45 @@ BMPreadinfoheader(
         {
         case 12:
                 classv = C_OS2;
-
-                cx = GetShort(fp);
-                cy = GetShort(fp);
-                cPlanes = GetShort(fp);
-                cBitCount = GetShort(fp);
-
                 break;
-        case 40:
+        case 40:  // BITMAPINFOHEADER
                 classv = C_WIN;
+                break;
+        case 52:  // BITMAPV2INFOHEADER
+                classv = C_WINV2;
+                break;
+        case 56:  // BITMAPV3INFOHEADER
+                classv = C_WINV3;
+                break;
+        case 108:  // BITMAPV4HEADER
+                classv = C_WINV4;
+                break;
+        case 124:  // BITMAPV5HEADER
+                classv = C_WINV5;
+                break;
+        default:
+                pm_error("%s: unknown cbFix: %d", ifname, cbFix);
+                break;
+        }
 
+        if (classv == C_OS2) {
+                cx = GetShort(fp);
+                cy = GetShort(fp);
+        } else {
                 cx = GetLong(fp);
                 cy = GetLong(fp);
-                cPlanes = GetShort(fp);
-                cBitCount = GetShort(fp);
-
-                /*
-                 * We've read 16 bytes so far, need to read 24 more
-                 * for the required total of 40.
-                 */
+        }
+        cPlanes = GetShort(fp);
+        cBitCount = GetShort(fp);
 
+        /*
+         * We've read 16 bytes so far, need to read more
+         * for the required total.
+         */
+        if (classv != C_OS2) {
+            for (int i = 0; i < cbFix - 16; i += 4) {
                 GetLong(fp);
-                GetLong(fp);
-                GetLong(fp);
-                GetLong(fp);
-                GetLong(fp);
-                GetLong(fp);
-
-                break;
-        default:
-                pm_error("%s: unknown cbFix: %d", ifname, cbFix);
-                break;
+            }
         }
 
         if (cPlanes != 1)
@@ -239,6 +247,16 @@ BMPreadinfoheader(
                            ,cy
                            ,cBitCount);
                 break;
+        case C_WINV2:
+        case C_WINV3:
+        case C_WINV4:
+        case C_WINV5:
+                pm_message("Windows BMP V%d, %dx%dx%d"
+                           ,(classv - C_WINV2 + 2)
+                           ,cx
+                           ,cy
+                           ,cBitCount);
+                break;
         case C_OS2:
                 pm_message("OS/2 BMP, %dx%dx%d"
                            ,cx
@@ -288,7 +306,7 @@ BMPreadrgbtable(
                 R[i] = (pixval) GetByte(fp);
                 nbyte += 3;
 
-                if (classv == C_WIN)
+                if (classv != C_OS2)
                 {
                         (void) GetByte(fp);
                         nbyte++;
@@ -307,6 +325,7 @@ BMPreadrow(
         istream           *fp,
         unsigned long  *ppos,   /* number of bytes read from fp */
         pixel          *row,
+        xelval         *alpha_row,
         unsigned long   cx,
         unsigned short  cBitCount,
         int             indexed,
@@ -335,6 +354,10 @@ BMPreadrow(
                   b = GetByte(fp);
                   g = GetByte(fp);
                   r = GetByte(fp);
+                  if (cBitCount > 24) {
+                    *(alpha_row++) = GetByte(fp);
+                    ++nbyte;
+                  }
                   nbyte += 3;
                   PPM_ASSIGN(*row, r, g, b);
                 } else {
@@ -369,7 +392,7 @@ BMPreadrow(
 }
 
 static void
-BMPreadbits(xel *array,
+BMPreadbits(xel *array, xelval *alpha_array,
         istream           *fp,
         unsigned long  *ppos,   /* number of bytes read from fp */
         unsigned long   offBits,
@@ -386,7 +409,7 @@ BMPreadbits(xel *array,
 
         readto(fp, ppos, offBits);
 
-        if(cBitCount > 24)
+        if(cBitCount > 24 && cBitCount != 32)
         {
                 pm_error("%s: cannot handle cBitCount: %d"
                          ,ifname
@@ -400,7 +423,7 @@ BMPreadbits(xel *array,
         for (y = (long)cy - 1; y >= 0; y--)
         {
                 int rc;
-                rc = BMPreadrow(fp, ppos, array + y*cx, cx, cBitCount, indexed, R, G, B);
+                rc = BMPreadrow(fp, ppos, array + y*cx, alpha_array + y*cx, cx, cBitCount, indexed, R, G, B);
                 if(rc == -1)
                 {
                         pm_error("%s: couldn't read row %d"
@@ -472,7 +495,11 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) :
     }
   }
 
-  _num_channels = 3;
+  if (cBitCount > 24) {
+    _num_channels = 4;
+  } else {
+    _num_channels = 3;
+  }
   _x_size = (int)cx;
   _y_size = (int)cy;
   _maxval = 255;
@@ -498,8 +525,8 @@ Reader(PNMFileType *type, istream *file, bool owns_file, string magic_number) :
 //               below.
 ////////////////////////////////////////////////////////////////////
 int PNMFileTypeBMP::Reader::
-read_data(xel *array, xelval *) {
-  BMPreadbits(array, _file, &pos, offBits, _x_size, _y_size,
+read_data(xel *array, xelval *alpha_array) {
+  BMPreadbits(array, alpha_array, _file, &pos, offBits, _x_size, _y_size,
               cBitCount, classv, indexed, R, G, B);
 
   if (pos != BMPlenfile(classv, cBitCount, _x_size, _y_size)) {

Some files were not shown because too many files changed in this diff