From bcb203af9a1e027aee4a96794c5f238a466a9f4a Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 29 Mar 2015 18:09:28 +0200 Subject: [PATCH 01/73] Mac OS X build improvements --- direct/src/p3d/Packager.py | 5 +- direct/src/p3d/ppackage.py | 5 +- direct/src/showutil/FreezeTool.py | 2 +- makepanda/installpanda.py | 3 + makepanda/makepanda.py | 136 ++++++++++++++++-------------- makepanda/makepandacore.py | 54 ++++++++---- 6 files changed, 122 insertions(+), 83 deletions(-) diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 23f10f0604..8b8a0733c2 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -1156,7 +1156,10 @@ class Packager: self.__alterFrameworkDependencies(file, framework_deps) for filename in filenames: - if '.framework/' in filename: + if '@loader_path' in filename: + filename = filename.replace('@loader_path', file.filename.getDirname()) + + if False and '.framework/' in filename: # It references a framework, and besides the fact # that those often contain absolute paths, they # aren't commonly on the library path either. diff --git a/direct/src/p3d/ppackage.py b/direct/src/p3d/ppackage.py index 3897c7c52c..f0369ada92 100755 --- a/direct/src/p3d/ppackage.py +++ b/direct/src/p3d/ppackage.py @@ -90,7 +90,7 @@ Options: each supported architecture). On other platforms, this option does nothing. This is therefore safe to apply in all cases, if you wish to take advantage of universal binaries. This is - equivalent to "-P osx_ppc -P osx_i386" on Mac platforms. + equivalent to "-P osx_i386 -P osx_x86_64" on Mac platforms. -P platform Specify the platform to masquerade as. The default is whatever @@ -215,8 +215,7 @@ if universalBinaries: print '\nYou may not specify both -u and -P.\n' sys.exit(1) if PandaSystem.getPlatform().startswith('osx_'): - # Maybe soon we'll add osx_x86_64 to this default list. - platforms = ['osx_i386', 'osx_ppc'] + platforms = ['osx_i386', 'osx_x86_64'] if not platforms: platforms = [PandaSystem.getPlatform()] diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index 216192939f..f5384024c9 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -144,7 +144,7 @@ class CompilationEnvironment: elif proc == 'ppc': self.arch = '-arch ppc' elif proc == 'x86_64': - self.arch = '-arch x86_x64' + self.arch = '-arch x86_64' self.compileObj = "gcc -fPIC -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s" self.linkExe = "gcc %(arch)s -o %(basename)s %(basename)s.o -framework Python" self.linkDll = "gcc %(arch)s -undefined dynamic_lookup -bundle -o %(basename)s.so %(basename)s.o" diff --git a/makepanda/installpanda.py b/makepanda/installpanda.py index b1804942d8..41e78bc85a 100644 --- a/makepanda/installpanda.py +++ b/makepanda/installpanda.py @@ -127,6 +127,9 @@ def GetLibDir(): something like "lib" or "lib64" or in some cases, something similar to "lib/x86_64-linux-gnu". """ + if sys.platform == "darwin": + return "lib" + # This one's a bit tricky. Some systems require us to install # 64-bits libraries into /usr/lib64, some into /usr/lib. # Debian forbids installing to lib64 nowadays, and the only distros diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 620981d136..4f45b2d6b8 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -67,7 +67,7 @@ MAJOR_VERSION=None COREAPI_VERSION=None PLUGIN_VERSION=None OSXTARGET=None -UNIVERSAL=False +OSX_ARCHS=[] HOST_URL=None global STRDXSDKVERSION, STRMSPLATFORMVERSION, BOOUSEINTELCOMPILER STRDXSDKVERSION = 'default' @@ -165,7 +165,7 @@ def usage(problem): def parseopts(args): global INSTALLER,RTDIST,RUNTIME,GENMAN,DISTRIBUTOR,VERSION - global COMPRESSOR,THREADCOUNT,OSXTARGET,UNIVERSAL,HOST_URL + global COMPRESSOR,THREADCOUNT,OSXTARGET,OSX_ARCHS,HOST_URL global DEBVERSION,RPMRELEASE,GIT_COMMIT,P3DSUFFIX global STRDXSDKVERSION, STRMSPLATFORMVERSION, BOOUSEINTELCOMPILER longopts = [ @@ -179,6 +179,7 @@ def parseopts(args): optimize = "" target = None target_arch = None + universal = False for pkg in PkgListGet(): longopts.append("no-"+pkg.lower()) for pkg in PkgListGet(): longopts.append("use-"+pkg.lower()) try: @@ -197,7 +198,7 @@ def parseopts(args): elif (option=="--threads"): THREADCOUNT=int(value) elif (option=="--outputdir"): SetOutputDir(value.strip()) elif (option=="--osxtarget"): OSXTARGET=value.strip() - elif (option=="--universal"): UNIVERSAL=True + elif (option=="--universal"): universal = True elif (option=="--target"): target = value.strip() elif (option=="--arch"): target_arch = value.strip() elif (option=="--nocolor"): DisableColors() @@ -252,23 +253,39 @@ def parseopts(args): usage("Options --runtime and --rtdist cannot be specified at the same time!") if (optimize=="" and (RTDIST or RUNTIME)): optimize = "4" elif (optimize==""): optimize = "3" - if (OSXTARGET != None and OSXTARGET.strip() == ""): - OSXTARGET = None - elif (OSXTARGET != None): - OSXTARGET = OSXTARGET.strip() - if (len(OSXTARGET) != 4 or not OSXTARGET.startswith("10.")): - usage("Invalid setting for OSXTARGET") + + if OSXTARGET: try: - OSXTARGET = "10.%d" % (int(OSXTARGET[-1])) + maj, min = OSXTARGET.strip().split('.') + OSXTARGET = int(maj), int(min) + assert OSXTARGET[0] == 10 except: usage("Invalid setting for OSXTARGET") + else: + OSXTARGET = None - if UNIVERSAL: - if not OSXTARGET: - exit("--universal requires --osxtarget") + if target is not None or target_arch is not None: + SetTarget(target, target_arch) + + if universal: if target_arch: exit("--universal is incompatible with --arch") + OSX_ARCHS.append("i386") + if OSXTARGET: + osxver = OSXTARGET + else: + maj, min = platform.mac_ver()[0].split('.')[:2] + osxver = int(maj), int(min) + + if osxver[1] < 6: + OSX_ARCHS.append("ppc") + else: + OSX_ARCHS.append("x86_64") + + elif HasTargetArch(): + OSX_ARCHS.append(GetTargetArch()) + try: SetOptimize(int(optimize)) assert GetOptimize() in [1, 2, 3, 4] @@ -278,9 +295,6 @@ def parseopts(args): if GIT_COMMIT is not None and not re.match("^[a-f0-9]{40}$", GIT_COMMIT): usage("Invalid SHA-1 hash given for --git-commit option!") - if target is not None or target_arch is not None: - SetTarget(target, target_arch) - is_win7 = False if GetHost() == "windows": if (STRMSPLATFORMVERSION not in ['winserver2003r2', 'win60A']): @@ -316,8 +330,8 @@ if ("LDFLAGS" in os.environ): LDFLAGS = os.environ["LDFLAGS"].strip() os.environ["MAKEPANDA"] = os.path.abspath(sys.argv[0]) -if (GetHost() == "darwin" and OSXTARGET != None): - os.environ["MACOSX_DEPLOYMENT_TARGET"] = OSXTARGET +if GetHost() == "darwin" and OSXTARGET is not None: + os.environ["MACOSX_DEPLOYMENT_TARGET"] = "%d.%d" % OSXTARGET ######################################################################## ## @@ -683,7 +697,7 @@ if (COMPILER=="GCC"): elif RUNTIME: # We don't support Cocoa in the runtime yet. PkgDisable("COCOA") - if UNIVERSAL or GetTargetArch() == 'x86_64': + if 'x86_64' in OSX_ARCHS: # 64-bits OS X doesn't have Carbon. PkgDisable("CARBON") @@ -738,7 +752,7 @@ if (COMPILER=="GCC"): cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV") if cv_lib == "opencv_core": OPENCV_VER_23 = True - SmartPkgEnable("OPENCV", "opencv", ("opencv_core"), ("opencv2/core/core.hpp")) + SmartPkgEnable("OPENCV", "opencv", ("opencv_core", "opencv_highgui"), ("opencv2/core/core.hpp")) else: SmartPkgEnable("OPENCV", "opencv", ("cv", "highgui", "cvaux", "ml", "cxcore"), ("opencv", "opencv/cv.h", "opencv/cxcore.h", "opencv/highgui.h")) @@ -752,8 +766,8 @@ if (COMPILER=="GCC"): SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h") if not PkgSkip("PYTHON"): - if GetHost() == "darwin" and GetTarget() == "darwin" and not RTDIST: - # Use the system Python framework in the standard Mac SDK. + if GetTarget() == "darwin" and SDK.get("MACOSX") and not RTDIST: + # When targeting a specific OSX version, use the system Python framework in the standard Mac SDK. LibName("PYTHON", "-framework Python") else: SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config") @@ -1125,20 +1139,13 @@ def CompileCxx(obj,src,opts): # Mac-specific flags. if GetTarget() == "darwin": cmd += " -Wno-deprecated-declarations" - if (OSXTARGET != None): + if OSXTARGET is not None: cmd += " -isysroot " + SDK["MACOSX"] - cmd += " -mmacosx-version-min=" + OSXTARGET + cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET) - if UNIVERSAL: - cmd += " -arch i386" - if OSXTARGET: - osxver = int(OSXTARGET[-1]) - if "NOPPC" not in opts and int(OSXTARGET[-1]) < 6: - cmd += " -arch ppc" - if int(OSXTARGET[-1]) >= 5: - cmd += " -arch x86_64" - elif HasTargetArch(): - cmd += " -arch %s" % (GetTargetArch()) + for arch in OSX_ARCHS: + if arch != "ppc" or "NOPPC" not in OPTS: + cmd += " -arch %s" % arch if "SYSROOT" in SDK: cmd += ' --sysroot=%s -no-canonical-prefixes' % (SDK["SYSROOT"]) @@ -1587,20 +1594,13 @@ def CompileLink(dll, obj, opts): # Mac OS X specific flags. if GetTarget() == 'darwin': cmd += " -headerpad_max_install_names" - if OSXTARGET != None: + if OSXTARGET is not None: cmd += " -isysroot " + SDK["MACOSX"] + " -Wl,-syslibroot," + SDK["MACOSX"] - cmd += " -mmacosx-version-min=" + OSXTARGET + cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET) - if UNIVERSAL: - cmd += " -arch i386" - if OSXTARGET: - osxver = int(OSXTARGET[-1]) - if "NOPPC" not in opts and int(OSXTARGET[-1]) < 6: - cmd += " -arch ppc" - if int(OSXTARGET[-1]) >= 5: - cmd += " -arch x86_64" - elif HasTargetArch(): - cmd += " -arch %s" % (GetTargetArch()) + for arch in OSX_ARCHS: + if arch != "ppc" or "NOPPC" not in OPTS: + cmd += " -arch %s" % arch if "SYSROOT" in SDK: cmd += " --sysroot=%s -no-canonical-prefixes" % (SDK["SYSROOT"]) @@ -1820,10 +1820,11 @@ def Package(target, inputs, opts): command += "direct/src/p3d/ppackage.py" if GetTarget() == "darwin": - if SDK.get("MACOSX") is not None: + if SDK.get("MACOSX"): command += " -R \"%s\"" % SDK["MACOSX"] - if UNIVERSAL: - command += " -u" + + for arch in OSX_ARCHS: + command += " -P osx_%s" % arch command += " -i \"" + GetOutputDir() + "/stage\"" if (P3DSUFFIX): @@ -2608,14 +2609,27 @@ if tp_dir is not None: if (PkgSkip("PYTHON")==0 and os.path.exists(tp_pkg + "/bin/" + SDK["PYTHONVERSION"])): CopyAllFiles(GetOutputDir() + "/bin/", tp_pkg + "/bin/" + SDK["PYTHONVERSION"] + "/") else: - if os.path.exists(tp_pkg + "/lib"): - CopyAllFiles(GetOutputDir() + "/lib/", tp_pkg + "/lib/") - if (PkgSkip("PYTHON")==0 and os.path.exists(tp_pkg + "/lib/" + SDK["PYTHONVERSION"])): - CopyAllFiles(GetOutputDir() + "/lib/", tp_pkg + "/lib/" + SDK["PYTHONVERSION"] + "/") + for tp_lib in glob.glob(tp_pkg + "/lib/*.so*"): + CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib) + + if not PkgSkip("PYTHON"): + for tp_lib in glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.so*")): + CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib) + + if GetTarget() == 'darwin': + for tp_lib in glob.glob(tp_pkg + "/lib/*.dylib"): + CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib) + + if not PkgSkip("PYTHON"): + for tp_lib in glob.glob(os.path.join(tp_pkg, "lib", SDK["PYTHONVERSION"], "*.dylib")): + CopyFile(GetOutputDir() + "/lib/" + os.path.basename(tp_lib), tp_lib) + + for fwx in glob.glob(tp_pkg + "/*.framework"): + CopyTree(GetOutputDir() + "/Frameworks/" + os.path.basename(fwx), fwx) if GetTarget() == 'windows': CopyAllFiles(GetOutputDir() + "/bin/", tp_dir + "extras/bin/") - if PkgSkip("PYTHON") == 0: + if not PkgSkip("PYTHON"): pydll = "/" + SDK["PYTHONVERSION"].replace(".", "") if (GetOptimize() <= 2): pydll += "_d.dll" else: pydll += ".dll" @@ -3745,7 +3759,6 @@ if (not RUNTIME): TargetAdd('core_module.obj', opts=['IMOD:panda3d.core', 'ILIB:core']) - OPTS=['WINSOCK2'] TargetAdd('core.pyd', input='libp3downloader_igate.obj') TargetAdd('core.pyd', input='p3express_ext_composite.obj') TargetAdd('core.pyd', input='libp3express_igate.obj') @@ -3795,7 +3808,7 @@ if (not RUNTIME): TargetAdd('core.pyd', input='core_module.obj') TargetAdd('core.pyd', input='libp3tinyxml.ilb') TargetAdd('core.pyd', input=COMMON_PANDA_LIBS) - TargetAdd('core.pyd', opts=OPTS) + TargetAdd('core.pyd', opts=['PYTHON', 'WINSOCK2']) # # DIRECTORY: panda/src/vision/ @@ -6597,6 +6610,7 @@ def MakeInstallerOSX(): oscmd("cp -R %s/models dstroot/base/Developer/Panda3D/models" % GetOutputDir()) oscmd("cp -R doc/LICENSE dstroot/base/Developer/Panda3D/LICENSE") oscmd("cp -R doc/ReleaseNotes dstroot/base/Developer/Panda3D/ReleaseNotes") + oscmd("cp -R %s/Frameworks dstroot/base/Developer/Panda3D/Frameworks" % GetOutputDir()) if os.path.isdir(GetOutputDir()+"/plugins"): oscmd("cp -R %s/plugins dstroot/base/Developer/Panda3D/plugins" % GetOutputDir()) @@ -6650,11 +6664,11 @@ def MakeInstallerOSX(): if PkgSkip("PYTHON")==0: PV = SDK["PYTHONVERSION"].replace("python", "") oscmd("mkdir -p dstroot/pythoncode/usr/bin") - oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D/direct") + oscmd("mkdir -p dstroot/pythoncode/Developer/Panda3D") oscmd("mkdir -p dstroot/pythoncode/Library/Python/%s/site-packages" % PV) WriteFile("dstroot/pythoncode/Library/Python/%s/site-packages/Panda3D.pth" % PV, "/Developer/Panda3D") oscmd("cp -R %s/pandac dstroot/pythoncode/Developer/Panda3D/pandac" % GetOutputDir()) - oscmd("cp -R direct/src/* dstroot/pythoncode/Developer/Panda3D/direct") + oscmd("cp -R %s/direct dstroot/pythoncode/Developer/Panda3D/direct" % GetOutputDir()) oscmd("ln -s %s dstroot/pythoncode/usr/bin/ppython" % SDK["PYTHONEXEC"]) if os.path.isdir(GetOutputDir()+"/Pmw"): oscmd("cp -R %s/Pmw dstroot/pythoncode/Developer/Panda3D/Pmw" % GetOutputDir()) @@ -6691,15 +6705,15 @@ def MakeInstallerOSX(): if not os.path.isdir("dstroot/" + pkg): os.makedirs("dstroot/" + pkg) - if OSXTARGET: - target = '--target %s' % (OSXTARGET) + if OSXTARGET and OSXTARGET <= (10, 5): + target = '--target %d.%d' % (OSXTARGET) else: target = '' if os.path.exists("/Developer/usr/bin/packagemaker"): cmd = '/Developer/usr/bin/packagemaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker"): - cmd = '/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg --target ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' + cmd = '/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker --info /tmp/Info_plist --version ' + VERSION + ' --out dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg ' + target + ' --domain system --root dstroot/' + pkg + '/ --no-relocate' elif os.path.exists("/Developer/Tools/packagemaker"): cmd = '/Developer/Tools/packagemaker -build -f dstroot/' + pkg + '/ -p dstroot/Panda3D/Panda3D.mpkg/Contents/Packages/' + pkg + '.pkg -i /tmp/Info_plist' else: diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 94d26306fe..8e7b46348c 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1062,7 +1062,10 @@ def MakeBuildTree(): MakeDirectory(OUTPUTDIR + "/panda3d") CreateFile(OUTPUTDIR + "/panda3d/__init__.py") - if GetTarget() == 'android': + if GetTarget() == 'darwin': + MakeDirectory(OUTPUTDIR + "/Frameworks") + + elif GetTarget() == 'android': MakeDirectory(OUTPUTDIR + "/libs") MakeDirectory(OUTPUTDIR + "/libs/" + ANDROID_ABI) MakeDirectory(OUTPUTDIR + "/src") @@ -1847,7 +1850,6 @@ def SdkLocatePython(prefer_thirdparty_python=False): elif CrossCompiling() or (prefer_thirdparty_python and os.path.isdir(os.path.join(GetThirdpartyDir(), "python"))): tp_python = os.path.join(GetThirdpartyDir(), "python") - SDK["PYTHON"] = tp_python + "/include" if GetTarget() == 'darwin': py_libs = glob.glob(tp_python + "/lib/libpython[0-9].[0-9].dylib") @@ -1865,6 +1867,24 @@ def SdkLocatePython(prefer_thirdparty_python=False): py_lib = os.path.basename(py_libs[0]) SDK["PYTHONVERSION"] = "python" + py_lib[9] + "." + py_lib[11] SDK["PYTHONEXEC"] = tp_python + "/bin/" + SDK["PYTHONVERSION"] + SDK["PYTHON"] = tp_python + "/include/" + SDK["PYTHONVERSION"] + + elif GetTarget() == 'darwin' and SDK.get("MACOSX"): + # When targeting a specific Mac OS X version, use the system Python framework. + py_fwx = SDK.get("MACOSX", "") + "/System/Library/Frameworks/Python.framework/Versions/Current" + + if not os.path.islink(py_fwx): + exit("Could not locate Python installation at %s" % (py_fwx)) + + ver = os.path.basename(os.readlink(py_fwx)) + py_fwx = SDK.get("MACOSX", "") + "/System/Library/Frameworks/Python.framework/Versions/%s" % ver + + SDK["PYTHON"] = py_fwx + "/Headers" + SDK["PYTHONVERSION"] = "python" + ver + SDK["PYTHONEXEC"] = "/System/Library/Frameworks/Python.framework/Versions/" + ver + "/bin/python" + ver + + if sys.version[:3] != ver: + print("Warning: building with Python %s instead of %s since you targeted a specific Mac OS X version." % (ver, sys.version[:3])) #elif GetTarget() == 'windows': # SDK["PYTHON"] = os.path.dirname(sysconfig.get_python_inc()) @@ -1932,22 +1952,23 @@ def SdkLocateMSPlatform(strMode = 'default'): def SdkLocateMacOSX(osxtarget = None): if (GetHost() != "darwin"): return if (osxtarget != None): - if (os.path.exists("/Developer/SDKs/MacOSX%su.sdk" % osxtarget)): - SDK["MACOSX"] = "/Developer/SDKs/MacOSX%su.sdk" % osxtarget - elif (os.path.exists("/Developer/SDKs/MacOSX%s.sdk" % osxtarget)): - SDK["MACOSX"] = "/Developer/SDKs/MacOSX%s.sdk" % osxtarget - elif (os.path.exists("/Developer/SDKs/MacOSX%s.0.sdk" % osxtarget)): - SDK["MACOSX"] = "/Developer/SDKs/MacOSX%s.0.sdk" % osxtarget - elif (os.path.exists("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % osxtarget)): - SDK["MACOSX"] = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % osxtarget + sdkname = "MacOSX%d.%d" % osxtarget + if (os.path.exists("/Developer/SDKs/%su.sdk" % sdkname)): + SDK["MACOSX"] = "/Developer/SDKs/%su.sdk" % sdkname + elif (os.path.exists("/Developer/SDKs/%s.sdk" % sdkname)): + SDK["MACOSX"] = "/Developer/SDKs/%s.sdk" % sdkname + elif (os.path.exists("/Developer/SDKs/%s.0.sdk" % sdkname)): + SDK["MACOSX"] = "/Developer/SDKs/%s.0.sdk" % sdkname + elif (os.path.exists("/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/%s.sdk" % sdkname)): + SDK["MACOSX"] = "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/%s.sdk" % sdkname else: handle = os.popen("xcode-select -print-path") result = handle.read().strip().rstrip('/') handle.close() - if (os.path.exists("%s/Platforms/MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % (result, osxtarget))): - SDK["MACOSX"] = "%s/Platforms/MacOSX.platform/Developer/SDKs/MacOSX%s.sdk" % (result, osxtarget) + if (os.path.exists("%s/Platforms/MacOSX.platform/Developer/SDKs/%s.sdk" % (result, sdkname))): + SDK["MACOSX"] = "%s/Platforms/MacOSX.platform/Developer/SDKs/%s.sdk" % (result, sdkname) else: - exit("Couldn't find any MacOSX SDK for OSX version %s!" % osxtarget) + exit("Couldn't find any MacOSX SDK for OSX version %s!" % sdkname) else: SDK["MACOSX"] = "" @@ -2370,11 +2391,10 @@ def SetupBuildEnvironment(compiler): AddToPathEnv("PYTHONPATH", builtdir) AddToPathEnv("PANDA_PRC_DIR", os.path.join(builtdir, "etc")) AddToPathEnv("PATH", os.path.join(builtdir, "bin")) - if (GetHost() == 'windows'): - AddToPathEnv("PATH", os.path.join(builtdir, "plugins")) + if GetHost() == 'windows': + # extension_native_helpers.py currently expects to find libpandaexpress on sys.path. AddToPathEnv("PYTHONPATH", os.path.join(builtdir, "bin")) - else: - AddToPathEnv("PYTHONPATH", os.path.join(builtdir, "lib")) + AddToPathEnv("PATH", os.path.join(builtdir, "plugins")) # Now for the special (DY)LD_LIBRARY_PATH on Unix-esque systems. if GetHost() != 'windows': From 0f8f4d63b0e4f1853050c5c9046837e606a418e9 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 29 Mar 2015 18:11:12 +0200 Subject: [PATCH 02/73] Only query glVertexAttribIPointer when GL version >= 3.0 --- .../src/glstuff/glGraphicsStateGuardian_src.cxx | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 76087d4644..b623cb655f 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -1310,10 +1310,19 @@ reset() { get_extension_func("glValidateProgram"); _glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) get_extension_func("glVertexAttribPointer"); - _glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) - get_extension_func("glVertexAttribIPointer"); - _glVertexAttribLPointer = (PFNGLVERTEXATTRIBLPOINTERPROC) - get_extension_func("glVertexAttribLPointer"); + + if (is_at_least_gl_version(3, 0)) { + _glVertexAttribIPointer = (PFNGLVERTEXATTRIBIPOINTERPROC) + get_extension_func("glVertexAttribIPointer"); + } else { + _glVertexAttribIPointer = NULL; + } + if (has_extension("GL_ARB_vertex_attrib_64bit")) { + _glVertexAttribLPointer = (PFNGLVERTEXATTRIBLPOINTERPROC) + get_extension_func("glVertexAttribLPointer"); + } else { + _glVertexAttribLPointer = NULL; + } if (_supports_geometry_shaders) { _glProgramParameteri = (PFNGLPROGRAMPARAMETERIPROC) From 982ece639d02510dd7d3a378463c2ef5705ffe2b Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 29 Mar 2015 18:16:29 +0200 Subject: [PATCH 03/73] Support specifying custom location of thirdparty packages on makepanda command-line --- makepanda/makepanda.py | 37 +++++++++++++------- makepanda/makepandacore.py | 72 ++++++++++++++++++++++++++------------ 2 files changed, 74 insertions(+), 35 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 4f45b2d6b8..0ef8776e94 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -150,6 +150,9 @@ def usage(problem): for pkg in PkgListGet(): p = pkg.lower() print(" --use-%-9s --no-%-9s (enable/disable use of %s)"%(p, p, pkg)) + if sys.platform != 'win32': + print(" ---incdir (custom location for header files of thirdparty package)") + print(" ---libdir (custom location for library files of thirdparty package)") print("") print(" --nothing (disable every third-party lib)") print(" --everything (enable every third-party lib)") @@ -180,11 +183,13 @@ def parseopts(args): target = None target_arch = None universal = False - for pkg in PkgListGet(): longopts.append("no-"+pkg.lower()) - for pkg in PkgListGet(): longopts.append("use-"+pkg.lower()) + for pkg in PkgListGet(): + longopts.append("no-" + pkg.lower()) + longopts.append(pkg.lower() + "-incdir=") + longopts.append(pkg.lower() + "-libdir=") try: opts, extras = getopt.getopt(args, "", longopts) - for option,value in opts: + for option, value in opts: if (option=="--help"): raise Exception elif (option=="--optimize"): optimize=value elif (option=="--installer"): INSTALLER=1 @@ -229,19 +234,25 @@ def parseopts(args): elif (option=="--use-icl"): BOOUSEINTELCOMPILER = True else: for pkg in PkgListGet(): - if (option=="--use-"+pkg.lower()): + if option == "--use-" + pkg.lower(): PkgEnable(pkg) break - for pkg in PkgListGet(): - if (option=="--no-"+pkg.lower()): + elif option == "--use-" + pkg.lower(): PkgDisable(pkg) break - if (option=="--everything" or option.startswith("--use-") - or option=="--nothing" or option.startswith("--no-")): + elif option == "--" + pkg.lower() + "-incdir": + PkgSetCustomLocation(pkg) + IncDirectory(pkg, value) + break + elif option == "--" + pkg.lower() + "-libdir": + PkgSetCustomLocation(pkg) + LibDirectory(pkg, value) + break + if (option == "--everything" or option.startswith("--use-") + or option == "--nothing" or option.startswith("--no-")): anything = 1 except: - usage(0) - print("Exception while parsing commandline:", sys.exc_info()[0]) + usage(sys.exc_info()[1]) if not anything: if RUNTIME: @@ -4179,7 +4190,7 @@ if (not RUNTIME): # if (not RUNTIME and PkgSkip("GL")==0): - OPTS=['DIR:panda/src/glgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'NVIDIACG'] + OPTS=['DIR:panda/src/glgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGL', 'GL', 'NVIDIACG'] TargetAdd('p3glgsg_config_glgsg.obj', opts=OPTS, input='config_glgsg.cxx') TargetAdd('p3glgsg_glgsg.obj', opts=OPTS, input='glgsg.cxx') @@ -4188,7 +4199,7 @@ if (not RUNTIME and PkgSkip("GL")==0): # if (not RUNTIME and PkgSkip("GLES")==0): - OPTS=['DIR:panda/src/glesgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES'] + OPTS=['DIR:panda/src/glesgsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES', 'GLES'] TargetAdd('p3glesgsg_config_glesgsg.obj', opts=OPTS, input='config_glesgsg.cxx') TargetAdd('p3glesgsg_glesgsg.obj', opts=OPTS, input='glesgsg.cxx') @@ -4197,7 +4208,7 @@ if (not RUNTIME and PkgSkip("GLES")==0): # if (not RUNTIME and PkgSkip("GLES2")==0): - OPTS=['DIR:panda/src/gles2gsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2'] + OPTS=['DIR:panda/src/gles2gsg', 'DIR:panda/src/glstuff', 'BUILDING:PANDAGLES2', 'GLES2'] TargetAdd('p3gles2gsg_config_gles2gsg.obj', opts=OPTS, input='config_gles2gsg.cxx') TargetAdd('p3gles2gsg_gles2gsg.obj', opts=OPTS, input='gles2gsg.cxx') diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index 8e7b46348c..a4b9b406d8 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1217,8 +1217,9 @@ def UnsetLinkAllStatic(): ## ######################################################################## -PKG_LIST_ALL=[] -PKG_LIST_OMIT={} +PKG_LIST_ALL = [] +PKG_LIST_OMIT = {} +PKG_LIST_CUSTOM = set() def PkgListSet(pkgs): global PKG_LIST_ALL @@ -1244,6 +1245,12 @@ def PkgEnable(pkg): def PkgDisable(pkg): PKG_LIST_OMIT[pkg] = 1 +def PkgSetCustomLocation(pkg): + PKG_LIST_CUSTOM.add(pkg) + +def PkgHasCustomLocation(pkg): + return pkg in PKG_LIST_CUSTOM + def PkgSkip(pkg): return PKG_LIST_OMIT[pkg] @@ -1401,22 +1408,22 @@ def PkgConfigEnable(opt, pkgname, tool = "pkg-config"): for i, j in PkgConfigGetDefSymbols(pkgname, tool).items(): DefSymbol(opt, i, j) -def LibraryExists(lib, lpath=[]): +def LocateLibrary(lib, lpath=[]): """ Returns True if this library was found in the given search path, False otherwise. """ target = GetTarget() for dir in lpath: if target == 'darwin' and os.path.isfile(os.path.join(dir, 'lib%s.dylib' % lib)): - return True + return os.path.join(dir, 'lib%s.dylib' % lib) elif target != 'darwin' and os.path.isfile(os.path.join(dir, 'lib%s.so' % lib)): - return True + return os.path.join(dir, 'lib%s.so' % lib) elif os.path.isfile(os.path.join(dir, 'lib%s.a' % lib)): - return True + return os.path.join(dir, 'lib%s.a' % lib) - return False + return None def SystemLibraryExists(lib): - return LibraryExists(lib, SYS_LIB_DIRS) + return LocateLibrary(lib, SYS_LIB_DIRS) is not None def ChooseLib(libs, thirdparty=None): """ Chooses a library from the parameters, in order of preference. Returns the first if none of them were found. """ @@ -1430,7 +1437,7 @@ def ChooseLib(libs, thirdparty=None): libname = l if l.startswith("lib"): libname = l[3:] - if LibraryExists(libname, lpath): + if LocateLibrary(libname, lpath): return libname if len(libs) > 0: @@ -1466,16 +1473,18 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, for d in olddefs: defs[d] = "" - if (pkg.lower() == "swscale" and os.path.isfile(GetThirdpartyDir() + "ffmpeg/include/libswscale/swscale.h")): + custom_loc = PkgHasCustomLocation(pkg) + + if pkg.lower() == "swscale" and os.path.isfile(GetThirdpartyDir() + "ffmpeg/include/libswscale/swscale.h"): # Let it be handled by the ffmpeg package LibName(target_pkg, "-lswscale") return - if (pkg.lower() == "swresample" and os.path.isfile(GetThirdpartyDir() + "ffmpeg/include/libswresample/swresample.h")): + if pkg.lower() == "swresample" and os.path.isfile(GetThirdpartyDir() + "ffmpeg/include/libswresample/swresample.h"): LibName(target_pkg, "-lswresample") return pkg_dir = os.path.join(GetThirdpartyDir(), pkg.lower()) - if (os.path.isdir(pkg_dir)): + if not custom_loc and os.path.isdir(pkg_dir): if framework and os.path.isdir(os.path.join(pkg_dir, framework + ".framework")): FrameworkDirectory(target_pkg, pkg_dir) LibName(target_pkg, "-framework " + framework) @@ -1515,7 +1524,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, DefSymbol(target_pkg, d, v) return - elif (GetHost() == "darwin" and framework != None): + elif not custom_loc and GetHost() == "darwin" and framework != None: prefix = SDK["MACOSX"] if (os.path.isdir(prefix + "/Library/Frameworks/%s.framework" % framework) or os.path.isdir(prefix + "/System/Library/Frameworks/%s.framework" % framework) or @@ -1529,7 +1538,7 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, elif VERBOSE: print(ColorText("cyan", "Couldn't find the framework %s" % (framework))) - elif (LocateBinary(tool) != None and (tool != "pkg-config" or pkgconfig != None)): + elif not custom_loc and LocateBinary(tool) != None and (tool != "pkg-config" or pkgconfig != None): if (isinstance(pkgconfig, str) or tool != "pkg-config"): if (PkgConfigHavePkg(pkgconfig, tool)): return PkgConfigEnable(target_pkg, pkgconfig, tool) @@ -1559,22 +1568,38 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, libname = l if l.startswith("lib"): libname = l[3:] - if SystemLibraryExists(libname): + + if custom_loc: + # Try searching in the package's LibDirectories. + lpath = [dir for ppkg, dir in LIBDIRECTORIES if pkg == ppkg] + location = LocateLibrary(libname, lpath) + if location is not None: + LibName(target_pkg, location) + else: + have_pkg = False + print(GetColor("cyan") + "Couldn't find library lib" + libname + GetColor()) + + elif SystemLibraryExists(libname): + # It exists in a system library directory. LibName(target_pkg, "-l" + libname) else: # Try searching in the package's LibDirectories. lpath = [dir for ppkg, dir in LIBDIRECTORIES if pkg == ppkg or ppkg == "ALWAYS"] - if LibraryExists(libname, lpath): + location = LocateLibrary(libname, lpath) + if location is not None: LibName(target_pkg, "-l" + libname) else: have_pkg = False - if VERBOSE: + if VERBOSE or custom_loc: print(GetColor("cyan") + "Couldn't find library lib" + libname + GetColor()) # Determine which include directories to look in. - incdirs = list(SYS_INC_DIRS) + incdirs = [] + if not custom_loc: + incdirs += list(SYS_INC_DIRS) + for ppkg, pdir in INCDIRECTORIES: - if pkg == ppkg or ppkg == "ALWAYS": + if pkg == ppkg or (ppkg == "ALWAYS" and not custom_loc): incdirs.append(pdir) # The incs list contains both subdirectories to explicitly add to @@ -1588,14 +1613,17 @@ def SmartPkgEnable(pkg, pkgconfig = None, libs = None, incs = None, defs = None, # Note: It's possible to specify a file instead of a dir, for the sake of checking if it exists. if incdir is None and i.endswith(".h"): have_pkg = False - if VERBOSE: + if VERBOSE or custom_loc: print(GetColor("cyan") + "Couldn't find header file " + i + GetColor()) if incdir is not None and os.path.isdir(incdir): IncDirectory(target_pkg, incdir) - if (not have_pkg): - if (pkg in PkgListGet()): + if not have_pkg: + if custom_loc: + print("%sERROR:%s Could not locate thirdparty package %s in specified directory, aborting build" % (GetColor("red"), GetColor(), pkg.lower())) + exit() + elif pkg in PkgListGet(): print("%sWARNING:%s Could not locate thirdparty package %s, excluding from build" % (GetColor("red"), GetColor(), pkg.lower())) PkgDisable(pkg) else: From 5827959056d8722209e5601f4bf42ec153a05e80 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 29 Mar 2015 22:06:32 +0200 Subject: [PATCH 04/73] Fixes for 64-bit OS X build on newer OS X versions --- direct/src/p3d/Packager.py | 28 ++++++++++++------- direct/src/p3d/ppackage.py | 4 +-- direct/src/plugin_installer/make_installer.py | 13 +++++++-- direct/src/showutil/FreezeTool.py | 2 +- makepanda/makepanda.py | 3 ++ panda/src/display/subprocessWindowBuffer.cxx | 1 + panda/src/tinydisplay/config_tinydisplay.cxx | 4 +-- panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx | 2 +- panda/src/tinydisplay/tinyOsxGraphicsPipe.h | 2 +- panda/src/tinydisplay/tinyOsxGraphicsWindow.h | 2 +- .../src/tinydisplay/tinyOsxGraphicsWindow.mm | 2 +- 11 files changed, 41 insertions(+), 22 deletions(-) diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index 8b8a0733c2..a25f1df0ae 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -1119,14 +1119,19 @@ class Packager: # Skip this file. continue + origFilename = Filename(file.filename) + tempFile = Filename.temporary('', 'p3d_', '.txt') command = '/usr/bin/otool -arch all -L "%s" >"%s"' % ( - file.filename.toOsSpecific(), + origFilename.toOsSpecific(), tempFile.toOsSpecific()) if self.arch: + arch = self.arch + if arch == "amd64": + arch = "x86_64" command = '/usr/bin/otool -arch %s -L "%s" >"%s"' % ( - self.arch, - file.filename.toOsSpecific(), + arch, + origFilename.toOsSpecific(), tempFile.toOsSpecific()) exitStatus = os.system(command) if exitStatus != 0: @@ -1137,13 +1142,13 @@ class Packager: filenames = self.__parseDependenciesOSX(tempFile) tempFile.unlink() if filenames is None: - self.notify.warning("Unable to determine dependencies from %s" % (file.filename)) + self.notify.warning("Unable to determine dependencies from %s" % (origFilename)) continue # Attempt to resolve the dependent filename relative # to the original filename, before we resolve it along # the PATH. - path = DSearchPath(Filename(file.filename.getDirname())) + path = DSearchPath(Filename(origFilename.getDirname())) # Find the dependencies that are referencing a framework framework_deps = [] @@ -1157,7 +1162,7 @@ class Packager: for filename in filenames: if '@loader_path' in filename: - filename = filename.replace('@loader_path', file.filename.getDirname()) + filename = filename.replace('@loader_path', origFilename.getDirname()) if False and '.framework/' in filename: # It references a framework, and besides the fact @@ -2085,6 +2090,10 @@ class Packager: # particular architecture, use lipo to strip out the # part of the file for that architecture. + arch = self.arch + if arch == "amd64": + arch = "x86_64" + # First, we need to verify that it is in fact a # universal binary. tfile = Filename.temporary('', 'p3d_') @@ -2110,25 +2119,24 @@ class Packager: arches = lipoData.rsplit(':', 1)[1] arches = arches.split() - if arches == [self.arch]: + if arches == [arch]: # The file only contains the one architecture that # we want anyway. file.filename.setBinary() self.multifile.addSubfile(file.newName, file.filename, compressionLevel) return True - if self.arch not in arches: + if arch not in arches: # The file doesn't support the architecture that we # want at all. Omit the file. self.notify.warning("%s doesn't support architecture %s" % ( file.filename, self.arch)) return False - # The file contains multiple architectures. Get # out just the one we want. command = '/usr/bin/lipo -thin %s -output "%s" "%s"' % ( - self.arch, tfile.toOsSpecific(), + arch, tfile.toOsSpecific(), file.filename.toOsSpecific()) exitStatus = os.system(command) if exitStatus != 0: diff --git a/direct/src/p3d/ppackage.py b/direct/src/p3d/ppackage.py index f0369ada92..36be497a9f 100755 --- a/direct/src/p3d/ppackage.py +++ b/direct/src/p3d/ppackage.py @@ -90,7 +90,7 @@ Options: each supported architecture). On other platforms, this option does nothing. This is therefore safe to apply in all cases, if you wish to take advantage of universal binaries. This is - equivalent to "-P osx_i386 -P osx_x86_64" on Mac platforms. + equivalent to "-P osx_i386 -P osx_amd64" on Mac platforms. -P platform Specify the platform to masquerade as. The default is whatever @@ -215,7 +215,7 @@ if universalBinaries: print '\nYou may not specify both -u and -P.\n' sys.exit(1) if PandaSystem.getPlatform().startswith('osx_'): - platforms = ['osx_i386', 'osx_x86_64'] + platforms = ['osx_i386', 'osx_amd64'] if not platforms: platforms = [PandaSystem.getPlatform()] diff --git a/direct/src/plugin_installer/make_installer.py b/direct/src/plugin_installer/make_installer.py index 4a4a73ccd1..7767ca425a 100755 --- a/direct/src/plugin_installer/make_installer.py +++ b/direct/src/plugin_installer/make_installer.py @@ -461,7 +461,10 @@ def makeInstaller(): infoFilename = None descriptionFilename = None - packagemaker = "/Developer/usr/bin/packagemaker" + packagemaker = "/Applications/Xcode.app/Contents/Applications/PackageMaker.app/Contents/MacOS/PackageMaker" + if not os.path.exists(packagemaker): + packagemaker = "/Developer/usr/bin/packagemaker" + if os.path.exists(packagemaker): # PackageMaker 3.0 or better, e.g. OSX 10.5. CMD = packagemaker @@ -469,7 +472,7 @@ def makeInstaller(): CMD += ' --version "%s"' % options.version CMD += ' --title "%s"' % options.long_name CMD += ' --out "%s"' % (pkgname) - CMD += ' --target 10.4' # The earliest version of OSX supported by Panda + CMD += ' --target 10.5' # The earliest version of OSX supported by Panda CMD += ' --domain system' CMD += ' --root "%s"' % tmproot CMD += ' --resources "%s"' % tmpresdir @@ -520,7 +523,11 @@ def makeInstaller(): # Pack the .pkg into a .dmg if not os.path.exists(tmproot): os.makedirs(tmproot) - shutil.copytree(pkgname, os.path.join(tmproot, pkgname)) + if os.path.isdir(pkgname): + shutil.copytree(pkgname, os.path.join(tmproot, pkgname)) + else: + shutil.copyfile(pkgname, os.path.join(tmproot, pkgname)) + tmpdmg = tempfile.mktemp('', 'p3d-setup') + ".dmg" CMD = 'hdiutil create "%s" -srcfolder "%s"' % (tmpdmg, tmproot) print "" diff --git a/direct/src/showutil/FreezeTool.py b/direct/src/showutil/FreezeTool.py index f5384024c9..28c622a9be 100644 --- a/direct/src/showutil/FreezeTool.py +++ b/direct/src/showutil/FreezeTool.py @@ -143,7 +143,7 @@ class CompilationEnvironment: self.arch = '-arch i386' elif proc == 'ppc': self.arch = '-arch ppc' - elif proc == 'x86_64': + elif proc == 'amd64': self.arch = '-arch x86_64' self.compileObj = "gcc -fPIC -c %(arch)s -o %(basename)s.o -O2 -I%(pythonIPath)s %(filename)s" self.linkExe = "gcc %(arch)s -o %(basename)s %(basename)s.o -framework Python" diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 0ef8776e94..628635b679 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -184,6 +184,7 @@ def parseopts(args): target_arch = None universal = False for pkg in PkgListGet(): + longopts.append("use-" + pkg.lower()) longopts.append("no-" + pkg.lower()) longopts.append(pkg.lower() + "-incdir=") longopts.append(pkg.lower() + "-libdir=") @@ -1835,6 +1836,8 @@ def Package(target, inputs, opts): command += " -R \"%s\"" % SDK["MACOSX"] for arch in OSX_ARCHS: + if arch == "x86_64": + arch = "amd64" command += " -P osx_%s" % arch command += " -i \"" + GetOutputDir() + "/stage\"" diff --git a/panda/src/display/subprocessWindowBuffer.cxx b/panda/src/display/subprocessWindowBuffer.cxx index 4936c03698..fa31624daf 100644 --- a/panda/src/display/subprocessWindowBuffer.cxx +++ b/panda/src/display/subprocessWindowBuffer.cxx @@ -16,6 +16,7 @@ #include #include #include +#include #include using namespace std; diff --git a/panda/src/tinydisplay/config_tinydisplay.cxx b/panda/src/tinydisplay/config_tinydisplay.cxx index eea1101acd..73dac78e0e 100644 --- a/panda/src/tinydisplay/config_tinydisplay.cxx +++ b/panda/src/tinydisplay/config_tinydisplay.cxx @@ -116,7 +116,7 @@ init_libtinydisplay() { ps->set_system_tag("TinyPanda", "native_window_system", "Win"); #endif -#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) +#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) && !__LP64__ TinyOsxGraphicsPipe::init_type(); TinyOsxGraphicsWindow::init_type(); selection->add_pipe_type(TinyOsxGraphicsPipe::get_class_type(), @@ -150,7 +150,7 @@ get_pipe_type_p3tinydisplay() { return TinyWinGraphicsPipe::get_class_type().get_index(); #endif -#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) +#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) && !__LP64__ return TinyOsxGraphicsPipe::get_class_type().get_index(); #endif diff --git a/panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx b/panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx index 45122a4e13..1c8d672479 100644 --- a/panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx +++ b/panda/src/tinydisplay/tinyOsxGraphicsPipe.cxx @@ -14,7 +14,7 @@ #include "pandabase.h" -#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) +#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) && !__LP64__ #include "tinyOsxGraphicsPipe.h" #include "config_tinydisplay.h" diff --git a/panda/src/tinydisplay/tinyOsxGraphicsPipe.h b/panda/src/tinydisplay/tinyOsxGraphicsPipe.h index 18db9f946e..04900c366c 100644 --- a/panda/src/tinydisplay/tinyOsxGraphicsPipe.h +++ b/panda/src/tinydisplay/tinyOsxGraphicsPipe.h @@ -17,7 +17,7 @@ #include "pandabase.h" -#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) +#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) && !__LP64__ // We have to include this early, before anyone includes // netinet/tcp.h, which will define TCP_NODELAY and other symbols and diff --git a/panda/src/tinydisplay/tinyOsxGraphicsWindow.h b/panda/src/tinydisplay/tinyOsxGraphicsWindow.h index 660422dbd0..459ed0eee7 100644 --- a/panda/src/tinydisplay/tinyOsxGraphicsWindow.h +++ b/panda/src/tinydisplay/tinyOsxGraphicsWindow.h @@ -17,7 +17,7 @@ #include "pandabase.h" -#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) +#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) && !__LP64__ #include diff --git a/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm b/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm index baf237dab9..876de6450d 100644 --- a/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm +++ b/panda/src/tinydisplay/tinyOsxGraphicsWindow.mm @@ -11,7 +11,7 @@ #include "pandabase.h" -#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) +#if defined(IS_OSX) && !defined(BUILD_IPHONE) && defined(HAVE_CARBON) && !__LP64__ #include #include From af18bfd18d326a124e219cd8c00723eb7df000b1 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 30 Mar 2015 00:21:31 +0200 Subject: [PATCH 05/73] Fix makepanda, squelch libpandaexpress import error --- direct/src/extensions_native/extension_native_helpers.py | 9 ++++----- makepanda/makepanda.py | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/direct/src/extensions_native/extension_native_helpers.py b/direct/src/extensions_native/extension_native_helpers.py index 961f8f8636..9424b640ce 100644 --- a/direct/src/extensions_native/extension_native_helpers.py +++ b/direct/src/extensions_native/extension_native_helpers.py @@ -107,14 +107,13 @@ def Dtool_PreloadDLL(module): # Dtool_FindModule to find our panda3d.core module. However, we # should be able to import it. To differentiate the old-style Panda # build (with .dll's) from the new-style Panda build (with .pyd's), we -# first try to import libpandaexpress directly; if it succeeds we're -# in an old-style build, and if it fails we must be in a new-style -# build. +# first try to import panda3d.core directly; if it succeeds we're in a +# new-style build, and if it fails we must be in an old-style build. try: + from panda3d.core import * +except ImportError: Dtool_PreloadDLL("libpandaexpress") from libpandaexpress import * -except ImportError: - from panda3d.core import * def Dtool_ObjectToDict(cls, name, obj): cls.DtoolClassDict[name] = obj; diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 628635b679..9d8aa0cab6 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -238,7 +238,7 @@ def parseopts(args): if option == "--use-" + pkg.lower(): PkgEnable(pkg) break - elif option == "--use-" + pkg.lower(): + elif option == "--no-" + pkg.lower(): PkgDisable(pkg) break elif option == "--" + pkg.lower() + "-incdir": From 40fff906d1ad90f5c2a95bb75cdf6ef561ecaf27 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 30 Mar 2015 17:57:37 +0200 Subject: [PATCH 06/73] Change default window size to 800x600 across the board (incl runtime) --- direct/src/p3d/pdeploy.py | 2 +- direct/src/plugin_standalone/panda3d.cxx | 4 ++-- direct/src/plugin_standalone/panda3dBase.cxx | 4 ++-- panda/src/display/config_display.cxx | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/direct/src/p3d/pdeploy.py b/direct/src/p3d/pdeploy.py index 9ba14e43be..0b0a77f834 100644 --- a/direct/src/p3d/pdeploy.py +++ b/direct/src/p3d/pdeploy.py @@ -319,7 +319,7 @@ elif deploy_mode == 'installer': del i elif deploy_mode == 'html': - w, h = tokens.get("width", 640), tokens.get("height", 480) + w, h = tokens.get("width", 800), tokens.get("height", 600) if "data" not in tokens: tokens["data"] = appFilename.getBasename() diff --git a/direct/src/plugin_standalone/panda3d.cxx b/direct/src/plugin_standalone/panda3d.cxx index 78bb7143e0..ab0219f7cf 100644 --- a/direct/src/plugin_standalone/panda3d.cxx +++ b/direct/src/plugin_standalone/panda3d.cxx @@ -226,8 +226,8 @@ run_command_line(int argc, char *argv[]) { // The user asked for an embedded window. Create a toplevel // window to be its parent, of the requested size. if (_win_width == 0 && _win_height == 0) { - _win_width = 640; - _win_height = 480; + _win_width = 800; + _win_height = 600; } make_parent_window(); diff --git a/direct/src/plugin_standalone/panda3dBase.cxx b/direct/src/plugin_standalone/panda3dBase.cxx index be2d278889..6b38e221f2 100644 --- a/direct/src/plugin_standalone/panda3dBase.cxx +++ b/direct/src/plugin_standalone/panda3dBase.cxx @@ -62,8 +62,8 @@ Panda3DBase(bool console_environment) { _win_x = -1; _win_y = -1; - _win_width = 640; - _win_height = 480; + _win_width = 800; + _win_height = 600; _got_win_size = false; _exit_with_last_instance = true; diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index 978d88f256..0d219273e5 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -301,7 +301,7 @@ ConfigVariableBool allow_incomplete_render "the frame render if necessary.")); ConfigVariableInt win_size -("win-size", "640 480", +("win-size", "800 600", PRC_DESC("This is the default size at which to open a new window. This " "replaces the deprecated win-width and win-height variables.")); From 7097ea4a0ebcf5fcab419b564650079f80db9cd6 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 30 Mar 2015 17:58:04 +0200 Subject: [PATCH 07/73] OSX build tweaks and fixes (always use Python framework for SDK) --- makepanda/makepanda.py | 9 ++++----- makepanda/makepandacore.py | 4 ++-- pandatool/src/mayaprogs/mayapath.cxx | 2 ++ 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 9d8aa0cab6..a58d9f7079 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -778,8 +778,7 @@ if (COMPILER=="GCC"): SmartPkgEnable("ROCKET", "", rocket_libs, "Rocket/Core.h") if not PkgSkip("PYTHON"): - if GetTarget() == "darwin" and SDK.get("MACOSX") and not RTDIST: - # When targeting a specific OSX version, use the system Python framework in the standard Mac SDK. + if GetTarget() == "darwin" and not RTDIST and not PkgHasCustomLocation("PYTHON"): LibName("PYTHON", "-framework Python") else: SmartPkgEnable("PYTHON", "", SDK["PYTHONVERSION"], (SDK["PYTHONVERSION"], SDK["PYTHONVERSION"] + "/Python.h"), tool = SDK["PYTHONVERSION"] + "-config") @@ -6741,7 +6740,7 @@ def MakeInstallerOSX(): dist = open("dstroot/Panda3D/Panda3D.mpkg/Contents/distribution.dist", "w") dist.write('\n') dist.write('\n') - dist.write(' Panda3D\n') + dist.write(' Panda3D SDK %s\n' % (VERSION)) dist.write(' \n') dist.write(' %s\n' % ReadFile("doc/LICENSE")) dist.write(' \n') @@ -6780,8 +6779,8 @@ def MakeInstallerOSX(): dist.write('\n') dist.close() - oscmd('hdiutil create Panda3D-rw.dmg -srcfolder dstroot/Panda3D') - oscmd('hdiutil convert Panda3D-rw.dmg -format UDBZ -o Panda3D-%s.dmg' % VERSION) + oscmd('hdiutil create Panda3D-rw.dmg -volname "Panda3D SDK %s" -srcfolder dstroot/Panda3D' % (VERSION)) + oscmd('hdiutil convert Panda3D-rw.dmg -format UDBZ -o Panda3D-%s.dmg' % (VERSION)) oscmd('rm -f Panda3D-rw.dmg') def MakeInstallerFreeBSD(): diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index a4b9b406d8..899434d677 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -1897,8 +1897,8 @@ def SdkLocatePython(prefer_thirdparty_python=False): SDK["PYTHONEXEC"] = tp_python + "/bin/" + SDK["PYTHONVERSION"] SDK["PYTHON"] = tp_python + "/include/" + SDK["PYTHONVERSION"] - elif GetTarget() == 'darwin' and SDK.get("MACOSX"): - # When targeting a specific Mac OS X version, use the system Python framework. + elif GetTarget() == 'darwin': + # On Mac OS X, use the system Python framework. py_fwx = SDK.get("MACOSX", "") + "/System/Library/Frameworks/Python.framework/Versions/Current" if not os.path.islink(py_fwx): diff --git a/pandatool/src/mayaprogs/mayapath.cxx b/pandatool/src/mayaprogs/mayapath.cxx index 3548668578..5a89e20361 100755 --- a/pandatool/src/mayaprogs/mayapath.cxx +++ b/pandatool/src/mayaprogs/mayapath.cxx @@ -46,6 +46,8 @@ #if defined(_WIN32) #define WIN32_LEAN_AND_MEAN #include +#else +#include #endif #define QUOTESTR(x) #x From 10796fe33e7f3d1cdb4c3ec100461e3800ef44f9 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 30 Mar 2015 17:58:35 +0200 Subject: [PATCH 08/73] Fix unlockFocus error in release builds --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index 84a5d9149a..bcc859f1a8 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -182,7 +182,7 @@ begin_frame(FrameMode mode, Thread *current_thread) { // Lock the view for drawing. if (!_properties.get_fullscreen()) { - nassertr([_view lockFocusIfCanDraw], false); + nassertr_always([_view lockFocusIfCanDraw], false); } // Make the context current. From 95c403e6366cb7f137a15438a2ae9359ba374d05 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 12:51:05 +0200 Subject: [PATCH 09/73] Remove unused lru implementation --- panda/src/display/Sources.pp | 3 - panda/src/display/lru.cxx | 1229 ------------------- panda/src/display/lru.h | 269 ---- panda/src/display/p3display_composite2.cxx | 1 - panda/src/dxgsg9/dxGraphicsStateGuardian9.h | 2 - panda/src/dxgsg9/dxTextureContext9.h | 2 - 6 files changed, 1506 deletions(-) delete mode 100644 panda/src/display/lru.cxx delete mode 100644 panda/src/display/lru.h diff --git a/panda/src/display/Sources.pp b/panda/src/display/Sources.pp index 26aa3b5187..2edfb51d86 100644 --- a/panda/src/display/Sources.pp +++ b/panda/src/display/Sources.pp @@ -37,7 +37,6 @@ graphicsWindowInputDevice.h \ graphicsWindowProc.h \ graphicsWindowProcCallbackData.I graphicsWindowProcCallbackData.h \ - lru.h \ nativeWindowHandle.I nativeWindowHandle.h \ parasiteBuffer.I parasiteBuffer.h \ pStatGPUTimer.I pStatGPUTimer.h \ @@ -74,7 +73,6 @@ graphicsWindowProc.cxx \ graphicsWindowProcCallbackData.cxx \ graphicsDevice.cxx \ - lru.cxx \ nativeWindowHandle.cxx \ parasiteBuffer.cxx \ windowHandle.cxx \ @@ -109,7 +107,6 @@ graphicsThreadingModel.I graphicsThreadingModel.h \ graphicsWindowInputDevice.I graphicsWindowInputDevice.h \ graphicsDevice.I graphicsDevice.h \ - lru.h \ nativeWindowHandle.I nativeWindowHandle.h \ parasiteBuffer.I parasiteBuffer.h \ pStatGPUTimer.I pStatGPUTimer.h \ diff --git a/panda/src/display/lru.cxx b/panda/src/display/lru.cxx deleted file mode 100644 index b93fb500b0..0000000000 --- a/panda/src/display/lru.cxx +++ /dev/null @@ -1,1229 +0,0 @@ -// Filename: lru.cxx -// Created by: aignacio (12Dec05) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -//#include "stdafx.h" - -#define LRU_UNIT_TEST 0 - -#include -#include -//#include - -#include "lru.h" -#if ENABLE_MUTEX -#include "mutexHolder.h" -#endif - - -static const int HIGH_PRIORITY_SCALE = 4; -static const int LOW_PRIORITY_RANGE = 25; - -//////////////////////////////////////////////////////////////////// -// Function: Lru::Constructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -Lru::Lru (int maximum_memory, int maximum_pages, int maximum_page_types) -{ - if(this) { - int index; - - memset(&this->_m, 0, sizeof (LruVariables)); - - this->_m.maximum_memory = maximum_memory; - this->_m.maximum_pages = maximum_pages; - this->_m.maximum_page_types = maximum_page_types; - this->_m.available_memory = maximum_memory; - this->_m.current_frame_identifier = 1; - this->_m.weight = 0.20f; - - this->set_maximum_frame_bandwidth_utilization(2000000.0f); - - for(index = 0; index < MAXIMUM_LRU_PAGE_TYPES; index++) { - this->_m.page_in_function_array[index] = default_page_in_function; - this->_m.page_out_function_array[index] = default_page_out_function; - } - - if(maximum_pages > 0) { - this -> _m.lru_page_pool = new LruPage * [maximum_pages]; - this -> _m.lru_page_free_pool = new LruPage * [maximum_pages]; - for(index = 0; index < maximum_pages; index++) { - LruPage * lru_page; - - lru_page = new LruPage ( ); - if(lru_page) { - lru_page->_m.v.pre_allocated = true; - this->_m.lru_page_pool[index] = lru_page; - } - else { -// ERROR - } - } - } - - if(maximum_page_types > 0) { - this -> _m.page_type_statistics_array = - new PageTypeStatistics [maximum_page_types]; - } - -#if ENABLE_MUTEX - this -> _m.mutex = new Mutex ("lru"); -#endif - - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::Destructor -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -Lru::~Lru ( ) -{ - int index; - LruPage * lru_page; - - // free pre-allocated LruPages - if(this->_m.maximum_pages > 0) { - if(this->_m.lru_page_free_pool) { - for(index = 0; index < this->_m.maximum_pages; index++) { - lru_page = this->_m.lru_page_pool[index]; - if(lru_page->_m.v.in_lru) { - this->remove_page(lru_page); - } - - delete lru_page; - } - - delete this -> _m.lru_page_free_pool; - } - if(this->_m.lru_page_pool) { - delete this -> _m.lru_page_pool; - } - } - - // free dynamically allocated LruPages - for(index = 0; index < LPP_TotalPriorities; index++) { - LruPage * next_lru_page; - - lru_page = this->_m.lru_page_array[index]; - while(lru_page) { - next_lru_page = lru_page->_m.next; - - delete lru_page; - - lru_page = next_lru_page; - } - } - - if(this->_m.page_type_statistics_array) { - delete this -> _m.page_type_statistics_array; - } - -#if ENABLE_MUTEX - if(this->_m.mutex) { - delete this -> _m.mutex; - } -#endif - -} - -//////////////////////////////////////////////////////////////////// -// Function: LruPage::Constructor -// Access: Protected -// Description: Internal function only. -// Call Lru::allocate_page instead. -//////////////////////////////////////////////////////////////////// -LruPage::LruPage ( ) -{ - if(this) { - memset(&this->_m, 0, sizeof (LruPageVariables)); - _m.name = ""; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: LruPage::Destructor -// Access: Protected -// Description: Internal function only. -// Call Lru::free_page instead. -//////////////////////////////////////////////////////////////////// -LruPage::~LruPage ( ) -{ - -} - -//////////////////////////////////////////////////////////////////// -// Function: LruPage::change_priority -// Access: Protected -// Description: -//////////////////////////////////////////////////////////////////// -void LruPage::change_priority (int delta) -{ - this->_m.priority_change += delta; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::register_lru_page_type -// Access: Public -// Description: Registers a specific type of page and its -// required page in and out functions. -//////////////////////////////////////////////////////////////////// -bool Lru::register_lru_page_type (int index, - LruPageTypeFunction page_in_function, - LruPageTypeFunction page_out_function) -{ - bool state; - - state = false; - if(index >= 0 && index < MAXIMUM_LRU_PAGE_TYPES) { - this->_m.page_in_function_array[index] = page_in_function; - this->_m.page_out_function_array[index] = page_out_function; - state = true; - } - - return state; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::allocate_page -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -LruPage *Lru::allocate_page (int size) -{ - LruPage * lru_page; - - lru_page = 0; - if(size <= this->_m.maximum_memory) { - if(this->_m.maximum_pages) { - if(this->_m.total_lru_pages_in_free_pool > 0) { - lru_page = - this->_m.lru_page_free_pool [this->_m.total_lru_pages_in_free_pool - 1]; - this->_m.total_lru_pages_in_free_pool--; - - memset (&lru_page -> _m, 0, sizeof (LruPage::LruPageVariables)); - lru_page->_m.v.pre_allocated = true; - } - else { - if(this->_m.total_lru_pages_in_pool < this->_m.maximum_pages) { - lru_page = this->_m.lru_page_pool[this->_m.total_lru_pages_in_pool]; - this->_m.total_lru_pages_in_pool++; - } - else { - // out of pre-allocated LruPages so dynamically allocate a page - lru_page = new LruPage ( ); - } - } - } - else { - lru_page = new LruPage; - } - if(lru_page) { - lru_page->_m.lru = this; - lru_page->_m.size = size; - lru_page->_m.first_frame_identifier = this->_m.current_frame_identifier; - lru_page->_m.last_frame_identifier = this->_m.current_frame_identifier; - - lru_page->_m.v.allocated = true; - lru_page->_m.identifier = this->_m.identifier; - - lru_page->_m.average_frame_utilization = 1.0f; - - this->_m.total_pages++; - this->_m.identifier++; - } - else { - -// ERROR: could not allocate LruPage - - } - } - else { - -// ERROR: requested page size is larger than maximum memory size - - } - - return lru_page; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::update_start_update_lru_page -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void Lru::update_start_update_lru_page (LruPage *lru_page) -{ - if(lru_page) { - if(this->_m.start_update_lru_page == lru_page) { - if(lru_page->_m.next) { - this->_m.start_update_lru_page = lru_page->_m.next; - } - else { - if((this->_m.start_priority_index + 1) >= LPP_TotalPriorities) { - this->_m.start_priority_index = 0; - } - else { - this->_m.start_priority_index = this->_m.start_priority_index + 1; - } - - this->_m.start_update_lru_page = 0; - } - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::free_page -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void Lru::free_page (LruPage *lru_page) -{ - if(this->_m.total_pages > 0) { - if(lru_page) { - LruMutexHolder(this->_m.mutex); - - this->update_start_update_lru_page(lru_page); - - if(lru_page->_m.v.in_cache) { - this->_m.available_memory += lru_page->_m.size; - } - - if(lru_page->_m.v.pre_allocated) { - if(this->_m.maximum_pages) { - lru_page->_m.v.allocated = false; - this->_m.lru_page_free_pool [this->_m.total_lru_pages_in_free_pool] = - lru_page; - this->_m.total_lru_pages_in_free_pool++; - } - else { -// ERROR: this case should not happen - } - } - else { - delete lru_page; - } - - this->_m.total_pages--; - } - } - else { - -// ERROR: tried to free a page when 0 pages allocated - - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::add_page -// Access: Public -// Description: Adds a page to the LRU based on the given priority. -//////////////////////////////////////////////////////////////////// -void Lru::add_page (LruPagePriority priority, LruPage *lru_page) -{ - if(lru_page) { - LruMutexHolder(this->_m.mutex); - - LruPage * first_lru_page; - - lru_page->_m.priority = priority; - - first_lru_page = this->_m.lru_page_array[lru_page->_m.priority]; - if(first_lru_page) { - first_lru_page->_m.previous = lru_page; - lru_page->_m.next = first_lru_page; - } - - this->_m.lru_page_array[lru_page->_m.priority] = lru_page; - - lru_page->_m.v.in_lru = true; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::add_cached_page -// Access: Public -// Description: Adds a page that is already paged in to the LRU -// based on the given priority. -//////////////////////////////////////////////////////////////////// -void Lru::add_cached_page (LruPagePriority priority, LruPage *lru_page) -{ - if(lru_page) { - LruMutexHolder(this->_m.mutex); - - lru_page->_m.v.in_cache = true; - - if(lru_page->_m.size > this->_m.available_memory) { - int memory_required; - - memory_required = lru_page->_m.size - this->_m.available_memory; - - // unload page(s) - this->page_out_lru(memory_required); - } - - this->_m.available_memory -= lru_page->_m.size; - - this->add_page(priority, lru_page); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::remove_page -// Access: Public -// Description: Removes a page from the LRU. -//////////////////////////////////////////////////////////////////// -void Lru::remove_page (LruPage *lru_page) -{ - if(this) { - if(this->_m.total_pages > 0) { - if(lru_page) { - LruMutexHolder(this->_m.mutex); - - this->update_start_update_lru_page(lru_page); - - if(lru_page->_m.previous) { - lru_page->_m.previous->_m.next = lru_page->_m.next; - if(lru_page->_m.next) { - lru_page->_m.next->_m.previous = lru_page->_m.previous; - } - } - else { - this->_m.lru_page_array[lru_page->_m.priority] = - lru_page->_m.next; - if(lru_page->_m.next) { - lru_page->_m.next->_m.previous = 0; - } - } - - lru_page->_m.next = 0; - lru_page->_m.previous = 0; - - lru_page->_m.v.in_lru = false; - } - } - else { - -// ERROR: tried to remove a page when 0 pages are allocated - - } - } - else { - -// ERROR: Lru == 0, this should not happen - - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::lock_page -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void Lru::lock_page (LruPage *lru_page) -{ - lru_page->_m.v.lock = true; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::unlock_page -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void Lru::unlock_page (LruPage *lru_page) -{ - lru_page->_m.v.lock = false; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::access_page -// Access: Public -// Description: This must always be called before accessing or -// using a page's memory since it pages in the page -// if it is currently paged out. -//////////////////////////////////////////////////////////////////// -void Lru::access_page (LruPage *lru_page) -{ - if(lru_page) { - if(lru_page->_m.current_frame_identifier - == this->_m.current_frame_identifier) { - lru_page->_m.current_frame_usage++; - this->_m.total_page_all_access_size += lru_page->_m.size; - } - else { - // first update this frame - lru_page->_m.last_frame_identifier = lru_page->_m.current_frame_identifier; - lru_page->_m.current_frame_identifier = this->_m.current_frame_identifier; - lru_page->_m.last_frame_usage = lru_page->_m.current_frame_usage; - lru_page->_m.current_frame_usage = 1; - lru_page->_m.total_frame_page_faults = 0; - - this->_m.total_page_access_size += lru_page->_m.size; - } - - // check if the page is out - if(lru_page->_m.v.in_cache == false) { - bool state; - - state = true; - - LruMutexHolder(this->_m.mutex); - - // check memory usage - if(lru_page->_m.size > this->_m.available_memory) { - int memory_required; - - memory_required = lru_page->_m.size - this->_m.available_memory; - - // unload page(s) - state = this->page_out_lru(memory_required); - } - - // load the page in - if(state) { - // PAGE IN CALLBACK - if(this->_m.page_in_function_array[lru_page->_m.v.type](lru_page)) { - this->_m.available_memory -= lru_page->_m.size; - lru_page->_m.v.in_cache = true; - - // CHANGE THE PAGE PRIORITY FROM LPP_PageOut TO LPP_New - this->remove_page(lru_page); - this->add_page(LPP_New, lru_page); - - this->_m.total_lifetime_page_ins++; - } - } - - lru_page->_m.total_frame_page_faults++; - lru_page->_m.total_page_faults++; - } - - lru_page->_m.total_usage++; - lru_page->_m.update_total_usage++; - - this->_m.total_page_access++; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::set_maximum_frame_bandwidth_utilization -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void Lru::set_maximum_frame_bandwidth_utilization - (PN_stdfloat maximum_frame_bandwidth_utilization) -{ - this->_m.maximum_frame_bandwidth_utilization = - maximum_frame_bandwidth_utilization; - - this->_m.frame_bandwidth_factor = (PN_stdfloat) LPP_TotalPriorities - / this->_m.maximum_frame_bandwidth_utilization; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::begin_frame -// Access: Public -// Description: This must be called before each frame. -//////////////////////////////////////////////////////////////////// -void Lru::begin_frame ( ) -{ - this->_m.current_frame_identifier++; - - this->_m.total_page_ins_last_frame = this->_m.total_page_ins; - this->_m.total_page_outs = this->_m.total_page_outs; - - this->_m.total_page_ins = 0; - this->_m.total_page_outs = 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::update_page_priorities -// Access: Public -// Description: This updates the priority of a page that has a -// change in priority. -//////////////////////////////////////////////////////////////////// -void Lru::update_page_priorities (void) -{ - int index; - LruPage *lru_page; - - for(index = 0; index < this->_m.total_lru_page_priority_changes; index++) { - int priority; - - lru_page = this->_m.lru_page_priority_change_array[index]; - - this->remove_page(lru_page); - - priority = (( int ) lru_page->_m.priority + lru_page->_m.priority_change); - if(priority < 0) { - priority = 0; - } - if(priority >= LPP_TotalPriorities) { - priority = LPP_TotalPriorities - 1; - } - - this->add_page((LruPagePriority) priority, lru_page); - lru_page->_m.priority_change = 0; - } - this->_m.total_lru_page_priority_changes = 0; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::update_lru_page -// Access: Public -// Description: This updates the page's average utilization. -// Priority LPP_New is considered to be average usage -// of 1.0 (which means the page is used once per frame -// on average). Priorities < LPP_New are for pages -// used more than once per frame and Priorities > -// LPP_New are for pages used less than once per frame. -// If there was a change in priority, then adds it to -// the array of lru pages with changed priorities -// which will be updated later. -//////////////////////////////////////////////////////////////////// -void Lru::update_lru_page (LruPage *lru_page) -{ - -#if LRU_UNIT_TEST - if(false) { - char string[256]; - - sprintf(string, " UPDATE %d\n", lru_page->_m.identifier); - OutputDebugString(string); - } -#endif - - if(lru_page->_m.v.lock == false && lru_page->_m.v.in_cache) { - int delta_priority; - int lifetime_frames; - - delta_priority = 0; - - lifetime_frames = this->_m.current_frame_identifier - - lru_page->_m.first_frame_identifier; - if(lifetime_frames >= 1) { - if(lru_page->_m.update_frame_identifier) { - int target_priority; - int integer_update_frames; - PN_stdfloat update_frames; - PN_stdfloat one_over_update_frames; - PN_stdfloat update_average_frame_utilization; - - integer_update_frames = (this->_m.current_frame_identifier - - lru_page->_m.update_frame_identifier); - if(integer_update_frames > 0) { - update_frames = ( PN_stdfloat ) integer_update_frames; - one_over_update_frames = 1.0f / update_frames; - - update_average_frame_utilization = - (PN_stdfloat) (lru_page->_m.update_total_usage)* one_over_update_frames; - - lru_page->_m.average_frame_utilization = - calculate_exponential_moving_average( - update_average_frame_utilization, this->_m.weight, - lru_page->_m.average_frame_utilization); - - target_priority = lru_page->_m.priority; - if(lru_page->_m.average_frame_utilization >= 1.0f) { - int integer_average_frame_utilization; - - integer_average_frame_utilization = - (int) ((lru_page->_m.average_frame_utilization - 1.0f) * - (PN_stdfloat) HIGH_PRIORITY_SCALE); - if(integer_average_frame_utilization >= LPP_New) { - integer_average_frame_utilization = LPP_New; - } - integer_average_frame_utilization = LPP_New - - integer_average_frame_utilization; - target_priority = integer_average_frame_utilization; - } - else { - int integer_average_frame_utilization; - - integer_average_frame_utilization = (int) - (lru_page->_m.average_frame_utilization * - (PN_stdfloat) LOW_PRIORITY_RANGE); - integer_average_frame_utilization = LOW_PRIORITY_RANGE - - integer_average_frame_utilization; - target_priority = LPP_New + integer_average_frame_utilization; - } - - delta_priority = target_priority - lru_page->_m.priority; - lru_page->change_priority(delta_priority); - } - } - - lru_page->_m.update_frame_identifier = this->_m.current_frame_identifier; - lru_page->_m.update_total_usage = 0; - } - - if(lru_page->_m.priority_change) { - if(this->_m.total_lru_page_priority_changes - < FRAME_MAXIMUM_PRIORITY_CHANGES) - { - this->_m.lru_page_priority_change_array - [this->_m.total_lru_page_priority_changes] = lru_page; - this->_m.total_lru_page_priority_changes++; - } - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::update_lru_page_old -// Access: Public -// Description: This updates the page's average utilization and -// adds it to the array of pages with changed -// priorities if there was a change in priority. -// Old method. -//////////////////////////////////////////////////////////////////// -void Lru::update_lru_page_old (LruPage *lru_page) -{ -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::update_entire_lru -// Access: Public -// Description: This updates all the pages in the Lru. -// Lru::partial_lru_update should be called instead -// due to performance reasons. -//////////////////////////////////////////////////////////////////// -void Lru::update_entire_lru ( ) -{ - if(this->_m.total_pages > 0) { - int index; - LruPage *lru_page; - - LruMutexHolder(this->_m.mutex); - - for(index = 0; index < LPP_TotalPriorities; index++) { - - LruPage * next_lru_page; - - lru_page = this->_m.lru_page_array[index]; - while(lru_page) { - next_lru_page = lru_page->_m.next; - - this->update_lru_page(lru_page); - - lru_page = next_lru_page; - } - } - - this->update_page_priorities( ); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::partial_lru_update -// Access: Public -// Description: This only updates a number of pages up to the -// specified maximum_updates. -//////////////////////////////////////////////////////////////////// -void Lru::partial_lru_update (int maximum_updates) -{ - int total_page_updates; - - if (maximum_updates <= 0) { - // enforce a minimum number of updates - maximum_updates = 1; - } - - total_page_updates = 0; - if(this->_m.total_pages > 0) { - int index; - int start_priority; - LruPage *lru_page; - - LruMutexHolder(this->_m.mutex); - - start_priority = this->_m.start_priority_index; - - { - for(index = start_priority; index < LPP_TotalPriorities; index++) { - - LruPage *next_lru_page; - - if(index == start_priority) { - if(this->_m.start_update_lru_page) { - lru_page = this->_m.start_update_lru_page; - } - else { - lru_page = this->_m.lru_page_array[index]; - } - } - else { - lru_page = this->_m.lru_page_array[index]; - } - while(lru_page) { - next_lru_page = lru_page->_m.next; - - this->update_lru_page(lru_page); - - total_page_updates++; - if(total_page_updates >= maximum_updates) { - if(next_lru_page) { - this->_m.start_priority_index = index; - this->_m.start_update_lru_page = next_lru_page; - } - else { - if((index + 1) >= LPP_TotalPriorities) { - this->_m.start_priority_index = 0; - } - else { - this->_m.start_priority_index = index + 1; - } - - this->_m.start_update_lru_page = 0; - } - - break; - } - - lru_page = next_lru_page; - } - - if(total_page_updates >= maximum_updates) { - break; - } - } - } - - if(total_page_updates < maximum_updates) { - for(index = 0; index <= start_priority; index++) { - LruPage *next_lru_page; - - lru_page = this->_m.lru_page_array[index]; - while(lru_page) { - next_lru_page = lru_page->_m.next; - - this->update_lru_page(lru_page); - - total_page_updates++; - if(total_page_updates >= maximum_updates) { - if(next_lru_page) { - this->_m.start_priority_index = index; - this->_m.start_update_lru_page = next_lru_page; - } - else { - if((index + 1) >= LPP_TotalPriorities) { - this->_m.start_priority_index = 0; - } - else { - this->_m.start_priority_index = index + 1; - } - - this->_m.start_update_lru_page = 0; - } - - break; - } - - lru_page = next_lru_page; - } - - if(total_page_updates >= maximum_updates) { - break; - } - } - } - - if(total_page_updates < maximum_updates) { - this->_m.start_priority_index = 0; - this->_m.start_update_lru_page = 0; - } - - this->update_page_priorities( ); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::unlock_all_pages -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -void Lru::unlock_all_pages (void) -{ - if(this->_m.total_pages > 0) { - int index; - - for(index = 0; index < LPP_TotalPriorities; index++) { - LruPage *lru_page; - LruPage *next_lru_page; - - lru_page = this->_m.lru_page_array[index]; - while(lru_page) { - next_lru_page = lru_page->_m.next; - - lru_page->_m.v.lock = false; - - lru_page = next_lru_page; - } - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::page_out_lru -// Access: Public -// Description: Pages out the lowest priority pages until the -// memory_required is satisfied. This will unlock -// all pages if needed. -//////////////////////////////////////////////////////////////////// -bool Lru::page_out_lru (int memory_required) -{ - bool state; - int attempts; - - state = false; - attempts = 0; - if(this->_m.total_pages > 0) { - LruMutexHolder(this->_m.mutex); - - do { - int index; - int minimum_frame_identifier; - - minimum_frame_identifier = this->_m.current_frame_identifier - 1; - - // page out lower priority pages first - for(index = LPP_PageOut - 1; index >= 0; index--) { - LruPage *lru_page; - LruPage *next_lru_page; - - lru_page = this->_m.lru_page_array[index]; - while(lru_page) { - next_lru_page = lru_page->_m.next; - - if(attempts == 0 && (lru_page->_m.current_frame_identifier >= minimum_frame_identifier)) { - // avoid swapping out pages used in the current and last frame on the first attempt - } - else { - if(lru_page->_m.v.lock == false && lru_page->_m.v.in_cache) { - memory_required -= lru_page->_m.size; - this->_m.available_memory += lru_page->_m.size; - lru_page->_m.v.in_cache = false; - - // PAGE OUT CALLBACK - this->_m.page_out_function_array[lru_page->_m.v.type](lru_page); - this->_m.total_lifetime_page_outs++; - - // MOVE THE PAGE TO THE LPP_PageOut PRIORITY - this->remove_page(lru_page); - this->add_page(LPP_PageOut, lru_page); - - if(memory_required <= 0) { - break; - } - } - } - - lru_page = next_lru_page; - } - - if(memory_required <= 0) { - break; - } - } - - if(memory_required > 0) { - state = false; - } - else { - state = true; - } - - attempts++; - } while(state == false && attempts < 2); - } - - return state; -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::count_priority_level_pages -// Access: Public -// Description: Debug function. Counts the number of pages for each -// priority level. -//////////////////////////////////////////////////////////////////// -void Lru::count_priority_level_pages (void) -{ - int index; - - LruMutexHolder(this->_m.mutex); - - for(index = 0; index < LPP_TotalPriorities; index++) { - int total_pages; - LruPage *lru_page; - LruPage *next_lru_page; - - total_pages = 0; - lru_page = this->_m.lru_page_array[index]; - while(lru_page) { - next_lru_page = lru_page->_m.next; - - total_pages++; - - lru_page = next_lru_page; - } - - this->_m.lru_page_count_array[index] = total_pages; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: Lru::calculate_lru_statistics -// Access: Public -// Description: Debug function. -//////////////////////////////////////////////////////////////////// -void Lru::calculate_lru_statistics (void) -{ - LruMutexHolder(this->_m.mutex); - - if(this->_m.maximum_page_types > 0) { - int index; - - memset(this->_m.page_type_statistics_array, 0, - sizeof (PageTypeStatistics) * this->_m.maximum_page_types); - for(index = 0; index < LPP_TotalPriorities; index++) { - LruPage *lru_page; - LruPage *next_lru_page; - PageTypeStatistics *page_type_statistics; - - lru_page = this->_m.lru_page_array[index]; - while(lru_page) { - int type; - - next_lru_page = lru_page->_m.next; - - type = lru_page->_m.v.type; - page_type_statistics = &this->_m.page_type_statistics_array[type]; - page_type_statistics->total_pages++; - - if(lru_page->_m.v.in_cache) { - page_type_statistics->total_pages_in++; - page_type_statistics->total_memory_in += lru_page->_m.size; - } - else { - page_type_statistics->total_pages_out++; - page_type_statistics->total_memory_out += lru_page->_m.size; - } - - lru_page = next_lru_page; - } - } - } -} - -//////////////////////////////////////////////////////////////////// -// Function: calculate_exponential_moving_average -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -PN_stdfloat calculate_exponential_moving_average(PN_stdfloat value, - PN_stdfloat weight, PN_stdfloat average) -{ - return ((value - average) * weight) + average; -} - -//////////////////////////////////////////////////////////////////// -// Function: default_page_in_function -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -bool default_page_in_function(LruPage *lru_page) -{ - -#if LRU_UNIT_TEST - char string[256]; - - sprintf(string, " PAGE IN %d\n", lru_page->_m.identifier); - OutputDebugString(string); -#endif - - return true; -} - -//////////////////////////////////////////////////////////////////// -// Function: default_page_out_function -// Access: Public -// Description: -//////////////////////////////////////////////////////////////////// -bool default_page_out_function(LruPage *lru_page) -{ - -#if LRU_UNIT_TEST - char string[256]; - - sprintf(string, " PAGE OUT %d\n", lru_page->_m.identifier); - OutputDebugString(string); -#endif - - return true; -} - -#if LRU_UNIT_TEST - -//////////////////////////////////////////////////////////////////// -// Function: test_ema -// Access: -// Description: Unit test function for ema. -//////////////////////////////////////////////////////////////////// -void test_ema(void) -{ - int index; - PN_stdfloat usage; - PN_stdfloat weight; - PN_stdfloat average; - - weight = 0.2; - average = 1.0f; - for(index = 0; index < 50; index++) { - if(index < 25) { - usage = (PN_stdfloat) (index & 0x01); - } - else { - usage = 0.0f; - } - average = - calculate_exponential_moving_average(usage, weight, average); - - char string[256]; - sprintf(string, "%d %f\n", index, average); - OutputDebugString(string); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: test_lru -// Access: -// Description: Unit test function for Lru. -//////////////////////////////////////////////////////////////////// -void test_lru(void) -{ - int maximum_memory; - int maximum_pages; - int maximum_page_types; - Lru *lru; - - test_ema( ); - - maximum_memory = 3000000; - maximum_pages = 3; - maximum_page_types = 4; - lru = new Lru (maximum_memory, maximum_pages, maximum_page_types); - if(lru) { - lru->_m.minimum_memory = 1000000; - - LruPage *lru_page_0; - LruPage *lru_page_1; - LruPage *lru_page_2; - LruPage *lru_page_3; - LruPage *lru_page_4; - LruPage *lru_page_5; - - lru_page_0 = lru->allocate_page(1000000); - if(lru_page_0) { - lru->add_page(LPP_PageOut, lru_page_0); - } - - lru_page_1 = lru->allocate_page(1000000); - if(lru_page_1) { - lru->add_page(LPP_PageOut, lru_page_1); - } - - lru_page_2 = lru->allocate_page(1000000); - if(lru_page_2) { - lru->add_page(LPP_PageOut, lru_page_2); - } - - lru_page_3 = lru->allocate_page(1000000); - if(lru_page_3) { - lru->add_page(LPP_PageOut, lru_page_3); - } - - lru_page_4 = lru->allocate_page(1000000); - if(lru_page_4) { - lru->add_page(LPP_PageOut, lru_page_4); - } - - lru_page_5 = lru->allocate_page(1000000); - if(lru_page_5) { - lru->add_page(LPP_PageOut, lru_page_5); - } - - int index; - int total_frames; - - total_frames = 300; - for(index = 0; index < total_frames; index++) { - char string[256]; - - sprintf(string, "FRAME %d\n", index); - OutputDebugString(string); - - lru->begin_frame( ); - - if(index <= 5) { - lru->access_page(lru_page_0); - } - - lru->access_page(lru_page_1); - lru->access_page(lru_page_1); - - if(index & 0x01) { - lru->access_page(lru_page_2); - } - - if((index % 10) == 0) { - lru->access_page(lru_page_3); - } - - if(index >= 100) { - lru->access_page(lru_page_4); - } - - if(index >= 200) { - lru->access_page(lru_page_5); - } - - if(false) { - lru->update_entire_lru( ); - } - else { - int maximum_updates; - - maximum_updates = 3; - lru->partial_lru_update(maximum_updates); - } - } - - if(!true) { - lru->remove_page(lru_page_2); - lru->free_page(lru_page_2); - - lru->remove_page(lru_page_3); - lru->free_page(lru_page_3); - - lru->remove_page(lru_page_1); - lru->free_page(lru_page_1); - } - - delete lru; - } -} - -#endif diff --git a/panda/src/display/lru.h b/panda/src/display/lru.h deleted file mode 100644 index 45c8f8c2c2..0000000000 --- a/panda/src/display/lru.h +++ /dev/null @@ -1,269 +0,0 @@ -// Filename: lru.h -// Created by: aignacio (12Dec05) -// -//////////////////////////////////////////////////////////////////// -// -// PANDA 3D SOFTWARE -// Copyright (c) Carnegie Mellon University. All rights reserved. -// -// All use of this software is subject to the terms of the revised BSD -// license. You should have received a copy of this license along -// with this source code in a file named "LICENSE." -// -//////////////////////////////////////////////////////////////////// - -#ifndef LRU_H -#define LRU_H - -#define ENABLE_MUTEX 1 - -#if ENABLE_MUTEX -#include "lightMutex.h" -#include "lightMutexHolder.h" -#define LruMutexHolder(mutex) MutexHolder(mutex) -#else -#define LruMutexHolder(mutex) -#endif - - -static const int MAXIMUM_LRU_PAGE_TYPES = 8; -static const int FRAME_MAXIMUM_PRIORITY_CHANGES = 256; - - -class Lru; -class LruPage; - -enum LruPagePriority -{ - LPP_Highest = 0, - LPP_High = 10, - LPP_New = 20, - LPP_Normal = 25, - LPP_Intermediate = 30, - LPP_Low = 40, - LPP_TotalPriorities = 50, - - LPP_PageOut = LPP_TotalPriorities - 1 -}; - -typedef union _LruPageType -{ - void *pointer; - -} -LruPageType; - -typedef struct -{ - int total_pages; - int total_pages_in; - int total_pages_out; - int total_memory_in; - int total_memory_out; -} -PageTypeStatistics; - -typedef bool (*LruPageTypeFunction) (LruPage *lru_page); - -class EXPCL_PANDA_DISPLAY LruPage -{ - -protected: - - LruPage ( ); - ~LruPage ( ); - void change_priority (int delta); - -public: - - typedef struct _LruPageVariables - { - LruPageType lru_page_type; // pointer to memory type - - int size; - LruPagePriority priority; - int priority_change; - - struct - { - unsigned int type : 8; - unsigned int lock : 1; - unsigned int in_cache : 1; - unsigned int in_memory : 1; - unsigned int on_disk : 1; - unsigned int pre_allocated : 1; - unsigned int allocated : 1; - unsigned int in_lru : 1; - } v; - - int first_frame_identifier; // creation time - int last_frame_identifier; // previous time page was used - int current_frame_identifier; - int update_frame_identifier; - - int current_frame_usage; - int last_frame_usage; - - int total_frame_page_faults; - int total_page_faults; - - int total_usage; - int update_total_usage; - - int identifier; - - PN_stdfloat average_frame_utilization; - - LruPage *previous; - LruPage *next; - Lru *lru; - - string name; - } - LruPageVariables; - - LruPageVariables _m; - - friend class Lru; -}; - -//////////////////////////////////////////////////////////////////// -// Class : Lru -// Description : Least Recently Used algorithm implementation: -// In the Lru, each "memory page" has an associated class LruPage. -// The Lru has a range of priorities from LPP_Highest to -// LPP_PagedOut. Each priority has a doubly linked list of LruPages. -// The algorithim uses an adaptive method based on the average -// utilization of each page per frame (or time slice). The -// average utilization is calculated with an exponetial moving -// average. This is superior to a standard average since a standard -// average becomes less and less adaptive the longer a page exists. -// The average utilization is used to set the priority of each page. -// A higher average utilization automatically raises the priority -// of a page and a lower average utilization automatically lowers -// the priority of a page. Therefore, pages with a higher average -// utilization have a higher chance of being kept in memory or -// cached and pages with a lower average utilization have a higher -// chance of being paged out. When a page is paged in and there -// is not enough memory available, then the lowest priority pages -// will be paged out first until there is enough memory available. -//////////////////////////////////////////////////////////////////// -class EXPCL_PANDA_DISPLAY Lru -{ -public: - - Lru (int maximum_memory, int maximum_pages, int maximum_page_types); - ~Lru ( ); - - bool register_lru_page_type (int index, LruPageTypeFunction page_in_function, LruPageTypeFunction page_out_function); - - LruPage *allocate_page (int size); - void update_start_update_lru_page (LruPage *lru_page); - - void free_page (LruPage *lru_page); - - void add_page (LruPagePriority priority, LruPage *lru_page); - void add_cached_page (LruPagePriority priority, LruPage *lru_page); - void remove_page (LruPage *lru_page); - - void lock_page (LruPage *lru_page); - void unlock_page (LruPage *lru_page); - - void access_page (LruPage *lru_page); - - void set_maximum_frame_bandwidth_utilization (PN_stdfloat maximum_frame_bandwidth_utilization); - - void begin_frame ( ); - - void update_entire_lru ( ); - void partial_lru_update (int maximum_updates); - - // set maximum number of page updates per frame - // pause/resume updates/current_frame_identifier - - void unlock_all_pages (void); - - void count_priority_level_pages (void); - - void calculate_lru_statistics (void); - - bool page_out_lru (int memory_required); - -private: - void update_page_priorities (void); - void update_lru_page (LruPage *lru_page); - void update_lru_page_old (LruPage *lru_page); - -public: - typedef struct _LruVariables - { - // LruPagePriority lists - LruPage *lru_page_array [LPP_TotalPriorities]; - - int total_pages; - int available_memory; - int current_frame_identifier; - - int maximum_memory; - int minimum_memory; // target amount of memory to keep free if possible - int maximum_page_types; - - int total_lifetime_page_ins; - int total_lifetime_page_outs; - - int total_page_ins_last_frame; - int total_page_outs_last_frame; - - int total_page_ins; - int total_page_outs; - - int total_page_access; - double total_page_access_size; - double total_page_all_access_size; - - int start_priority_index; - LruPage *start_update_lru_page; - - int identifier; // the number of pages created during the lifetime of the LRU - - PN_stdfloat weight; // used for exponential moving average - PN_stdfloat maximum_frame_bandwidth_utilization; - - PN_stdfloat frame_bandwidth_factor; - - LruPageTypeFunction page_in_function_array [MAXIMUM_LRU_PAGE_TYPES]; - LruPageTypeFunction page_out_function_array [MAXIMUM_LRU_PAGE_TYPES]; - - int total_lru_page_priority_changes; - LruPage *lru_page_priority_change_array [FRAME_MAXIMUM_PRIORITY_CHANGES]; - - int maximum_pages; - int total_lru_pages_in_pool; - int total_lru_pages_in_free_pool; - LruPage **lru_page_pool; - LruPage **lru_page_free_pool; - - int lru_page_count_array [LPP_TotalPriorities]; - PageTypeStatistics *page_type_statistics_array; - - void *context; // user specified data - -#if ENABLE_MUTEX - Mutex *mutex; -#endif - } - LruVariables; - - LruVariables _m; - - friend class LruPage; -}; - -PN_stdfloat calculate_exponential_moving_average (PN_stdfloat value, PN_stdfloat weight, PN_stdfloat average); -bool default_page_in_function (LruPage *lru_page); -bool default_page_out_function (LruPage *lru_page); - -void test_ema (void); -void test_lru (void); - -#endif diff --git a/panda/src/display/p3display_composite2.cxx b/panda/src/display/p3display_composite2.cxx index 66abd308d0..b3ba58995b 100644 --- a/panda/src/display/p3display_composite2.cxx +++ b/panda/src/display/p3display_composite2.cxx @@ -5,7 +5,6 @@ #include "graphicsWindowProc.cxx" #include "graphicsWindowProcCallbackData.cxx" #include "graphicsWindowInputDevice.cxx" -#include "lru.cxx" #include "nativeWindowHandle.cxx" #include "parasiteBuffer.cxx" #include "standardMunger.cxx" diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.h b/panda/src/dxgsg9/dxGraphicsStateGuardian9.h index ac242d7ff2..6bc8af012d 100755 --- a/panda/src/dxgsg9/dxGraphicsStateGuardian9.h +++ b/panda/src/dxgsg9/dxGraphicsStateGuardian9.h @@ -32,8 +32,6 @@ #include "fog.h" #include "pointerToArray.h" -#include "lru.h" - #include "vertexElementArray.h" #include "dxShaderContext9.h" diff --git a/panda/src/dxgsg9/dxTextureContext9.h b/panda/src/dxgsg9/dxTextureContext9.h index 01a5838042..4fa7d4d5e7 100755 --- a/panda/src/dxgsg9/dxTextureContext9.h +++ b/panda/src/dxgsg9/dxTextureContext9.h @@ -19,8 +19,6 @@ #include "texture.h" #include "textureContext.h" -#include "lru.h" - //////////////////////////////////////////////////////////////////// // Class : DXTextureContext9 // Description : From 889da02c8caec863d01243adec0f89a01e99b7f0 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:02:35 +0200 Subject: [PATCH 10/73] FLTK needs X11 link --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index a58d9f7079..24480449a0 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -4908,7 +4908,7 @@ if (RTDIST or RUNTIME): TargetAdd('p3dcert.exe', input='plugin_mkdir_complete.obj') TargetAdd('p3dcert.exe', input='plugin_wstring_encode.obj') TargetAdd('p3dcert.exe', input='plugin_p3dCert.obj') - OPTS=['OPENSSL', 'FLTK', 'WINCOMCTL', 'WINSOCK', 'WINGDI', 'WINUSER', 'ADVAPI', 'WINOLE', 'WINSHELL', 'SUBSYSTEM:WINDOWS'] + OPTS=['OPENSSL', 'FLTK', 'X11', 'WINCOMCTL', 'WINSOCK', 'WINGDI', 'WINUSER', 'ADVAPI', 'WINOLE', 'WINSHELL', 'SUBSYSTEM:WINDOWS'] if GetTarget() == 'darwin': OPTS += ['OPT:2'] TargetAdd('p3dcert.exe', opts=OPTS) From 720fdba470eea5670e22af0a3d08b222d24d0d33 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:07:33 +0200 Subject: [PATCH 11/73] Re-expose LineStream to Python --- panda/src/express/config_express.N | 1 + panda/src/express/config_express.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/panda/src/express/config_express.N b/panda/src/express/config_express.N index 823d65541e..ad6e244b4e 100644 --- a/panda/src/express/config_express.N +++ b/panda/src/express/config_express.N @@ -21,6 +21,7 @@ forcetype OFileStream forcetype FileStream forcetype IDecryptStream forcetype OEncryptStream +forcetype LineStream forcetype ofstream forcetype ifstream diff --git a/panda/src/express/config_express.h b/panda/src/express/config_express.h index 06203eff08..863c0f60f5 100644 --- a/panda/src/express/config_express.h +++ b/panda/src/express/config_express.h @@ -25,8 +25,9 @@ #include "configVariableList.h" #include "configVariableFilename.h" -// Include this so interrogate can find it. +// Include these so interrogate can find them. #include "executionEnvironment.h" +#include "lineStream.h" #ifdef ANDROID #include From 840d81b3e1a00337e935304f1e3159d3647e13f7 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:08:36 +0200 Subject: [PATCH 12/73] Fix npapi plugin load issue I had on Chrome on Mac --- direct/src/plugin_npapi/startup.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/direct/src/plugin_npapi/startup.cxx b/direct/src/plugin_npapi/startup.cxx index 1d2a33b82b..a5bc20341a 100644 --- a/direct/src/plugin_npapi/startup.cxx +++ b/direct/src/plugin_npapi/startup.cxx @@ -233,7 +233,7 @@ NP_GetEntryPoints(NPPluginFuncs *pluginFuncs) { if (pluginFuncs->size == 0) { pluginFuncs->size = sizeof(*pluginFuncs); } - if (pluginFuncs->size < sizeof(*pluginFuncs)) { + if (pluginFuncs->size < offsetof(NPPluginFuncs, gotfocus)) { nout << "Invalid NPPPluginFuncs size\n"; return NPERR_INVALID_FUNCTABLE_ERROR; } From 0c6638b99c2d1ed21bd9c5932cd69b60f63ee00f Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:21:19 +0200 Subject: [PATCH 13/73] Maya 2012 and onward has no 32-bit build on Mac --- makepanda/makepanda.py | 37 +++++++++++++++++++++++-------------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 24480449a0..0f8aedad46 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1155,7 +1155,7 @@ def CompileCxx(obj,src,opts): cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET) for arch in OSX_ARCHS: - if arch != "ppc" or "NOPPC" not in OPTS: + if 'NOARCH:' + arch.upper() not in OPTS: cmd += " -arch %s" % arch if "SYSROOT" in SDK: @@ -1610,7 +1610,7 @@ def CompileLink(dll, obj, opts): cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET) for arch in OSX_ARCHS: - if arch != "ppc" or "NOPPC" not in OPTS: + if 'NOARCH:' + arch.upper() not in OPTS: cmd += " -arch %s" % arch if "SYSROOT" in SDK: @@ -4455,10 +4455,10 @@ if (PkgSkip("BULLET")==0 and not RUNTIME): # if (PkgSkip("PHYSX")==0): - OPTS=['DIR:panda/src/physx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOPPC'] + OPTS=['DIR:panda/src/physx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOARCH:PPC'] TargetAdd('p3physx_composite.obj', opts=OPTS, input='p3physx_composite.cxx') - OPTS=['DIR:panda/src/physx', 'PHYSX', 'NOPPC'] + OPTS=['DIR:panda/src/physx', 'PHYSX', 'NOARCH:PPC'] IGATEFILES=GetDirectoryContents('panda/src/physx', ["*.h", "*_composite*.cxx"]) TargetAdd('libpandaphysx.in', opts=OPTS, input=IGATEFILES) TargetAdd('libpandaphysx.in', opts=['IMOD:panda3d.physx', 'ILIB:libpandaphysx', 'SRCDIR:panda/src/physx']) @@ -4469,15 +4469,15 @@ if (PkgSkip("PHYSX")==0): # if (PkgSkip("PHYSX")==0): - OPTS=['DIR:panda/metalibs/pandaphysx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOPPC'] + OPTS=['DIR:panda/metalibs/pandaphysx', 'BUILDING:PANDAPHYSX', 'PHYSX', 'NOARCH:PPC'] TargetAdd('pandaphysx_pandaphysx.obj', opts=OPTS, input='pandaphysx.cxx') TargetAdd('libpandaphysx.dll', input='pandaphysx_pandaphysx.obj') TargetAdd('libpandaphysx.dll', input='p3physx_composite.obj') TargetAdd('libpandaphysx.dll', input=COMMON_PANDA_LIBS) - TargetAdd('libpandaphysx.dll', opts=['WINUSER', 'PHYSX', 'NOPPC']) + TargetAdd('libpandaphysx.dll', opts=['WINUSER', 'PHYSX', 'NOARCH:PPC']) - OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOPPC'] + OPTS=['DIR:panda/metalibs/pandaphysx', 'PHYSX', 'NOARCH:PPC'] TargetAdd('physx_module.obj', input='libpandaphysx.in') TargetAdd('physx_module.obj', opts=OPTS) TargetAdd('physx_module.obj', opts=['IMOD:panda3d.physx', 'ILIB:physx']) @@ -4487,7 +4487,7 @@ if (PkgSkip("PHYSX")==0): TargetAdd('physx.pyd', input='libpandaphysx.dll') TargetAdd('physx.pyd', input='core.pyd') TargetAdd('physx.pyd', input=COMMON_PANDA_LIBS) - TargetAdd('physx.pyd', opts=['PYTHON', 'WINUSER', 'PHYSX', 'NOPPC']) + TargetAdd('physx.pyd', opts=['PYTHON', 'WINUSER', 'PHYSX', 'NOARCH:PPC']) # # DIRECTORY: panda/src/physics/ @@ -5934,8 +5934,11 @@ for VER in MAYAVERSIONS: TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - if GetTarget() == "darwin" and int(VNUM) >= 2009: - TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOPPC', VER]) + + if GetTarget() == "darwin" and int(VNUM) >= 2012: + TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', 'NOARCH:I386', VER]) + elif GetTarget() == "darwin" and int(VNUM) >= 2009: + TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', VER]) else: TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', VER]) @@ -5947,8 +5950,11 @@ for VER in MAYAVERSIONS: TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - if GetTarget() == 'darwin' and int(VNUM) >= 2009: - TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOPPC', VER]) + + if GetTarget() == 'darwin' and int(VNUM) >= 2012: + TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', 'NOARCH:I386', VER]) + elif GetTarget() == 'darwin' and int(VNUM) >= 2009: + TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', VER]) else: TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', VER]) @@ -5960,8 +5966,11 @@ for VER in MAYAVERSIONS: TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - if GetTarget() == 'darwin' and int(VNUM) >= 2009: - TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOPPC', VER]) + + if GetTarget() == 'darwin' and int(VNUM) >= 2012: + TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', 'NOARCH:I386', VER]) + elif GetTarget() == 'darwin' and int(VNUM) >= 2009: + TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', VER]) else: TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', VER]) From 93e8d4d5f5a2ed0a8e0fee372eb996cbc1214be8 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:23:55 +0200 Subject: [PATCH 14/73] Fix 32-bit Windows compilation issue with Eigen --- pandatool/src/daeegg/daeCharacter.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pandatool/src/daeegg/daeCharacter.h b/pandatool/src/daeegg/daeCharacter.h index 4b9e86af73..c1f555394f 100644 --- a/pandatool/src/daeegg/daeCharacter.h +++ b/pandatool/src/daeegg/daeCharacter.h @@ -19,6 +19,7 @@ #include "typedReferenceCount.h" #include "typeHandle.h" #include "eggTable.h" +#include "epvector.h" #include "pre_fcollada_include.h" #include "FCollada.h" @@ -49,7 +50,7 @@ public: const FCDSceneNode *_scene_node; DaeCharacter *_character; }; - typedef pvector Joints; + typedef epvector Joints; typedef pmap JointMap; void bind_joints(JointMap &joint_map); From af0d853eefb14d02f02e25c99cf71639b58db452 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:54:38 +0200 Subject: [PATCH 15/73] Disable i386 atomics impl on Mac OS X until we find out why it won't compile --- dtool/src/dtoolbase/atomicAdjust.h | 2 +- dtool/src/dtoolbase/atomicAdjustI386Impl.cxx | 6 ------ dtool/src/dtoolbase/atomicAdjustI386Impl.h | 2 +- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/dtool/src/dtoolbase/atomicAdjust.h b/dtool/src/dtoolbase/atomicAdjust.h index bd709fce20..cbaa2bcf7f 100644 --- a/dtool/src/dtoolbase/atomicAdjust.h +++ b/dtool/src/dtoolbase/atomicAdjust.h @@ -31,7 +31,7 @@ struct AtomicAdjust { #include "atomicAdjustDummyImpl.h" typedef AtomicAdjustDummyImpl AtomicAdjust; -#elif defined(__i386__) || defined(_M_IX86) +#elif (defined(__i386__) || defined(_M_IX86)) && !defined(__APPLE__) // For an i386 architecture, we'll always use the i386 implementation. // It should be safe for any OS, and it might be a bit faster than // any OS-provided calls. diff --git a/dtool/src/dtoolbase/atomicAdjustI386Impl.cxx b/dtool/src/dtoolbase/atomicAdjustI386Impl.cxx index b564a27fbe..ee0cccd6fd 100644 --- a/dtool/src/dtoolbase/atomicAdjustI386Impl.cxx +++ b/dtool/src/dtoolbase/atomicAdjustI386Impl.cxx @@ -12,10 +12,4 @@ // //////////////////////////////////////////////////////////////////// -#include "selectThreadImpl.h" - -#ifdef __i386__ - #include "atomicAdjustI386Impl.h" - -#endif // __i386__ diff --git a/dtool/src/dtoolbase/atomicAdjustI386Impl.h b/dtool/src/dtoolbase/atomicAdjustI386Impl.h index 600aea7781..e234a47e31 100644 --- a/dtool/src/dtoolbase/atomicAdjustI386Impl.h +++ b/dtool/src/dtoolbase/atomicAdjustI386Impl.h @@ -18,7 +18,7 @@ #include "dtoolbase.h" #include "selectThreadImpl.h" -#if defined(__i386__) || defined(_M_IX86) +#if (defined(__i386__) || defined(_M_IX86)) && !defined(__APPLE__) #include "numeric_types.h" From 346d04a256b81988dcb45f765cf3478dab0b035d Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:55:32 +0200 Subject: [PATCH 16/73] Work around buggy list::remove in libc++ --- dtool/src/dtoolbase/plist.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dtool/src/dtoolbase/plist.h b/dtool/src/dtoolbase/plist.h index 4ebc2899eb..91de207835 100644 --- a/dtool/src/dtoolbase/plist.h +++ b/dtool/src/dtoolbase/plist.h @@ -49,6 +49,19 @@ public: typedef TYPENAME base_class::const_iterator const_iterator; typedef TYPENAME base_class::reverse_iterator reverse_iterator; typedef TYPENAME base_class::const_reverse_iterator const_reverse_iterator; + + // This exists because libc++'s remove implementation has a bug with + // Panda's allocator class. + INLINE void remove(const Type &val) { + iterator it = this->begin(); + while (it != this->end()) { + if (*it == val) { + it = this->erase(it); + } else { + ++it; + } + } + }; }; #endif // USE_STL_ALLOCATOR From b4bfe7010c69244a1bb026040437a3ce9931cb47 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 13:57:02 +0200 Subject: [PATCH 17/73] A few convenience methods that allow for cleaner code in GSGs --- .../glstuff/glGraphicsStateGuardian_src.cxx | 72 +++++++++---------- panda/src/gobj/geom.I | 22 ++++++ panda/src/gobj/geom.h | 3 + panda/src/gobj/geomPrimitive.I | 41 +++++++---- panda/src/gobj/geomPrimitive.h | 3 + panda/src/gobj/geomVertexArrayData.I | 40 ++++++++--- panda/src/gobj/geomVertexArrayData.h | 19 ++--- panda/src/pgraph/renderState.I | 36 ++++++++-- panda/src/pgraph/renderState.h | 7 ++ 9 files changed, 170 insertions(+), 73 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index b623cb655f..8e96089bfb 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -3146,7 +3146,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader, // buffers are unbound, or the nVidia drivers may crash. unbind_buffers(); - GeomContext *gc = ((Geom *)geom_reader->get_object())->prepare_now(get_prepared_objects(), this); + GeomContext *gc = geom_reader->prepare_now(get_prepared_objects(), this); nassertr(gc != (GeomContext *)NULL, false); CLP(GeomContext) *ggc = DCAST(CLP(GeomContext), gc); const CLP(GeomMunger) *gmunger = DCAST(CLP(GeomMunger), _munger); @@ -4845,7 +4845,7 @@ setup_array_data(const unsigned char *&client_pointer, } // Prepare the buffer object and bind it. - VertexBufferContext *vbc = ((GeomVertexArrayData *)array_reader->get_object())->prepare_now(get_prepared_objects(), this); + VertexBufferContext *vbc = array_reader->prepare_now(get_prepared_objects(), this); nassertr(vbc != (VertexBufferContext *)NULL, false); if (!apply_vertex_buffer(vbc, array_reader, force)) { return false; @@ -5039,7 +5039,7 @@ setup_primitive(const unsigned char *&client_pointer, } // Prepare the buffer object and bind it. - IndexBufferContext *ibc = ((GeomPrimitive *)reader->get_object())->prepare_now(get_prepared_objects(), this); + IndexBufferContext *ibc = reader->prepare_now(get_prepared_objects(), this); nassertr(ibc != (IndexBufferContext *)NULL, false); if (!apply_index_buffer(ibc, reader, force)) { return false; @@ -5709,8 +5709,8 @@ do_issue_transform() { void CLP(GraphicsStateGuardian):: do_issue_shade_model() { #ifndef OPENGLES_2 - const ShadeModelAttrib *target_shade_model = (const ShadeModelAttrib *) - _target_rs->get_attrib_def(ShadeModelAttrib::get_class_slot()); + const ShadeModelAttrib *target_shade_model; + _target_rs->get_attrib_def(target_shade_model); switch (target_shade_model->get_mode()) { case ShadeModelAttrib::M_smooth: @@ -5794,8 +5794,8 @@ do_issue_shader(bool state_has_changed) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_render_mode() { - const RenderModeAttrib *target_render_mode = (const RenderModeAttrib *) - _target_rs->get_attrib_def(RenderModeAttrib::get_class_slot()); + const RenderModeAttrib *target_render_mode; + _target_rs->get_attrib_def(target_render_mode); _render_mode = target_render_mode->get_mode(); _point_size = target_render_mode->get_thickness(); @@ -5840,8 +5840,8 @@ do_issue_render_mode() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_antialias() { - const AntialiasAttrib *target_antialias = (const AntialiasAttrib *) - _target_rs->get_attrib_def(AntialiasAttrib::get_class_slot()); + const AntialiasAttrib *target_antialias; + _target_rs->get_attrib_def(target_antialias); if (target_antialias->get_mode_type() == AntialiasAttrib::M_auto) { // In this special mode, we must enable antialiasing on a @@ -5908,8 +5908,8 @@ do_issue_antialias() { void CLP(GraphicsStateGuardian):: do_issue_rescale_normal() { #ifndef OPENGLES_2 // OpenGL ES 2.0 doesn't support rescaling normals. - const RescaleNormalAttrib *target_rescale_normal = (const RescaleNormalAttrib *) - _target_rs->get_attrib_def(RescaleNormalAttrib::get_class_slot()); + const RescaleNormalAttrib *target_rescale_normal; + _target_rs->get_attrib_def(target_rescale_normal); RescaleNormalAttrib::Mode mode = target_rescale_normal->get_mode(); @@ -5962,8 +5962,8 @@ do_issue_rescale_normal() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_depth_test() { - const DepthTestAttrib *target_depth_test = (const DepthTestAttrib *) - _target_rs->get_attrib_def(DepthTestAttrib::get_class_slot()); + const DepthTestAttrib *target_depth_test; + _target_rs->get_attrib_def(target_depth_test); DepthTestAttrib::PandaCompareFunc mode = target_depth_test->get_mode(); if (mode == DepthTestAttrib::M_none) { @@ -5985,8 +5985,8 @@ do_issue_alpha_test() { if (_target_shader->get_flag(ShaderAttrib::F_subsume_alpha_test)) { enable_alpha_test(false); } else { - const AlphaTestAttrib *target_alpha_test = (const AlphaTestAttrib *) - _target_rs->get_attrib_def(AlphaTestAttrib::get_class_slot()); + const AlphaTestAttrib *target_alpha_test; + _target_rs->get_attrib_def(target_alpha_test); AlphaTestAttrib::PandaCompareFunc mode = target_alpha_test->get_mode(); if (mode == AlphaTestAttrib::M_none) { @@ -6008,8 +6008,8 @@ do_issue_alpha_test() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_depth_write() { - const DepthWriteAttrib *target_depth_write = (const DepthWriteAttrib *) - _target_rs->get_attrib_def(DepthWriteAttrib::get_class_slot()); + const DepthWriteAttrib *target_depth_write; + _target_rs->get_attrib_def(target_depth_write); DepthWriteAttrib::Mode mode = target_depth_write->get_mode(); if (mode == DepthWriteAttrib::M_off) { @@ -6035,8 +6035,8 @@ do_issue_depth_write() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_cull_face() { - const CullFaceAttrib *target_cull_face = (const CullFaceAttrib *) - _target_rs->get_attrib_def(CullFaceAttrib::get_class_slot()); + const CullFaceAttrib *target_cull_face; + _target_rs->get_attrib_def(target_cull_face); CullFaceAttrib::Mode mode = target_cull_face->get_effective_mode(); @@ -6067,8 +6067,8 @@ do_issue_cull_face() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_fog() { - const FogAttrib *target_fog = (const FogAttrib *) - _target_rs->get_attrib_def(FogAttrib::get_class_slot()); + const FogAttrib *target_fog; + _target_rs->get_attrib_def(target_fog); if (!target_fog->is_off()) { enable_fog(true); @@ -6131,8 +6131,8 @@ do_issue_material() { static Material empty; const Material *material; - const MaterialAttrib *target_material = (const MaterialAttrib *) - _target_rs->get_attrib_def(MaterialAttrib::get_class_slot()); + const MaterialAttrib *target_material; + _target_rs->get_attrib_def(target_material); if (target_material == (MaterialAttrib *)NULL || target_material->is_off()) { @@ -6239,8 +6239,8 @@ do_issue_blending() { // all the other blending-related stuff doesn't matter. If the // device doesn't support color-write, we use blending tricks // to effectively disable color write. - const ColorWriteAttrib *target_color_write = (const ColorWriteAttrib *) - _target_rs->get_attrib_def(ColorWriteAttrib::get_class_slot()); + const ColorWriteAttrib *target_color_write; + _target_rs->get_attrib_def(target_color_write); unsigned int color_channels = target_color_write->get_channels() & _color_write_mask; @@ -6270,13 +6270,13 @@ do_issue_blending() { } - const ColorBlendAttrib *target_color_blend = (const ColorBlendAttrib *) - _target_rs->get_attrib_def(ColorBlendAttrib::get_class_slot()); + const ColorBlendAttrib *target_color_blend; + _target_rs->get_attrib_def(target_color_blend); CPT(ColorBlendAttrib) color_blend = target_color_blend; ColorBlendAttrib::Mode color_blend_mode = target_color_blend->get_mode(); - const TransparencyAttrib *target_transparency = (const TransparencyAttrib *) - _target_rs->get_attrib_def(TransparencyAttrib::get_class_slot()); + const TransparencyAttrib *target_transparency; + _target_rs->get_attrib_def(target_transparency); TransparencyAttrib::Mode transparency_mode = target_transparency->get_mode(); _color_blend_involves_color_scale = color_blend->involves_color_scale(); @@ -9636,8 +9636,8 @@ do_issue_tex_matrix() { glMatrixMode(GL_TEXTURE); - const TexMatrixAttrib *target_tex_matrix = (const TexMatrixAttrib *) - _target_rs->get_attrib_def(TexMatrixAttrib::get_class_slot()); + const TexMatrixAttrib *target_tex_matrix; + _target_rs->get_attrib_def(target_tex_matrix); if (target_tex_matrix->has_stage(stage)) { GLPf(LoadMatrix)(target_tex_matrix->get_mat(stage).get_data()); @@ -11959,10 +11959,8 @@ do_issue_stencil() { return; } - const StencilAttrib *stencil = (const StencilAttrib *) - _target_rs->get_attrib(StencilAttrib::get_class_slot()); - - if (stencil != (const StencilAttrib *)NULL) { + const StencilAttrib *stencil; + if (_target_rs->get_attrib(stencil)) { // DEBUG if (false) { GLCAT.debug() << "STENCIL STATE CHANGE\n"; @@ -12052,8 +12050,8 @@ do_issue_stencil() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_scissor() { - const ScissorAttrib *target_scissor = (const ScissorAttrib *) - _target_rs->get_attrib_def(ScissorAttrib::get_class_slot()); + const ScissorAttrib *target_scissor; + _target_rs->get_attrib_def(target_scissor); if (!target_scissor->is_off()) { // A non-off ScissorAttrib means to override the scissor setting diff --git a/panda/src/gobj/geom.I b/panda/src/gobj/geom.I index 41bdfb4528..45d911d2ce 100644 --- a/panda/src/gobj/geom.I +++ b/panda/src/gobj/geom.I @@ -800,6 +800,28 @@ get_modified() const { return _cdata->_modified; } +//////////////////////////////////////////////////////////////////// +// Function: GeomPipelineReader::prepare_now +// Access: Public +// Description: Creates a context for the geom on the particular +// GSG, if it does not already exist. Returns the new +// (or old) GeomContext. This assumes that the +// GraphicsStateGuardian is the currently active +// rendering context and that it is ready to accept new +// geoms. If this is not necessarily the case, you +// should use prepare() instead. +// +// Normally, this is not called directly except by the +// GraphicsStateGuardian; a geom does not need to be +// explicitly prepared by the user before it may be +// rendered. +//////////////////////////////////////////////////////////////////// +INLINE GeomContext *GeomPipelineReader:: +prepare_now(PreparedGraphicsObjects *prepared_objects, + GraphicsStateGuardianBase *gsg) const { + return ((Geom *)_object.p())->prepare_now(prepared_objects, gsg); +} + INLINE ostream & operator << (ostream &out, const Geom &obj) { obj.output(out); diff --git a/panda/src/gobj/geom.h b/panda/src/gobj/geom.h index 09091b2b0d..aa890a404f 100644 --- a/panda/src/gobj/geom.h +++ b/panda/src/gobj/geom.h @@ -424,6 +424,9 @@ public: bool check_valid(const GeomVertexDataPipelineReader *data_reader) const; + INLINE GeomContext *prepare_now(PreparedGraphicsObjects *prepared_objects, + GraphicsStateGuardianBase *gsg) const; + bool draw(GraphicsStateGuardianBase *gsg, const GeomMunger *munger, const GeomVertexDataPipelineReader *data_reader, bool force) const; diff --git a/panda/src/gobj/geomPrimitive.I b/panda/src/gobj/geomPrimitive.I index 8b40eb0813..9eb42022db 100644 --- a/panda/src/gobj/geomPrimitive.I +++ b/panda/src/gobj/geomPrimitive.I @@ -512,7 +512,7 @@ CData(const GeomPrimitive::CData ©) : // Description: //////////////////////////////////////////////////////////////////// INLINE GeomPrimitivePipelineReader:: -GeomPrimitivePipelineReader(const GeomPrimitive *object, +GeomPrimitivePipelineReader(const GeomPrimitive *object, Thread *current_thread) : _object(object), _current_thread(current_thread), @@ -594,7 +594,7 @@ get_current_thread() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_shade_model // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomPrimitivePipelineReader::ShadeModel GeomPrimitivePipelineReader:: get_shade_model() const { @@ -604,7 +604,7 @@ get_shade_model() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_usage_hint // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomPrimitivePipelineReader::UsageHint GeomPrimitivePipelineReader:: get_usage_hint() const { @@ -614,7 +614,7 @@ get_usage_hint() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_index_type // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomPrimitivePipelineReader::NumericType GeomPrimitivePipelineReader:: get_index_type() const { @@ -624,7 +624,7 @@ get_index_type() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::is_indexed // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE bool GeomPrimitivePipelineReader:: is_indexed() const { @@ -634,7 +634,7 @@ is_indexed() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_num_vertices // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE int GeomPrimitivePipelineReader:: get_num_vertices() const { @@ -649,7 +649,7 @@ get_num_vertices() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_min_vertex // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE int GeomPrimitivePipelineReader:: get_min_vertex() const { @@ -660,7 +660,7 @@ get_min_vertex() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_max_vertex // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE int GeomPrimitivePipelineReader:: get_max_vertex() const { @@ -682,7 +682,7 @@ get_data_size_bytes() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_modified // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE UpdateSeq GeomPrimitivePipelineReader:: get_modified() const { @@ -692,7 +692,7 @@ get_modified() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_index_stride // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE int GeomPrimitivePipelineReader:: get_index_stride() const { @@ -703,7 +703,7 @@ get_index_stride() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_vertices_reader // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE const GeomVertexArrayDataHandle *GeomPrimitivePipelineReader:: get_vertices_reader() const { @@ -713,7 +713,7 @@ get_vertices_reader() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_read_pointer // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE const unsigned char *GeomPrimitivePipelineReader:: get_read_pointer(bool force) const { @@ -733,7 +733,7 @@ get_strip_cut_index() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_ends // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE CPTA_int GeomPrimitivePipelineReader:: get_ends() const { @@ -743,7 +743,7 @@ get_ends() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_mins // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE CPT(GeomVertexArrayData) GeomPrimitivePipelineReader:: get_mins() const { @@ -755,7 +755,7 @@ get_mins() const { //////////////////////////////////////////////////////////////////// // Function: GeomPrimitivePipelineReader::get_maxs // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE CPT(GeomVertexArrayData) GeomPrimitivePipelineReader:: get_maxs() const { @@ -764,6 +764,17 @@ get_maxs() const { return _cdata->_maxs.get_read_pointer(); } +//////////////////////////////////////////////////////////////////// +// Function: GeomPrimitivePipelineReader::prepare_now +// Access: Public +// Description: +//////////////////////////////////////////////////////////////////// +INLINE IndexBufferContext *GeomPrimitivePipelineReader:: +prepare_now(PreparedGraphicsObjects *prepared_objects, + GraphicsStateGuardianBase *gsg) const { + return ((GeomPrimitive *)_object.p())->prepare_now(prepared_objects, gsg); +} + INLINE ostream & operator << (ostream &out, const GeomPrimitive &obj) { obj.output(out); diff --git a/panda/src/gobj/geomPrimitive.h b/panda/src/gobj/geomPrimitive.h index 3a1e1fff55..1926625f5a 100644 --- a/panda/src/gobj/geomPrimitive.h +++ b/panda/src/gobj/geomPrimitive.h @@ -374,6 +374,9 @@ public: INLINE CPT(GeomVertexArrayData) get_mins() const; INLINE CPT(GeomVertexArrayData) get_maxs() const; + INLINE IndexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, + GraphicsStateGuardianBase *gsg) const; + private: CPT(GeomPrimitive) _object; Thread *_current_thread; diff --git a/panda/src/gobj/geomVertexArrayData.I b/panda/src/gobj/geomVertexArrayData.I index a10a8e285b..c8be2ffdb7 100644 --- a/panda/src/gobj/geomVertexArrayData.I +++ b/panda/src/gobj/geomVertexArrayData.I @@ -183,7 +183,7 @@ request_resident() const { INLINE CPT(GeomVertexArrayDataHandle) GeomVertexArrayData:: get_handle(Thread *current_thread) const { const CData *cdata = _cycler.read_unlocked(current_thread); - return new GeomVertexArrayDataHandle(this, current_thread, + return new GeomVertexArrayDataHandle(this, current_thread, cdata, false); } @@ -199,7 +199,7 @@ get_handle(Thread *current_thread) const { INLINE PT(GeomVertexArrayDataHandle) GeomVertexArrayData:: modify_handle(Thread *current_thread) { CData *cdata = _cycler.write_upstream(true, current_thread); - return new GeomVertexArrayDataHandle(this, current_thread, + return new GeomVertexArrayDataHandle(this, current_thread, cdata, true); } @@ -298,7 +298,7 @@ operator = (const GeomVertexArrayData::CData ©) { // Description: //////////////////////////////////////////////////////////////////// INLINE GeomVertexArrayDataHandle:: -GeomVertexArrayDataHandle(const GeomVertexArrayData *object, +GeomVertexArrayDataHandle(const GeomVertexArrayData *object, Thread *current_thread, const GeomVertexArrayData::CData *cdata, bool writable) : @@ -421,7 +421,7 @@ get_object() { //////////////////////////////////////////////////////////////////// // Function: GeomVertexArrayDataHandle::get_array_format // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE const GeomVertexArrayFormat *GeomVertexArrayDataHandle:: get_array_format() const { @@ -431,7 +431,7 @@ get_array_format() const { //////////////////////////////////////////////////////////////////// // Function: GeomVertexArrayDataHandle::get_usage_hint // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE GeomVertexArrayDataHandle::UsageHint GeomVertexArrayDataHandle:: get_usage_hint() const { @@ -441,7 +441,7 @@ get_usage_hint() const { //////////////////////////////////////////////////////////////////// // Function: GeomVertexArrayDataHandle::get_num_rows // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE int GeomVertexArrayDataHandle:: get_num_rows() const { @@ -452,7 +452,7 @@ get_num_rows() const { //////////////////////////////////////////////////////////////////// // Function: GeomVertexArrayDataHandle::clear_rows // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void GeomVertexArrayDataHandle:: clear_rows() { @@ -462,7 +462,7 @@ clear_rows() { //////////////////////////////////////////////////////////////////// // Function: GeomVertexArrayDataHandle::get_data_size_bytes // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE int GeomVertexArrayDataHandle:: get_data_size_bytes() const { @@ -472,7 +472,7 @@ get_data_size_bytes() const { //////////////////////////////////////////////////////////////////// // Function: GeomVertexArrayDataHandle::get_modified // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE UpdateSeq GeomVertexArrayDataHandle:: get_modified() const { @@ -493,6 +493,28 @@ request_resident() const { return (get_read_pointer(false) != (const unsigned char *)NULL); } +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexArrayDataHandle::prepare_now +// Access: Public +// Description: Creates a context for the data on the particular +// GSG, if it does not already exist. Returns the new +// (or old) VertexBufferContext. This assumes that the +// GraphicsStateGuardian is the currently active +// rendering context and that it is ready to accept new +// datas. If this is not necessarily the case, you +// should use prepare() instead. +// +// Normally, this is not called directly except by the +// GraphicsStateGuardian; a data does not need to be +// explicitly prepared by the user before it may be +// rendered. +//////////////////////////////////////////////////////////////////// +INLINE VertexBufferContext *GeomVertexArrayDataHandle:: +prepare_now(PreparedGraphicsObjects *prepared_objects, + GraphicsStateGuardianBase *gsg) const { + return _object->prepare_now(prepared_objects, gsg); +} + //////////////////////////////////////////////////////////////////// // Function: GeomVertexArrayDataHandle::get_data // Access: Published diff --git a/panda/src/gobj/geomVertexArrayData.h b/panda/src/gobj/geomVertexArrayData.h index 684336ae92..e0aebb95e5 100644 --- a/panda/src/gobj/geomVertexArrayData.h +++ b/panda/src/gobj/geomVertexArrayData.h @@ -104,7 +104,7 @@ PUBLISHED: void prepare(PreparedGraphicsObjects *prepared_objects); bool is_prepared(PreparedGraphicsObjects *prepared_objects) const; - VertexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, + VertexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, GraphicsStateGuardianBase *gsg); bool release(PreparedGraphicsObjects *prepared_objects); int release_all(); @@ -127,7 +127,7 @@ private: INLINE void set_lru_size(size_t lru_size); void clear_prepared(PreparedGraphicsObjects *prepared_objects); - void reverse_data_endianness(unsigned char *dest, + void reverse_data_endianness(unsigned char *dest, const unsigned char *source, size_t size); @@ -174,7 +174,7 @@ private: // This implements read-write locking. Anyone who gets the data for // reading or writing will hold this mutex during the lock. ReMutex _rw_lock; - + public: static TypeHandle get_class_type() { return _type_handle; @@ -182,7 +182,7 @@ private: static void init_type() { register_type(_type_handle, "GeomVertexArrayData::CData"); } - + private: static TypeHandle _type_handle; @@ -253,13 +253,13 @@ private: //////////////////////////////////////////////////////////////////// class EXPCL_PANDA_GOBJ GeomVertexArrayDataHandle : public ReferenceCount, public GeomEnums { private: - INLINE GeomVertexArrayDataHandle(const GeomVertexArrayData *object, + INLINE GeomVertexArrayDataHandle(const GeomVertexArrayData *object, Thread *current_thread, - const GeomVertexArrayData::CData *_cdata, + const GeomVertexArrayData::CData *_cdata, bool writable); INLINE GeomVertexArrayDataHandle(const GeomVertexArrayDataHandle &); INLINE void operator = (const GeomVertexArrayDataHandle &); - + PUBLISHED: INLINE ~GeomVertexArrayDataHandle(); @@ -289,6 +289,9 @@ PUBLISHED: INLINE bool request_resident() const; + INLINE VertexBufferContext *prepare_now(PreparedGraphicsObjects *prepared_objects, + GraphicsStateGuardianBase *gsg) const; + void copy_data_from(const GeomVertexArrayDataHandle *other); void copy_subdata_from(size_t to_start, size_t to_size, const GeomVertexArrayDataHandle *other, @@ -312,7 +315,7 @@ PUBLISHED: void set_subdata(size_t start, size_t size, const string &data); INLINE void mark_used() const; - + private: PT(GeomVertexArrayData) _object; Thread *_current_thread; diff --git a/panda/src/pgraph/renderState.I b/panda/src/pgraph/renderState.I index da6679bd7a..6bce566751 100644 --- a/panda/src/pgraph/renderState.I +++ b/panda/src/pgraph/renderState.I @@ -513,7 +513,7 @@ consider_update_pstats(int old_referenced_bits) const { //////////////////////////////////////////////////////////////////// // Function: RenderState::Composition::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE RenderState::Composition:: Composition() { @@ -522,7 +522,7 @@ Composition() { //////////////////////////////////////////////////////////////////// // Function: RenderState::Composition::Copy Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE RenderState::Composition:: Composition(const RenderState::Composition ©) : @@ -545,7 +545,7 @@ Attribute(const RenderAttrib *attrib, int override) : //////////////////////////////////////////////////////////////////// // Function: RenderState::Attribute::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE RenderState::Attribute:: Attribute(int override) : @@ -624,6 +624,34 @@ flush_level() { _cache_counter.flush_level(); } +#ifndef CPPPARSER +//////////////////////////////////////////////////////////////////// +// Function: RenderState::get_attrib +// Access: Public +// Description: Handy templated version of get_attrib that +// costs to the right type. Returns true if the +// attribute was present, false otherwise. +//////////////////////////////////////////////////////////////////// +template +INLINE bool RenderState:: +get_attrib(const AttribType *&attrib) const { + attrib = (const AttribType *)get_attrib((int)AttribType::get_class_slot()); + return (attrib != (const AttribType *)NULL); +} + +//////////////////////////////////////////////////////////////////// +// Function: RenderState::get_attrib_def +// Access: Public +// Description: Handy templated version of get_attrib_def that +// costs to the right type. +//////////////////////////////////////////////////////////////////// +template +INLINE void RenderState:: +get_attrib_def(const AttribType *&attrib) const { + attrib = (const AttribType *)get_attrib_def((int)AttribType::get_class_slot()); +} +#endif // CPPPARSER + //////////////////////////////////////////////////////////////////// // Function: RenderState::check_hash // Access: Private @@ -677,7 +705,7 @@ calc_hash() { //////////////////////////////////////////////////////////////////// // Function: RenderState::CompositionCycleDescEntry::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE RenderState::CompositionCycleDescEntry:: CompositionCycleDescEntry(const RenderState *obj, diff --git a/panda/src/pgraph/renderState.h b/panda/src/pgraph/renderState.h index 035ae6fbe9..e1bc57d632 100644 --- a/panda/src/pgraph/renderState.h +++ b/panda/src/pgraph/renderState.h @@ -159,6 +159,13 @@ public: INLINE static void flush_level(); +#ifndef CPPPARSER + template + INLINE bool get_attrib(const AttribType *&attrib) const; + template + INLINE void get_attrib_def(const AttribType *&attrib) const; +#endif // CPPPARSER + private: INLINE void check_hash() const; bool validate_filled_slots() const; From 26fb210ffd90fc68c663938489624f0adc38fc81 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 14:13:05 +0200 Subject: [PATCH 18/73] Add release notes for 1.9.0 --- doc/ReleaseNotes | 111 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index d20d255b38..f5bb47f440 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -1,3 +1,114 @@ +------------------------ RELEASE 1.9.0 ------------------------ + +This is a major release with many exciting new features! +Beware of bugs. + +The list below contains a subset of the changes introduced: + +* We now offer 64-bit Windows and Mac OS X builds. +* Switch to MSVC 2010; no more assembly manifests. +* Cocoa port for Mac OS X; 64-bit OS X support. +* We now compile the Python modules into panda3d/*.pyd modules; + no more imp.load_dynamic hackery needed. +* Support for GPU profiling in OpenGL, see pstats-gpu-timing +* sRGB framebuffers, see framebuffer-srgb +* sRGB texture support, see Texture::F_srgb et al. +* Integer vector support, including passing to shaders +* Native .ogg vorbis and .wav loader (does not require ffmpeg) +* FFmpeg support is a separate plug-in module now, libp3ffmpeg. +* Sample programs are now part of the source code repository +* Can be built with Python 3 (highly experimental) +* Improvements to Windows installer +* M_filled_wireframe rendering mode +* Support specifying sampler state separate from textures +* Support for bindless texture clearing +* Texture LOD bias and min/max LOD settings +* Framebuffer properties allows separate red/green/blue bits +* Explicit float color and float depth specification in fbprops +* Coverage samples settable via FrameBufferProperties +* Stereo buffer implementation in OpenGL via FBOs +* Support enumeration of pixel formats in WebcamVideo +* Frame rate meter can be configured to show milliseconds +* Changes to improve font crispness with default settings +* Fix assertion error when using more than one GraphicsEngine +* raw-w, raw-a, etc. keyboard events for layout-independent input +* Allow querying active keyboard layout via win.get_keyboard_map() +* Distinguish between lmeta and rmeta keys on Mac OS X +* Floating-point image manipulation API, support float tiffs +* Various new 16-bit and 32-bit and int texture formats +* Man pages are now available for the majority of utilities + +Pipeline: +* Fix bugs with group transformations in .egg +* Don't create unnecessary intermediate node when loading .egg +* bam2egg supports materials, and correctly converts animations +* dae2egg has some skeletal animation support +* Support Maya versions up to 2015 + +OpenGL renderer changes: +* Error checking is now OFF by default for performance reasons, + set gl-check-errors or gl-debug to true to enable. +* GL 4.2 shader_image_load_store support (incl. multi-bind) +* Layered render-to-texture (using geometry shaders) +* Seamless cube maps (on by default), see gl-cube-map-seamless +* Added gl-debug for improved debug output support +* Added GL object labels when gl-debug is enabled +* gl-dump-compiled-shaders can be used to dump program binaries +* Direct3D-style NT_packed_dabc vertex arrays now directly supported +* Native rendering of line strips, using primitive restart +* Immutable texture storage support (disabled by default) +* Bindless texture support (disabled by default) +* Specular component is now computed separately in FFP + +Shader system: +* Support for tessellation shaders +* Support for compute shaders via ComputeNode +* GLSL preprocessor with "#pragma include" support +* Much better coverage of shader inputs in GLSL +* GLSL error messages now show source filename +* Fixes apiclip_of_x shader inputs +* Matrices can be passed directly to setShaderInput +* Support binding images to shaders +* Viewport array support + +Optimizations and performance improvements: +* Use of C++11 move semantics to reduce refcounting overhead +* Build with Eigen by default for faster linear math +* Dramatic overhead reduction of generated bindings +* Streamline culling process +* Tighter bounding volume generation +* Take advantage of CPU features for bit operations +* Circumvent bounding volume generation when not required +* Optimizations for interned strings +* Use of GCC atomics should improve 64-bit Linux performance + +API features: +* Buffer protocol support for textures and arrays +* Interrogate supports various C++11 features +* Expose TextGlyph interfaces for making custom text renderers +* Better handling of default arguments for many functions +* Cyclic references can sometimes be tracked through tasks +* ShowBase clean teardown possible +* API documentation is more accurate +* Improve interfaces for interop with other applications + +Deprecated features: +* Use of pandac.PandaModules is discouraged; use panda3d.core +* Deprecate DirectStart and global run() function; use ShowBase +* Remove old decal system +* Remove Direct3D 8 renderer +* Remove M_light_vector tex gen mode and FFP-based bump mapping + +Bug fixes: +* Various point rendering issues are fixed now +* Fix pview issue with 1-frame and/or multiple animations +* Fixes for multisampling in FBOs +* Fix aspect ratio of frame rate meter +* Support NaN and infinity values in Config.prc variables +* Fixes for webcams on Linux that do not output Huffman tables +* Better support for non-basic Cg shaders on non-NVIDIA cards +* Many others + ------------------------ RELEASE 1.8.1 ------------------------ This is a bugfix release, fixing many issues in 1.8.0. From e9493361fc81e5c834096605dabb14e83b9f8345 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 14:28:23 +0200 Subject: [PATCH 19/73] Update readme with thirdparty links and Mac OS X instructions --- README.md | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 93a20db562..bc02c69c6f 100644 --- a/README.md +++ b/README.md @@ -29,8 +29,10 @@ need Microsoft Visual Studio to build Panda3D, though - the relevant compilers are included as part of the Windows 7.1 SDK. You will also need to have the third-party dependency libraries available for -the build scripts to use. These are available from here: -https://www.panda3d.org/forums/viewtopic.php?f=9&t=16346 +the build scripts to use. These are available from one of these two URLs, +depending on whether you are on a 32-bit or 64-bit system: +https://www.panda3d.org/download/panda3d-1.9.0/panda3d-1.9.0-tools-win32.zip +https://www.panda3d.org/download/panda3d-1.9.0/panda3d-1.9.0-tools-win64.zip After acquiring these dependencies, you may simply build Panda3D from the command prompt using the following command: @@ -81,3 +83,25 @@ your system. Careful: it is not easy to uninstall Panda3D in this way! ```bash python2.7 makepanda/installpanda.py --prefix=/usr/local ``` + +Mac OS X +-------- + +On Mac OS X, all you need to compile Panda3D is a set of precompiled +thirdparty packages, which can be acquired from here: +https://www.panda3d.org/download/panda3d-1.9.0/panda3d-1.9.0-tools-mac.tar.gz + +After placing the thirdparty directory inside the panda3d source directory, +you may build Panda3D using a command like the following: + +```bash +python makepanda/makepanda.py --everything --installer +``` + +In order to make a universal build, pass the --universal flag. You may also +target a specific minimum Mac OS X version using the --osxtarget flag followed +by the release number, eg. 10.6 or 10.7. + +If the build was successful, makepanda will have generated a .dmg file in +the source directory containing the installer. Simply open it and run the +package file in order to install the SDK onto your system. From 7e2bbda1235ed49cdeeccb29ebda8ef255348704 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 21:34:08 +0200 Subject: [PATCH 20/73] Don't compile Maya 2012-2015 plugins in 32-bit mode on Mac OS X --- makepanda/makepanda.py | 54 ++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 0f8aedad46..b6c3682898 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1155,7 +1155,7 @@ def CompileCxx(obj,src,opts): cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET) for arch in OSX_ARCHS: - if 'NOARCH:' + arch.upper() not in OPTS: + if 'NOARCH:' + arch.upper() not in opts: cmd += " -arch %s" % arch if "SYSROOT" in SDK: @@ -1610,7 +1610,7 @@ def CompileLink(dll, obj, opts): cmd += " -mmacosx-version-min=%d.%d" % (OSXTARGET) for arch in OSX_ARCHS: - if 'NOARCH:' + arch.upper() not in OPTS: + if 'NOARCH:' + arch.upper() not in opts: cmd += " -arch %s" % arch if "SYSROOT" in SDK: @@ -1651,7 +1651,8 @@ def CompileLink(dll, obj, opts): oscmd('%s --strip-unneeded %s' % (GetStrip(), BracketNameWithQuotes(new_path))) elif (GetOptimizeOption(opts)==4 and GetTarget() == 'linux'): - oscmd(GetStrip() + " --strip-unneeded " + BracketNameWithQuotes(dll)) + #oscmd(GetStrip() + " --strip-unneeded " + BracketNameWithQuotes(dll)) + pass os.system("chmod +x " + BracketNameWithQuotes(dll)) @@ -5879,9 +5880,18 @@ if (PkgSkip("PANDATOOL")==0): # for VER in MAYAVERSIONS: - VNUM=VER[4:] - if (PkgSkip(VER)==0) and (PkgSkip("PANDATOOL")==0): - OPTS=['DIR:pandatool/src/mayaprogs', 'DIR:pandatool/src/maya', 'DIR:pandatool/src/mayaegg', 'DIR:pandatool/src/cvscopy', 'BUILDING:MISC', VER] + VNUM = VER[4:] + if not PkgSkip(VER) and not PkgSkip("PANDATOOL"): + if GetTarget() == 'darwin' and int(VNUM) >= 2012: + VER_OPTS = ['NOARCH:PPC', 'NOARCH:I386', VER] + if len(OSX_ARCHS) != 0 and 'x86_64' not in OSX_ARCHS: + continue + elif GetTarget() == 'darwin' and int(VNUM) >= 2009: + VER_OPTS = ['NOARCH:PPC', VER] + else: + VER_OPTS = [VER] + + OPTS=['DIR:pandatool/src/mayaprogs', 'DIR:pandatool/src/maya', 'DIR:pandatool/src/mayaegg', 'DIR:pandatool/src/cvscopy', 'BUILDING:MISC'] + VER_OPTS TargetAdd('mayaeggimport'+VNUM+'_mayaeggimport.obj', opts=OPTS, input='mayaEggImport.cxx') TargetAdd('mayaeggimport'+VNUM+'.mll', input='mayaegg'+VNUM+'_loader.obj') TargetAdd('mayaeggimport'+VNUM+'.mll', input='mayaeggimport'+VNUM+'_mayaeggimport.obj') @@ -5889,7 +5899,7 @@ for VER in MAYAVERSIONS: TargetAdd('mayaeggimport'+VNUM+'.mll', input=COMMON_PANDA_LIBS) if GetTarget() == 'windows': TargetAdd('mayaeggimport'+VNUM+'.mll', input='libp3pystub.lib') - TargetAdd('mayaeggimport'+VNUM+'.mll', opts=['ADVAPI', VER]) + TargetAdd('mayaeggimport'+VNUM+'.mll', opts=['ADVAPI']+VER_OPTS) TargetAdd('mayaloader'+VNUM+'_config_mayaloader.obj', opts=OPTS, input='config_mayaloader.cxx') TargetAdd('libp3mayaloader'+VNUM+'.dll', input='mayaloader'+VNUM+'_config_mayaloader.obj') @@ -5913,7 +5923,7 @@ for VER in MAYAVERSIONS: TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3pandatoolbase.lib') TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libpandaegg.dll') TargetAdd('libp3mayaloader'+VNUM+'.dll', input=COMMON_PANDA_LIBS) - TargetAdd('libp3mayaloader'+VNUM+'.dll', opts=['ADVAPI', VER]) + TargetAdd('libp3mayaloader'+VNUM+'.dll', opts=['ADVAPI']+VER_OPTS) TargetAdd('mayapview'+VNUM+'_mayaPview.obj', opts=OPTS, input='mayaPview.cxx') TargetAdd('libmayapview'+VNUM+'.mll', input='mayapview'+VNUM+'_mayaPview.obj') @@ -5924,7 +5934,7 @@ for VER in MAYAVERSIONS: TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS) - TargetAdd('libmayapview'+VNUM+'.mll', opts=['ADVAPI', VER]) + TargetAdd('libmayapview'+VNUM+'.mll', opts=['ADVAPI']+VER_OPTS) TargetAdd('maya2egg'+VNUM+'_mayaToEgg.obj', opts=OPTS, input='mayaToEgg.cxx') TargetAdd('maya2egg'+VNUM+'_bin.exe', input='maya2egg'+VNUM+'_mayaToEgg.obj') @@ -5934,13 +5944,7 @@ for VER in MAYAVERSIONS: TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - - if GetTarget() == "darwin" and int(VNUM) >= 2012: - TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', 'NOARCH:I386', VER]) - elif GetTarget() == "darwin" and int(VNUM) >= 2009: - TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', VER]) - else: - TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', VER]) + TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI']+VER_OPTS) TargetAdd('egg2maya'+VNUM+'_eggToMaya.obj', opts=OPTS, input='eggToMaya.cxx') TargetAdd('egg2maya'+VNUM+'_bin.exe', input='egg2maya'+VNUM+'_eggToMaya.obj') @@ -5950,13 +5954,7 @@ for VER in MAYAVERSIONS: TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - - if GetTarget() == 'darwin' and int(VNUM) >= 2012: - TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', 'NOARCH:I386', VER]) - elif GetTarget() == 'darwin' and int(VNUM) >= 2009: - TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', VER]) - else: - TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', VER]) + TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI']+VER_OPTS) TargetAdd('mayacopy'+VNUM+'_mayaCopy.obj', opts=OPTS, input='mayaCopy.cxx') TargetAdd('mayacopy'+VNUM+'_bin.exe', input='mayacopy'+VNUM+'_mayaCopy.obj') @@ -5966,17 +5964,11 @@ for VER in MAYAVERSIONS: TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - - if GetTarget() == 'darwin' and int(VNUM) >= 2012: - TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', 'NOARCH:I386', VER]) - elif GetTarget() == 'darwin' and int(VNUM) >= 2009: - TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', 'NOARCH:PPC', VER]) - else: - TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', VER]) + TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI']+VER_OPTS) TargetAdd('mayasavepview'+VNUM+'_mayaSavePview.obj', opts=OPTS, input='mayaSavePview.cxx') TargetAdd('libmayasavepview'+VNUM+'.mll', input='mayasavepview'+VNUM+'_mayaSavePview.obj') - TargetAdd('libmayasavepview'+VNUM+'.mll', opts=['ADVAPI', VER]) + TargetAdd('libmayasavepview'+VNUM+'.mll', opts=['ADVAPI']+VER_OPTS) TargetAdd('mayapath'+VNUM+'.obj', opts=OPTS, input='mayapath.cxx') From f8779d7eaf67c90ddd0a9846e40b989d0e63d604 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 22:33:11 +0200 Subject: [PATCH 21/73] Warn if GeoMipTerrain is passed a height field with sRGB color space --- panda/src/grutil/geoMipTerrain.I | 19 +++++---- panda/src/grutil/geoMipTerrain.cxx | 63 +++++++++++++++++++----------- panda/src/grutil/geoMipTerrain.h | 1 - 3 files changed, 52 insertions(+), 31 deletions(-) diff --git a/panda/src/grutil/geoMipTerrain.I b/panda/src/grutil/geoMipTerrain.I index 9da10e944d..3d972cb7bf 100644 --- a/panda/src/grutil/geoMipTerrain.I +++ b/panda/src/grutil/geoMipTerrain.I @@ -455,24 +455,29 @@ lod_decide(unsigned short mx, unsigned short my) { //////////////////////////////////////////////////////////////////// INLINE bool GeoMipTerrain:: set_heightfield(const PNMImage &image) { + if (image.get_color_space() == CS_sRGB) { + // Probably a mistaken metadata setting on the file. + grutil_cat.warning() + << "Heightfield image is specified to have sRGB color space!\n" + "Panda applies gamma correction, which will probably cause " + "it to produce incorrect results.\n"; + } + // Before we apply anything, validate the size. - if(is_power_of_two(image.get_x_size() - 1) && is_power_of_two(image.get_y_size() - 1)) { + if (is_power_of_two(image.get_x_size() - 1) && + is_power_of_two(image.get_y_size() - 1)) { _heightfield = image; _is_dirty = true; _xsize = _heightfield.get_x_size(); _ysize = _heightfield.get_y_size(); return true; } else { - grutil_cat.error() << "Specified image does not have a power-of-two-plus-one size!\n"; + grutil_cat.error() + << "Specified image does not have a power-of-two-plus-one size!\n"; } return false; } -INLINE bool GeoMipTerrain:: -set_heightfield(const string &path) { - return set_heightfield(Filename(path)); -} - //////////////////////////////////////////////////////////////////// // Function: GeoMipTerrain::set_color_map // Access: Published diff --git a/panda/src/grutil/geoMipTerrain.cxx b/panda/src/grutil/geoMipTerrain.cxx index f5ff072fca..145ba37131 100644 --- a/panda/src/grutil/geoMipTerrain.cxx +++ b/panda/src/grutil/geoMipTerrain.cxx @@ -55,15 +55,16 @@ generate_block(unsigned short mx, // Create the format PT(GeomVertexArrayFormat) array = new GeomVertexArrayFormat(); if (_has_color_map) { - array->add_column(InternalName::make("color"), 4, - Geom::NT_stdfloat, Geom::C_color); + array->add_column(InternalName::get_color(), 4, + Geom::NT_stdfloat, Geom::C_color); } - array->add_column(InternalName::make("vertex"), 3, - Geom::NT_stdfloat, Geom::C_point); - array->add_column(InternalName::make("texcoord"), 2, - Geom::NT_stdfloat, Geom::C_texcoord); - array->add_column(InternalName::make("normal"), 3, - Geom::NT_stdfloat, Geom::C_vector); + array->add_column(InternalName::get_vertex(), 3, + Geom::NT_stdfloat, Geom::C_point); + array->add_column(InternalName::get_texcoord(), 2, + Geom::NT_stdfloat, Geom::C_texcoord); + array->add_column(InternalName::get_normal(), 3, + Geom::NT_stdfloat, Geom::C_vector); + PT(GeomVertexFormat) format = new GeomVertexFormat(); format->add_array(array); @@ -73,11 +74,11 @@ generate_block(unsigned short mx, vdata->unclean_set_num_rows((_block_size + 1) * (_block_size + 1)); GeomVertexWriter cwriter; if (_has_color_map) { - cwriter = GeomVertexWriter(vdata, "color"); + cwriter = GeomVertexWriter(vdata, InternalName::get_color()); } - GeomVertexWriter vwriter (vdata, "vertex" ); - GeomVertexWriter twriter (vdata, "texcoord"); - GeomVertexWriter nwriter (vdata, "normal" ); + GeomVertexWriter vwriter (vdata, InternalName::get_vertex()); + GeomVertexWriter twriter (vdata, InternalName::get_texcoord()); + GeomVertexWriter nwriter (vdata, InternalName::get_normal()); PT(GeomTriangles) prim = new GeomTriangles(Geom::UH_stream); if (_bruteforce) { @@ -109,20 +110,26 @@ generate_block(unsigned short mx, // This is the number of vertices at the certain level. unsigned short lowblocksize = _block_size / level + 1; + PN_stdfloat cmap_xratio = _color_map.get_x_size() / (PN_stdfloat)_xsize; + PN_stdfloat cmap_yratio = _color_map.get_y_size() / (PN_stdfloat)_ysize; + + PN_stdfloat tc_xscale = 1.0f / PN_stdfloat(_xsize - 1); + PN_stdfloat tc_yscale = 1.0f / PN_stdfloat(_ysize - 1); + for (int x = 0; x <= _block_size; x++) { for (int y = 0; y <= _block_size; y++) { if ((x % level) == 0 && (y % level) == 0) { if (_has_color_map) { - LVecBase4f color = _color_map.get_xel_a(int((mx * _block_size + x) - / double(_xsize) * _color_map.get_x_size()), - int((my * _block_size + y) - / double(_ysize) * _color_map.get_y_size())); + LVecBase4f color = _color_map.get_xel_a( + int((mx * _block_size + x) * cmap_xratio), + int((my * _block_size + y) * cmap_yratio)); cwriter.add_data4f(color); } vwriter.add_data3(x - 0.5 * _block_size, y - 0.5 * _block_size, get_pixel_value(mx, my, x, y)); - twriter.add_data2((mx * _block_size + x) / double(_xsize - 1), - (my * _block_size + y) / double(_ysize - 1)); + twriter.add_data2((mx * _block_size + x) * tc_xscale, + (my * _block_size + y) * tc_yscale); nwriter.add_data3(get_normal(mx, my, x, y)); + if (x > 0 && y > 0) { // Left border if (x == level && ljunction) { @@ -654,22 +661,32 @@ set_heightfield(const Filename &filename, PNMFileType *ftype) { // Copy over the header to the heightfield image. _heightfield.copy_header_from(imgheader); - if(!is_power_of_two(imgheader.get_x_size() - 1) || !is_power_of_two(imgheader.get_y_size() - 1)) { + if (!is_power_of_two(imgheader.get_x_size() - 1) || + !is_power_of_two(imgheader.get_y_size() - 1)) { // Calculate the nearest power-of-two-plus-one size. unsigned int reqx, reqy; reqx = max(3, (int) pow(2.0, ceil(log((double) max(2, imgheader.get_x_size() - 1)) / log(2.0))) + 1); reqy = max(3, (int) pow(2.0, ceil(log((double) max(2, imgheader.get_y_size() - 1)) / log(2.0))) + 1); // If it's not a valid size, tell PNMImage to resize it. - if (reqx != (unsigned int)imgheader.get_x_size() || reqy != (unsigned int)imgheader.get_y_size()) { + if (reqx != (unsigned int)imgheader.get_x_size() || + reqy != (unsigned int)imgheader.get_y_size()) { grutil_cat.warning() - << "Rescaling heightfield image " << filename - << " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size() - << " to " << reqx << "x" << reqy << " pixels.\n"; + << "Rescaling heightfield image " << filename + << " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size() + << " to " << reqx << "x" << reqy << " pixels.\n"; _heightfield.set_read_size(reqx, reqy); } } + if (imgheader.get_color_space() == CS_sRGB) { + // Probably a mistaken metadata setting on the file. + grutil_cat.warning() + << "Heightfield image is specified to have sRGB color space!\n" + "Panda applies gamma correction, which will probably cause " + "it to produce incorrect results.\n"; + } + // Read the real image now if (!_heightfield.read(filename, ftype)) { _heightfield.clear_read_size(); diff --git a/panda/src/grutil/geoMipTerrain.h b/panda/src/grutil/geoMipTerrain.h index 9b7f5d7274..3719f50283 100644 --- a/panda/src/grutil/geoMipTerrain.h +++ b/panda/src/grutil/geoMipTerrain.h @@ -45,7 +45,6 @@ PUBLISHED: INLINE PNMImage &heightfield(); bool set_heightfield(const Filename &filename, PNMFileType *type = NULL); INLINE bool set_heightfield(const PNMImage &image); - INLINE bool set_heightfield(const string &path); INLINE PNMImage &color_map(); INLINE bool set_color_map(const Filename &filename, PNMFileType *type = NULL); From 426fdf08424414464176c26c712a0afcbcf596a9 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 31 Mar 2015 22:34:28 +0200 Subject: [PATCH 22/73] Fix issue where overloads with invalid default arg types weren't exported at all --- .../interfaceMakerPythonNative.cxx | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 0835387141..a35f8c0fb4 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -4475,15 +4475,23 @@ write_function_instance(ostream &out, FunctionRemap *remap, // Now convert (the rest of the) actual arguments, one by one. for (; pn < num_params; ++pn) { - if (pn > 0) { - expected_params += ", "; + ParameterRemap *param = remap->_parameters[pn]._remap; + CPPType *orig_type = param->get_orig_type(); + CPPType *type = param->get_new_type(); + CPPExpression *default_value = param->get_default_value(); + string param_name = remap->get_parameter_name(pn); + + if (!is_cpp_type_legal(orig_type)) { + // We can't wrap this. We sometimes get here for default arguments. + // Just skip this parameter. + continue; } - bool is_optional = false; // Has this remap been selected to consider optional arguments for // this parameter? We can do that by adding a vertical bar to the // PyArg_ParseTuple format string, coupled with some extra logic // in the argument handling, below. + bool is_optional = false; if (remap->_has_this && !is_constructor) { if (pn > min_num_args) { is_optional = true; @@ -4500,11 +4508,9 @@ write_function_instance(ostream &out, FunctionRemap *remap, } } - ParameterRemap *param = remap->_parameters[pn]._remap; - CPPType *orig_type = param->get_orig_type(); - CPPType *type = param->get_new_type(); - CPPExpression *default_value = param->get_default_value(); - string param_name = remap->get_parameter_name(pn); + if (pn > 0) { + expected_params += ", "; + } // This is the string to convert our local variable to the // appropriate C++ type. Normally this is just a cast. @@ -6432,10 +6438,11 @@ is_remap_legal(FunctionRemap *remap) { return false; } - // all params must be legal + // all non-optional params must be legal for (int pn = 0; pn < (int)remap->_parameters.size(); pn++) { - CPPType *orig_type = remap->_parameters[pn]._remap->get_orig_type(); - if (!is_cpp_type_legal(orig_type)) { + ParameterRemap *param = remap->_parameters[pn]._remap; + CPPType *orig_type = param->get_orig_type(); + if (param->get_default_value() == NULL && !is_cpp_type_legal(orig_type)) { return false; } } From b7840fed068e217b027608dcff64e8afd18b406f Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 1 Apr 2015 00:22:03 +0200 Subject: [PATCH 23/73] Fix compile errors and warnings with mayapath.cxx --- makepanda/makepanda.py | 12 +++++------ pandatool/src/mayaprogs/mayapath.cxx | 32 ++++++++++++++++------------ 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index b6c3682898..8c1d8038dd 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -5973,19 +5973,19 @@ for VER in MAYAVERSIONS: TargetAdd('mayapath'+VNUM+'.obj', opts=OPTS, input='mayapath.cxx') TargetAdd('maya2egg'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') - TargetAdd('maya2egg'+VNUM+'.exe', opts=['ADVAPI']) - TargetAdd('maya2egg'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) TargetAdd('maya2egg'+VNUM+'.exe', input='libpandaexpress.dll') + TargetAdd('maya2egg'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) + TargetAdd('maya2egg'+VNUM+'.exe', opts=['ADVAPI']+VER_OPTS) TargetAdd('egg2maya'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') - TargetAdd('egg2maya'+VNUM+'.exe', opts=['ADVAPI']) - TargetAdd('egg2maya'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) TargetAdd('egg2maya'+VNUM+'.exe', input='libpandaexpress.dll') + TargetAdd('egg2maya'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) + TargetAdd('egg2maya'+VNUM+'.exe', opts=['ADVAPI']+VER_OPTS) TargetAdd('mayacopy'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') - TargetAdd('mayacopy'+VNUM+'.exe', opts=['ADVAPI']) - TargetAdd('mayacopy'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) TargetAdd('mayacopy'+VNUM+'.exe', input='libpandaexpress.dll') + TargetAdd('mayacopy'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) + TargetAdd('mayacopy'+VNUM+'.exe', opts=['ADVAPI']+VER_OPTS) # # DIRECTORY: contrib/src/ai/ diff --git a/pandatool/src/mayaprogs/mayapath.cxx b/pandatool/src/mayaprogs/mayapath.cxx index 5a89e20361..f123d0ccaf 100755 --- a/pandatool/src/mayaprogs/mayapath.cxx +++ b/pandatool/src/mayaprogs/mayapath.cxx @@ -78,7 +78,11 @@ find_pyzip(const Filename &maya_location) { return Filename(); } -struct { char *ver, *key; } maya_versions[] = { +struct MayaVerInfo { + const char *ver, *key; +}; + +struct MayaVerInfo maya_versions[] = { { "MAYA6", "6.0" }, { "MAYA65", "6.5" }, { "MAYA7", "7.0" }, @@ -96,10 +100,10 @@ struct { char *ver, *key; } maya_versions[] = { { 0, 0 }, }; -static char * +static const char * get_version_number(const char *ver) { - for (int i=0; maya_versions[i].ver != 0; i++) { - if (strcmp(maya_versions[i].ver, ver)==0) { + for (int i = 0; maya_versions[i].ver != 0; ++i) { + if (strcmp(maya_versions[i].ver, ver) == 0) { return maya_versions[i].key; } } @@ -124,7 +128,7 @@ get_maya_location(const char *ver, string &loc) { HKEY hkey; res = RegOpenKeyEx(HKEY_LOCAL_MACHINE, fullkey, 0, KEY_READ | (hive ? 256:0), &hkey); if (res == ERROR_SUCCESS) { - DWORD dtype; + DWORD dtype; DWORD size = 4096; char result[4096 + 1]; res = RegQueryValueEx(hkey, "MAYA_INSTALL_LOCATION", NULL, &dtype, (LPBYTE)result, &size); @@ -176,7 +180,7 @@ get_maya_location(const char *ver, string &loc) { #endif // _WIN32 -int +int main(int argc, char *argv[]) { // First, get the command line and append _bin, so we will actually // run maya2egg_bin.exe, egg2maya_bin.exe, etc. @@ -246,7 +250,7 @@ main(int argc, char *argv[]) { maya_location.make_canonical(); maya_location = Filename::from_os_specific(maya_location.to_os_long_name()); } - + if (maya_location.empty()) { // If it is not set, we use the standard version instead. maya_location = standard_maya_location; @@ -322,12 +326,12 @@ main(int argc, char *argv[]) { cerr << "The directory referred to by $MAYA_LOCATION does not exist!\n"; exit(1); } - + // Look for OpenMaya.dll as a sanity check. Filename openmaya = Filename::dso_filename(Filename(maya_location, openmaya_filename)); if (!openmaya.is_regular_file()) { cerr << "Could not find $MAYA_LOCATION/" << Filename::dso_filename(openmaya_filename).to_os_specific() << "!\n"; - exit(1); + exit(1); } // Re-set MAYA_LOCATION to its properly sanitized form. @@ -376,7 +380,7 @@ main(int argc, char *argv[]) { // Also put the Maya bin directory on the PATH. Filename bin = Filename(maya_location, "bin"); if (bin.is_directory()) { - char *path = getenv("PATH"); + const char *path = getenv("PATH"); if (path == NULL) { path = ""; } @@ -388,7 +392,7 @@ main(int argc, char *argv[]) { #ifdef IS_OSX // And on DYLD_LIBRARY_PATH. if (bin.is_directory()) { - char *path = getenv("DYLD_LIBRARY_PATH"); + const char *path = getenv("DYLD_LIBRARY_PATH"); if (path == NULL) { path = ""; } @@ -401,7 +405,7 @@ main(int argc, char *argv[]) { #elif !defined(_WIN32) // Linux (or other non-Windows OS) gets it added to LD_LIBRARY_PATH. if (bin.is_directory()) { - char *path = getenv("LD_LIBRARY_PATH"); + const char *path = getenv("LD_LIBRARY_PATH"); if (path == NULL) { path = ""; } @@ -416,7 +420,7 @@ main(int argc, char *argv[]) { // When this is set, Panda3D will try not to use any functions from the // CPython API. This is necessary because Maya links with its own copy // of Python, which may be incompatible with ours. - putenv("PANDA_INCOMPATIBLE_PYTHON=1"); + putenv((char *)"PANDA_INCOMPATIBLE_PYTHON=1"); // Now that we have set up the environment variables properly, chain // to the actual maya2egg_bin (or whichever) executable. @@ -428,7 +432,7 @@ main(int argc, char *argv[]) { PROCESS_INFORMATION process_info; GetStartupInfo(&startup_info); BOOL result = CreateProcess(os_command.c_str(), - command_line, + command_line, NULL, NULL, true, 0, NULL, NULL, &startup_info, From d337573504f421537a35d11ea83d21fbc75ec90b Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 1 Apr 2015 00:57:48 +0200 Subject: [PATCH 24/73] Allow loading 64-bit Panda from 32-bit plug-in on Mac OS X --- direct/src/plugin/p3dInstanceManager.cxx | 26 +++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/direct/src/plugin/p3dInstanceManager.cxx b/direct/src/plugin/p3dInstanceManager.cxx index 27886267f0..b5536b8836 100644 --- a/direct/src/plugin/p3dInstanceManager.cxx +++ b/direct/src/plugin/p3dInstanceManager.cxx @@ -45,6 +45,10 @@ #include #endif +#ifdef __APPLE__ +#include +#endif + #include static ofstream logfile; @@ -230,9 +234,29 @@ initialize(int api_version, const string &contents_filename, _supported_platforms.push_back("win_i386"); _supported_platforms.push_back("win32"); } +#elif defined(__APPLE__) + if (_platform == "osx_amd64") { + _supported_platforms.push_back("osx_amd64"); + _supported_platforms.push_back("osx_i386"); + + } else if (_platform == "osx_i386") { + // This is a 32-bit process, but determine if the underlying OS + // supports 64-bit. + + int mib[2] = { CTL_HW, HW_MACHINE }; + char machine[512]; + size_t len = 511; + if (sysctl(mib, 2, (void *)machine, &len, NULL, 0) == 0) { + if (strcmp(machine, "x86_64") == 0) { + _supported_platforms.push_back("osx_amd64"); + } + } + + _supported_platforms.push_back("osx_i386"); + } #endif // _WIN32 - // TODO: OSX, Linux multiplatform support. Just add the + // TODO: Linux multiplatform support. Just add the // appropriate platform strings to _supported_platforms. } From 3f520cad0116550a25b885662c078a87250fb746 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 1 Apr 2015 02:40:59 +0200 Subject: [PATCH 25/73] Fix black screen when going to fullscreen on Mac OS X --- panda/src/cocoadisplay/cocoaGraphicsWindow.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm index bcc859f1a8..efe9849ff5 100644 --- a/panda/src/cocoadisplay/cocoaGraphicsWindow.mm +++ b/panda/src/cocoadisplay/cocoaGraphicsWindow.mm @@ -159,7 +159,7 @@ begin_frame(FrameMode mode, Thread *current_thread) { // Set the drawable. if (_properties.get_fullscreen()) { // Fullscreen. - [cocoagsg->_context setFullScreen]; + CGLSetFullScreenOnDisplay((CGLContextObj) [cocoagsg->_context CGLContextObj], CGDisplayIDToOpenGLDisplayMask(_display)); } else { // Although not recommended, it is technically possible to // use the same context with multiple different-sized windows. From 82b3268786b4b5540f2649a638fe8cb6ced1c431 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 1 Apr 2015 02:55:20 +0200 Subject: [PATCH 26/73] Prevent crash when OpenAL device creation fails --- panda/src/audiotraits/openalAudioManager.cxx | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/panda/src/audiotraits/openalAudioManager.cxx b/panda/src/audiotraits/openalAudioManager.cxx index e87ebee5f0..0a8faa896d 100644 --- a/panda/src/audiotraits/openalAudioManager.cxx +++ b/panda/src/audiotraits/openalAudioManager.cxx @@ -125,7 +125,7 @@ OpenALAudioManager() { alcGetError(_device); // clear errors _context = alcCreateContext(_device, NULL); alc_audio_errcheck("alcCreateContext(_device, NULL)",_device); - if (_context!=NULL) { + if (_context != NULL) { _openal_active = true; } } @@ -142,20 +142,24 @@ OpenALAudioManager() { } else { alcGetError(_device); // clear errors alcMakeContextCurrent(_context); - alc_audio_errcheck("alcMakeContextCurrent(_context)",_device); - + alc_audio_errcheck("alcMakeContextCurrent(_context)", _device); // set 3D sound characteristics as they are given in the configrc audio_3d_set_doppler_factor(audio_doppler_factor); audio_3d_set_distance_factor(audio_distance_factor); audio_3d_set_drop_off_factor(audio_drop_off_factor); + + if (audio_cat.is_debug()) { + audio_cat->debug() + << "ALC_DEVICE_SPECIFIER:" << alcGetString(_device, ALC_DEVICE_SPECIFIER) << endl; + } } - audio_cat->debug() << "ALC_DEVICE_SPECIFIER:" << alcGetString(_device, ALC_DEVICE_SPECIFIER) << endl; - audio_cat->debug() << "AL_RENDERER:" << alGetString(AL_RENDERER) << endl; - audio_cat->debug() << "AL_VENDOR:" << alGetString(AL_VENDOR) << endl; - audio_cat->debug() << "AL_VERSION:" << alGetString(AL_VERSION) << endl; - + if (audio_cat.is_debug()) { + audio_cat->debug() << "AL_RENDERER:" << alGetString(AL_RENDERER) << endl; + audio_cat->debug() << "AL_VENDOR:" << alGetString(AL_VENDOR) << endl; + audio_cat->debug() << "AL_VERSION:" << alGetString(AL_VERSION) << endl; + } } //////////////////////////////////////////////////////////////////// From 9f3b37d62fbddd5b461769729894889fa523e38e Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 1 Apr 2015 13:59:58 +0200 Subject: [PATCH 27/73] Fix FCollada include location issue --- makepanda/makepanda.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 8c1d8038dd..21efa7e66d 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -736,7 +736,7 @@ if (COMPILER=="GCC"): if (not RUNTIME): SmartPkgEnable("EIGEN", "eigen3", (), ("Eigen/Dense",), target_pkg = 'ALWAYS') SmartPkgEnable("ARTOOLKIT", "", ("AR"), "AR/ar.h") - SmartPkgEnable("FCOLLADA", "", ChooseLib(fcollada_libs, "FCOLLADA"), ("FCollada", "FCollada.h")) + SmartPkgEnable("FCOLLADA", "", ChooseLib(fcollada_libs, "FCOLLADA"), ("FCollada", "FCollada/FCollada.h")) SmartPkgEnable("FFMPEG", ffmpeg_libs, ffmpeg_libs, ffmpeg_libs) SmartPkgEnable("SWSCALE", "libswscale", "libswscale", ("libswscale", "libswscale/swscale.h"), target_pkg = "FFMPEG") SmartPkgEnable("SWRESAMPLE","libswresample", "libswresample", ("libswresample", "libswresample/swresample.h"), target_pkg = "FFMPEG") From 19e5677e1806eacc1f78ea32aa82d9e85e5976e7 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 1 Apr 2015 14:01:58 +0200 Subject: [PATCH 28/73] Let's increment coreapi version number to 1.0.4.2 --- doc/ReleaseNotes | 2 +- dtool/PandaVersion.pp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index f5bb47f440..64513c39d3 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -7,7 +7,7 @@ The list below contains a subset of the changes introduced: * We now offer 64-bit Windows and Mac OS X builds. * Switch to MSVC 2010; no more assembly manifests. -* Cocoa port for Mac OS X; 64-bit OS X support. +* Cocoa port for better Mac OS X support, esp. newer versions. * We now compile the Python modules into panda3d/*.pyd modules; no more imp.load_dynamic hackery needed. * Support for GPU profiling in OpenGL, see pstats-gpu-timing diff --git a/dtool/PandaVersion.pp b/dtool/PandaVersion.pp index bd44788d05..277912e546 100644 --- a/dtool/PandaVersion.pp +++ b/dtool/PandaVersion.pp @@ -44,5 +44,4 @@ // integers, but by convention it will consist of four integers, with // the first three matching the plugin version, and the fourth integer // being incremented with each new Core API revision. -#define P3D_COREAPI_VERSION $[P3D_PLUGIN_VERSION] 1 - +#define P3D_COREAPI_VERSION $[P3D_PLUGIN_VERSION] 2 From f7eb1db74c241f789ff196e2e85c3f1f4f8d6428 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Apr 2015 00:58:04 +0200 Subject: [PATCH 29/73] Fix symbol error when loading libp3ffmpeg on Mac OS X --- makepanda/makepanda.py | 1 + 1 file changed, 1 insertion(+) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 21efa7e66d..c5906ae275 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -760,6 +760,7 @@ if (COMPILER=="GCC"): if GetTarget() == "darwin" and not PkgSkip("FFMPEG"): LibName("FFMPEG", "-Wl,-read_only_relocs,suppress") + LibName("FFMPEG", "-framework VideoDecodeAcceleration") cv_lib = ChooseLib(("opencv_core", "cv"), "OPENCV") if cv_lib == "opencv_core": From fdcd8de59691b4da8e2cc6cbd09aa3d41f355193 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Apr 2015 01:34:45 +0200 Subject: [PATCH 30/73] Fix runtime issues running maya2egg on Mac OS X --- makepanda/makepanda.py | 34 ++++++++++++++-------------- pandatool/src/mayaprogs/mayapath.cxx | 26 +++++++++++++++++++++ 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index c5906ae275..e8e8af96cc 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -5884,15 +5884,15 @@ for VER in MAYAVERSIONS: VNUM = VER[4:] if not PkgSkip(VER) and not PkgSkip("PANDATOOL"): if GetTarget() == 'darwin' and int(VNUM) >= 2012: - VER_OPTS = ['NOARCH:PPC', 'NOARCH:I386', VER] + ARCH_OPTS = ['NOARCH:PPC', 'NOARCH:I386'] if len(OSX_ARCHS) != 0 and 'x86_64' not in OSX_ARCHS: continue elif GetTarget() == 'darwin' and int(VNUM) >= 2009: - VER_OPTS = ['NOARCH:PPC', VER] + ARCH_OPTS = ['NOARCH:PPC'] else: - VER_OPTS = [VER] + ARCH_OPTS = [] - OPTS=['DIR:pandatool/src/mayaprogs', 'DIR:pandatool/src/maya', 'DIR:pandatool/src/mayaegg', 'DIR:pandatool/src/cvscopy', 'BUILDING:MISC'] + VER_OPTS + OPTS=['DIR:pandatool/src/mayaprogs', 'DIR:pandatool/src/maya', 'DIR:pandatool/src/mayaegg', 'DIR:pandatool/src/cvscopy', 'BUILDING:MISC', VER] + ARCH_OPTS TargetAdd('mayaeggimport'+VNUM+'_mayaeggimport.obj', opts=OPTS, input='mayaEggImport.cxx') TargetAdd('mayaeggimport'+VNUM+'.mll', input='mayaegg'+VNUM+'_loader.obj') TargetAdd('mayaeggimport'+VNUM+'.mll', input='mayaeggimport'+VNUM+'_mayaeggimport.obj') @@ -5900,7 +5900,7 @@ for VER in MAYAVERSIONS: TargetAdd('mayaeggimport'+VNUM+'.mll', input=COMMON_PANDA_LIBS) if GetTarget() == 'windows': TargetAdd('mayaeggimport'+VNUM+'.mll', input='libp3pystub.lib') - TargetAdd('mayaeggimport'+VNUM+'.mll', opts=['ADVAPI']+VER_OPTS) + TargetAdd('mayaeggimport'+VNUM+'.mll', opts=['ADVAPI', VER]+ARCH_OPTS) TargetAdd('mayaloader'+VNUM+'_config_mayaloader.obj', opts=OPTS, input='config_mayaloader.cxx') TargetAdd('libp3mayaloader'+VNUM+'.dll', input='mayaloader'+VNUM+'_config_mayaloader.obj') @@ -5924,7 +5924,7 @@ for VER in MAYAVERSIONS: TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libp3pandatoolbase.lib') TargetAdd('libp3mayaloader'+VNUM+'.dll', input='libpandaegg.dll') TargetAdd('libp3mayaloader'+VNUM+'.dll', input=COMMON_PANDA_LIBS) - TargetAdd('libp3mayaloader'+VNUM+'.dll', opts=['ADVAPI']+VER_OPTS) + TargetAdd('libp3mayaloader'+VNUM+'.dll', opts=['ADVAPI', VER]+ARCH_OPTS) TargetAdd('mayapview'+VNUM+'_mayaPview.obj', opts=OPTS, input='mayaPview.cxx') TargetAdd('libmayapview'+VNUM+'.mll', input='mayapview'+VNUM+'_mayaPview.obj') @@ -5935,7 +5935,7 @@ for VER in MAYAVERSIONS: TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('libmayapview'+VNUM+'.mll', input=COMMON_EGG2X_LIBS) - TargetAdd('libmayapview'+VNUM+'.mll', opts=['ADVAPI']+VER_OPTS) + TargetAdd('libmayapview'+VNUM+'.mll', opts=['ADVAPI', VER]+ARCH_OPTS) TargetAdd('maya2egg'+VNUM+'_mayaToEgg.obj', opts=OPTS, input='mayaToEgg.cxx') TargetAdd('maya2egg'+VNUM+'_bin.exe', input='maya2egg'+VNUM+'_mayaToEgg.obj') @@ -5945,7 +5945,7 @@ for VER in MAYAVERSIONS: TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('maya2egg'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI']+VER_OPTS) + TargetAdd('maya2egg'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS) TargetAdd('egg2maya'+VNUM+'_eggToMaya.obj', opts=OPTS, input='eggToMaya.cxx') TargetAdd('egg2maya'+VNUM+'_bin.exe', input='egg2maya'+VNUM+'_eggToMaya.obj') @@ -5955,7 +5955,7 @@ for VER in MAYAVERSIONS: TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('egg2maya'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI']+VER_OPTS) + TargetAdd('egg2maya'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS) TargetAdd('mayacopy'+VNUM+'_mayaCopy.obj', opts=OPTS, input='mayaCopy.cxx') TargetAdd('mayacopy'+VNUM+'_bin.exe', input='mayacopy'+VNUM+'_mayaCopy.obj') @@ -5965,28 +5965,28 @@ for VER in MAYAVERSIONS: TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS_PYSTUB) else: TargetAdd('mayacopy'+VNUM+'_bin.exe', input=COMMON_EGG2X_LIBS) - TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI']+VER_OPTS) + TargetAdd('mayacopy'+VNUM+'_bin.exe', opts=['ADVAPI', VER]+ARCH_OPTS) TargetAdd('mayasavepview'+VNUM+'_mayaSavePview.obj', opts=OPTS, input='mayaSavePview.cxx') TargetAdd('libmayasavepview'+VNUM+'.mll', input='mayasavepview'+VNUM+'_mayaSavePview.obj') - TargetAdd('libmayasavepview'+VNUM+'.mll', opts=['ADVAPI']+VER_OPTS) + TargetAdd('libmayasavepview'+VNUM+'.mll', opts=['ADVAPI', VER]+ARCH_OPTS) TargetAdd('mayapath'+VNUM+'.obj', opts=OPTS, input='mayapath.cxx') TargetAdd('maya2egg'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') TargetAdd('maya2egg'+VNUM+'.exe', input='libpandaexpress.dll') - TargetAdd('maya2egg'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) - TargetAdd('maya2egg'+VNUM+'.exe', opts=['ADVAPI']+VER_OPTS) + TargetAdd('maya2egg'+VNUM+'.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('maya2egg'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS) TargetAdd('egg2maya'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') TargetAdd('egg2maya'+VNUM+'.exe', input='libpandaexpress.dll') - TargetAdd('egg2maya'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) - TargetAdd('egg2maya'+VNUM+'.exe', opts=['ADVAPI']+VER_OPTS) + TargetAdd('egg2maya'+VNUM+'.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('egg2maya'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS) TargetAdd('mayacopy'+VNUM+'.exe', input='mayapath'+VNUM+'.obj') TargetAdd('mayacopy'+VNUM+'.exe', input='libpandaexpress.dll') - TargetAdd('mayacopy'+VNUM+'.exe', input=COMMON_DTOOL_LIBS) - TargetAdd('mayacopy'+VNUM+'.exe', opts=['ADVAPI']+VER_OPTS) + TargetAdd('mayacopy'+VNUM+'.exe', input=COMMON_DTOOL_LIBS_PYSTUB) + TargetAdd('mayacopy'+VNUM+'.exe', opts=['ADVAPI']+ARCH_OPTS) # # DIRECTORY: contrib/src/ai/ diff --git a/pandatool/src/mayaprogs/mayapath.cxx b/pandatool/src/mayaprogs/mayapath.cxx index f123d0ccaf..a7eba240b2 100755 --- a/pandatool/src/mayaprogs/mayapath.cxx +++ b/pandatool/src/mayaprogs/mayapath.cxx @@ -50,6 +50,10 @@ #include #endif +#ifdef HAVE_PYTHON +#include "pystub.h" +#endif + #define QUOTESTR(x) #x #define TOSTRING(x) QUOTESTR(x) @@ -182,6 +186,11 @@ get_maya_location(const char *ver, string &loc) { int main(int argc, char *argv[]) { +#ifdef HAVE_PYTHON + // Force pystub to be linked in. + pystub(); +#endif + // First, get the command line and append _bin, so we will actually // run maya2egg_bin.exe, egg2maya_bin.exe, etc. Filename command = Filename::from_os_specific(argv[0]); @@ -378,7 +387,11 @@ main(int argc, char *argv[]) { } // Also put the Maya bin directory on the PATH. +#ifdef IS_OSX + Filename bin = Filename(maya_location, "MacOS"); +#else Filename bin = Filename(maya_location, "bin"); +#endif if (bin.is_directory()) { const char *path = getenv("PATH"); if (path == NULL) { @@ -402,6 +415,19 @@ main(int argc, char *argv[]) { putenv(putenv_cstr); } + // We also have to give it a way to find the Maya frameworks. + Filename fw_dir = Filename(maya_location, "Frameworks"); + if (fw_dir.is_directory()) { + const char *path = getenv("DYLD_FALLBACK_FRAMEWORK_PATH"); + if (path == NULL) { + path = ""; + } + string sep = ":"; + string putenv_str = "DYLD_FALLBACK_FRAMEWORK_PATH=" + fw_dir.to_os_specific() + sep + path; + char *putenv_cstr = strdup(putenv_str.c_str()); + putenv(putenv_cstr); + } + #elif !defined(_WIN32) // Linux (or other non-Windows OS) gets it added to LD_LIBRARY_PATH. if (bin.is_directory()) { From 89acd29463a64990f3a8993cbeda1613136058b9 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 2 Apr 2015 11:30:08 +0200 Subject: [PATCH 31/73] Fixed unitialized variable in maya2egg --- pandatool/src/mayaegg/mayaNodeTree.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandatool/src/mayaegg/mayaNodeTree.cxx b/pandatool/src/mayaegg/mayaNodeTree.cxx index 9c577bc111..06249d93fd 100755 --- a/pandatool/src/mayaegg/mayaNodeTree.cxx +++ b/pandatool/src/mayaegg/mayaNodeTree.cxx @@ -656,7 +656,7 @@ r_build_node(const string &path) { // Otherwise, we have to create it. Do this recursively, so we // create each node along the path. - MayaNodeDesc *node_desc; + MayaNodeDesc *node_desc = NULL; //mayaegg_cat.info() << "path: " << path << endl; if (path.empty()) { From 87451d80009c48e104c2371523784d8f644902e2 Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 3 Apr 2015 14:15:23 +0200 Subject: [PATCH 32/73] Support wireframe and point rendering modes in OpenGL ES --- panda/src/display/standardMunger.I | 13 ++++++ panda/src/display/standardMunger.h | 2 + panda/src/glstuff/glGeomMunger_src.cxx | 44 +++++++++++++++++++ panda/src/glstuff/glGeomMunger_src.h | 6 +++ panda/src/gobj/geom.I | 13 ++++++ panda/src/gobj/geom.cxx | 38 ++++++++++++++++ panda/src/gobj/geom.h | 2 + panda/src/gobj/geomPrimitive.cxx | 60 ++++++++++++++++++++++++++ panda/src/gobj/geomPrimitive.h | 1 + 9 files changed, 179 insertions(+) diff --git a/panda/src/display/standardMunger.I b/panda/src/display/standardMunger.I index 563385856a..17a973cb4c 100644 --- a/panda/src/display/standardMunger.I +++ b/panda/src/display/standardMunger.I @@ -23,3 +23,16 @@ INLINE GraphicsStateGuardian *StandardMunger:: get_gsg() const { return (GraphicsStateGuardian *)GeomMunger::get_gsg(); } + +//////////////////////////////////////////////////////////////////// +// Function: StandardMunger::get_render_mode +// Access: Protected +// Description: Returns the render mode active on this munger. +// Intended for derived classes that may have to munge +// differently depending on render mode. +//////////////////////////////////////////////////////////////////// +INLINE RenderModeAttrib::Mode StandardMunger:: +get_render_mode() const { + return (_render_mode != NULL) ? _render_mode->get_mode() + : RenderModeAttrib::M_filled; +} diff --git a/panda/src/display/standardMunger.h b/panda/src/display/standardMunger.h index 1e2b8ef024..872d2d8403 100644 --- a/panda/src/display/standardMunger.h +++ b/panda/src/display/standardMunger.h @@ -49,6 +49,8 @@ protected: virtual int geom_compare_to_impl(const GeomMunger *other) const; virtual CPT(RenderState) munge_state_impl(const RenderState *state); + INLINE RenderModeAttrib::Mode get_render_mode() const; + private: int _num_components; NumericType _numeric_type; diff --git a/panda/src/glstuff/glGeomMunger_src.cxx b/panda/src/glstuff/glGeomMunger_src.cxx index b4da760703..b2deb6e29f 100644 --- a/panda/src/glstuff/glGeomMunger_src.cxx +++ b/panda/src/glstuff/glGeomMunger_src.cxx @@ -362,6 +362,45 @@ premunge_format_impl(const GeomVertexFormat *orig) { return format; } +#ifdef OPENGLES +//////////////////////////////////////////////////////////////////// +// Function: CLP(GeomMunger)::munge_geom_impl +// Access: Protected, Virtual +// Description: Converts a Geom and/or its data as necessary. +//////////////////////////////////////////////////////////////////// +void CLP(GeomMunger):: +munge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &vertex_data, + Thread *current_thread) { + StandardMunger::munge_geom_impl(geom, vertex_data, current_thread); + + // OpenGL ES has no polygon mode, so we have to emulate it. + RenderModeAttrib::Mode render_mode = get_render_mode(); + if (render_mode == RenderModeAttrib::M_point) { + geom = geom->make_points(); + } else if (render_mode == RenderModeAttrib::M_wireframe) { + geom = geom->make_lines(); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: CLP(GeomMunger)::premunge_geom_impl +// Access: Protected, Virtual +// Description: Converts a Geom and/or its data as necessary. +//////////////////////////////////////////////////////////////////// +void CLP(GeomMunger):: +premunge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &vertex_data) { + StandardMunger::premunge_geom_impl(geom, vertex_data); + + // OpenGL ES has no polygon mode, so we have to emulate it. + RenderModeAttrib::Mode render_mode = get_render_mode(); + if (render_mode == RenderModeAttrib::M_point) { + geom = geom->make_points(); + } else if (render_mode == RenderModeAttrib::M_wireframe) { + geom = geom->make_lines(); + } +} +#endif // OPENGLES + //////////////////////////////////////////////////////////////////// // Function: CLP(GeomMunger)::compare_to_impl // Access: Protected, Virtual @@ -397,6 +436,11 @@ compare_to_impl(const GeomMunger *other) const { int CLP(GeomMunger):: geom_compare_to_impl(const GeomMunger *other) const { const CLP(GeomMunger) *om = DCAST(CLP(GeomMunger), other); +#ifdef OPENGLES + if (get_render_mode() != om->get_render_mode()) { + return get_render_mode() < om->get_render_mode() ? -1 : 1; + } +#endif if (_texture != om->_texture) { return _texture < om->_texture ? -1 : 1; } diff --git a/panda/src/glstuff/glGeomMunger_src.h b/panda/src/glstuff/glGeomMunger_src.h index ac3275e859..0c2eaabc8b 100644 --- a/panda/src/glstuff/glGeomMunger_src.h +++ b/panda/src/glstuff/glGeomMunger_src.h @@ -42,6 +42,12 @@ protected: const GeomVertexAnimationSpec &animation); virtual CPT(GeomVertexFormat) premunge_format_impl(const GeomVertexFormat *orig); +#ifdef OPENGLES + virtual void munge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &data, + Thread *current_thread); + virtual void premunge_geom_impl(CPT(Geom) &geom, CPT(GeomVertexData) &data); +#endif + virtual int compare_to_impl(const GeomMunger *other) const; virtual int geom_compare_to_impl(const GeomMunger *other) const; diff --git a/panda/src/gobj/geom.I b/panda/src/gobj/geom.I index 45d911d2ce..823e9798a4 100644 --- a/panda/src/gobj/geom.I +++ b/panda/src/gobj/geom.I @@ -242,6 +242,19 @@ make_points() const { return new_geom; } +//////////////////////////////////////////////////////////////////// +// Function: Geom::make_lines +// Access: Published +// Description: Returns a new Geom with lines at all the edges. +// See GeomPrimitive::make_lines(). +//////////////////////////////////////////////////////////////////// +INLINE PT(Geom) Geom:: +make_lines() const { + PT(Geom) new_geom = make_copy(); + new_geom->make_lines_in_place(); + return new_geom; +} + //////////////////////////////////////////////////////////////////// // Function: Geom::make_patches // Access: Published diff --git a/panda/src/gobj/geom.cxx b/panda/src/gobj/geom.cxx index 92ef2e063f..fe82255c6e 100644 --- a/panda/src/gobj/geom.cxx +++ b/panda/src/gobj/geom.cxx @@ -750,6 +750,44 @@ unify_in_place(int max_indices, bool preserve_order) { reset_geom_rendering(cdata); } +//////////////////////////////////////////////////////////////////// +// Function: Geom::make_lines_in_place +// Access: Published +// Description: Replaces the GeomPrimitives within this Geom with +// corresponding GeomLines, representing a wireframe +// of the primitives. See GeomPrimitive::make_lines(). +// +// Don't call this in a downstream thread unless you +// don't mind it blowing away other changes you might +// have recently made in an upstream thread. +//////////////////////////////////////////////////////////////////// +void Geom:: +make_lines_in_place() { + Thread *current_thread = Thread::get_current_thread(); + CDWriter cdata(_cycler, true, current_thread); + +#ifndef NDEBUG + bool all_is_valid = true; +#endif + Primitives::iterator pi; + for (pi = cdata->_primitives.begin(); pi != cdata->_primitives.end(); ++pi) { + CPT(GeomPrimitive) new_prim = (*pi).get_read_pointer()->make_lines(); + (*pi) = (GeomPrimitive *)new_prim.p(); + +#ifndef NDEBUG + if (!new_prim->check_valid(cdata->_data.get_read_pointer())) { + all_is_valid = false; + } +#endif + } + + cdata->_modified = Geom::get_next_modified(); + reset_geom_rendering(cdata); + clear_cache_stage(current_thread); + + nassertv(all_is_valid); +} + //////////////////////////////////////////////////////////////////// // Function: Geom::make_points_in_place // Access: Published diff --git a/panda/src/gobj/geom.h b/panda/src/gobj/geom.h index aa890a404f..35337bbfcc 100644 --- a/panda/src/gobj/geom.h +++ b/panda/src/gobj/geom.h @@ -102,6 +102,7 @@ PUBLISHED: INLINE PT(Geom) rotate() const; INLINE PT(Geom) unify(int max_indices, bool preserve_order) const; INLINE PT(Geom) make_points() const; + INLINE PT(Geom) make_lines() const; INLINE PT(Geom) make_patches() const; void decompose_in_place(); @@ -110,6 +111,7 @@ PUBLISHED: void rotate_in_place(); void unify_in_place(int max_indices, bool preserve_order); void make_points_in_place(); + void make_lines_in_place(); void make_patches_in_place(); virtual bool copy_primitives_from(const Geom *other); diff --git a/panda/src/gobj/geomPrimitive.cxx b/panda/src/gobj/geomPrimitive.cxx index ede9dc71a6..83ae80b266 100644 --- a/panda/src/gobj/geomPrimitive.cxx +++ b/panda/src/gobj/geomPrimitive.cxx @@ -1044,6 +1044,66 @@ make_points() const { return points; } +//////////////////////////////////////////////////////////////////// +// Function: GeomPrimitive::make_lines +// Access: Published +// Description: Returns a new GeomLines primitive that represents +// each of the edges in the original primitive rendered +// as a line. If the original primitive is already a +// GeomLines primitive, returns the original primitive +// unchanged. +//////////////////////////////////////////////////////////////////// +CPT(GeomPrimitive) GeomPrimitive:: +make_lines() const { + if (is_exact_type(GeomLines::get_class_type())) { + return this; + } + + PrimitiveType prim_type = get_primitive_type(); + if (prim_type == PT_lines) { + // It's a line strip, just decompose it. + return decompose(); + + } else if (prim_type != PT_polygons && prim_type != PT_patches) { + // Don't know how to represent this in wireframe. + return this; + } + + if (prim_type == PT_polygons && !is_exact_type(GeomTriangles::get_class_type())) { + // Decompose tristrips. We could probably make this more efficient + // by making a specific implementation of make_lines for GeomTristrips. + return decompose()->make_lines(); + } + + // Iterate through the primitives. + int num_primitives = get_num_primitives(); + int verts_per_prim = get_num_vertices_per_primitive(); + + PT(GeomVertexArrayData) new_vertices = make_index_data(); + new_vertices->unclean_set_num_rows(num_primitives * verts_per_prim * 2); + + GeomVertexWriter new_index(new_vertices, 0); + + for (int i = 0; i < num_primitives; ++i) { + int begin = get_primitive_start(i); + int end = get_primitive_end(i); + if (begin == end) { + continue; + } + for (int vi = begin; vi < end - 1; vi++) { + new_index.set_data1i(get_vertex(vi)); + new_index.set_data1i(get_vertex(vi + 1)); + } + new_index.set_data1i(get_vertex(end - 1)); + new_index.set_data1i(get_vertex(begin)); + } + + PT(GeomPrimitive) lines = new GeomLines(UH_dynamic); + lines->set_vertices(new_vertices); + + return lines; +} + //////////////////////////////////////////////////////////////////// // Function: GeomPrimitive::make_patches // Access: Published diff --git a/panda/src/gobj/geomPrimitive.h b/panda/src/gobj/geomPrimitive.h index 1926625f5a..da787edad7 100644 --- a/panda/src/gobj/geomPrimitive.h +++ b/panda/src/gobj/geomPrimitive.h @@ -134,6 +134,7 @@ PUBLISHED: CPT(GeomPrimitive) reverse() const; CPT(GeomPrimitive) match_shade_model(ShadeModel shade_model) const; CPT(GeomPrimitive) make_points() const; + CPT(GeomPrimitive) make_lines() const; CPT(GeomPrimitive) make_patches() const; int get_num_bytes() const; From 44346769b4de62dc18c98e82e0d8f95f516f1854 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Apr 2015 14:59:31 +0200 Subject: [PATCH 33/73] Fix pstrtod bug with exponents --- dtool/src/dtoolbase/pstrtod.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dtool/src/dtoolbase/pstrtod.cxx b/dtool/src/dtoolbase/pstrtod.cxx index dbc19b94a0..19fa28b2e7 100644 --- a/dtool/src/dtoolbase/pstrtod.cxx +++ b/dtool/src/dtoolbase/pstrtod.cxx @@ -132,9 +132,9 @@ pstrtod(const char *nptr, char **endptr) { } if (esign == '-') { - value /= pow(evalue, 10.0); + value /= pow(10.0, evalue); } else { - value *= pow(evalue, 10.0); + value *= pow(10.0, evalue); } } } From 0082b7876ff20c2d3bf20085afce1ff4ed7edab2 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Apr 2015 15:59:12 +0200 Subject: [PATCH 34/73] Fix clang 3.5 compile warnings/errors --- panda/src/pnmimage/ppmcmap.cxx | 6 +++--- pandatool/src/dxf/dxfFile.cxx | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/panda/src/pnmimage/ppmcmap.cxx b/panda/src/pnmimage/ppmcmap.cxx index 071a40585c..c061bfbde5 100644 --- a/panda/src/pnmimage/ppmcmap.cxx +++ b/panda/src/pnmimage/ppmcmap.cxx @@ -83,7 +83,7 @@ ppm_computecolorhash(pixel** pixels, int* colorsP) { colorhash_table cht; - register pixel* pP; + pixel* pP; colorhist_list chl; int col, row, hash; @@ -141,8 +141,8 @@ ppm_addtocolorhash(colorhash_table cht, pixel* colorP, int value) { - register int hash; - register colorhist_list chl; + int hash; + colorhist_list chl; chl = (colorhist_list) malloc( sizeof(struct colorhist_list_item) ); if ( chl == 0 ) diff --git a/pandatool/src/dxf/dxfFile.cxx b/pandatool/src/dxf/dxfFile.cxx index 93a49dd8ef..aadf9d2879 100644 --- a/pandatool/src/dxf/dxfFile.cxx +++ b/pandatool/src/dxf/dxfFile.cxx @@ -585,20 +585,20 @@ get_group() { change_state(ST_error); return false; } - + // Now skip past exactly one newline character and any number of // other whitespace characters. - while (in!=0 && in.peek() != '\n') { + while (in && in.peek() != '\n') { in.get(); } in.get(); - while (in!=0 && isspace(in.peek()) && in.peek() != '\n') { + while (in && isspace(in.peek()) && in.peek() != '\n') { in.get(); } getline(in, _string); _string = trim_right(_string); - + if (!in) { change_state(ST_error); return false; From 41184b11895ce7db0a1382c69d8de87c59a4db74 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Apr 2015 18:48:55 +0200 Subject: [PATCH 35/73] Optimizations to improve start-up time (esp. in JavaScript) --- .../src/dtoolbase/p3dtoolbase_composite2.cxx | 1 + dtool/src/dtoolbase/pdtoa.c | 435 ++++++++++++++++++ dtool/src/dtoolbase/pdtoa.h | 24 + dtool/src/dtoolutil/string_utils.I | 78 ++++ dtool/src/dtoolutil/string_utils.h | 10 +- dtool/src/prc/configDeclaration.cxx | 20 +- dtool/src/prc/configVariableDouble.cxx | 6 +- dtool/src/prc/configVariableInt.cxx | 6 +- dtool/src/prc/configVariableInt64.cxx | 6 +- panda/src/gobj/texture.cxx | 12 +- panda/src/linmath/configVariableColor.cxx | 20 +- panda/src/linmath/dblnames.h | 5 + panda/src/linmath/fltnames.h | 5 + panda/src/linmath/intnames.h | 5 + panda/src/linmath/lmatrix3_src.cxx | 4 +- panda/src/linmath/lmatrix4_src.cxx | 8 +- panda/src/linmath/lorientation_src.cxx | 4 +- panda/src/linmath/lpoint2_src.cxx | 4 +- panda/src/linmath/lpoint3_src.cxx | 4 +- panda/src/linmath/lpoint4_src.cxx | 4 +- panda/src/linmath/lquaternion_src.cxx | 4 +- panda/src/linmath/lrotation_src.cxx | 4 +- panda/src/linmath/lvecBase2_src.cxx | 4 +- panda/src/linmath/lvecBase3_src.cxx | 4 +- panda/src/linmath/lvecBase4_src.cxx | 8 +- panda/src/linmath/lvector2_src.cxx | 4 +- panda/src/linmath/lvector3_src.cxx | 4 +- panda/src/linmath/lvector4_src.cxx | 4 +- panda/src/pstatclient/pStatClient.cxx | 17 + 29 files changed, 627 insertions(+), 87 deletions(-) create mode 100644 dtool/src/dtoolbase/pdtoa.c create mode 100644 dtool/src/dtoolbase/pdtoa.h diff --git a/dtool/src/dtoolbase/p3dtoolbase_composite2.cxx b/dtool/src/dtoolbase/p3dtoolbase_composite2.cxx index 3bac46d398..145c86d801 100644 --- a/dtool/src/dtoolbase/p3dtoolbase_composite2.cxx +++ b/dtool/src/dtoolbase/p3dtoolbase_composite2.cxx @@ -2,6 +2,7 @@ #include "mutexWin32Impl.cxx" #include "mutexSpinlockImpl.cxx" #include "neverFreeMemory.cxx" +#include "pdtoa.c" #include "pstrtod.cxx" #include "register_type.cxx" #include "typeHandle.cxx" diff --git a/dtool/src/dtoolbase/pdtoa.c b/dtool/src/dtoolbase/pdtoa.c new file mode 100644 index 0000000000..949e070b63 --- /dev/null +++ b/dtool/src/dtoolbase/pdtoa.c @@ -0,0 +1,435 @@ +/* +See pdtoa.h for explanation. + +Copyright (C) 2014 Milo Yip +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ + +#include "pdtoa.h" +#include "cmath.h" + +#include +#include +#include + +#if defined(_MSC_VER) +#include +#endif + +#define UINT64_C2(h, l) ((static_cast(h) << 32) | static_cast(l)) + +struct DiyFp { + DiyFp() {} + + DiyFp(uint64_t f, int e) : f(f), e(e) {} + + DiyFp(double d) { + union { + double d; + uint64_t u64; + } u = { d }; + + int biased_e = (u.u64 & kDpExponentMask) >> kDpSignificandSize; + uint64_t significand = (u.u64 & kDpSignificandMask); + if (biased_e != 0) { + f = significand + kDpHiddenBit; + e = biased_e - kDpExponentBias; + } + else { + f = significand; + e = kDpMinExponent + 1; + } + } + + DiyFp operator-(const DiyFp& rhs) const { + assert(e == rhs.e); + assert(f >= rhs.f); + return DiyFp(f - rhs.f, e); + } + + DiyFp operator*(const DiyFp& rhs) const { +#if defined(_MSC_VER) && defined(_M_AMD64) + uint64_t h; + uint64_t l = _umul128(f, rhs.f, &h); + if (l & (uint64_t(1) << 63)) // rounding + h++; + return DiyFp(h, e + rhs.e + 64); +#elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) + unsigned __int128 p = static_cast(f) * static_cast(rhs.f); + uint64_t h = p >> 64; + uint64_t l = static_cast(p); + if (l & (uint64_t(1) << 63)) // rounding + h++; + return DiyFp(h, e + rhs.e + 64); +#else + const uint64_t M32 = 0xFFFFFFFF; + const uint64_t a = f >> 32; + const uint64_t b = f & M32; + const uint64_t c = rhs.f >> 32; + const uint64_t d = rhs.f & M32; + const uint64_t ac = a * c; + const uint64_t bc = b * c; + const uint64_t ad = a * d; + const uint64_t bd = b * d; + uint64_t tmp = (bd >> 32) + (ad & M32) + (bc & M32); + tmp += 1U << 31; /// mult_round + return DiyFp(ac + (ad >> 32) + (bc >> 32) + (tmp >> 32), e + rhs.e + 64); +#endif + } + + DiyFp Normalize() const { +#if defined(_MSC_VER) && defined(_M_AMD64) + unsigned long index; + _BitScanReverse64(&index, f); + return DiyFp(f << (63 - index), e - (63 - index)); +#elif defined(__GNUC__) + int s = __builtin_clzll(f); + return DiyFp(f << s, e - s); +#else + DiyFp res = *this; + while (!(res.f & kDpHiddenBit)) { + res.f <<= 1; + res.e--; + } + res.f <<= (kDiySignificandSize - kDpSignificandSize - 1); + res.e = res.e - (kDiySignificandSize - kDpSignificandSize - 1); + return res; +#endif + } + + DiyFp NormalizeBoundary() const { +#if defined(_MSC_VER) && defined(_M_AMD64) + unsigned long index; + _BitScanReverse64(&index, f); + return DiyFp (f << (63 - index), e - (63 - index)); +#else + DiyFp res = *this; + while (!(res.f & (kDpHiddenBit << 1))) { + res.f <<= 1; + res.e--; + } + res.f <<= (kDiySignificandSize - kDpSignificandSize - 2); + res.e = res.e - (kDiySignificandSize - kDpSignificandSize - 2); + return res; +#endif + } + + void NormalizedBoundaries(DiyFp* minus, DiyFp* plus) const { + DiyFp pl = DiyFp((f << 1) + 1, e - 1).NormalizeBoundary(); + DiyFp mi = (f == kDpHiddenBit) ? DiyFp((f << 2) - 1, e - 2) : DiyFp((f << 1) - 1, e - 1); + mi.f <<= mi.e - pl.e; + mi.e = pl.e; + *plus = pl; + *minus = mi; + } + + static const int kDiySignificandSize = 64; + static const int kDpSignificandSize = 52; + static const int kDpExponentBias = 0x3FF + kDpSignificandSize; + static const int kDpMinExponent = -kDpExponentBias; + static const uint64_t kDpExponentMask = UINT64_C2(0x7FF00000, 0x00000000); + static const uint64_t kDpSignificandMask = UINT64_C2(0x000FFFFF, 0xFFFFFFFF); + static const uint64_t kDpHiddenBit = UINT64_C2(0x00100000, 0x00000000); + + uint64_t f; + int e; +}; + +inline static DiyFp GetCachedPower(int e, int* K) { + // 10^-348, 10^-340, ..., 10^340 + static const uint64_t kCachedPowers_F[] = { + UINT64_C2(0xfa8fd5a0, 0x081c0288), UINT64_C2(0xbaaee17f, 0xa23ebf76), + UINT64_C2(0x8b16fb20, 0x3055ac76), UINT64_C2(0xcf42894a, 0x5dce35ea), + UINT64_C2(0x9a6bb0aa, 0x55653b2d), UINT64_C2(0xe61acf03, 0x3d1a45df), + UINT64_C2(0xab70fe17, 0xc79ac6ca), UINT64_C2(0xff77b1fc, 0xbebcdc4f), + UINT64_C2(0xbe5691ef, 0x416bd60c), UINT64_C2(0x8dd01fad, 0x907ffc3c), + UINT64_C2(0xd3515c28, 0x31559a83), UINT64_C2(0x9d71ac8f, 0xada6c9b5), + UINT64_C2(0xea9c2277, 0x23ee8bcb), UINT64_C2(0xaecc4991, 0x4078536d), + UINT64_C2(0x823c1279, 0x5db6ce57), UINT64_C2(0xc2109436, 0x4dfb5637), + UINT64_C2(0x9096ea6f, 0x3848984f), UINT64_C2(0xd77485cb, 0x25823ac7), + UINT64_C2(0xa086cfcd, 0x97bf97f4), UINT64_C2(0xef340a98, 0x172aace5), + UINT64_C2(0xb23867fb, 0x2a35b28e), UINT64_C2(0x84c8d4df, 0xd2c63f3b), + UINT64_C2(0xc5dd4427, 0x1ad3cdba), UINT64_C2(0x936b9fce, 0xbb25c996), + UINT64_C2(0xdbac6c24, 0x7d62a584), UINT64_C2(0xa3ab6658, 0x0d5fdaf6), + UINT64_C2(0xf3e2f893, 0xdec3f126), UINT64_C2(0xb5b5ada8, 0xaaff80b8), + UINT64_C2(0x87625f05, 0x6c7c4a8b), UINT64_C2(0xc9bcff60, 0x34c13053), + UINT64_C2(0x964e858c, 0x91ba2655), UINT64_C2(0xdff97724, 0x70297ebd), + UINT64_C2(0xa6dfbd9f, 0xb8e5b88f), UINT64_C2(0xf8a95fcf, 0x88747d94), + UINT64_C2(0xb9447093, 0x8fa89bcf), UINT64_C2(0x8a08f0f8, 0xbf0f156b), + UINT64_C2(0xcdb02555, 0x653131b6), UINT64_C2(0x993fe2c6, 0xd07b7fac), + UINT64_C2(0xe45c10c4, 0x2a2b3b06), UINT64_C2(0xaa242499, 0x697392d3), + UINT64_C2(0xfd87b5f2, 0x8300ca0e), UINT64_C2(0xbce50864, 0x92111aeb), + UINT64_C2(0x8cbccc09, 0x6f5088cc), UINT64_C2(0xd1b71758, 0xe219652c), + UINT64_C2(0x9c400000, 0x00000000), UINT64_C2(0xe8d4a510, 0x00000000), + UINT64_C2(0xad78ebc5, 0xac620000), UINT64_C2(0x813f3978, 0xf8940984), + UINT64_C2(0xc097ce7b, 0xc90715b3), UINT64_C2(0x8f7e32ce, 0x7bea5c70), + UINT64_C2(0xd5d238a4, 0xabe98068), UINT64_C2(0x9f4f2726, 0x179a2245), + UINT64_C2(0xed63a231, 0xd4c4fb27), UINT64_C2(0xb0de6538, 0x8cc8ada8), + UINT64_C2(0x83c7088e, 0x1aab65db), UINT64_C2(0xc45d1df9, 0x42711d9a), + UINT64_C2(0x924d692c, 0xa61be758), UINT64_C2(0xda01ee64, 0x1a708dea), + UINT64_C2(0xa26da399, 0x9aef774a), UINT64_C2(0xf209787b, 0xb47d6b85), + UINT64_C2(0xb454e4a1, 0x79dd1877), UINT64_C2(0x865b8692, 0x5b9bc5c2), + UINT64_C2(0xc83553c5, 0xc8965d3d), UINT64_C2(0x952ab45c, 0xfa97a0b3), + UINT64_C2(0xde469fbd, 0x99a05fe3), UINT64_C2(0xa59bc234, 0xdb398c25), + UINT64_C2(0xf6c69a72, 0xa3989f5c), UINT64_C2(0xb7dcbf53, 0x54e9bece), + UINT64_C2(0x88fcf317, 0xf22241e2), UINT64_C2(0xcc20ce9b, 0xd35c78a5), + UINT64_C2(0x98165af3, 0x7b2153df), UINT64_C2(0xe2a0b5dc, 0x971f303a), + UINT64_C2(0xa8d9d153, 0x5ce3b396), UINT64_C2(0xfb9b7cd9, 0xa4a7443c), + UINT64_C2(0xbb764c4c, 0xa7a44410), UINT64_C2(0x8bab8eef, 0xb6409c1a), + UINT64_C2(0xd01fef10, 0xa657842c), UINT64_C2(0x9b10a4e5, 0xe9913129), + UINT64_C2(0xe7109bfb, 0xa19c0c9d), UINT64_C2(0xac2820d9, 0x623bf429), + UINT64_C2(0x80444b5e, 0x7aa7cf85), UINT64_C2(0xbf21e440, 0x03acdd2d), + UINT64_C2(0x8e679c2f, 0x5e44ff8f), UINT64_C2(0xd433179d, 0x9c8cb841), + UINT64_C2(0x9e19db92, 0xb4e31ba9), UINT64_C2(0xeb96bf6e, 0xbadf77d9), + UINT64_C2(0xaf87023b, 0x9bf0ee6b) + }; + static const int16_t kCachedPowers_E[] = { + -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, + -954, -927, -901, -874, -847, -821, -794, -768, -741, -715, + -688, -661, -635, -608, -582, -555, -529, -502, -475, -449, + -422, -396, -369, -343, -316, -289, -263, -236, -210, -183, + -157, -130, -103, -77, -50, -24, 3, 30, 56, 83, + 109, 136, 162, 189, 216, 242, 269, 295, 322, 348, + 375, 402, 428, 455, 481, 508, 534, 561, 588, 614, + 641, 667, 694, 720, 747, 774, 800, 827, 853, 880, + 907, 933, 960, 986, 1013, 1039, 1066 + }; + + //int k = static_cast(ceil((-61 - e) * 0.30102999566398114)) + 374; + double dk = (-61 - e) * 0.30102999566398114 + 347; // dk must be positive, so can do ceiling in positive + int k = static_cast(dk); + if (k != dk) + k++; + + unsigned index = static_cast((k >> 3) + 1); + *K = -(-348 + static_cast(index << 3)); // decimal exponent no need lookup table + + assert(index < sizeof(kCachedPowers_F) / sizeof(kCachedPowers_F[0])); + return DiyFp(kCachedPowers_F[index], kCachedPowers_E[index]); +} + +inline static void GrisuRound(char* buffer, int len, uint64_t delta, uint64_t rest, uint64_t ten_kappa, uint64_t wp_w) { + while (rest < wp_w && delta - rest >= ten_kappa && + (rest + ten_kappa < wp_w || /// closer + wp_w - rest > rest + ten_kappa - wp_w)) { + buffer[len - 1]--; + rest += ten_kappa; + } +} + +inline static unsigned CountDecimalDigit32(uint32_t n) { + // Simple pure C++ implementation was faster than __builtin_clz version in this situation. + if (n < 10) return 1; + if (n < 100) return 2; + if (n < 1000) return 3; + if (n < 10000) return 4; + if (n < 100000) return 5; + if (n < 1000000) return 6; + if (n < 10000000) return 7; + if (n < 100000000) return 8; + if (n < 1000000000) return 9; + return 10; +} + +inline static void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) { + static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; + const DiyFp one(uint64_t(1) << -Mp.e, Mp.e); + const DiyFp wp_w = Mp - W; + uint32_t p1 = static_cast(Mp.f >> -one.e); + uint64_t p2 = Mp.f & (one.f - 1); + int kappa = static_cast(CountDecimalDigit32(p1)); + *len = 0; + + while (kappa > 0) { + uint32_t d; + switch (kappa) { + case 10: d = p1 / 1000000000; p1 %= 1000000000; break; + case 9: d = p1 / 100000000; p1 %= 100000000; break; + case 8: d = p1 / 10000000; p1 %= 10000000; break; + case 7: d = p1 / 1000000; p1 %= 1000000; break; + case 6: d = p1 / 100000; p1 %= 100000; break; + case 5: d = p1 / 10000; p1 %= 10000; break; + case 4: d = p1 / 1000; p1 %= 1000; break; + case 3: d = p1 / 100; p1 %= 100; break; + case 2: d = p1 / 10; p1 %= 10; break; + case 1: d = p1; p1 = 0; break; + default: +#if defined(_MSC_VER) + __assume(0); +#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) + __builtin_unreachable(); +#else + d = 0; +#endif + } + if (d || *len) + buffer[(*len)++] = '0' + static_cast(d); + kappa--; + uint64_t tmp = (static_cast(p1) << -one.e) + p2; + if (tmp <= delta) { + *K += kappa; + GrisuRound(buffer, *len, delta, tmp, static_cast(kPow10[kappa]) << -one.e, wp_w.f); + return; + } + } + + // kappa = 0 + for (;;) { + p2 *= 10; + delta *= 10; + char d = static_cast(p2 >> -one.e); + if (d || *len) + buffer[(*len)++] = '0' + d; + p2 &= one.f - 1; + kappa--; + if (p2 < delta) { + *K += kappa; + GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * kPow10[-kappa]); + return; + } + } +} + +inline static void Grisu2(double value, char* buffer, int* length, int* K) { + const DiyFp v(value); + DiyFp w_m, w_p; + v.NormalizedBoundaries(&w_m, &w_p); + + const DiyFp c_mk = GetCachedPower(w_p.e, K); + const DiyFp W = v.Normalize() * c_mk; + DiyFp Wp = w_p * c_mk; + DiyFp Wm = w_m * c_mk; + Wm.f++; + Wp.f--; + DigitGen(W, Wp, Wp.f - Wm.f, buffer, length, K); +} + +static const char cDigitsLut[200] = { + '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', + '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', + '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', + '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', '9', + '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', + '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', + '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9', + '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', + '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', + '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7', '9', '8', '9', '9' +}; + +inline void WriteExponent(int K, char* buffer) { + if (K < 0) { + *buffer++ = '-'; + K = -K; + } + + if (K >= 100) { + *buffer++ = '0' + static_cast(K / 100); + K %= 100; + const char* d = cDigitsLut + K * 2; + *buffer++ = d[0]; + *buffer++ = d[1]; + } + else if (K >= 10) { + const char* d = cDigitsLut + K * 2; + *buffer++ = d[0]; + *buffer++ = d[1]; + } + else + *buffer++ = '0' + static_cast(K); + + *buffer = '\0'; +} + +inline static void Prettify(char* buffer, int length, int k) { + const int kk = length + k; // 10^(kk-1) <= v < 10^kk + + if (length <= kk && kk <= 21) { + // 1234e7 -> 12340000000 + for (int i = length; i < kk; i++) + buffer[i] = '0'; + buffer[kk] = '.'; + buffer[kk + 1] = '0'; + buffer[kk + 2] = '\0'; + } + else if (0 < kk && kk <= 21) { + // 1234e-2 -> 12.34 + memmove(&buffer[kk + 1], &buffer[kk], length - kk); + buffer[kk] = '.'; + buffer[length + 1] = '\0'; + } + else if (-6 < kk && kk <= 0) { + // 1234e-6 -> 0.001234 + const int offset = 2 - kk; + memmove(&buffer[offset], &buffer[0], length); + buffer[0] = '0'; + buffer[1] = '.'; + for (int i = 2; i < offset; i++) + buffer[i] = '0'; + buffer[length + offset] = '\0'; + } + else if (length == 1) { + // 1e30 + buffer[1] = 'e'; + WriteExponent(kk - 1, &buffer[2]); + } + else { + // 1234e30 -> 1.234e33 + memmove(&buffer[2], &buffer[1], length - 1); + buffer[1] = '.'; + buffer[length + 1] = 'e'; + WriteExponent(kk - 1, &buffer[0 + length + 2]); + } +} + +void pdtoa(double value, char *buffer) { +#ifdef _MSC_VER + if (copysign(1.0, value) < 0) { +#else + if (signbit(value)) { +#endif + *buffer++ = '-'; + value = -value; + } + if (cinf(value)) { + buffer[0] = 'i'; + buffer[1] = 'n'; + buffer[2] = 'f'; + buffer[3] = '\0'; + } else if (cnan(value)) { + buffer[0] = 'n'; + buffer[1] = 'a'; + buffer[2] = 'n'; + buffer[3] = '\0'; + } else if (value == 0.0) { + buffer[0] = '0'; + buffer[1] = '.'; + buffer[2] = '0'; + buffer[3] = '\0'; + } else if (value == 1.0) { + buffer[0] = '1'; + buffer[1] = '.'; + buffer[2] = '0'; + buffer[3] = '\0'; + } else { + int length, K; + Grisu2(value, buffer, &length, &K); + Prettify(buffer, length, K); + } +} diff --git a/dtool/src/dtoolbase/pdtoa.h b/dtool/src/dtoolbase/pdtoa.h new file mode 100644 index 0000000000..b7f9b39f72 --- /dev/null +++ b/dtool/src/dtoolbase/pdtoa.h @@ -0,0 +1,24 @@ +/* + This is a double-to-string conversion implementation by Milo Yip from: + https://github.com/miloyip/dtoa-benchmark + + I introduced it because the ostringstream implementation is just too + darned slow, especially when compiled to JavaScript. +*/ + +#ifndef PDTOA_H +#define PDTOA_H + +#include "dtoolsymbols.h" + +#ifdef __cplusplus +extern "C" { +#endif + +EXPCL_DTOOL void pdtoa(double value, char *buffer); + +#ifdef __cplusplus +}; /* end of extern "C" */ +#endif + +#endif // PDTOA_H diff --git a/dtool/src/dtoolutil/string_utils.I b/dtool/src/dtoolutil/string_utils.I index 677666df84..abbfbbfd94 100644 --- a/dtool/src/dtoolutil/string_utils.I +++ b/dtool/src/dtoolutil/string_utils.I @@ -20,3 +20,81 @@ format_string(const Thing &thing) { str << thing; return str.str(); } + +INLINE string +format_string(const string &value) { + return value; +} + +INLINE string +format_string(float value) { + char buffer[32]; + pdtoa(value, buffer); + return string(buffer); +} + +INLINE string +format_string(double value) { + char buffer[32]; + pdtoa(value, buffer); + return string(buffer); +} + +INLINE string +format_string(unsigned int value) { + char buffer[11]; + char *p = buffer + 10; + *p = 0; + do { + *--p = '0' + (value % 10); + value /= 10; + } while (value > 0); + + return string(p); +} + +INLINE string +format_string(int value) { + char buffer[12]; + char *p = buffer + 11; + *p = 0; + + if (value < 0) { + unsigned int posv = (unsigned int)-value; + do { + *--p = '0' + (posv % 10); + posv /= 10; + } while (posv > 0); + *--p = '-'; + } else { + do { + *--p = '0' + (value % 10); + value /= 10; + } while (value > 0); + } + + return string(p); +} + +INLINE string +format_string(PN_int64 value) { + char buffer[21]; + char *p = buffer + 20; + *p = 0; + + if (value < 0) { + PN_uint64 posv = (PN_uint64)-value; + do { + *--p = '0' + (posv % 10); + posv /= 10; + } while (posv > 0); + *--p = '-'; + } else { + do { + *--p = '0' + (value % 10); + value /= 10; + } while (value > 0); + } + + return string(p); +} diff --git a/dtool/src/dtoolutil/string_utils.h b/dtool/src/dtoolutil/string_utils.h index 8fda82a8b0..afeb91c422 100644 --- a/dtool/src/dtoolutil/string_utils.h +++ b/dtool/src/dtoolutil/string_utils.h @@ -19,6 +19,7 @@ #include #include "vector_string.h" +#include "pdtoa.h" // Case-insensitive string comparison, from Stroustrup's C++ third edition. // Works like strcmp(). @@ -66,7 +67,14 @@ EXPCL_DTOOL bool string_to_stdfloat(const string &str, PN_stdfloat &result); template INLINE string format_string(const Thing &thing); +// Fast specializations for some primitive types. +INLINE string format_string(const string &value); +INLINE string format_string(float value); +INLINE string format_string(double value); +INLINE string format_string(unsigned int value); +INLINE string format_string(int value); +INLINE string format_string(PN_int64 value); + #include "string_utils.I" #endif - diff --git a/dtool/src/prc/configDeclaration.cxx b/dtool/src/prc/configDeclaration.cxx index fa3e4f095e..65cc4360d2 100644 --- a/dtool/src/prc/configDeclaration.cxx +++ b/dtool/src/prc/configDeclaration.cxx @@ -16,7 +16,7 @@ #include "configVariableCore.h" #include "config_prc.h" #include "pstrtod.h" - +#include "string_utils.h" //////////////////////////////////////////////////////////////////// // Function: ConfigDeclaration::Constructor @@ -93,11 +93,7 @@ set_string_word(int n, const string &value) { //////////////////////////////////////////////////////////////////// void ConfigDeclaration:: set_bool_word(int n, bool value) { - if (value) { - set_string_word(n, "1"); - } else { - set_string_word(n, "0"); - } + set_string_word(n, value ? "1" : "0"); _words[n]._flags |= (F_checked_bool | F_valid_bool); _words[n]._bool = value; @@ -112,9 +108,7 @@ set_bool_word(int n, bool value) { //////////////////////////////////////////////////////////////////// void ConfigDeclaration:: set_int_word(int n, int value) { - ostringstream strm; - strm << value; - set_string_word(n, strm.str()); + set_string_word(n, format_string(value)); _words[n]._flags |= (F_checked_int | F_valid_int); _words[n]._int = value; @@ -129,9 +123,7 @@ set_int_word(int n, int value) { //////////////////////////////////////////////////////////////////// void ConfigDeclaration:: set_int64_word(int n, PN_int64 value) { - ostringstream strm; - strm << value; - set_string_word(n, strm.str()); + set_string_word(n, format_string(value)); _words[n]._flags |= (F_checked_int64 | F_valid_int64); _words[n]._int_64 = value; @@ -146,9 +138,7 @@ set_int64_word(int n, PN_int64 value) { //////////////////////////////////////////////////////////////////// void ConfigDeclaration:: set_double_word(int n, double value) { - ostringstream strm; - strm << value; - set_string_word(n, strm.str()); + set_string_word(n, format_string(value)); _words[n]._flags |= (F_checked_double | F_valid_double); _words[n]._double = value; diff --git a/dtool/src/prc/configVariableDouble.cxx b/dtool/src/prc/configVariableDouble.cxx index 9be538144c..74722b6444 100644 --- a/dtool/src/prc/configVariableDouble.cxx +++ b/dtool/src/prc/configVariableDouble.cxx @@ -13,6 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "configVariableDouble.h" +#include "string_utils.h" //////////////////////////////////////////////////////////////////// // Function: ConfigVariableDouble::set_default_value @@ -21,8 +22,5 @@ //////////////////////////////////////////////////////////////////// void ConfigVariableDouble:: set_default_value(double default_value) { - ostringstream strm; - strm << default_value; - - _core->set_default_value(strm.str()); + _core->set_default_value(format_string(default_value)); } diff --git a/dtool/src/prc/configVariableInt.cxx b/dtool/src/prc/configVariableInt.cxx index 7ddff67cce..909368e3c2 100644 --- a/dtool/src/prc/configVariableInt.cxx +++ b/dtool/src/prc/configVariableInt.cxx @@ -13,6 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "configVariableInt.h" +#include "string_utils.h" //////////////////////////////////////////////////////////////////// // Function: ConfigVariableInt::set_default_value @@ -21,8 +22,5 @@ //////////////////////////////////////////////////////////////////// void ConfigVariableInt:: set_default_value(int default_value) { - ostringstream strm; - strm << default_value; - - _core->set_default_value(strm.str()); + _core->set_default_value(format_string(default_value)); } diff --git a/dtool/src/prc/configVariableInt64.cxx b/dtool/src/prc/configVariableInt64.cxx index cd54254570..637172c65e 100644 --- a/dtool/src/prc/configVariableInt64.cxx +++ b/dtool/src/prc/configVariableInt64.cxx @@ -13,6 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "configVariableInt64.h" +#include "string_utils.h" //////////////////////////////////////////////////////////////////// // Function: ConfigVariableInt64::set_default_value @@ -21,8 +22,5 @@ //////////////////////////////////////////////////////////////////// void ConfigVariableInt64:: set_default_value(PN_int64 default_value) { - ostringstream strm; - strm << default_value; - - _core->set_default_value(strm.str()); + _core->set_default_value(format_string(default_value)); } diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index eedf79cc1e..bf6b8f0422 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -8146,9 +8146,7 @@ do_fillin_body(CData *cdata, DatagramIterator &scan, BamReader *manager) { size_t u_size = scan.get_uint32(); PTA_uchar image = PTA_uchar::empty_array(u_size, get_class_type()); - for (size_t u_idx = 0; u_idx < u_size; ++u_idx) { - image[(int)u_idx] = scan.get_uint8(); - } + scan.extract_bytes(image.p(), u_size); cdata->_simple_ram_image._image = image; cdata->_simple_ram_image._page_size = u_size; @@ -8201,13 +8199,11 @@ do_fillin_rawdata(CData *cdata, DatagramIterator &scan, BamReader *manager) { cdata->_ram_images[n]._page_size = scan.get_uint32(); } - size_t u_size = scan.get_uint32(); - // fill the cdata->_image buffer with image data + size_t u_size = scan.get_uint32(); PTA_uchar image = PTA_uchar::empty_array(u_size, get_class_type()); - for (size_t u_idx = 0; u_idx < u_size; ++u_idx) { - image[(int)u_idx] = scan.get_uint8(); - } + scan.extract_bytes(image.p(), u_size); + cdata->_ram_images[n]._image = image; } cdata->_loaded_from_image = true; diff --git a/panda/src/linmath/configVariableColor.cxx b/panda/src/linmath/configVariableColor.cxx index 3d4ea47a7d..27282c36e7 100644 --- a/panda/src/linmath/configVariableColor.cxx +++ b/panda/src/linmath/configVariableColor.cxx @@ -13,6 +13,7 @@ //////////////////////////////////////////////////////////////////// #include "configVariableColor.h" +#include "pdtoa.h" //////////////////////////////////////////////////////////////////// // Function: ConfigVariableColor::set_default_value @@ -21,8 +22,21 @@ //////////////////////////////////////////////////////////////////// void ConfigVariableColor:: set_default_value(const LColor &default_value) { - ostringstream strm; - strm << default_value; + char buffer[128]; + char *p = buffer; + pdtoa(default_value[0], p); - _core->set_default_value(strm.str()); + p += strlen(p); + *p++ = ' '; + pdtoa(default_value[1], p); + + p += strlen(p); + *p++ = ' '; + pdtoa(default_value[2], p); + + p += strlen(p); + *p++ = ' '; + pdtoa(default_value[3], p); + + _core->set_default_value(buffer); } diff --git a/panda/src/linmath/dblnames.h b/panda/src/linmath/dblnames.h index cb841dd977..d0df9e8039 100644 --- a/panda/src/linmath/dblnames.h +++ b/panda/src/linmath/dblnames.h @@ -38,8 +38,13 @@ #undef FLOATTOKEN #undef FLOATCONST #undef FLOATTYPE_IS_INT +#undef STRINGIFY +#undef FLOATNAME_STR #define FLOATTYPE double #define FLOATNAME(ARG) ARG##d #define FLOATTOKEN 'd' #define FLOATCONST(ARG) ARG + +#define STRINGIFY(ARG) #ARG +#define FLOATNAME_STR(ARG) STRINGIFY(ARG##d) diff --git a/panda/src/linmath/fltnames.h b/panda/src/linmath/fltnames.h index b6aae8bd3e..75affd8fa7 100644 --- a/panda/src/linmath/fltnames.h +++ b/panda/src/linmath/fltnames.h @@ -38,8 +38,13 @@ #undef FLOATTOKEN #undef FLOATCONST #undef FLOATTYPE_IS_INT +#undef STRINGIFY +#undef FLOATNAME_STR #define FLOATTYPE float #define FLOATNAME(ARG) ARG##f #define FLOATTOKEN 'f' #define FLOATCONST(ARG) ARG##f + +#define STRINGIFY(ARG) #ARG +#define FLOATNAME_STR(ARG) STRINGIFY(ARG##f) diff --git a/panda/src/linmath/intnames.h b/panda/src/linmath/intnames.h index 1ae59f275a..2a63cbeec7 100644 --- a/panda/src/linmath/intnames.h +++ b/panda/src/linmath/intnames.h @@ -38,9 +38,14 @@ #undef FLOATTOKEN #undef FLOATCONST #undef FLOATTYPE_IS_INT +#undef STRINGIFY +#undef FLOATNAME_STR #define FLOATTYPE int #define FLOATNAME(ARG) ARG##i #define FLOATTOKEN 'i' #define FLOATCONST(ARG) ARG #define FLOATTYPE_IS_INT + +#define STRINGIFY(ARG) #ARG +#define FLOATNAME_STR(ARG) STRINGIFY(ARG##i) diff --git a/panda/src/linmath/lmatrix3_src.cxx b/panda/src/linmath/lmatrix3_src.cxx index 994056de79..a60e4231a7 100644 --- a/panda/src/linmath/lmatrix3_src.cxx +++ b/panda/src/linmath/lmatrix3_src.cxx @@ -512,8 +512,6 @@ void FLOATNAME(LMatrix3):: init_type() { if (_type_handle == TypeHandle::none()) { // Format a string to describe the type. - string name = "LMatrix3"; - name += FLOATTOKEN; - register_type(_type_handle, name); + register_type(_type_handle, FLOATNAME_STR(LMatrix3)); } } diff --git a/panda/src/linmath/lmatrix4_src.cxx b/panda/src/linmath/lmatrix4_src.cxx index 75775f9217..f5406757b5 100644 --- a/panda/src/linmath/lmatrix4_src.cxx +++ b/panda/src/linmath/lmatrix4_src.cxx @@ -593,9 +593,7 @@ void FLOATNAME(LMatrix4):: init_type() { if (_type_handle == TypeHandle::none()) { // Format a string to describe the type. - string name = "LMatrix4"; - name += FLOATTOKEN; - register_type(_type_handle, name); + register_type(_type_handle, FLOATNAME_STR(LMatrix4)); } } @@ -608,8 +606,6 @@ void FLOATNAME(UnalignedLMatrix4):: init_type() { if (_type_handle == TypeHandle::none()) { // Format a string to describe the type. - string name = "UnalignedLMatrix4"; - name += FLOATTOKEN; - register_type(_type_handle, name); + register_type(_type_handle, FLOATNAME_STR(UnalignedLMatrix4)); } } diff --git a/panda/src/linmath/lorientation_src.cxx b/panda/src/linmath/lorientation_src.cxx index 521a4483bb..26f694d572 100644 --- a/panda/src/linmath/lorientation_src.cxx +++ b/panda/src/linmath/lorientation_src.cxx @@ -23,9 +23,7 @@ void FLOATNAME(LOrientation):: init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LQuaternion)::init_type(); - string name = "LOrientation"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LOrientation), FLOATNAME(LQuaternion)::get_class_type()); } } diff --git a/panda/src/linmath/lpoint2_src.cxx b/panda/src/linmath/lpoint2_src.cxx index 5e7e503254..f25fe04b0d 100644 --- a/panda/src/linmath/lpoint2_src.cxx +++ b/panda/src/linmath/lpoint2_src.cxx @@ -23,9 +23,7 @@ void FLOATNAME(LPoint2):: init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LVecBase2)::init_type(); - string name = "LPoint2"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LPoint2), FLOATNAME(LVecBase2)::get_class_type()); } } diff --git a/panda/src/linmath/lpoint3_src.cxx b/panda/src/linmath/lpoint3_src.cxx index e395c31074..185935aeee 100644 --- a/panda/src/linmath/lpoint3_src.cxx +++ b/panda/src/linmath/lpoint3_src.cxx @@ -23,9 +23,7 @@ void FLOATNAME(LPoint3):: init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LVecBase3)::init_type(); - string name = "LPoint3"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LPoint3), FLOATNAME(LVecBase3)::get_class_type()); } } diff --git a/panda/src/linmath/lpoint4_src.cxx b/panda/src/linmath/lpoint4_src.cxx index eee0e12bac..112d5a804a 100644 --- a/panda/src/linmath/lpoint4_src.cxx +++ b/panda/src/linmath/lpoint4_src.cxx @@ -23,9 +23,7 @@ void FLOATNAME(LPoint4):: init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LVecBase4)::init_type(); - string name = "LPoint4"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LPoint4), FLOATNAME(LVecBase4)::get_class_type()); } } diff --git a/panda/src/linmath/lquaternion_src.cxx b/panda/src/linmath/lquaternion_src.cxx index 78edbc05d1..a9d2b031ce 100644 --- a/panda/src/linmath/lquaternion_src.cxx +++ b/panda/src/linmath/lquaternion_src.cxx @@ -323,9 +323,7 @@ void FLOATNAME(LQuaternion):: init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LVecBase4)::init_type(); - string name = "LQuaternion"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LQuaternion), FLOATNAME(LVecBase4)::get_class_type()); } } diff --git a/panda/src/linmath/lrotation_src.cxx b/panda/src/linmath/lrotation_src.cxx index 2f2bf040b7..31d41cdbe0 100644 --- a/panda/src/linmath/lrotation_src.cxx +++ b/panda/src/linmath/lrotation_src.cxx @@ -24,9 +24,7 @@ init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LQuaternion)::init_type(); // Format a string to describe the type. - string name = "LRotation"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LRotation), FLOATNAME(LQuaternion)::get_class_type()); } } diff --git a/panda/src/linmath/lvecBase2_src.cxx b/panda/src/linmath/lvecBase2_src.cxx index 02a5507069..03cd74b05f 100644 --- a/panda/src/linmath/lvecBase2_src.cxx +++ b/panda/src/linmath/lvecBase2_src.cxx @@ -30,8 +30,6 @@ void FLOATNAME(LVecBase2):: init_type() { if (_type_handle == TypeHandle::none()) { // Format a string to describe the type. - string name = "LVecBase2"; - name += FLOATTOKEN; - register_type(_type_handle, name); + register_type(_type_handle, FLOATNAME_STR(LVecBase2)); } } diff --git a/panda/src/linmath/lvecBase3_src.cxx b/panda/src/linmath/lvecBase3_src.cxx index f2d243fb3c..e5ffff0555 100644 --- a/panda/src/linmath/lvecBase3_src.cxx +++ b/panda/src/linmath/lvecBase3_src.cxx @@ -33,9 +33,7 @@ void FLOATNAME(LVecBase3):: init_type() { if (_type_handle == TypeHandle::none()) { // Format a string to describe the type. - string name = "LVecBase3"; - name += FLOATTOKEN; - register_type(_type_handle, name); + register_type(_type_handle, FLOATNAME_STR(LVecBase3)); } } diff --git a/panda/src/linmath/lvecBase4_src.cxx b/panda/src/linmath/lvecBase4_src.cxx index 49debed5a7..b5465bce6b 100644 --- a/panda/src/linmath/lvecBase4_src.cxx +++ b/panda/src/linmath/lvecBase4_src.cxx @@ -35,9 +35,7 @@ void FLOATNAME(LVecBase4):: init_type() { if (_type_handle == TypeHandle::none()) { // Format a string to describe the type. - string name = "LVecBase4"; - name += FLOATTOKEN; - register_type(_type_handle, name); + register_type(_type_handle, FLOATNAME_STR(LVecBase4)); } } @@ -51,9 +49,7 @@ void FLOATNAME(UnalignedLVecBase4):: init_type() { if (_type_handle == TypeHandle::none()) { // Format a string to describe the type. - string name = "UnalignedLVecBase4"; - name += FLOATTOKEN; - register_type(_type_handle, name); + register_type(_type_handle, FLOATNAME_STR(UnalignedLVecBase4)); } } diff --git a/panda/src/linmath/lvector2_src.cxx b/panda/src/linmath/lvector2_src.cxx index 77c1f0c04b..9627c0f396 100644 --- a/panda/src/linmath/lvector2_src.cxx +++ b/panda/src/linmath/lvector2_src.cxx @@ -23,9 +23,7 @@ void FLOATNAME(LVector2):: init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LVecBase2)::init_type(); - string name = "LVector2"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LVector2), FLOATNAME(LVecBase2)::get_class_type()); } } diff --git a/panda/src/linmath/lvector3_src.cxx b/panda/src/linmath/lvector3_src.cxx index e254220bc4..d0c382289f 100644 --- a/panda/src/linmath/lvector3_src.cxx +++ b/panda/src/linmath/lvector3_src.cxx @@ -23,9 +23,7 @@ void FLOATNAME(LVector3):: init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LVecBase3)::init_type(); - string name = "LVector3"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LVector3), FLOATNAME(LVecBase3)::get_class_type()); } } diff --git a/panda/src/linmath/lvector4_src.cxx b/panda/src/linmath/lvector4_src.cxx index 112170c315..615f8eb059 100644 --- a/panda/src/linmath/lvector4_src.cxx +++ b/panda/src/linmath/lvector4_src.cxx @@ -23,9 +23,7 @@ void FLOATNAME(LVector4):: init_type() { if (_type_handle == TypeHandle::none()) { FLOATNAME(LVecBase4)::init_type(); - string name = "LVector4"; - name += FLOATTOKEN; - register_type(_type_handle, name, + register_type(_type_handle, FLOATNAME_STR(LVector4), FLOATNAME(LVecBase4)::get_class_type()); } } diff --git a/panda/src/pstatclient/pStatClient.cxx b/panda/src/pstatclient/pStatClient.cxx index 0cd70c5d96..8bf8c74af8 100644 --- a/panda/src/pstatclient/pStatClient.cxx +++ b/panda/src/pstatclient/pStatClient.cxx @@ -879,6 +879,10 @@ stop(int collector_index, int thread_index, double as_of) { //////////////////////////////////////////////////////////////////// void PStatClient:: clear_level(int collector_index, int thread_index) { + if (!client_is_connected()) { + return; + } + #ifdef _DEBUG nassertv(collector_index >= 0 && collector_index < AtomicAdjust::get(_num_collectors)); nassertv(thread_index >= 0 && thread_index < AtomicAdjust::get(_num_threads)); @@ -903,6 +907,10 @@ clear_level(int collector_index, int thread_index) { //////////////////////////////////////////////////////////////////// void PStatClient:: set_level(int collector_index, int thread_index, double level) { + if (!client_is_connected()) { + return; + } + #ifdef _DEBUG nassertv(collector_index >= 0 && collector_index < AtomicAdjust::get(_num_collectors)); nassertv(thread_index >= 0 && thread_index < AtomicAdjust::get(_num_threads)); @@ -936,6 +944,10 @@ set_level(int collector_index, int thread_index, double level) { //////////////////////////////////////////////////////////////////// void PStatClient:: add_level(int collector_index, int thread_index, double increment) { + if (!client_is_connected()) { + return; + } + #ifdef _DEBUG nassertv(collector_index >= 0 && collector_index < AtomicAdjust::get(_num_collectors)); nassertv(thread_index >= 0 && thread_index < AtomicAdjust::get(_num_threads)); @@ -955,12 +967,17 @@ add_level(int collector_index, int thread_index, double increment) { // Function: PStatClient::get_level // Access: Private // Description: Returns the current level value of the given collector. +// Returns 0.0 if the pstats client is not connected. // // Normally you would not use this interface directly; // instead, call PStatCollector::get_level(). //////////////////////////////////////////////////////////////////// double PStatClient:: get_level(int collector_index, int thread_index) const { + if (!client_is_connected()) { + return 0.0; + } + #ifdef _DEBUG nassertr(collector_index >= 0 && collector_index < AtomicAdjust::get(_num_collectors), 0.0f); nassertr(thread_index >= 0 && thread_index < AtomicAdjust::get(_num_threads), 0.0f); From 059f67d1b5f764758a653c5db28cd8777b396343 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Apr 2015 20:52:44 +0200 Subject: [PATCH 36/73] Improve GLSL error reporting, fix GLSL ES shader loading --- .../glstuff/glGraphicsStateGuardian_src.cxx | 10 ++++++- panda/src/glstuff/glShaderContext_src.cxx | 27 ++++++++++++------- panda/src/glstuff/glShaderContext_src.h | 4 +-- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 8e96089bfb..06fdd1eb4c 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -1382,7 +1382,7 @@ reset() { // if it failed to compile. This default shader just outputs // a red color, indicating that something went wrong. if (_default_shader == NULL) { - _default_shader = Shader::load(Shader::SL_GLSL, default_vshader, default_fshader); + _default_shader = Shader::make(Shader::SL_GLSL, default_vshader, default_fshader); } #endif @@ -2997,6 +2997,14 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader, } #endif // NDEBUG +#ifdef OPENGLES_2 + // We can't draw without a shader bound in OpenGL ES 2. This shouldn't + // happen anyway unless the default shader failed to compile somehow. + if (_current_shader_context == NULL) { + return false; + } +#endif + if (!GraphicsStateGuardian::begin_draw_primitives(geom_reader, munger, data_reader, force)) { return false; } diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index eb67ce51d5..1b66f6172a 100755 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1593,7 +1593,7 @@ update_shader_texture_bindings(ShaderContext *prev) { // Description: This subroutine prints the infolog for a shader. //////////////////////////////////////////////////////////////////// void CLP(ShaderContext):: -glsl_report_shader_errors(GLuint shader, Shader::ShaderType type) { +glsl_report_shader_errors(GLuint shader, Shader::ShaderType type, bool fatal) { char *info_log; GLint length = 0; GLint num_chars = 0; @@ -1642,6 +1642,9 @@ glsl_report_shader_errors(GLuint shader, Shader::ShaderType type) { GLCAT.error(false) << fn << "(" << lineno << ") : " << (line.c_str() + prefixlen) << "\n"; + } else if (!fatal) { + GLCAT.warning(false) << line << "\n"; + } else { GLCAT.error(false) << line << "\n"; } @@ -1654,7 +1657,7 @@ glsl_report_shader_errors(GLuint shader, Shader::ShaderType type) { // Description: This subroutine prints the infolog for a program. //////////////////////////////////////////////////////////////////// void CLP(ShaderContext):: -glsl_report_program_errors(GLuint program) { +glsl_report_program_errors(GLuint program, bool fatal) { char *info_log; GLint length = 0; GLint num_chars = 0; @@ -1664,8 +1667,13 @@ glsl_report_program_errors(GLuint program) { if (length > 1) { info_log = (char *) alloca(length); _glgsg->_glGetProgramInfoLog(program, length, &num_chars, info_log); + if (strcmp(info_log, "Success.\n") != 0 && strcmp(info_log, "No errors.\n") != 0) { - GLCAT.error(false) << info_log << "\n"; + if (!fatal) { + GLCAT.warning(false) << info_log << "\n"; + } else { + GLCAT.error(false) << info_log << "\n"; + } } } } @@ -1733,7 +1741,7 @@ glsl_compile_shader(Shader::ShaderType type) { GLCAT.error() << "An error occurred while compiling GLSL shader " << _shader->get_filename(type) << ":\n"; - glsl_report_shader_errors(handle, type); + glsl_report_shader_errors(handle, type, true); _glgsg->_glDeleteShader(handle); _glgsg->report_my_gl_errors(); return false; @@ -1743,7 +1751,7 @@ glsl_compile_shader(Shader::ShaderType type) { _glsl_shaders.push_back(handle); // There might be warnings, so report those. - glsl_report_shader_errors(handle, type); + glsl_report_shader_errors(handle, type, false); return true; } @@ -1776,9 +1784,8 @@ glsl_compile_and_link() { valid &= glsl_compile_shader(Shader::ST_fragment); } -#ifdef OPENGLES - nassertr(false, false); // OpenGL ES has no geometry shaders. -#else + // OpenGL ES has no geometry shaders. +#ifndef OPENGLES if (!_shader->get_text(Shader::ST_geometry).empty()) { valid &= glsl_compile_shader(Shader::ST_geometry); @@ -1823,12 +1830,12 @@ glsl_compile_and_link() { _glgsg->_glGetProgramiv(_glsl_program, GL_LINK_STATUS, &status); if (status != GL_TRUE) { GLCAT.error() << "An error occurred while linking GLSL shader program!\n"; - glsl_report_program_errors(_glsl_program); + glsl_report_program_errors(_glsl_program, true); return false; } // Report any warnings. - glsl_report_program_errors(_glsl_program); + glsl_report_program_errors(_glsl_program, false); // Dump the binary if requested. #if !defined(NDEBUG) && !defined(OPENGLES) diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index 7def61d924..19c7190bcd 100755 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -73,8 +73,8 @@ private: bool _uses_standard_vertex_arrays; - void glsl_report_shader_errors(GLuint shader, Shader::ShaderType type); - void glsl_report_program_errors(GLuint program); + void glsl_report_shader_errors(GLuint shader, Shader::ShaderType type, bool fatal); + void glsl_report_program_errors(GLuint program, bool fatal); bool glsl_compile_shader(Shader::ShaderType type); bool glsl_compile_and_link(); bool parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *s); From b323d73622f6278fa8e0a6b94d94fa6ea28ad0f6 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Apr 2015 21:04:27 +0200 Subject: [PATCH 37/73] Reduce redundant state changes and error checks --- .../src/glstuff/glGraphicsStateGuardian_src.I | 29 ++++++ .../glstuff/glGraphicsStateGuardian_src.cxx | 94 +++++++++---------- .../src/glstuff/glGraphicsStateGuardian_src.h | 5 + 3 files changed, 78 insertions(+), 50 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.I b/panda/src/glstuff/glGraphicsStateGuardian_src.I index 6d5248acf2..694abd1280 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.I +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.I @@ -616,6 +616,35 @@ enable_polygon_offset(bool val) { } } +//////////////////////////////////////////////////////////////////// +// Function: GLGraphicsStateGuardian::set_color_write_mask +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void CLP(GraphicsStateGuardian):: +set_color_write_mask(int mask) { + if (gl_color_mask && _active_color_write_mask != mask) { + _active_color_write_mask = mask; + glColorMask((_color_write_mask & ColorWriteAttrib::C_red) != 0, + (_color_write_mask & ColorWriteAttrib::C_green) != 0, + (_color_write_mask & ColorWriteAttrib::C_blue) != 0, + (_color_write_mask & ColorWriteAttrib::C_alpha) != 0); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: GLGraphicsStateGuardian::clear_color_write_mask +// Access: Protected +// Description: +//////////////////////////////////////////////////////////////////// +INLINE void CLP(GraphicsStateGuardian):: +clear_color_write_mask() { + if (gl_color_mask && _active_color_write_mask != ColorWriteAttrib::C_all) { + _active_color_write_mask = ColorWriteAttrib::C_all; + glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); + } +} + //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::call_glFogfv // Access: Public diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 06fdd1eb4c..7813d9cc2a 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -51,7 +51,6 @@ #include "bamCacheRecord.h" #include "alphaTestAttrib.h" #include "clipPlaneAttrib.h" -#include "colorWriteAttrib.h" #include "cullFaceAttrib.h" #include "depthOffsetAttrib.h" #include "depthWriteAttrib.h" @@ -2094,6 +2093,7 @@ reset() { _polygon_offset_enabled = false; _flat_shade_model = false; _decal_level = 0; + _active_color_write_mask = ColorWriteAttrib::C_all; _tex_gen_point_sprite = false; #ifndef OPENGLES @@ -2447,9 +2447,7 @@ clear(DrawableRegion *clearable) { if (clearable->get_clear_color_active()) { LColor v = clearable->get_clear_color(); glClearColor(v[0], v[1], v[2], v[3]); - if (gl_color_mask) { - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } + clear_color_write_mask(); _state_mask.clear_bit(ColorWriteAttrib::get_class_slot()); mask |= GL_COLOR_BUFFER_BIT; } @@ -2944,35 +2942,43 @@ end_frame(Thread *current_thread) { if (_check_errors || (_supports_debug && gl_debug)) { report_my_gl_errors(); } else { - PStatTimer timer(_check_error_pcollector); + static int frame_counter = -1; // If _check_errors is false, we still want to check for errors - // once during this frame, so that we know if anything went wrong. - GLenum error_code = glGetError(); - if (error_code != GL_NO_ERROR) { - int error_count = 0; - bool deactivate = !report_errors_loop(__LINE__, __FILE__, error_code, error_count); + // the first few frames and once every N frames, so that we know if + // anything went wrong at all. + if (frame_counter++ <= 0) { + PStatTimer timer(_check_error_pcollector); - if (error_count == 1) { - GLCAT.error() - << "An OpenGL error (" << get_error_string(error_code) - << ") has occurred."; - } else { - GLCAT.error() - << error_count << " OpenGL errors have occurred."; - } + GLenum error_code = glGetError(); + if (error_code != GL_NO_ERROR) { + int error_count = 0; + bool deactivate = !report_errors_loop(__LINE__, __FILE__, error_code, error_count); - if (_supports_debug) { - GLCAT.error(false) << " Set gl-debug #t " - << "in your PRC file to display more information.\n"; - } else { - GLCAT.error(false) << " Set gl-check-errors #t " - << "in your PRC file to display more information.\n"; - } + if (error_count == 1) { + GLCAT.error() + << "An OpenGL error (" << get_error_string(error_code) + << ") has occurred."; + } else { + GLCAT.error() + << error_count << " OpenGL errors have occurred."; + } - if (deactivate) { - panic_deactivate(); + if (_supports_debug) { + GLCAT.error(false) << " Set gl-debug #t " + << "in your PRC file to display more information.\n"; + } else { + GLCAT.error(false) << " Set gl-check-errors #t " + << "in your PRC file to display more information.\n"; + } + + if (deactivate) { + panic_deactivate(); + } } + } else if (frame_counter > 100) { + // 100 frames have passed. Check next frame. + frame_counter = 0; } } #endif @@ -5257,9 +5263,7 @@ framebuffer_copy_to_texture(Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb) { nassertr(tex != NULL && dr != NULL, false); set_read_buffer(rb._buffer_type); - if (gl_color_mask) { - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } + clear_color_write_mask(); int xo, yo, w, h; dr->get_region_pixels(xo, yo, w, h); @@ -5473,9 +5477,7 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z, nassertr(tex != NULL && dr != NULL, false); set_read_buffer(rb._buffer_type); glPixelStorei(GL_PACK_ALIGNMENT, 1); - if (gl_color_mask) { - glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); - } + clear_color_write_mask(); // Bug fix for RE, RE2, and VTX - need to disable texturing in order // for glReadPixels() to work @@ -5806,7 +5808,7 @@ do_issue_render_mode() { _target_rs->get_attrib_def(target_render_mode); _render_mode = target_render_mode->get_mode(); - _point_size = target_render_mode->get_thickness(); + PN_stdfloat thickness = target_render_mode->get_thickness(); _point_perspective = target_render_mode->get_perspective(); #ifndef OPENGLES // glPolygonMode not supported by OpenGL ES. @@ -5832,10 +5834,13 @@ do_issue_render_mode() { #endif // OPENGLES // The thickness affects both the line width and the point size. - glLineWidth(_point_size); + if (thickness != _point_size) { + glLineWidth(_point_size); #ifndef OPENGLES_2 - glPointSize(_point_size); + glPointSize(_point_size); #endif + _point_size = thickness; + } report_my_gl_errors(); do_point_size(); @@ -6261,7 +6266,7 @@ do_issue_blending() { enable_multisample_alpha_mask(false); if (gl_color_mask) { enable_blend(false); - glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); + set_color_write_mask(ColorWriteAttrib::C_off); } else { enable_blend(true); _glBlendEquation(GL_FUNC_ADD); @@ -6269,15 +6274,9 @@ do_issue_blending() { } return; } else { - if (gl_color_mask) { - glColorMask((color_channels & ColorWriteAttrib::C_red) != 0, - (color_channels & ColorWriteAttrib::C_green) != 0, - (color_channels & ColorWriteAttrib::C_blue) != 0, - (color_channels & ColorWriteAttrib::C_alpha) != 0); - } + set_color_write_mask(color_channels); } - const ColorBlendAttrib *target_color_blend; _target_rs->get_attrib_def(target_color_blend); CPT(ColorBlendAttrib) color_blend = target_color_blend; @@ -7029,12 +7028,7 @@ set_draw_buffer(int rbtype) { #endif // OPENGLES // Also ensure that any global color channels are masked out. - if (gl_color_mask) { - glColorMask((_color_write_mask & ColorWriteAttrib::C_red) != 0, - (_color_write_mask & ColorWriteAttrib::C_green) != 0, - (_color_write_mask & ColorWriteAttrib::C_blue) != 0, - (_color_write_mask & ColorWriteAttrib::C_alpha) != 0); - } + set_color_write_mask(_color_write_mask); report_my_gl_errors(); } diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 97efe35586..03e8e2c8a5 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -21,6 +21,7 @@ #include "texture.h" #include "displayRegion.h" #include "material.h" +#include "colorWriteAttrib.h" #include "depthTestAttrib.h" #include "textureAttrib.h" #include "texMatrixAttrib.h" @@ -443,6 +444,9 @@ protected: INLINE void enable_alpha_test(bool val); INLINE void enable_polygon_offset(bool val); + INLINE void set_color_write_mask(int mask); + INLINE void clear_color_write_mask(); + INLINE void call_glFogfv(GLenum pname, const LColor &color); INLINE void call_glMaterialfv(GLenum face, GLenum pname, const LColor &color); INLINE void call_glLightfv(GLenum light, GLenum pname, const LVecBase4 &value); @@ -539,6 +543,7 @@ protected: bool _polygon_offset_enabled; bool _flat_shade_model; int _decal_level; + int _active_color_write_mask; bool _dithering_enabled; From 497634548637c37b270c7ad968cfa34d982df126 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Apr 2015 21:38:54 +0200 Subject: [PATCH 38/73] Let's use OpenGL-style vertex colors by default on non-Windows platforms --- panda/src/egg2pg/eggLoader.cxx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/panda/src/egg2pg/eggLoader.cxx b/panda/src/egg2pg/eggLoader.cxx index 40ca88b6e7..b472a104b6 100644 --- a/panda/src/egg2pg/eggLoader.cxx +++ b/panda/src/egg2pg/eggLoader.cxx @@ -2216,7 +2216,7 @@ check_for_polysets(EggGroup *egg_group, bool &all_polysets, bool &any_hidden) { // transform, just returns it. //////////////////////////////////////////////////////////////////// PT(GeomVertexData) EggLoader:: -make_vertex_data(const EggRenderState *render_state, +make_vertex_data(const EggRenderState *render_state, EggVertexPool *vertex_pool, EggNode *primitive_home, const LMatrix4d &transform, TransformBlendTable *blend_table, bool is_dynamic, CharacterMaker *character_maker, @@ -2231,7 +2231,7 @@ make_vertex_data(const EggRenderState *render_state, if (di != _vertex_pool_data.end()) { return (*di).second; } - + PT(GeomVertexArrayFormat) array_format = new GeomVertexArrayFormat; array_format->add_column (InternalName::get_vertex(), vertex_pool->get_num_dimensions(), @@ -2244,9 +2244,15 @@ make_vertex_data(const EggRenderState *render_state, } if (!ignore_color) { - array_format->add_column - (InternalName::get_color(), 1, - Geom::NT_packed_dabc, Geom::C_color); + // Let's not use Direct3D-style colors on platforms where we only + // have OpenGL anyway. +#ifdef _WIN32 + array_format->add_column(InternalName::get_color(), 1, + Geom::NT_packed_dabc, Geom::C_color); +#else + array_format->add_column(InternalName::get_color(), 4, + Geom::NT_uint8, Geom::C_color); +#endif } vector_string uv_names, uvw_names, tbn_names; From cda7c1f1719e6a44101409e5e1efdf1d00d7139d Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 4 Apr 2015 21:58:29 +0200 Subject: [PATCH 39/73] OpenGL ES 2 optimizations and better support --- panda/src/gles2gsg/gles2gsg.h | 7 + panda/src/glesgsg/glesgsg.h | 1 + panda/src/glesgsg/panda_esglext.h | 7 +- .../src/glstuff/glGraphicsStateGuardian_src.I | 51 +- .../glstuff/glGraphicsStateGuardian_src.cxx | 766 ++++++++++++------ .../src/glstuff/glGraphicsStateGuardian_src.h | 58 +- panda/src/glstuff/glShaderContext_src.cxx | 99 ++- panda/src/glstuff/glShaderContext_src.h | 1 + 8 files changed, 675 insertions(+), 315 deletions(-) diff --git a/panda/src/gles2gsg/gles2gsg.h b/panda/src/gles2gsg/gles2gsg.h index d06c160e02..71ac91e594 100644 --- a/panda/src/gles2gsg/gles2gsg.h +++ b/panda/src/gles2gsg/gles2gsg.h @@ -113,6 +113,13 @@ typedef char GLchar; #define GL_R32F GL_R32F_EXT #define GL_RG32F GL_RG32F_EXT #define GL_RGB8 GL_RGB8_OES +#define GL_TEXTURE_COMPARE_FUNC_ARB GL_TEXTURE_COMPARE_FUNC_EXT +#define GL_TEXTURE_COMPARE_MODE_ARB GL_TEXTURE_COMPARE_MODE_EXT +#define GL_COMPARE_R_TO_TEXTURE_ARB GL_COMPARE_REF_TO_TEXTURE_EXT +#define GL_SAMPLER_2D_SHADOW GL_SAMPLER_2D_SHADOW_EXT +#define GL_MAX_DRAW_BUFFERS GL_MAX_DRAW_BUFFERS_NV +#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE +#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE #undef SUPPORT_IMMEDIATE_MODE #define APIENTRY diff --git a/panda/src/glesgsg/glesgsg.h b/panda/src/glesgsg/glesgsg.h index 9a3825c5dd..3282cd4536 100644 --- a/panda/src/glesgsg/glesgsg.h +++ b/panda/src/glesgsg/glesgsg.h @@ -118,6 +118,7 @@ #define GL_ALPHA8 GL_ALPHA8_EXT #define GL_LUMINANCE8 GL_LUMINANCE8_EXT #define GL_LUMINANCE8_ALPHA8 GL_LUMINANCE8_ALPHA8_EXT +#define GL_MAX_VERTEX_UNITS_ARB GL_MAX_VERTEX_UNITS_OES #undef SUPPORT_IMMEDIATE_MODE #define APIENTRY diff --git a/panda/src/glesgsg/panda_esglext.h b/panda/src/glesgsg/panda_esglext.h index 1a9e57e2a5..bb347948cc 100644 --- a/panda/src/glesgsg/panda_esglext.h +++ b/panda/src/glesgsg/panda_esglext.h @@ -1,7 +1,7 @@ #ifndef __panda_esglext_h_ #define __panda_esglext_h_ -/* $Revision$ on $Date$ */ +/* $Revision: 20798 $ on $Date:: 2013-03-07 01:19:34 -0800 #$ */ #ifdef __cplusplus extern "C" { @@ -1055,10 +1055,10 @@ typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays 1 #ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum, GLint *, GLsizei *, GLsizei); +GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei); GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* *, GLsizei); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif @@ -1275,3 +1275,4 @@ typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); #endif #endif /* __glext_h_ */ + diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.I b/panda/src/glstuff/glGraphicsStateGuardian_src.I index 694abd1280..d973269700 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.I +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.I @@ -532,6 +532,7 @@ enable_depth_test(bool val) { } } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::enable_fog // Access: @@ -539,7 +540,6 @@ enable_depth_test(bool val) { //////////////////////////////////////////////////////////////////// INLINE void CLP(GraphicsStateGuardian):: enable_fog(bool val) { -#ifndef OPENGLES_2 if (_fog_enabled != val) { _fog_enabled = val; if (val) { @@ -556,9 +556,10 @@ enable_fog(bool val) { glDisable(GL_FOG); } } -#endif } +#endif +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::enable_alpha_test // Access: @@ -566,7 +567,6 @@ enable_fog(bool val) { //////////////////////////////////////////////////////////////////// INLINE void CLP(GraphicsStateGuardian):: enable_alpha_test(bool val) { -#ifndef OPENGLES_2 if (_alpha_test_enabled != val) { _alpha_test_enabled = val; if (val) { @@ -583,9 +583,8 @@ enable_alpha_test(bool val) { glDisable(GL_ALPHA_TEST); } } -#endif // OPENGLES_2 } - +#endif //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::enable_polygon_offset @@ -645,6 +644,7 @@ clear_color_write_mask() { } } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::call_glFogfv // Access: Public @@ -653,16 +653,16 @@ clear_color_write_mask() { //////////////////////////////////////////////////////////////////// INLINE void CLP(GraphicsStateGuardian):: call_glFogfv(GLenum pname, const LColor &color) { -#ifndef OPENGLES_2 #ifndef STDFLOAT_DOUBLE glFogfv(pname, color.get_data()); #else // STDFLOAT_DOUBLE LColorf fcolor = LCAST(float, color); glFogfv(pname, fcolor.get_data()); #endif // STDFLOAT_DOUBLE -#endif } +#endif +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::call_glMaterialfv // Access: Public @@ -671,16 +671,16 @@ call_glFogfv(GLenum pname, const LColor &color) { //////////////////////////////////////////////////////////////////// INLINE void CLP(GraphicsStateGuardian):: call_glMaterialfv(GLenum face, GLenum pname, const LColor &color) { -#ifndef OPENGLES_2 #ifndef STDFLOAT_DOUBLE glMaterialfv(face, pname, color.get_data()); #else // STDFLOAT_DOUBLE LColorf fcolor = LCAST(float, color); glMaterialfv(face, pname, fcolor.get_data()); #endif // STDFLOAT_DOUBLE -#endif } +#endif +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::call_glLightfv // Access: Public @@ -689,16 +689,16 @@ call_glMaterialfv(GLenum face, GLenum pname, const LColor &color) { //////////////////////////////////////////////////////////////////// INLINE void CLP(GraphicsStateGuardian):: call_glLightfv(GLenum light, GLenum pname, const LVecBase4 &value) { -#ifndef OPENGLES_2 #ifndef STDFLOAT_DOUBLE glLightfv(light, pname, value.get_data()); #else // STDFLOAT_DOUBLE LVecBase4f fvalue = LCAST(float, value); glLightfv(light, pname, fvalue.get_data()); #endif // STDFLOAT_DOUBLE -#endif } +#endif +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::call_glLightfv // Access: Public @@ -707,16 +707,16 @@ call_glLightfv(GLenum light, GLenum pname, const LVecBase4 &value) { //////////////////////////////////////////////////////////////////// INLINE void CLP(GraphicsStateGuardian):: call_glLightfv(GLenum light, GLenum pname, const LVecBase3 &value) { -#ifndef OPENGLES_2 #ifndef STDFLOAT_DOUBLE glLightfv(light, pname, value.get_data()); #else // STDFLOAT_DOUBLE LVecBase3f fvalue = LCAST(float, value); glLightfv(light, pname, fvalue.get_data()); #endif // STDFLOAT_DOUBLE -#endif } +#endif +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::call_glLightModelfv // Access: Public @@ -725,16 +725,16 @@ call_glLightfv(GLenum light, GLenum pname, const LVecBase3 &value) { //////////////////////////////////////////////////////////////////// INLINE void CLP(GraphicsStateGuardian):: call_glLightModelfv(GLenum pname, const LVecBase4 &value) { -#ifndef OPENGLES_2 #ifndef STDFLOAT_DOUBLE glLightModelfv(pname, value.get_data()); #else // STDFLOAT_DOUBLE LVecBase4f fvalue = LCAST(float, value); glLightModelfv(pname, fvalue.get_data()); #endif // STDFLOAT_DOUBLE -#endif // OPENGLES_2 } +#endif +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::call_glTexEnvfv // Access: Public @@ -743,15 +743,14 @@ call_glLightModelfv(GLenum pname, const LVecBase4 &value) { //////////////////////////////////////////////////////////////////// INLINE void CLP(GraphicsStateGuardian):: call_glTexEnvfv(GLenum target, GLenum pname, const LVecBase4 &value) { -#ifndef OPENGLES_2 #ifndef STDFLOAT_DOUBLE glTexEnvfv(target, pname, value.get_data()); #else // STDFLOAT_DOUBLE LVecBase4f fvalue = LCAST(float, value); glTexEnvfv(target, pname, fvalue.get_data()); #endif // STDFLOAT_DOUBLE -#endif } +#endif //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::call_glTexParameterfv @@ -769,6 +768,7 @@ call_glTexParameterfv(GLenum target, GLenum pname, const LVecBase4 &value) { #endif // STDFLOAT_DOUBLE } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::get_light_id // Access: Public @@ -776,13 +776,11 @@ call_glTexParameterfv(GLenum target, GLenum pname, const LVecBase4 &value) { //////////////////////////////////////////////////////////////////// INLINE GLenum CLP(GraphicsStateGuardian):: get_light_id(int index) const { -#ifndef OPENGLES_2 return GL_LIGHT0 + index; -#else - return 0; -#endif } +#endif +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::get_clip_plane_id // Access: Public @@ -790,12 +788,9 @@ get_light_id(int index) const { //////////////////////////////////////////////////////////////////// INLINE GLenum CLP(GraphicsStateGuardian):: get_clip_plane_id(int index) const { -#ifndef OPENGLES_2 return GL_CLIP_PLANE0 + index; -#else - return 0; -#endif } +#endif //////////////////////////////////////////////////////////////////// // Function: CLP(GraphicsStateGuardian)::get_supports_framebuffer_multisample @@ -805,7 +800,7 @@ get_clip_plane_id(int index) const { //////////////////////////////////////////////////////////////////// INLINE bool CLP(GraphicsStateGuardian):: get_supports_framebuffer_multisample() { - return _supports_framebuffer_multisample; + return _supports_framebuffer_multisample; } //////////////////////////////////////////////////////////////////// @@ -816,7 +811,7 @@ get_supports_framebuffer_multisample() { //////////////////////////////////////////////////////////////////// INLINE bool CLP(GraphicsStateGuardian):: get_supports_framebuffer_multisample_coverage_nv() { - return _supports_framebuffer_multisample_coverage_nv; + return _supports_framebuffer_multisample_coverage_nv; } @@ -828,7 +823,7 @@ get_supports_framebuffer_multisample_coverage_nv() { //////////////////////////////////////////////////////////////////// INLINE bool CLP(GraphicsStateGuardian):: get_supports_framebuffer_blit() { - return _supports_framebuffer_blit; + return _supports_framebuffer_blit; } #ifndef NDEBUG diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 7813d9cc2a..5471dfeb87 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -96,6 +96,12 @@ static void APIENTRY null_glPointParameterfv(GLenum, const GLfloat *) { } +#ifdef OPENGLES +// OpenGL ES doesn't support this, period. Might as well macro it. +#define _glDrawRangeElements(mode, start, end, count, type, indices) \ + glDrawElements(mode, count, type, indices) + +#else static void APIENTRY null_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices) { @@ -103,6 +109,7 @@ null_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, // glDrawElements() instead. glDrawElements(mode, count, type, indices); } +#endif static void APIENTRY null_glActiveTexture(GLenum gl_texture_stage) { @@ -471,12 +478,14 @@ reset() { _supports_debug = true; _use_object_labels = gl_debug_object_labels; +#ifndef OPENGLES } else if (has_extension("GL_ARB_debug_output")) { _glDebugMessageCallback = (PFNGLDEBUGMESSAGECALLBACKPROC) get_extension_func("glDebugMessageCallbackARB"); _glDebugMessageControl = (PFNGLDEBUGMESSAGECONTROLPROC) get_extension_func("glDebugMessageControlARB"); _supports_debug = true; +#endif } if (_supports_debug) { @@ -520,6 +529,7 @@ reset() { _supports_point_parameters = false; +#ifndef OPENGLES_2 if (is_at_least_gl_version(1, 4)) { _supports_point_parameters = true; _glPointParameterfv = (PFNGLPOINTPARAMETERFVPROC) @@ -542,8 +552,17 @@ reset() { } else { _glPointParameterfv = null_glPointParameterfv; } +#endif // !OPENGLES_2 + +#if defined(OPENGLES_2) + // OpenGL ES 2 doesn't have point sprites. + _supports_point_sprite = false; +#elif defined(OPENGLES_1) + _supports_point_sprite = has_extension("GL_OES_point_sprite"); +#else + _supports_point_sprite = has_extension("GL_ARB_point_sprite"); +#endif - _supports_point_sprite = has_extension("GL_ARB_point_sprite") || has_extension("GL_OES_point_sprite"); if (_supports_point_sprite) { // It appears that the point_sprite extension doesn't support // texture transforms on the generated texture coordinates. How @@ -576,11 +595,12 @@ reset() { get_extension_func("glPrimitiveRestartIndex"); } - // We used to have a case here for GL_NV_primitive_restart, but it - // seems to cause garbled geometry bugs on some drivers. } #endif +#ifdef OPENGLES_2 + _supports_vertex_blend = false; +#else _supports_vertex_blend = has_extension("GL_ARB_vertex_blend"); if (_supports_vertex_blend) { @@ -600,10 +620,13 @@ reset() { _supports_vertex_blend = false; } } +#endif -#ifndef OPENGLES +#ifndef OPENGLES_2 if (_supports_vertex_blend) { +#ifndef OPENGLES glEnable(GL_WEIGHT_SUM_UNITY_ARB); +#endif GLint max_vertex_units = 0; glGetIntegerv(GL_MAX_VERTEX_UNITS_ARB, &max_vertex_units); @@ -634,7 +657,7 @@ reset() { _supports_matrix_palette = false; } } -#else +#elif defined(OPENGLES_1) if (has_extension("GL_OES_matrix_palette")) { _supports_matrix_palette = true; _glCurrentPaletteMatrix = (PFNGLCURRENTPALETTEMATRIXOESPROC) @@ -684,46 +707,27 @@ reset() { } } - _supports_draw_range_elements = false; +#ifndef OPENGLES + _glDrawRangeElements = null_glDrawRangeElements; if (is_at_least_gl_version(1, 2)) { - _supports_draw_range_elements = true; _glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) get_extension_func("glDrawRangeElements"); } else if (has_extension("GL_EXT_draw_range_elements")) { - _supports_draw_range_elements = true; _glDrawRangeElements = (PFNGLDRAWRANGEELEMENTSPROC) get_extension_func("glDrawRangeElementsEXT"); } - if (_supports_draw_range_elements) { - if (_glDrawRangeElements == NULL) { - GLCAT.warning() - << "glDrawRangeElements advertised as supported by OpenGL runtime, but could not get pointers to extension functions.\n"; - _supports_draw_range_elements = false; - } - } - if (!_supports_draw_range_elements) { + if (_glDrawRangeElements == NULL) { + GLCAT.warning() + << "glDrawRangeElements advertised as supported by OpenGL runtime, but could not get pointers to extension functions.\n"; _glDrawRangeElements = null_glDrawRangeElements; } - -#ifdef OPENGLES - _supports_depth_texture = has_extension("GL_OES_depth_texture"); - _supports_depth24 = has_extension("GL_OES_depth24"); - _supports_depth32 = has_extension("GL_OES_depth32"); -#else - _supports_depth_texture = - has_extension("GL_ARB_depth_texture") || is_at_least_gl_version(1, 4); #endif - _supports_depth_stencil = false; - if (_supports_depth_texture) { - _supports_depth_stencil = - has_extension("GL_EXT_packed_depth_stencil") || has_extension("GL_OES_packed_depth_stencil"); - } - _supports_3d_texture = false; +#ifndef OPENGLES_1 if (is_at_least_gl_version(1, 2)) { _supports_3d_texture = true; @@ -771,9 +775,11 @@ reset() { _supports_3d_texture = false; } } +#endif // !OPENGLES_1 _supports_tex_storage = false; +#ifndef OPENGLES if (is_at_least_gl_version(4, 2) || has_extension("GL_ARB_texture_storage")) { _supports_tex_storage = true; @@ -784,7 +790,9 @@ reset() { _glTexStorage3D = (PFNGLTEXSTORAGE3DPROC) get_extension_func("glTexStorage3D"); - } else if (has_extension("GL_EXT_texture_storage")) { // GLES case + } else +#endif + if (has_extension("GL_EXT_texture_storage")) { // GLES case _supports_tex_storage = true; _glTexStorage1D = (PFNGLTEXSTORAGE1DPROC) @@ -991,8 +999,12 @@ reset() { (has_extension("GL_EXT_rescale_normal") || is_at_least_gl_version(1, 2)); #endif +#ifdef OPENGLES + _supports_packed_dabc = false; +#else _supports_packed_dabc = /*gl_support_packed_dabc &&*/ has_extension("GL_ARB_vertex_array_bgra") || has_extension("GL_EXT_vertex_array_bgra"); +#endif _supports_multisample = has_extension("GL_ARB_multisample") || is_at_least_gl_version(1, 3); @@ -1004,8 +1016,6 @@ reset() { has_extension("GL_SGIS_generate_mipmap") || is_at_least_gl_version(1, 4) || is_at_least_gles_version(1, 1); #endif - _supports_multitexture = false; - #ifdef OPENGLES _supports_tex_non_pow2 = has_extension("GL_OES_texture_npot"); @@ -1014,8 +1024,8 @@ reset() { has_extension("GL_ARB_texture_non_power_of_two"); #endif -#ifdef OPENGLES_2 // OpenGL ES 2.0 doesn't support multitexturing. - _supports_multitexture = false; +#ifdef OPENGLES_2 + _glActiveTexture = glActiveTexture; #else if (is_at_least_gl_version(1, 3) || is_at_least_gles_version(1, 1)) { _supports_multitexture = true; @@ -1064,6 +1074,8 @@ reset() { get_extension_func("glMultiTexCoord3dARB"); _glMultiTexCoord4d = (PFNGLMULTITEXCOORD4DPROC) get_extension_func("glMultiTexCoord4dARB"); + } else { + _supports_multitexture = false; } if (_supports_multitexture) { @@ -1078,23 +1090,45 @@ reset() { _supports_multitexture = false; } } -#endif if (!_supports_multitexture) { + // Replace with dummy no-op functions. _glActiveTexture = null_glActiveTexture; _glClientActiveTexture = null_glActiveTexture; } +#endif - if (has_extension("GL_ARB_depth_texture")) { +#ifdef OPENGLES + if (has_extension("GL_ANGLE_depth_texture")) { + // This extension provides both depth textures and depth-stencil support. _supports_depth_texture = true; - } + _supports_depth_stencil = true; + } else if (has_extension("GL_OES_depth_texture")) { + _supports_depth_texture = true; + _supports_depth_stencil = has_extension("GL_OES_packed_depth_stencil"); + } + _supports_depth24 = has_extension("GL_OES_depth24"); + _supports_depth32 = has_extension("GL_OES_depth32"); + +#else + _supports_depth_texture = (is_at_least_gl_version(1, 4) || + has_extension("GL_ARB_depth_texture")); +#endif + +#ifdef OPENGLES_2 + if (gl_support_shadow_filter && _supports_depth_texture && + has_extension("GL_EXT_shadow_samplers")) { + _supports_shadow_filter = true; + } +#else if (gl_support_shadow_filter && _supports_depth_texture && has_extension("GL_ARB_shadow") && has_extension("GL_ARB_fragment_program_shadow")) { _supports_shadow_filter = true; } +#endif // Actually, we can't keep forever disabling ARB_shadow on ATI cards, // since they do work correctly now. Maybe there is some feature // level we can check somewhere? @@ -1103,15 +1137,29 @@ reset() { _supports_shadow_filter = false; }*/ +#ifdef OPENGLES_2 + _supports_texture_combine = false; + _supports_texture_saved_result = false; + _supports_texture_dot3 = false; +#else _supports_texture_combine = has_extension("GL_ARB_texture_env_combine") || is_at_least_gl_version(1, 3) || is_at_least_gles_version(1, 1); _supports_texture_saved_result = has_extension("GL_ARB_texture_env_crossbar") || has_extension("GL_OES_texture_env_crossbar") || is_at_least_gl_version(1, 4); _supports_texture_dot3 = has_extension("GL_ARB_texture_env_dot3") || is_at_least_gl_version(1, 3) || is_at_least_gles_version(1, 1); +#endif +#ifdef OPENGLES_2 + _supports_buffers = true; + _glGenBuffers = glGenBuffers; + _glBindBuffer = glBindBuffer; + _glBufferData = glBufferData; + _glBufferSubData = glBufferSubData; + _glDeleteBuffers = glDeleteBuffers; + +#else _supports_buffers = false; - if (is_at_least_gl_version(1, 5) || is_at_least_gles_version(1, 1)) { _supports_buffers = true; @@ -1125,8 +1173,9 @@ reset() { get_extension_func("glBufferSubData"); _glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) get_extension_func("glDeleteBuffers"); - - } else if (has_extension("GL_ARB_vertex_buffer_object")) { + } +#ifndef OPENGLES_1 + else if (has_extension("GL_ARB_vertex_buffer_object")) { _supports_buffers = true; _glGenBuffers = (PFNGLGENBUFFERSPROC) @@ -1140,6 +1189,7 @@ reset() { _glDeleteBuffers = (PFNGLDELETEBUFFERSPROC) get_extension_func("glDeleteBuffersARB"); } +#endif // OPENGLES_1 if (_supports_buffers) { if (_glGenBuffers == NULL || _glBindBuffer == NULL || @@ -1150,6 +1200,7 @@ reset() { _supports_buffers = false; } } +#endif #if defined(HAVE_CG) && !defined(OPENGLES) if (cgGLIsProfileSupported(CG_PROFILE_ARBFP1) && @@ -1385,19 +1436,129 @@ reset() { } #endif + // Check whether we support geometry instancing and instanced vertex attribs. +#if defined(OPENGLES_1) _supports_vertex_attrib_divisor = false; -#ifndef OPENGLES - if (is_at_least_gl_version(3, 3)) { + _supports_geometry_instancing = false; + +#elif defined(OPENGLES_2) + if (has_extension("GL_ANGLE_instanced_arrays")) { + // This extension has both things in one. +#ifdef __EMSCRIPTEN__ + // Work around bug - it doesn't allow ANGLE suffix in getProcAddress. _glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) get_extension_func("glVertexAttribDivisor"); + _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) + get_extension_func("glDrawArraysInstanced"); + _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) + get_extension_func("glDrawElementsInstanced"); +#else + _glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) + get_extension_func("glVertexAttribDivisorANGLE"); + _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) + get_extension_func("glDrawArraysInstancedANGLE"); + _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) + get_extension_func("glDrawElementsInstancedANGLE"); +#endif _supports_vertex_attrib_divisor = true; + _supports_geometry_instancing = true; + + } else { + // Check separately for geometry instancing and instanced attribs. + if (has_extension("GL_EXT_draw_instanced")) { + _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) + get_extension_func("glDrawArraysInstancedEXT"); + _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) + get_extension_func("glDrawElementsInstancedEXT"); + _supports_geometry_instancing = true; + + } else if (has_extension("GL_NV_draw_instanced")) { + _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) + get_extension_func("glDrawArraysInstancedNV"); + _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) + get_extension_func("glDrawElementsInstancedNV"); + _supports_geometry_instancing = true; + + } else { + _supports_geometry_instancing = false; + } + + if (has_extension("GL_EXT_instanced_arrays")) { + _glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) + get_extension_func("glVertexAttribDivisorEXT"); + _supports_vertex_attrib_divisor = true; + + } else if (has_extension("GL_NV_instanced_arrays")) { + _glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) + get_extension_func("glVertexAttribDivisorNV"); + _supports_vertex_attrib_divisor = true; + + } else { + _supports_vertex_attrib_divisor = false; + } + } + +#else + if (is_at_least_gl_version(3, 3)) { + // This feature is in OpenGL core as of 3.3. + _glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) + get_extension_func("glVertexAttribDivisor"); + _supports_vertex_attrib_divisor = true; } else if (has_extension("GL_ARB_instanced_arrays")) { _glVertexAttribDivisor = (PFNGLVERTEXATTRIBDIVISORPROC) get_extension_func("glVertexAttribDivisorARB"); - _supports_vertex_attrib_divisor = true; + + } else { + _supports_vertex_attrib_divisor = false; + } + + // Some drivers expose one extension, some expose the other. + if (is_at_least_gl_version(3, 1)) { + _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) + get_extension_func("glDrawArraysInstanced"); + _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) + get_extension_func("glDrawElementsInstanced"); + _supports_geometry_instancing = true; + + } else if (has_extension("GL_ARB_draw_instanced")) { + _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) + get_extension_func("glDrawArraysInstancedARB"); + _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) + get_extension_func("glDrawElementsInstancedARB"); + _supports_geometry_instancing = true; + + } else if (has_extension("GL_EXT_draw_instanced")) { + _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) + get_extension_func("glDrawArraysInstancedEXT"); + _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) + get_extension_func("glDrawElementsInstancedEXT"); + _supports_geometry_instancing = true; + + } else { + _glDrawElementsInstanced = 0; + _glDrawArraysInstanced = 0; + _supports_geometry_instancing = false; + } +#endif + +#ifndef OPENGLES_1 + if (_supports_geometry_instancing) { + if (_glDrawArraysInstanced == NULL || _glDrawElementsInstanced == NULL) { + GLCAT.warning() + << "Geometry instancing advertised as supported by OpenGL runtime, but could not get pointers to extension functions.\n"; + _supports_geometry_instancing = false; + } + } + + if (_supports_vertex_attrib_divisor) { + if (_glVertexAttribDivisor == NULL) { + GLCAT.warning() + << "Instanced vertex arrays advertised as supported by OpenGL runtime, but could not get pointers to extension functions.\n"; + _supports_vertex_attrib_divisor = false; + } } #endif @@ -1506,43 +1667,67 @@ reset() { get_extension_func("glRenderbufferStorageMultisampleEXT"); } +#ifndef OPENGLES _supports_framebuffer_multisample_coverage_nv = false; if ( has_extension("GL_NV_framebuffer_multisample_coverage") ) { _supports_framebuffer_multisample_coverage_nv = true; _glRenderbufferStorageMultisampleCoverage = (PFNGLRENDERBUFFERSTORAGEMULTISAMPLECOVERAGENVPROC) get_extension_func("glRenderbufferStorageMultisampleCoverageNV"); } +#endif +#ifndef OPENGLES_1 _supports_framebuffer_blit = false; if ( has_extension("GL_EXT_framebuffer_blit") ) { _supports_framebuffer_blit = true; _glBlitFramebuffer = (PFNGLBLITFRAMEBUFFEREXTPROC) get_extension_func("glBlitFramebufferEXT"); } +#endif +#if defined(OPENGLES_1) _glDrawBuffers = NULL; _glClearBufferfv = NULL; -#ifndef OPENGLES + _max_color_targets = 1; + +#elif defined(OPENGLES_2) + if (has_extension("GL_EXT_draw_buffers")) { + _glDrawBuffers = (PFNGLDRAWBUFFERSPROC) + get_extension_func("glDrawBuffersEXT"); + + } else if (has_extension("GL_NV_draw_buffers")) { + _glDrawBuffers = (PFNGLDRAWBUFFERSPROC) + get_extension_func("glDrawBuffersNV"); + } + +#else if (is_at_least_gl_version(2, 0)) { _glDrawBuffers = (PFNGLDRAWBUFFERSPROC) get_extension_func("glDrawBuffers"); + } else if (has_extension("GL_ARB_draw_buffers")) { _glDrawBuffers = (PFNGLDRAWBUFFERSPROC) get_extension_func("glDrawBuffersARB"); } +#endif +#ifndef OPENGLES_1 _max_color_targets = 1; if (_glDrawBuffers != 0) { GLint max_draw_buffers = 0; glGetIntegerv(GL_MAX_DRAW_BUFFERS, &max_draw_buffers); _max_color_targets = max_draw_buffers; } +#endif // !OPENGLES_1 +#ifndef OPENGLES if (is_at_least_gl_version(3, 0)) { _glClearBufferfv = (PFNGLCLEARBUFFERFVPROC) get_extension_func("glClearBufferfv"); + } else { + _glClearBufferfv = NULL; } -#endif // OPENGLES +#endif // !OPENGLES #ifndef OPENGLES _supports_viewport_arrays = false; @@ -1562,18 +1747,17 @@ reset() { _supports_viewport_arrays = true; } } -#endif // OPENGLES +#endif // !OPENGLES _max_fb_samples = 0; -#ifndef OPENGLES if (_supports_framebuffer_multisample) { GLint max_samples; glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_samples); _max_fb_samples = max_samples; } -#endif _supports_occlusion_query = false; +#ifndef OPENGLES if (gl_support_occlusion_query) { if (is_at_least_gl_version(1, 5)) { _supports_occlusion_query = true; @@ -1608,7 +1792,6 @@ reset() { } } -#ifndef OPENGLES if (_supports_occlusion_query) { if (_glGenQueries == NULL || _glBeginQuery == NULL || _glEndQuery == NULL || _glDeleteQueries == NULL || @@ -1628,7 +1811,7 @@ reset() { } } } -#endif +#endif // !OPENGLES _supports_timer_query = false; #if defined(DO_PSTATS) && !defined(OPENGLES) @@ -1718,12 +1901,16 @@ reset() { } #endif +#ifdef OPENGLES_2 + _mirror_repeat = GL_MIRRORED_REPEAT; +#else _mirror_repeat = GL_REPEAT; if (has_extension("GL_ARB_texture_mirrored_repeat") || is_at_least_gl_version(1, 4) || has_extension("GL_OES_texture_mirrored_repeat")) { _mirror_repeat = GL_MIRRORED_REPEAT; } +#endif _mirror_clamp = _edge_clamp; _mirror_edge_clamp = _edge_clamp; @@ -1833,7 +2020,7 @@ reset() { } else { GLCAT.debug() << "Supported compressed texture formats:\n"; - GLint *formats = (GLint *)PANDA_MALLOC_ARRAY(num_compressed_formats * sizeof(GLint)); + GLint *formats = (GLint *)alloca(num_compressed_formats * sizeof(GLint)); glGetIntegerv(GL_COMPRESSED_TEXTURE_FORMATS, formats); for (int i = 0; i < num_compressed_formats; ++i) { switch (formats[i]) { @@ -1860,7 +2047,8 @@ reset() { case GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: GLCAT.debug(false) << " GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG\n"; break; -#else +#endif +#ifndef OPENGLES_1 case GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: GLCAT.debug(false) << " GL_COMPRESSED_RGBA_S3TC_DXT3_EXT\n"; break; @@ -1868,7 +2056,8 @@ reset() { case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: GLCAT.debug(false) << " GL_COMPRESSED_RGBA_S3TC_DXT5_EXT\n"; break; - +#endif +#ifndef OPENGLES case GL_COMPRESSED_RGB_FXT1_3DFX: GLCAT.debug(false) << " GL_COMPRESSED_RGB_FXT1_3DFX\n"; break; @@ -1884,7 +2073,6 @@ reset() { << dec << "\n"; } } - PANDA_FREE_ARRAY(formats); } } } @@ -2040,26 +2228,6 @@ reset() { } #endif -#ifndef OPENGLES - // Some drivers expose one, some expose the other. ARB seems to be the newer one. - if (has_extension("GL_ARB_draw_instanced")) { - _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) - get_extension_func("glDrawArraysInstancedARB"); - _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) - get_extension_func("glDrawElementsInstancedARB"); - _supports_geometry_instancing = true; - } else if (has_extension("GL_EXT_draw_instanced")) { - _glDrawArraysInstanced = (PFNGLDRAWARRAYSINSTANCEDPROC) - get_extension_func("glDrawArraysInstancedEXT"); - _glDrawElementsInstanced = (PFNGLDRAWELEMENTSINSTANCEDPROC) - get_extension_func("glDrawElementsInstancedEXT"); - _supports_geometry_instancing = true; - } else { - _glDrawElementsInstanced = 0; - _glDrawArraysInstanced = 0; - } -#endif - _auto_rescale_normal = false; // Ensure the initial state is what we say it should be (in some @@ -2139,13 +2307,12 @@ reset() { } #endif +#ifdef OPENGLES_2 + _max_texture_stages = 0; +#else if (_supports_multitexture) { GLint max_texture_stages = 0; -#ifdef OPENGLES_2 - glGetIntegerv(GL_MAX_TEXTURE_IMAGE_UNITS, &max_texture_stages); -#else glGetIntegerv(GL_MAX_TEXTURE_UNITS, &max_texture_stages); -#endif _max_texture_stages = max_texture_stages; if (GLCAT.is_debug()) { @@ -2153,6 +2320,8 @@ reset() { << "max texture stages = " << _max_texture_stages << "\n"; } } +#endif + _current_vbuffer_index = 0; _current_ibuffer_index = 0; _current_fbo = 0; @@ -2626,14 +2795,18 @@ prepare_display_region(DisplayRegionPipelineReader *dr) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: clear_before_callback() { +#ifndef OPENGLES_2 disable_standard_vertex_arrays(); +#endif unbind_buffers(); // Some callbacks may quite reasonably assume that the active // texture stage is still set to stage 0. CEGUI, in particular, // makes this assumption. _glActiveTexture(GL_TEXTURE0); +#ifndef OPENGLES_2 _glClientActiveTexture(GL_TEXTURE0); +#endif // Clear the bound sampler object, so that we do not inadvertently // override the callback's desired sampler settings. @@ -3231,10 +3404,13 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader, if (_vertex_array_shader_context != 0) { _vertex_array_shader_context->disable_shader_vertex_arrays(); } +#ifndef OPENGLES_2 if (!update_standard_vertex_arrays(force)) { return false; } +#endif } else { +#ifndef OPENGLES_2 // Shader. if (_vertex_array_shader_context == 0 || _vertex_array_shader_context->uses_standard_vertex_arrays()) { // Previous shader used standard arrays. @@ -3248,6 +3424,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader, disable_standard_vertex_arrays(); } } +#endif // !OPENGLES_2 if (_current_shader_context->uses_custom_vertex_arrays()) { // The current shader also uses custom vertex arrays. if (!_current_shader_context-> @@ -3268,6 +3445,7 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader, return true; } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::update_standard_vertex_arrays // Access: Protected @@ -3282,7 +3460,6 @@ begin_draw_primitives(const GeomPipelineReader *geom_reader, //////////////////////////////////////////////////////////////////// bool CLP(GraphicsStateGuardian):: update_standard_vertex_arrays(bool force) { -#ifndef OPENGLES_2 const GeomVertexAnimationSpec &animation = _data_reader->get_format()->get_animation(); bool hardware_animation = (animation.get_animation_type() == Geom::AT_hardware); @@ -3512,9 +3689,9 @@ update_standard_vertex_arrays(bool force) { glEnableClientState(GL_VERTEX_ARRAY); } } -#endif // OPENGLES_2 return true; } +#endif // !OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::unbind_buffers @@ -3542,9 +3719,12 @@ unbind_buffers() { _current_ibuffer_index = 0; } +#ifndef OPENGLES_2 disable_standard_vertex_arrays(); +#endif } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::disable_standard_vertex_arrays // Access: Protected @@ -3557,7 +3737,6 @@ unbind_buffers() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: disable_standard_vertex_arrays() { -#ifndef OPENGLES_2 #ifdef SUPPORT_IMMEDIATE_MODE if (_use_sender) return; #endif @@ -3583,8 +3762,8 @@ disable_standard_vertex_arrays() { glDisableClientState(GL_VERTEX_ARRAY); report_my_gl_errors(); -#endif } +#endif // !OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::draw_triangles @@ -3618,7 +3797,7 @@ draw_triangles(const GeomPrimitivePipelineReader *reader, bool force) { return false; } -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_TRIANGLES, num_vertices, get_numeric_type(reader->get_index_type()), @@ -3634,7 +3813,7 @@ draw_triangles(const GeomPrimitivePipelineReader *reader, bool force) { client_pointer); } } else { -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawArraysInstanced(GL_TRIANGLES, reader->get_first_vertex(), @@ -3688,7 +3867,7 @@ draw_tristrips(const GeomPrimitivePipelineReader *reader, bool force) { if (!setup_primitive(client_pointer, reader, force)) { return false; } -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_TRIANGLE_STRIP, num_vertices, get_numeric_type(reader->get_index_type()), @@ -3704,7 +3883,7 @@ draw_tristrips(const GeomPrimitivePipelineReader *reader, bool force) { client_pointer); } } else { -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawArraysInstanced(GL_TRIANGLE_STRIP, reader->get_first_vertex(), @@ -3738,7 +3917,7 @@ draw_tristrips(const GeomPrimitivePipelineReader *reader, bool force) { unsigned int start = 0; for (size_t i = 0; i < ends.size(); i++) { _vertices_tristrip_pcollector.add_level(ends[i] - start); -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_TRIANGLE_STRIP, ends[i] - start, get_numeric_type(reader->get_index_type()), @@ -3760,7 +3939,7 @@ draw_tristrips(const GeomPrimitivePipelineReader *reader, bool force) { int first_vertex = reader->get_first_vertex(); for (size_t i = 0; i < ends.size(); i++) { _vertices_tristrip_pcollector.add_level(ends[i] - start); -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawArraysInstanced(GL_TRIANGLE_STRIP, first_vertex + start, ends[i] - start, _instance_count); @@ -3819,7 +3998,7 @@ draw_trifans(const GeomPrimitivePipelineReader *reader, bool force) { unsigned int start = 0; for (size_t i = 0; i < ends.size(); i++) { _vertices_trifan_pcollector.add_level(ends[i] - start); -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_TRIANGLE_FAN, ends[i] - start, get_numeric_type(reader->get_index_type()), @@ -3840,7 +4019,7 @@ draw_trifans(const GeomPrimitivePipelineReader *reader, bool force) { int first_vertex = reader->get_first_vertex(); for (size_t i = 0; i < ends.size(); i++) { _vertices_trifan_pcollector.add_level(ends[i] - start); -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawArraysInstanced(GL_TRIANGLE_FAN, first_vertex + start, ends[i] - start, _instance_count); @@ -3899,7 +4078,7 @@ draw_patches(const GeomPrimitivePipelineReader *reader, bool force) { return false; } -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_PATCHES, num_vertices, get_numeric_type(reader->get_index_type()), @@ -3915,7 +4094,7 @@ draw_patches(const GeomPrimitivePipelineReader *reader, bool force) { client_pointer); } } else { -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawArraysInstanced(GL_PATCHES, reader->get_first_vertex(), @@ -3965,7 +4144,7 @@ draw_lines(const GeomPrimitivePipelineReader *reader, bool force) { if (!setup_primitive(client_pointer, reader, force)) { return false; } -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_LINES, num_vertices, get_numeric_type(reader->get_index_type()), @@ -3981,7 +4160,7 @@ draw_lines(const GeomPrimitivePipelineReader *reader, bool force) { client_pointer); } } else { -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawArraysInstanced(GL_LINES, reader->get_first_vertex(), @@ -4042,7 +4221,7 @@ draw_linestrips(const GeomPrimitivePipelineReader *reader, bool force) { if (!setup_primitive(client_pointer, reader, force)) { return false; } -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_LINE_STRIP, num_vertices, get_numeric_type(reader->get_index_type()), @@ -4083,7 +4262,7 @@ draw_linestrips(const GeomPrimitivePipelineReader *reader, bool force) { unsigned int start = 0; for (size_t i = 0; i < ends.size(); i++) { _vertices_other_pcollector.add_level(ends[i] - start); -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_LINE_STRIP, ends[i] - start, get_numeric_type(reader->get_index_type()), @@ -4105,15 +4284,14 @@ draw_linestrips(const GeomPrimitivePipelineReader *reader, bool force) { int first_vertex = reader->get_first_vertex(); for (size_t i = 0; i < ends.size(); i++) { _vertices_other_pcollector.add_level(ends[i] - start); -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawArraysInstanced(GL_LINE_STRIP, first_vertex + start, ends[i] - start, _instance_count); } else #endif { - glDrawArrays(GL_LINE_STRIP, first_vertex + start, - ends[i] - start); + glDrawArrays(GL_LINE_STRIP, first_vertex + start, ends[i] - start); } start = ends[i] + 1; } @@ -4154,7 +4332,7 @@ draw_points(const GeomPrimitivePipelineReader *reader, bool force) { if (!setup_primitive(client_pointer, reader, force)) { return false; } -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawElementsInstanced(GL_POINTS, num_vertices, get_numeric_type(reader->get_index_type()), @@ -4170,7 +4348,7 @@ draw_points(const GeomPrimitivePipelineReader *reader, bool force) { client_pointer); } } else { -#ifndef OPENGLES +#ifndef OPENGLES_1 if (_supports_geometry_instancing && _instance_count > 0) { _glDrawArraysInstanced(GL_POINTS, reader->get_first_vertex(), @@ -4178,9 +4356,7 @@ draw_points(const GeomPrimitivePipelineReader *reader, bool force) { } else #endif { - glDrawArrays(GL_POINTS, - reader->get_first_vertex(), - num_vertices); + glDrawArrays(GL_POINTS, reader->get_first_vertex(), num_vertices); } } } @@ -4241,6 +4417,7 @@ end_draw_primitives() { report_my_gl_errors(); } +#ifndef OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::issue_memory_barrier // Access: Public @@ -4250,7 +4427,6 @@ end_draw_primitives() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: issue_memory_barrier(GLbitfield barriers) { -#ifndef OPENGLES if (!gl_enable_memory_barriers || _glMemoryBarrier == NULL) { return; } @@ -4288,8 +4464,8 @@ issue_memory_barrier(GLbitfield barriers) { GLCAT.spam(false) << "\n"; report_my_gl_errors(); -#endif // OPENGLES } +#endif // OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::prepare_texture @@ -4459,6 +4635,7 @@ extract_texture_data(Texture *tex) { return success; } +#ifndef OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::prepare_sampler // Access: Public, Virtual @@ -4475,7 +4652,6 @@ extract_texture_data(Texture *tex) { //////////////////////////////////////////////////////////////////// SamplerContext *CLP(GraphicsStateGuardian):: prepare_sampler(const SamplerState &sampler) { -#ifndef OPENGLES nassertr(_supports_sampler_objects, NULL); PStatGPUTimer timer(this, _prepare_sampler_pcollector); @@ -4543,12 +4719,10 @@ prepare_sampler(const SamplerState &sampler) { report_my_gl_errors(); return gsc; - -#else - return NULL; -#endif // OPENGLES } +#endif // !OPENGLES +#ifndef OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::release_sampler // Access: Public, Virtual @@ -4558,11 +4732,10 @@ prepare_sampler(const SamplerState &sampler) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: release_sampler(SamplerContext *sc) { -#ifndef OPENGLES CLP(SamplerContext) *gsc = DCAST(CLP(SamplerContext), sc); delete gsc; -#endif } +#endif // !OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::prepare_geom @@ -5064,6 +5237,7 @@ setup_primitive(const unsigned char *&client_pointer, return true; } +#ifndef OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::begin_occlusion_query // Access: Public, Virtual @@ -5082,10 +5256,6 @@ setup_primitive(const unsigned char *&client_pointer, //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: begin_occlusion_query() { -#ifdef OPENGLES // Occlusion queries not supported by OpenGL ES. - nassertv(false); - -#else nassertv(_supports_occlusion_query); nassertv(_current_occlusion_query == (OcclusionQueryContext *)NULL); PT(CLP(OcclusionQueryContext)) query = new CLP(OcclusionQueryContext)(this); @@ -5101,9 +5271,10 @@ begin_occlusion_query() { _current_occlusion_query = query; report_my_gl_errors(); -#endif // OPENGLES } +#endif // !OPENGLES +#ifndef OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::end_occlusion_query // Access: Public, Virtual @@ -5115,11 +5286,6 @@ begin_occlusion_query() { //////////////////////////////////////////////////////////////////// PT(OcclusionQueryContext) CLP(GraphicsStateGuardian):: end_occlusion_query() { -#ifdef OPENGLES // Occlusion queries not supported by OpenGL ES. - nassertr(false, NULL); - return NULL; - -#else nassertr(_current_occlusion_query != (OcclusionQueryContext *)NULL, NULL); PT(OcclusionQueryContext) result = _current_occlusion_query; @@ -5150,8 +5316,8 @@ end_occlusion_query() { report_my_gl_errors(); return result; -#endif // OPENGLES } +#endif // !OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::issue_timer_query @@ -5204,6 +5370,7 @@ issue_timer_query(int pstats_index) { #endif } +#ifndef OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::dispatch_compute // Access: Public, Virtual @@ -5212,7 +5379,6 @@ issue_timer_query(int pstats_index) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: dispatch_compute(int num_groups_x, int num_groups_y, int num_groups_z) { -#ifndef OPENGLES maybe_gl_finish(); PStatGPUTimer timer(this, _compute_dispatch_pcollector); @@ -5221,8 +5387,8 @@ dispatch_compute(int num_groups_x, int num_groups_y, int num_groups_z) { _glDispatchCompute(num_groups_x, num_groups_y, num_groups_z); maybe_gl_finish(); -#endif } +#endif // !OPENGLES //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::make_geom_munger @@ -5414,6 +5580,7 @@ framebuffer_copy_to_texture(Texture *tex, int view, int z, #endif if (z >= 0) { +#ifndef OPENGLES_1 if (new_image) { // These won't be used because we pass a NULL image, but we still // have to specify them. Might as well use the actual values. @@ -5423,6 +5590,7 @@ framebuffer_copy_to_texture(Texture *tex, int view, int z, } _glCopyTexSubImage3D(target, 0, 0, 0, z, xo, yo, w, h); +#endif } else { if (new_image) { // We have to create a new image. @@ -5645,6 +5813,7 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z, return true; } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::apply_fog // Access: Public, Virtual @@ -5652,7 +5821,6 @@ framebuffer_copy_to_ram(Texture *tex, int view, int z, //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: apply_fog(Fog *fog) { -#ifndef OPENGLES_2 Fog::Mode fmode = fog->get_mode(); glFogf(GL_FOG_MODE, get_fog_mode_type(fmode)); @@ -5669,8 +5837,8 @@ apply_fog(Fog *fog) { call_glFogfv(GL_FOG_COLOR, fog->get_color()); report_my_gl_errors(); -#endif } +#endif // OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_transform @@ -5711,6 +5879,7 @@ do_issue_transform() { report_my_gl_errors(); } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_shade_model // Access: Protected @@ -5718,7 +5887,6 @@ do_issue_transform() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_shade_model() { -#ifndef OPENGLES_2 const ShadeModelAttrib *target_shade_model; _target_rs->get_attrib_def(target_shade_model); @@ -5733,8 +5901,8 @@ do_issue_shade_model() { _flat_shade_model = true; break; } -#endif } +#endif // !OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_shader @@ -5783,9 +5951,6 @@ do_issue_shader(bool state_has_changed) { _current_shader_context = context; context->issue_parameters(Shader::SSD_shaderinputs); } else { -#ifdef OPENGLES_2 - context->bind(false); -#endif if (state_has_changed) { // Use the same shader as before, but with new input arguments. context->issue_parameters(Shader::SSD_shaderinputs); @@ -5908,11 +6073,12 @@ do_issue_antialias() { #endif // OPENGLES break; } -#endif +#endif // !OPENGLES_2 report_my_gl_errors(); } +#ifndef OPENGLES_2 // OpenGL ES 2.0 doesn't support rescaling normals. //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_rescale_normal // Access: Protected @@ -5920,7 +6086,6 @@ do_issue_antialias() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_rescale_normal() { -#ifndef OPENGLES_2 // OpenGL ES 2.0 doesn't support rescaling normals. const RescaleNormalAttrib *target_rescale_normal; _target_rs->get_attrib_def(target_rescale_normal); @@ -5962,8 +6127,8 @@ do_issue_rescale_normal() { << "Unknown rescale_normal mode " << (int)mode << endl; } report_my_gl_errors(); -#endif } +#endif // !OPENGLES_2 // PandaCompareFunc - 1 + 0x200 === GL_NEVER, etc. order is sequential #define PANDA_TO_GL_COMPAREFUNC(PANDACMPFUNC) (PANDACMPFUNC-1 +0x200) @@ -5988,6 +6153,7 @@ do_issue_depth_test() { report_my_gl_errors(); } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_alpha_test // Access: Protected @@ -6006,13 +6172,12 @@ do_issue_alpha_test() { enable_alpha_test(false); } else { nassertv(GL_NEVER == (AlphaTestAttrib::M_never-1+0x200)); -#ifndef OPENGLES_2 glAlphaFunc(PANDA_TO_GL_COMPAREFUNC(mode), target_alpha_test->get_reference_alpha()); -#endif enable_alpha_test(true); } } } +#endif // !OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_depth_write @@ -6073,6 +6238,7 @@ do_issue_cull_face() { report_my_gl_errors(); } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_fog // Access: Protected @@ -6093,6 +6259,7 @@ do_issue_fog() { } report_my_gl_errors(); } +#endif // !OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_depth_offset @@ -6133,6 +6300,7 @@ do_issue_depth_offset() { report_my_gl_errors(); } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_material // Access: Protected @@ -6140,7 +6308,6 @@ do_issue_depth_offset() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_material() { -#ifndef OPENGLES_2 // OpenGL ES 2.0 doesn't support materials. static Material empty; const Material *material; @@ -6238,8 +6405,8 @@ do_issue_material() { #endif report_my_gl_errors(); -#endif // OPENGLES_2 } +#endif // !OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_blending @@ -6370,6 +6537,7 @@ do_issue_blending() { enable_blend(false); } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::bind_light // Access: Public, Virtual @@ -6380,7 +6548,6 @@ do_issue_blending() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: bind_light(PointLight *light_obj, const NodePath &light, int light_id) { -#ifndef OPENGLES_2 // static PStatCollector _draw_set_state_light_bind_point_pcollector("Draw:Set State:Light:Bind:Point"); // PStatGPUTimer timer(this, _draw_set_state_light_bind_point_pcollector); @@ -6412,9 +6579,10 @@ bind_light(PointLight *light_obj, const NodePath &light, int light_id) { glLightf(id, GL_QUADRATIC_ATTENUATION, att[2]); report_my_gl_errors(); -#endif } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::bind_light // Access: Public, Virtual @@ -6425,7 +6593,6 @@ bind_light(PointLight *light_obj, const NodePath &light, int light_id) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) { -#ifndef OPENGLES_2 // static PStatCollector _draw_set_state_light_bind_directional_pcollector("Draw:Set State:Light:Bind:Directional"); // PStatGPUTimer timer(this, _draw_set_state_light_bind_directional_pcollector); @@ -6464,9 +6631,10 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) { glLightf(id, GL_QUADRATIC_ATTENUATION, 0.0f); report_my_gl_errors(); -#endif } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::bind_light // Access: Public, Virtual @@ -6477,7 +6645,6 @@ bind_light(DirectionalLight *light_obj, const NodePath &light, int light_id) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: bind_light(Spotlight *light_obj, const NodePath &light, int light_id) { -#ifndef OPENGLES_2 // static PStatCollector _draw_set_state_light_bind_spotlight_pcollector("Draw:Set State:Light:Bind:Spotlight"); // PStatGPUTimer timer(this, _draw_set_state_light_bind_spotlight_pcollector); @@ -6510,8 +6677,8 @@ bind_light(Spotlight *light_obj, const NodePath &light, int light_id) { glLightf(id, GL_QUADRATIC_ATTENUATION, att[2]); report_my_gl_errors(); -#endif } +#endif // !OPENGLES_2 #ifdef SUPPORT_IMMEDIATE_MODE //////////////////////////////////////////////////////////////////// @@ -6720,10 +6887,12 @@ query_gl_version() { _gl_version_major = 0; _gl_version_minor = 0; + _gl_shadlang_ver_major = 0; + _gl_shadlang_ver_minor = 0; const GLubyte *text = glGetString(GL_VERSION); if (text == (const GLubyte *)NULL) { - GLCAT.debug() + GLCAT.warning() << "Unable to query GL_VERSION\n"; } else { string version((const char *)text); @@ -6759,30 +6928,40 @@ query_gl_version() { string_to_int(components[1], _gl_version_minor); } - if (GLCAT.is_debug()) { - GLCAT.debug() + if (GLCAT.is_info()) { + GLCAT.info() << "GL_VERSION = " << version << ", decoded to " << _gl_version_major << "." << _gl_version_minor << "\n"; } + #ifndef OPENGLES - if (_gl_version_major==1) { - const char *extstr = (const char *) glGetString(GL_EXTENSIONS); - if (extstr != NULL) { - if (strstr( extstr, "GL_ARB_shading_language_100") != NULL) - { - _gl_shadlang_ver_major = 1; - _gl_shadlang_ver_minor = 0; - } + if (_gl_version_major == 1) { + // We can't call has_extension at this point yet. + const char *extstr = (const char *) glGetString(GL_EXTENSIONS); + if (extstr != NULL) { + if (strstr(extstr, "GL_ARB_shading_language_100") != NULL) { + _gl_shadlang_ver_major = 1; + _gl_shadlang_ver_minor = 0; } + } + } else if (_gl_version_major >= 2) { + _gl_shadlang_ver_major = 1; + _gl_shadlang_ver_minor = 1; + const char *verstr = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION); + if (verstr == NULL || sscanf(verstr, "%d.%d", &_gl_shadlang_ver_major, &_gl_shadlang_ver_minor) != 2) { + GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; + } + cerr << verstr << " -> " << _gl_shadlang_ver_major << " . " << _gl_shadlang_ver_minor << "\n"; } - else if (_gl_version_major >= 2) { - const char *verstr = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION); - if ((verstr == NULL) || (sscanf(verstr, "%d.%d", &_gl_shadlang_ver_major, &_gl_shadlang_ver_minor) != 2)) - { - GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; - } +#elif defined(OPENGLES_2) + _gl_shadlang_ver_major = 1; + _gl_shadlang_ver_minor = 0; + const char *verstr = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION); + if (verstr == NULL || sscanf(verstr, "OpenGL ES GLSL %d.%d", &_gl_shadlang_ver_major, &_gl_shadlang_ver_minor) != 2) { + GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; } + cerr << verstr << " -> " << _gl_shadlang_ver_major << " . " << _gl_shadlang_ver_minor << "\n"; #endif } } @@ -7134,9 +7313,11 @@ get_numeric_type(Geom::NumericType numeric_type) { case Geom::NT_uint16: return GL_UNSIGNED_SHORT; -#ifndef OPENGLES_1 case Geom::NT_uint32: +#ifndef OPENGLES_1 return GL_UNSIGNED_INT; +#else + break; #endif case Geom::NT_uint8: @@ -7147,9 +7328,11 @@ get_numeric_type(Geom::NumericType numeric_type) { case Geom::NT_float32: return GL_FLOAT; -#ifndef OPENGLES case Geom::NT_float64: +#ifndef OPENGLES return GL_DOUBLE; +#else + break; #endif case Geom::NT_stdfloat: @@ -7171,8 +7354,9 @@ get_numeric_type(Geom::NumericType numeric_type) { GLenum CLP(GraphicsStateGuardian):: get_texture_target(Texture::TextureType texture_type) const { switch (texture_type) { -#ifndef OPENGLES case Texture::TT_1d_texture: + // There are no 1D textures in OpenGL ES. Fall back to 2D textures. +#ifndef OPENGLES return GL_TEXTURE_1D; #endif @@ -7487,37 +7671,40 @@ get_external_image_format(Texture *tex) const { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; } -#ifndef OPENGLES case Texture::CM_dxt3: +#ifndef OPENGLES if (format == Texture::F_srgb || format == Texture::F_srgb_alpha) { return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - } else { - return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; } +#endif +#ifndef OPENGLES_1 + return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; +#endif + break; case Texture::CM_dxt5: +#ifndef OPENGLES if (format == Texture::F_srgb || format == Texture::F_srgb_alpha) { return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - } else { - return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; } +#endif +#ifndef OPENGLES_1 + return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; +#endif + break; case Texture::CM_fxt1: +#ifndef OPENGLES if (Texture::has_alpha(format)) { return GL_COMPRESSED_RGBA_FXT1_3DFX; } else { return GL_COMPRESSED_RGB_FXT1_3DFX; } +#endif + break; -#else +#ifdef OPENGLES case Texture::CM_pvr1_2bpp: -#ifndef OPENGLES - if (format == Texture::F_srgb_alpha) { - return GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT; - } else if (format == Texture::F_srgb) { - return GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT; - } else -#endif // OPENGLES if (Texture::has_alpha(format)) { return GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; } else { @@ -7525,19 +7712,16 @@ get_external_image_format(Texture *tex) const { } case Texture::CM_pvr1_4bpp: -#ifndef OPENGLES - if (format == Texture::F_srgb_alpha) { - return GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT; - } else if (format == Texture::F_srgb) { - return GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT; - } else -#endif // OPENGLES if (Texture::has_alpha(format)) { return GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG; } else { return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; } -#endif +#else + case Texture::CM_pvr1_2bpp: + case Texture::CM_pvr1_4bpp: + break; +#endif // OPENGLES case Texture::CM_default: case Texture::CM_off: @@ -7623,12 +7807,14 @@ get_external_image_format(Texture *tex) const { return GL_RGB_INTEGER; case Texture::F_rgba8i: return GL_RGBA_INTEGER; - #endif + + default: + break; } GLCAT.error() << "Invalid Texture::Format value in get_external_image_format(): " - << (int)tex->get_format() << "\n"; + << tex->get_format() << "\n"; return GL_RGB; } @@ -7654,8 +7840,6 @@ get_internal_image_format(Texture *tex, bool force_sized) const { if (get_supports_compressed_texture_format(compression)) { switch (compression) { - // For now, we don't support generic compression with OpenGL ES. -#ifndef OPENGLES case Texture::CM_on: // The user asked for just generic compression. OpenGL supports // requesting just generic compression, but we'd like to go ahead @@ -7681,30 +7865,46 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::F_rgbm: if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGBA_S3TC_DXT1_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGBA_FXT1_3DFX; } return GL_COMPRESSED_RGBA; +#endif + break; case Texture::F_rgba4: +#ifndef OPENGLES_1 if (get_supports_compressed_texture_format(Texture::CM_dxt3) && !is_3d) { return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#endif +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGBA_FXT1_3DFX; } return GL_COMPRESSED_RGBA; +#endif + break; case Texture::F_rgba: case Texture::F_rgba8: case Texture::F_rgba12: case Texture::F_rgba16: case Texture::F_rgba32: +#ifndef OPENGLES_1 if (get_supports_compressed_texture_format(Texture::CM_dxt5) && !is_3d) { return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#endif +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGBA_FXT1_3DFX; } return GL_COMPRESSED_RGBA; +#endif + break; case Texture::F_rgb: case Texture::F_rgb5: @@ -7716,18 +7916,28 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::F_rgb32: if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGB_FXT1_3DFX; } return GL_COMPRESSED_RGB; +#endif + break; case Texture::F_alpha: +#ifndef OPENGLES_1 if (get_supports_compressed_texture_format(Texture::CM_dxt5) && !is_3d) { return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#endif +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGBA_FXT1_3DFX; } return GL_COMPRESSED_ALPHA; +#endif + break; case Texture::F_red: case Texture::F_green: @@ -7736,37 +7946,56 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::F_r32: if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGB_FXT1_3DFX; } return GL_COMPRESSED_RED; +#endif + break; case Texture::F_rg16: case Texture::F_rg32: if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGB_FXT1_3DFX; } return GL_COMPRESSED_RG; +#endif + break; case Texture::F_luminance: if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGB_FXT1_3DFX; } return GL_COMPRESSED_LUMINANCE; +#endif + break; case Texture::F_luminance_alpha: case Texture::F_luminance_alphamask: +#ifndef OPENGLES_1 if (get_supports_compressed_texture_format(Texture::CM_dxt5) && !is_3d) { return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; - } else if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { + } +#endif +#ifndef OPENGLES + if (get_supports_compressed_texture_format(Texture::CM_fxt1) && !is_3d) { return GL_COMPRESSED_RGBA_FXT1_3DFX; } return GL_COMPRESSED_LUMINANCE_ALPHA; +#endif + break; +#ifndef OPENGLES case Texture::F_srgb: if (get_supports_compressed_texture_format(Texture::CM_dxt1) && !is_3d) { return GL_COMPRESSED_SRGB_S3TC_DXT1_EXT; @@ -7784,9 +8013,16 @@ get_internal_image_format(Texture *tex, bool force_sized) const { case Texture::F_sluminance_alpha: return GL_COMPRESSED_SLUMINANCE_ALPHA; +#else + // For now, we don't support compressed sRGB textures in OpenGL ES. + case Texture::F_srgb: + case Texture::F_srgb_alpha: + case Texture::F_sluminance: + case Texture::F_sluminance_alpha: + break; +#endif } break; -#endif case Texture::CM_dxt1: #ifndef OPENGLES @@ -7802,28 +8038,38 @@ get_internal_image_format(Texture *tex, bool force_sized) const { return GL_COMPRESSED_RGB_S3TC_DXT1_EXT; } -#ifndef OPENGLES case Texture::CM_dxt3: +#ifndef OPENGLES if (format == Texture::F_srgb || format == Texture::F_srgb_alpha) { return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT; - } else { - return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; } +#endif +#ifndef OPENGLES_1 + return GL_COMPRESSED_RGBA_S3TC_DXT3_EXT; +#endif + break; case Texture::CM_dxt5: +#ifndef OPENGLES if (format == Texture::F_srgb || format == Texture::F_srgb_alpha) { return GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT; - } else { - return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; } +#endif +#ifndef OPENGLES_1 + return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT; +#endif case Texture::CM_fxt1: +#ifndef OPENGLES if (Texture::has_alpha(format)) { return GL_COMPRESSED_RGBA_FXT1_3DFX; } else { return GL_COMPRESSED_RGB_FXT1_3DFX; } -#else +#endif + break; + +#ifdef OPENGLES case Texture::CM_pvr1_2bpp: if (Texture::has_alpha(format)) { return GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG; @@ -7837,6 +8083,10 @@ get_internal_image_format(Texture *tex, bool force_sized) const { } else { return GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG; } +#else + case Texture::CM_pvr1_2bpp: + case Texture::CM_pvr1_4bpp: + break; #endif case Texture::CM_default: @@ -8337,7 +8587,13 @@ get_blend_equation_type(ColorBlendAttrib::Mode mode) { case ColorBlendAttrib::M_inv_subtract: return GL_FUNC_REVERSE_SUBTRACT; -#ifndef OPENGLES +#ifdef OPENGLES + case ColorBlendAttrib::M_min: + return GL_MIN_EXT; + + case ColorBlendAttrib::M_max: + return GL_MAX_EXT; +#else case ColorBlendAttrib::M_min: return GL_MIN; @@ -8390,7 +8646,18 @@ get_blend_func(ColorBlendAttrib::Operand operand) { case ColorBlendAttrib::O_one_minus_fbuffer_alpha: return GL_ONE_MINUS_DST_ALPHA; -#ifndef OPENGLES_1 +#ifdef OPENGLES_1 + // OpenGL ES 1 has no constant blend factor. + case ColorBlendAttrib::O_constant_color: + case ColorBlendAttrib::O_color_scale: + case ColorBlendAttrib::O_one_minus_constant_color: + case ColorBlendAttrib::O_one_minus_color_scale: + case ColorBlendAttrib::O_constant_alpha: + case ColorBlendAttrib::O_alpha_scale: + case ColorBlendAttrib::O_one_minus_constant_alpha: + case ColorBlendAttrib::O_one_minus_alpha_scale: + break; +#else case ColorBlendAttrib::O_constant_color: case ColorBlendAttrib::O_color_scale: return GL_CONSTANT_COLOR; @@ -8549,6 +8816,7 @@ reissue_transforms() { do_issue_transform(); } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::enable_lighting // Access: Protected, Virtual @@ -8559,7 +8827,6 @@ reissue_transforms() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: enable_lighting(bool enable) { -#ifndef OPENGLES_2 // static PStatCollector _draw_set_state_light_enable_lighting_pcollector("Draw:Set State:Light:Enable lighting"); // PStatGPUTimer timer(this, _draw_set_state_light_enable_lighting_pcollector); @@ -8568,9 +8835,10 @@ enable_lighting(bool enable) { } else { glDisable(GL_LIGHTING); } -#endif } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::set_ambient_light // Access: Protected, Virtual @@ -8581,7 +8849,6 @@ enable_lighting(bool enable) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: set_ambient_light(const LColor &color) { -#ifndef OPENGLES_2 // static PStatCollector _draw_set_state_light_ambient_pcollector("Draw:Set State:Light:Ambient"); // PStatGPUTimer timer(this, _draw_set_state_light_ambient_pcollector); @@ -8591,9 +8858,10 @@ set_ambient_light(const LColor &color) { c[2] * _light_color_scale[2], c[3] * _light_color_scale[3]); call_glLightModelfv(GL_LIGHT_MODEL_AMBIENT, c); -#endif } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::enable_light // Access: Protected, Virtual @@ -8612,7 +8880,9 @@ enable_light(int light_id, bool enable) { glDisable(get_light_id(light_id)); } } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::begin_bind_lights // Access: Protected, Virtual @@ -8627,7 +8897,6 @@ enable_light(int light_id, bool enable) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: begin_bind_lights() { -#ifndef OPENGLES_2 // static PStatCollector _draw_set_state_light_begin_bind_pcollector("Draw:Set State:Light:Begin bind"); // PStatGPUTimer timer(this, _draw_set_state_light_begin_bind_pcollector); @@ -8644,9 +8913,10 @@ begin_bind_lights() { glMatrixMode(GL_MODELVIEW); glPushMatrix(); GLPf(LoadMatrix)(render_transform->get_mat().get_data()); -#endif } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::end_bind_lights // Access: Protected, Virtual @@ -8658,15 +8928,15 @@ begin_bind_lights() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: end_bind_lights() { -#ifndef OPENGLES_2 // static PStatCollector _draw_set_state_light_end_bind_pcollector("Draw:Set State:Light:End bind"); // PStatGPUTimer timer(this, _draw_set_state_light_end_bind_pcollector); glMatrixMode(GL_MODELVIEW); glPopMatrix(); -#endif } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::enable_clip_plane // Access: Protected, Virtual @@ -8683,7 +8953,9 @@ enable_clip_plane(int plane_id, bool enable) { glDisable(get_clip_plane_id(plane_id)); } } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::begin_bind_clip_planes // Access: Protected, Virtual @@ -8698,7 +8970,6 @@ enable_clip_plane(int plane_id, bool enable) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: begin_bind_clip_planes() { -#ifndef OPENGLES_2 // We need to temporarily load a new matrix so we can define the // clip_plane in a known coordinate system. We pick the transform of the // root. (Alternatively, we could leave the current transform where @@ -8712,9 +8983,10 @@ begin_bind_clip_planes() { glMatrixMode(GL_MODELVIEW); glPushMatrix(); GLPf(LoadMatrix)(render_transform->get_mat().get_data()); -#endif } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::bind_clip_plane // Access: Protected, Virtual @@ -8732,7 +9004,6 @@ bind_clip_plane(const NodePath &plane, int plane_id) { DCAST_INTO_V(plane_node, plane.node()); LPlane xformed_plane = plane_node->get_plane() * transform->get_mat(); -#ifndef OPENGLES_2 // OpenGL ES 2.0 doesn't support clip planes at all. #ifdef OPENGLES // OpenGL ES uses a single-precision call. LPlanef single_plane(LCAST(float, xformed_plane)); @@ -8742,11 +9013,12 @@ bind_clip_plane(const NodePath &plane, int plane_id) { LPlaned double_plane(LCAST(double, xformed_plane)); glClipPlane(id, double_plane.get_data()); #endif // OPENGLES -#endif // OPENGLES_2 report_my_gl_errors(); } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::end_bind_clip_planes // Access: Protected, Virtual @@ -8758,11 +9030,10 @@ bind_clip_plane(const NodePath &plane, int plane_id) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: end_bind_clip_planes() { -#ifndef OPENGLES_2 glMatrixMode(GL_MODELVIEW); glPopMatrix(); -#endif } +#endif // !OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::set_state_and_transform @@ -8809,10 +9080,11 @@ set_state_and_transform(const RenderState *target, _target_shader = (const ShaderAttrib *) _target_rs->get_attrib_def(ShaderAttrib::get_class_slot()); -#ifndef OPENGLES +#ifndef OPENGLES_1 _instance_count = _target_shader->get_instance_count(); #endif +#ifndef OPENGLES_2 int alpha_test_slot = AlphaTestAttrib::get_class_slot(); if (_target_rs->get_attrib(alpha_test_slot) != _state_rs->get_attrib(alpha_test_slot) || !_state_mask.get_bit(alpha_test_slot) || @@ -8822,6 +9094,7 @@ set_state_and_transform(const RenderState *target, do_issue_alpha_test(); _state_mask.set_bit(alpha_test_slot); } +#endif int antialias_slot = AntialiasAttrib::get_class_slot(); if (_target_rs->get_attrib(antialias_slot) != _state_rs->get_attrib(antialias_slot) || @@ -8903,6 +9176,7 @@ set_state_and_transform(const RenderState *target, _state_mask.set_bit(render_mode_slot); } +#ifndef OPENGLES_2 int rescale_normal_slot = RescaleNormalAttrib::get_class_slot(); if (_target_rs->get_attrib(rescale_normal_slot) != _state_rs->get_attrib(rescale_normal_slot) || !_state_mask.get_bit(rescale_normal_slot)) { @@ -8910,7 +9184,9 @@ set_state_and_transform(const RenderState *target, do_issue_rescale_normal(); _state_mask.set_bit(rescale_normal_slot); } +#endif +#ifndef OPENGLES_2 int shade_model_slot = ShadeModelAttrib::get_class_slot(); if (_target_rs->get_attrib(shade_model_slot) != _state_rs->get_attrib(shade_model_slot) || !_state_mask.get_bit(shade_model_slot)) { @@ -8918,6 +9194,7 @@ set_state_and_transform(const RenderState *target, do_issue_shade_model(); _state_mask.set_bit(shade_model_slot); } +#endif int transparency_slot = TransparencyAttrib::get_class_slot(); int color_write_slot = ColorWriteAttrib::get_class_slot(); @@ -8972,6 +9249,7 @@ set_state_and_transform(const RenderState *target, // If one of the previously-loaded TexGen modes modified the texture // matrix, then if either state changed, we have to change both of // them now. +#ifndef OPENGLES_2 if (_tex_gen_modifies_mat) { int tex_gen_slot = TexGenAttrib::get_class_slot(); int tex_matrix_slot = TexMatrixAttrib::get_class_slot(); @@ -8991,7 +9269,9 @@ set_state_and_transform(const RenderState *target, do_issue_tex_matrix(); _state_mask.set_bit(tex_matrix_slot); } +#endif +#ifndef OPENGLES_2 int tex_gen_slot = TexGenAttrib::get_class_slot(); if (_target_tex_gen != _state_tex_gen || !_state_mask.get_bit(tex_gen_slot)) { @@ -9000,12 +9280,15 @@ set_state_and_transform(const RenderState *target, _state_tex_gen = _target_tex_gen; _state_mask.set_bit(tex_gen_slot); } +#endif int material_slot = MaterialAttrib::get_class_slot(); if (_target_rs->get_attrib(material_slot) != _state_rs->get_attrib(material_slot) || !_state_mask.get_bit(material_slot)) { //PStatGPUTimer timer(this, _draw_set_state_material_pcollector); +#ifndef OPENGLES_2 do_issue_material(); +#endif _state_mask.set_bit(material_slot); #ifndef OPENGLES_1 if (_current_shader_context) { @@ -9018,7 +9301,9 @@ set_state_and_transform(const RenderState *target, if (_target_rs->get_attrib(light_slot) != _state_rs->get_attrib(light_slot) || !_state_mask.get_bit(light_slot)) { //PStatGPUTimer timer(this, _draw_set_state_light_pcollector); +#ifndef OPENGLES_2 do_issue_light(); +#endif _state_mask.set_bit(light_slot); #ifndef OPENGLES_1 if (_current_shader_context) { @@ -9039,7 +9324,9 @@ set_state_and_transform(const RenderState *target, if (_target_rs->get_attrib(fog_slot) != _state_rs->get_attrib(fog_slot) || !_state_mask.get_bit(fog_slot)) { //PStatGPUTimer timer(this, _draw_set_state_fog_pcollector); +#ifndef OPENGLES_2 do_issue_fog(); +#endif _state_mask.set_bit(fog_slot); #ifndef OPENGLES_1 if (_current_shader_context) { @@ -9150,10 +9437,14 @@ do_issue_texture() { if (_texture_binding_shader_context != 0) { _texture_binding_shader_context->disable_shader_texture_bindings(); } +#ifndef OPENGLES_2 update_standard_texture_bindings(); +#endif } else { if (_texture_binding_shader_context == 0) { +#ifndef OPENGLES_2 disable_standard_texture_bindings(); +#endif _current_shader_context->update_shader_texture_bindings(NULL); } else { _current_shader_context-> @@ -9166,6 +9457,7 @@ do_issue_texture() { #endif } +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::update_standard_texture_bindings // Access: Private @@ -9175,7 +9467,6 @@ do_issue_texture() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: update_standard_texture_bindings() { -#ifndef OPENGLES_2 #ifndef NDEBUG if (_show_texture_usage) { update_show_usage_texture_bindings(-1); @@ -9409,8 +9700,9 @@ update_standard_texture_bindings() { _num_active_texture_stages = num_stages; report_my_gl_errors(); -#endif // OPENGLES_2 } +#endif // !OPENGLES_2 + #ifndef NDEBUG @@ -9591,6 +9883,7 @@ upload_usage_texture(int width, int height) { } #endif // NDEBUG +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::disable_standard_texture_bindings // Access: Private @@ -9598,7 +9891,6 @@ upload_usage_texture(int width, int height) { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: disable_standard_texture_bindings() { -#ifndef OPENGLES_2 // Disable the texture stages that are no longer used. for (int i = 0; i < _num_active_texture_stages; i++) { _glActiveTexture(GL_TEXTURE0 + i); @@ -9619,9 +9911,10 @@ disable_standard_texture_bindings() { _num_active_texture_stages = 0; report_my_gl_errors(); -#endif // OPENGLES_2 } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_tex_matrix // Access: Protected @@ -9629,7 +9922,6 @@ disable_standard_texture_bindings() { //////////////////////////////////////////////////////////////////// void CLP(GraphicsStateGuardian):: do_issue_tex_matrix() { -#ifndef OPENGLES_2 // OpenGL ES 2 doesn't support texture matrices, I think. nassertv(_num_active_texture_stages <= _max_texture_stages); for (int i = 0; i < _num_active_texture_stages; i++) { @@ -9656,9 +9948,10 @@ do_issue_tex_matrix() { } } report_my_gl_errors(); -#endif } +#endif // !OPENGLES_2 +#ifndef OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::do_issue_tex_gen // Access: Protected @@ -9687,7 +9980,6 @@ do_issue_tex_gen() { for (int i = 0; i < _num_active_texture_stages; i++) { TextureStage *stage = _target_texture->get_on_ff_stage(i); _glActiveTexture(GL_TEXTURE0 + i); -#ifndef OPENGLES_2 if (_supports_point_sprite) { #ifdef OPENGLES glTexEnvi(GL_POINT_SPRITE_OES, GL_COORD_REPLACE_OES, GL_FALSE); @@ -9695,7 +9987,6 @@ do_issue_tex_gen() { glTexEnvi(GL_POINT_SPRITE_ARB, GL_COORD_REPLACE_ARB, GL_FALSE); #endif // OPENGLES } -#endif // OPENGLES_2 #ifndef OPENGLES // TexGen not supported by OpenGL ES. glDisable(GL_TEXTURE_GEN_S); @@ -9926,7 +10217,6 @@ do_issue_tex_gen() { if (got_point_sprites != _tex_gen_point_sprite) { _tex_gen_point_sprite = got_point_sprites; -#ifndef OPENGLES_2 #ifdef OPENGLES if (_tex_gen_point_sprite) { glEnable(GL_POINT_SPRITE_OES); @@ -9940,11 +10230,11 @@ do_issue_tex_gen() { glDisable(GL_POINT_SPRITE_ARB); } #endif // OPENGLES -#endif // OPENGLES_2 } report_my_gl_errors(); } +#endif // !OPENGLES_2 //////////////////////////////////////////////////////////////////// // Function: GLGraphicsStateGuardian::specify_texture @@ -10028,13 +10318,15 @@ specify_texture(CLP(TextureContext) *gtc, const SamplerState &sampler) { glTexParameterf(target, GL_TEXTURE_MAX_ANISOTROPY_EXT, anisotropy); } -#ifndef OPENGLES +#ifndef OPENGLES_1 if (tex->get_format() == Texture::F_depth_stencil || tex->get_format() == Texture::F_depth_component || tex->get_format() == Texture::F_depth_component16 || tex->get_format() == Texture::F_depth_component24 || tex->get_format() == Texture::F_depth_component32) { +#ifndef OPENGLES glTexParameteri(target, GL_DEPTH_TEXTURE_MODE_ARB, GL_INTENSITY); +#endif if (_supports_shadow_filter) { if ((sampler.get_magfilter() == SamplerState::FT_shadow) || (sampler.get_minfilter() == SamplerState::FT_shadow)) { @@ -10046,7 +10338,9 @@ specify_texture(CLP(TextureContext) *gtc, const SamplerState &sampler) { } } } +#endif +#ifndef OPENGLES glTexParameterf(target, GL_TEXTURE_MIN_LOD, sampler.get_min_lod()); glTexParameterf(target, GL_TEXTURE_MAX_LOD, sampler.get_max_lod()); glTexParameterf(target, GL_TEXTURE_LOD_BIAS, sampler.get_lod_bias()); diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 03e8e2c8a5..3a7f5ddba7 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -184,6 +184,8 @@ typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLVERTEXATTRIBDIVISORPROC) (GLuint index, GLuint divisor); +typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); +typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); #endif // OPENGLES_1 #ifndef OPENGLES typedef void (APIENTRYP PFNGLGENSAMPLERSPROC) (GLsizei count, GLuint *samplers); @@ -194,8 +196,6 @@ typedef void (APIENTRYP PFNGLSAMPLERPARAMETERIVPROC) (GLuint sampler, GLenum pna typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFPROC) (GLuint sampler, GLenum pname, GLfloat param); typedef void (APIENTRYP PFNGLSAMPLERPARAMETERFVPROC) (GLuint sampler, GLenum pname, const GLfloat *param); typedef void (APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -typedef void (APIENTRYP PFNGLDRAWARRAYSINSTANCEDPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (APIENTRYP PFNGLDRAWELEMENTSINSTANCEDPROC) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount); typedef void (APIENTRYP PFNGLCLEARTEXIMAGEPROC) (GLuint texture, GLint level, GLenum format, GLenum type, const void *data); typedef void (APIENTRYP PFNGLCLEARTEXSUBIMAGEPROC) (GLuint texture, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *data); typedef void (APIENTRYP PFNGLBINDTEXTURESPROC) (GLuint first, GLsizei count, const GLuint *textures); @@ -281,15 +281,19 @@ public: bool force); virtual void end_draw_primitives(); +#ifndef OPENGLES void issue_memory_barrier(GLbitfield barrier); +#endif virtual TextureContext *prepare_texture(Texture *tex, int view); virtual bool update_texture(TextureContext *tc, bool force); virtual void release_texture(TextureContext *tc); virtual bool extract_texture_data(Texture *tex); +#ifndef OPENGLES virtual SamplerContext *prepare_sampler(const SamplerState &sampler); virtual void release_sampler(SamplerContext *sc); +#endif virtual GeomContext *prepare_geom(Geom *geom); virtual void release_geom(GeomContext *gc); @@ -318,12 +322,16 @@ public: const GeomPrimitivePipelineReader *reader, bool force); +#ifndef OPENGLES virtual void begin_occlusion_query(); virtual PT(OcclusionQueryContext) end_occlusion_query(); +#endif virtual PT(TimerQueryContext) issue_timer_query(int pstats_index); +#ifndef OPENGLES virtual void dispatch_compute(int size_x, int size_y, int size_z); +#endif virtual PT(GeomMunger) make_geom_munger(const RenderState *state, Thread *current_thread); @@ -337,6 +345,7 @@ public: virtual bool framebuffer_copy_to_ram (Texture *tex, int view, int z, const DisplayRegion *dr, const RenderBuffer &rb); +#ifndef OPENGLES_2 void apply_fog(Fog *fog); virtual void bind_light(PointLight *light_obj, const NodePath &light, @@ -345,6 +354,7 @@ public: int light_id); virtual void bind_light(Spotlight *light_obj, const NodePath &light, int light_id); +#endif void print_gfx_visual(); @@ -380,18 +390,26 @@ protected: void do_issue_rescale_normal(); void do_issue_color_write(); void do_issue_depth_test(); +#ifndef OPENGLES_2 void do_issue_alpha_test(); +#endif void do_issue_depth_write(); void do_issue_cull_face(); +#ifndef OPENGLES_2 void do_issue_fog(); +#endif void do_issue_depth_offset(); void do_issue_shade_model(); void do_issue_shader(bool state_has_changed = false); +#ifndef OPENGLES_2 void do_issue_material(); +#endif void do_issue_texture(); void do_issue_blending(); +#ifndef OPENGLES_2 void do_issue_tex_gen(); void do_issue_tex_matrix(); +#endif void do_issue_stencil(); void do_issue_scissor(); @@ -414,6 +432,8 @@ protected: virtual void *do_get_extension_func(const char *name); virtual void reissue_transforms(); + +#ifndef OPENGLES_2 virtual void enable_lighting(bool enable); virtual void set_ambient_light(const LColor &color); virtual void enable_light(int light_id, bool enable); @@ -424,6 +444,7 @@ protected: virtual void begin_bind_clip_planes(); virtual void bind_clip_plane(const NodePath &plane, int plane_id); virtual void end_bind_clip_planes(); +#endif virtual void free_pointers(); @@ -447,16 +468,21 @@ protected: INLINE void set_color_write_mask(int mask); INLINE void clear_color_write_mask(); +#ifndef OPENGLES_2 INLINE void call_glFogfv(GLenum pname, const LColor &color); INLINE void call_glMaterialfv(GLenum face, GLenum pname, const LColor &color); INLINE void call_glLightfv(GLenum light, GLenum pname, const LVecBase4 &value); INLINE void call_glLightfv(GLenum light, GLenum pname, const LVecBase3 &value); INLINE void call_glLightModelfv(GLenum pname, const LVecBase4 &value); INLINE void call_glTexEnvfv(GLenum target, GLenum pname, const LVecBase4 &value); +#endif + INLINE void call_glTexParameterfv(GLenum target, GLenum pname, const LVecBase4 &value); +#ifndef OPENGLES_2 INLINE GLenum get_light_id(int index) const; INLINE GLenum get_clip_plane_id(int index) const; +#endif void set_draw_buffer(int rbtype); void set_read_buffer(int rbtype); @@ -485,10 +511,12 @@ protected: static GLenum get_usage(Geom::UsageHint usage_hint); void unbind_buffers(); +#ifndef OPENGLES_2 void disable_standard_vertex_arrays(); bool update_standard_vertex_arrays(bool force); void disable_standard_texture_bindings(); void update_standard_texture_bindings(); +#endif #ifndef NDEBUG void update_show_usage_texture_bindings(int show_stage_index); @@ -570,7 +598,7 @@ protected: ShaderContext *_texture_binding_shader_context; #endif #ifdef OPENGLES_2 - static PT(Shader) _default_shader; + static PT(Shader) _default_shader; #endif #ifdef HAVE_CG @@ -640,21 +668,25 @@ public: PFNGLWEIGHTDVARBPROC _glWeightdv; bool _supports_matrix_palette; -#ifdef OPENGLES +#ifdef OPENGLES_1 PFNGLCURRENTPALETTEMATRIXOESPROC _glCurrentPaletteMatrix; PFNGLMATRIXINDEXPOINTEROESPROC _glMatrixIndexPointer; -#else +#endif +#ifndef OPENGLES PFNGLCURRENTPALETTEMATRIXARBPROC _glCurrentPaletteMatrix; PFNGLMATRIXINDEXPOINTERARBPROC _glMatrixIndexPointer; PFNGLMATRIXINDEXUIVARBPROC _glMatrixIndexuiv; #endif - bool _supports_draw_range_elements; +#ifndef OPENGLES PFNGLDRAWRANGEELEMENTSPROC _glDrawRangeElements; +#endif +#ifndef OPENGLES_1 PFNGLTEXIMAGE3DPROC_P _glTexImage3D; PFNGLTEXSUBIMAGE3DPROC _glTexSubImage3D; PFNGLCOPYTEXSUBIMAGE3DPROC _glCopyTexSubImage3D; +#endif bool _supports_tex_storage; PFNGLTEXSTORAGE1DPROC _glTexStorage1D; @@ -678,8 +710,9 @@ public: bool _supports_rescale_normal; bool _supports_packed_dabc; - bool _supports_multitexture; PFNGLACTIVETEXTUREPROC _glActiveTexture; +#ifndef OPENGLES_2 + bool _supports_multitexture; PFNGLCLIENTACTIVETEXTUREPROC _glClientActiveTexture; PFNGLMULTITEXCOORD1FPROC _glMultiTexCoord1f; PFNGLMULTITEXCOORD2FPROC _glMultiTexCoord2f; @@ -689,6 +722,7 @@ public: PFNGLMULTITEXCOORD2DPROC _glMultiTexCoord2d; PFNGLMULTITEXCOORD3DPROC _glMultiTexCoord3d; PFNGLMULTITEXCOORD4DPROC _glMultiTexCoord4d; +#endif bool _supports_buffers; PFNGLGENBUFFERSPROC _glGenBuffers; @@ -798,7 +832,9 @@ public: PFNGLVERTEXATTRIBIPOINTERPROC _glVertexAttribIPointer; PFNGLVERTEXATTRIBLPOINTERPROC _glVertexAttribLPointer; PFNGLVERTEXATTRIBDIVISORPROC _glVertexAttribDivisor; -#endif // OPENGLES_1 + PFNGLDRAWARRAYSINSTANCEDPROC _glDrawArraysInstanced; + PFNGLDRAWELEMENTSINSTANCEDPROC _glDrawElementsInstanced; +#endif // !OPENGLES_1 #ifndef OPENGLES PFNGLGENSAMPLERSPROC _glGenSamplers; PFNGLDELETESAMPLERSPROC _glDeleteSamplers; @@ -809,8 +845,6 @@ public: PFNGLSAMPLERPARAMETERFVPROC _glSamplerParameterfv; PFNGLPROGRAMPARAMETERIPROC _glProgramParameteri; PFNGLPATCHPARAMETERIPROC _glPatchParameteri; - PFNGLDRAWARRAYSINSTANCEDPROC _glDrawArraysInstanced; - PFNGLDRAWELEMENTSINSTANCEDPROC _glDrawElementsInstanced; PFNGLBINDTEXTURESPROC _glBindTextures; PFNGLBINDSAMPLERSPROC _glBindSamplers; PFNGLBINDIMAGETEXTUREPROC _glBindImageTexture; @@ -828,7 +862,7 @@ public: PFNGLMAKETEXTUREHANDLENONRESIDENTPROC _glMakeTextureHandleNonResident; PFNGLUNIFORMHANDLEUI64PROC _glUniformHandleui64; PFNGLUNIFORMHANDLEUI64VPROC _glUniformHandleui64v; -#endif // OPENGLES +#endif // !OPENGLES GLenum _edge_clamp; GLenum _border_clamp; @@ -836,7 +870,7 @@ public: GLenum _mirror_clamp; GLenum _mirror_edge_clamp; GLenum _mirror_border_clamp; -#ifndef OPENGLES +#ifndef OPENGLES_1 GLsizei _instance_count; #endif diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 1b66f6172a..eb31a08127 100755 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -196,6 +196,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext _glgsg = glgsg; _glsl_program = 0; _uses_standard_vertex_arrays = false; + _has_divisor = false; nassertv(s->get_language() == Shader::SL_GLSL); @@ -537,8 +538,8 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext continue; } case GL_INT_SAMPLER_2D: case GL_UNSIGNED_INT_SAMPLER_2D: - case GL_SAMPLER_2D_SHADOW: #endif + case GL_SAMPLER_2D_SHADOW: case GL_SAMPLER_2D: { _glgsg->_glUniform1i(p, s->_tex_spec.size()); Shader::ShaderTexSpec bind; @@ -553,13 +554,18 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext case GL_UNSIGNED_INT_SAMPLER_3D: #endif case GL_SAMPLER_3D: { - _glgsg->_glUniform1i(p, s->_tex_spec.size()); - Shader::ShaderTexSpec bind; - bind._id = arg_id; - bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_3d_texture; - bind._stage = texunitno++; - s->_tex_spec.push_back(bind); + if (_glgsg->_supports_3d_texture) { + _glgsg->_glUniform1i(p, s->_tex_spec.size()); + Shader::ShaderTexSpec bind; + bind._id = arg_id; + bind._name = InternalName::make(param_name); + bind._desired_type = Texture::TT_3d_texture; + bind._stage = texunitno++; + s->_tex_spec.push_back(bind); + } else { + GLCAT.error() + << "GLSL shader uses 3D texture, which is unsupported by the driver.\n"; + } continue; } #ifndef OPENGLES case GL_INT_SAMPLER_CUBE: @@ -567,26 +573,36 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext case GL_SAMPLER_CUBE_SHADOW: #endif case GL_SAMPLER_CUBE: { - _glgsg->_glUniform1i(p, s->_tex_spec.size()); - Shader::ShaderTexSpec bind; - bind._id = arg_id; - bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_cube_map; - bind._stage = texunitno++; - s->_tex_spec.push_back(bind); + if (_glgsg->_supports_cube_map) { + _glgsg->_glUniform1i(p, s->_tex_spec.size()); + Shader::ShaderTexSpec bind; + bind._id = arg_id; + bind._name = InternalName::make(param_name); + bind._desired_type = Texture::TT_cube_map; + bind._stage = texunitno++; + s->_tex_spec.push_back(bind); + } else { + GLCAT.error() + << "GLSL shader uses cube map, which is unsupported by the driver.\n"; + } continue; } #ifndef OPENGLES case GL_INT_SAMPLER_2D_ARRAY: case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: case GL_SAMPLER_2D_ARRAY_SHADOW: case GL_SAMPLER_2D_ARRAY: { - _glgsg->_glUniform1i(p, s->_tex_spec.size()); - Shader::ShaderTexSpec bind; - bind._id = arg_id; - bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_2d_texture_array; - bind._stage = texunitno++; - s->_tex_spec.push_back(bind); + if (_glgsg->_supports_2d_texture_array) { + _glgsg->_glUniform1i(p, s->_tex_spec.size()); + Shader::ShaderTexSpec bind; + bind._id = arg_id; + bind._name = InternalName::make(param_name); + bind._desired_type = Texture::TT_2d_texture_array; + bind._stage = texunitno++; + s->_tex_spec.push_back(bind); + } else { + GLCAT.error() + << "GLSL shader uses 2D texture array, which is unsupported by the driver.\n"; + } continue; } #endif case GL_FLOAT_MAT2: @@ -1202,7 +1218,7 @@ disable_shader_vertex_arrays() { for (int i=0; i<(int)_shader->_var_spec.size(); i++) { const Shader::ShaderVarSpec &bind = _shader->_var_spec[i]; const GLint p = _glsl_parameter_map[bind._id._seqno]; - if (_glgsg->_supports_vertex_attrib_divisor) { + if (_has_divisor) { _glgsg->_glVertexAttribDivisor(p, 0); } for (int i = 0; i < bind._elements; ++i) { @@ -1291,6 +1307,7 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { if (_glgsg->_supports_vertex_attrib_divisor) { _glgsg->_glVertexAttribDivisor(p, divisor); + _has_divisor = true; } ++p; @@ -1342,22 +1359,32 @@ disable_shader_texture_bindings() { _glgsg->_glActiveTexture(GL_TEXTURE0 + i); + switch (_shader->_tex_spec[i]._desired_type) { + case Texture::TT_1d_texture: #ifndef OPENGLES - glBindTexture(GL_TEXTURE_1D, 0); -#endif // OPENGLES - glBindTexture(GL_TEXTURE_2D, 0); -#ifndef OPENGLES_1 - if (_glgsg->_supports_3d_texture) { - glBindTexture(GL_TEXTURE_3D, 0); - } -#endif // OPENGLES_1 -#ifndef OPENGLES - if (_glgsg->_supports_2d_texture_array) { - glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, 0); - } + glBindTexture(GL_TEXTURE_1D, 0); #endif - if (_glgsg->_supports_cube_map) { + break; + + case Texture::TT_2d_texture: + glBindTexture(GL_TEXTURE_2D, 0); + break; + + case Texture::TT_3d_texture: +#ifndef OPENGLES_1 + glBindTexture(GL_TEXTURE_3D, 0); +#endif + break; + + case Texture::TT_2d_texture_array: +#ifndef OPENGLES + glBindTexture(GL_TEXTURE_2D_ARRAY_EXT, 0); +#endif + break; + + case Texture::TT_cube_map: glBindTexture(GL_TEXTURE_CUBE_MAP, 0); + break; } } diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index 19c7190bcd..ae8e6b3851 100755 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -72,6 +72,7 @@ private: CLP(GraphicsStateGuardian) *_glgsg; bool _uses_standard_vertex_arrays; + bool _has_divisor; void glsl_report_shader_errors(GLuint shader, Shader::ShaderType type, bool fatal); void glsl_report_program_errors(GLuint program, bool fatal); From 16e7831566b88f32b1c1e48408795fb0e66b389a Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 5 Apr 2015 15:41:49 +0200 Subject: [PATCH 40/73] Remove executable permissions from files that don't need them --- contrib/src/ai/Sources.pp | 0 contrib/src/panda3dtoolsgui/build_exe.bat | 0 direct/src/dcparser/dcPackData.I | 0 direct/src/dcparser/dcPackData.cxx | 0 direct/src/dcparser/dcPackData.h | 0 direct/src/dcparser/dcPacker.I | 0 direct/src/dcparser/dcPacker.cxx | 0 direct/src/dcparser/dcPacker.h | 0 direct/src/dcparser/dcPackerInterface.cxx | 0 direct/src/dcparser/dcPackerInterface.h | 0 direct/src/dcparser/dcPython.h | 0 direct/src/dcparser/dcSwitchParameter.cxx | 0 direct/src/dcparser/dcSwitchParameter.h | 0 direct/src/dcparser/dcmsgtypes.h | 0 direct/src/directbase/ppython.cxx | 0 direct/src/doc/dcPacker.txt | 0 direct/src/doc/howto.PythonRedefine | 0 direct/src/http/favicon.ico | Bin direct/src/p3d/panda3d.pdef | 0 direct/src/plugin/fileSpec.I | 0 direct/src/plugin/fileSpec.cxx | 0 direct/src/plugin/fileSpec.h | 0 direct/src/plugin/find_root_dir.cxx | 0 direct/src/plugin/find_root_dir.h | 0 direct/src/plugin/get_tinyxml.h | 0 direct/src/plugin/get_twirl_data.cxx | 0 direct/src/plugin/get_twirl_data.h | 0 direct/src/plugin/handleStreamBuf.I | 0 direct/src/plugin/load_plugin.cxx | 0 direct/src/plugin/load_plugin.h | 0 direct/src/plugin/mkdir_complete.cxx | 0 direct/src/plugin/mkdir_complete.h | 0 direct/src/plugin/p3dCInstance.I | 0 direct/src/plugin/p3dCInstance.cxx | 0 direct/src/plugin/p3dCInstance.h | 0 direct/src/plugin/p3dDownload.I | 0 direct/src/plugin/p3dDownload.cxx | 0 direct/src/plugin/p3dDownload.h | 0 direct/src/plugin/p3dFileDownload.I | 0 direct/src/plugin/p3dFileDownload.cxx | 0 direct/src/plugin/p3dFileDownload.h | 0 direct/src/plugin/p3dPackage.I | 0 direct/src/plugin/p3dPackage.cxx | 0 direct/src/plugin/p3dPackage.h | 0 direct/src/plugin/p3dPythonRun.I | 0 direct/src/plugin/p3dPythonRun.cxx | 0 direct/src/plugin/p3dPythonRun.h | 0 direct/src/plugin/p3dSplashWindow.I | 0 direct/src/plugin/p3dSplashWindow.cxx | 0 direct/src/plugin/p3dSplashWindow.h | 0 direct/src/plugin/p3dWinSplashWindow.I | 0 direct/src/plugin/p3dWinSplashWindow.cxx | 0 direct/src/plugin/p3dWinSplashWindow.h | 0 direct/src/plugin/p3dX11SplashWindow.cxx | 0 direct/src/plugin/p3dX11SplashWindow.h | 0 direct/src/plugin/p3d_lock.h | 0 direct/src/plugin/twirl.xcf | Bin direct/src/plugin/wstring_encode.cxx | 0 direct/src/plugin/wstring_encode.h | 0 direct/src/plugin/xml_helpers.cxx | 0 direct/src/plugin/xml_helpers.h | 0 direct/src/plugin_activex/P3DActiveX.rc.pp | 0 direct/src/plugin_activex/Sources.pp | 0 direct/src/plugin_activex/p3dactivex_composite1.cxx | 0 direct/src/plugin_standalone/p3dEmbed.h | 0 direct/src/plugin_standalone/panda3d.I | 0 direct/src/plugin_standalone/panda3d.h | 0 direct/src/plugin_standalone/panda3d.ico | Bin direct/src/plugin_standalone/panda3dBase.I | 0 direct/src/plugin_standalone/panda3dBase.h | 0 dtool/Config.Cygwin64.pp | 0 dtool/Config.Win64.pp | 0 dtool/pptempl/PythonPackageInit.pp | 0 dtool/src/dtoolbase/addHash.I | 0 dtool/src/dtoolbase/addHash.cxx | 0 dtool/src/dtoolbase/addHash.h | 0 dtool/src/dtoolbase/dtool_platform.h | 0 dtool/src/dtoolbase/lookup3.c | 0 dtool/src/dtoolbase/lookup3.h | 0 dtool/src/dtoolbase/memoryBase.cxx | 0 dtool/src/dtoolutil/preprocess_argv.cxx | 0 dtool/src/dtoolutil/preprocess_argv.h | 0 dtool/src/dtoolutil/win32ArgParser.cxx | 0 dtool/src/dtoolutil/win32ArgParser.h | 0 dtool/src/interrogatedb/py_panda.h | 0 dtool/src/newheader/newheader.cxx | 0 dtool/src/parser-inc/Core.h | 0 dtool/src/parser-inc/DirectX9Renderer.h | 0 dtool/src/parser-inc/Forest.h | 0 dtool/src/parser-inc/Max.h | 0 dtool/src/parser-inc/OpenGLRenderer.h | 0 dtool/src/parser-inc/Python.h | 0 dtool/src/parser-inc/cg.h | 0 dtool/src/parser-inc/cgGL.h | 0 dtool/src/parser-inc/collision_trimesh.h | 0 dtool/src/parser-inc/ctype.h | 0 dtool/src/parser-inc/cv.h | 0 dtool/src/parser-inc/cvtypes.h | 0 dtool/src/parser-inc/cxcore.h | 0 dtool/src/parser-inc/cxerror.h | 0 dtool/src/parser-inc/cxtypes.h | 0 dtool/src/parser-inc/glew.h | 0 dtool/src/parser-inc/highgui.h | 0 dtool/src/parser-inc/iparamb2.h | 0 dtool/src/parser-inc/iparamm2.h | 0 dtool/src/parser-inc/iskin.h | 0 dtool/src/parser-inc/istdplug.h | 0 dtool/src/parser-inc/ode.h | 0 dtool/src/parser-inc/os_types.h | 0 dtool/src/parser-inc/phyexp.h | 0 dtool/src/parser-inc/rfftw.h | 0 dtool/src/parser-inc/setjmp.h | 0 dtool/src/parser-inc/socket.h | 0 dtool/src/parser-inc/stdmat.h | 0 dtool/src/parser-inc/x509v3.h | 0 panda/metalibs/pandadx9/Sources.pp | 0 panda/metalibs/pandadx9/pandadx9.cxx | 0 panda/metalibs/pandadx9/pandadx9.h | 0 panda/metalibs/pandaode/Sources.pp | 0 panda/metalibs/pandaode/pandaode.cxx | 0 panda/metalibs/pandaode/pandaode.h | 0 panda/src/android/NativeIStream.java | 0 panda/src/android/PandaActivity.java | 0 panda/src/android/p3android_composite1.cxx | 0 panda/src/android/pview_manifest.xml | 0 panda/src/collide/collisionFloorMesh.I | 0 panda/src/collide/collisionFloorMesh.cxx | 0 panda/src/collide/collisionFloorMesh.h | 0 panda/src/collide/collisionHandler.I | 0 panda/src/collide/collisionHandlerFluidPusher.I | 0 panda/src/collide/collisionHandlerFluidPusher.cxx | 0 panda/src/collide/collisionHandlerFluidPusher.h | 0 panda/src/collide/collisionHandlerGravity.I | 0 panda/src/collide/collisionHandlerGravity.cxx | 0 panda/src/collide/collisionHandlerGravity.h | 0 panda/src/collide/collisionHandlerHighestEvent.cxx | 0 panda/src/collide/collisionHandlerHighestEvent.h | 0 panda/src/configfiles/pandaIcon.ico | Bin panda/src/configfiles/pandaIcon.rc | 0 panda/src/display/graphicsDevice.I | 0 panda/src/display/graphicsDevice.cxx | 0 panda/src/display/graphicsDevice.h | 0 panda/src/distort/oSphereLens.I | 0 panda/src/distort/oSphereLens.cxx | 0 panda/src/distort/oSphereLens.h | 0 panda/src/doc/collisionFlags.txt | 0 panda/src/doc/howto.control_render_order.txt | 0 panda/src/doc/howto.multi-texture-in-maya.txt | 0 panda/src/dxgsg9/Sources.pp | 0 panda/src/dxgsg9/config_dxgsg9.cxx | 0 panda/src/dxgsg9/config_dxgsg9.h | 0 panda/src/dxgsg9/dxGeomMunger9.I | 0 panda/src/dxgsg9/dxGeomMunger9.cxx | 0 panda/src/dxgsg9/dxGeomMunger9.h | 0 panda/src/dxgsg9/dxGraphicsDevice9.cxx | 0 panda/src/dxgsg9/dxGraphicsDevice9.h | 0 panda/src/dxgsg9/dxGraphicsStateGuardian9.I | 0 panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx | 0 panda/src/dxgsg9/dxGraphicsStateGuardian9.h | 0 panda/src/dxgsg9/dxIndexBufferContext9.I | 0 panda/src/dxgsg9/dxIndexBufferContext9.cxx | 0 panda/src/dxgsg9/dxIndexBufferContext9.h | 0 panda/src/dxgsg9/dxInput9.cxx | 0 panda/src/dxgsg9/dxInput9.h | 0 panda/src/dxgsg9/dxOcclusionQueryContext9.I | 0 panda/src/dxgsg9/dxOcclusionQueryContext9.cxx | 0 panda/src/dxgsg9/dxOcclusionQueryContext9.h | 0 panda/src/dxgsg9/dxTextureContext9.I | 0 panda/src/dxgsg9/dxTextureContext9.cxx | 0 panda/src/dxgsg9/dxTextureContext9.h | 0 panda/src/dxgsg9/dxVertexBufferContext9.I | 0 panda/src/dxgsg9/dxVertexBufferContext9.cxx | 0 panda/src/dxgsg9/dxVertexBufferContext9.h | 0 panda/src/dxgsg9/dxgsg9base.h | 0 panda/src/dxgsg9/p3dxgsg9_composite1.cxx | 0 panda/src/dxgsg9/wdxGraphicsPipe9.I | 0 panda/src/dxgsg9/wdxGraphicsPipe9.cxx | 0 panda/src/dxgsg9/wdxGraphicsPipe9.h | 0 panda/src/dxgsg9/wdxGraphicsWindow9.I | 0 panda/src/dxgsg9/wdxGraphicsWindow9.cxx | 0 panda/src/dxgsg9/wdxGraphicsWindow9.h | 0 panda/src/dxml/config_dxml.cxx | 0 panda/src/dxml/config_dxml.h | 0 panda/src/egg/eggPatch.I | 0 panda/src/egg/eggPatch.cxx | 0 panda/src/egg/eggPatch.h | 0 panda/src/egg/eggVertexUV.I | 0 panda/src/egg/eggVertexUV.cxx | 0 panda/src/egg/eggVertexUV.h | 0 panda/src/egg2pg/eggSaver.I | 0 panda/src/egg2pg/eggSaver.cxx | 0 panda/src/egg2pg/eggSaver.h | 0 panda/src/egg2pg/save_egg_file.cxx | 0 panda/src/egg2pg/save_egg_file.h | 0 panda/src/event/eventHandler.I | 0 panda/src/express/copy_stream.cxx | 0 panda/src/express/copy_stream.h | 0 panda/src/express/windowsRegistry.cxx | 0 panda/src/express/windowsRegistry.h | 0 panda/src/framework/rock_floor.rgb_src.c | 0 panda/src/framework/shuttle_controls.bam_src.c | 0 panda/src/glstuff/glCgShaderContext_src.I | 0 panda/src/glstuff/glCgShaderContext_src.cxx | 0 panda/src/glstuff/glCgShaderContext_src.h | 0 panda/src/glstuff/glShaderContext_src.I | 0 panda/src/glstuff/glShaderContext_src.cxx | 0 panda/src/glstuff/glShaderContext_src.h | 0 panda/src/gobj/bufferContextChain.cxx | 0 panda/src/gobj/bufferContextChain.h | 0 panda/src/gobj/geomPatches.cxx | 0 panda/src/gobj/geomPatches.h | 0 panda/src/gobj/shader.I | 0 panda/src/gobj/shader.cxx | 0 panda/src/gobj/shader.h | 0 panda/src/gobj/shaderContext.I | 0 panda/src/gobj/shaderContext.cxx | 0 panda/src/gobj/shaderContext.h | 0 panda/src/gobj/textureStage.I | 0 panda/src/gobj/textureStage.cxx | 0 panda/src/linmath/mathNumbers.I | 0 panda/src/mathutil/pta_LMatrix3_ext.h | 0 panda/src/mathutil/pta_LMatrix4_ext.h | 0 panda/src/mathutil/pta_LVecBase2_ext.h | 0 panda/src/mathutil/pta_LVecBase3_ext.h | 0 panda/src/mathutil/pta_LVecBase4_ext.h | 0 panda/src/mathutil/triangulator3.I | 0 panda/src/mathutil/triangulator3.cxx | 0 panda/src/mathutil/triangulator3.h | 0 panda/src/nativenet/buffered_datagramconnection.h | 0 panda/src/nativenet/buffered_datagramreader.h | 0 panda/src/nativenet/buffered_datagramreader.i | 0 panda/src/nativenet/buffered_datagramwriter.h | 0 panda/src/nativenet/membuffer.h | 0 panda/src/nativenet/membuffer.i | 0 panda/src/nativenet/p3nativenet_composite1.cxx | 0 panda/src/nativenet/ringbuffer.h | 0 panda/src/nativenet/ringbuffer.i | 0 panda/src/nativenet/socket_address.I | 0 panda/src/nativenet/socket_address.h | 0 panda/src/nativenet/socket_base.h | 0 panda/src/nativenet/socket_fdset.h | 0 panda/src/nativenet/socket_ip.h | 0 panda/src/nativenet/socket_portable.h | 0 panda/src/nativenet/socket_selector.h | 0 panda/src/nativenet/socket_tcp.h | 0 panda/src/nativenet/socket_tcp_listen.h | 0 panda/src/nativenet/socket_tcp_ssl.h | 0 panda/src/nativenet/socket_udp_incoming.h | 0 panda/src/nativenet/socket_udp_outgoing.h | 0 panda/src/nativenet/time_accumulator.h | 0 panda/src/nativenet/time_base.h | 0 panda/src/nativenet/time_clock.h | 0 panda/src/nativenet/time_general.h | 0 panda/src/nativenet/time_out.h | 0 panda/src/nativenet/time_span.h | 0 panda/src/ode/Sources.pp | 0 panda/src/ode/config_ode.N | 0 panda/src/ode/config_ode.cxx | 0 panda/src/ode/config_ode.h | 0 panda/src/ode/odeAMotorJoint.I | 0 panda/src/ode/odeBallJoint.I | 0 panda/src/ode/odeBallJoint.cxx | 0 panda/src/ode/odeBody.I | 0 panda/src/ode/odeBody.cxx | 0 panda/src/ode/odeBody.h | 0 panda/src/ode/odeBoxGeom.I | 0 panda/src/ode/odeCappedCylinderGeom.I | 0 panda/src/ode/odeCappedCylinderGeom.cxx | 0 panda/src/ode/odeCappedCylinderGeom.h | 0 panda/src/ode/odeContact.I | 0 panda/src/ode/odeContact.cxx | 0 panda/src/ode/odeContact.h | 0 panda/src/ode/odeContactGeom.I | 0 panda/src/ode/odeContactGeom.cxx | 0 panda/src/ode/odeContactGeom.h | 0 panda/src/ode/odeContactJoint.I | 0 panda/src/ode/odeContactJoint.cxx | 0 panda/src/ode/odeConvexGeom.I | 0 panda/src/ode/odeConvexGeom.h | 0 panda/src/ode/odeCylinderGeom.I | 0 panda/src/ode/odeCylinderGeom.h | 0 panda/src/ode/odeFixedJoint.I | 0 panda/src/ode/odeGeom.I | 0 panda/src/ode/odeGeom.cxx | 0 panda/src/ode/odeGeom.h | 0 panda/src/ode/odeHashSpace.I | 0 panda/src/ode/odeHashSpace.cxx | 0 panda/src/ode/odeHashSpace.h | 0 panda/src/ode/odeHinge2Joint.I | 0 panda/src/ode/odeHingeJoint.I | 0 panda/src/ode/odeHingeJoint.h | 0 panda/src/ode/odeJoint.I | 0 panda/src/ode/odeJoint.cxx | 0 panda/src/ode/odeJoint.h | 0 panda/src/ode/odeJointCollection.cxx | 0 panda/src/ode/odeJointCollection.h | 0 panda/src/ode/odeJointGroup.I | 0 panda/src/ode/odeJointGroup.cxx | 0 panda/src/ode/odeJointGroup.h | 0 panda/src/ode/odeLMotorJoint.I | 0 panda/src/ode/odeLMotorJoint.h | 0 panda/src/ode/odeMass.I | 0 panda/src/ode/odeMass.cxx | 0 panda/src/ode/odeMass.h | 0 panda/src/ode/odeNullJoint.I | 0 panda/src/ode/odeNullJoint.h | 0 panda/src/ode/odePlane2dJoint.I | 0 panda/src/ode/odePlane2dJoint.h | 0 panda/src/ode/odePlaneGeom.I | 0 panda/src/ode/odePlaneGeom.h | 0 panda/src/ode/odeQuadTreeSpace.I | 0 panda/src/ode/odeQuadTreeSpace.cxx | 0 panda/src/ode/odeQuadTreeSpace.h | 0 panda/src/ode/odeRayGeom.I | 0 panda/src/ode/odeRayGeom.h | 0 panda/src/ode/odeSimpleSpace.I | 0 panda/src/ode/odeSimpleSpace.cxx | 0 panda/src/ode/odeSimpleSpace.h | 0 panda/src/ode/odeSliderJoint.I | 0 panda/src/ode/odeSliderJoint.h | 0 panda/src/ode/odeSpace.I | 0 panda/src/ode/odeSpace.cxx | 0 panda/src/ode/odeSpace.h | 0 panda/src/ode/odeSphereGeom.I | 0 panda/src/ode/odeSphereGeom.cxx | 0 panda/src/ode/odeSphereGeom.h | 0 panda/src/ode/odeSurfaceParameters.I | 0 panda/src/ode/odeSurfaceParameters.cxx | 0 panda/src/ode/odeSurfaceParameters.h | 0 panda/src/ode/odeTriMeshData.I | 0 panda/src/ode/odeTriMeshData.cxx | 0 panda/src/ode/odeTriMeshData.h | 0 panda/src/ode/odeTriMeshGeom.I | 0 panda/src/ode/odeTriMeshGeom.cxx | 0 panda/src/ode/odeTriMeshGeom.h | 0 panda/src/ode/odeUniversalJoint.I | 0 panda/src/ode/odeUtil.cxx | 0 panda/src/ode/odeUtil.h | 0 panda/src/ode/odeWorld.I | 0 panda/src/ode/odeWorld.cxx | 0 panda/src/ode/odeWorld.h | 0 panda/src/ode/ode_includes.h | 0 panda/src/ode/p3ode_composite1.cxx | 0 panda/src/ode/p3ode_composite2.cxx | 0 panda/src/ode/p3ode_composite3.cxx | 0 panda/src/parametrics/nurbsCurve.I | 0 panda/src/particlesystem/arcEmitter.cxx | 0 panda/src/particlesystem/arcEmitter.h | 0 .../src/particlesystem/colorInterpolationManager.I | 0 .../particlesystem/colorInterpolationManager.cxx | 0 .../src/particlesystem/colorInterpolationManager.h | 0 panda/src/pgraph/audioVolumeAttrib.I | 0 panda/src/pgraph/audioVolumeAttrib.cxx | 0 panda/src/pgraph/audioVolumeAttrib.h | 0 panda/src/pgraph/modelSaveRequest.I | 0 panda/src/pgraph/modelSaveRequest.cxx | 0 panda/src/pgraph/modelSaveRequest.h | 0 panda/src/pgraph/occluderEffect.I | 0 panda/src/pgraph/occluderEffect.cxx | 0 panda/src/pgraph/occluderEffect.h | 0 panda/src/pgraph/polylightEffect.I | 0 panda/src/pgraph/polylightEffect.cxx | 0 panda/src/pgraph/polylightEffect.h | 0 panda/src/pgraph/polylightNode.I | 0 panda/src/pgraph/polylightNode.cxx | 0 panda/src/pgraph/polylightNode.h | 0 panda/src/pgraph/portalClipper.I | 0 panda/src/pgraph/portalClipper.cxx | 0 panda/src/pgraph/portalClipper.h | 0 panda/src/pgraph/portalNode.I | 0 panda/src/pgraph/portalNode.cxx | 0 panda/src/pgraph/portalNode.h | 0 panda/src/pgraph/shaderAttrib.I | 0 panda/src/pgraph/shaderAttrib.cxx | 0 panda/src/pgraph/shaderAttrib.h | 0 panda/src/pgraph/texGenAttrib.I | 0 panda/src/pgraph/texGenAttrib.cxx | 0 panda/src/pgraph/texGenAttrib.h | 0 panda/src/pgraphnodes/fadeLodNode.I | 0 panda/src/pgraphnodes/fadeLodNode.cxx | 0 panda/src/pgraphnodes/fadeLodNode.h | 0 panda/src/pgui/pgSliderBar.I | 0 panda/src/pgui/pgSliderBar.cxx | 0 panda/src/pgui/pgSliderBar.h | 0 panda/src/physics/linearControlForce.I | 0 panda/src/physics/linearControlForce.cxx | 0 panda/src/physics/linearControlForce.h | 0 panda/src/physics/physicsCollisionHandler.I | 0 panda/src/physics/physicsCollisionHandler.cxx | 0 panda/src/physics/physicsCollisionHandler.h | 0 panda/src/physics/physicsObjectCollection.I | 0 panda/src/physics/physicsObjectCollection.cxx | 0 panda/src/physics/physicsObjectCollection.h | 0 panda/src/pipeline/conditionVarDebug.I | 0 panda/src/pipeline/conditionVarDebug.cxx | 0 panda/src/pipeline/conditionVarDirect.I | 0 panda/src/pipeline/conditionVarDirect.cxx | 0 panda/src/pipeline/contextSwitch_longjmp_src.c | 0 panda/src/pipeline/contextSwitch_ucontext_src.c | 0 panda/src/pipeline/contextSwitch_windows_src.c | 0 panda/src/pipeline/mutexDebug.I | 0 panda/src/pipeline/mutexDebug.cxx | 0 panda/src/pipeline/mutexDirect.I | 0 panda/src/pipeline/mutexDirect.cxx | 0 panda/src/pipeline/reMutexDirect.I | 0 panda/src/pipeline/reMutexDirect.cxx | 0 panda/src/pipeline/test_atomic.cxx | 0 panda/src/pipeline/test_concurrency.cxx | 0 panda/src/pnmimage/pnm-image-filter-sparse-core.cxx | 0 panda/src/pnmimagetypes/pnmFileTypePNG.cxx | 0 panda/src/pnmimagetypes/pnmFileTypePNG.h | 0 panda/src/pstatclient/pStatCollector.cxx | 0 panda/src/putil/bitArray.I | 0 panda/src/putil/bitArray.cxx | 0 panda/src/putil/bitArray.h | 0 panda/src/putil/portalMask.h | 0 panda/src/speedtree/loaderFileTypeStf.cxx | 0 panda/src/speedtree/loaderFileTypeStf.h | 0 panda/src/text/persans.ttf_src.c | 0 panda/src/tinydisplay/p3tinydisplay_composite1.cxx | 0 panda/src/tinydisplay/p3tinydisplay_composite2.cxx | 0 panda/src/tinydisplay/tinyWinGraphicsPipe.I | 0 panda/src/tinydisplay/tinyWinGraphicsPipe.cxx | 0 panda/src/tinydisplay/tinyWinGraphicsPipe.h | 0 panda/src/tinydisplay/tinyWinGraphicsWindow.I | 0 panda/src/tinydisplay/tinyWinGraphicsWindow.cxx | 0 panda/src/tinydisplay/tinyWinGraphicsWindow.h | 0 panda/src/tinydisplay/ztriangle.py | 1 + panda/src/tinydisplay/ztriangle_table.h | 0 panda/src/wgldisplay/wglGraphicsStateGuardian.I | 0 panda/src/wgldisplay/wglGraphicsStateGuardian.cxx | 0 panda/src/wgldisplay/wglGraphicsStateGuardian.h | 0 pandatool/src/bam/ptsToBam.cxx | 0 pandatool/src/bam/ptsToBam.h | 0 pandatool/src/converter/eggToSomethingConverter.I | 0 pandatool/src/converter/eggToSomethingConverter.cxx | 0 pandatool/src/converter/eggToSomethingConverter.h | 0 pandatool/src/daeegg/Sources.pp | 0 pandatool/src/daeegg/daeMaterials.cxx | 0 pandatool/src/daeegg/daeMaterials.h | 0 pandatool/src/daeegg/daeToEggConverter.cxx | 0 pandatool/src/daeegg/daeToEggConverter.h | 0 pandatool/src/daeegg/p3daeegg_composite1.cxx | 0 pandatool/src/daeegg/pre_fcollada_include.h | 0 pandatool/src/daeprogs/Sources.pp | 0 pandatool/src/daeprogs/daeToEgg.cxx | 0 pandatool/src/daeprogs/daeToEgg.h | 0 pandatool/src/daeprogs/eggToDAE.cxx | 0 pandatool/src/daeprogs/eggToDAE.h | 0 pandatool/src/eggprogs/eggRename.cxx | 0 pandatool/src/eggprogs/eggRename.h | 0 pandatool/src/gtk-stats/gtkStatsChartMenu.cxx | 0 pandatool/src/gtk-stats/gtkStatsChartMenu.h | 0 pandatool/src/gtk-stats/gtkStatsGraph.cxx | 0 pandatool/src/gtk-stats/gtkStatsGraph.h | 0 pandatool/src/gtk-stats/gtkStatsLabelStack.cxx | 0 pandatool/src/gtk-stats/gtkStatsLabelStack.h | 0 pandatool/src/gtk-stats/gtkStatsMenuId.h | 0 pandatool/src/gtk-stats/gtkStatsMonitor.I | 0 pandatool/src/gtk-stats/gtkstats_composite1.cxx | 0 pandatool/src/imageprogs/imageInfo.cxx | 0 pandatool/src/imageprogs/imageInfo.h | 0 pandatool/src/imageprogs/imageResize.I | 0 pandatool/src/imageprogs/imageResize.cxx | 0 pandatool/src/imageprogs/imageResize.h | 0 pandatool/src/maxegg/maxEgg.cxx | 0 pandatool/src/maxegg/maxEgg.def | 0 pandatool/src/maxegg/maxEgg.h | 0 pandatool/src/maxegg/maxEgg.rc | 0 pandatool/src/maxegg/maxEggLoader.cxx | 0 pandatool/src/maxegg/maxEggLoader.h | 0 pandatool/src/maxegg/maxNodeDesc.cxx | 0 pandatool/src/maxegg/maxNodeDesc.h | 0 pandatool/src/maxegg/maxNodeTree.cxx | 0 pandatool/src/maxegg/maxNodeTree.h | 0 pandatool/src/maxegg/maxResource.h | 0 pandatool/src/maxegg/maxToEggConverter.cxx | 0 pandatool/src/maxegg/maxToEggConverter.h | 0 pandatool/src/maxegg/p3maxegg_composite1.cxx | 0 pandatool/src/maxprogs/maxEggImport.cxx | 0 pandatool/src/maxprogs/maxEggImport.def | 0 pandatool/src/maxprogs/maxImportRes.h | 0 pandatool/src/maxprogs/maxImportRes.rc | 0 pandatool/src/maya/mayaShaderColorDef.h | 0 pandatool/src/maya/p3maya_composite1.cxx | 0 pandatool/src/mayaegg/mayaEggGroupUserData.I | 0 pandatool/src/mayaegg/mayaEggGroupUserData.cxx | 0 pandatool/src/mayaegg/mayaEggGroupUserData.h | 0 pandatool/src/mayaegg/mayaEggLoader.cxx | 0 pandatool/src/mayaegg/mayaEggLoader.h | 0 pandatool/src/mayaegg/mayaNodeDesc.cxx | 0 pandatool/src/mayaegg/mayaNodeDesc.h | 0 pandatool/src/mayaegg/mayaNodeTree.cxx | 0 pandatool/src/mayaegg/mayaNodeTree.h | 0 pandatool/src/mayaegg/p3mayaegg_composite1.cxx | 0 pandatool/src/mayaprogs/eggToMaya.cxx | 0 pandatool/src/mayaprogs/eggToMaya.h | 0 pandatool/src/mayaprogs/mayaEggImport.cxx | 0 pandatool/src/mayaprogs/mayaPview.cxx | 0 pandatool/src/mayaprogs/mayaPview.h | 0 pandatool/src/mayaprogs/mayaToEgg_client.cxx | 0 pandatool/src/mayaprogs/mayaToEgg_client.h | 0 pandatool/src/mayaprogs/mayaToEgg_server.cxx | 0 pandatool/src/mayaprogs/mayaToEgg_server.h | 0 pandatool/src/mayaprogs/mayapath.cxx | 0 pandatool/src/mayaprogs/normal_test.cxx | 0 pandatool/src/objegg/Sources.pp | 0 pandatool/src/objegg/config_objegg.cxx | 0 pandatool/src/objegg/config_objegg.h | 0 pandatool/src/objegg/eggToObjConverter.cxx | 0 pandatool/src/objegg/eggToObjConverter.h | 0 pandatool/src/objegg/objToEggConverter.I | 0 pandatool/src/objegg/objToEggConverter.cxx | 0 pandatool/src/objegg/objToEggConverter.h | 0 pandatool/src/objprogs/Sources.pp | 0 pandatool/src/objprogs/objToEgg.cxx | 0 pandatool/src/objprogs/objToEgg.h | 0 pandatool/src/pandatoolbase/pathReplace.I | 0 pandatool/src/pandatoolbase/pathReplace.cxx | 0 pandatool/src/pandatoolbase/pathReplace.h | 0 pandatool/src/pandatoolbase/pathStore.cxx | 0 pandatool/src/pandatoolbase/pathStore.h | 0 pandatool/src/pfmprogs/Sources.pp | 0 pandatool/src/pfmprogs/config_pfm.cxx | 0 pandatool/src/pfmprogs/config_pfm.h | 0 pandatool/src/pfmprogs/pfmBba.cxx | 0 pandatool/src/pfmprogs/pfmBba.h | 0 pandatool/src/pfmprogs/pfmTrans.cxx | 0 pandatool/src/pfmprogs/pfmTrans.h | 0 .../src/pstatserver/p3pstatserver_composite1.cxx | 0 pandatool/src/softegg/Sources.pp | 0 pandatool/src/softegg/config_softegg.cxx | 0 pandatool/src/softegg/config_softegg.h | 0 pandatool/src/softegg/soft2Egg.c | 0 pandatool/src/softegg/softEggGroupUserData.I | 0 pandatool/src/softegg/softEggGroupUserData.cxx | 0 pandatool/src/softegg/softEggGroupUserData.h | 0 pandatool/src/softegg/softNodeDesc.cxx | 0 pandatool/src/softegg/softNodeDesc.h | 0 pandatool/src/softegg/softNodeTree.cxx | 0 pandatool/src/softegg/softNodeTree.h | 0 pandatool/src/softegg/softToEggConverter.cxx | 0 pandatool/src/softegg/softToEggConverter.h | 0 pandatool/src/text-stats/textMonitor.I | 0 pandatool/src/win-stats/winStatsChartMenu.cxx | 0 pandatool/src/win-stats/winStatsChartMenu.h | 0 pandatool/src/win-stats/winStatsLabel.cxx | 0 pandatool/src/win-stats/winStatsLabel.h | 0 pandatool/src/win-stats/winStatsLabelStack.cxx | 0 pandatool/src/win-stats/winStatsLabelStack.h | 0 pandatool/src/win-stats/winStatsMenuId.h | 0 pandatool/src/win-stats/winStatsMonitor.I | 0 pandatool/src/win-stats/winStatsPianoRoll.cxx | 0 pandatool/src/win-stats/winStatsPianoRoll.h | 0 pandatool/src/xfile/standardTemplates.x | 0 pandatool/src/xfile/standardTemplates.x.pz.c | 0 556 files changed, 1 insertion(+) mode change 100755 => 100644 contrib/src/ai/Sources.pp mode change 100644 => 100755 contrib/src/panda3dtoolsgui/build_exe.bat mode change 100755 => 100644 direct/src/dcparser/dcPackData.I mode change 100755 => 100644 direct/src/dcparser/dcPackData.cxx mode change 100755 => 100644 direct/src/dcparser/dcPackData.h mode change 100755 => 100644 direct/src/dcparser/dcPacker.I mode change 100755 => 100644 direct/src/dcparser/dcPacker.cxx mode change 100755 => 100644 direct/src/dcparser/dcPacker.h mode change 100755 => 100644 direct/src/dcparser/dcPackerInterface.cxx mode change 100755 => 100644 direct/src/dcparser/dcPackerInterface.h mode change 100755 => 100644 direct/src/dcparser/dcPython.h mode change 100755 => 100644 direct/src/dcparser/dcSwitchParameter.cxx mode change 100755 => 100644 direct/src/dcparser/dcSwitchParameter.h mode change 100755 => 100644 direct/src/dcparser/dcmsgtypes.h mode change 100755 => 100644 direct/src/directbase/ppython.cxx mode change 100755 => 100644 direct/src/doc/dcPacker.txt mode change 100755 => 100644 direct/src/doc/howto.PythonRedefine mode change 100755 => 100644 direct/src/http/favicon.ico mode change 100755 => 100644 direct/src/p3d/panda3d.pdef mode change 100755 => 100644 direct/src/plugin/fileSpec.I mode change 100755 => 100644 direct/src/plugin/fileSpec.cxx mode change 100755 => 100644 direct/src/plugin/fileSpec.h mode change 100755 => 100644 direct/src/plugin/find_root_dir.cxx mode change 100755 => 100644 direct/src/plugin/find_root_dir.h mode change 100755 => 100644 direct/src/plugin/get_tinyxml.h mode change 100755 => 100644 direct/src/plugin/get_twirl_data.cxx mode change 100755 => 100644 direct/src/plugin/get_twirl_data.h mode change 100755 => 100644 direct/src/plugin/handleStreamBuf.I mode change 100755 => 100644 direct/src/plugin/load_plugin.cxx mode change 100755 => 100644 direct/src/plugin/load_plugin.h mode change 100755 => 100644 direct/src/plugin/mkdir_complete.cxx mode change 100755 => 100644 direct/src/plugin/mkdir_complete.h mode change 100755 => 100644 direct/src/plugin/p3dCInstance.I mode change 100755 => 100644 direct/src/plugin/p3dCInstance.cxx mode change 100755 => 100644 direct/src/plugin/p3dCInstance.h mode change 100755 => 100644 direct/src/plugin/p3dDownload.I mode change 100755 => 100644 direct/src/plugin/p3dDownload.cxx mode change 100755 => 100644 direct/src/plugin/p3dDownload.h mode change 100755 => 100644 direct/src/plugin/p3dFileDownload.I mode change 100755 => 100644 direct/src/plugin/p3dFileDownload.cxx mode change 100755 => 100644 direct/src/plugin/p3dFileDownload.h mode change 100755 => 100644 direct/src/plugin/p3dPackage.I mode change 100755 => 100644 direct/src/plugin/p3dPackage.cxx mode change 100755 => 100644 direct/src/plugin/p3dPackage.h mode change 100755 => 100644 direct/src/plugin/p3dPythonRun.I mode change 100755 => 100644 direct/src/plugin/p3dPythonRun.cxx mode change 100755 => 100644 direct/src/plugin/p3dPythonRun.h mode change 100755 => 100644 direct/src/plugin/p3dSplashWindow.I mode change 100755 => 100644 direct/src/plugin/p3dSplashWindow.cxx mode change 100755 => 100644 direct/src/plugin/p3dSplashWindow.h mode change 100755 => 100644 direct/src/plugin/p3dWinSplashWindow.I mode change 100755 => 100644 direct/src/plugin/p3dWinSplashWindow.cxx mode change 100755 => 100644 direct/src/plugin/p3dWinSplashWindow.h mode change 100755 => 100644 direct/src/plugin/p3dX11SplashWindow.cxx mode change 100755 => 100644 direct/src/plugin/p3dX11SplashWindow.h mode change 100755 => 100644 direct/src/plugin/p3d_lock.h mode change 100755 => 100644 direct/src/plugin/twirl.xcf mode change 100755 => 100644 direct/src/plugin/wstring_encode.cxx mode change 100755 => 100644 direct/src/plugin/wstring_encode.h mode change 100755 => 100644 direct/src/plugin/xml_helpers.cxx mode change 100755 => 100644 direct/src/plugin/xml_helpers.h mode change 100755 => 100644 direct/src/plugin_activex/P3DActiveX.rc.pp mode change 100755 => 100644 direct/src/plugin_activex/Sources.pp mode change 100755 => 100644 direct/src/plugin_activex/p3dactivex_composite1.cxx mode change 100755 => 100644 direct/src/plugin_standalone/p3dEmbed.h mode change 100755 => 100644 direct/src/plugin_standalone/panda3d.I mode change 100755 => 100644 direct/src/plugin_standalone/panda3d.h mode change 100755 => 100644 direct/src/plugin_standalone/panda3d.ico mode change 100755 => 100644 direct/src/plugin_standalone/panda3dBase.I mode change 100755 => 100644 direct/src/plugin_standalone/panda3dBase.h mode change 100755 => 100644 dtool/Config.Cygwin64.pp mode change 100755 => 100644 dtool/Config.Win64.pp mode change 100755 => 100644 dtool/pptempl/PythonPackageInit.pp mode change 100755 => 100644 dtool/src/dtoolbase/addHash.I mode change 100755 => 100644 dtool/src/dtoolbase/addHash.cxx mode change 100755 => 100644 dtool/src/dtoolbase/addHash.h mode change 100755 => 100644 dtool/src/dtoolbase/dtool_platform.h mode change 100755 => 100644 dtool/src/dtoolbase/lookup3.c mode change 100755 => 100644 dtool/src/dtoolbase/lookup3.h mode change 100755 => 100644 dtool/src/dtoolbase/memoryBase.cxx mode change 100755 => 100644 dtool/src/dtoolutil/preprocess_argv.cxx mode change 100755 => 100644 dtool/src/dtoolutil/preprocess_argv.h mode change 100755 => 100644 dtool/src/dtoolutil/win32ArgParser.cxx mode change 100755 => 100644 dtool/src/dtoolutil/win32ArgParser.h mode change 100755 => 100644 dtool/src/interrogatedb/py_panda.h mode change 100755 => 100644 dtool/src/newheader/newheader.cxx mode change 100755 => 100644 dtool/src/parser-inc/Core.h mode change 100755 => 100644 dtool/src/parser-inc/DirectX9Renderer.h mode change 100755 => 100644 dtool/src/parser-inc/Forest.h mode change 100755 => 100644 dtool/src/parser-inc/Max.h mode change 100755 => 100644 dtool/src/parser-inc/OpenGLRenderer.h mode change 100755 => 100644 dtool/src/parser-inc/Python.h mode change 100755 => 100644 dtool/src/parser-inc/cg.h mode change 100755 => 100644 dtool/src/parser-inc/cgGL.h mode change 100755 => 100644 dtool/src/parser-inc/collision_trimesh.h mode change 100755 => 100644 dtool/src/parser-inc/ctype.h mode change 100755 => 100644 dtool/src/parser-inc/cv.h mode change 100755 => 100644 dtool/src/parser-inc/cvtypes.h mode change 100755 => 100644 dtool/src/parser-inc/cxcore.h mode change 100755 => 100644 dtool/src/parser-inc/cxerror.h mode change 100755 => 100644 dtool/src/parser-inc/cxtypes.h mode change 100755 => 100644 dtool/src/parser-inc/glew.h mode change 100755 => 100644 dtool/src/parser-inc/highgui.h mode change 100755 => 100644 dtool/src/parser-inc/iparamb2.h mode change 100755 => 100644 dtool/src/parser-inc/iparamm2.h mode change 100755 => 100644 dtool/src/parser-inc/iskin.h mode change 100755 => 100644 dtool/src/parser-inc/istdplug.h mode change 100755 => 100644 dtool/src/parser-inc/ode.h mode change 100755 => 100644 dtool/src/parser-inc/os_types.h mode change 100755 => 100644 dtool/src/parser-inc/phyexp.h mode change 100755 => 100644 dtool/src/parser-inc/rfftw.h mode change 100755 => 100644 dtool/src/parser-inc/setjmp.h mode change 100755 => 100644 dtool/src/parser-inc/socket.h mode change 100755 => 100644 dtool/src/parser-inc/stdmat.h mode change 100755 => 100644 dtool/src/parser-inc/x509v3.h mode change 100755 => 100644 panda/metalibs/pandadx9/Sources.pp mode change 100755 => 100644 panda/metalibs/pandadx9/pandadx9.cxx mode change 100755 => 100644 panda/metalibs/pandadx9/pandadx9.h mode change 100755 => 100644 panda/metalibs/pandaode/Sources.pp mode change 100755 => 100644 panda/metalibs/pandaode/pandaode.cxx mode change 100755 => 100644 panda/metalibs/pandaode/pandaode.h mode change 100755 => 100644 panda/src/android/NativeIStream.java mode change 100755 => 100644 panda/src/android/PandaActivity.java mode change 100755 => 100644 panda/src/android/p3android_composite1.cxx mode change 100755 => 100644 panda/src/android/pview_manifest.xml mode change 100755 => 100644 panda/src/collide/collisionFloorMesh.I mode change 100755 => 100644 panda/src/collide/collisionFloorMesh.cxx mode change 100755 => 100644 panda/src/collide/collisionFloorMesh.h mode change 100755 => 100644 panda/src/collide/collisionHandler.I mode change 100755 => 100644 panda/src/collide/collisionHandlerFluidPusher.I mode change 100755 => 100644 panda/src/collide/collisionHandlerFluidPusher.cxx mode change 100755 => 100644 panda/src/collide/collisionHandlerFluidPusher.h mode change 100755 => 100644 panda/src/collide/collisionHandlerGravity.I mode change 100755 => 100644 panda/src/collide/collisionHandlerGravity.cxx mode change 100755 => 100644 panda/src/collide/collisionHandlerGravity.h mode change 100755 => 100644 panda/src/collide/collisionHandlerHighestEvent.cxx mode change 100755 => 100644 panda/src/collide/collisionHandlerHighestEvent.h mode change 100755 => 100644 panda/src/configfiles/pandaIcon.ico mode change 100755 => 100644 panda/src/configfiles/pandaIcon.rc mode change 100755 => 100644 panda/src/display/graphicsDevice.I mode change 100755 => 100644 panda/src/display/graphicsDevice.cxx mode change 100755 => 100644 panda/src/display/graphicsDevice.h mode change 100755 => 100644 panda/src/distort/oSphereLens.I mode change 100755 => 100644 panda/src/distort/oSphereLens.cxx mode change 100755 => 100644 panda/src/distort/oSphereLens.h mode change 100755 => 100644 panda/src/doc/collisionFlags.txt mode change 100755 => 100644 panda/src/doc/howto.control_render_order.txt mode change 100755 => 100644 panda/src/doc/howto.multi-texture-in-maya.txt mode change 100755 => 100644 panda/src/dxgsg9/Sources.pp mode change 100755 => 100644 panda/src/dxgsg9/config_dxgsg9.cxx mode change 100755 => 100644 panda/src/dxgsg9/config_dxgsg9.h mode change 100755 => 100644 panda/src/dxgsg9/dxGeomMunger9.I mode change 100755 => 100644 panda/src/dxgsg9/dxGeomMunger9.cxx mode change 100755 => 100644 panda/src/dxgsg9/dxGeomMunger9.h mode change 100755 => 100644 panda/src/dxgsg9/dxGraphicsDevice9.cxx mode change 100755 => 100644 panda/src/dxgsg9/dxGraphicsDevice9.h mode change 100755 => 100644 panda/src/dxgsg9/dxGraphicsStateGuardian9.I mode change 100755 => 100644 panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx mode change 100755 => 100644 panda/src/dxgsg9/dxGraphicsStateGuardian9.h mode change 100755 => 100644 panda/src/dxgsg9/dxIndexBufferContext9.I mode change 100755 => 100644 panda/src/dxgsg9/dxIndexBufferContext9.cxx mode change 100755 => 100644 panda/src/dxgsg9/dxIndexBufferContext9.h mode change 100755 => 100644 panda/src/dxgsg9/dxInput9.cxx mode change 100755 => 100644 panda/src/dxgsg9/dxInput9.h mode change 100755 => 100644 panda/src/dxgsg9/dxOcclusionQueryContext9.I mode change 100755 => 100644 panda/src/dxgsg9/dxOcclusionQueryContext9.cxx mode change 100755 => 100644 panda/src/dxgsg9/dxOcclusionQueryContext9.h mode change 100755 => 100644 panda/src/dxgsg9/dxTextureContext9.I mode change 100755 => 100644 panda/src/dxgsg9/dxTextureContext9.cxx mode change 100755 => 100644 panda/src/dxgsg9/dxTextureContext9.h mode change 100755 => 100644 panda/src/dxgsg9/dxVertexBufferContext9.I mode change 100755 => 100644 panda/src/dxgsg9/dxVertexBufferContext9.cxx mode change 100755 => 100644 panda/src/dxgsg9/dxVertexBufferContext9.h mode change 100755 => 100644 panda/src/dxgsg9/dxgsg9base.h mode change 100755 => 100644 panda/src/dxgsg9/p3dxgsg9_composite1.cxx mode change 100755 => 100644 panda/src/dxgsg9/wdxGraphicsPipe9.I mode change 100755 => 100644 panda/src/dxgsg9/wdxGraphicsPipe9.cxx mode change 100755 => 100644 panda/src/dxgsg9/wdxGraphicsPipe9.h mode change 100755 => 100644 panda/src/dxgsg9/wdxGraphicsWindow9.I mode change 100755 => 100644 panda/src/dxgsg9/wdxGraphicsWindow9.cxx mode change 100755 => 100644 panda/src/dxgsg9/wdxGraphicsWindow9.h mode change 100755 => 100644 panda/src/dxml/config_dxml.cxx mode change 100755 => 100644 panda/src/dxml/config_dxml.h mode change 100755 => 100644 panda/src/egg/eggPatch.I mode change 100755 => 100644 panda/src/egg/eggPatch.cxx mode change 100755 => 100644 panda/src/egg/eggPatch.h mode change 100755 => 100644 panda/src/egg/eggVertexUV.I mode change 100755 => 100644 panda/src/egg/eggVertexUV.cxx mode change 100755 => 100644 panda/src/egg/eggVertexUV.h mode change 100755 => 100644 panda/src/egg2pg/eggSaver.I mode change 100755 => 100644 panda/src/egg2pg/eggSaver.cxx mode change 100755 => 100644 panda/src/egg2pg/eggSaver.h mode change 100755 => 100644 panda/src/egg2pg/save_egg_file.cxx mode change 100755 => 100644 panda/src/egg2pg/save_egg_file.h mode change 100755 => 100644 panda/src/event/eventHandler.I mode change 100755 => 100644 panda/src/express/copy_stream.cxx mode change 100755 => 100644 panda/src/express/copy_stream.h mode change 100755 => 100644 panda/src/express/windowsRegistry.cxx mode change 100755 => 100644 panda/src/express/windowsRegistry.h mode change 100755 => 100644 panda/src/framework/rock_floor.rgb_src.c mode change 100755 => 100644 panda/src/framework/shuttle_controls.bam_src.c mode change 100755 => 100644 panda/src/glstuff/glCgShaderContext_src.I mode change 100755 => 100644 panda/src/glstuff/glCgShaderContext_src.cxx mode change 100755 => 100644 panda/src/glstuff/glCgShaderContext_src.h mode change 100755 => 100644 panda/src/glstuff/glShaderContext_src.I mode change 100755 => 100644 panda/src/glstuff/glShaderContext_src.cxx mode change 100755 => 100644 panda/src/glstuff/glShaderContext_src.h mode change 100755 => 100644 panda/src/gobj/bufferContextChain.cxx mode change 100755 => 100644 panda/src/gobj/bufferContextChain.h mode change 100755 => 100644 panda/src/gobj/geomPatches.cxx mode change 100755 => 100644 panda/src/gobj/geomPatches.h mode change 100755 => 100644 panda/src/gobj/shader.I mode change 100755 => 100644 panda/src/gobj/shader.cxx mode change 100755 => 100644 panda/src/gobj/shader.h mode change 100755 => 100644 panda/src/gobj/shaderContext.I mode change 100755 => 100644 panda/src/gobj/shaderContext.cxx mode change 100755 => 100644 panda/src/gobj/shaderContext.h mode change 100755 => 100644 panda/src/gobj/textureStage.I mode change 100755 => 100644 panda/src/gobj/textureStage.cxx mode change 100755 => 100644 panda/src/linmath/mathNumbers.I mode change 100755 => 100644 panda/src/mathutil/pta_LMatrix3_ext.h mode change 100755 => 100644 panda/src/mathutil/pta_LMatrix4_ext.h mode change 100755 => 100644 panda/src/mathutil/pta_LVecBase2_ext.h mode change 100755 => 100644 panda/src/mathutil/pta_LVecBase3_ext.h mode change 100755 => 100644 panda/src/mathutil/pta_LVecBase4_ext.h mode change 100755 => 100644 panda/src/mathutil/triangulator3.I mode change 100755 => 100644 panda/src/mathutil/triangulator3.cxx mode change 100755 => 100644 panda/src/mathutil/triangulator3.h mode change 100755 => 100644 panda/src/nativenet/buffered_datagramconnection.h mode change 100755 => 100644 panda/src/nativenet/buffered_datagramreader.h mode change 100755 => 100644 panda/src/nativenet/buffered_datagramreader.i mode change 100755 => 100644 panda/src/nativenet/buffered_datagramwriter.h mode change 100755 => 100644 panda/src/nativenet/membuffer.h mode change 100755 => 100644 panda/src/nativenet/membuffer.i mode change 100755 => 100644 panda/src/nativenet/p3nativenet_composite1.cxx mode change 100755 => 100644 panda/src/nativenet/ringbuffer.h mode change 100755 => 100644 panda/src/nativenet/ringbuffer.i mode change 100755 => 100644 panda/src/nativenet/socket_address.I mode change 100755 => 100644 panda/src/nativenet/socket_address.h mode change 100755 => 100644 panda/src/nativenet/socket_base.h mode change 100755 => 100644 panda/src/nativenet/socket_fdset.h mode change 100755 => 100644 panda/src/nativenet/socket_ip.h mode change 100755 => 100644 panda/src/nativenet/socket_portable.h mode change 100755 => 100644 panda/src/nativenet/socket_selector.h mode change 100755 => 100644 panda/src/nativenet/socket_tcp.h mode change 100755 => 100644 panda/src/nativenet/socket_tcp_listen.h mode change 100755 => 100644 panda/src/nativenet/socket_tcp_ssl.h mode change 100755 => 100644 panda/src/nativenet/socket_udp_incoming.h mode change 100755 => 100644 panda/src/nativenet/socket_udp_outgoing.h mode change 100755 => 100644 panda/src/nativenet/time_accumulator.h mode change 100755 => 100644 panda/src/nativenet/time_base.h mode change 100755 => 100644 panda/src/nativenet/time_clock.h mode change 100755 => 100644 panda/src/nativenet/time_general.h mode change 100755 => 100644 panda/src/nativenet/time_out.h mode change 100755 => 100644 panda/src/nativenet/time_span.h mode change 100755 => 100644 panda/src/ode/Sources.pp mode change 100755 => 100644 panda/src/ode/config_ode.N mode change 100755 => 100644 panda/src/ode/config_ode.cxx mode change 100755 => 100644 panda/src/ode/config_ode.h mode change 100755 => 100644 panda/src/ode/odeAMotorJoint.I mode change 100755 => 100644 panda/src/ode/odeBallJoint.I mode change 100755 => 100644 panda/src/ode/odeBallJoint.cxx mode change 100755 => 100644 panda/src/ode/odeBody.I mode change 100755 => 100644 panda/src/ode/odeBody.cxx mode change 100755 => 100644 panda/src/ode/odeBody.h mode change 100755 => 100644 panda/src/ode/odeBoxGeom.I mode change 100755 => 100644 panda/src/ode/odeCappedCylinderGeom.I mode change 100755 => 100644 panda/src/ode/odeCappedCylinderGeom.cxx mode change 100755 => 100644 panda/src/ode/odeCappedCylinderGeom.h mode change 100755 => 100644 panda/src/ode/odeContact.I mode change 100755 => 100644 panda/src/ode/odeContact.cxx mode change 100755 => 100644 panda/src/ode/odeContact.h mode change 100755 => 100644 panda/src/ode/odeContactGeom.I mode change 100755 => 100644 panda/src/ode/odeContactGeom.cxx mode change 100755 => 100644 panda/src/ode/odeContactGeom.h mode change 100755 => 100644 panda/src/ode/odeContactJoint.I mode change 100755 => 100644 panda/src/ode/odeContactJoint.cxx mode change 100755 => 100644 panda/src/ode/odeConvexGeom.I mode change 100755 => 100644 panda/src/ode/odeConvexGeom.h mode change 100755 => 100644 panda/src/ode/odeCylinderGeom.I mode change 100755 => 100644 panda/src/ode/odeCylinderGeom.h mode change 100755 => 100644 panda/src/ode/odeFixedJoint.I mode change 100755 => 100644 panda/src/ode/odeGeom.I mode change 100755 => 100644 panda/src/ode/odeGeom.cxx mode change 100755 => 100644 panda/src/ode/odeGeom.h mode change 100755 => 100644 panda/src/ode/odeHashSpace.I mode change 100755 => 100644 panda/src/ode/odeHashSpace.cxx mode change 100755 => 100644 panda/src/ode/odeHashSpace.h mode change 100755 => 100644 panda/src/ode/odeHinge2Joint.I mode change 100755 => 100644 panda/src/ode/odeHingeJoint.I mode change 100755 => 100644 panda/src/ode/odeHingeJoint.h mode change 100755 => 100644 panda/src/ode/odeJoint.I mode change 100755 => 100644 panda/src/ode/odeJoint.cxx mode change 100755 => 100644 panda/src/ode/odeJoint.h mode change 100755 => 100644 panda/src/ode/odeJointCollection.cxx mode change 100755 => 100644 panda/src/ode/odeJointCollection.h mode change 100755 => 100644 panda/src/ode/odeJointGroup.I mode change 100755 => 100644 panda/src/ode/odeJointGroup.cxx mode change 100755 => 100644 panda/src/ode/odeJointGroup.h mode change 100755 => 100644 panda/src/ode/odeLMotorJoint.I mode change 100755 => 100644 panda/src/ode/odeLMotorJoint.h mode change 100755 => 100644 panda/src/ode/odeMass.I mode change 100755 => 100644 panda/src/ode/odeMass.cxx mode change 100755 => 100644 panda/src/ode/odeMass.h mode change 100755 => 100644 panda/src/ode/odeNullJoint.I mode change 100755 => 100644 panda/src/ode/odeNullJoint.h mode change 100755 => 100644 panda/src/ode/odePlane2dJoint.I mode change 100755 => 100644 panda/src/ode/odePlane2dJoint.h mode change 100755 => 100644 panda/src/ode/odePlaneGeom.I mode change 100755 => 100644 panda/src/ode/odePlaneGeom.h mode change 100755 => 100644 panda/src/ode/odeQuadTreeSpace.I mode change 100755 => 100644 panda/src/ode/odeQuadTreeSpace.cxx mode change 100755 => 100644 panda/src/ode/odeQuadTreeSpace.h mode change 100755 => 100644 panda/src/ode/odeRayGeom.I mode change 100755 => 100644 panda/src/ode/odeRayGeom.h mode change 100755 => 100644 panda/src/ode/odeSimpleSpace.I mode change 100755 => 100644 panda/src/ode/odeSimpleSpace.cxx mode change 100755 => 100644 panda/src/ode/odeSimpleSpace.h mode change 100755 => 100644 panda/src/ode/odeSliderJoint.I mode change 100755 => 100644 panda/src/ode/odeSliderJoint.h mode change 100755 => 100644 panda/src/ode/odeSpace.I mode change 100755 => 100644 panda/src/ode/odeSpace.cxx mode change 100755 => 100644 panda/src/ode/odeSpace.h mode change 100755 => 100644 panda/src/ode/odeSphereGeom.I mode change 100755 => 100644 panda/src/ode/odeSphereGeom.cxx mode change 100755 => 100644 panda/src/ode/odeSphereGeom.h mode change 100755 => 100644 panda/src/ode/odeSurfaceParameters.I mode change 100755 => 100644 panda/src/ode/odeSurfaceParameters.cxx mode change 100755 => 100644 panda/src/ode/odeSurfaceParameters.h mode change 100755 => 100644 panda/src/ode/odeTriMeshData.I mode change 100755 => 100644 panda/src/ode/odeTriMeshData.cxx mode change 100755 => 100644 panda/src/ode/odeTriMeshData.h mode change 100755 => 100644 panda/src/ode/odeTriMeshGeom.I mode change 100755 => 100644 panda/src/ode/odeTriMeshGeom.cxx mode change 100755 => 100644 panda/src/ode/odeTriMeshGeom.h mode change 100755 => 100644 panda/src/ode/odeUniversalJoint.I mode change 100755 => 100644 panda/src/ode/odeUtil.cxx mode change 100755 => 100644 panda/src/ode/odeUtil.h mode change 100755 => 100644 panda/src/ode/odeWorld.I mode change 100755 => 100644 panda/src/ode/odeWorld.cxx mode change 100755 => 100644 panda/src/ode/odeWorld.h mode change 100755 => 100644 panda/src/ode/ode_includes.h mode change 100755 => 100644 panda/src/ode/p3ode_composite1.cxx mode change 100755 => 100644 panda/src/ode/p3ode_composite2.cxx mode change 100755 => 100644 panda/src/ode/p3ode_composite3.cxx mode change 100755 => 100644 panda/src/parametrics/nurbsCurve.I mode change 100755 => 100644 panda/src/particlesystem/arcEmitter.cxx mode change 100755 => 100644 panda/src/particlesystem/arcEmitter.h mode change 100755 => 100644 panda/src/particlesystem/colorInterpolationManager.I mode change 100755 => 100644 panda/src/particlesystem/colorInterpolationManager.cxx mode change 100755 => 100644 panda/src/particlesystem/colorInterpolationManager.h mode change 100755 => 100644 panda/src/pgraph/audioVolumeAttrib.I mode change 100755 => 100644 panda/src/pgraph/audioVolumeAttrib.cxx mode change 100755 => 100644 panda/src/pgraph/audioVolumeAttrib.h mode change 100755 => 100644 panda/src/pgraph/modelSaveRequest.I mode change 100755 => 100644 panda/src/pgraph/modelSaveRequest.cxx mode change 100755 => 100644 panda/src/pgraph/modelSaveRequest.h mode change 100755 => 100644 panda/src/pgraph/occluderEffect.I mode change 100755 => 100644 panda/src/pgraph/occluderEffect.cxx mode change 100755 => 100644 panda/src/pgraph/occluderEffect.h mode change 100755 => 100644 panda/src/pgraph/polylightEffect.I mode change 100755 => 100644 panda/src/pgraph/polylightEffect.cxx mode change 100755 => 100644 panda/src/pgraph/polylightEffect.h mode change 100755 => 100644 panda/src/pgraph/polylightNode.I mode change 100755 => 100644 panda/src/pgraph/polylightNode.cxx mode change 100755 => 100644 panda/src/pgraph/polylightNode.h mode change 100755 => 100644 panda/src/pgraph/portalClipper.I mode change 100755 => 100644 panda/src/pgraph/portalClipper.cxx mode change 100755 => 100644 panda/src/pgraph/portalClipper.h mode change 100755 => 100644 panda/src/pgraph/portalNode.I mode change 100755 => 100644 panda/src/pgraph/portalNode.cxx mode change 100755 => 100644 panda/src/pgraph/portalNode.h mode change 100755 => 100644 panda/src/pgraph/shaderAttrib.I mode change 100755 => 100644 panda/src/pgraph/shaderAttrib.cxx mode change 100755 => 100644 panda/src/pgraph/shaderAttrib.h mode change 100755 => 100644 panda/src/pgraph/texGenAttrib.I mode change 100755 => 100644 panda/src/pgraph/texGenAttrib.cxx mode change 100755 => 100644 panda/src/pgraph/texGenAttrib.h mode change 100755 => 100644 panda/src/pgraphnodes/fadeLodNode.I mode change 100755 => 100644 panda/src/pgraphnodes/fadeLodNode.cxx mode change 100755 => 100644 panda/src/pgraphnodes/fadeLodNode.h mode change 100755 => 100644 panda/src/pgui/pgSliderBar.I mode change 100755 => 100644 panda/src/pgui/pgSliderBar.cxx mode change 100755 => 100644 panda/src/pgui/pgSliderBar.h mode change 100755 => 100644 panda/src/physics/linearControlForce.I mode change 100755 => 100644 panda/src/physics/linearControlForce.cxx mode change 100755 => 100644 panda/src/physics/linearControlForce.h mode change 100755 => 100644 panda/src/physics/physicsCollisionHandler.I mode change 100755 => 100644 panda/src/physics/physicsCollisionHandler.cxx mode change 100755 => 100644 panda/src/physics/physicsCollisionHandler.h mode change 100755 => 100644 panda/src/physics/physicsObjectCollection.I mode change 100755 => 100644 panda/src/physics/physicsObjectCollection.cxx mode change 100755 => 100644 panda/src/physics/physicsObjectCollection.h mode change 100755 => 100644 panda/src/pipeline/conditionVarDebug.I mode change 100755 => 100644 panda/src/pipeline/conditionVarDebug.cxx mode change 100755 => 100644 panda/src/pipeline/conditionVarDirect.I mode change 100755 => 100644 panda/src/pipeline/conditionVarDirect.cxx mode change 100755 => 100644 panda/src/pipeline/contextSwitch_longjmp_src.c mode change 100755 => 100644 panda/src/pipeline/contextSwitch_ucontext_src.c mode change 100755 => 100644 panda/src/pipeline/contextSwitch_windows_src.c mode change 100755 => 100644 panda/src/pipeline/mutexDebug.I mode change 100755 => 100644 panda/src/pipeline/mutexDebug.cxx mode change 100755 => 100644 panda/src/pipeline/mutexDirect.I mode change 100755 => 100644 panda/src/pipeline/mutexDirect.cxx mode change 100755 => 100644 panda/src/pipeline/reMutexDirect.I mode change 100755 => 100644 panda/src/pipeline/reMutexDirect.cxx mode change 100755 => 100644 panda/src/pipeline/test_atomic.cxx mode change 100755 => 100644 panda/src/pipeline/test_concurrency.cxx mode change 100755 => 100644 panda/src/pnmimage/pnm-image-filter-sparse-core.cxx mode change 100755 => 100644 panda/src/pnmimagetypes/pnmFileTypePNG.cxx mode change 100755 => 100644 panda/src/pnmimagetypes/pnmFileTypePNG.h mode change 100755 => 100644 panda/src/pstatclient/pStatCollector.cxx mode change 100755 => 100644 panda/src/putil/bitArray.I mode change 100755 => 100644 panda/src/putil/bitArray.cxx mode change 100755 => 100644 panda/src/putil/bitArray.h mode change 100755 => 100644 panda/src/putil/portalMask.h mode change 100755 => 100644 panda/src/speedtree/loaderFileTypeStf.cxx mode change 100755 => 100644 panda/src/speedtree/loaderFileTypeStf.h mode change 100755 => 100644 panda/src/text/persans.ttf_src.c mode change 100755 => 100644 panda/src/tinydisplay/p3tinydisplay_composite1.cxx mode change 100755 => 100644 panda/src/tinydisplay/p3tinydisplay_composite2.cxx mode change 100755 => 100644 panda/src/tinydisplay/tinyWinGraphicsPipe.I mode change 100755 => 100644 panda/src/tinydisplay/tinyWinGraphicsPipe.cxx mode change 100755 => 100644 panda/src/tinydisplay/tinyWinGraphicsPipe.h mode change 100755 => 100644 panda/src/tinydisplay/tinyWinGraphicsWindow.I mode change 100755 => 100644 panda/src/tinydisplay/tinyWinGraphicsWindow.cxx mode change 100755 => 100644 panda/src/tinydisplay/tinyWinGraphicsWindow.h mode change 100755 => 100644 panda/src/tinydisplay/ztriangle_table.h mode change 100755 => 100644 panda/src/wgldisplay/wglGraphicsStateGuardian.I mode change 100755 => 100644 panda/src/wgldisplay/wglGraphicsStateGuardian.cxx mode change 100755 => 100644 panda/src/wgldisplay/wglGraphicsStateGuardian.h mode change 100755 => 100644 pandatool/src/bam/ptsToBam.cxx mode change 100755 => 100644 pandatool/src/bam/ptsToBam.h mode change 100755 => 100644 pandatool/src/converter/eggToSomethingConverter.I mode change 100755 => 100644 pandatool/src/converter/eggToSomethingConverter.cxx mode change 100755 => 100644 pandatool/src/converter/eggToSomethingConverter.h mode change 100755 => 100644 pandatool/src/daeegg/Sources.pp mode change 100755 => 100644 pandatool/src/daeegg/daeMaterials.cxx mode change 100755 => 100644 pandatool/src/daeegg/daeMaterials.h mode change 100755 => 100644 pandatool/src/daeegg/daeToEggConverter.cxx mode change 100755 => 100644 pandatool/src/daeegg/daeToEggConverter.h mode change 100755 => 100644 pandatool/src/daeegg/p3daeegg_composite1.cxx mode change 100755 => 100644 pandatool/src/daeegg/pre_fcollada_include.h mode change 100755 => 100644 pandatool/src/daeprogs/Sources.pp mode change 100755 => 100644 pandatool/src/daeprogs/daeToEgg.cxx mode change 100755 => 100644 pandatool/src/daeprogs/daeToEgg.h mode change 100755 => 100644 pandatool/src/daeprogs/eggToDAE.cxx mode change 100755 => 100644 pandatool/src/daeprogs/eggToDAE.h mode change 100755 => 100644 pandatool/src/eggprogs/eggRename.cxx mode change 100755 => 100644 pandatool/src/eggprogs/eggRename.h mode change 100755 => 100644 pandatool/src/gtk-stats/gtkStatsChartMenu.cxx mode change 100755 => 100644 pandatool/src/gtk-stats/gtkStatsChartMenu.h mode change 100755 => 100644 pandatool/src/gtk-stats/gtkStatsGraph.cxx mode change 100755 => 100644 pandatool/src/gtk-stats/gtkStatsGraph.h mode change 100755 => 100644 pandatool/src/gtk-stats/gtkStatsLabelStack.cxx mode change 100755 => 100644 pandatool/src/gtk-stats/gtkStatsLabelStack.h mode change 100755 => 100644 pandatool/src/gtk-stats/gtkStatsMenuId.h mode change 100755 => 100644 pandatool/src/gtk-stats/gtkStatsMonitor.I mode change 100755 => 100644 pandatool/src/gtk-stats/gtkstats_composite1.cxx mode change 100755 => 100644 pandatool/src/imageprogs/imageInfo.cxx mode change 100755 => 100644 pandatool/src/imageprogs/imageInfo.h mode change 100755 => 100644 pandatool/src/imageprogs/imageResize.I mode change 100755 => 100644 pandatool/src/imageprogs/imageResize.cxx mode change 100755 => 100644 pandatool/src/imageprogs/imageResize.h mode change 100755 => 100644 pandatool/src/maxegg/maxEgg.cxx mode change 100755 => 100644 pandatool/src/maxegg/maxEgg.def mode change 100755 => 100644 pandatool/src/maxegg/maxEgg.h mode change 100755 => 100644 pandatool/src/maxegg/maxEgg.rc mode change 100755 => 100644 pandatool/src/maxegg/maxEggLoader.cxx mode change 100755 => 100644 pandatool/src/maxegg/maxEggLoader.h mode change 100755 => 100644 pandatool/src/maxegg/maxNodeDesc.cxx mode change 100755 => 100644 pandatool/src/maxegg/maxNodeDesc.h mode change 100755 => 100644 pandatool/src/maxegg/maxNodeTree.cxx mode change 100755 => 100644 pandatool/src/maxegg/maxNodeTree.h mode change 100755 => 100644 pandatool/src/maxegg/maxResource.h mode change 100755 => 100644 pandatool/src/maxegg/maxToEggConverter.cxx mode change 100755 => 100644 pandatool/src/maxegg/maxToEggConverter.h mode change 100755 => 100644 pandatool/src/maxegg/p3maxegg_composite1.cxx mode change 100755 => 100644 pandatool/src/maxprogs/maxEggImport.cxx mode change 100755 => 100644 pandatool/src/maxprogs/maxEggImport.def mode change 100755 => 100644 pandatool/src/maxprogs/maxImportRes.h mode change 100755 => 100644 pandatool/src/maxprogs/maxImportRes.rc mode change 100755 => 100644 pandatool/src/maya/mayaShaderColorDef.h mode change 100755 => 100644 pandatool/src/maya/p3maya_composite1.cxx mode change 100755 => 100644 pandatool/src/mayaegg/mayaEggGroupUserData.I mode change 100755 => 100644 pandatool/src/mayaegg/mayaEggGroupUserData.cxx mode change 100755 => 100644 pandatool/src/mayaegg/mayaEggGroupUserData.h mode change 100755 => 100644 pandatool/src/mayaegg/mayaEggLoader.cxx mode change 100755 => 100644 pandatool/src/mayaegg/mayaEggLoader.h mode change 100755 => 100644 pandatool/src/mayaegg/mayaNodeDesc.cxx mode change 100755 => 100644 pandatool/src/mayaegg/mayaNodeDesc.h mode change 100755 => 100644 pandatool/src/mayaegg/mayaNodeTree.cxx mode change 100755 => 100644 pandatool/src/mayaegg/mayaNodeTree.h mode change 100755 => 100644 pandatool/src/mayaegg/p3mayaegg_composite1.cxx mode change 100755 => 100644 pandatool/src/mayaprogs/eggToMaya.cxx mode change 100755 => 100644 pandatool/src/mayaprogs/eggToMaya.h mode change 100755 => 100644 pandatool/src/mayaprogs/mayaEggImport.cxx mode change 100755 => 100644 pandatool/src/mayaprogs/mayaPview.cxx mode change 100755 => 100644 pandatool/src/mayaprogs/mayaPview.h mode change 100755 => 100644 pandatool/src/mayaprogs/mayaToEgg_client.cxx mode change 100755 => 100644 pandatool/src/mayaprogs/mayaToEgg_client.h mode change 100755 => 100644 pandatool/src/mayaprogs/mayaToEgg_server.cxx mode change 100755 => 100644 pandatool/src/mayaprogs/mayaToEgg_server.h mode change 100755 => 100644 pandatool/src/mayaprogs/mayapath.cxx mode change 100755 => 100644 pandatool/src/mayaprogs/normal_test.cxx mode change 100755 => 100644 pandatool/src/objegg/Sources.pp mode change 100755 => 100644 pandatool/src/objegg/config_objegg.cxx mode change 100755 => 100644 pandatool/src/objegg/config_objegg.h mode change 100755 => 100644 pandatool/src/objegg/eggToObjConverter.cxx mode change 100755 => 100644 pandatool/src/objegg/eggToObjConverter.h mode change 100755 => 100644 pandatool/src/objegg/objToEggConverter.I mode change 100755 => 100644 pandatool/src/objegg/objToEggConverter.cxx mode change 100755 => 100644 pandatool/src/objegg/objToEggConverter.h mode change 100755 => 100644 pandatool/src/objprogs/Sources.pp mode change 100755 => 100644 pandatool/src/objprogs/objToEgg.cxx mode change 100755 => 100644 pandatool/src/objprogs/objToEgg.h mode change 100755 => 100644 pandatool/src/pandatoolbase/pathReplace.I mode change 100755 => 100644 pandatool/src/pandatoolbase/pathReplace.cxx mode change 100755 => 100644 pandatool/src/pandatoolbase/pathReplace.h mode change 100755 => 100644 pandatool/src/pandatoolbase/pathStore.cxx mode change 100755 => 100644 pandatool/src/pandatoolbase/pathStore.h mode change 100755 => 100644 pandatool/src/pfmprogs/Sources.pp mode change 100755 => 100644 pandatool/src/pfmprogs/config_pfm.cxx mode change 100755 => 100644 pandatool/src/pfmprogs/config_pfm.h mode change 100755 => 100644 pandatool/src/pfmprogs/pfmBba.cxx mode change 100755 => 100644 pandatool/src/pfmprogs/pfmBba.h mode change 100755 => 100644 pandatool/src/pfmprogs/pfmTrans.cxx mode change 100755 => 100644 pandatool/src/pfmprogs/pfmTrans.h mode change 100755 => 100644 pandatool/src/pstatserver/p3pstatserver_composite1.cxx mode change 100755 => 100644 pandatool/src/softegg/Sources.pp mode change 100755 => 100644 pandatool/src/softegg/config_softegg.cxx mode change 100755 => 100644 pandatool/src/softegg/config_softegg.h mode change 100755 => 100644 pandatool/src/softegg/soft2Egg.c mode change 100755 => 100644 pandatool/src/softegg/softEggGroupUserData.I mode change 100755 => 100644 pandatool/src/softegg/softEggGroupUserData.cxx mode change 100755 => 100644 pandatool/src/softegg/softEggGroupUserData.h mode change 100755 => 100644 pandatool/src/softegg/softNodeDesc.cxx mode change 100755 => 100644 pandatool/src/softegg/softNodeDesc.h mode change 100755 => 100644 pandatool/src/softegg/softNodeTree.cxx mode change 100755 => 100644 pandatool/src/softegg/softNodeTree.h mode change 100755 => 100644 pandatool/src/softegg/softToEggConverter.cxx mode change 100755 => 100644 pandatool/src/softegg/softToEggConverter.h mode change 100755 => 100644 pandatool/src/text-stats/textMonitor.I mode change 100755 => 100644 pandatool/src/win-stats/winStatsChartMenu.cxx mode change 100755 => 100644 pandatool/src/win-stats/winStatsChartMenu.h mode change 100755 => 100644 pandatool/src/win-stats/winStatsLabel.cxx mode change 100755 => 100644 pandatool/src/win-stats/winStatsLabel.h mode change 100755 => 100644 pandatool/src/win-stats/winStatsLabelStack.cxx mode change 100755 => 100644 pandatool/src/win-stats/winStatsLabelStack.h mode change 100755 => 100644 pandatool/src/win-stats/winStatsMenuId.h mode change 100755 => 100644 pandatool/src/win-stats/winStatsMonitor.I mode change 100755 => 100644 pandatool/src/win-stats/winStatsPianoRoll.cxx mode change 100755 => 100644 pandatool/src/win-stats/winStatsPianoRoll.h mode change 100755 => 100644 pandatool/src/xfile/standardTemplates.x mode change 100755 => 100644 pandatool/src/xfile/standardTemplates.x.pz.c diff --git a/contrib/src/ai/Sources.pp b/contrib/src/ai/Sources.pp old mode 100755 new mode 100644 diff --git a/contrib/src/panda3dtoolsgui/build_exe.bat b/contrib/src/panda3dtoolsgui/build_exe.bat old mode 100644 new mode 100755 diff --git a/direct/src/dcparser/dcPackData.I b/direct/src/dcparser/dcPackData.I old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcPackData.cxx b/direct/src/dcparser/dcPackData.cxx old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcPackData.h b/direct/src/dcparser/dcPackData.h old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcPacker.I b/direct/src/dcparser/dcPacker.I old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcPacker.cxx b/direct/src/dcparser/dcPacker.cxx old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcPacker.h b/direct/src/dcparser/dcPacker.h old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcPackerInterface.cxx b/direct/src/dcparser/dcPackerInterface.cxx old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcPackerInterface.h b/direct/src/dcparser/dcPackerInterface.h old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcPython.h b/direct/src/dcparser/dcPython.h old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcSwitchParameter.cxx b/direct/src/dcparser/dcSwitchParameter.cxx old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcSwitchParameter.h b/direct/src/dcparser/dcSwitchParameter.h old mode 100755 new mode 100644 diff --git a/direct/src/dcparser/dcmsgtypes.h b/direct/src/dcparser/dcmsgtypes.h old mode 100755 new mode 100644 diff --git a/direct/src/directbase/ppython.cxx b/direct/src/directbase/ppython.cxx old mode 100755 new mode 100644 diff --git a/direct/src/doc/dcPacker.txt b/direct/src/doc/dcPacker.txt old mode 100755 new mode 100644 diff --git a/direct/src/doc/howto.PythonRedefine b/direct/src/doc/howto.PythonRedefine old mode 100755 new mode 100644 diff --git a/direct/src/http/favicon.ico b/direct/src/http/favicon.ico old mode 100755 new mode 100644 diff --git a/direct/src/p3d/panda3d.pdef b/direct/src/p3d/panda3d.pdef old mode 100755 new mode 100644 diff --git a/direct/src/plugin/fileSpec.I b/direct/src/plugin/fileSpec.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/fileSpec.cxx b/direct/src/plugin/fileSpec.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/fileSpec.h b/direct/src/plugin/fileSpec.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/find_root_dir.cxx b/direct/src/plugin/find_root_dir.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/find_root_dir.h b/direct/src/plugin/find_root_dir.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/get_tinyxml.h b/direct/src/plugin/get_tinyxml.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/get_twirl_data.cxx b/direct/src/plugin/get_twirl_data.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/get_twirl_data.h b/direct/src/plugin/get_twirl_data.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/handleStreamBuf.I b/direct/src/plugin/handleStreamBuf.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/load_plugin.cxx b/direct/src/plugin/load_plugin.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/load_plugin.h b/direct/src/plugin/load_plugin.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/mkdir_complete.cxx b/direct/src/plugin/mkdir_complete.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/mkdir_complete.h b/direct/src/plugin/mkdir_complete.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dCInstance.I b/direct/src/plugin/p3dCInstance.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dCInstance.cxx b/direct/src/plugin/p3dCInstance.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dCInstance.h b/direct/src/plugin/p3dCInstance.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dDownload.I b/direct/src/plugin/p3dDownload.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dDownload.cxx b/direct/src/plugin/p3dDownload.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dDownload.h b/direct/src/plugin/p3dDownload.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dFileDownload.I b/direct/src/plugin/p3dFileDownload.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dFileDownload.cxx b/direct/src/plugin/p3dFileDownload.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dFileDownload.h b/direct/src/plugin/p3dFileDownload.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dPackage.I b/direct/src/plugin/p3dPackage.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dPackage.cxx b/direct/src/plugin/p3dPackage.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dPackage.h b/direct/src/plugin/p3dPackage.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dPythonRun.I b/direct/src/plugin/p3dPythonRun.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dPythonRun.cxx b/direct/src/plugin/p3dPythonRun.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dPythonRun.h b/direct/src/plugin/p3dPythonRun.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dSplashWindow.I b/direct/src/plugin/p3dSplashWindow.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dSplashWindow.cxx b/direct/src/plugin/p3dSplashWindow.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dSplashWindow.h b/direct/src/plugin/p3dSplashWindow.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dWinSplashWindow.I b/direct/src/plugin/p3dWinSplashWindow.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dWinSplashWindow.cxx b/direct/src/plugin/p3dWinSplashWindow.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dWinSplashWindow.h b/direct/src/plugin/p3dWinSplashWindow.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dX11SplashWindow.cxx b/direct/src/plugin/p3dX11SplashWindow.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3dX11SplashWindow.h b/direct/src/plugin/p3dX11SplashWindow.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/p3d_lock.h b/direct/src/plugin/p3d_lock.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/twirl.xcf b/direct/src/plugin/twirl.xcf old mode 100755 new mode 100644 diff --git a/direct/src/plugin/wstring_encode.cxx b/direct/src/plugin/wstring_encode.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/wstring_encode.h b/direct/src/plugin/wstring_encode.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin/xml_helpers.cxx b/direct/src/plugin/xml_helpers.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin/xml_helpers.h b/direct/src/plugin/xml_helpers.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin_activex/P3DActiveX.rc.pp b/direct/src/plugin_activex/P3DActiveX.rc.pp old mode 100755 new mode 100644 diff --git a/direct/src/plugin_activex/Sources.pp b/direct/src/plugin_activex/Sources.pp old mode 100755 new mode 100644 diff --git a/direct/src/plugin_activex/p3dactivex_composite1.cxx b/direct/src/plugin_activex/p3dactivex_composite1.cxx old mode 100755 new mode 100644 diff --git a/direct/src/plugin_standalone/p3dEmbed.h b/direct/src/plugin_standalone/p3dEmbed.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin_standalone/panda3d.I b/direct/src/plugin_standalone/panda3d.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin_standalone/panda3d.h b/direct/src/plugin_standalone/panda3d.h old mode 100755 new mode 100644 diff --git a/direct/src/plugin_standalone/panda3d.ico b/direct/src/plugin_standalone/panda3d.ico old mode 100755 new mode 100644 diff --git a/direct/src/plugin_standalone/panda3dBase.I b/direct/src/plugin_standalone/panda3dBase.I old mode 100755 new mode 100644 diff --git a/direct/src/plugin_standalone/panda3dBase.h b/direct/src/plugin_standalone/panda3dBase.h old mode 100755 new mode 100644 diff --git a/dtool/Config.Cygwin64.pp b/dtool/Config.Cygwin64.pp old mode 100755 new mode 100644 diff --git a/dtool/Config.Win64.pp b/dtool/Config.Win64.pp old mode 100755 new mode 100644 diff --git a/dtool/pptempl/PythonPackageInit.pp b/dtool/pptempl/PythonPackageInit.pp old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolbase/addHash.I b/dtool/src/dtoolbase/addHash.I old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolbase/addHash.cxx b/dtool/src/dtoolbase/addHash.cxx old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolbase/addHash.h b/dtool/src/dtoolbase/addHash.h old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolbase/dtool_platform.h b/dtool/src/dtoolbase/dtool_platform.h old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolbase/lookup3.c b/dtool/src/dtoolbase/lookup3.c old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolbase/lookup3.h b/dtool/src/dtoolbase/lookup3.h old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolbase/memoryBase.cxx b/dtool/src/dtoolbase/memoryBase.cxx old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolutil/preprocess_argv.cxx b/dtool/src/dtoolutil/preprocess_argv.cxx old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolutil/preprocess_argv.h b/dtool/src/dtoolutil/preprocess_argv.h old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolutil/win32ArgParser.cxx b/dtool/src/dtoolutil/win32ArgParser.cxx old mode 100755 new mode 100644 diff --git a/dtool/src/dtoolutil/win32ArgParser.h b/dtool/src/dtoolutil/win32ArgParser.h old mode 100755 new mode 100644 diff --git a/dtool/src/interrogatedb/py_panda.h b/dtool/src/interrogatedb/py_panda.h old mode 100755 new mode 100644 diff --git a/dtool/src/newheader/newheader.cxx b/dtool/src/newheader/newheader.cxx old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/Core.h b/dtool/src/parser-inc/Core.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/DirectX9Renderer.h b/dtool/src/parser-inc/DirectX9Renderer.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/Forest.h b/dtool/src/parser-inc/Forest.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/Max.h b/dtool/src/parser-inc/Max.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/OpenGLRenderer.h b/dtool/src/parser-inc/OpenGLRenderer.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/Python.h b/dtool/src/parser-inc/Python.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/cg.h b/dtool/src/parser-inc/cg.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/cgGL.h b/dtool/src/parser-inc/cgGL.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/collision_trimesh.h b/dtool/src/parser-inc/collision_trimesh.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/ctype.h b/dtool/src/parser-inc/ctype.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/cv.h b/dtool/src/parser-inc/cv.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/cvtypes.h b/dtool/src/parser-inc/cvtypes.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/cxcore.h b/dtool/src/parser-inc/cxcore.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/cxerror.h b/dtool/src/parser-inc/cxerror.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/cxtypes.h b/dtool/src/parser-inc/cxtypes.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/glew.h b/dtool/src/parser-inc/glew.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/highgui.h b/dtool/src/parser-inc/highgui.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/iparamb2.h b/dtool/src/parser-inc/iparamb2.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/iparamm2.h b/dtool/src/parser-inc/iparamm2.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/iskin.h b/dtool/src/parser-inc/iskin.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/istdplug.h b/dtool/src/parser-inc/istdplug.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/ode.h b/dtool/src/parser-inc/ode.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/os_types.h b/dtool/src/parser-inc/os_types.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/phyexp.h b/dtool/src/parser-inc/phyexp.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/rfftw.h b/dtool/src/parser-inc/rfftw.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/setjmp.h b/dtool/src/parser-inc/setjmp.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/socket.h b/dtool/src/parser-inc/socket.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/stdmat.h b/dtool/src/parser-inc/stdmat.h old mode 100755 new mode 100644 diff --git a/dtool/src/parser-inc/x509v3.h b/dtool/src/parser-inc/x509v3.h old mode 100755 new mode 100644 diff --git a/panda/metalibs/pandadx9/Sources.pp b/panda/metalibs/pandadx9/Sources.pp old mode 100755 new mode 100644 diff --git a/panda/metalibs/pandadx9/pandadx9.cxx b/panda/metalibs/pandadx9/pandadx9.cxx old mode 100755 new mode 100644 diff --git a/panda/metalibs/pandadx9/pandadx9.h b/panda/metalibs/pandadx9/pandadx9.h old mode 100755 new mode 100644 diff --git a/panda/metalibs/pandaode/Sources.pp b/panda/metalibs/pandaode/Sources.pp old mode 100755 new mode 100644 diff --git a/panda/metalibs/pandaode/pandaode.cxx b/panda/metalibs/pandaode/pandaode.cxx old mode 100755 new mode 100644 diff --git a/panda/metalibs/pandaode/pandaode.h b/panda/metalibs/pandaode/pandaode.h old mode 100755 new mode 100644 diff --git a/panda/src/android/NativeIStream.java b/panda/src/android/NativeIStream.java old mode 100755 new mode 100644 diff --git a/panda/src/android/PandaActivity.java b/panda/src/android/PandaActivity.java old mode 100755 new mode 100644 diff --git a/panda/src/android/p3android_composite1.cxx b/panda/src/android/p3android_composite1.cxx old mode 100755 new mode 100644 diff --git a/panda/src/android/pview_manifest.xml b/panda/src/android/pview_manifest.xml old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionFloorMesh.I b/panda/src/collide/collisionFloorMesh.I old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionFloorMesh.cxx b/panda/src/collide/collisionFloorMesh.cxx old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionFloorMesh.h b/panda/src/collide/collisionFloorMesh.h old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandler.I b/panda/src/collide/collisionHandler.I old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandlerFluidPusher.I b/panda/src/collide/collisionHandlerFluidPusher.I old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandlerFluidPusher.cxx b/panda/src/collide/collisionHandlerFluidPusher.cxx old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandlerFluidPusher.h b/panda/src/collide/collisionHandlerFluidPusher.h old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandlerGravity.I b/panda/src/collide/collisionHandlerGravity.I old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandlerGravity.cxx b/panda/src/collide/collisionHandlerGravity.cxx old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandlerGravity.h b/panda/src/collide/collisionHandlerGravity.h old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandlerHighestEvent.cxx b/panda/src/collide/collisionHandlerHighestEvent.cxx old mode 100755 new mode 100644 diff --git a/panda/src/collide/collisionHandlerHighestEvent.h b/panda/src/collide/collisionHandlerHighestEvent.h old mode 100755 new mode 100644 diff --git a/panda/src/configfiles/pandaIcon.ico b/panda/src/configfiles/pandaIcon.ico old mode 100755 new mode 100644 diff --git a/panda/src/configfiles/pandaIcon.rc b/panda/src/configfiles/pandaIcon.rc old mode 100755 new mode 100644 diff --git a/panda/src/display/graphicsDevice.I b/panda/src/display/graphicsDevice.I old mode 100755 new mode 100644 diff --git a/panda/src/display/graphicsDevice.cxx b/panda/src/display/graphicsDevice.cxx old mode 100755 new mode 100644 diff --git a/panda/src/display/graphicsDevice.h b/panda/src/display/graphicsDevice.h old mode 100755 new mode 100644 diff --git a/panda/src/distort/oSphereLens.I b/panda/src/distort/oSphereLens.I old mode 100755 new mode 100644 diff --git a/panda/src/distort/oSphereLens.cxx b/panda/src/distort/oSphereLens.cxx old mode 100755 new mode 100644 diff --git a/panda/src/distort/oSphereLens.h b/panda/src/distort/oSphereLens.h old mode 100755 new mode 100644 diff --git a/panda/src/doc/collisionFlags.txt b/panda/src/doc/collisionFlags.txt old mode 100755 new mode 100644 diff --git a/panda/src/doc/howto.control_render_order.txt b/panda/src/doc/howto.control_render_order.txt old mode 100755 new mode 100644 diff --git a/panda/src/doc/howto.multi-texture-in-maya.txt b/panda/src/doc/howto.multi-texture-in-maya.txt old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/Sources.pp b/panda/src/dxgsg9/Sources.pp old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/config_dxgsg9.cxx b/panda/src/dxgsg9/config_dxgsg9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/config_dxgsg9.h b/panda/src/dxgsg9/config_dxgsg9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxGeomMunger9.I b/panda/src/dxgsg9/dxGeomMunger9.I old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxGeomMunger9.cxx b/panda/src/dxgsg9/dxGeomMunger9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxGeomMunger9.h b/panda/src/dxgsg9/dxGeomMunger9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxGraphicsDevice9.cxx b/panda/src/dxgsg9/dxGraphicsDevice9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxGraphicsDevice9.h b/panda/src/dxgsg9/dxGraphicsDevice9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.I b/panda/src/dxgsg9/dxGraphicsStateGuardian9.I old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx b/panda/src/dxgsg9/dxGraphicsStateGuardian9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxGraphicsStateGuardian9.h b/panda/src/dxgsg9/dxGraphicsStateGuardian9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxIndexBufferContext9.I b/panda/src/dxgsg9/dxIndexBufferContext9.I old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxIndexBufferContext9.cxx b/panda/src/dxgsg9/dxIndexBufferContext9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxIndexBufferContext9.h b/panda/src/dxgsg9/dxIndexBufferContext9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxInput9.cxx b/panda/src/dxgsg9/dxInput9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxInput9.h b/panda/src/dxgsg9/dxInput9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxOcclusionQueryContext9.I b/panda/src/dxgsg9/dxOcclusionQueryContext9.I old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxOcclusionQueryContext9.cxx b/panda/src/dxgsg9/dxOcclusionQueryContext9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxOcclusionQueryContext9.h b/panda/src/dxgsg9/dxOcclusionQueryContext9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxTextureContext9.I b/panda/src/dxgsg9/dxTextureContext9.I old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxTextureContext9.cxx b/panda/src/dxgsg9/dxTextureContext9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxTextureContext9.h b/panda/src/dxgsg9/dxTextureContext9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxVertexBufferContext9.I b/panda/src/dxgsg9/dxVertexBufferContext9.I old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxVertexBufferContext9.cxx b/panda/src/dxgsg9/dxVertexBufferContext9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxVertexBufferContext9.h b/panda/src/dxgsg9/dxVertexBufferContext9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/dxgsg9base.h b/panda/src/dxgsg9/dxgsg9base.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/p3dxgsg9_composite1.cxx b/panda/src/dxgsg9/p3dxgsg9_composite1.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.I b/panda/src/dxgsg9/wdxGraphicsPipe9.I old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.cxx b/panda/src/dxgsg9/wdxGraphicsPipe9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/wdxGraphicsPipe9.h b/panda/src/dxgsg9/wdxGraphicsPipe9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.I b/panda/src/dxgsg9/wdxGraphicsWindow9.I old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.cxx b/panda/src/dxgsg9/wdxGraphicsWindow9.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxgsg9/wdxGraphicsWindow9.h b/panda/src/dxgsg9/wdxGraphicsWindow9.h old mode 100755 new mode 100644 diff --git a/panda/src/dxml/config_dxml.cxx b/panda/src/dxml/config_dxml.cxx old mode 100755 new mode 100644 diff --git a/panda/src/dxml/config_dxml.h b/panda/src/dxml/config_dxml.h old mode 100755 new mode 100644 diff --git a/panda/src/egg/eggPatch.I b/panda/src/egg/eggPatch.I old mode 100755 new mode 100644 diff --git a/panda/src/egg/eggPatch.cxx b/panda/src/egg/eggPatch.cxx old mode 100755 new mode 100644 diff --git a/panda/src/egg/eggPatch.h b/panda/src/egg/eggPatch.h old mode 100755 new mode 100644 diff --git a/panda/src/egg/eggVertexUV.I b/panda/src/egg/eggVertexUV.I old mode 100755 new mode 100644 diff --git a/panda/src/egg/eggVertexUV.cxx b/panda/src/egg/eggVertexUV.cxx old mode 100755 new mode 100644 diff --git a/panda/src/egg/eggVertexUV.h b/panda/src/egg/eggVertexUV.h old mode 100755 new mode 100644 diff --git a/panda/src/egg2pg/eggSaver.I b/panda/src/egg2pg/eggSaver.I old mode 100755 new mode 100644 diff --git a/panda/src/egg2pg/eggSaver.cxx b/panda/src/egg2pg/eggSaver.cxx old mode 100755 new mode 100644 diff --git a/panda/src/egg2pg/eggSaver.h b/panda/src/egg2pg/eggSaver.h old mode 100755 new mode 100644 diff --git a/panda/src/egg2pg/save_egg_file.cxx b/panda/src/egg2pg/save_egg_file.cxx old mode 100755 new mode 100644 diff --git a/panda/src/egg2pg/save_egg_file.h b/panda/src/egg2pg/save_egg_file.h old mode 100755 new mode 100644 diff --git a/panda/src/event/eventHandler.I b/panda/src/event/eventHandler.I old mode 100755 new mode 100644 diff --git a/panda/src/express/copy_stream.cxx b/panda/src/express/copy_stream.cxx old mode 100755 new mode 100644 diff --git a/panda/src/express/copy_stream.h b/panda/src/express/copy_stream.h old mode 100755 new mode 100644 diff --git a/panda/src/express/windowsRegistry.cxx b/panda/src/express/windowsRegistry.cxx old mode 100755 new mode 100644 diff --git a/panda/src/express/windowsRegistry.h b/panda/src/express/windowsRegistry.h old mode 100755 new mode 100644 diff --git a/panda/src/framework/rock_floor.rgb_src.c b/panda/src/framework/rock_floor.rgb_src.c old mode 100755 new mode 100644 diff --git a/panda/src/framework/shuttle_controls.bam_src.c b/panda/src/framework/shuttle_controls.bam_src.c old mode 100755 new mode 100644 diff --git a/panda/src/glstuff/glCgShaderContext_src.I b/panda/src/glstuff/glCgShaderContext_src.I old mode 100755 new mode 100644 diff --git a/panda/src/glstuff/glCgShaderContext_src.cxx b/panda/src/glstuff/glCgShaderContext_src.cxx old mode 100755 new mode 100644 diff --git a/panda/src/glstuff/glCgShaderContext_src.h b/panda/src/glstuff/glCgShaderContext_src.h old mode 100755 new mode 100644 diff --git a/panda/src/glstuff/glShaderContext_src.I b/panda/src/glstuff/glShaderContext_src.I old mode 100755 new mode 100644 diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx old mode 100755 new mode 100644 diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h old mode 100755 new mode 100644 diff --git a/panda/src/gobj/bufferContextChain.cxx b/panda/src/gobj/bufferContextChain.cxx old mode 100755 new mode 100644 diff --git a/panda/src/gobj/bufferContextChain.h b/panda/src/gobj/bufferContextChain.h old mode 100755 new mode 100644 diff --git a/panda/src/gobj/geomPatches.cxx b/panda/src/gobj/geomPatches.cxx old mode 100755 new mode 100644 diff --git a/panda/src/gobj/geomPatches.h b/panda/src/gobj/geomPatches.h old mode 100755 new mode 100644 diff --git a/panda/src/gobj/shader.I b/panda/src/gobj/shader.I old mode 100755 new mode 100644 diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx old mode 100755 new mode 100644 diff --git a/panda/src/gobj/shader.h b/panda/src/gobj/shader.h old mode 100755 new mode 100644 diff --git a/panda/src/gobj/shaderContext.I b/panda/src/gobj/shaderContext.I old mode 100755 new mode 100644 diff --git a/panda/src/gobj/shaderContext.cxx b/panda/src/gobj/shaderContext.cxx old mode 100755 new mode 100644 diff --git a/panda/src/gobj/shaderContext.h b/panda/src/gobj/shaderContext.h old mode 100755 new mode 100644 diff --git a/panda/src/gobj/textureStage.I b/panda/src/gobj/textureStage.I old mode 100755 new mode 100644 diff --git a/panda/src/gobj/textureStage.cxx b/panda/src/gobj/textureStage.cxx old mode 100755 new mode 100644 diff --git a/panda/src/linmath/mathNumbers.I b/panda/src/linmath/mathNumbers.I old mode 100755 new mode 100644 diff --git a/panda/src/mathutil/pta_LMatrix3_ext.h b/panda/src/mathutil/pta_LMatrix3_ext.h old mode 100755 new mode 100644 diff --git a/panda/src/mathutil/pta_LMatrix4_ext.h b/panda/src/mathutil/pta_LMatrix4_ext.h old mode 100755 new mode 100644 diff --git a/panda/src/mathutil/pta_LVecBase2_ext.h b/panda/src/mathutil/pta_LVecBase2_ext.h old mode 100755 new mode 100644 diff --git a/panda/src/mathutil/pta_LVecBase3_ext.h b/panda/src/mathutil/pta_LVecBase3_ext.h old mode 100755 new mode 100644 diff --git a/panda/src/mathutil/pta_LVecBase4_ext.h b/panda/src/mathutil/pta_LVecBase4_ext.h old mode 100755 new mode 100644 diff --git a/panda/src/mathutil/triangulator3.I b/panda/src/mathutil/triangulator3.I old mode 100755 new mode 100644 diff --git a/panda/src/mathutil/triangulator3.cxx b/panda/src/mathutil/triangulator3.cxx old mode 100755 new mode 100644 diff --git a/panda/src/mathutil/triangulator3.h b/panda/src/mathutil/triangulator3.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/buffered_datagramconnection.h b/panda/src/nativenet/buffered_datagramconnection.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/buffered_datagramreader.h b/panda/src/nativenet/buffered_datagramreader.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/buffered_datagramreader.i b/panda/src/nativenet/buffered_datagramreader.i old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/buffered_datagramwriter.h b/panda/src/nativenet/buffered_datagramwriter.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/membuffer.h b/panda/src/nativenet/membuffer.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/membuffer.i b/panda/src/nativenet/membuffer.i old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/p3nativenet_composite1.cxx b/panda/src/nativenet/p3nativenet_composite1.cxx old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/ringbuffer.h b/panda/src/nativenet/ringbuffer.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/ringbuffer.i b/panda/src/nativenet/ringbuffer.i old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_address.I b/panda/src/nativenet/socket_address.I old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_address.h b/panda/src/nativenet/socket_address.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_base.h b/panda/src/nativenet/socket_base.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_fdset.h b/panda/src/nativenet/socket_fdset.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_ip.h b/panda/src/nativenet/socket_ip.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_portable.h b/panda/src/nativenet/socket_portable.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_selector.h b/panda/src/nativenet/socket_selector.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_tcp.h b/panda/src/nativenet/socket_tcp.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_tcp_listen.h b/panda/src/nativenet/socket_tcp_listen.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_tcp_ssl.h b/panda/src/nativenet/socket_tcp_ssl.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_udp_incoming.h b/panda/src/nativenet/socket_udp_incoming.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/socket_udp_outgoing.h b/panda/src/nativenet/socket_udp_outgoing.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/time_accumulator.h b/panda/src/nativenet/time_accumulator.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/time_base.h b/panda/src/nativenet/time_base.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/time_clock.h b/panda/src/nativenet/time_clock.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/time_general.h b/panda/src/nativenet/time_general.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/time_out.h b/panda/src/nativenet/time_out.h old mode 100755 new mode 100644 diff --git a/panda/src/nativenet/time_span.h b/panda/src/nativenet/time_span.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/Sources.pp b/panda/src/ode/Sources.pp old mode 100755 new mode 100644 diff --git a/panda/src/ode/config_ode.N b/panda/src/ode/config_ode.N old mode 100755 new mode 100644 diff --git a/panda/src/ode/config_ode.cxx b/panda/src/ode/config_ode.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/config_ode.h b/panda/src/ode/config_ode.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeAMotorJoint.I b/panda/src/ode/odeAMotorJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeBallJoint.I b/panda/src/ode/odeBallJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeBallJoint.cxx b/panda/src/ode/odeBallJoint.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeBody.I b/panda/src/ode/odeBody.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeBody.cxx b/panda/src/ode/odeBody.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeBody.h b/panda/src/ode/odeBody.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeBoxGeom.I b/panda/src/ode/odeBoxGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeCappedCylinderGeom.I b/panda/src/ode/odeCappedCylinderGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeCappedCylinderGeom.cxx b/panda/src/ode/odeCappedCylinderGeom.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeCappedCylinderGeom.h b/panda/src/ode/odeCappedCylinderGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeContact.I b/panda/src/ode/odeContact.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeContact.cxx b/panda/src/ode/odeContact.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeContact.h b/panda/src/ode/odeContact.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeContactGeom.I b/panda/src/ode/odeContactGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeContactGeom.cxx b/panda/src/ode/odeContactGeom.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeContactGeom.h b/panda/src/ode/odeContactGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeContactJoint.I b/panda/src/ode/odeContactJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeContactJoint.cxx b/panda/src/ode/odeContactJoint.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeConvexGeom.I b/panda/src/ode/odeConvexGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeConvexGeom.h b/panda/src/ode/odeConvexGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeCylinderGeom.I b/panda/src/ode/odeCylinderGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeCylinderGeom.h b/panda/src/ode/odeCylinderGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeFixedJoint.I b/panda/src/ode/odeFixedJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeGeom.I b/panda/src/ode/odeGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeGeom.cxx b/panda/src/ode/odeGeom.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeGeom.h b/panda/src/ode/odeGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeHashSpace.I b/panda/src/ode/odeHashSpace.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeHashSpace.cxx b/panda/src/ode/odeHashSpace.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeHashSpace.h b/panda/src/ode/odeHashSpace.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeHinge2Joint.I b/panda/src/ode/odeHinge2Joint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeHingeJoint.I b/panda/src/ode/odeHingeJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeHingeJoint.h b/panda/src/ode/odeHingeJoint.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeJoint.I b/panda/src/ode/odeJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeJoint.cxx b/panda/src/ode/odeJoint.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeJoint.h b/panda/src/ode/odeJoint.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeJointCollection.cxx b/panda/src/ode/odeJointCollection.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeJointCollection.h b/panda/src/ode/odeJointCollection.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeJointGroup.I b/panda/src/ode/odeJointGroup.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeJointGroup.cxx b/panda/src/ode/odeJointGroup.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeJointGroup.h b/panda/src/ode/odeJointGroup.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeLMotorJoint.I b/panda/src/ode/odeLMotorJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeLMotorJoint.h b/panda/src/ode/odeLMotorJoint.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeMass.I b/panda/src/ode/odeMass.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeMass.cxx b/panda/src/ode/odeMass.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeMass.h b/panda/src/ode/odeMass.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeNullJoint.I b/panda/src/ode/odeNullJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeNullJoint.h b/panda/src/ode/odeNullJoint.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odePlane2dJoint.I b/panda/src/ode/odePlane2dJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odePlane2dJoint.h b/panda/src/ode/odePlane2dJoint.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odePlaneGeom.I b/panda/src/ode/odePlaneGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odePlaneGeom.h b/panda/src/ode/odePlaneGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeQuadTreeSpace.I b/panda/src/ode/odeQuadTreeSpace.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeQuadTreeSpace.cxx b/panda/src/ode/odeQuadTreeSpace.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeQuadTreeSpace.h b/panda/src/ode/odeQuadTreeSpace.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeRayGeom.I b/panda/src/ode/odeRayGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeRayGeom.h b/panda/src/ode/odeRayGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSimpleSpace.I b/panda/src/ode/odeSimpleSpace.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSimpleSpace.cxx b/panda/src/ode/odeSimpleSpace.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSimpleSpace.h b/panda/src/ode/odeSimpleSpace.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSliderJoint.I b/panda/src/ode/odeSliderJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSliderJoint.h b/panda/src/ode/odeSliderJoint.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSpace.I b/panda/src/ode/odeSpace.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSpace.cxx b/panda/src/ode/odeSpace.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSpace.h b/panda/src/ode/odeSpace.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSphereGeom.I b/panda/src/ode/odeSphereGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSphereGeom.cxx b/panda/src/ode/odeSphereGeom.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSphereGeom.h b/panda/src/ode/odeSphereGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSurfaceParameters.I b/panda/src/ode/odeSurfaceParameters.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSurfaceParameters.cxx b/panda/src/ode/odeSurfaceParameters.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeSurfaceParameters.h b/panda/src/ode/odeSurfaceParameters.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeTriMeshData.I b/panda/src/ode/odeTriMeshData.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeTriMeshData.cxx b/panda/src/ode/odeTriMeshData.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeTriMeshData.h b/panda/src/ode/odeTriMeshData.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeTriMeshGeom.I b/panda/src/ode/odeTriMeshGeom.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeTriMeshGeom.cxx b/panda/src/ode/odeTriMeshGeom.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeTriMeshGeom.h b/panda/src/ode/odeTriMeshGeom.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeUniversalJoint.I b/panda/src/ode/odeUniversalJoint.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeUtil.cxx b/panda/src/ode/odeUtil.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeUtil.h b/panda/src/ode/odeUtil.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeWorld.I b/panda/src/ode/odeWorld.I old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeWorld.cxx b/panda/src/ode/odeWorld.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/odeWorld.h b/panda/src/ode/odeWorld.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/ode_includes.h b/panda/src/ode/ode_includes.h old mode 100755 new mode 100644 diff --git a/panda/src/ode/p3ode_composite1.cxx b/panda/src/ode/p3ode_composite1.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/p3ode_composite2.cxx b/panda/src/ode/p3ode_composite2.cxx old mode 100755 new mode 100644 diff --git a/panda/src/ode/p3ode_composite3.cxx b/panda/src/ode/p3ode_composite3.cxx old mode 100755 new mode 100644 diff --git a/panda/src/parametrics/nurbsCurve.I b/panda/src/parametrics/nurbsCurve.I old mode 100755 new mode 100644 diff --git a/panda/src/particlesystem/arcEmitter.cxx b/panda/src/particlesystem/arcEmitter.cxx old mode 100755 new mode 100644 diff --git a/panda/src/particlesystem/arcEmitter.h b/panda/src/particlesystem/arcEmitter.h old mode 100755 new mode 100644 diff --git a/panda/src/particlesystem/colorInterpolationManager.I b/panda/src/particlesystem/colorInterpolationManager.I old mode 100755 new mode 100644 diff --git a/panda/src/particlesystem/colorInterpolationManager.cxx b/panda/src/particlesystem/colorInterpolationManager.cxx old mode 100755 new mode 100644 diff --git a/panda/src/particlesystem/colorInterpolationManager.h b/panda/src/particlesystem/colorInterpolationManager.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/audioVolumeAttrib.I b/panda/src/pgraph/audioVolumeAttrib.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/audioVolumeAttrib.cxx b/panda/src/pgraph/audioVolumeAttrib.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/audioVolumeAttrib.h b/panda/src/pgraph/audioVolumeAttrib.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/modelSaveRequest.I b/panda/src/pgraph/modelSaveRequest.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/modelSaveRequest.cxx b/panda/src/pgraph/modelSaveRequest.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/modelSaveRequest.h b/panda/src/pgraph/modelSaveRequest.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/occluderEffect.I b/panda/src/pgraph/occluderEffect.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/occluderEffect.cxx b/panda/src/pgraph/occluderEffect.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/occluderEffect.h b/panda/src/pgraph/occluderEffect.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/polylightEffect.I b/panda/src/pgraph/polylightEffect.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/polylightEffect.cxx b/panda/src/pgraph/polylightEffect.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/polylightEffect.h b/panda/src/pgraph/polylightEffect.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/polylightNode.I b/panda/src/pgraph/polylightNode.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/polylightNode.cxx b/panda/src/pgraph/polylightNode.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/polylightNode.h b/panda/src/pgraph/polylightNode.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/portalClipper.I b/panda/src/pgraph/portalClipper.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/portalClipper.cxx b/panda/src/pgraph/portalClipper.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/portalClipper.h b/panda/src/pgraph/portalClipper.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/portalNode.I b/panda/src/pgraph/portalNode.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/portalNode.cxx b/panda/src/pgraph/portalNode.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/portalNode.h b/panda/src/pgraph/portalNode.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/shaderAttrib.I b/panda/src/pgraph/shaderAttrib.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/shaderAttrib.cxx b/panda/src/pgraph/shaderAttrib.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/shaderAttrib.h b/panda/src/pgraph/shaderAttrib.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/texGenAttrib.I b/panda/src/pgraph/texGenAttrib.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/texGenAttrib.cxx b/panda/src/pgraph/texGenAttrib.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraph/texGenAttrib.h b/panda/src/pgraph/texGenAttrib.h old mode 100755 new mode 100644 diff --git a/panda/src/pgraphnodes/fadeLodNode.I b/panda/src/pgraphnodes/fadeLodNode.I old mode 100755 new mode 100644 diff --git a/panda/src/pgraphnodes/fadeLodNode.cxx b/panda/src/pgraphnodes/fadeLodNode.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgraphnodes/fadeLodNode.h b/panda/src/pgraphnodes/fadeLodNode.h old mode 100755 new mode 100644 diff --git a/panda/src/pgui/pgSliderBar.I b/panda/src/pgui/pgSliderBar.I old mode 100755 new mode 100644 diff --git a/panda/src/pgui/pgSliderBar.cxx b/panda/src/pgui/pgSliderBar.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pgui/pgSliderBar.h b/panda/src/pgui/pgSliderBar.h old mode 100755 new mode 100644 diff --git a/panda/src/physics/linearControlForce.I b/panda/src/physics/linearControlForce.I old mode 100755 new mode 100644 diff --git a/panda/src/physics/linearControlForce.cxx b/panda/src/physics/linearControlForce.cxx old mode 100755 new mode 100644 diff --git a/panda/src/physics/linearControlForce.h b/panda/src/physics/linearControlForce.h old mode 100755 new mode 100644 diff --git a/panda/src/physics/physicsCollisionHandler.I b/panda/src/physics/physicsCollisionHandler.I old mode 100755 new mode 100644 diff --git a/panda/src/physics/physicsCollisionHandler.cxx b/panda/src/physics/physicsCollisionHandler.cxx old mode 100755 new mode 100644 diff --git a/panda/src/physics/physicsCollisionHandler.h b/panda/src/physics/physicsCollisionHandler.h old mode 100755 new mode 100644 diff --git a/panda/src/physics/physicsObjectCollection.I b/panda/src/physics/physicsObjectCollection.I old mode 100755 new mode 100644 diff --git a/panda/src/physics/physicsObjectCollection.cxx b/panda/src/physics/physicsObjectCollection.cxx old mode 100755 new mode 100644 diff --git a/panda/src/physics/physicsObjectCollection.h b/panda/src/physics/physicsObjectCollection.h old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/conditionVarDebug.I b/panda/src/pipeline/conditionVarDebug.I old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/conditionVarDebug.cxx b/panda/src/pipeline/conditionVarDebug.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/conditionVarDirect.I b/panda/src/pipeline/conditionVarDirect.I old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/conditionVarDirect.cxx b/panda/src/pipeline/conditionVarDirect.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/contextSwitch_longjmp_src.c b/panda/src/pipeline/contextSwitch_longjmp_src.c old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/contextSwitch_ucontext_src.c b/panda/src/pipeline/contextSwitch_ucontext_src.c old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/contextSwitch_windows_src.c b/panda/src/pipeline/contextSwitch_windows_src.c old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/mutexDebug.I b/panda/src/pipeline/mutexDebug.I old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/mutexDebug.cxx b/panda/src/pipeline/mutexDebug.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/mutexDirect.I b/panda/src/pipeline/mutexDirect.I old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/mutexDirect.cxx b/panda/src/pipeline/mutexDirect.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/reMutexDirect.I b/panda/src/pipeline/reMutexDirect.I old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/reMutexDirect.cxx b/panda/src/pipeline/reMutexDirect.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/test_atomic.cxx b/panda/src/pipeline/test_atomic.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pipeline/test_concurrency.cxx b/panda/src/pipeline/test_concurrency.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx b/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pnmimagetypes/pnmFileTypePNG.cxx b/panda/src/pnmimagetypes/pnmFileTypePNG.cxx old mode 100755 new mode 100644 diff --git a/panda/src/pnmimagetypes/pnmFileTypePNG.h b/panda/src/pnmimagetypes/pnmFileTypePNG.h old mode 100755 new mode 100644 diff --git a/panda/src/pstatclient/pStatCollector.cxx b/panda/src/pstatclient/pStatCollector.cxx old mode 100755 new mode 100644 diff --git a/panda/src/putil/bitArray.I b/panda/src/putil/bitArray.I old mode 100755 new mode 100644 diff --git a/panda/src/putil/bitArray.cxx b/panda/src/putil/bitArray.cxx old mode 100755 new mode 100644 diff --git a/panda/src/putil/bitArray.h b/panda/src/putil/bitArray.h old mode 100755 new mode 100644 diff --git a/panda/src/putil/portalMask.h b/panda/src/putil/portalMask.h old mode 100755 new mode 100644 diff --git a/panda/src/speedtree/loaderFileTypeStf.cxx b/panda/src/speedtree/loaderFileTypeStf.cxx old mode 100755 new mode 100644 diff --git a/panda/src/speedtree/loaderFileTypeStf.h b/panda/src/speedtree/loaderFileTypeStf.h old mode 100755 new mode 100644 diff --git a/panda/src/text/persans.ttf_src.c b/panda/src/text/persans.ttf_src.c old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/p3tinydisplay_composite1.cxx b/panda/src/tinydisplay/p3tinydisplay_composite1.cxx old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/p3tinydisplay_composite2.cxx b/panda/src/tinydisplay/p3tinydisplay_composite2.cxx old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/tinyWinGraphicsPipe.I b/panda/src/tinydisplay/tinyWinGraphicsPipe.I old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx b/panda/src/tinydisplay/tinyWinGraphicsPipe.cxx old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/tinyWinGraphicsPipe.h b/panda/src/tinydisplay/tinyWinGraphicsPipe.h old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/tinyWinGraphicsWindow.I b/panda/src/tinydisplay/tinyWinGraphicsWindow.I old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/tinyWinGraphicsWindow.cxx b/panda/src/tinydisplay/tinyWinGraphicsWindow.cxx old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/tinyWinGraphicsWindow.h b/panda/src/tinydisplay/tinyWinGraphicsWindow.h old mode 100755 new mode 100644 diff --git a/panda/src/tinydisplay/ztriangle.py b/panda/src/tinydisplay/ztriangle.py index 90f11e39aa..ca19a09474 100755 --- a/panda/src/tinydisplay/ztriangle.py +++ b/panda/src/tinydisplay/ztriangle.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python """ This simple Python script can be run to generate ztriangle_code_*.h, ztriangle_table.*, and ztriangle_*.cxx, which are a poor man's form of generated code to cover the explosion of diff --git a/panda/src/tinydisplay/ztriangle_table.h b/panda/src/tinydisplay/ztriangle_table.h old mode 100755 new mode 100644 diff --git a/panda/src/wgldisplay/wglGraphicsStateGuardian.I b/panda/src/wgldisplay/wglGraphicsStateGuardian.I old mode 100755 new mode 100644 diff --git a/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx b/panda/src/wgldisplay/wglGraphicsStateGuardian.cxx old mode 100755 new mode 100644 diff --git a/panda/src/wgldisplay/wglGraphicsStateGuardian.h b/panda/src/wgldisplay/wglGraphicsStateGuardian.h old mode 100755 new mode 100644 diff --git a/pandatool/src/bam/ptsToBam.cxx b/pandatool/src/bam/ptsToBam.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/bam/ptsToBam.h b/pandatool/src/bam/ptsToBam.h old mode 100755 new mode 100644 diff --git a/pandatool/src/converter/eggToSomethingConverter.I b/pandatool/src/converter/eggToSomethingConverter.I old mode 100755 new mode 100644 diff --git a/pandatool/src/converter/eggToSomethingConverter.cxx b/pandatool/src/converter/eggToSomethingConverter.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/converter/eggToSomethingConverter.h b/pandatool/src/converter/eggToSomethingConverter.h old mode 100755 new mode 100644 diff --git a/pandatool/src/daeegg/Sources.pp b/pandatool/src/daeegg/Sources.pp old mode 100755 new mode 100644 diff --git a/pandatool/src/daeegg/daeMaterials.cxx b/pandatool/src/daeegg/daeMaterials.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/daeegg/daeMaterials.h b/pandatool/src/daeegg/daeMaterials.h old mode 100755 new mode 100644 diff --git a/pandatool/src/daeegg/daeToEggConverter.cxx b/pandatool/src/daeegg/daeToEggConverter.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/daeegg/daeToEggConverter.h b/pandatool/src/daeegg/daeToEggConverter.h old mode 100755 new mode 100644 diff --git a/pandatool/src/daeegg/p3daeegg_composite1.cxx b/pandatool/src/daeegg/p3daeegg_composite1.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/daeegg/pre_fcollada_include.h b/pandatool/src/daeegg/pre_fcollada_include.h old mode 100755 new mode 100644 diff --git a/pandatool/src/daeprogs/Sources.pp b/pandatool/src/daeprogs/Sources.pp old mode 100755 new mode 100644 diff --git a/pandatool/src/daeprogs/daeToEgg.cxx b/pandatool/src/daeprogs/daeToEgg.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/daeprogs/daeToEgg.h b/pandatool/src/daeprogs/daeToEgg.h old mode 100755 new mode 100644 diff --git a/pandatool/src/daeprogs/eggToDAE.cxx b/pandatool/src/daeprogs/eggToDAE.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/daeprogs/eggToDAE.h b/pandatool/src/daeprogs/eggToDAE.h old mode 100755 new mode 100644 diff --git a/pandatool/src/eggprogs/eggRename.cxx b/pandatool/src/eggprogs/eggRename.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/eggprogs/eggRename.h b/pandatool/src/eggprogs/eggRename.h old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkStatsChartMenu.cxx b/pandatool/src/gtk-stats/gtkStatsChartMenu.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkStatsChartMenu.h b/pandatool/src/gtk-stats/gtkStatsChartMenu.h old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkStatsGraph.cxx b/pandatool/src/gtk-stats/gtkStatsGraph.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkStatsGraph.h b/pandatool/src/gtk-stats/gtkStatsGraph.h old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkStatsLabelStack.cxx b/pandatool/src/gtk-stats/gtkStatsLabelStack.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkStatsLabelStack.h b/pandatool/src/gtk-stats/gtkStatsLabelStack.h old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkStatsMenuId.h b/pandatool/src/gtk-stats/gtkStatsMenuId.h old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkStatsMonitor.I b/pandatool/src/gtk-stats/gtkStatsMonitor.I old mode 100755 new mode 100644 diff --git a/pandatool/src/gtk-stats/gtkstats_composite1.cxx b/pandatool/src/gtk-stats/gtkstats_composite1.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/imageprogs/imageInfo.cxx b/pandatool/src/imageprogs/imageInfo.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/imageprogs/imageInfo.h b/pandatool/src/imageprogs/imageInfo.h old mode 100755 new mode 100644 diff --git a/pandatool/src/imageprogs/imageResize.I b/pandatool/src/imageprogs/imageResize.I old mode 100755 new mode 100644 diff --git a/pandatool/src/imageprogs/imageResize.cxx b/pandatool/src/imageprogs/imageResize.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/imageprogs/imageResize.h b/pandatool/src/imageprogs/imageResize.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxEgg.cxx b/pandatool/src/maxegg/maxEgg.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxEgg.def b/pandatool/src/maxegg/maxEgg.def old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxEgg.h b/pandatool/src/maxegg/maxEgg.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxEgg.rc b/pandatool/src/maxegg/maxEgg.rc old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxEggLoader.cxx b/pandatool/src/maxegg/maxEggLoader.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxEggLoader.h b/pandatool/src/maxegg/maxEggLoader.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxNodeDesc.cxx b/pandatool/src/maxegg/maxNodeDesc.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxNodeDesc.h b/pandatool/src/maxegg/maxNodeDesc.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxNodeTree.cxx b/pandatool/src/maxegg/maxNodeTree.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxNodeTree.h b/pandatool/src/maxegg/maxNodeTree.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxResource.h b/pandatool/src/maxegg/maxResource.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxToEggConverter.cxx b/pandatool/src/maxegg/maxToEggConverter.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/maxToEggConverter.h b/pandatool/src/maxegg/maxToEggConverter.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maxegg/p3maxegg_composite1.cxx b/pandatool/src/maxegg/p3maxegg_composite1.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/maxprogs/maxEggImport.cxx b/pandatool/src/maxprogs/maxEggImport.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/maxprogs/maxEggImport.def b/pandatool/src/maxprogs/maxEggImport.def old mode 100755 new mode 100644 diff --git a/pandatool/src/maxprogs/maxImportRes.h b/pandatool/src/maxprogs/maxImportRes.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maxprogs/maxImportRes.rc b/pandatool/src/maxprogs/maxImportRes.rc old mode 100755 new mode 100644 diff --git a/pandatool/src/maya/mayaShaderColorDef.h b/pandatool/src/maya/mayaShaderColorDef.h old mode 100755 new mode 100644 diff --git a/pandatool/src/maya/p3maya_composite1.cxx b/pandatool/src/maya/p3maya_composite1.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaEggGroupUserData.I b/pandatool/src/mayaegg/mayaEggGroupUserData.I old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaEggGroupUserData.cxx b/pandatool/src/mayaegg/mayaEggGroupUserData.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaEggGroupUserData.h b/pandatool/src/mayaegg/mayaEggGroupUserData.h old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaEggLoader.cxx b/pandatool/src/mayaegg/mayaEggLoader.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaEggLoader.h b/pandatool/src/mayaegg/mayaEggLoader.h old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaNodeDesc.cxx b/pandatool/src/mayaegg/mayaNodeDesc.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaNodeDesc.h b/pandatool/src/mayaegg/mayaNodeDesc.h old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaNodeTree.cxx b/pandatool/src/mayaegg/mayaNodeTree.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/mayaNodeTree.h b/pandatool/src/mayaegg/mayaNodeTree.h old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaegg/p3mayaegg_composite1.cxx b/pandatool/src/mayaegg/p3mayaegg_composite1.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/eggToMaya.cxx b/pandatool/src/mayaprogs/eggToMaya.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/eggToMaya.h b/pandatool/src/mayaprogs/eggToMaya.h old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/mayaEggImport.cxx b/pandatool/src/mayaprogs/mayaEggImport.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/mayaPview.cxx b/pandatool/src/mayaprogs/mayaPview.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/mayaPview.h b/pandatool/src/mayaprogs/mayaPview.h old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/mayaToEgg_client.cxx b/pandatool/src/mayaprogs/mayaToEgg_client.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/mayaToEgg_client.h b/pandatool/src/mayaprogs/mayaToEgg_client.h old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/mayaToEgg_server.cxx b/pandatool/src/mayaprogs/mayaToEgg_server.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/mayaToEgg_server.h b/pandatool/src/mayaprogs/mayaToEgg_server.h old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/mayapath.cxx b/pandatool/src/mayaprogs/mayapath.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/mayaprogs/normal_test.cxx b/pandatool/src/mayaprogs/normal_test.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/objegg/Sources.pp b/pandatool/src/objegg/Sources.pp old mode 100755 new mode 100644 diff --git a/pandatool/src/objegg/config_objegg.cxx b/pandatool/src/objegg/config_objegg.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/objegg/config_objegg.h b/pandatool/src/objegg/config_objegg.h old mode 100755 new mode 100644 diff --git a/pandatool/src/objegg/eggToObjConverter.cxx b/pandatool/src/objegg/eggToObjConverter.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/objegg/eggToObjConverter.h b/pandatool/src/objegg/eggToObjConverter.h old mode 100755 new mode 100644 diff --git a/pandatool/src/objegg/objToEggConverter.I b/pandatool/src/objegg/objToEggConverter.I old mode 100755 new mode 100644 diff --git a/pandatool/src/objegg/objToEggConverter.cxx b/pandatool/src/objegg/objToEggConverter.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/objegg/objToEggConverter.h b/pandatool/src/objegg/objToEggConverter.h old mode 100755 new mode 100644 diff --git a/pandatool/src/objprogs/Sources.pp b/pandatool/src/objprogs/Sources.pp old mode 100755 new mode 100644 diff --git a/pandatool/src/objprogs/objToEgg.cxx b/pandatool/src/objprogs/objToEgg.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/objprogs/objToEgg.h b/pandatool/src/objprogs/objToEgg.h old mode 100755 new mode 100644 diff --git a/pandatool/src/pandatoolbase/pathReplace.I b/pandatool/src/pandatoolbase/pathReplace.I old mode 100755 new mode 100644 diff --git a/pandatool/src/pandatoolbase/pathReplace.cxx b/pandatool/src/pandatoolbase/pathReplace.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/pandatoolbase/pathReplace.h b/pandatool/src/pandatoolbase/pathReplace.h old mode 100755 new mode 100644 diff --git a/pandatool/src/pandatoolbase/pathStore.cxx b/pandatool/src/pandatoolbase/pathStore.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/pandatoolbase/pathStore.h b/pandatool/src/pandatoolbase/pathStore.h old mode 100755 new mode 100644 diff --git a/pandatool/src/pfmprogs/Sources.pp b/pandatool/src/pfmprogs/Sources.pp old mode 100755 new mode 100644 diff --git a/pandatool/src/pfmprogs/config_pfm.cxx b/pandatool/src/pfmprogs/config_pfm.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/pfmprogs/config_pfm.h b/pandatool/src/pfmprogs/config_pfm.h old mode 100755 new mode 100644 diff --git a/pandatool/src/pfmprogs/pfmBba.cxx b/pandatool/src/pfmprogs/pfmBba.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/pfmprogs/pfmBba.h b/pandatool/src/pfmprogs/pfmBba.h old mode 100755 new mode 100644 diff --git a/pandatool/src/pfmprogs/pfmTrans.cxx b/pandatool/src/pfmprogs/pfmTrans.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/pfmprogs/pfmTrans.h b/pandatool/src/pfmprogs/pfmTrans.h old mode 100755 new mode 100644 diff --git a/pandatool/src/pstatserver/p3pstatserver_composite1.cxx b/pandatool/src/pstatserver/p3pstatserver_composite1.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/Sources.pp b/pandatool/src/softegg/Sources.pp old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/config_softegg.cxx b/pandatool/src/softegg/config_softegg.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/config_softegg.h b/pandatool/src/softegg/config_softegg.h old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/soft2Egg.c b/pandatool/src/softegg/soft2Egg.c old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softEggGroupUserData.I b/pandatool/src/softegg/softEggGroupUserData.I old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softEggGroupUserData.cxx b/pandatool/src/softegg/softEggGroupUserData.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softEggGroupUserData.h b/pandatool/src/softegg/softEggGroupUserData.h old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softNodeDesc.cxx b/pandatool/src/softegg/softNodeDesc.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softNodeDesc.h b/pandatool/src/softegg/softNodeDesc.h old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softNodeTree.cxx b/pandatool/src/softegg/softNodeTree.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softNodeTree.h b/pandatool/src/softegg/softNodeTree.h old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softToEggConverter.cxx b/pandatool/src/softegg/softToEggConverter.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/softegg/softToEggConverter.h b/pandatool/src/softegg/softToEggConverter.h old mode 100755 new mode 100644 diff --git a/pandatool/src/text-stats/textMonitor.I b/pandatool/src/text-stats/textMonitor.I old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsChartMenu.cxx b/pandatool/src/win-stats/winStatsChartMenu.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsChartMenu.h b/pandatool/src/win-stats/winStatsChartMenu.h old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsLabel.cxx b/pandatool/src/win-stats/winStatsLabel.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsLabel.h b/pandatool/src/win-stats/winStatsLabel.h old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsLabelStack.cxx b/pandatool/src/win-stats/winStatsLabelStack.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsLabelStack.h b/pandatool/src/win-stats/winStatsLabelStack.h old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsMenuId.h b/pandatool/src/win-stats/winStatsMenuId.h old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsMonitor.I b/pandatool/src/win-stats/winStatsMonitor.I old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsPianoRoll.cxx b/pandatool/src/win-stats/winStatsPianoRoll.cxx old mode 100755 new mode 100644 diff --git a/pandatool/src/win-stats/winStatsPianoRoll.h b/pandatool/src/win-stats/winStatsPianoRoll.h old mode 100755 new mode 100644 diff --git a/pandatool/src/xfile/standardTemplates.x b/pandatool/src/xfile/standardTemplates.x old mode 100755 new mode 100644 diff --git a/pandatool/src/xfile/standardTemplates.x.pz.c b/pandatool/src/xfile/standardTemplates.x.pz.c old mode 100755 new mode 100644 From 947149c56a5f8e0acf9f18faad92b91a36f48bef Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 5 Apr 2015 22:50:38 +0200 Subject: [PATCH 41/73] Fix reading from URLs mounted to the virtual file system --- panda/src/express/virtualFileSystem.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/express/virtualFileSystem.cxx b/panda/src/express/virtualFileSystem.cxx index c21706e335..49c5b72ef6 100644 --- a/panda/src/express/virtualFileSystem.cxx +++ b/panda/src/express/virtualFileSystem.cxx @@ -565,7 +565,7 @@ make_directory_full(const Filename &filename) { //////////////////////////////////////////////////////////////////// PT(VirtualFile) VirtualFileSystem:: get_file(const Filename &filename, bool status_only) const { - int open_flags = status_only ? 0 : OF_status_only; + int open_flags = status_only ? OF_status_only : 0; ((VirtualFileSystem *)this)->_lock.acquire(); PT(VirtualFile) result = do_get_file(filename, open_flags); ((VirtualFileSystem *)this)->_lock.release(); From 3d2d1d9c23b3434b6583bbe1f68e64e9ab7dc7a8 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 6 Apr 2015 12:48:30 +0200 Subject: [PATCH 42/73] Exclude a few system DLLs to make rtdist work on WinXP --- direct/src/p3d/Packager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/direct/src/p3d/Packager.py b/direct/src/p3d/Packager.py index a25f1df0ae..9614e96d59 100644 --- a/direct/src/p3d/Packager.py +++ b/direct/src/p3d/Packager.py @@ -2400,7 +2400,8 @@ class Packager: 'shell32.dll', 'ntdll.dll', 'ws2help.dll', 'rpcrt4.dll', 'imm32.dll', 'ddraw.dll', 'shlwapi.dll', 'secur32.dll', 'dciman32.dll', 'comdlg32.dll', 'comctl32.dll', 'ole32.dll', - 'oleaut32.dll', 'gdiplus.dll', 'winmm.dll', + 'oleaut32.dll', 'gdiplus.dll', 'winmm.dll', 'iphlpapi.dll', + 'msvcrt.dll', 'kernelbase.dll', 'msimg32.dll', 'msacm32.dll', 'libsystem.b.dylib', 'libmathcommon.a.dylib', 'libmx.a.dylib', 'libstdc++.6.dylib', 'libobjc.a.dylib', 'libauto.dylib', @@ -2410,6 +2411,7 @@ class Packager: # filenames. self.excludeSystemGlobs = [ GlobPattern('d3dx9_*.dll'), + GlobPattern('api-ms-win-*.dll'), GlobPattern('libGL.so*'), GlobPattern('libGLU.so*'), From adb02a8f4509cb6c57924cbbaec24760999559b8 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 6 Apr 2015 13:24:45 +0200 Subject: [PATCH 43/73] Compile out things irrelevant for target build, like ShaderGenerator when !HAVE_CG --- panda/src/display/graphicsEngine.cxx | 2 ++ panda/src/display/standardMunger.cxx | 2 ++ panda/src/pgraphnodes/shaderGenerator.cxx | 5 ++++ panda/src/pgraphnodes/shaderGenerator.h | 30 ++++++++++++++++++++++- panda/src/pnmimage/convert_srgb.cxx | 8 ------ panda/src/pnmimage/convert_srgb.h | 6 +++++ panda/src/pnmimage/convert_srgb_sse2.cxx | 9 ++++--- panda/src/putil/bitMask.I | 6 ++--- panda/src/putil/bitMask.h | 2 +- panda/src/putil/config_util.cxx | 6 ++--- 10 files changed, 55 insertions(+), 21 deletions(-) diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 22b2b876f8..2cac310b0c 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -2001,9 +2001,11 @@ setup_scene(GraphicsStateGuardian *gsg, DisplayRegionPipelineReader *dr) { // to use. We have to do this here because the ShaderGenerator // needs a host window pointer. Hopefully we'll be able to // eliminate that requirement in the future. +#ifdef HAVE_CG if (gsg->get_shader_generator() == NULL) { gsg->set_shader_generator(new ShaderGenerator(gsg, window)); } +#endif return scene_setup; } diff --git a/panda/src/display/standardMunger.cxx b/panda/src/display/standardMunger.cxx index 922150a114..45fcc7feb1 100644 --- a/panda/src/display/standardMunger.cxx +++ b/panda/src/display/standardMunger.cxx @@ -365,6 +365,7 @@ munge_state_impl(const RenderState *state) { munged_state = munged_state->remove_attrib(ColorScaleAttrib::get_class_slot()); } +#ifdef HAVE_CG if (_auto_shader) { CPT(RenderState) shader_state = munged_state->get_auto_shader_state(); ShaderGenerator *shader_generator = get_gsg()->get_shader_generator(); @@ -379,6 +380,7 @@ munge_state_impl(const RenderState *state) { } munged_state = munged_state->set_attrib(shader_state->_generated_shader); } +#endif return munged_state; } diff --git a/panda/src/pgraphnodes/shaderGenerator.cxx b/panda/src/pgraphnodes/shaderGenerator.cxx index 9e76063177..da3232692e 100644 --- a/panda/src/pgraphnodes/shaderGenerator.cxx +++ b/panda/src/pgraphnodes/shaderGenerator.cxx @@ -17,6 +17,7 @@ //////////////////////////////////////////////////////////////////// #include "shaderGenerator.h" + #include "renderState.h" #include "shaderAttrib.h" #include "auxBitplaneAttrib.h" @@ -44,6 +45,8 @@ TypeHandle ShaderGenerator::_type_handle; +#ifdef HAVE_CG + //////////////////////////////////////////////////////////////////// // Function: ShaderGenerator::Constructor // Access: Published @@ -1636,3 +1639,5 @@ texture_type_as_string(Texture::TextureType ttype) { return "2D"; } } + +#endif // HAVE_CG diff --git a/panda/src/pgraphnodes/shaderGenerator.h b/panda/src/pgraphnodes/shaderGenerator.h index 9a4aa05857..1e1daa581d 100644 --- a/panda/src/pgraphnodes/shaderGenerator.h +++ b/panda/src/pgraphnodes/shaderGenerator.h @@ -17,6 +17,10 @@ #define SHADERGENERATOR_H #include "pandabase.h" +#include "typedReferenceCount.h" + +#ifdef HAVE_CG + #include "graphicsStateGuardianBase.h" #include "graphicsOutputBase.h" #include "nodePath.h" @@ -169,10 +173,34 @@ public: } virtual TypeHandle force_init_type() {init_type(); return get_class_type();} - private: +private: + static TypeHandle _type_handle; +}; + +#else + +// If we don't have Cg, let's replace this with a stub. +class EXPCL_PANDA_PGRAPHNODES ShaderGenerator : public TypedReferenceCount { +public: + static TypeHandle get_class_type() { + return _type_handle; + } + static void init_type() { + TypedObject::init_type(); + register_type(_type_handle, "ShaderGenerator", + TypedObject::get_class_type()); + } + virtual TypeHandle get_type() const { + return get_class_type(); + } + virtual TypeHandle force_init_type() {init_type(); return get_class_type();} + +private: static TypeHandle _type_handle; }; #include "shaderGenerator.I" +#endif // HAVE_CG + #endif // SHADERGENERATOR_H diff --git a/panda/src/pnmimage/convert_srgb.cxx b/panda/src/pnmimage/convert_srgb.cxx index ac46aa50f4..426e9818c5 100644 --- a/panda/src/pnmimage/convert_srgb.cxx +++ b/panda/src/pnmimage/convert_srgb.cxx @@ -162,12 +162,4 @@ has_sse2_sRGB_encode() { return has_support; } -#else -// Other architectures don't support SSE2 at all. - -bool -has_sse2_sRGB_encode() { - return false; -} - #endif // __SSE2__ diff --git a/panda/src/pnmimage/convert_srgb.h b/panda/src/pnmimage/convert_srgb.h index a28c126402..c27d3dcbf4 100644 --- a/panda/src/pnmimage/convert_srgb.h +++ b/panda/src/pnmimage/convert_srgb.h @@ -45,6 +45,7 @@ EXPCL_PANDA_PNMIMAGE INLINE void encode_sRGB_uchar(const LColorf &from, // Use these functions if you know that SSE2 support is available. // Otherwise, they will crash! +#if defined(__SSE2__) || defined(__i386__) || defined(_M_IX86) || defined(_M_X64) || defined(_M_AMD64) EXPCL_PANDA_PNMIMAGE unsigned char encode_sRGB_uchar_sse2(float val); EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar_sse2(const LColorf &from, xel &into); @@ -53,6 +54,11 @@ EXPCL_PANDA_PNMIMAGE void encode_sRGB_uchar_sse2(const LColorf &from, // Use the following to find out if you can call either of the above. EXPCL_PANDA_PNMIMAGE bool has_sse2_sRGB_encode(); +#else +// The target architecture can't support the SSE2 extension at all. +#define encode_sRGB_uchar_sse2 encode_sRGB_uchar +#define has_sse2_sRGB_encode() (false) +#endif #include "convert_srgb.I" diff --git a/panda/src/pnmimage/convert_srgb_sse2.cxx b/panda/src/pnmimage/convert_srgb_sse2.cxx index 8121eccc8d..6de58d9584 100644 --- a/panda/src/pnmimage/convert_srgb_sse2.cxx +++ b/panda/src/pnmimage/convert_srgb_sse2.cxx @@ -127,10 +127,11 @@ encode_sRGB_uchar_sse2(const LColorf &color, xel &into, xelval &into_alpha) { into_alpha = _mm_extract_epi16(vals, 6); } -#else -// Somehow we're still compiling this without SSE2 support. We'll -// still have to define these functions, but emit a warning that the -// build system isn't configured properly. +#elif defined(__i386__) || defined(_M_IX86) +// Somehow we're still compiling this without SSE2 support, even though the +// target architecture could (in theory) support SSE2. We still have to +// define these functions, but emit a warning that the build system isn't +// configured properly. #warning convert_srgb_sse2.cxx is being compiled without SSE2 support! unsigned char diff --git a/panda/src/putil/bitMask.I b/panda/src/putil/bitMask.I index 19a603e7e8..5f4321e213 100644 --- a/panda/src/putil/bitMask.I +++ b/panda/src/putil/bitMask.I @@ -862,10 +862,8 @@ generate_hash(ChecksumHashGenerator &hashgen) const { //////////////////////////////////////////////////////////////////// template void BitMask:: -init_type() { - ostringstream str; - str << "BitMask" << num_bits; - register_type(_type_handle, str.str()); +init_type(const string &name) { + register_type(_type_handle, name); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/putil/bitMask.h b/panda/src/putil/bitMask.h index 64fcdedff0..05b9f7ddae 100644 --- a/panda/src/putil/bitMask.h +++ b/panda/src/putil/bitMask.h @@ -144,7 +144,7 @@ public: static TypeHandle get_class_type() { return _type_handle; } - static void init_type(); + static void init_type(const string &name); private: static TypeHandle _type_handle; diff --git a/panda/src/putil/config_util.cxx b/panda/src/putil/config_util.cxx index ea690e423b..44ac7bd6a4 100644 --- a/panda/src/putil/config_util.cxx +++ b/panda/src/putil/config_util.cxx @@ -181,9 +181,9 @@ init_libputil() { BamReaderAuxData::init_type(); BamReaderParam::init_type(); BitArray::init_type(); - BitMask16::init_type(); - BitMask32::init_type(); - BitMask64::init_type(); + BitMask16::init_type("BitMask16"); + BitMask32::init_type("BitMask32"); + BitMask64::init_type("BitMask64"); ButtonHandle::init_type(); ButtonMap::init_type(); CPointerCallbackObject::init_type(); From 8a9e30afa8ca5020c10d9bdb17063ddcd506d816 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 6 Apr 2015 15:05:47 +0200 Subject: [PATCH 44/73] Revert accidental disabling of strip step on Linux in opt4 builds --- makepanda/makepanda.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index e8e8af96cc..487d964d8f 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -1652,8 +1652,7 @@ def CompileLink(dll, obj, opts): oscmd('%s --strip-unneeded %s' % (GetStrip(), BracketNameWithQuotes(new_path))) elif (GetOptimizeOption(opts)==4 and GetTarget() == 'linux'): - #oscmd(GetStrip() + " --strip-unneeded " + BracketNameWithQuotes(dll)) - pass + oscmd(GetStrip() + " --strip-unneeded " + BracketNameWithQuotes(dll)) os.system("chmod +x " + BracketNameWithQuotes(dll)) From 0c3fd953fc1a81f5307da018e9abae17dda30eda Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 6 Apr 2015 15:11:55 +0200 Subject: [PATCH 45/73] oops, revert accidental checkin of debug message --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 5471dfeb87..637bfb63e9 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -6928,8 +6928,8 @@ query_gl_version() { string_to_int(components[1], _gl_version_minor); } - if (GLCAT.is_info()) { - GLCAT.info() + if (GLCAT.is_debug()) { + GLCAT.debug() << "GL_VERSION = " << version << ", decoded to " << _gl_version_major << "." << _gl_version_minor << "\n"; @@ -6952,7 +6952,6 @@ query_gl_version() { if (verstr == NULL || sscanf(verstr, "%d.%d", &_gl_shadlang_ver_major, &_gl_shadlang_ver_minor) != 2) { GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; } - cerr << verstr << " -> " << _gl_shadlang_ver_major << " . " << _gl_shadlang_ver_minor << "\n"; } #elif defined(OPENGLES_2) _gl_shadlang_ver_major = 1; @@ -6961,7 +6960,6 @@ query_gl_version() { if (verstr == NULL || sscanf(verstr, "OpenGL ES GLSL %d.%d", &_gl_shadlang_ver_major, &_gl_shadlang_ver_minor) != 2) { GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; } - cerr << verstr << " -> " << _gl_shadlang_ver_major << " . " << _gl_shadlang_ver_minor << "\n"; #endif } } From 8e76328b3b6ce3e53065be1cd3b69a2c02ac20d7 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 9 Apr 2015 13:08:17 +0200 Subject: [PATCH 46/73] Fix Bullet support (Broken float division in default args in interrogate) --- dtool/src/cppparser/cppExpression.cxx | 18 +++++++++++++----- dtool/src/cppparser/cppInstance.cxx | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/dtool/src/cppparser/cppExpression.cxx b/dtool/src/cppparser/cppExpression.cxx index 2b344c36ef..25bb2140f7 100644 --- a/dtool/src/cppparser/cppExpression.cxx +++ b/dtool/src/cppparser/cppExpression.cxx @@ -26,6 +26,7 @@ #include "cppFunctionGroup.h" #include "cppFunctionType.h" #include "cppBison.h" +#include "pdtoa.h" #include @@ -1079,7 +1080,13 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { break; case T_real: - out << _u._real; + { + // We use our own dtoa implementation here because it guarantees + // to never format the number as an integer. + char buffer[32]; + pdtoa(_u._real, buffer); + out << buffer; + } break; case T_string: @@ -1155,14 +1162,15 @@ output(ostream &out, int indent_level, CPPScope *scope, bool) const { break; case T_construct: - out << "(" << _u._typecast._to->get_typedef_name(scope) - << "("; + _u._typecast._to->output(out, indent_level, scope, false); + out << "("; _u._typecast._op1->output(out, indent_level, scope, false); - out << "))"; + out << ")"; break; case T_default_construct: - out << "(" << _u._typecast._to->get_typedef_name(scope) << "())"; + _u._typecast._to->output(out, indent_level, scope, false); + out << "()"; break; case T_new: diff --git a/dtool/src/cppparser/cppInstance.cxx b/dtool/src/cppparser/cppInstance.cxx index aaaff2eb24..94b0924460 100644 --- a/dtool/src/cppparser/cppInstance.cxx +++ b/dtool/src/cppparser/cppInstance.cxx @@ -558,7 +558,7 @@ output(ostream &out, int indent_level, CPPScope *scope, bool complete, out << " = 0"; } if (_initializer != NULL) { - out << " = (" << *_initializer << ")"; + out << " = " << *_initializer; } } From 500da290138a58950fc8984ffaf709d8d0f7fcd5 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 9 Apr 2015 13:15:25 +0200 Subject: [PATCH 47/73] Fix obscure error caused by bug in _getDtoolSuperBase --- direct/src/showbase/PythonUtil.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/direct/src/showbase/PythonUtil.py b/direct/src/showbase/PythonUtil.py index 189b90ea81..7f335e7a94 100644 --- a/direct/src/showbase/PythonUtil.py +++ b/direct/src/showbase/PythonUtil.py @@ -1429,11 +1429,12 @@ dtoolSuperBase = None def _getDtoolSuperBase(): global dtoolSuperBase - from panda3d.core import PandaNode - dtoolSuperBase = PandaNode('').__class__.__bases__[0].__bases__[0].__bases__[0] + from panda3d.core import TypedObject + dtoolSuperBase = TypedObject.__bases__[0] assert repr(dtoolSuperBase) == "" \ or repr(dtoolSuperBase) == "" \ - or repr(dtoolSuperBase) == "" + or repr(dtoolSuperBase) == "" \ + or repr(dtoolSuperBase) == "" safeReprNotify = None From 3b17e8fff1087790c2c65f6f8d56d6be4ce9511e Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 14 Apr 2015 15:43:22 +0200 Subject: [PATCH 48/73] Fix issue tracking memory allocations of more than 2GB at a time on 64-bit systems --- dtool/src/dtoolbase/atomicAdjustGccImpl.h | 2 +- dtool/src/dtoolbase/pallocator.T | 4 ++-- dtool/src/dtoolbase/typeHandle.cxx | 4 ++-- dtool/src/dtoolbase/typeHandle.h | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/dtool/src/dtoolbase/atomicAdjustGccImpl.h b/dtool/src/dtoolbase/atomicAdjustGccImpl.h index 2059addbbe..ec3050f14c 100644 --- a/dtool/src/dtoolbase/atomicAdjustGccImpl.h +++ b/dtool/src/dtoolbase/atomicAdjustGccImpl.h @@ -26,7 +26,7 @@ //////////////////////////////////////////////////////////////////// class EXPCL_DTOOL AtomicAdjustGccImpl { public: -#if __GCC_ATOMIC_LONG_LOCK_FREE > __GCC_ATOMIC_INT_LOCK_FREE +#if __GCC_ATOMIC_LONG_LOCK_FREE >= __GCC_ATOMIC_INT_LOCK_FREE // If the long can be more lock-free than int, use it instead. typedef __attribute__ ((aligned (__SIZEOF_LONG__))) long Integer; #else diff --git a/dtool/src/dtoolbase/pallocator.T b/dtool/src/dtoolbase/pallocator.T index bb09b2633d..0a3c8a460a 100644 --- a/dtool/src/dtoolbase/pallocator.T +++ b/dtool/src/dtoolbase/pallocator.T @@ -51,7 +51,7 @@ allocate(TYPENAME pallocator_array::size_type n, TYPENAME allocator: size_t alloc_size = n * sizeof(Type); // We also need to store the total number of bytes we allocated. alloc_size += header_reserved_bytes; - _type_handle.inc_memory_usage(TypeHandle::MC_array, (int)alloc_size); + _type_handle.inc_memory_usage(TypeHandle::MC_array, alloc_size); void *ptr = (TYPENAME pallocator_array::pointer)PANDA_MALLOC_ARRAY(alloc_size); *((size_t *)ptr) = alloc_size; return (TYPENAME pallocator_array::pointer)(((char *)ptr) + header_reserved_bytes); @@ -69,7 +69,7 @@ deallocate(TYPENAME pallocator_array::pointer p, TYPENAME pallocator_array const size_t header_reserved_bytes = MemoryHook::get_header_reserved_bytes(); void *ptr = (void *)((char *)p - header_reserved_bytes); size_t alloc_size = *((size_t *)ptr); - _type_handle.dec_memory_usage(TypeHandle::MC_array, (int)alloc_size); + _type_handle.dec_memory_usage(TypeHandle::MC_array, alloc_size); PANDA_FREE_ARRAY(ptr); #else free(p); diff --git a/dtool/src/dtoolbase/typeHandle.cxx b/dtool/src/dtoolbase/typeHandle.cxx index b1d50fffaa..cca55062c1 100644 --- a/dtool/src/dtoolbase/typeHandle.cxx +++ b/dtool/src/dtoolbase/typeHandle.cxx @@ -49,7 +49,7 @@ get_memory_usage(MemoryClass memory_class) const { // allocated memory for objects of this type. //////////////////////////////////////////////////////////////////// void TypeHandle:: -inc_memory_usage(MemoryClass memory_class, int size) { +inc_memory_usage(MemoryClass memory_class, size_t size) { assert((int)memory_class >= 0 && (int)memory_class < (int)MC_limit); if ((*this) != TypeHandle::none()) { TypeRegistryNode *rnode = TypeRegistry::ptr()->look_up(*this, NULL); @@ -72,7 +72,7 @@ inc_memory_usage(MemoryClass memory_class, int size) { // the total allocated memory for objects of this type. //////////////////////////////////////////////////////////////////// void TypeHandle:: -dec_memory_usage(MemoryClass memory_class, int size) { +dec_memory_usage(MemoryClass memory_class, size_t size) { assert((int)memory_class >= 0 && (int)memory_class < (int)MC_limit); if ((*this) != TypeHandle::none()) { TypeRegistryNode *rnode = TypeRegistry::ptr()->look_up(*this, NULL); diff --git a/dtool/src/dtoolbase/typeHandle.h b/dtool/src/dtoolbase/typeHandle.h index b060689c01..9573cb2ffb 100644 --- a/dtool/src/dtoolbase/typeHandle.h +++ b/dtool/src/dtoolbase/typeHandle.h @@ -125,12 +125,12 @@ PUBLISHED: #ifdef DO_MEMORY_USAGE int get_memory_usage(MemoryClass memory_class) const; - void inc_memory_usage(MemoryClass memory_class, int size); - void dec_memory_usage(MemoryClass memory_class, int size); + void inc_memory_usage(MemoryClass memory_class, size_t size); + void dec_memory_usage(MemoryClass memory_class, size_t size); #else static CONSTEXPR int get_memory_usage(MemoryClass) { return 0; } - INLINE void inc_memory_usage(MemoryClass, int) { } - INLINE void dec_memory_usage(MemoryClass, int) { } + INLINE void inc_memory_usage(MemoryClass, size_t) { } + INLINE void dec_memory_usage(MemoryClass, size_t) { } #endif // DO_MEMORY_USAGE INLINE int get_index() const; From 8360ad442a9a544ffeeb68b89936d3471e60e044 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 14 Apr 2015 15:46:52 +0200 Subject: [PATCH 49/73] Work around gcc compiler shortcoming --- panda/src/pnmimage/convert_srgb.I | 6 +++--- panda/src/pnmimage/convert_srgb.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/panda/src/pnmimage/convert_srgb.I b/panda/src/pnmimage/convert_srgb.I index e841748fb4..28ac8aad23 100644 --- a/panda/src/pnmimage/convert_srgb.I +++ b/panda/src/pnmimage/convert_srgb.I @@ -18,7 +18,7 @@ // Description: Decodes the sRGB-encoded unsigned char value to // a linearized float in the range 0-1. //////////////////////////////////////////////////////////////////// -CONSTEXPR float decode_sRGB_float(unsigned char val) { +INLINE float decode_sRGB_float(unsigned char val) { return to_linear_float_table[val]; } @@ -40,7 +40,7 @@ INLINE float decode_sRGB_float(float val) { // Description: Decodes the sRGB-encoded unsigned char value to // a linearized unsigned char value. //////////////////////////////////////////////////////////////////// -CONSTEXPR unsigned char decode_sRGB_uchar(unsigned char val) { +INLINE unsigned char decode_sRGB_uchar(unsigned char val) { return to_linear_uchar_table[val]; } @@ -88,7 +88,7 @@ encode_sRGB_float(float val) { // Description: Encodes the linearized unsigned char value to an // sRGB-encoded unsigned char value. //////////////////////////////////////////////////////////////////// -CONSTEXPR unsigned char +INLINE unsigned char encode_sRGB_uchar(unsigned char val) { return to_srgb8_table[val]; } diff --git a/panda/src/pnmimage/convert_srgb.h b/panda/src/pnmimage/convert_srgb.h index a28c126402..d2dc064373 100644 --- a/panda/src/pnmimage/convert_srgb.h +++ b/panda/src/pnmimage/convert_srgb.h @@ -26,14 +26,14 @@ extern EXPCL_PANDA_PNMIMAGE ALIGN_64BYTE const unsigned char to_srgb8_table[256] extern EXPCL_PANDA_PNMIMAGE ALIGN_64BYTE const unsigned char to_linear_uchar_table[256]; extern EXPCL_PANDA_PNMIMAGE ALIGN_64BYTE const float to_linear_float_table[256]; -EXPCL_PANDA_PNMIMAGE CONSTEXPR float decode_sRGB_float(unsigned char val); +EXPCL_PANDA_PNMIMAGE INLINE float decode_sRGB_float(unsigned char val); EXPCL_PANDA_PNMIMAGE INLINE float decode_sRGB_float(float val); -EXPCL_PANDA_PNMIMAGE CONSTEXPR unsigned char decode_sRGB_uchar(unsigned char val); +EXPCL_PANDA_PNMIMAGE INLINE unsigned char decode_sRGB_uchar(unsigned char val); EXPCL_PANDA_PNMIMAGE INLINE unsigned char decode_sRGB_uchar(float val); EXPCL_PANDA_PNMIMAGE INLINE float encode_sRGB_float(unsigned char val); EXPCL_PANDA_PNMIMAGE INLINE float encode_sRGB_float(float val); -EXPCL_PANDA_PNMIMAGE CONSTEXPR unsigned char encode_sRGB_uchar(unsigned char val); +EXPCL_PANDA_PNMIMAGE INLINE unsigned char encode_sRGB_uchar(unsigned char val); EXPCL_PANDA_PNMIMAGE INLINE unsigned char encode_sRGB_uchar(float val); // These functions convert more than one component in one go, From d430e611bb4d60f3ca7e22ae95aa88cee8a7f9a6 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 14 Apr 2015 15:47:35 +0200 Subject: [PATCH 50/73] size_t params of methods in template classes did not support 64-bit values on 64-bit systems --- dtool/src/cppparser/cppTypedefType.cxx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dtool/src/cppparser/cppTypedefType.cxx b/dtool/src/cppparser/cppTypedefType.cxx index b1c86d9da2..ceedd35f33 100644 --- a/dtool/src/cppparser/cppTypedefType.cxx +++ b/dtool/src/cppparser/cppTypedefType.cxx @@ -204,6 +204,19 @@ CPPDeclaration *CPPTypedefType:: substitute_decl(CPPDeclaration::SubstDecl &subst, CPPScope *current_scope, CPPScope *global_scope) { + if (_ident != NULL && _ident->get_scope(current_scope, global_scope) == global_scope) { + // Hack... I know that size_t etc is supposed to work fine, so + // preserve these top-level typedefs. + CPPDeclaration *top = + CPPType::substitute_decl(subst, current_scope, global_scope); + if (top != this) { + return top; + } + top = new CPPTypedefType(*this); + subst.insert(SubstDecl::value_type(this, top)); + return top; + } + return _type->substitute_decl(subst, current_scope, global_scope); // Bah, this doesn't seem to work, and I can't figure out why. From 0343c4f1863679f94f480d922ba7a1350d69c3e0 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 14 Apr 2015 15:48:48 +0200 Subject: [PATCH 51/73] GLSL robustness and issue fixes: * Int params were not being implicitly converted to float properly * p3d_TextureN now accepts other sampler types * More error checking for parameter types * p3d_ColorScale et al also allows vec3 instead of vec4 now --- panda/src/glstuff/glShaderContext_src.cxx | 314 +++++++++++++++------- panda/src/glstuff/glShaderContext_src.h | 2 + 2 files changed, 224 insertions(+), 92 deletions(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index eb31a08127..3c031dc904 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -316,10 +316,14 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext bind._part[1] = Shader::SMO_view_to_model; } - if (transpose) { - bind._piece = Shader::SMP_upper3x3; + if (param_type != GL_FLOAT_MAT3) { + GLCAT.error() << "p3d_NormalMatrix input should be mat3, not mat4!\n"; } else { - bind._piece = Shader::SMP_transpose3x3; + if (transpose) { + bind._piece = Shader::SMP_upper3x3; + } else { + bind._piece = Shader::SMP_transpose3x3; + } } } else if (matrix_name == "ModelMatrix") { @@ -357,13 +361,26 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext continue; } if (size > 7 && noprefix.substr(0, 7) == "Texture") { - _glgsg->_glUniform1i(p, s->_tex_spec.size()); Shader::ShaderTexSpec bind; bind._id = arg_id; bind._name = 0; - bind._desired_type = Texture::TT_2d_texture; - bind._stage = atoi(noprefix.substr(7).c_str()); - s->_tex_spec.push_back(bind); + + string tail; + bind._stage = string_to_int(noprefix.substr(7), tail); + if (!tail.empty()) { + GLCAT.error() + << "Error parsing shader input name: unexpected '" + << tail << "' in '" << param_name << "'\n"; + continue; + } + + if (get_sampler_texture_type(bind._desired_type, param_type)) { + _glgsg->_glUniform1i(p, s->_tex_spec.size()); + s->_tex_spec.push_back(bind); + } else { + GLCAT.error() + << "Could not bind texture input " << param_name << "\n"; + } continue; } if (size > 9 && noprefix.substr(0, 9) == "Material.") { @@ -378,22 +395,46 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext bind._dep[1] = Shader::SSD_NONE; if (noprefix == "Material.ambient") { + if (param_type != GL_FLOAT_VEC4) { + GLCAT.error() + << "p3d_Material.ambient should be vec4\n"; + } bind._piece = Shader::SMP_row0; s->_mat_spec.push_back(bind); continue; + } else if (noprefix == "Material.diffuse") { + if (param_type != GL_FLOAT_VEC4) { + GLCAT.error() + << "p3d_Material.diffuse should be vec4\n"; + } bind._piece = Shader::SMP_row1; s->_mat_spec.push_back(bind); continue; + } else if (noprefix == "Material.emission") { + if (param_type != GL_FLOAT_VEC4) { + GLCAT.error() + << "p3d_Material.emission should be vec4\n"; + } bind._piece = Shader::SMP_row2; s->_mat_spec.push_back(bind); continue; + } else if (noprefix == "Material.specular") { + if (param_type != GL_FLOAT_VEC3) { + GLCAT.error() + << "p3d_Material.specular should be vec3\n"; + } bind._piece = Shader::SMP_row3x3; s->_mat_spec.push_back(bind); continue; + } else if (noprefix == "Material.shininess") { + if (param_type != GL_FLOAT) { + GLCAT.error() + << "p3d_Material.shininess should be float\n"; + } bind._piece = Shader::SMP_cell15; s->_mat_spec.push_back(bind); continue; @@ -402,7 +443,6 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext if (noprefix == "ColorScale") { Shader::ShaderMatSpec bind; bind._id = arg_id; - bind._piece = Shader::SMP_row3; bind._func = Shader::SMF_first; bind._part[0] = Shader::SMO_attr_colorscale; bind._arg[0] = NULL; @@ -410,13 +450,22 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext bind._part[1] = Shader::SMO_identity; bind._arg[1] = NULL; bind._dep[1] = Shader::SSD_NONE; + + if (param_type == GL_FLOAT_VEC3) { + bind._piece = Shader::SMP_row3x3; + } else if (param_type == GL_FLOAT_VEC4) { + bind._piece = Shader::SMP_row3; + } else { + GLCAT.error() + << "p3d_ColorScale should be vec3 or vec4\n"; + continue; + } s->_mat_spec.push_back(bind); continue; } if (noprefix == "Color") { Shader::ShaderMatSpec bind; bind._id = arg_id; - bind._piece = Shader::SMP_row3; bind._func = Shader::SMF_first; bind._part[0] = Shader::SMO_attr_color; bind._arg[0] = NULL; @@ -424,10 +473,25 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext bind._part[1] = Shader::SMO_identity; bind._arg[1] = NULL; bind._dep[1] = Shader::SSD_NONE; + + if (param_type == GL_FLOAT_VEC3) { + bind._piece = Shader::SMP_row3x3; + } else if (param_type == GL_FLOAT_VEC4) { + bind._piece = Shader::SMP_row3; + } else { + GLCAT.error() + << "p3d_Color should be vec3 or vec4\n"; + continue; + } s->_mat_spec.push_back(bind); continue; } if (noprefix == "ClipPlane") { + if (param_type != GL_FLOAT_VEC4) { + GLCAT.error() + << "p3d_ClipPlane should be vec4 or vec4[]\n"; + continue; + } for (int i = 0; i < param_size; ++i) { Shader::ShaderMatSpec bind; bind._id = arg_id; @@ -449,7 +513,6 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext if (noprefix == "LightModel.ambient") { Shader::ShaderMatSpec bind; bind._id = arg_id; - bind._piece = Shader::SMP_row3; bind._func = Shader::SMF_first; bind._part[0] = Shader::SMO_light_ambient; bind._arg[0] = NULL; @@ -457,6 +520,16 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext bind._part[1] = Shader::SMO_identity; bind._arg[1] = NULL; bind._dep[1] = Shader::SSD_NONE; + + if (param_type == GL_FLOAT_VEC3) { + bind._piece = Shader::SMP_row3x3; + } else if (param_type == GL_FLOAT_VEC4) { + bind._piece = Shader::SMP_row3; + } else { + GLCAT.error() + << "p3d_LightModel.ambient should be vec3 or vec4\n"; + continue; + } s->_mat_spec.push_back(bind); continue; } @@ -525,86 +598,36 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext switch (param_type) { #ifndef OPENGLES case GL_INT_SAMPLER_1D: - case GL_UNSIGNED_INT_SAMPLER_1D: - case GL_SAMPLER_1D_SHADOW: - case GL_SAMPLER_1D: { - _glgsg->_glUniform1i(p, s->_tex_spec.size()); - Shader::ShaderTexSpec bind; - bind._id = arg_id; - bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_1d_texture; - bind._stage = texunitno++; - s->_tex_spec.push_back(bind); - continue; } case GL_INT_SAMPLER_2D: + case GL_INT_SAMPLER_3D: + case GL_INT_SAMPLER_2D_ARRAY: + case GL_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_1D: case GL_UNSIGNED_INT_SAMPLER_2D: -#endif + case GL_UNSIGNED_INT_SAMPLER_3D: + case GL_UNSIGNED_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: + case GL_SAMPLER_1D_SHADOW: + case GL_SAMPLER_1D: + case GL_SAMPLER_CUBE_SHADOW: + case GL_SAMPLER_2D_ARRAY: + case GL_SAMPLER_2D_ARRAY_SHADOW: +#endif // !OPENGLES + case GL_SAMPLER_2D: case GL_SAMPLER_2D_SHADOW: - case GL_SAMPLER_2D: { - _glgsg->_glUniform1i(p, s->_tex_spec.size()); + case GL_SAMPLER_3D: + case GL_SAMPLER_CUBE: { Shader::ShaderTexSpec bind; bind._id = arg_id; bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_2d_texture; + bind._desired_type = Texture::TT_2d_texture_array; bind._stage = texunitno++; - s->_tex_spec.push_back(bind); - continue; } -#ifndef OPENGLES - case GL_INT_SAMPLER_3D: - case GL_UNSIGNED_INT_SAMPLER_3D: -#endif - case GL_SAMPLER_3D: { - if (_glgsg->_supports_3d_texture) { + if (get_sampler_texture_type(bind._desired_type, param_type)) { _glgsg->_glUniform1i(p, s->_tex_spec.size()); - Shader::ShaderTexSpec bind; - bind._id = arg_id; - bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_3d_texture; - bind._stage = texunitno++; s->_tex_spec.push_back(bind); - } else { - GLCAT.error() - << "GLSL shader uses 3D texture, which is unsupported by the driver.\n"; } - continue; } -#ifndef OPENGLES - case GL_INT_SAMPLER_CUBE: - case GL_UNSIGNED_INT_SAMPLER_CUBE: - case GL_SAMPLER_CUBE_SHADOW: -#endif - case GL_SAMPLER_CUBE: { - if (_glgsg->_supports_cube_map) { - _glgsg->_glUniform1i(p, s->_tex_spec.size()); - Shader::ShaderTexSpec bind; - bind._id = arg_id; - bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_cube_map; - bind._stage = texunitno++; - s->_tex_spec.push_back(bind); - } else { - GLCAT.error() - << "GLSL shader uses cube map, which is unsupported by the driver.\n"; - } - continue; } -#ifndef OPENGLES - case GL_INT_SAMPLER_2D_ARRAY: - case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: - case GL_SAMPLER_2D_ARRAY_SHADOW: - case GL_SAMPLER_2D_ARRAY: { - if (_glgsg->_supports_2d_texture_array) { - _glgsg->_glUniform1i(p, s->_tex_spec.size()); - Shader::ShaderTexSpec bind; - bind._id = arg_id; - bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_2d_texture_array; - bind._stage = texunitno++; - s->_tex_spec.push_back(bind); - } else { - GLCAT.error() - << "GLSL shader uses 2D texture array, which is unsupported by the driver.\n"; - } - continue; } -#endif + continue; + } case GL_FLOAT_MAT2: #ifndef OPENGLES case GL_FLOAT_MAT2x3: @@ -614,7 +637,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext case GL_FLOAT_MAT4x2: case GL_FLOAT_MAT4x3: #endif - GLCAT.warning() << "GLSL shader requested an unrecognized matrix type\n"; + GLCAT.warning() << "GLSL shader requested an unsupported matrix type\n"; continue; case GL_FLOAT_MAT3: { Shader::ShaderMatSpec bind; @@ -961,6 +984,107 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext _glgsg->report_my_gl_errors(); } +//////////////////////////////////////////////////////////////////// +// Function: GLShaderContext::get_sampler_texture_type +// Access: Public +// Description: Returns the texture type required for the given +// GL sampler type. Returns false if unsupported. +//////////////////////////////////////////////////////////////////// +bool CLP(ShaderContext):: +get_sampler_texture_type(int &out, GLenum param_type) { + switch (param_type) { +#ifndef OPENGLES + case GL_SAMPLER_1D_SHADOW: + if (!_glgsg->_supports_shadow_filter) { + GLCAT.error() + << "GLSL shader uses shadow sampler, which is unsupported by the driver.\n"; + return false; + } + // Fall through + case GL_INT_SAMPLER_1D: + case GL_UNSIGNED_INT_SAMPLER_1D: + case GL_SAMPLER_1D: + out = Texture::TT_1d_texture; + return true; + + case GL_INT_SAMPLER_2D: + case GL_UNSIGNED_INT_SAMPLER_2D: +#endif + case GL_SAMPLER_2D: + out = Texture::TT_2d_texture; + return true; + + case GL_SAMPLER_2D_SHADOW: + out = Texture::TT_2d_texture; + if (!_glgsg->_supports_shadow_filter) { + GLCAT.error() + << "GLSL shader uses shadow sampler, which is unsupported by the driver.\n"; + return false; + } + return true; + +#ifndef OPENGLES + case GL_INT_SAMPLER_3D: + case GL_UNSIGNED_INT_SAMPLER_3D: +#endif + case GL_SAMPLER_3D: + out = Texture::TT_3d_texture; + if (_glgsg->_supports_3d_texture) { + return true; + } else { + GLCAT.error() + << "GLSL shader uses 3D texture, which is unsupported by the driver.\n"; + return false; + } + +#ifndef OPENGLES + case GL_SAMPLER_CUBE_SHADOW: + if (!_glgsg->_supports_shadow_filter) { + GLCAT.error() + << "GLSL shader uses shadow sampler, which is unsupported by the driver.\n"; + return false; + } + // Fall through + case GL_INT_SAMPLER_CUBE: + case GL_UNSIGNED_INT_SAMPLER_CUBE: +#endif + case GL_SAMPLER_CUBE: + out = Texture::TT_cube_map; + if (!_glgsg->_supports_cube_map) { + GLCAT.error() + << "GLSL shader uses cube map, which is unsupported by the driver.\n"; + return false; + } + return true; + +#ifndef OPENGLES + case GL_SAMPLER_2D_ARRAY_SHADOW: + if (!_glgsg->_supports_shadow_filter) { + GLCAT.error() + << "GLSL shader uses shadow sampler, which is unsupported by the driver.\n"; + return false; + } + // Fall through + case GL_INT_SAMPLER_2D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: + case GL_SAMPLER_2D_ARRAY: + out = Texture::TT_2d_texture_array; + if (_glgsg->_supports_2d_texture_array) { + return true; + } else { + GLCAT.error() + << "GLSL shader uses 2D texture array, which is unsupported by the driver.\n"; + return false; + } +#endif + + default: + GLCAT.error() + << "GLSL shader uses unsupported sampler type for texture input.\n"; + return false; + } +} + //////////////////////////////////////////////////////////////////// // Function: GLShaderContext::Destructor // Access: Public @@ -1079,7 +1203,7 @@ issue_parameters(int altered) { // Convert int data to float data. data = (float*) alloca(sizeof(float) * spec._dim[0] * spec._dim[1]); for (int i = 0; i < (spec._dim[0] * spec._dim[1]); ++i) { - data[i] = (int)(((float*)ptr_data->_ptr)[i]); + data[i] = (float)(((int*)ptr_data->_ptr)[i]); } break; @@ -1100,12 +1224,12 @@ issue_parameters(int altered) { } switch (spec._dim[1]) { - case 1: _glgsg->_glUniform1fv(p, spec._dim[0], (float*)ptr_data->_ptr); continue; - case 2: _glgsg->_glUniform2fv(p, spec._dim[0], (float*)ptr_data->_ptr); continue; - case 3: _glgsg->_glUniform3fv(p, spec._dim[0], (float*)ptr_data->_ptr); continue; - case 4: _glgsg->_glUniform4fv(p, spec._dim[0], (float*)ptr_data->_ptr); continue; - case 9: _glgsg->_glUniformMatrix3fv(p, spec._dim[0], GL_FALSE, (float*)ptr_data->_ptr); continue; - case 16: _glgsg->_glUniformMatrix4fv(p, spec._dim[0], GL_FALSE, (float*)ptr_data->_ptr); continue; + case 1: _glgsg->_glUniform1fv(p, spec._dim[0], (float*)data); continue; + case 2: _glgsg->_glUniform2fv(p, spec._dim[0], (float*)data); continue; + case 3: _glgsg->_glUniform3fv(p, spec._dim[0], (float*)data); continue; + case 4: _glgsg->_glUniform4fv(p, spec._dim[0], (float*)data); continue; + case 9: _glgsg->_glUniformMatrix3fv(p, spec._dim[0], GL_FALSE, (float*)data); continue; + case 16: _glgsg->_glUniformMatrix4fv(p, spec._dim[0], GL_FALSE, (float*)data); continue; } nassertd(false) continue; } @@ -1518,7 +1642,7 @@ update_shader_texture_bindings(ShaderContext *prev) { nassertv(texattrib != (TextureAttrib *)NULL); for (int i = 0; i < (int)_shader->_tex_spec.size(); ++i) { - const Shader::ShaderTexSpec &spec = _shader->_tex_spec[i]; + Shader::ShaderTexSpec &spec = _shader->_tex_spec[i]; const InternalName *id = spec._name; int texunit = spec._stage; @@ -1546,9 +1670,15 @@ update_shader_texture_bindings(ShaderContext *prev) { } if (tex->get_texture_type() != spec._desired_type) { - GLCAT.error() - << "Sampler type of GLSL shader input '" << *id << "' does not " - "match type of texture " << *tex << ".\n"; + if (id != NULL) { + GLCAT.error() + << "Sampler type of GLSL shader input '" << *id << "' does not " + "match type of texture " << *tex << ".\n"; + } else { + GLCAT.error() + << "Sampler type of GLSL shader input p3d_Texture" << texunit + << " does not match type of texture " << *tex << ".\n"; + } //TODO: also check whether shadow sampler textures have shadow filter enabled. } diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index ae8e6b3851..e2a9aadc9d 100644 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -35,6 +35,8 @@ public: ~CLP(ShaderContext)(); ALLOC_DELETED_CHAIN(CLP(ShaderContext)); + bool get_sampler_texture_type(int &out, GLenum param_type); + INLINE bool valid(void); void bind(bool reissue_parameters = true); void unbind(); From c130d251936ef8555ca2c9a5a846ddd3b61cb286 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 15 Apr 2015 13:55:50 +0200 Subject: [PATCH 52/73] Add typedefs to API documentation generator --- direct/src/directscripts/extract_docs.py | 7 +- dtool/metalibs/dtoolconfig/pydtool.cxx | 1154 +++++++++++----------- 2 files changed, 591 insertions(+), 570 deletions(-) diff --git a/direct/src/directscripts/extract_docs.py b/direct/src/directscripts/extract_docs.py index b6bb06bfeb..a248fa83ae 100644 --- a/direct/src/directscripts/extract_docs.py +++ b/direct/src/directscripts/extract_docs.py @@ -203,6 +203,11 @@ def processType(handle, type): if docstring: print >>handle, docstring print >>handle, interrogate_type_enum_value_name(type, i_value), "=", interrogate_type_enum_value(type, i_value), "," + + elif interrogate_type_is_typedef(type): + wrapped_type = translated_type_name(interrogate_type_wrapped_type(type)) + print >>handle, "typedef %s %s;" % (wrapped_type, typename) + return else: if interrogate_type_is_struct(type): classtype = "struct" @@ -211,7 +216,7 @@ def processType(handle, type): elif interrogate_type_is_union(type): classtype = "union" else: - print "I don't know what type %s is" % typename + print "I don't know what type %s is" % interrogate_type_true_name(type) return if len(derivations) > 0: diff --git a/dtool/metalibs/dtoolconfig/pydtool.cxx b/dtool/metalibs/dtoolconfig/pydtool.cxx index 0c4b807bb1..7b3a017b34 100644 --- a/dtool/metalibs/dtoolconfig/pydtool.cxx +++ b/dtool/metalibs/dtoolconfig/pydtool.cxx @@ -1,6 +1,6 @@ /* * This file generated by: - * interrogate -D EXPCL_DTOOLCONFIG= -nodb -python -promiscuous -I~/panda3d/include -module panda3d.dtoolconfig -library dtoolconfig -true-names -do-module -oc pydtool.cxx ../../src/interrogatedb/interrogate_interface.h + * interrogate -D EXPCL_DTOOLCONFIG= -nodb -python -promiscuous -I~/panda3d-git/built/include -module panda3d.dtoolconfig -library dtoolconfig -string -true-names -do-module -oc pydtool.cxx ../../src/interrogatedb/interrogate_interface.h * */ @@ -24,68 +24,68 @@ static PyObject *_inPU7VH4RgX(PyObject *self, PyObject *args); static PyObject *_inPU7VH3Gip(PyObject *self, PyObject *args); static PyObject *_inPU7VHRKDz(PyObject *self, PyObject *args); static PyObject *_inPU7VHgZ9N(PyObject *self, PyObject *args); -static PyObject *_inPU7VHRQIx(PyObject *self, PyObject *args); -static PyObject *_inPU7VHGVSj(PyObject *self, PyObject *args); -static PyObject *_inPU7VHznM6(PyObject *self, PyObject *args); -static PyObject *_inPU7VHjiLg(PyObject *self, PyObject *args); -static PyObject *_inPU7VH_yjE(PyObject *self, PyObject *args); -static PyObject *_inPU7VHzK9F(PyObject *self, PyObject *args); -static PyObject *_inPU7VHJju_(PyObject *self, PyObject *args); -static PyObject *_inPU7VHZktk(PyObject *self, PyObject *args); -static PyObject *_inPU7VHG71J(PyObject *self, PyObject *args); -static PyObject *_inPU7VHgeUs(PyObject *self, PyObject *args); -static PyObject *_inPU7VH5Gsy(PyObject *self, PyObject *args); -static PyObject *_inPU7VHCSJJ(PyObject *self, PyObject *args); +static PyObject *_inPU7VHFnRZ(PyObject *self, PyObject *args); +static PyObject *_inPU7VHg0Qv(PyObject *self, PyObject *args); +static PyObject *_inPU7VHtrqw(PyObject *self, PyObject *args); +static PyObject *_inPU7VHdmpW(PyObject *self, PyObject *args); +static PyObject *_inPU7VHUYgQ(PyObject *self, PyObject *args); +static PyObject *_inPU7VH0k7F(PyObject *self, PyObject *args); +static PyObject *_inPU7VHfIsr(PyObject *self, PyObject *args); +static PyObject *_inPU7VHvysR(PyObject *self, PyObject *args); +static PyObject *_inPU7VHYQ_2(PyObject *self, PyObject *args); +static PyObject *_inPU7VH3kdv(PyObject *self, PyObject *args); +static PyObject *_inPU7VHew01(PyObject *self, PyObject *args); +static PyObject *_inPU7VHQna7(PyObject *self, PyObject *args); static PyObject *_inPU7VHkg95(PyObject *self, PyObject *args); static PyObject *_inPU7VHluRc(PyObject *self, PyObject *args); -static PyObject *_inPU7VHwtTf(PyObject *self, PyObject *args); -static PyObject *_inPU7VHrfao(PyObject *self, PyObject *args); -static PyObject *_inPU7VHcedk(PyObject *self, PyObject *args); -static PyObject *_inPU7VHXmoo(PyObject *self, PyObject *args); -static PyObject *_inPU7VHclIo(PyObject *self, PyObject *args); +static PyObject *_inPU7VHtHdM(PyObject *self, PyObject *args); +static PyObject *_inPU7VHDId0(PyObject *self, PyObject *args); +static PyObject *_inPU7VHHuAm(PyObject *self, PyObject *args); +static PyObject *_inPU7VH_xr0(PyObject *self, PyObject *args); +static PyObject *_inPU7VHH5qp(PyObject *self, PyObject *args); static PyObject *_inPU7VHU2_B(PyObject *self, PyObject *args); static PyObject *_inPU7VHHFO2(PyObject *self, PyObject *args); static PyObject *_inPU7VHcfjm(PyObject *self, PyObject *args); static PyObject *_inPU7VH3Sjw(PyObject *self, PyObject *args); static PyObject *_inPU7VHgJcX(PyObject *self, PyObject *args); static PyObject *_inPU7VHYlw6(PyObject *self, PyObject *args); -static PyObject *_inPU7VH3gns(PyObject *self, PyObject *args); -static PyObject *_inPU7VHN968(PyObject *self, PyObject *args); -static PyObject *_inPU7VHFJVJ(PyObject *self, PyObject *args); -static PyObject *_inPU7VHndTW(PyObject *self, PyObject *args); -static PyObject *_inPU7VHpjWj(PyObject *self, PyObject *args); -static PyObject *_inPU7VHNcQW(PyObject *self, PyObject *args); -static PyObject *_inPU7VHP_SX(PyObject *self, PyObject *args); -static PyObject *_inPU7VH1iRq(PyObject *self, PyObject *args); -static PyObject *_inPU7VHEmel(PyObject *self, PyObject *args); -static PyObject *_inPU7VH20Vx(PyObject *self, PyObject *args); -static PyObject *_inPU7VHKcdW(PyObject *self, PyObject *args); -static PyObject *_inPU7VHhUs9(PyObject *self, PyObject *args); -static PyObject *_inPU7VHhF25(PyObject *self, PyObject *args); -static PyObject *_inPU7VHu1qB(PyObject *self, PyObject *args); -static PyObject *_inPU7VHKMkY(PyObject *self, PyObject *args); -static PyObject *_inPU7VHRx9W(PyObject *self, PyObject *args); -static PyObject *_inPU7VH0C9G(PyObject *self, PyObject *args); -static PyObject *_inPU7VHhaPp(PyObject *self, PyObject *args); -static PyObject *_inPU7VHt_1v(PyObject *self, PyObject *args); -static PyObject *_inPU7VH8KQG(PyObject *self, PyObject *args); -static PyObject *_inPU7VHEtIl(PyObject *self, PyObject *args); -static PyObject *_inPU7VHRFmo(PyObject *self, PyObject *args); -static PyObject *_inPU7VHWHA0(PyObject *self, PyObject *args); -static PyObject *_inPU7VHcyIl(PyObject *self, PyObject *args); -static PyObject *_inPU7VHBnBv(PyObject *self, PyObject *args); -static PyObject *_inPU7VHUvW7(PyObject *self, PyObject *args); -static PyObject *_inPU7VHPdXf(PyObject *self, PyObject *args); -static PyObject *_inPU7VHd0dl(PyObject *self, PyObject *args); -static PyObject *_inPU7VHdVbH(PyObject *self, PyObject *args); -static PyObject *_inPU7VHBwF0(PyObject *self, PyObject *args); -static PyObject *_inPU7VH9dPK(PyObject *self, PyObject *args); -static PyObject *_inPU7VHhUwR(PyObject *self, PyObject *args); +static PyObject *_inPU7VHsmnz(PyObject *self, PyObject *args); +static PyObject *_inPU7VHxQ10(PyObject *self, PyObject *args); +static PyObject *_inPU7VH6gPB(PyObject *self, PyObject *args); +static PyObject *_inPU7VHISgV(PyObject *self, PyObject *args); +static PyObject *_inPU7VHH3bx(PyObject *self, PyObject *args); +static PyObject *_inPU7VHzeUk(PyObject *self, PyObject *args); +static PyObject *_inPU7VHUeI5(PyObject *self, PyObject *args); +static PyObject *_inPU7VHuSvx(PyObject *self, PyObject *args); +static PyObject *_inPU7VHwpYd(PyObject *self, PyObject *args); +static PyObject *_inPU7VHOfNh(PyObject *self, PyObject *args); +static PyObject *_inPU7VHf5_U(PyObject *self, PyObject *args); +static PyObject *_inPU7VHL3ZB(PyObject *self, PyObject *args); +static PyObject *_inPU7VHXw0I(PyObject *self, PyObject *args); +static PyObject *_inPU7VH3zru(PyObject *self, PyObject *args); +static PyObject *_inPU7VHRrg2(PyObject *self, PyObject *args); +static PyObject *_inPU7VHEJCx(PyObject *self, PyObject *args); +static PyObject *_inPU7VHWAZr(PyObject *self, PyObject *args); +static PyObject *_inPU7VHrD_M(PyObject *self, PyObject *args); +static PyObject *_inPU7VHjolz(PyObject *self, PyObject *args); +static PyObject *_inPU7VHt_JD(PyObject *self, PyObject *args); +static PyObject *_inPU7VHwEts(PyObject *self, PyObject *args); +static PyObject *_inPU7VHrJWs(PyObject *self, PyObject *args); +static PyObject *_inPU7VHpmFD(PyObject *self, PyObject *args); +static PyObject *_inPU7VHyYUX(PyObject *self, PyObject *args); +static PyObject *_inPU7VH54dn(PyObject *self, PyObject *args); +static PyObject *_inPU7VHGMpW(PyObject *self, PyObject *args); +static PyObject *_inPU7VHNuBV(PyObject *self, PyObject *args); +static PyObject *_inPU7VH9UwA(PyObject *self, PyObject *args); +static PyObject *_inPU7VH3FDt(PyObject *self, PyObject *args); +static PyObject *_inPU7VHf513(PyObject *self, PyObject *args); +static PyObject *_inPU7VHsqGH(PyObject *self, PyObject *args); +static PyObject *_inPU7VH7shV(PyObject *self, PyObject *args); static PyObject *_inPU7VHA1eF(PyObject *self, PyObject *args); -static PyObject *_inPU7VH8pBy(PyObject *self, PyObject *args); -static PyObject *_inPU7VH85oW(PyObject *self, PyObject *args); -static PyObject *_inPU7VHYZz0(PyObject *self, PyObject *args); -static PyObject *_inPU7VHzKCA(PyObject *self, PyObject *args); +static PyObject *_inPU7VH9tTm(PyObject *self, PyObject *args); +static PyObject *_inPU7VH776V(PyObject *self, PyObject *args); +static PyObject *_inPU7VHfaH0(PyObject *self, PyObject *args); +static PyObject *_inPU7VHGB9D(PyObject *self, PyObject *args); static PyObject *_inPU7VHsxxs(PyObject *self, PyObject *args); static PyObject *_inPU7VHMT0z(PyObject *self, PyObject *args); static PyObject *_inPU7VHiW3v(PyObject *self, PyObject *args); @@ -93,61 +93,62 @@ static PyObject *_inPU7VH4Px8(PyObject *self, PyObject *args); static PyObject *_inPU7VHNHcs(PyObject *self, PyObject *args); static PyObject *_inPU7VHqHrb(PyObject *self, PyObject *args); static PyObject *_inPU7VHaOqq(PyObject *self, PyObject *args); -static PyObject *_inPU7VHvue5(PyObject *self, PyObject *args); -static PyObject *_inPU7VHB_n_(PyObject *self, PyObject *args); -static PyObject *_inPU7VHDFET(PyObject *self, PyObject *args); -static PyObject *_inPU7VHUyNE(PyObject *self, PyObject *args); -static PyObject *_inPU7VHpDlm(PyObject *self, PyObject *args); -static PyObject *_inPU7VHAscF(PyObject *self, PyObject *args); -static PyObject *_inPU7VHYjbU(PyObject *self, PyObject *args); -static PyObject *_inPU7VHWmpU(PyObject *self, PyObject *args); -static PyObject *_inPU7VHnegH(PyObject *self, PyObject *args); -static PyObject *_inPU7VHrrnF(PyObject *self, PyObject *args); -static PyObject *_inPU7VH7ShX(PyObject *self, PyObject *args); -static PyObject *_inPU7VHx_aO(PyObject *self, PyObject *args); -static PyObject *_inPU7VHpofZ(PyObject *self, PyObject *args); -static PyObject *_inPU7VH2J9C(PyObject *self, PyObject *args); -static PyObject *_inPU7VHA6iz(PyObject *self, PyObject *args); -static PyObject *_inPU7VHa78E(PyObject *self, PyObject *args); -static PyObject *_inPU7VHWD3W(PyObject *self, PyObject *args); -static PyObject *_inPU7VHYuud(PyObject *self, PyObject *args); -static PyObject *_inPU7VHlmJS(PyObject *self, PyObject *args); -static PyObject *_inPU7VHLlrr(PyObject *self, PyObject *args); -static PyObject *_inPU7VHw_wy(PyObject *self, PyObject *args); -static PyObject *_inPU7VHgk_l(PyObject *self, PyObject *args); -static PyObject *_inPU7VHXpHY(PyObject *self, PyObject *args); -static PyObject *_inPU7VHHhIg(PyObject *self, PyObject *args); -static PyObject *_inPU7VHff0T(PyObject *self, PyObject *args); -static PyObject *_inPU7VH5PPX(PyObject *self, PyObject *args); -static PyObject *_inPU7VHCIt5(PyObject *self, PyObject *args); -static PyObject *_inPU7VHPww5(PyObject *self, PyObject *args); -static PyObject *_inPU7VHPke3(PyObject *self, PyObject *args); -static PyObject *_inPU7VHJmw3(PyObject *self, PyObject *args); -static PyObject *_inPU7VHR0Lc(PyObject *self, PyObject *args); -static PyObject *_inPU7VHc6gE(PyObject *self, PyObject *args); -static PyObject *_inPU7VH1iT0(PyObject *self, PyObject *args); -static PyObject *_inPU7VHz1Mn(PyObject *self, PyObject *args); -static PyObject *_inPU7VHWlf2(PyObject *self, PyObject *args); -static PyObject *_inPU7VH1q8q(PyObject *self, PyObject *args); -static PyObject *_inPU7VHobo6(PyObject *self, PyObject *args); -static PyObject *_inPU7VHjevK(PyObject *self, PyObject *args); -static PyObject *_inPU7VHeBpM(PyObject *self, PyObject *args); -static PyObject *_inPU7VHfmeN(PyObject *self, PyObject *args); -static PyObject *_inPU7VHKBCl(PyObject *self, PyObject *args); -static PyObject *_inPU7VH936K(PyObject *self, PyObject *args); -static PyObject *_inPU7VHPPXQ(PyObject *self, PyObject *args); -static PyObject *_inPU7VHnu86(PyObject *self, PyObject *args); -static PyObject *_inPU7VHngiq(PyObject *self, PyObject *args); -static PyObject *_inPU7VHUXR0(PyObject *self, PyObject *args); -static PyObject *_inPU7VHDO7D(PyObject *self, PyObject *args); -static PyObject *_inPU7VHhZFz(PyObject *self, PyObject *args); -static PyObject *_inPU7VHnKPe(PyObject *self, PyObject *args); -static PyObject *_inPU7VHP3lS(PyObject *self, PyObject *args); -static PyObject *_inPU7VHUlLp(PyObject *self, PyObject *args); -static PyObject *_inPU7VH9Xei(PyObject *self, PyObject *args); -static PyObject *_inPU7VHaGkE(PyObject *self, PyObject *args); -static PyObject *_inPU7VHoe_l(PyObject *self, PyObject *args); -static PyObject *_inPU7VHuEdH(PyObject *self, PyObject *args); +static PyObject *_inPU7VHqWOw(PyObject *self, PyObject *args); +static PyObject *_inPU7VHHu7x(PyObject *self, PyObject *args); +static PyObject *_inPU7VHwGnA(PyObject *self, PyObject *args); +static PyObject *_inPU7VHXGxx(PyObject *self, PyObject *args); +static PyObject *_inPU7VHj04Z(PyObject *self, PyObject *args); +static PyObject *_inPU7VHEOv4(PyObject *self, PyObject *args); +static PyObject *_inPU7VHpCqJ(PyObject *self, PyObject *args); +static PyObject *_inPU7VH_Pz3(PyObject *self, PyObject *args); +static PyObject *_inPU7VHt_06(PyObject *self, PyObject *args); +static PyObject *_inPU7VHmuPs(PyObject *self, PyObject *args); +static PyObject *_inPU7VHvM8B(PyObject *self, PyObject *args); +static PyObject *_inPU7VHap97(PyObject *self, PyObject *args); +static PyObject *_inPU7VH0o8D(PyObject *self, PyObject *args); +static PyObject *_inPU7VHOoQ2(PyObject *self, PyObject *args); +static PyObject *_inPU7VHKuFh(PyObject *self, PyObject *args); +static PyObject *_inPU7VHo5L6(PyObject *self, PyObject *args); +static PyObject *_inPU7VHzgKK(PyObject *self, PyObject *args); +static PyObject *_inPU7VH0FIF(PyObject *self, PyObject *args); +static PyObject *_inPU7VHZqvD(PyObject *self, PyObject *args); +static PyObject *_inPU7VHDyRd(PyObject *self, PyObject *args); +static PyObject *_inPU7VHMnKa(PyObject *self, PyObject *args); +static PyObject *_inPU7VHRtji(PyObject *self, PyObject *args); +static PyObject *_inPU7VHCnbQ(PyObject *self, PyObject *args); +static PyObject *_inPU7VHdUVN(PyObject *self, PyObject *args); +static PyObject *_inPU7VHihbt(PyObject *self, PyObject *args); +static PyObject *_inPU7VHbyPY(PyObject *self, PyObject *args); +static PyObject *_inPU7VHAaT6(PyObject *self, PyObject *args); +static PyObject *_inPU7VHgL9q(PyObject *self, PyObject *args); +static PyObject *_inPU7VHWB97(PyObject *self, PyObject *args); +static PyObject *_inPU7VHDUAl(PyObject *self, PyObject *args); +static PyObject *_inPU7VH1_Kf(PyObject *self, PyObject *args); +static PyObject *_inPU7VH98lD(PyObject *self, PyObject *args); +static PyObject *_inPU7VH9SHr(PyObject *self, PyObject *args); +static PyObject *_inPU7VHdiZP(PyObject *self, PyObject *args); +static PyObject *_inPU7VHTdER(PyObject *self, PyObject *args); +static PyObject *_inPU7VHYO56(PyObject *self, PyObject *args); +static PyObject *_inPU7VHxtCG(PyObject *self, PyObject *args); +static PyObject *_inPU7VH_EB2(PyObject *self, PyObject *args); +static PyObject *_inPU7VHEG1l(PyObject *self, PyObject *args); +static PyObject *_inPU7VH7tUq(PyObject *self, PyObject *args); +static PyObject *_inPU7VHyStU(PyObject *self, PyObject *args); +static PyObject *_inPU7VHdM85(PyObject *self, PyObject *args); +static PyObject *_inPU7VHk_GN(PyObject *self, PyObject *args); +static PyObject *_inPU7VH8QjG(PyObject *self, PyObject *args); +static PyObject *_inPU7VHyMtj(PyObject *self, PyObject *args); +static PyObject *_inPU7VHHDtN(PyObject *self, PyObject *args); +static PyObject *_inPU7VHHFjA(PyObject *self, PyObject *args); +static PyObject *_inPU7VH_NPR(PyObject *self, PyObject *args); +static PyObject *_inPU7VHcTOH(PyObject *self, PyObject *args); +static PyObject *_inPU7VHhdU7(PyObject *self, PyObject *args); +static PyObject *_inPU7VHQPxU(PyObject *self, PyObject *args); +static PyObject *_inPU7VHO7Pz(PyObject *self, PyObject *args); +static PyObject *_inPU7VHvu_E(PyObject *self, PyObject *args); +static PyObject *_inPU7VHxGUt(PyObject *self, PyObject *args); +static PyObject *_inPU7VHzM1P(PyObject *self, PyObject *args); +static PyObject *_inPU7VHoY5L(PyObject *self, PyObject *args); /* @@ -158,7 +159,7 @@ static PyObject * _inPU7VHtbRf(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - interrogate_add_search_directory((char const *)param0); + interrogate_add_search_directory((char *)param0); return Py_BuildValue(""); } return (PyObject *)NULL; @@ -172,7 +173,7 @@ static PyObject * _inPU7VHda_g(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - interrogate_add_search_path((char const *)param0); + interrogate_add_search_path((char *)param0); return Py_BuildValue(""); } return (PyObject *)NULL; @@ -210,13 +211,13 @@ _inPU7VH3Gip(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_manifest(int n) + * ManifestIndex interrogate_get_manifest(int n) */ static PyObject * _inPU7VHRKDz(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_get_manifest((int)param0); + ManifestIndex return_value = interrogate_get_manifest((int)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -228,13 +229,13 @@ _inPU7VHRKDz(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_manifest_by_name(char const *manifest_name) + * ManifestIndex interrogate_get_manifest_by_name(char const *manifest_name) */ static PyObject * _inPU7VHgZ9N(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - int return_value = interrogate_get_manifest_by_name((char const *)param0); + ManifestIndex return_value = interrogate_get_manifest_by_name((char *)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -246,13 +247,13 @@ _inPU7VHgZ9N(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_manifest_name(int manifest) + * char const *interrogate_manifest_name(ManifestIndex manifest) */ static PyObject * -_inPU7VHRQIx(PyObject *, PyObject *args) { +_inPU7VHFnRZ(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_manifest_name((int)param0); + char const *return_value = interrogate_manifest_name((ManifestIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -264,13 +265,13 @@ _inPU7VHRQIx(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_manifest_definition(int manifest) + * char const *interrogate_manifest_definition(ManifestIndex manifest) */ static PyObject * -_inPU7VHGVSj(PyObject *, PyObject *args) { +_inPU7VHg0Qv(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_manifest_definition((int)param0); + char const *return_value = interrogate_manifest_definition((ManifestIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -282,13 +283,13 @@ _inPU7VHGVSj(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_manifest_has_type(int manifest) + * bool interrogate_manifest_has_type(ManifestIndex manifest) */ static PyObject * -_inPU7VHznM6(PyObject *, PyObject *args) { +_inPU7VHtrqw(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_manifest_has_type((int)param0); + bool return_value = interrogate_manifest_has_type((ManifestIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -296,13 +297,13 @@ _inPU7VHznM6(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_manifest_get_type(int manifest) + * TypeIndex interrogate_manifest_get_type(ManifestIndex manifest) */ static PyObject * -_inPU7VHjiLg(PyObject *, PyObject *args) { +_inPU7VHdmpW(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_manifest_get_type((int)param0); + TypeIndex return_value = interrogate_manifest_get_type((ManifestIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -314,13 +315,13 @@ _inPU7VHjiLg(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_manifest_has_getter(int manifest) + * bool interrogate_manifest_has_getter(ManifestIndex manifest) */ static PyObject * -_inPU7VH_yjE(PyObject *, PyObject *args) { +_inPU7VHUYgQ(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_manifest_has_getter((int)param0); + bool return_value = interrogate_manifest_has_getter((ManifestIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -328,13 +329,13 @@ _inPU7VH_yjE(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_manifest_getter(int manifest) + * FunctionIndex interrogate_manifest_getter(ManifestIndex manifest) */ static PyObject * -_inPU7VHzK9F(PyObject *, PyObject *args) { +_inPU7VH0k7F(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_manifest_getter((int)param0); + FunctionIndex return_value = interrogate_manifest_getter((ManifestIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -346,13 +347,13 @@ _inPU7VHzK9F(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_manifest_has_int_value(int manifest) + * bool interrogate_manifest_has_int_value(ManifestIndex manifest) */ static PyObject * -_inPU7VHJju_(PyObject *, PyObject *args) { +_inPU7VHfIsr(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_manifest_has_int_value((int)param0); + bool return_value = interrogate_manifest_has_int_value((ManifestIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -360,13 +361,13 @@ _inPU7VHJju_(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_manifest_get_int_value(int manifest) + * int interrogate_manifest_get_int_value(ManifestIndex manifest) */ static PyObject * -_inPU7VHZktk(PyObject *, PyObject *args) { +_inPU7VHvysR(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_manifest_get_int_value((int)param0); + int return_value = interrogate_manifest_get_int_value((ManifestIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -378,13 +379,13 @@ _inPU7VHZktk(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_element_name(int element) + * char const *interrogate_element_name(ElementIndex element) */ static PyObject * -_inPU7VHG71J(PyObject *, PyObject *args) { +_inPU7VHYQ_2(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_element_name((int)param0); + char const *return_value = interrogate_element_name((ElementIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -396,13 +397,13 @@ _inPU7VHG71J(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_element_scoped_name(int element) + * char const *interrogate_element_scoped_name(ElementIndex element) */ static PyObject * -_inPU7VHgeUs(PyObject *, PyObject *args) { +_inPU7VH3kdv(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_element_scoped_name((int)param0); + char const *return_value = interrogate_element_scoped_name((ElementIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -414,13 +415,13 @@ _inPU7VHgeUs(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_element_has_comment(int element) + * bool interrogate_element_has_comment(ElementIndex element) */ static PyObject * -_inPU7VH5Gsy(PyObject *, PyObject *args) { +_inPU7VHew01(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_element_has_comment((int)param0); + bool return_value = interrogate_element_has_comment((ElementIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -428,13 +429,13 @@ _inPU7VH5Gsy(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_element_comment(int element) + * char const *interrogate_element_comment(ElementIndex element) */ static PyObject * -_inPU7VHCSJJ(PyObject *, PyObject *args) { +_inPU7VHQna7(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_element_comment((int)param0); + char const *return_value = interrogate_element_comment((ElementIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -446,13 +447,13 @@ _inPU7VHCSJJ(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_element_by_name(char const *element_name) + * ElementIndex interrogate_get_element_by_name(char const *element_name) */ static PyObject * _inPU7VHkg95(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - int return_value = interrogate_get_element_by_name((char const *)param0); + ElementIndex return_value = interrogate_get_element_by_name((char *)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -464,13 +465,13 @@ _inPU7VHkg95(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_element_by_scoped_name(char const *element_name) + * ElementIndex interrogate_get_element_by_scoped_name(char const *element_name) */ static PyObject * _inPU7VHluRc(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - int return_value = interrogate_get_element_by_scoped_name((char const *)param0); + ElementIndex return_value = interrogate_get_element_by_scoped_name((char *)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -482,13 +483,13 @@ _inPU7VHluRc(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_element_type(int element) + * TypeIndex interrogate_element_type(ElementIndex element) */ static PyObject * -_inPU7VHwtTf(PyObject *, PyObject *args) { +_inPU7VHtHdM(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_element_type((int)param0); + TypeIndex return_value = interrogate_element_type((ElementIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -500,13 +501,13 @@ _inPU7VHwtTf(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_element_has_getter(int element) + * bool interrogate_element_has_getter(ElementIndex element) */ static PyObject * -_inPU7VHrfao(PyObject *, PyObject *args) { +_inPU7VHDId0(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_element_has_getter((int)param0); + bool return_value = interrogate_element_has_getter((ElementIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -514,13 +515,13 @@ _inPU7VHrfao(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_element_getter(int element) + * FunctionIndex interrogate_element_getter(ElementIndex element) */ static PyObject * -_inPU7VHcedk(PyObject *, PyObject *args) { +_inPU7VHHuAm(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_element_getter((int)param0); + FunctionIndex return_value = interrogate_element_getter((ElementIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -532,13 +533,13 @@ _inPU7VHcedk(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_element_has_setter(int element) + * bool interrogate_element_has_setter(ElementIndex element) */ static PyObject * -_inPU7VHXmoo(PyObject *, PyObject *args) { +_inPU7VH_xr0(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_element_has_setter((int)param0); + bool return_value = interrogate_element_has_setter((ElementIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -546,13 +547,13 @@ _inPU7VHXmoo(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_element_setter(int element) + * FunctionIndex interrogate_element_setter(ElementIndex element) */ static PyObject * -_inPU7VHclIo(PyObject *, PyObject *args) { +_inPU7VHH5qp(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_element_setter((int)param0); + FunctionIndex return_value = interrogate_element_setter((ElementIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -581,13 +582,13 @@ _inPU7VHU2_B(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_global(int n) + * ElementIndex interrogate_get_global(int n) */ static PyObject * _inPU7VHHFO2(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_get_global((int)param0); + ElementIndex return_value = interrogate_get_global((int)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -616,13 +617,13 @@ _inPU7VHcfjm(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_global_function(int n) + * FunctionIndex interrogate_get_global_function(int n) */ static PyObject * _inPU7VH3Sjw(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_get_global_function((int)param0); + FunctionIndex return_value = interrogate_get_global_function((int)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -651,13 +652,13 @@ _inPU7VHgJcX(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_function(int n) + * FunctionIndex interrogate_get_function(int n) */ static PyObject * _inPU7VHYlw6(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_get_function((int)param0); + FunctionIndex return_value = interrogate_get_function((int)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -669,13 +670,13 @@ _inPU7VHYlw6(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_function_name(int function) + * char const *interrogate_function_name(FunctionIndex function) */ static PyObject * -_inPU7VH3gns(PyObject *, PyObject *args) { +_inPU7VHsmnz(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_function_name((int)param0); + char const *return_value = interrogate_function_name((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -687,13 +688,13 @@ _inPU7VH3gns(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_function_scoped_name(int function) + * char const *interrogate_function_scoped_name(FunctionIndex function) */ static PyObject * -_inPU7VHN968(PyObject *, PyObject *args) { +_inPU7VHxQ10(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_function_scoped_name((int)param0); + char const *return_value = interrogate_function_scoped_name((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -705,13 +706,13 @@ _inPU7VHN968(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_function_has_comment(int function) + * bool interrogate_function_has_comment(FunctionIndex function) */ static PyObject * -_inPU7VHFJVJ(PyObject *, PyObject *args) { +_inPU7VH6gPB(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_function_has_comment((int)param0); + bool return_value = interrogate_function_has_comment((FunctionIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -719,13 +720,13 @@ _inPU7VHFJVJ(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_function_comment(int function) + * char const *interrogate_function_comment(FunctionIndex function) */ static PyObject * -_inPU7VHndTW(PyObject *, PyObject *args) { +_inPU7VHISgV(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_function_comment((int)param0); + char const *return_value = interrogate_function_comment((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -737,13 +738,13 @@ _inPU7VHndTW(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_function_prototype(int function) + * char const *interrogate_function_prototype(FunctionIndex function) */ static PyObject * -_inPU7VHpjWj(PyObject *, PyObject *args) { +_inPU7VHH3bx(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_function_prototype((int)param0); + char const *return_value = interrogate_function_prototype((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -755,13 +756,13 @@ _inPU7VHpjWj(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_function_is_method(int function) + * bool interrogate_function_is_method(FunctionIndex function) */ static PyObject * -_inPU7VHNcQW(PyObject *, PyObject *args) { +_inPU7VHzeUk(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_function_is_method((int)param0); + bool return_value = interrogate_function_is_method((FunctionIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -769,13 +770,13 @@ _inPU7VHNcQW(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_function_class(int function) + * TypeIndex interrogate_function_class(FunctionIndex function) */ static PyObject * -_inPU7VHP_SX(PyObject *, PyObject *args) { +_inPU7VHUeI5(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_function_class((int)param0); + TypeIndex return_value = interrogate_function_class((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -787,13 +788,13 @@ _inPU7VHP_SX(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_function_has_module_name(int function) + * bool interrogate_function_has_module_name(FunctionIndex function) */ static PyObject * -_inPU7VH1iRq(PyObject *, PyObject *args) { +_inPU7VHuSvx(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_function_has_module_name((int)param0); + bool return_value = interrogate_function_has_module_name((FunctionIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -801,13 +802,13 @@ _inPU7VH1iRq(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_function_module_name(int function) + * char const *interrogate_function_module_name(FunctionIndex function) */ static PyObject * -_inPU7VHEmel(PyObject *, PyObject *args) { +_inPU7VHwpYd(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_function_module_name((int)param0); + char const *return_value = interrogate_function_module_name((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -819,13 +820,13 @@ _inPU7VHEmel(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_function_has_library_name(int function) + * bool interrogate_function_has_library_name(FunctionIndex function) */ static PyObject * -_inPU7VH20Vx(PyObject *, PyObject *args) { +_inPU7VHOfNh(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_function_has_library_name((int)param0); + bool return_value = interrogate_function_has_library_name((FunctionIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -833,13 +834,13 @@ _inPU7VH20Vx(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_function_library_name(int function) + * char const *interrogate_function_library_name(FunctionIndex function) */ static PyObject * -_inPU7VHKcdW(PyObject *, PyObject *args) { +_inPU7VHf5_U(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_function_library_name((int)param0); + char const *return_value = interrogate_function_library_name((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -851,13 +852,13 @@ _inPU7VHKcdW(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_function_is_virtual(int function) + * bool interrogate_function_is_virtual(FunctionIndex function) */ static PyObject * -_inPU7VHhUs9(PyObject *, PyObject *args) { +_inPU7VHL3ZB(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_function_is_virtual((int)param0); + bool return_value = interrogate_function_is_virtual((FunctionIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -865,13 +866,13 @@ _inPU7VHhUs9(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_function_number_of_c_wrappers(int function) + * int interrogate_function_number_of_c_wrappers(FunctionIndex function) */ static PyObject * -_inPU7VHhF25(PyObject *, PyObject *args) { +_inPU7VHXw0I(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_function_number_of_c_wrappers((int)param0); + int return_value = interrogate_function_number_of_c_wrappers((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -883,14 +884,14 @@ _inPU7VHhF25(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_function_c_wrapper(int function, int n) + * FunctionWrapperIndex interrogate_function_c_wrapper(FunctionIndex function, int n) */ static PyObject * -_inPU7VHu1qB(PyObject *, PyObject *args) { +_inPU7VH3zru(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_function_c_wrapper((int)param0, (int)param1); + FunctionWrapperIndex return_value = interrogate_function_c_wrapper((FunctionIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -902,13 +903,13 @@ _inPU7VHu1qB(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_function_number_of_python_wrappers(int function) + * int interrogate_function_number_of_python_wrappers(FunctionIndex function) */ static PyObject * -_inPU7VHKMkY(PyObject *, PyObject *args) { +_inPU7VHRrg2(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_function_number_of_python_wrappers((int)param0); + int return_value = interrogate_function_number_of_python_wrappers((FunctionIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -920,14 +921,14 @@ _inPU7VHKMkY(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_function_python_wrapper(int function, int n) + * FunctionWrapperIndex interrogate_function_python_wrapper(FunctionIndex function, int n) */ static PyObject * -_inPU7VHRx9W(PyObject *, PyObject *args) { +_inPU7VHEJCx(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_function_python_wrapper((int)param0, (int)param1); + FunctionWrapperIndex return_value = interrogate_function_python_wrapper((FunctionIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -939,13 +940,13 @@ _inPU7VHRx9W(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_wrapper_name(int wrapper) + * char const *interrogate_wrapper_name(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VH0C9G(PyObject *, PyObject *args) { +_inPU7VHWAZr(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_wrapper_name((int)param0); + char const *return_value = interrogate_wrapper_name((FunctionWrapperIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -957,13 +958,13 @@ _inPU7VH0C9G(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_wrapper_is_callable_by_name(int wrapper) + * bool interrogate_wrapper_is_callable_by_name(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHhaPp(PyObject *, PyObject *args) { +_inPU7VHrD_M(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_wrapper_is_callable_by_name((int)param0); + bool return_value = interrogate_wrapper_is_callable_by_name((FunctionWrapperIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -971,13 +972,13 @@ _inPU7VHhaPp(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_wrapper_has_comment(int wrapper) + * bool interrogate_wrapper_has_comment(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHt_1v(PyObject *, PyObject *args) { +_inPU7VHjolz(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_wrapper_has_comment((int)param0); + bool return_value = interrogate_wrapper_has_comment((FunctionWrapperIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -985,13 +986,13 @@ _inPU7VHt_1v(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_wrapper_comment(int wrapper) + * char const *interrogate_wrapper_comment(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VH8KQG(PyObject *, PyObject *args) { +_inPU7VHt_JD(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_wrapper_comment((int)param0); + char const *return_value = interrogate_wrapper_comment((FunctionWrapperIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1003,13 +1004,13 @@ _inPU7VH8KQG(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_wrapper_has_return_value(int wrapper) + * bool interrogate_wrapper_has_return_value(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHEtIl(PyObject *, PyObject *args) { +_inPU7VHwEts(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_wrapper_has_return_value((int)param0); + bool return_value = interrogate_wrapper_has_return_value((FunctionWrapperIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1017,13 +1018,13 @@ _inPU7VHEtIl(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_wrapper_return_type(int wrapper) + * TypeIndex interrogate_wrapper_return_type(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHRFmo(PyObject *, PyObject *args) { +_inPU7VHrJWs(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_wrapper_return_type((int)param0); + TypeIndex return_value = interrogate_wrapper_return_type((FunctionWrapperIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1035,13 +1036,13 @@ _inPU7VHRFmo(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_wrapper_caller_manages_return_value(int wrapper) + * bool interrogate_wrapper_caller_manages_return_value(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHWHA0(PyObject *, PyObject *args) { +_inPU7VHpmFD(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_wrapper_caller_manages_return_value((int)param0); + bool return_value = interrogate_wrapper_caller_manages_return_value((FunctionWrapperIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1049,13 +1050,13 @@ _inPU7VHWHA0(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_wrapper_return_value_destructor(int wrapper) + * FunctionIndex interrogate_wrapper_return_value_destructor(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHcyIl(PyObject *, PyObject *args) { +_inPU7VHyYUX(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_wrapper_return_value_destructor((int)param0); + FunctionIndex return_value = interrogate_wrapper_return_value_destructor((FunctionWrapperIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1067,13 +1068,13 @@ _inPU7VHcyIl(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_wrapper_number_of_parameters(int wrapper) + * int interrogate_wrapper_number_of_parameters(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHBnBv(PyObject *, PyObject *args) { +_inPU7VH54dn(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_wrapper_number_of_parameters((int)param0); + int return_value = interrogate_wrapper_number_of_parameters((FunctionWrapperIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1085,14 +1086,14 @@ _inPU7VHBnBv(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_wrapper_parameter_type(int wrapper, int n) + * TypeIndex interrogate_wrapper_parameter_type(FunctionWrapperIndex wrapper, int n) */ static PyObject * -_inPU7VHUvW7(PyObject *, PyObject *args) { +_inPU7VHGMpW(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_wrapper_parameter_type((int)param0, (int)param1); + TypeIndex return_value = interrogate_wrapper_parameter_type((FunctionWrapperIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1104,14 +1105,14 @@ _inPU7VHUvW7(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_wrapper_parameter_has_name(int wrapper, int n) + * bool interrogate_wrapper_parameter_has_name(FunctionWrapperIndex wrapper, int n) */ static PyObject * -_inPU7VHPdXf(PyObject *, PyObject *args) { +_inPU7VHNuBV(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = interrogate_wrapper_parameter_has_name((int)param0, (int)param1); + bool return_value = interrogate_wrapper_parameter_has_name((FunctionWrapperIndex)param0, (int)param1); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1119,14 +1120,14 @@ _inPU7VHPdXf(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_wrapper_parameter_name(int wrapper, int n) + * char const *interrogate_wrapper_parameter_name(FunctionWrapperIndex wrapper, int n) */ static PyObject * -_inPU7VHd0dl(PyObject *, PyObject *args) { +_inPU7VH9UwA(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - char const *return_value = interrogate_wrapper_parameter_name((int)param0, (int)param1); + char const *return_value = interrogate_wrapper_parameter_name((FunctionWrapperIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1138,14 +1139,14 @@ _inPU7VHd0dl(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_wrapper_parameter_is_this(int wrapper, int n) + * bool interrogate_wrapper_parameter_is_this(FunctionWrapperIndex wrapper, int n) */ static PyObject * -_inPU7VHdVbH(PyObject *, PyObject *args) { +_inPU7VH3FDt(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = interrogate_wrapper_parameter_is_this((int)param0, (int)param1); + bool return_value = interrogate_wrapper_parameter_is_this((FunctionWrapperIndex)param0, (int)param1); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1153,13 +1154,13 @@ _inPU7VHdVbH(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_wrapper_has_pointer(int wrapper) + * bool interrogate_wrapper_has_pointer(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHBwF0(PyObject *, PyObject *args) { +_inPU7VHf513(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_wrapper_has_pointer((int)param0); + bool return_value = interrogate_wrapper_has_pointer((FunctionWrapperIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1167,13 +1168,13 @@ _inPU7VHBwF0(PyObject *, PyObject *args) { /* * Python simple wrapper for - * void *interrogate_wrapper_pointer(int wrapper) + * void *interrogate_wrapper_pointer(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VH9dPK(PyObject *, PyObject *args) { +_inPU7VHsqGH(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - interrogate_wrapper_pointer((int)param0); + interrogate_wrapper_pointer((FunctionWrapperIndex)param0); return Py_BuildValue(""); } return (PyObject *)NULL; @@ -1181,13 +1182,13 @@ _inPU7VH9dPK(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_wrapper_unique_name(int wrapper) + * char const *interrogate_wrapper_unique_name(FunctionWrapperIndex wrapper) */ static PyObject * -_inPU7VHhUwR(PyObject *, PyObject *args) { +_inPU7VH7shV(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_wrapper_unique_name((int)param0); + char const *return_value = interrogate_wrapper_unique_name((FunctionWrapperIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1199,13 +1200,13 @@ _inPU7VHhUwR(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_wrapper_by_unique_name(char const *unique_name) + * FunctionWrapperIndex interrogate_get_wrapper_by_unique_name(char const *unique_name) */ static PyObject * _inPU7VHA1eF(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - int return_value = interrogate_get_wrapper_by_unique_name((char const *)param0); + FunctionWrapperIndex return_value = interrogate_get_wrapper_by_unique_name((char *)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1217,13 +1218,13 @@ _inPU7VHA1eF(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_make_seq_class(int make_seq) + * TypeIndex interrogate_make_seq_class(MakeSeqIndex make_seq) */ static PyObject * -_inPU7VH8pBy(PyObject *, PyObject *args) { +_inPU7VH9tTm(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_make_seq_class((int)param0); + TypeIndex return_value = interrogate_make_seq_class((MakeSeqIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1235,13 +1236,13 @@ _inPU7VH8pBy(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_make_seq_seq_name(int make_seq) + * char const *interrogate_make_seq_seq_name(MakeSeqIndex make_seq) */ static PyObject * -_inPU7VH85oW(PyObject *, PyObject *args) { +_inPU7VH776V(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_make_seq_seq_name((int)param0); + char const *return_value = interrogate_make_seq_seq_name((MakeSeqIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1253,13 +1254,13 @@ _inPU7VH85oW(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_make_seq_num_name(int make_seq) + * char const *interrogate_make_seq_num_name(MakeSeqIndex make_seq) */ static PyObject * -_inPU7VHYZz0(PyObject *, PyObject *args) { +_inPU7VHfaH0(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_make_seq_num_name((int)param0); + char const *return_value = interrogate_make_seq_num_name((MakeSeqIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1271,13 +1272,13 @@ _inPU7VHYZz0(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_make_seq_element_name(int make_seq) + * char const *interrogate_make_seq_element_name(MakeSeqIndex make_seq) */ static PyObject * -_inPU7VHzKCA(PyObject *, PyObject *args) { +_inPU7VHGB9D(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_make_seq_element_name((int)param0); + char const *return_value = interrogate_make_seq_element_name((MakeSeqIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1306,13 +1307,13 @@ _inPU7VHsxxs(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_global_type(int n) + * TypeIndex interrogate_get_global_type(int n) */ static PyObject * _inPU7VHMT0z(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_get_global_type((int)param0); + TypeIndex return_value = interrogate_get_global_type((int)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1341,13 +1342,13 @@ _inPU7VHiW3v(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_type(int n) + * TypeIndex interrogate_get_type(int n) */ static PyObject * _inPU7VH4Px8(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_get_type((int)param0); + TypeIndex return_value = interrogate_get_type((int)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1359,13 +1360,13 @@ _inPU7VH4Px8(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_type_by_name(char const *type_name) + * TypeIndex interrogate_get_type_by_name(char const *type_name) */ static PyObject * _inPU7VHNHcs(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - int return_value = interrogate_get_type_by_name((char const *)param0); + TypeIndex return_value = interrogate_get_type_by_name((char *)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1377,13 +1378,13 @@ _inPU7VHNHcs(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_type_by_scoped_name(char const *type_name) + * TypeIndex interrogate_get_type_by_scoped_name(char const *type_name) */ static PyObject * _inPU7VHqHrb(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - int return_value = interrogate_get_type_by_scoped_name((char const *)param0); + TypeIndex return_value = interrogate_get_type_by_scoped_name((char *)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1395,13 +1396,13 @@ _inPU7VHqHrb(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_get_type_by_true_name(char const *type_name) + * TypeIndex interrogate_get_type_by_true_name(char const *type_name) */ static PyObject * _inPU7VHaOqq(PyObject *, PyObject *args) { char *param0; if (PyArg_ParseTuple(args, "s", ¶m0)) { - int return_value = interrogate_get_type_by_true_name((char const *)param0); + TypeIndex return_value = interrogate_get_type_by_true_name((char *)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1413,13 +1414,13 @@ _inPU7VHaOqq(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_name(int type) + * char const *interrogate_type_name(TypeIndex type) */ static PyObject * -_inPU7VHvue5(PyObject *, PyObject *args) { +_inPU7VHqWOw(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_type_name((int)param0); + char const *return_value = interrogate_type_name((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1431,13 +1432,13 @@ _inPU7VHvue5(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_scoped_name(int type) + * char const *interrogate_type_scoped_name(TypeIndex type) */ static PyObject * -_inPU7VHB_n_(PyObject *, PyObject *args) { +_inPU7VHHu7x(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_type_scoped_name((int)param0); + char const *return_value = interrogate_type_scoped_name((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1449,13 +1450,13 @@ _inPU7VHB_n_(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_true_name(int type) + * char const *interrogate_type_true_name(TypeIndex type) */ static PyObject * -_inPU7VHDFET(PyObject *, PyObject *args) { +_inPU7VHwGnA(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_type_true_name((int)param0); + char const *return_value = interrogate_type_true_name((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1467,13 +1468,13 @@ _inPU7VHDFET(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_nested(int type) + * bool interrogate_type_is_nested(TypeIndex type) */ static PyObject * -_inPU7VHUyNE(PyObject *, PyObject *args) { +_inPU7VHXGxx(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_nested((int)param0); + bool return_value = interrogate_type_is_nested((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1481,13 +1482,13 @@ _inPU7VHUyNE(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_outer_class(int type) + * TypeIndex interrogate_type_outer_class(TypeIndex type) */ static PyObject * -_inPU7VHpDlm(PyObject *, PyObject *args) { +_inPU7VHj04Z(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_outer_class((int)param0); + TypeIndex return_value = interrogate_type_outer_class((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1499,13 +1500,13 @@ _inPU7VHpDlm(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_has_comment(int type) + * bool interrogate_type_has_comment(TypeIndex type) */ static PyObject * -_inPU7VHAscF(PyObject *, PyObject *args) { +_inPU7VHEOv4(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_has_comment((int)param0); + bool return_value = interrogate_type_has_comment((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1513,13 +1514,13 @@ _inPU7VHAscF(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_comment(int type) + * char const *interrogate_type_comment(TypeIndex type) */ static PyObject * -_inPU7VHYjbU(PyObject *, PyObject *args) { +_inPU7VHpCqJ(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_type_comment((int)param0); + char const *return_value = interrogate_type_comment((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1531,13 +1532,13 @@ _inPU7VHYjbU(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_has_module_name(int type) + * bool interrogate_type_has_module_name(TypeIndex type) */ static PyObject * -_inPU7VHWmpU(PyObject *, PyObject *args) { +_inPU7VH_Pz3(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_has_module_name((int)param0); + bool return_value = interrogate_type_has_module_name((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1545,13 +1546,13 @@ _inPU7VHWmpU(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_module_name(int type) + * char const *interrogate_type_module_name(TypeIndex type) */ static PyObject * -_inPU7VHnegH(PyObject *, PyObject *args) { +_inPU7VHt_06(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_type_module_name((int)param0); + char const *return_value = interrogate_type_module_name((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1563,13 +1564,13 @@ _inPU7VHnegH(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_has_library_name(int type) + * bool interrogate_type_has_library_name(TypeIndex type) */ static PyObject * -_inPU7VHrrnF(PyObject *, PyObject *args) { +_inPU7VHmuPs(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_has_library_name((int)param0); + bool return_value = interrogate_type_has_library_name((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1577,13 +1578,13 @@ _inPU7VHrrnF(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_library_name(int type) + * char const *interrogate_type_library_name(TypeIndex type) */ static PyObject * -_inPU7VH7ShX(PyObject *, PyObject *args) { +_inPU7VHvM8B(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - char const *return_value = interrogate_type_library_name((int)param0); + char const *return_value = interrogate_type_library_name((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1595,13 +1596,13 @@ _inPU7VH7ShX(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_atomic(int type) + * bool interrogate_type_is_atomic(TypeIndex type) */ static PyObject * -_inPU7VHx_aO(PyObject *, PyObject *args) { +_inPU7VHap97(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_atomic((int)param0); + bool return_value = interrogate_type_is_atomic((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1609,13 +1610,13 @@ _inPU7VHx_aO(PyObject *, PyObject *args) { /* * Python simple wrapper for - * AtomicToken interrogate_type_atomic_token(int type) + * AtomicToken interrogate_type_atomic_token(TypeIndex type) */ static PyObject * -_inPU7VHpofZ(PyObject *, PyObject *args) { +_inPU7VH0o8D(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - AtomicToken return_value = interrogate_type_atomic_token((int)param0); + AtomicToken return_value = interrogate_type_atomic_token((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1627,13 +1628,13 @@ _inPU7VHpofZ(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_unsigned(int type) + * bool interrogate_type_is_unsigned(TypeIndex type) */ static PyObject * -_inPU7VH2J9C(PyObject *, PyObject *args) { +_inPU7VHOoQ2(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_unsigned((int)param0); + bool return_value = interrogate_type_is_unsigned((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1641,13 +1642,13 @@ _inPU7VH2J9C(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_signed(int type) + * bool interrogate_type_is_signed(TypeIndex type) */ static PyObject * -_inPU7VHA6iz(PyObject *, PyObject *args) { +_inPU7VHKuFh(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_signed((int)param0); + bool return_value = interrogate_type_is_signed((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1655,13 +1656,13 @@ _inPU7VHA6iz(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_long(int type) + * bool interrogate_type_is_long(TypeIndex type) */ static PyObject * -_inPU7VHa78E(PyObject *, PyObject *args) { +_inPU7VHo5L6(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_long((int)param0); + bool return_value = interrogate_type_is_long((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1669,13 +1670,13 @@ _inPU7VHa78E(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_longlong(int type) + * bool interrogate_type_is_longlong(TypeIndex type) */ static PyObject * -_inPU7VHWD3W(PyObject *, PyObject *args) { +_inPU7VHzgKK(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_longlong((int)param0); + bool return_value = interrogate_type_is_longlong((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1683,13 +1684,13 @@ _inPU7VHWD3W(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_short(int type) + * bool interrogate_type_is_short(TypeIndex type) */ static PyObject * -_inPU7VHYuud(PyObject *, PyObject *args) { +_inPU7VH0FIF(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_short((int)param0); + bool return_value = interrogate_type_is_short((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1697,13 +1698,13 @@ _inPU7VHYuud(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_wrapped(int type) + * bool interrogate_type_is_wrapped(TypeIndex type) */ static PyObject * -_inPU7VHlmJS(PyObject *, PyObject *args) { +_inPU7VHZqvD(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_wrapped((int)param0); + bool return_value = interrogate_type_is_wrapped((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1711,13 +1712,13 @@ _inPU7VHlmJS(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_pointer(int type) + * bool interrogate_type_is_pointer(TypeIndex type) */ static PyObject * -_inPU7VHLlrr(PyObject *, PyObject *args) { +_inPU7VHDyRd(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_pointer((int)param0); + bool return_value = interrogate_type_is_pointer((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1725,13 +1726,13 @@ _inPU7VHLlrr(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_const(int type) + * bool interrogate_type_is_const(TypeIndex type) */ static PyObject * -_inPU7VHw_wy(PyObject *, PyObject *args) { +_inPU7VHMnKa(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_const((int)param0); + bool return_value = interrogate_type_is_const((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1739,13 +1740,27 @@ _inPU7VHw_wy(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_wrapped_type(int type) + * bool interrogate_type_is_typedef(TypeIndex type) */ static PyObject * -_inPU7VHgk_l(PyObject *, PyObject *args) { +_inPU7VHRtji(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_wrapped_type((int)param0); + bool return_value = interrogate_type_is_typedef((TypeIndex)param0); + return PyBool_FromLong(return_value); + } + return (PyObject *)NULL; +} + +/* + * Python simple wrapper for + * TypeIndex interrogate_type_wrapped_type(TypeIndex type) + */ +static PyObject * +_inPU7VHCnbQ(PyObject *, PyObject *args) { + int param0; + if (PyArg_ParseTuple(args, "i", ¶m0)) { + TypeIndex return_value = interrogate_type_wrapped_type((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1757,13 +1772,13 @@ _inPU7VHgk_l(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_enum(int type) + * bool interrogate_type_is_enum(TypeIndex type) */ static PyObject * -_inPU7VHXpHY(PyObject *, PyObject *args) { +_inPU7VHdUVN(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_enum((int)param0); + bool return_value = interrogate_type_is_enum((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1771,13 +1786,13 @@ _inPU7VHXpHY(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_number_of_enum_values(int type) + * int interrogate_type_number_of_enum_values(TypeIndex type) */ static PyObject * -_inPU7VHHhIg(PyObject *, PyObject *args) { +_inPU7VHihbt(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_number_of_enum_values((int)param0); + int return_value = interrogate_type_number_of_enum_values((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1789,14 +1804,14 @@ _inPU7VHHhIg(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_enum_value_name(int type, int n) + * char const *interrogate_type_enum_value_name(TypeIndex type, int n) */ static PyObject * -_inPU7VHff0T(PyObject *, PyObject *args) { +_inPU7VHbyPY(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - char const *return_value = interrogate_type_enum_value_name((int)param0, (int)param1); + char const *return_value = interrogate_type_enum_value_name((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1808,14 +1823,14 @@ _inPU7VHff0T(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_enum_value_scoped_name(int type, int n) + * char const *interrogate_type_enum_value_scoped_name(TypeIndex type, int n) */ static PyObject * -_inPU7VH5PPX(PyObject *, PyObject *args) { +_inPU7VHAaT6(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - char const *return_value = interrogate_type_enum_value_scoped_name((int)param0, (int)param1); + char const *return_value = interrogate_type_enum_value_scoped_name((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1827,14 +1842,14 @@ _inPU7VH5PPX(PyObject *, PyObject *args) { /* * Python simple wrapper for - * char const *interrogate_type_enum_value_comment(int type, int n) + * char const *interrogate_type_enum_value_comment(TypeIndex type, int n) */ static PyObject * -_inPU7VHCIt5(PyObject *, PyObject *args) { +_inPU7VHgL9q(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - char const *return_value = interrogate_type_enum_value_comment((int)param0, (int)param1); + char const *return_value = interrogate_type_enum_value_comment((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyUnicode_FromString(return_value); #else @@ -1846,14 +1861,14 @@ _inPU7VHCIt5(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_enum_value(int type, int n) + * int interrogate_type_enum_value(TypeIndex type, int n) */ static PyObject * -_inPU7VHPww5(PyObject *, PyObject *args) { +_inPU7VHWB97(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_enum_value((int)param0, (int)param1); + int return_value = interrogate_type_enum_value((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1865,13 +1880,13 @@ _inPU7VHPww5(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_struct(int type) + * bool interrogate_type_is_struct(TypeIndex type) */ static PyObject * -_inPU7VHPke3(PyObject *, PyObject *args) { +_inPU7VHDUAl(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_struct((int)param0); + bool return_value = interrogate_type_is_struct((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1879,13 +1894,13 @@ _inPU7VHPke3(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_class(int type) + * bool interrogate_type_is_class(TypeIndex type) */ static PyObject * -_inPU7VHJmw3(PyObject *, PyObject *args) { +_inPU7VH1_Kf(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_class((int)param0); + bool return_value = interrogate_type_is_class((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1893,13 +1908,13 @@ _inPU7VHJmw3(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_union(int type) + * bool interrogate_type_is_union(TypeIndex type) */ static PyObject * -_inPU7VHR0Lc(PyObject *, PyObject *args) { +_inPU7VH98lD(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_union((int)param0); + bool return_value = interrogate_type_is_union((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1907,13 +1922,13 @@ _inPU7VHR0Lc(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_fully_defined(int type) + * bool interrogate_type_is_fully_defined(TypeIndex type) */ static PyObject * -_inPU7VHc6gE(PyObject *, PyObject *args) { +_inPU7VH9SHr(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_fully_defined((int)param0); + bool return_value = interrogate_type_is_fully_defined((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1921,13 +1936,13 @@ _inPU7VHc6gE(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_is_unpublished(int type) + * bool interrogate_type_is_unpublished(TypeIndex type) */ static PyObject * -_inPU7VH1iT0(PyObject *, PyObject *args) { +_inPU7VHdiZP(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_is_unpublished((int)param0); + bool return_value = interrogate_type_is_unpublished((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1935,13 +1950,13 @@ _inPU7VH1iT0(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_number_of_constructors(int type) + * int interrogate_type_number_of_constructors(TypeIndex type) */ static PyObject * -_inPU7VHz1Mn(PyObject *, PyObject *args) { +_inPU7VHTdER(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_number_of_constructors((int)param0); + int return_value = interrogate_type_number_of_constructors((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1953,14 +1968,14 @@ _inPU7VHz1Mn(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_constructor(int type, int n) + * FunctionIndex interrogate_type_get_constructor(TypeIndex type, int n) */ static PyObject * -_inPU7VHWlf2(PyObject *, PyObject *args) { +_inPU7VHYO56(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_constructor((int)param0, (int)param1); + FunctionIndex return_value = interrogate_type_get_constructor((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -1972,13 +1987,13 @@ _inPU7VHWlf2(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_has_destructor(int type) + * bool interrogate_type_has_destructor(TypeIndex type) */ static PyObject * -_inPU7VH1q8q(PyObject *, PyObject *args) { +_inPU7VHxtCG(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_has_destructor((int)param0); + bool return_value = interrogate_type_has_destructor((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -1986,13 +2001,13 @@ _inPU7VH1q8q(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_destructor_is_inherited(int type) + * bool interrogate_type_destructor_is_inherited(TypeIndex type) */ static PyObject * -_inPU7VHobo6(PyObject *, PyObject *args) { +_inPU7VH_EB2(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - bool return_value = interrogate_type_destructor_is_inherited((int)param0); + bool return_value = interrogate_type_destructor_is_inherited((TypeIndex)param0); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -2000,13 +2015,13 @@ _inPU7VHobo6(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_destructor(int type) + * FunctionIndex interrogate_type_get_destructor(TypeIndex type) */ static PyObject * -_inPU7VHjevK(PyObject *, PyObject *args) { +_inPU7VHEG1l(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_get_destructor((int)param0); + FunctionIndex return_value = interrogate_type_get_destructor((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2018,13 +2033,13 @@ _inPU7VHjevK(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_number_of_elements(int type) + * int interrogate_type_number_of_elements(TypeIndex type) */ static PyObject * -_inPU7VHeBpM(PyObject *, PyObject *args) { +_inPU7VH7tUq(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_number_of_elements((int)param0); + int return_value = interrogate_type_number_of_elements((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2036,14 +2051,14 @@ _inPU7VHeBpM(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_element(int type, int n) + * ElementIndex interrogate_type_get_element(TypeIndex type, int n) */ static PyObject * -_inPU7VHfmeN(PyObject *, PyObject *args) { +_inPU7VHyStU(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_element((int)param0, (int)param1); + ElementIndex return_value = interrogate_type_get_element((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2055,13 +2070,13 @@ _inPU7VHfmeN(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_number_of_methods(int type) + * int interrogate_type_number_of_methods(TypeIndex type) */ static PyObject * -_inPU7VHKBCl(PyObject *, PyObject *args) { +_inPU7VHdM85(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_number_of_methods((int)param0); + int return_value = interrogate_type_number_of_methods((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2073,14 +2088,14 @@ _inPU7VHKBCl(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_method(int type, int n) + * FunctionIndex interrogate_type_get_method(TypeIndex type, int n) */ static PyObject * -_inPU7VH936K(PyObject *, PyObject *args) { +_inPU7VHk_GN(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_method((int)param0, (int)param1); + FunctionIndex return_value = interrogate_type_get_method((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2092,13 +2107,13 @@ _inPU7VH936K(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_number_of_make_seqs(int type) + * int interrogate_type_number_of_make_seqs(TypeIndex type) */ static PyObject * -_inPU7VHPPXQ(PyObject *, PyObject *args) { +_inPU7VH8QjG(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_number_of_make_seqs((int)param0); + int return_value = interrogate_type_number_of_make_seqs((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2110,14 +2125,14 @@ _inPU7VHPPXQ(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_make_seq(int type, int n) + * MakeSeqIndex interrogate_type_get_make_seq(TypeIndex type, int n) */ static PyObject * -_inPU7VHnu86(PyObject *, PyObject *args) { +_inPU7VHyMtj(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_make_seq((int)param0, (int)param1); + MakeSeqIndex return_value = interrogate_type_get_make_seq((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2129,13 +2144,13 @@ _inPU7VHnu86(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_number_of_casts(int type) + * int interrogate_type_number_of_casts(TypeIndex type) */ static PyObject * -_inPU7VHngiq(PyObject *, PyObject *args) { +_inPU7VHHDtN(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_number_of_casts((int)param0); + int return_value = interrogate_type_number_of_casts((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2147,14 +2162,14 @@ _inPU7VHngiq(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_cast(int type, int n) + * FunctionIndex interrogate_type_get_cast(TypeIndex type, int n) */ static PyObject * -_inPU7VHUXR0(PyObject *, PyObject *args) { +_inPU7VHHFjA(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_cast((int)param0, (int)param1); + FunctionIndex return_value = interrogate_type_get_cast((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2166,13 +2181,13 @@ _inPU7VHUXR0(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_number_of_derivations(int type) + * int interrogate_type_number_of_derivations(TypeIndex type) */ static PyObject * -_inPU7VHDO7D(PyObject *, PyObject *args) { +_inPU7VH_NPR(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_number_of_derivations((int)param0); + int return_value = interrogate_type_number_of_derivations((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2184,14 +2199,14 @@ _inPU7VHDO7D(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_derivation(int type, int n) + * TypeIndex interrogate_type_get_derivation(TypeIndex type, int n) */ static PyObject * -_inPU7VHhZFz(PyObject *, PyObject *args) { +_inPU7VHcTOH(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_derivation((int)param0, (int)param1); + TypeIndex return_value = interrogate_type_get_derivation((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2203,14 +2218,14 @@ _inPU7VHhZFz(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_derivation_has_upcast(int type, int n) + * bool interrogate_type_derivation_has_upcast(TypeIndex type, int n) */ static PyObject * -_inPU7VHnKPe(PyObject *, PyObject *args) { +_inPU7VHhdU7(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = interrogate_type_derivation_has_upcast((int)param0, (int)param1); + bool return_value = interrogate_type_derivation_has_upcast((TypeIndex)param0, (int)param1); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -2218,14 +2233,14 @@ _inPU7VHnKPe(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_upcast(int type, int n) + * FunctionIndex interrogate_type_get_upcast(TypeIndex type, int n) */ static PyObject * -_inPU7VHP3lS(PyObject *, PyObject *args) { +_inPU7VHQPxU(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_upcast((int)param0, (int)param1); + FunctionIndex return_value = interrogate_type_get_upcast((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2237,14 +2252,14 @@ _inPU7VHP3lS(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_derivation_downcast_is_impossible(int type, int n) + * bool interrogate_type_derivation_downcast_is_impossible(TypeIndex type, int n) */ static PyObject * -_inPU7VHUlLp(PyObject *, PyObject *args) { +_inPU7VHO7Pz(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = interrogate_type_derivation_downcast_is_impossible((int)param0, (int)param1); + bool return_value = interrogate_type_derivation_downcast_is_impossible((TypeIndex)param0, (int)param1); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -2252,14 +2267,14 @@ _inPU7VHUlLp(PyObject *, PyObject *args) { /* * Python simple wrapper for - * bool interrogate_type_derivation_has_downcast(int type, int n) + * bool interrogate_type_derivation_has_downcast(TypeIndex type, int n) */ static PyObject * -_inPU7VH9Xei(PyObject *, PyObject *args) { +_inPU7VHvu_E(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - bool return_value = interrogate_type_derivation_has_downcast((int)param0, (int)param1); + bool return_value = interrogate_type_derivation_has_downcast((TypeIndex)param0, (int)param1); return PyBool_FromLong(return_value); } return (PyObject *)NULL; @@ -2267,14 +2282,14 @@ _inPU7VH9Xei(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_downcast(int type, int n) + * FunctionIndex interrogate_type_get_downcast(TypeIndex type, int n) */ static PyObject * -_inPU7VHaGkE(PyObject *, PyObject *args) { +_inPU7VHxGUt(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_downcast((int)param0, (int)param1); + FunctionIndex return_value = interrogate_type_get_downcast((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2286,13 +2301,13 @@ _inPU7VHaGkE(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_number_of_nested_types(int type) + * int interrogate_type_number_of_nested_types(TypeIndex type) */ static PyObject * -_inPU7VHoe_l(PyObject *, PyObject *args) { +_inPU7VHzM1P(PyObject *, PyObject *args) { int param0; if (PyArg_ParseTuple(args, "i", ¶m0)) { - int return_value = interrogate_type_number_of_nested_types((int)param0); + int return_value = interrogate_type_number_of_nested_types((TypeIndex)param0); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2304,14 +2319,14 @@ _inPU7VHoe_l(PyObject *, PyObject *args) { /* * Python simple wrapper for - * int interrogate_type_get_nested_type(int type, int n) + * TypeIndex interrogate_type_get_nested_type(TypeIndex type, int n) */ static PyObject * -_inPU7VHuEdH(PyObject *, PyObject *args) { +_inPU7VHoY5L(PyObject *, PyObject *args) { int param0; int param1; if (PyArg_ParseTuple(args, "ii", ¶m0, ¶m1)) { - int return_value = interrogate_type_get_nested_type((int)param0, (int)param1); + TypeIndex return_value = interrogate_type_get_nested_type((TypeIndex)param0, (int)param1); #if PY_MAJOR_VERSION >= 3 return PyLong_FromLong(return_value); #else @@ -2329,68 +2344,68 @@ static PyMethodDef python_simple_funcs[] = { { "interrogate_number_of_manifests", &_inPU7VH3Gip, METH_VARARGS }, { "interrogate_get_manifest", &_inPU7VHRKDz, METH_VARARGS }, { "interrogate_get_manifest_by_name", &_inPU7VHgZ9N, METH_VARARGS }, - { "interrogate_manifest_name", &_inPU7VHRQIx, METH_VARARGS }, - { "interrogate_manifest_definition", &_inPU7VHGVSj, METH_VARARGS }, - { "interrogate_manifest_has_type", &_inPU7VHznM6, METH_VARARGS }, - { "interrogate_manifest_get_type", &_inPU7VHjiLg, METH_VARARGS }, - { "interrogate_manifest_has_getter", &_inPU7VH_yjE, METH_VARARGS }, - { "interrogate_manifest_getter", &_inPU7VHzK9F, METH_VARARGS }, - { "interrogate_manifest_has_int_value", &_inPU7VHJju_, METH_VARARGS }, - { "interrogate_manifest_get_int_value", &_inPU7VHZktk, METH_VARARGS }, - { "interrogate_element_name", &_inPU7VHG71J, METH_VARARGS }, - { "interrogate_element_scoped_name", &_inPU7VHgeUs, METH_VARARGS }, - { "interrogate_element_has_comment", &_inPU7VH5Gsy, METH_VARARGS }, - { "interrogate_element_comment", &_inPU7VHCSJJ, METH_VARARGS }, + { "interrogate_manifest_name", &_inPU7VHFnRZ, METH_VARARGS }, + { "interrogate_manifest_definition", &_inPU7VHg0Qv, METH_VARARGS }, + { "interrogate_manifest_has_type", &_inPU7VHtrqw, METH_VARARGS }, + { "interrogate_manifest_get_type", &_inPU7VHdmpW, METH_VARARGS }, + { "interrogate_manifest_has_getter", &_inPU7VHUYgQ, METH_VARARGS }, + { "interrogate_manifest_getter", &_inPU7VH0k7F, METH_VARARGS }, + { "interrogate_manifest_has_int_value", &_inPU7VHfIsr, METH_VARARGS }, + { "interrogate_manifest_get_int_value", &_inPU7VHvysR, METH_VARARGS }, + { "interrogate_element_name", &_inPU7VHYQ_2, METH_VARARGS }, + { "interrogate_element_scoped_name", &_inPU7VH3kdv, METH_VARARGS }, + { "interrogate_element_has_comment", &_inPU7VHew01, METH_VARARGS }, + { "interrogate_element_comment", &_inPU7VHQna7, METH_VARARGS }, { "interrogate_get_element_by_name", &_inPU7VHkg95, METH_VARARGS }, { "interrogate_get_element_by_scoped_name", &_inPU7VHluRc, METH_VARARGS }, - { "interrogate_element_type", &_inPU7VHwtTf, METH_VARARGS }, - { "interrogate_element_has_getter", &_inPU7VHrfao, METH_VARARGS }, - { "interrogate_element_getter", &_inPU7VHcedk, METH_VARARGS }, - { "interrogate_element_has_setter", &_inPU7VHXmoo, METH_VARARGS }, - { "interrogate_element_setter", &_inPU7VHclIo, METH_VARARGS }, + { "interrogate_element_type", &_inPU7VHtHdM, METH_VARARGS }, + { "interrogate_element_has_getter", &_inPU7VHDId0, METH_VARARGS }, + { "interrogate_element_getter", &_inPU7VHHuAm, METH_VARARGS }, + { "interrogate_element_has_setter", &_inPU7VH_xr0, METH_VARARGS }, + { "interrogate_element_setter", &_inPU7VHH5qp, METH_VARARGS }, { "interrogate_number_of_globals", &_inPU7VHU2_B, METH_VARARGS }, { "interrogate_get_global", &_inPU7VHHFO2, METH_VARARGS }, { "interrogate_number_of_global_functions", &_inPU7VHcfjm, METH_VARARGS }, { "interrogate_get_global_function", &_inPU7VH3Sjw, METH_VARARGS }, { "interrogate_number_of_functions", &_inPU7VHgJcX, METH_VARARGS }, { "interrogate_get_function", &_inPU7VHYlw6, METH_VARARGS }, - { "interrogate_function_name", &_inPU7VH3gns, METH_VARARGS }, - { "interrogate_function_scoped_name", &_inPU7VHN968, METH_VARARGS }, - { "interrogate_function_has_comment", &_inPU7VHFJVJ, METH_VARARGS }, - { "interrogate_function_comment", &_inPU7VHndTW, METH_VARARGS }, - { "interrogate_function_prototype", &_inPU7VHpjWj, METH_VARARGS }, - { "interrogate_function_is_method", &_inPU7VHNcQW, METH_VARARGS }, - { "interrogate_function_class", &_inPU7VHP_SX, METH_VARARGS }, - { "interrogate_function_has_module_name", &_inPU7VH1iRq, METH_VARARGS }, - { "interrogate_function_module_name", &_inPU7VHEmel, METH_VARARGS }, - { "interrogate_function_has_library_name", &_inPU7VH20Vx, METH_VARARGS }, - { "interrogate_function_library_name", &_inPU7VHKcdW, METH_VARARGS }, - { "interrogate_function_is_virtual", &_inPU7VHhUs9, METH_VARARGS }, - { "interrogate_function_number_of_c_wrappers", &_inPU7VHhF25, METH_VARARGS }, - { "interrogate_function_c_wrapper", &_inPU7VHu1qB, METH_VARARGS }, - { "interrogate_function_number_of_python_wrappers", &_inPU7VHKMkY, METH_VARARGS }, - { "interrogate_function_python_wrapper", &_inPU7VHRx9W, METH_VARARGS }, - { "interrogate_wrapper_name", &_inPU7VH0C9G, METH_VARARGS }, - { "interrogate_wrapper_is_callable_by_name", &_inPU7VHhaPp, METH_VARARGS }, - { "interrogate_wrapper_has_comment", &_inPU7VHt_1v, METH_VARARGS }, - { "interrogate_wrapper_comment", &_inPU7VH8KQG, METH_VARARGS }, - { "interrogate_wrapper_has_return_value", &_inPU7VHEtIl, METH_VARARGS }, - { "interrogate_wrapper_return_type", &_inPU7VHRFmo, METH_VARARGS }, - { "interrogate_wrapper_caller_manages_return_value", &_inPU7VHWHA0, METH_VARARGS }, - { "interrogate_wrapper_return_value_destructor", &_inPU7VHcyIl, METH_VARARGS }, - { "interrogate_wrapper_number_of_parameters", &_inPU7VHBnBv, METH_VARARGS }, - { "interrogate_wrapper_parameter_type", &_inPU7VHUvW7, METH_VARARGS }, - { "interrogate_wrapper_parameter_has_name", &_inPU7VHPdXf, METH_VARARGS }, - { "interrogate_wrapper_parameter_name", &_inPU7VHd0dl, METH_VARARGS }, - { "interrogate_wrapper_parameter_is_this", &_inPU7VHdVbH, METH_VARARGS }, - { "interrogate_wrapper_has_pointer", &_inPU7VHBwF0, METH_VARARGS }, - { "interrogate_wrapper_pointer", &_inPU7VH9dPK, METH_VARARGS }, - { "interrogate_wrapper_unique_name", &_inPU7VHhUwR, METH_VARARGS }, + { "interrogate_function_name", &_inPU7VHsmnz, METH_VARARGS }, + { "interrogate_function_scoped_name", &_inPU7VHxQ10, METH_VARARGS }, + { "interrogate_function_has_comment", &_inPU7VH6gPB, METH_VARARGS }, + { "interrogate_function_comment", &_inPU7VHISgV, METH_VARARGS }, + { "interrogate_function_prototype", &_inPU7VHH3bx, METH_VARARGS }, + { "interrogate_function_is_method", &_inPU7VHzeUk, METH_VARARGS }, + { "interrogate_function_class", &_inPU7VHUeI5, METH_VARARGS }, + { "interrogate_function_has_module_name", &_inPU7VHuSvx, METH_VARARGS }, + { "interrogate_function_module_name", &_inPU7VHwpYd, METH_VARARGS }, + { "interrogate_function_has_library_name", &_inPU7VHOfNh, METH_VARARGS }, + { "interrogate_function_library_name", &_inPU7VHf5_U, METH_VARARGS }, + { "interrogate_function_is_virtual", &_inPU7VHL3ZB, METH_VARARGS }, + { "interrogate_function_number_of_c_wrappers", &_inPU7VHXw0I, METH_VARARGS }, + { "interrogate_function_c_wrapper", &_inPU7VH3zru, METH_VARARGS }, + { "interrogate_function_number_of_python_wrappers", &_inPU7VHRrg2, METH_VARARGS }, + { "interrogate_function_python_wrapper", &_inPU7VHEJCx, METH_VARARGS }, + { "interrogate_wrapper_name", &_inPU7VHWAZr, METH_VARARGS }, + { "interrogate_wrapper_is_callable_by_name", &_inPU7VHrD_M, METH_VARARGS }, + { "interrogate_wrapper_has_comment", &_inPU7VHjolz, METH_VARARGS }, + { "interrogate_wrapper_comment", &_inPU7VHt_JD, METH_VARARGS }, + { "interrogate_wrapper_has_return_value", &_inPU7VHwEts, METH_VARARGS }, + { "interrogate_wrapper_return_type", &_inPU7VHrJWs, METH_VARARGS }, + { "interrogate_wrapper_caller_manages_return_value", &_inPU7VHpmFD, METH_VARARGS }, + { "interrogate_wrapper_return_value_destructor", &_inPU7VHyYUX, METH_VARARGS }, + { "interrogate_wrapper_number_of_parameters", &_inPU7VH54dn, METH_VARARGS }, + { "interrogate_wrapper_parameter_type", &_inPU7VHGMpW, METH_VARARGS }, + { "interrogate_wrapper_parameter_has_name", &_inPU7VHNuBV, METH_VARARGS }, + { "interrogate_wrapper_parameter_name", &_inPU7VH9UwA, METH_VARARGS }, + { "interrogate_wrapper_parameter_is_this", &_inPU7VH3FDt, METH_VARARGS }, + { "interrogate_wrapper_has_pointer", &_inPU7VHf513, METH_VARARGS }, + { "interrogate_wrapper_pointer", &_inPU7VHsqGH, METH_VARARGS }, + { "interrogate_wrapper_unique_name", &_inPU7VH7shV, METH_VARARGS }, { "interrogate_get_wrapper_by_unique_name", &_inPU7VHA1eF, METH_VARARGS }, - { "interrogate_make_seq_class", &_inPU7VH8pBy, METH_VARARGS }, - { "interrogate_make_seq_seq_name", &_inPU7VH85oW, METH_VARARGS }, - { "interrogate_make_seq_num_name", &_inPU7VHYZz0, METH_VARARGS }, - { "interrogate_make_seq_element_name", &_inPU7VHzKCA, METH_VARARGS }, + { "interrogate_make_seq_class", &_inPU7VH9tTm, METH_VARARGS }, + { "interrogate_make_seq_seq_name", &_inPU7VH776V, METH_VARARGS }, + { "interrogate_make_seq_num_name", &_inPU7VHfaH0, METH_VARARGS }, + { "interrogate_make_seq_element_name", &_inPU7VHGB9D, METH_VARARGS }, { "interrogate_number_of_global_types", &_inPU7VHsxxs, METH_VARARGS }, { "interrogate_get_global_type", &_inPU7VHMT0z, METH_VARARGS }, { "interrogate_number_of_types", &_inPU7VHiW3v, METH_VARARGS }, @@ -2398,61 +2413,62 @@ static PyMethodDef python_simple_funcs[] = { { "interrogate_get_type_by_name", &_inPU7VHNHcs, METH_VARARGS }, { "interrogate_get_type_by_scoped_name", &_inPU7VHqHrb, METH_VARARGS }, { "interrogate_get_type_by_true_name", &_inPU7VHaOqq, METH_VARARGS }, - { "interrogate_type_name", &_inPU7VHvue5, METH_VARARGS }, - { "interrogate_type_scoped_name", &_inPU7VHB_n_, METH_VARARGS }, - { "interrogate_type_true_name", &_inPU7VHDFET, METH_VARARGS }, - { "interrogate_type_is_nested", &_inPU7VHUyNE, METH_VARARGS }, - { "interrogate_type_outer_class", &_inPU7VHpDlm, METH_VARARGS }, - { "interrogate_type_has_comment", &_inPU7VHAscF, METH_VARARGS }, - { "interrogate_type_comment", &_inPU7VHYjbU, METH_VARARGS }, - { "interrogate_type_has_module_name", &_inPU7VHWmpU, METH_VARARGS }, - { "interrogate_type_module_name", &_inPU7VHnegH, METH_VARARGS }, - { "interrogate_type_has_library_name", &_inPU7VHrrnF, METH_VARARGS }, - { "interrogate_type_library_name", &_inPU7VH7ShX, METH_VARARGS }, - { "interrogate_type_is_atomic", &_inPU7VHx_aO, METH_VARARGS }, - { "interrogate_type_atomic_token", &_inPU7VHpofZ, METH_VARARGS }, - { "interrogate_type_is_unsigned", &_inPU7VH2J9C, METH_VARARGS }, - { "interrogate_type_is_signed", &_inPU7VHA6iz, METH_VARARGS }, - { "interrogate_type_is_long", &_inPU7VHa78E, METH_VARARGS }, - { "interrogate_type_is_longlong", &_inPU7VHWD3W, METH_VARARGS }, - { "interrogate_type_is_short", &_inPU7VHYuud, METH_VARARGS }, - { "interrogate_type_is_wrapped", &_inPU7VHlmJS, METH_VARARGS }, - { "interrogate_type_is_pointer", &_inPU7VHLlrr, METH_VARARGS }, - { "interrogate_type_is_const", &_inPU7VHw_wy, METH_VARARGS }, - { "interrogate_type_wrapped_type", &_inPU7VHgk_l, METH_VARARGS }, - { "interrogate_type_is_enum", &_inPU7VHXpHY, METH_VARARGS }, - { "interrogate_type_number_of_enum_values", &_inPU7VHHhIg, METH_VARARGS }, - { "interrogate_type_enum_value_name", &_inPU7VHff0T, METH_VARARGS }, - { "interrogate_type_enum_value_scoped_name", &_inPU7VH5PPX, METH_VARARGS }, - { "interrogate_type_enum_value_comment", &_inPU7VHCIt5, METH_VARARGS }, - { "interrogate_type_enum_value", &_inPU7VHPww5, METH_VARARGS }, - { "interrogate_type_is_struct", &_inPU7VHPke3, METH_VARARGS }, - { "interrogate_type_is_class", &_inPU7VHJmw3, METH_VARARGS }, - { "interrogate_type_is_union", &_inPU7VHR0Lc, METH_VARARGS }, - { "interrogate_type_is_fully_defined", &_inPU7VHc6gE, METH_VARARGS }, - { "interrogate_type_is_unpublished", &_inPU7VH1iT0, METH_VARARGS }, - { "interrogate_type_number_of_constructors", &_inPU7VHz1Mn, METH_VARARGS }, - { "interrogate_type_get_constructor", &_inPU7VHWlf2, METH_VARARGS }, - { "interrogate_type_has_destructor", &_inPU7VH1q8q, METH_VARARGS }, - { "interrogate_type_destructor_is_inherited", &_inPU7VHobo6, METH_VARARGS }, - { "interrogate_type_get_destructor", &_inPU7VHjevK, METH_VARARGS }, - { "interrogate_type_number_of_elements", &_inPU7VHeBpM, METH_VARARGS }, - { "interrogate_type_get_element", &_inPU7VHfmeN, METH_VARARGS }, - { "interrogate_type_number_of_methods", &_inPU7VHKBCl, METH_VARARGS }, - { "interrogate_type_get_method", &_inPU7VH936K, METH_VARARGS }, - { "interrogate_type_number_of_make_seqs", &_inPU7VHPPXQ, METH_VARARGS }, - { "interrogate_type_get_make_seq", &_inPU7VHnu86, METH_VARARGS }, - { "interrogate_type_number_of_casts", &_inPU7VHngiq, METH_VARARGS }, - { "interrogate_type_get_cast", &_inPU7VHUXR0, METH_VARARGS }, - { "interrogate_type_number_of_derivations", &_inPU7VHDO7D, METH_VARARGS }, - { "interrogate_type_get_derivation", &_inPU7VHhZFz, METH_VARARGS }, - { "interrogate_type_derivation_has_upcast", &_inPU7VHnKPe, METH_VARARGS }, - { "interrogate_type_get_upcast", &_inPU7VHP3lS, METH_VARARGS }, - { "interrogate_type_derivation_downcast_is_impossible", &_inPU7VHUlLp, METH_VARARGS }, - { "interrogate_type_derivation_has_downcast", &_inPU7VH9Xei, METH_VARARGS }, - { "interrogate_type_get_downcast", &_inPU7VHaGkE, METH_VARARGS }, - { "interrogate_type_number_of_nested_types", &_inPU7VHoe_l, METH_VARARGS }, - { "interrogate_type_get_nested_type", &_inPU7VHuEdH, METH_VARARGS }, + { "interrogate_type_name", &_inPU7VHqWOw, METH_VARARGS }, + { "interrogate_type_scoped_name", &_inPU7VHHu7x, METH_VARARGS }, + { "interrogate_type_true_name", &_inPU7VHwGnA, METH_VARARGS }, + { "interrogate_type_is_nested", &_inPU7VHXGxx, METH_VARARGS }, + { "interrogate_type_outer_class", &_inPU7VHj04Z, METH_VARARGS }, + { "interrogate_type_has_comment", &_inPU7VHEOv4, METH_VARARGS }, + { "interrogate_type_comment", &_inPU7VHpCqJ, METH_VARARGS }, + { "interrogate_type_has_module_name", &_inPU7VH_Pz3, METH_VARARGS }, + { "interrogate_type_module_name", &_inPU7VHt_06, METH_VARARGS }, + { "interrogate_type_has_library_name", &_inPU7VHmuPs, METH_VARARGS }, + { "interrogate_type_library_name", &_inPU7VHvM8B, METH_VARARGS }, + { "interrogate_type_is_atomic", &_inPU7VHap97, METH_VARARGS }, + { "interrogate_type_atomic_token", &_inPU7VH0o8D, METH_VARARGS }, + { "interrogate_type_is_unsigned", &_inPU7VHOoQ2, METH_VARARGS }, + { "interrogate_type_is_signed", &_inPU7VHKuFh, METH_VARARGS }, + { "interrogate_type_is_long", &_inPU7VHo5L6, METH_VARARGS }, + { "interrogate_type_is_longlong", &_inPU7VHzgKK, METH_VARARGS }, + { "interrogate_type_is_short", &_inPU7VH0FIF, METH_VARARGS }, + { "interrogate_type_is_wrapped", &_inPU7VHZqvD, METH_VARARGS }, + { "interrogate_type_is_pointer", &_inPU7VHDyRd, METH_VARARGS }, + { "interrogate_type_is_const", &_inPU7VHMnKa, METH_VARARGS }, + { "interrogate_type_is_typedef", &_inPU7VHRtji, METH_VARARGS }, + { "interrogate_type_wrapped_type", &_inPU7VHCnbQ, METH_VARARGS }, + { "interrogate_type_is_enum", &_inPU7VHdUVN, METH_VARARGS }, + { "interrogate_type_number_of_enum_values", &_inPU7VHihbt, METH_VARARGS }, + { "interrogate_type_enum_value_name", &_inPU7VHbyPY, METH_VARARGS }, + { "interrogate_type_enum_value_scoped_name", &_inPU7VHAaT6, METH_VARARGS }, + { "interrogate_type_enum_value_comment", &_inPU7VHgL9q, METH_VARARGS }, + { "interrogate_type_enum_value", &_inPU7VHWB97, METH_VARARGS }, + { "interrogate_type_is_struct", &_inPU7VHDUAl, METH_VARARGS }, + { "interrogate_type_is_class", &_inPU7VH1_Kf, METH_VARARGS }, + { "interrogate_type_is_union", &_inPU7VH98lD, METH_VARARGS }, + { "interrogate_type_is_fully_defined", &_inPU7VH9SHr, METH_VARARGS }, + { "interrogate_type_is_unpublished", &_inPU7VHdiZP, METH_VARARGS }, + { "interrogate_type_number_of_constructors", &_inPU7VHTdER, METH_VARARGS }, + { "interrogate_type_get_constructor", &_inPU7VHYO56, METH_VARARGS }, + { "interrogate_type_has_destructor", &_inPU7VHxtCG, METH_VARARGS }, + { "interrogate_type_destructor_is_inherited", &_inPU7VH_EB2, METH_VARARGS }, + { "interrogate_type_get_destructor", &_inPU7VHEG1l, METH_VARARGS }, + { "interrogate_type_number_of_elements", &_inPU7VH7tUq, METH_VARARGS }, + { "interrogate_type_get_element", &_inPU7VHyStU, METH_VARARGS }, + { "interrogate_type_number_of_methods", &_inPU7VHdM85, METH_VARARGS }, + { "interrogate_type_get_method", &_inPU7VHk_GN, METH_VARARGS }, + { "interrogate_type_number_of_make_seqs", &_inPU7VH8QjG, METH_VARARGS }, + { "interrogate_type_get_make_seq", &_inPU7VHyMtj, METH_VARARGS }, + { "interrogate_type_number_of_casts", &_inPU7VHHDtN, METH_VARARGS }, + { "interrogate_type_get_cast", &_inPU7VHHFjA, METH_VARARGS }, + { "interrogate_type_number_of_derivations", &_inPU7VH_NPR, METH_VARARGS }, + { "interrogate_type_get_derivation", &_inPU7VHcTOH, METH_VARARGS }, + { "interrogate_type_derivation_has_upcast", &_inPU7VHhdU7, METH_VARARGS }, + { "interrogate_type_get_upcast", &_inPU7VHQPxU, METH_VARARGS }, + { "interrogate_type_derivation_downcast_is_impossible", &_inPU7VHO7Pz, METH_VARARGS }, + { "interrogate_type_derivation_has_downcast", &_inPU7VHvu_E, METH_VARARGS }, + { "interrogate_type_get_downcast", &_inPU7VHxGUt, METH_VARARGS }, + { "interrogate_type_number_of_nested_types", &_inPU7VHzM1P, METH_VARARGS }, + { "interrogate_type_get_nested_type", &_inPU7VHoY5L, METH_VARARGS }, { NULL, NULL } }; From 76e135b835b09fcba29b4bd4044f6e26da8d6e31 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 15 Apr 2015 21:58:54 +0200 Subject: [PATCH 53/73] Improve behaviour of get_deactivation_enabled/is_deactivation_enabled --- panda/src/bullet/bulletBodyNode.cxx | 21 +++++++++++++-------- panda/src/bullet/bulletBodyNode.h | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index ef1a68df96..8a82b92577 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -155,6 +155,8 @@ output(ostream &out) const { out << " (" << get_num_shapes() << " shapes)"; + out << (is_active() ? " active" : " inactive"); + if (is_static()) out << " static"; if (is_kinematic()) out << " kinematic"; } @@ -448,19 +450,22 @@ set_active(bool active, bool force) { //////////////////////////////////////////////////////////////////// // Function: BulletBodyNode::set_deactivation_enabled // Access: Published -// Description: +// Description: If true, this object will be deactivated after a +// certain amount of time has passed without movement. +// If false, the object will always remain active. //////////////////////////////////////////////////////////////////// void BulletBodyNode:: -set_deactivation_enabled(const bool enabled, const bool force) { +set_deactivation_enabled(bool enabled) { - int state = (enabled) ? WANTS_DEACTIVATION : DISABLE_DEACTIVATION; + // Don't change the state if it's currently active and we enable + // deactivation. + if (enabled != is_deactivation_enabled()) { - if (force) { + // It's OK to set to ACTIVE_TAG even if we don't mean to activate it; it + // will be disabled right away if the deactivation timer has run out. + int state = (enabled) ? ACTIVE_TAG : DISABLE_DEACTIVATION; get_object()->forceActivationState(state); } - else { - get_object()->setActivationState(state); - } } //////////////////////////////////////////////////////////////////// @@ -471,7 +476,7 @@ set_deactivation_enabled(const bool enabled, const bool force) { bool BulletBodyNode:: is_deactivation_enabled() const { - return (get_object()->getActivationState() & DISABLE_DEACTIVATION) == 0; + return (get_object()->getActivationState() != DISABLE_DEACTIVATION); } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/bullet/bulletBodyNode.h b/panda/src/bullet/bulletBodyNode.h index 59c1ecb32c..eda0fb30f0 100644 --- a/panda/src/bullet/bulletBodyNode.h +++ b/panda/src/bullet/bulletBodyNode.h @@ -82,7 +82,7 @@ PUBLISHED: void set_deactivation_time(PN_stdfloat dt); PN_stdfloat get_deactivation_time() const; - void set_deactivation_enabled(const bool enabled, const bool force=false); + void set_deactivation_enabled(bool enabled); bool is_deactivation_enabled() const; // Debug Visualistion From 38ac0401ce19ff326ee54f451782efef2c508d07 Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 15 Apr 2015 22:00:30 +0200 Subject: [PATCH 54/73] A start to make Bullet objects writable (to .bam files) --- panda/src/bullet/bulletBodyNode.cxx | 133 ++++++++++++++++++++++- panda/src/bullet/bulletBodyNode.h | 13 ++- panda/src/bullet/bulletBoxShape.cxx | 65 ++++++++++- panda/src/bullet/bulletBoxShape.h | 12 +- panda/src/bullet/bulletPlaneShape.cxx | 69 +++++++++++- panda/src/bullet/bulletPlaneShape.h | 12 +- panda/src/bullet/bulletRigidBodyNode.cxx | 99 +++++++++++++++++ panda/src/bullet/bulletRigidBodyNode.h | 13 ++- panda/src/bullet/bulletShape.h | 8 +- panda/src/bullet/bulletSphereShape.cxx | 62 ++++++++++- panda/src/bullet/bulletSphereShape.h | 12 +- panda/src/bullet/config_bullet.cxx | 6 + panda/src/putil/bam.h | 3 +- panda/src/putil/bamReader.cxx | 12 +- panda/src/putil/bamReader.h | 2 +- 15 files changed, 500 insertions(+), 21 deletions(-) diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index 8a82b92577..24274f9ff5 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -342,7 +342,16 @@ LPoint3 BulletBodyNode:: get_shape_pos(int idx) const { nassertr(idx >= 0 && idx < (int)_shapes.size(), LPoint3::zero()); - return get_shape_mat(idx).get_row3(3); + + btCollisionShape *root = get_object()->getCollisionShape(); + if (root->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) { + btCompoundShape *compound = (btCompoundShape *)root; + + btTransform trans = compound->getChildTransform(idx); + return btVector3_to_LVector3(trans.getOrigin()); + } + + return LPoint3::zero(); } //////////////////////////////////////////////////////////////////// @@ -352,15 +361,24 @@ get_shape_pos(int idx) const { //////////////////////////////////////////////////////////////////// LMatrix4 BulletBodyNode:: get_shape_mat(int idx) const { + return get_shape_transform(idx)->get_mat(); +} - nassertr(idx >= 0 && idx < (int)_shapes.size(), LMatrix4::ident_mat()); +//////////////////////////////////////////////////////////////////// +// Function: BulletBodyNode::get_shape_transform +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +CPT(TransformState) BulletBodyNode:: +get_shape_transform(int idx) const { + nassertr(idx >= 0 && idx < (int)_shapes.size(), TransformState::make_identity()); btCollisionShape *root = get_object()->getCollisionShape(); if (root->getShapeType() == COMPOUND_SHAPE_PROXYTYPE) { btCompoundShape *compound = (btCompoundShape *)root; btTransform trans = compound->getChildTransform(idx); - return btTrans_to_LMatrix4(trans); + return btTrans_to_TransformState(trans); // The above code assumes that shape's index in _shapes member // is the same as the shapes index within the compound. If it @@ -377,7 +395,7 @@ get_shape_mat(int idx) const { */ } - return LMatrix4::ident_mat(); + return TransformState::make_identity(); } //////////////////////////////////////////////////////////////////// @@ -705,3 +723,110 @@ cout << "origin " << aabbMin.x() << " " << aabbMin.y() << " " << aabbMin.z() << return bounds; } +//////////////////////////////////////////////////////////////////// +// Function: BulletBodyNode::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletBodyNode:: +write_datagram(BamWriter *manager, Datagram &dg) { + PandaNode::write_datagram(manager, dg); + + dg.add_bool(is_static()); + dg.add_bool(is_kinematic()); + dg.add_bool(notifies_collisions()); + dg.add_bool(get_collision_response()); + dg.add_stdfloat(get_contact_processing_threshold()); + //dg.add_bool(is_active()); + dg.add_stdfloat(get_deactivation_time()); + dg.add_bool(is_deactivation_enabled()); + //dg.add_bool(is_debug_enabled()); + dg.add_stdfloat(get_restitution()); + dg.add_stdfloat(get_friction()); +#if BT_BULLET_VERSION >= 281 + dg.add_stdfloat(get_rolling_friction()); +#else + dg.add_stdfloat(0); +#endif + if (has_anisotropic_friction()) { + dg.add_bool(true); + get_anisotropic_friction().write_datagram(dg); + } else { + dg.add_bool(false); + } + dg.add_stdfloat(get_ccd_swept_sphere_radius()); + dg.add_stdfloat(get_ccd_motion_threshold()); + + for (int i = 0; i < _shapes.size(); ++i) { + manager->write_pointer(dg, get_shape(i)); + manager->write_pointer(dg, get_shape_transform(i)); + } + + // Write NULL pointer to indicate the end of the list. + manager->write_pointer(dg, NULL); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletBodyNode::complete_pointers +// Access: Public, Virtual +// Description: Receives an array of pointers, one for each time +// manager->read_pointer() was called in fillin(). +// Returns the number of pointers processed. +//////////////////////////////////////////////////////////////////// +int BulletBodyNode:: +complete_pointers(TypedWritable **p_list, BamReader *manager) { + int pi = PandaNode::complete_pointers(p_list, manager); + + BulletShape *shape = DCAST(BulletShape, p_list[pi++]); + + while (shape != (BulletShape *)NULL) { + const TransformState *trans = DCAST(TransformState, p_list[pi++]); + add_shape(shape, trans); + + shape = DCAST(BulletShape, p_list[pi++]); + } + + return pi; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletBodyNode::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletBodyNode. +//////////////////////////////////////////////////////////////////// +void BulletBodyNode:: +fillin(DatagramIterator &scan, BamReader *manager) { + PandaNode::fillin(scan, manager); + + set_static(scan.get_bool()); + set_kinematic(scan.get_bool()); + notify_collisions(scan.get_bool()); + set_collision_response(scan.get_bool()); + set_contact_processing_threshold(scan.get_stdfloat()); + //set_active(scan.get_bool(), true); + set_deactivation_time(scan.get_stdfloat()); + set_deactivation_enabled(scan.get_bool()); + set_restitution(scan.get_stdfloat()); + set_friction(scan.get_stdfloat()); +#if BT_BULLET_VERSION >= 281 + set_rolling_friction(scan.get_stdfloat()); +#else + scan.get_stdfloat(); +#endif + if (scan.get_bool()) { + LVector3 friction; + friction.read_datagram(scan); + set_anisotropic_friction(friction); + } + set_ccd_swept_sphere_radius(scan.get_stdfloat()); + set_ccd_motion_threshold(scan.get_stdfloat()); + + // Read shapes. The list is bounded by a NULL pointer. + while (manager->read_pointer(scan)) { + // Each shape comes with a TransformState. + manager->read_pointer(scan); + } +} diff --git a/panda/src/bullet/bulletBodyNode.h b/panda/src/bullet/bulletBodyNode.h index eda0fb30f0..8c50b67fae 100644 --- a/panda/src/bullet/bulletBodyNode.h +++ b/panda/src/bullet/bulletBodyNode.h @@ -33,9 +33,10 @@ class BulletShape; // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDABULLET BulletBodyNode : public PandaNode { +protected: + BulletBodyNode(const char *name); PUBLISHED: - BulletBodyNode(const char *name); INLINE ~BulletBodyNode(); // Shapes @@ -48,6 +49,7 @@ PUBLISHED: LPoint3 get_shape_pos(int idx) const; LMatrix4 get_shape_mat(int idx) const; + CPT(TransformState) get_shape_transform(int idx) const; BoundingSphere get_shape_bounds() const; void add_shapes_from_collision_solids(CollisionNode *cnode); @@ -142,7 +144,14 @@ private: static bool is_identity(btTransform &trans); -//////////////////////////////////////////////////////////////////// +public: + virtual void write_datagram(BamWriter *manager, Datagram &dg); + virtual int complete_pointers(TypedWritable **plist, + BamReader *manager); + +protected: + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/bulletBoxShape.cxx b/panda/src/bullet/bulletBoxShape.cxx index 6f8bec8a7d..1d1996521a 100644 --- a/panda/src/bullet/bulletBoxShape.cxx +++ b/panda/src/bullet/bulletBoxShape.cxx @@ -66,7 +66,7 @@ get_half_extents_with_margin() const { //////////////////////////////////////////////////////////////////// // Function: BulletBoxShape::make_from_solid -// Access: Public +// Access: Public, Static // Description: //////////////////////////////////////////////////////////////////// BulletBoxShape *BulletBoxShape:: @@ -82,3 +82,66 @@ make_from_solid(const CollisionBox *solid) { return new BulletBoxShape(extents); } +//////////////////////////////////////////////////////////////////// +// Function: BulletBoxShape::register_with_read_factory +// Access: Public, Static +// Description: Tells the BamReader how to create objects of type +// BulletShape. +//////////////////////////////////////////////////////////////////// +void BulletBoxShape:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletBoxShape::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletBoxShape:: +write_datagram(BamWriter *manager, Datagram &dg) { + dg.add_stdfloat(get_margin()); + get_half_extents_with_margin().write_datagram(dg); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletBoxShape::make_from_bam +// Access: Protected, Static +// Description: This function is called by the BamReader's factory +// when a new object of type BulletShape is encountered +// in the Bam file. It should create the BulletShape +// and extract its information from the file. +//////////////////////////////////////////////////////////////////// +TypedWritable *BulletBoxShape:: +make_from_bam(const FactoryParams ¶ms) { + BulletBoxShape *param = new BulletBoxShape; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletBoxShape::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletShape. +//////////////////////////////////////////////////////////////////// +void BulletBoxShape:: +fillin(DatagramIterator &scan, BamReader *manager) { + nassertv(_shape == NULL); + + PN_stdfloat margin = scan.get_stdfloat(); + + LVector3 half_extents; + half_extents.read_datagram(scan); + + _shape = new btBoxShape(LVecBase3_to_btVector3(half_extents)); + _shape->setUserPointer(this); + _shape->setMargin(margin); +} diff --git a/panda/src/bullet/bulletBoxShape.h b/panda/src/bullet/bulletBoxShape.h index 90680cbee5..4485689eeb 100644 --- a/panda/src/bullet/bulletBoxShape.h +++ b/panda/src/bullet/bulletBoxShape.h @@ -29,6 +29,9 @@ // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDABULLET BulletBoxShape : public BulletShape { +private: + // Only used by make_from_bam + INLINE BulletBoxShape() : _shape(NULL) {}; PUBLISHED: BulletBoxShape(const LVecBase3 &halfExtents); @@ -47,7 +50,14 @@ public: private: btBoxShape *_shape; -//////////////////////////////////////////////////////////////////// +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/bulletPlaneShape.cxx b/panda/src/bullet/bulletPlaneShape.cxx index 9054b46a00..0cfa590ee1 100644 --- a/panda/src/bullet/bulletPlaneShape.cxx +++ b/panda/src/bullet/bulletPlaneShape.cxx @@ -43,7 +43,7 @@ ptr() const { //////////////////////////////////////////////////////////////////// // Function: BulletPlaneShape::make_from_solid -// Access: Public +// Access: Public, Static // Description: //////////////////////////////////////////////////////////////////// BulletPlaneShape *BulletPlaneShape:: @@ -55,3 +55,70 @@ make_from_solid(const CollisionPlane *solid) { return new BulletPlaneShape(normal, constant); } +//////////////////////////////////////////////////////////////////// +// Function: BulletPlaneShape::register_with_read_factory +// Access: Public, Static +// Description: Tells the BamReader how to create objects of type +// BulletShape. +//////////////////////////////////////////////////////////////////// +void BulletPlaneShape:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletPlaneShape::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletPlaneShape:: +write_datagram(BamWriter *manager, Datagram &dg) { + dg.add_stdfloat(get_margin()); + get_plane_normal().write_datagram(dg); + dg.add_stdfloat(get_plane_constant()); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletPlaneShape::make_from_bam +// Access: Protected, Static +// Description: This function is called by the BamReader's factory +// when a new object of type BulletShape is encountered +// in the Bam file. It should create the BulletShape +// and extract its information from the file. +//////////////////////////////////////////////////////////////////// +TypedWritable *BulletPlaneShape:: +make_from_bam(const FactoryParams ¶ms) { + BulletPlaneShape *param = new BulletPlaneShape; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletPlaneShape::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletShape. +//////////////////////////////////////////////////////////////////// +void BulletPlaneShape:: +fillin(DatagramIterator &scan, BamReader *manager) { + nassertv(_shape == NULL); + + PN_stdfloat margin = scan.get_stdfloat(); + + LVector3 normal; + normal.read_datagram(scan); + + PN_stdfloat constant = scan.get_stdfloat(); + + _shape = new btStaticPlaneShape(LVecBase3_to_btVector3(normal), constant); + _shape->setUserPointer(this); + _shape->setMargin(margin); +} + diff --git a/panda/src/bullet/bulletPlaneShape.h b/panda/src/bullet/bulletPlaneShape.h index 0cff63d341..545289fcc6 100644 --- a/panda/src/bullet/bulletPlaneShape.h +++ b/panda/src/bullet/bulletPlaneShape.h @@ -29,6 +29,9 @@ // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDABULLET BulletPlaneShape : public BulletShape { +private: + // Only used by make_from_bam + INLINE BulletPlaneShape() : _shape(NULL) {}; PUBLISHED: BulletPlaneShape(const LVector3 &normal, PN_stdfloat constant); @@ -47,7 +50,14 @@ public: private: btStaticPlaneShape *_shape; -//////////////////////////////////////////////////////////////////// +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/bulletRigidBodyNode.cxx b/panda/src/bullet/bulletRigidBodyNode.cxx index c101a3b00c..718f83237d 100644 --- a/panda/src/bullet/bulletRigidBodyNode.cxx +++ b/panda/src/bullet/bulletRigidBodyNode.cxx @@ -490,6 +490,28 @@ get_gravity() const { return btVector3_to_LVector3(_rigid->getGravity()); } +//////////////////////////////////////////////////////////////////// +// Function: BulletRigidBodyNode::get_linear_factor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +LVector3 BulletRigidBodyNode:: +get_linear_factor() const { + + return btVector3_to_LVector3(_rigid->getLinearFactor()); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletRigidBodyNode::get_angular_factor +// Access: Published +// Description: +//////////////////////////////////////////////////////////////////// +LVector3 BulletRigidBodyNode:: +get_angular_factor() const { + + return btVector3_to_LVector3(_rigid->getAngularFactor()); +} + //////////////////////////////////////////////////////////////////// // Function: BulletRigidBodyNode::set_linear_factor // Access: Published @@ -650,3 +672,80 @@ pick_dirty_flag() { return _motion->pick_dirty_flag(); } +//////////////////////////////////////////////////////////////////// +// Function: BulletRigidBodyNode::register_with_read_factory +// Access: Public, Static +// Description: Tells the BamReader how to create objects of type +// BulletRigidBodyNode. +//////////////////////////////////////////////////////////////////// +void BulletRigidBodyNode:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletRigidBodyNode::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletRigidBodyNode:: +write_datagram(BamWriter *manager, Datagram &dg) { + BulletBodyNode::write_datagram(manager, dg); + + dg.add_stdfloat(get_mass()); + dg.add_stdfloat(get_linear_damping()); + dg.add_stdfloat(get_angular_damping()); + dg.add_stdfloat(get_linear_sleep_threshold()); + dg.add_stdfloat(get_angular_sleep_threshold()); + get_gravity().write_datagram(dg); + get_linear_factor().write_datagram(dg); + get_angular_factor().write_datagram(dg); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletRigidBodyNode::make_from_bam +// Access: Protected, Static +// Description: This function is called by the BamReader's factory +// when a new object of this type is encountered +// in the Bam file. It should create the rigid body +// and extract its information from the file. +//////////////////////////////////////////////////////////////////// +TypedWritable *BulletRigidBodyNode:: +make_from_bam(const FactoryParams ¶ms) { + BulletRigidBodyNode *param = new BulletRigidBodyNode; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletRigidBodyNode::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletRigidBodyNode. +//////////////////////////////////////////////////////////////////// +void BulletRigidBodyNode:: +fillin(DatagramIterator &scan, BamReader *manager) { + BulletBodyNode::fillin(scan, manager); + + set_mass(scan.get_stdfloat()); + set_linear_damping(scan.get_stdfloat()); + set_angular_damping(scan.get_stdfloat()); + set_linear_sleep_threshold(scan.get_stdfloat()); + set_angular_sleep_threshold(scan.get_stdfloat()); + + LVector3 gravity, linear_factor, angular_factor; + gravity.read_datagram(scan); + linear_factor.read_datagram(scan); + angular_factor.read_datagram(scan); + + set_gravity(gravity); + set_linear_factor(linear_factor); + set_angular_factor(angular_factor); +} diff --git a/panda/src/bullet/bulletRigidBodyNode.h b/panda/src/bullet/bulletRigidBodyNode.h index 05538f67cf..73ba5568a3 100644 --- a/panda/src/bullet/bulletRigidBodyNode.h +++ b/panda/src/bullet/bulletRigidBodyNode.h @@ -80,6 +80,8 @@ PUBLISHED: LVector3 get_gravity() const; // Restrict movement + LVector3 get_linear_factor() const; + LVector3 get_angular_factor() const; void set_linear_factor(const LVector3 &factor); void set_angular_factor(const LVector3 &factor); @@ -100,7 +102,7 @@ protected: private: virtual void shape_changed(); - // The motion state is used for syncronisation between Bullet + // The motion state is used for synchronisation between Bullet // and the Panda3D scene graph. class MotionState : public btMotionState { @@ -127,7 +129,14 @@ private: MotionState *_motion; btRigidBody *_rigid; -//////////////////////////////////////////////////////////////////// +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/bulletShape.h b/panda/src/bullet/bulletShape.h index de98ebf1eb..3666f2030a 100644 --- a/panda/src/bullet/bulletShape.h +++ b/panda/src/bullet/bulletShape.h @@ -26,7 +26,9 @@ // Class : BulletShape // Description : //////////////////////////////////////////////////////////////////// -class EXPCL_PANDABULLET BulletShape : public TypedReferenceCount { +class EXPCL_PANDABULLET BulletShape : public TypedWritableReferenceCount { +protected: + INLINE BulletShape() {}; PUBLISHED: INLINE virtual ~BulletShape(); @@ -58,9 +60,9 @@ public: return _type_handle; } static void init_type() { - TypedReferenceCount::init_type(); + TypedWritableReferenceCount::init_type(); register_type(_type_handle, "BulletShape", - TypedReferenceCount::get_class_type()); + TypedWritableReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/bullet/bulletSphereShape.cxx b/panda/src/bullet/bulletSphereShape.cxx index 8e66d64edc..cfc7375983 100644 --- a/panda/src/bullet/bulletSphereShape.cxx +++ b/panda/src/bullet/bulletSphereShape.cxx @@ -41,7 +41,7 @@ ptr() const { //////////////////////////////////////////////////////////////////// // Function: BulletSphereShape::make_from_solid -// Access: Public +// Access: Public, Static // Description: //////////////////////////////////////////////////////////////////// BulletSphereShape *BulletSphereShape:: @@ -50,3 +50,63 @@ make_from_solid(const CollisionSphere *solid) { return new BulletSphereShape(solid->get_radius()); } +//////////////////////////////////////////////////////////////////// +// Function: BulletSphereShape::register_with_read_factory +// Access: Public, Static +// Description: Tells the BamReader how to create objects of type +// BulletShape. +//////////////////////////////////////////////////////////////////// +void BulletSphereShape:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSphereShape::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletSphereShape:: +write_datagram(BamWriter *manager, Datagram &dg) { + dg.add_stdfloat(get_margin()); + dg.add_stdfloat(get_radius()); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSphereShape::make_from_bam +// Access: Protected, Static +// Description: This function is called by the BamReader's factory +// when a new object of type BulletShape is encountered +// in the Bam file. It should create the BulletShape +// and extract its information from the file. +//////////////////////////////////////////////////////////////////// +TypedWritable *BulletSphereShape:: +make_from_bam(const FactoryParams ¶ms) { + BulletSphereShape *param = new BulletSphereShape; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletSphereShape::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletShape. +//////////////////////////////////////////////////////////////////// +void BulletSphereShape:: +fillin(DatagramIterator &scan, BamReader *manager) { + nassertv(_shape == NULL); + + PN_stdfloat margin = scan.get_stdfloat(); + + _shape = new btSphereShape(scan.get_stdfloat()); + _shape->setUserPointer(this); + _shape->setMargin(margin); +} diff --git a/panda/src/bullet/bulletSphereShape.h b/panda/src/bullet/bulletSphereShape.h index 9bebd1d24d..c2c3331a4d 100644 --- a/panda/src/bullet/bulletSphereShape.h +++ b/panda/src/bullet/bulletSphereShape.h @@ -28,6 +28,9 @@ // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDABULLET BulletSphereShape : public BulletShape { +private: + // Only used by make_from_bam + INLINE BulletSphereShape() : _shape(NULL) {}; PUBLISHED: BulletSphereShape(PN_stdfloat radius); @@ -45,7 +48,14 @@ public: private: btSphereShape *_shape; -//////////////////////////////////////////////////////////////////// +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/config_bullet.cxx b/panda/src/bullet/config_bullet.cxx index 620b7b71e0..4448a1c16b 100644 --- a/panda/src/bullet/config_bullet.cxx +++ b/panda/src/bullet/config_bullet.cxx @@ -182,6 +182,12 @@ init_libbullet() { BulletVehicle::init_type(); BulletWorld::init_type(); + // Register factory functions for constructing objects from .bam files + BulletBoxShape::register_with_read_factory(); + BulletPlaneShape::register_with_read_factory(); + BulletRigidBodyNode::register_with_read_factory(); + BulletSphereShape::register_with_read_factory(); + // Custom contact callbacks gContactAddedCallback = contact_added_callback; gContactProcessedCallback = contact_processed_callback; diff --git a/panda/src/putil/bam.h b/panda/src/putil/bam.h index 55916dd228..1929dcab3b 100644 --- a/panda/src/putil/bam.h +++ b/panda/src/putil/bam.h @@ -33,7 +33,7 @@ static const unsigned short _bam_major_ver = 6; // Bumped to major version 6 on 2/11/06 to factor out PandaNode::CData. static const unsigned short _bam_first_minor_ver = 14; -static const unsigned short _bam_minor_ver = 37; +static const unsigned short _bam_minor_ver = 38; // Bumped to minor version 14 on 12/19/07 to change default ColorAttrib. // Bumped to minor version 15 on 4/9/08 to add TextureAttrib::_implicit_sort. // Bumped to minor version 16 on 5/13/08 to add Texture::_quality_level. @@ -58,5 +58,6 @@ static const unsigned short _bam_minor_ver = 37; // Bumped to minor version 35 on 12/3/14 to change StencilAttrib. // Bumped to minor version 36 on 12/9/14 to add samplers and lod settings. // Bumped to minor version 37 on 1/22/15 to add GeomVertexArrayFormat::_divisor. +// Bumped to minor version 38 on 4/15/15 to add various Bullet classes. #endif diff --git a/panda/src/putil/bamReader.cxx b/panda/src/putil/bamReader.cxx index b6ded7b654..2c7ed67416 100644 --- a/panda/src/putil/bamReader.cxx +++ b/panda/src/putil/bamReader.cxx @@ -647,12 +647,16 @@ read_handle(DatagramIterator &scan) { // read_pointer() was called. It is then the calling // object's responsibility to store these pointers in the // object properly. +// +// We don't know what the final pointer will be yet, +// but we do know whether it was NULL, so this method +// returns true if the pointer is non-NULL, false if NULL. //////////////////////////////////////////////////////////////////// -void BamReader:: +bool BamReader:: read_pointer(DatagramIterator &scan) { Thread::consider_yield(); - nassertv(_now_creating != _created_objs.end()); + nassertr(_now_creating != _created_objs.end(), false); int requestor_id = (*_now_creating).first; // Read the object ID, and associate it with the requesting object. @@ -680,6 +684,10 @@ read_pointer(DatagramIterator &scan) { // object for each non-NULL pointer we read. _num_extra_objects++; } + + return true; + } else { + return false; } } diff --git a/panda/src/putil/bamReader.h b/panda/src/putil/bamReader.h index 30a9dd157c..9c65856ae7 100644 --- a/panda/src/putil/bamReader.h +++ b/panda/src/putil/bamReader.h @@ -163,7 +163,7 @@ PUBLISHED: public: // Functions to support classes that read themselves from the Bam. - void read_pointer(DatagramIterator &scan); + bool read_pointer(DatagramIterator &scan); void read_pointers(DatagramIterator &scan, int count); void skip_pointer(DatagramIterator &scan); From 2ff9083812aa20f667a03b1917670fc7ceda9533 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 16 Apr 2015 16:55:29 +0200 Subject: [PATCH 55/73] Add support for buffer textures --- panda/src/display/graphicsStateGuardian.I | 26 +++ panda/src/display/graphicsStateGuardian.cxx | 2 + panda/src/display/graphicsStateGuardian.h | 4 + .../glstuff/glGraphicsStateGuardian_src.cxx | 155 +++++++++++++++--- .../src/glstuff/glGraphicsStateGuardian_src.h | 4 + panda/src/glstuff/glShaderContext_src.cxx | 26 ++- panda/src/glstuff/glTextureContext_src.I | 1 + panda/src/glstuff/glTextureContext_src.cxx | 10 ++ panda/src/glstuff/glTextureContext_src.h | 3 + panda/src/gobj/texture.I | 32 ++++ panda/src/gobj/texture.cxx | 31 +++- panda/src/gobj/texture.h | 6 + 12 files changed, 274 insertions(+), 26 deletions(-) diff --git a/panda/src/display/graphicsStateGuardian.I b/panda/src/display/graphicsStateGuardian.I index a4cea5ffc3..9cfa0e3fed 100644 --- a/panda/src/display/graphicsStateGuardian.I +++ b/panda/src/display/graphicsStateGuardian.I @@ -397,6 +397,22 @@ get_max_cube_map_dimension() const { return _max_cube_map_dimension; } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsStateGuardian::get_max_buffer_texture_size +// Access: Published +// Description: Returns the largest possible buffer texture size, +// or -1 if there is no particular limit. Returns 0 +// if cube map textures are not supported. +// +// The value returned may not be meaningful until after +// the graphics context has been fully created (e.g. the +// window has been opened). +//////////////////////////////////////////////////////////////////// +INLINE int GraphicsStateGuardian:: +get_max_buffer_texture_size() const { + return _max_buffer_texture_size; +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsStateGuardian::get_supports_texture_combine // Access: Published @@ -469,6 +485,16 @@ get_supports_cube_map() const { return _supports_cube_map; } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsStateGuardian::get_supports_buffer_texture +// Access: Published +// Description: Returns true if this GSG can render buffer textures. +//////////////////////////////////////////////////////////////////// +INLINE bool GraphicsStateGuardian:: +get_supports_buffer_texture() const { + return _supports_buffer_texture; +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsStateGuardian::get_supports_tex_non_pow2 // Access: Published diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index 1263339604..41cc8315ea 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -185,6 +185,7 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system, _max_3d_texture_dimension = 0; _max_2d_texture_array_layers = 0; _max_cube_map_dimension = 0; + _max_buffer_texture_size = 0; // Assume we don't support these fairly advanced texture combiner // modes. @@ -195,6 +196,7 @@ GraphicsStateGuardian(CoordinateSystem internal_coordinate_system, _supports_3d_texture = false; _supports_2d_texture_array = false; _supports_cube_map = false; + _supports_buffer_texture = false; _supports_tex_non_pow2 = false; _supports_texture_srgb = false; _supports_compressed_texture = false; diff --git a/panda/src/display/graphicsStateGuardian.h b/panda/src/display/graphicsStateGuardian.h index b546a61945..7e9d8b6f47 100644 --- a/panda/src/display/graphicsStateGuardian.h +++ b/panda/src/display/graphicsStateGuardian.h @@ -121,6 +121,7 @@ PUBLISHED: INLINE int get_max_3d_texture_dimension() const; INLINE int get_max_2d_texture_array_layers() const; //z axis INLINE int get_max_cube_map_dimension() const; + INLINE int get_max_buffer_texture_size() const; INLINE bool get_supports_texture_combine() const; INLINE bool get_supports_texture_saved_result() const; @@ -129,6 +130,7 @@ PUBLISHED: INLINE bool get_supports_3d_texture() const; INLINE bool get_supports_2d_texture_array() const; INLINE bool get_supports_cube_map() const; + INLINE bool get_supports_buffer_texture() const; INLINE bool get_supports_tex_non_pow2() const; INLINE bool get_supports_texture_srgb() const; @@ -476,6 +478,7 @@ protected: int _max_3d_texture_dimension; int _max_2d_texture_array_layers; //on the z axis int _max_cube_map_dimension; + int _max_buffer_texture_size; bool _supports_texture_combine; bool _supports_texture_saved_result; @@ -484,6 +487,7 @@ protected: bool _supports_3d_texture; bool _supports_2d_texture_array; bool _supports_cube_map; + bool _supports_buffer_texture; bool _supports_tex_non_pow2; bool _supports_texture_srgb; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 637bfb63e9..8efef7fd09 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -854,6 +854,17 @@ reset() { } #endif +#ifndef OPENGLES + if (is_at_least_gl_version(3, 0)) { + _glTexBuffer = (PFNGLTEXBUFFERPROC)get_extension_func("glTexBuffer"); + _supports_buffer_texture = true; + + } else if (has_extension("GL_ARB_texture_buffer_object")) { + _glTexBuffer = (PFNGLTEXBUFFERPROC)get_extension_func("glTexBufferARB"); + _supports_buffer_texture = true; + } +#endif + _supports_texture_srgb = false; if (is_at_least_gl_version(2, 1) || has_extension("GL_EXT_texture_sRGB")) { _supports_texture_srgb = true; @@ -1941,6 +1952,7 @@ reset() { GLint max_3d_texture_size = 0; GLint max_2d_texture_array_layers = 0; GLint max_cube_map_size = 0; + GLint max_buffer_texture_size = 0; glGetIntegerv(GL_MAX_TEXTURE_SIZE, &max_texture_size); _max_texture_dimension = max_texture_size; @@ -1966,6 +1978,15 @@ reset() { _max_cube_map_dimension = 0; } +#ifndef OPENGLES + if (_supports_buffer_texture) { + glGetIntegerv(GL_MAX_TEXTURE_BUFFER_SIZE, &max_buffer_texture_size); + _max_buffer_texture_size = max_buffer_texture_size; + } else { + _max_buffer_texture_size = 0; + } +#endif // !OPENGLES + GLint max_elements_vertices = 0, max_elements_indices = 0; #ifndef OPENGLES glGetIntegerv(GL_MAX_ELEMENTS_VERTICES, &max_elements_vertices); @@ -4510,6 +4531,15 @@ prepare_texture(Texture *tex, int view) { << "Cube map textures are not supported by this OpenGL driver.\n"; return NULL; } + break; + + case Texture::TT_buffer_texture: + if (!_supports_buffer_texture) { + GLCAT.warning() + << "Buffer textures are not supported by this OpenGL driver.\n"; + return NULL; + } + break; default: break; @@ -7362,27 +7392,35 @@ get_texture_target(Texture::TextureType texture_type) const { return GL_TEXTURE_2D; case Texture::TT_3d_texture: - if (_supports_3d_texture) { #ifndef OPENGLES_1 + if (_supports_3d_texture) { return GL_TEXTURE_3D; -#endif - } else { - return GL_NONE; } +#endif + return GL_NONE; + case Texture::TT_2d_texture_array: - if (_supports_2d_texture_array) { #ifndef OPENGLES + if (_supports_2d_texture_array) { return GL_TEXTURE_2D_ARRAY_EXT; -#endif - } else { - return GL_NONE; } +#endif + return GL_NONE; + case Texture::TT_cube_map: if (_supports_cube_map) { return GL_TEXTURE_CUBE_MAP; } else { return GL_NONE; } + + case Texture::TT_buffer_texture: +#ifndef OPENGLES + if (_supports_buffer_texture) { + return GL_TEXTURE_BUFFER; + } +#endif + return GL_NONE; } GLCAT.error() << "Invalid Texture::TextureType value!\n"; @@ -10252,6 +10290,12 @@ specify_texture(CLP(TextureContext) *gtc, const SamplerState &sampler) { // Unsupported target (e.g. 3-d texturing on GL 1.1). return false; } +#ifndef OPENGLES + if (target == GL_TEXTURE_BUFFER) { + // Buffer textures may not receive texture parameters. + return false; + } +#endif // OPENGLES // Record the active sampler settings. gtc->_active_sampler = sampler; @@ -10505,7 +10549,8 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { // If we'll use immutable texture storage, we have to pick a sized // image format. - bool force_sized = (gl_immutable_texture_storage && _supports_tex_storage); + bool force_sized = (gl_immutable_texture_storage && _supports_tex_storage) || + (tex->get_texture_type() == Texture::TT_buffer_texture); GLint internal_format = get_internal_image_format(tex, force_sized); GLint external_format = get_external_image_format(tex); @@ -10553,6 +10598,12 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { max_dimension_z = _max_2d_texture_array_layers; break; + case Texture::TT_buffer_texture: + max_dimension_x = _max_buffer_texture_size; + max_dimension_y = 1; + max_dimension_z = 1; + break; + default: max_dimension_x = _max_texture_dimension; max_dimension_y = _max_texture_dimension; @@ -10631,6 +10682,13 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { GLenum target = get_texture_target(tex->get_texture_type()); uses_mipmaps = (uses_mipmaps && !gl_ignore_mipmaps) || gl_force_mipmaps; +#ifndef OPENGLES + if (target == GL_TEXTURE_BUFFER) { + // Buffer textures may not have mipmaps. + uses_mipmaps = false; + } +#endif // OPENGLES + bool needs_reload = false; if (!gtc->_has_storage || gtc->_uses_mipmaps != uses_mipmaps || @@ -10640,6 +10698,12 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { gtc->_depth != depth) { // We need to reload a new GL Texture object. needs_reload = true; + + if (_use_object_labels) { + // This seems like a good time to assign a label for the debug messages. + const string &name = tex->get_name(); + _glObjectLabel(GL_TEXTURE, gtc->_index, name.size(), name.data()); + } } if (needs_reload && gtc->_immutable) { @@ -10648,13 +10712,26 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { glBindTexture(target, gtc->_index); } - if (needs_reload) { - if (_use_object_labels) { - // This seems like a good time to assign a label for the debug messages. - const string &name = tex->get_name(); - _glObjectLabel(GL_TEXTURE, gtc->_index, name.size(), name.data()); - } +#ifndef OPENGLES + if (target == GL_TEXTURE_BUFFER) { + // Buffer textures don't support mipmappping. + gtc->_generate_mipmaps = false; + if (gtc->_buffer == 0) { + // The buffer object wasn't created yet. + _glGenBuffers(1, >c->_buffer); + _glBindBuffer(GL_TEXTURE_BUFFER, gtc->_buffer); + _glTexBuffer(GL_TEXTURE_BUFFER, internal_format, gtc->_buffer); + needs_reload = true; + } else { + _glBindBuffer(GL_TEXTURE_BUFFER, gtc->_buffer); + if (gtc->_internal_format != internal_format) { + _glTexBuffer(GL_TEXTURE_BUFFER, internal_format, gtc->_buffer); + } + } + } else +#endif // !OPENGLES + if (needs_reload) { // Figure out whether mipmaps will be generated by the GPU or by // Panda (or not at all), and how many mipmap levels should be created. gtc->_generate_mipmaps = false; @@ -10736,6 +10813,8 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { } switch (tex->get_texture_type()) { + case Texture::TT_buffer_texture: + // Won't get here, but squelch compiler warning case Texture::TT_1d_texture: _glTexStorage1D(target, num_levels, internal_format, width); break; @@ -11095,6 +11174,17 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload, break; #endif // OPENGLES +#ifndef OPENGLES + case GL_TEXTURE_BUFFER: + if (_supports_buffer_texture) { + _glBufferSubData(GL_TEXTURE_BUFFER, 0, width, image_ptr); + } else { + report_my_gl_errors(); + return false; + } + break; +#endif // OPENGLES + default: if (image_compression == Texture::CM_off) { if (n==0) { @@ -11248,6 +11338,7 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload, } break; #endif + #ifndef OPENGLES case GL_TEXTURE_2D_ARRAY_EXT: if (_supports_2d_texture_array) { @@ -11265,7 +11356,19 @@ upload_texture_image(CLP(TextureContext) *gtc, bool needs_reload, return false; } break; -#endif +#endif // OPENGLES + +#ifndef OPENGLES + case GL_TEXTURE_BUFFER: + if (_supports_buffer_texture) { + _glBufferData(GL_TEXTURE_BUFFER, width, image_ptr, + get_usage(tex->get_usage_hint())); + } else { + report_my_gl_errors(); + return false; + } + break; +#endif // OPENGLES default: if (image_compression == Texture::CM_off) { @@ -11396,6 +11499,12 @@ get_texture_memory_size(Texture *tex) { // We need a particular page to get the level parameter from. page_target = GL_TEXTURE_CUBE_MAP_POSITIVE_X; scale = 6; + + } else if (target == GL_TEXTURE_BUFFER) { + // In the case of buffer textures, we provided the size to begin with, + // so no point in querying anything. Plus, glGetTexParameter is not even + // supported for buffer textures. + return tex->get_expected_ram_image_size(); } GLint minfilter; @@ -11431,20 +11540,20 @@ get_texture_memory_size(Texture *tex) { luminance_size, intensity_size; GLint depth_size = 0; glGetTexLevelParameteriv(page_target, 0, - GL_TEXTURE_RED_SIZE, &red_size); + GL_TEXTURE_RED_SIZE, &red_size); glGetTexLevelParameteriv(page_target, 0, - GL_TEXTURE_GREEN_SIZE, &green_size); + GL_TEXTURE_GREEN_SIZE, &green_size); glGetTexLevelParameteriv(page_target, 0, - GL_TEXTURE_BLUE_SIZE, &blue_size); + GL_TEXTURE_BLUE_SIZE, &blue_size); glGetTexLevelParameteriv(page_target, 0, - GL_TEXTURE_ALPHA_SIZE, &alpha_size); + GL_TEXTURE_ALPHA_SIZE, &alpha_size); glGetTexLevelParameteriv(page_target, 0, - GL_TEXTURE_LUMINANCE_SIZE, &luminance_size); + GL_TEXTURE_LUMINANCE_SIZE, &luminance_size); glGetTexLevelParameteriv(page_target, 0, - GL_TEXTURE_INTENSITY_SIZE, &intensity_size); + GL_TEXTURE_INTENSITY_SIZE, &intensity_size); if (_supports_depth_texture) { glGetTexLevelParameteriv(page_target, 0, - GL_TEXTURE_DEPTH_SIZE, &depth_size); + GL_TEXTURE_DEPTH_SIZE, &depth_size); } GLint width = 1, height = 1, depth = 1; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 3a7f5ddba7..cac7694f4e 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -693,6 +693,10 @@ public: PFNGLTEXSTORAGE2DPROC _glTexStorage2D; PFNGLTEXSTORAGE3DPROC _glTexStorage3D; +#ifndef OPENGLES + PFNGLTEXBUFFERPROC _glTexBuffer; +#endif + bool _supports_clear_texture; #ifndef OPENGLES PFNGLCLEARTEXIMAGEPROC _glClearTexImage; diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 3c031dc904..dc50428d00 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -602,16 +602,19 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext case GL_INT_SAMPLER_3D: case GL_INT_SAMPLER_2D_ARRAY: case GL_INT_SAMPLER_CUBE: + case GL_INT_SAMPLER_BUFFER: case GL_UNSIGNED_INT_SAMPLER_1D: case GL_UNSIGNED_INT_SAMPLER_2D: case GL_UNSIGNED_INT_SAMPLER_3D: case GL_UNSIGNED_INT_SAMPLER_CUBE: case GL_UNSIGNED_INT_SAMPLER_2D_ARRAY: + case GL_UNSIGNED_INT_SAMPLER_BUFFER: case GL_SAMPLER_1D_SHADOW: case GL_SAMPLER_1D: case GL_SAMPLER_CUBE_SHADOW: case GL_SAMPLER_2D_ARRAY: case GL_SAMPLER_2D_ARRAY_SHADOW: + case GL_SAMPLER_BUFFER: #endif // !OPENGLES case GL_SAMPLER_2D: case GL_SAMPLER_2D_SHADOW: @@ -620,7 +623,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext Shader::ShaderTexSpec bind; bind._id = arg_id; bind._name = InternalName::make(param_name); - bind._desired_type = Texture::TT_2d_texture_array; + bind._desired_type = Texture::TT_2d_texture; bind._stage = texunitno++; if (get_sampler_texture_type(bind._desired_type, param_type)) { _glgsg->_glUniform1i(p, s->_tex_spec.size()); @@ -761,16 +764,19 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext case GL_IMAGE_3D_EXT: case GL_IMAGE_CUBE_EXT: case GL_IMAGE_2D_ARRAY_EXT: + case GL_IMAGE_BUFFER_EXT: case GL_INT_IMAGE_1D_EXT: case GL_INT_IMAGE_2D_EXT: case GL_INT_IMAGE_3D_EXT: case GL_INT_IMAGE_CUBE_EXT: case GL_INT_IMAGE_2D_ARRAY_EXT: + case GL_INT_IMAGE_BUFFER_EXT: case GL_UNSIGNED_INT_IMAGE_1D_EXT: case GL_UNSIGNED_INT_IMAGE_2D_EXT: case GL_UNSIGNED_INT_IMAGE_3D_EXT: case GL_UNSIGNED_INT_IMAGE_CUBE_EXT: case GL_UNSIGNED_INT_IMAGE_2D_ARRAY_EXT: + case GL_UNSIGNED_INT_IMAGE_BUFFER_EXT: // This won't really change at runtime, so we might as well // bind once and then forget about it. _glgsg->_glUniform1i(p, imgunitno++); @@ -1076,6 +1082,18 @@ get_sampler_texture_type(int &out, GLenum param_type) { << "GLSL shader uses 2D texture array, which is unsupported by the driver.\n"; return false; } + + case GL_INT_SAMPLER_BUFFER: + case GL_UNSIGNED_INT_SAMPLER_BUFFER: + case GL_SAMPLER_BUFFER: + out = Texture::TT_buffer_texture; + if (_glgsg->_supports_buffer_texture) { + return true; + } else { + GLCAT.error() + << "GLSL shader uses buffer texture, which is unsupported by the driver.\n"; + return false; + } #endif default: @@ -1509,6 +1527,12 @@ disable_shader_texture_bindings() { case Texture::TT_cube_map: glBindTexture(GL_TEXTURE_CUBE_MAP, 0); break; + + case Texture::TT_buffer_texture: +#ifndef OPENGLES + glBindTexture(GL_TEXTURE_BUFFER, 0); +#endif + break; } } diff --git a/panda/src/glstuff/glTextureContext_src.I b/panda/src/glstuff/glTextureContext_src.I index 687a2e1f3b..37aa40d50c 100644 --- a/panda/src/glstuff/glTextureContext_src.I +++ b/panda/src/glstuff/glTextureContext_src.I @@ -26,6 +26,7 @@ CLP(TextureContext)(CLP(GraphicsStateGuardian) *glgsg, _glgsg = glgsg; glGenTextures(1, &_index); + _buffer = 0; _handle = 0; _has_storage = false; diff --git a/panda/src/glstuff/glTextureContext_src.cxx b/panda/src/glstuff/glTextureContext_src.cxx index af6d8c7259..1383275832 100644 --- a/panda/src/glstuff/glTextureContext_src.cxx +++ b/panda/src/glstuff/glTextureContext_src.cxx @@ -34,6 +34,11 @@ CLP(TextureContext):: glDeleteTextures(1, &_index); _index = 0; + + if (_buffer != 0) { + _glgsg->_glDeleteBuffers(1, &_buffer); + _buffer = 0; + } } //////////////////////////////////////////////////////////////////// @@ -88,6 +93,11 @@ reset_data() { // Free the texture resources. glDeleteTextures(1, &_index); + if (_buffer != 0) { + _glgsg->_glDeleteBuffers(1, &_buffer); + _buffer = 0; + } + // We still need a valid index number, though, in case we want to // re-load the texture later. glGenTextures(1, &_index); diff --git a/panda/src/glstuff/glTextureContext_src.h b/panda/src/glstuff/glTextureContext_src.h index 14a0b68f6e..57fd2fc790 100644 --- a/panda/src/glstuff/glTextureContext_src.h +++ b/panda/src/glstuff/glTextureContext_src.h @@ -48,6 +48,9 @@ public: // This is the GL "name" of the texture object. GLuint _index; + // This is only used for buffer textures. + GLuint _buffer; + // This is the bindless "handle" to the texture object. GLuint64 _handle; bool _handle_resident; diff --git a/panda/src/gobj/texture.I b/panda/src/gobj/texture.I index e7db1364ce..4aeaf4b259 100644 --- a/panda/src/gobj/texture.I +++ b/panda/src/gobj/texture.I @@ -215,6 +215,26 @@ setup_cube_map(int size, ComponentType component_type, Format format) { setup_texture(TT_cube_map, size, size, 6, component_type, format); } +//////////////////////////////////////////////////////////////////// +// Function: Texture::setup_buffer_texture +// Access: Published +// Description: Sets the texture as an empty buffer texture with +// the specified size and properties. Follow up +// with set_ram_image() or modify_ram_image() to fill +// the image data, or use set_clear_color to let the +// texture be cleared to a solid color. +// +// Note that a buffer texture's format needs to match +// the component type. +//////////////////////////////////////////////////////////////////// +INLINE void Texture:: +setup_buffer_texture(int size, ComponentType component_type, Format format, + GeomEnums::UsageHint usage) { + setup_texture(TT_buffer_texture, size, 1, 1, component_type, format); + CDWriter cdata(_cycler); + cdata->_usage_hint = usage; +} + //////////////////////////////////////////////////////////////////// // Function: Texture::clear_image // Access: Published @@ -886,6 +906,18 @@ get_component_type() const { return cdata->_component_type; } +//////////////////////////////////////////////////////////////////// +// Function: Texture::get_usage_hint +// Access: Published +// Description: Returns the usage hint specified for buffer textures, +// or UH_unspecified for all other texture types. +//////////////////////////////////////////////////////////////////// +INLINE GeomEnums::UsageHint Texture:: +get_usage_hint() const { + CDReader cdata(_cycler); + return cdata->_usage_hint; +} + //////////////////////////////////////////////////////////////////// // Function: Texture::set_wrap_u // Access: Published diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index bf6b8f0422..13137221f0 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -1524,6 +1524,10 @@ write(ostream &out, int indent_level) const { case TT_cube_map: out << "cube map, " << cdata->_x_size << " x " << cdata->_y_size; break; + + case TT_buffer_texture: + out << "buffer, " << cdata->_x_size; + break; } if (cdata->_num_views > 1) { @@ -1924,6 +1928,8 @@ format_texture_type(TextureType tt) { return "2d_texture_array"; case TT_cube_map: return "cube_map"; + case TT_buffer_texture: + return "buffer_texture"; } return "**invalid**"; } @@ -1946,6 +1952,8 @@ string_texture_type(const string &str) { return TT_2d_texture_array; } else if (cmp_nocase(str, "cube_map") == 0) { return TT_cube_map; + } else if (cmp_nocase(str, "buffer_texture") == 0) { + return TT_buffer_texture; } gobj_cat->error() @@ -2673,6 +2681,7 @@ do_read(CData *cdata, const Filename &fullpath, const Filename &alpha_fullpath, switch (cdata->_texture_type) { case TT_1d_texture: case TT_2d_texture: + case TT_buffer_texture: z_size = 1; break; @@ -4854,7 +4863,8 @@ do_reconsider_image_properties(CData *cdata, int x_size, int y_size, int num_com } #ifndef NDEBUG - if (cdata->_texture_type == TT_1d_texture) { + if (cdata->_texture_type == TT_1d_texture || + cdata->_texture_type == TT_buffer_texture) { nassertr(y_size == 1, false); } else if (cdata->_texture_type == TT_cube_map) { nassertr(x_size == y_size, false); @@ -5051,6 +5061,10 @@ do_setup_texture(CData *cdata, Texture::TextureType texture_type, cdata->_default_sampler.set_wrap_v(SamplerState::WM_clamp); cdata->_default_sampler.set_wrap_w(SamplerState::WM_clamp); break; + + case TT_buffer_texture: + nassertv(y_size == 1 && z_size == 1); + break; } if (texture_type != TT_2d_texture) { @@ -5199,7 +5213,8 @@ do_set_x_size(CData *cdata, int x_size) { void Texture:: do_set_y_size(CData *cdata, int y_size) { if (cdata->_y_size != y_size) { - nassertv(cdata->_texture_type != Texture::TT_1d_texture || y_size == 1); + nassertv((cdata->_texture_type != Texture::TT_buffer_texture && + cdata->_texture_type != Texture::TT_1d_texture) || y_size == 1); cdata->_y_size = y_size; cdata->inc_image_modified(); do_clear_ram_image(cdata); @@ -7897,6 +7912,10 @@ do_write_datagram_body(CData *cdata, BamWriter *manager, Datagram &me) { me.add_uint8(cdata->_format); me.add_uint8(cdata->_num_components); + if (cdata->_texture_type == TT_buffer_texture) { + me.add_uint8(cdata->_usage_hint); + } + me.add_uint8(cdata->_auto_texture_scale); me.add_uint32(cdata->_orig_file_x_size); me.add_uint32(cdata->_orig_file_y_size); @@ -8063,6 +8082,7 @@ make_this_from_bam(const FactoryParams ¶ms) { options.set_auto_texture_scale(auto_texture_scale); switch (texture_type) { + case TT_buffer_texture: case TT_1d_texture: case TT_2d_texture: if (alpha_filename.empty()) { @@ -8124,6 +8144,10 @@ do_fillin_body(CData *cdata, DatagramIterator &scan, BamReader *manager) { cdata->_format = (Format)scan.get_uint8(); cdata->_num_components = scan.get_uint8(); + if (cdata->_texture_type == TT_buffer_texture) { + cdata->_usage_hint = (GeomEnums::UsageHint)scan.get_uint8(); + } + cdata->inc_properties_modified(); cdata->_auto_texture_scale = ATS_unspecified; @@ -8304,6 +8328,9 @@ CData() { // check in do_set_format depending on an uninitialized value. _format = F_rgba; + // Only used for buffer textures. + _usage_hint = GeomEnums::UH_unspecified; + _pad_x_size = 0; _pad_y_size = 0; _pad_z_size = 0; diff --git a/panda/src/gobj/texture.h b/panda/src/gobj/texture.h index 1320935860..f19b1ef8fa 100644 --- a/panda/src/gobj/texture.h +++ b/panda/src/gobj/texture.h @@ -42,6 +42,7 @@ #include "samplerState.h" #include "pnmImage.h" #include "colorSpace.h" +#include "geomEnums.h" class PNMImage; class PfmFile; @@ -82,6 +83,7 @@ PUBLISHED: TT_3d_texture, TT_2d_texture_array, TT_cube_map, + TT_buffer_texture, }; enum ComponentType { @@ -240,6 +242,8 @@ PUBLISHED: INLINE void setup_2d_texture_array(int z_size = 1); INLINE void setup_2d_texture_array(int x_size, int y_size, int z_size, ComponentType component_type, Format format); + INLINE void setup_buffer_texture(int size, ComponentType component_type, + Format format, GeomEnums::UsageHint usage); void generate_normalization_cube_map(int size); void generate_alpha_scale_map(); @@ -304,6 +308,7 @@ PUBLISHED: INLINE TextureType get_texture_type() const; INLINE Format get_format() const; INLINE ComponentType get_component_type() const; + INLINE GeomEnums::UsageHint get_usage_hint() const; INLINE void set_wrap_u(WrapMode wrap); INLINE void set_wrap_v(WrapMode wrap); @@ -829,6 +834,7 @@ protected: TextureType _texture_type; Format _format; ComponentType _component_type; + GeomEnums::UsageHint _usage_hint; bool _loaded_from_image; bool _loaded_from_txo; From 52288e299bb16cb94346ca762fa8d56eff4532a4 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 16 Apr 2015 16:57:46 +0200 Subject: [PATCH 56/73] Fix interrogate regression that broke multiview support --- dtool/src/interrogate/interfaceMakerPythonNative.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index a35f8c0fb4..ecd2460d7c 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -2636,7 +2636,7 @@ write_module_class(ostream &out, Object *obj) { write_function_slot(out, 2, slots, "bf_getsegcount"); write_function_slot(out, 2, slots, "bf_getcharbuffer"); out << "#endif\n"; - out << "#if PY_MAJOR_VERSION >= 0x02060000\n"; + out << "#if PY_VERSION_HEX >= 0x02060000\n"; write_function_slot(out, 2, slots, "bf_getbuffer"); write_function_slot(out, 2, slots, "bf_releasebuffer"); out << "#endif\n"; From 4f47b018ebf0870ac3ee660c4def4bc9abcccc34 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 16 Apr 2015 17:10:14 +0200 Subject: [PATCH 57/73] Some .bam cross-compatibility for buffer textures --- panda/src/gobj/texture.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index bf6b8f0422..279dcc41e2 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -8124,6 +8124,14 @@ do_fillin_body(CData *cdata, DatagramIterator &scan, BamReader *manager) { cdata->_format = (Format)scan.get_uint8(); cdata->_num_components = scan.get_uint8(); + if ((int)cdata->_texture_type == 5) { + // As a kind little gesture to the people who try to load a Panda 1.10 + // bam in Panda 1.9. + scan.get_uint8(); + gobj_cat.error() + << "Buffer textures are not supported in this version of Panda3D.\n"; + } + cdata->inc_properties_modified(); cdata->_auto_texture_scale = ATS_unspecified; From 9c313a172d280b981f194333952b208190730890 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 16 Apr 2015 20:26:55 +0200 Subject: [PATCH 58/73] Make writable: bullet convex hull, triangle mesh, debug node --- panda/src/bullet/bulletBodyNode.cxx | 39 ++++-- panda/src/bullet/bulletBodyNode.h | 1 + panda/src/bullet/bulletConvexHullShape.cxx | 104 +++++++++++++++- panda/src/bullet/bulletConvexHullShape.h | 10 +- panda/src/bullet/bulletDebugNode.cxx | 67 ++++++++++ panda/src/bullet/bulletDebugNode.h | 9 +- panda/src/bullet/bulletTriangleMesh.cxx | 122 +++++++++++++++++++ panda/src/bullet/bulletTriangleMesh.h | 17 ++- panda/src/bullet/bulletTriangleMeshShape.cxx | 117 +++++++++++++++++- panda/src/bullet/bulletTriangleMeshShape.h | 17 ++- panda/src/bullet/config_bullet.cxx | 4 + 11 files changed, 483 insertions(+), 24 deletions(-) diff --git a/panda/src/bullet/bulletBodyNode.cxx b/panda/src/bullet/bulletBodyNode.cxx index 24274f9ff5..c494afe00c 100644 --- a/panda/src/bullet/bulletBodyNode.cxx +++ b/panda/src/bullet/bulletBodyNode.cxx @@ -167,13 +167,16 @@ output(ostream &out) const { // Description: //////////////////////////////////////////////////////////////////// void BulletBodyNode:: -add_shape(BulletShape *shape, const TransformState *ts) { +add_shape(BulletShape *bullet_shape, const TransformState *ts) { nassertv(get_object()); nassertv(ts); - nassertv(!(shape->ptr()->getShapeType() == CONVEX_HULL_SHAPE_PROXYTYPE - && ((btConvexHullShape *)shape->ptr())->getNumVertices() == 0)); + btCollisionShape *shape = bullet_shape->ptr(); + nassertv(shape != NULL); + + nassertv(!(shape->getShapeType() == CONVEX_HULL_SHAPE_PROXYTYPE && + ((btConvexHullShape *)shape)->getNumVertices() == 0)); // Transform btTransform trans = TransformState_to_btTrans(ts); @@ -195,13 +198,13 @@ add_shape(BulletShape *shape, const TransformState *ts) { // After adding the shape we will have one shape, but with transform. // We need to wrap the shape within a compound shape, in oder to // be able to set the local transform. - next = shape->ptr(); + next = shape; } else { // After adding the shape we will have a total of one shape, without // local transform. We can set the shape directly. next = new btCompoundShape(); - ((btCompoundShape *)next)->addChildShape(trans, shape->ptr()); + ((btCompoundShape *)next)->addChildShape(trans, shape); } get_object()->setCollisionShape(next); @@ -216,7 +219,7 @@ add_shape(BulletShape *shape, const TransformState *ts) { // to the compound shape. next = previous; - ((btCompoundShape *)next)->addChildShape(trans, shape->ptr()); + ((btCompoundShape *)next)->addChildShape(trans, shape); } else { // We have one shape which is NOT a compound shape, and want to add @@ -225,7 +228,7 @@ add_shape(BulletShape *shape, const TransformState *ts) { btTransform previous_trans = btTransform::getIdentity(); ((btCompoundShape *)next)->addChildShape(previous_trans, previous); - ((btCompoundShape *)next)->addChildShape(trans, shape->ptr()); + ((btCompoundShape *)next)->addChildShape(trans, shape); get_object()->setCollisionShape(next); _shape = next; @@ -238,10 +241,10 @@ add_shape(BulletShape *shape, const TransformState *ts) { nassertv(previous->getShapeType() == COMPOUND_SHAPE_PROXYTYPE); next = previous; - ((btCompoundShape *)next)->addChildShape(trans, shape->ptr()); + ((btCompoundShape *)next)->addChildShape(trans, shape); } - _shapes.push_back(shape); + _shapes.push_back(bullet_shape); // Restore the local scaling again np.set_scale(scale); @@ -778,7 +781,7 @@ int BulletBodyNode:: complete_pointers(TypedWritable **p_list, BamReader *manager) { int pi = PandaNode::complete_pointers(p_list, manager); - BulletShape *shape = DCAST(BulletShape, p_list[pi++]); + PT(BulletShape) shape = DCAST(BulletShape, p_list[pi++]); while (shape != (BulletShape *)NULL) { const TransformState *trans = DCAST(TransformState, p_list[pi++]); @@ -790,6 +793,22 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { return pi; } +//////////////////////////////////////////////////////////////////// +// Function: BulletBodyNode::require_fully_complete +// Access: Public, Virtual +// Description: Some objects require all of their nested pointers to +// have been completed before the objects themselves can +// be completed. If this is the case, override this +// method to return true, and be careful with circular +// references (which would make the object unreadable +// from a bam file). +//////////////////////////////////////////////////////////////////// +bool BulletBodyNode:: +require_fully_complete() const { + // We require the shape pointers to be complete before we add them. + return true; +} + //////////////////////////////////////////////////////////////////// // Function: BulletBodyNode::fillin // Access: Protected diff --git a/panda/src/bullet/bulletBodyNode.h b/panda/src/bullet/bulletBodyNode.h index 8c50b67fae..a2c7fc2e67 100644 --- a/panda/src/bullet/bulletBodyNode.h +++ b/panda/src/bullet/bulletBodyNode.h @@ -148,6 +148,7 @@ public: virtual void write_datagram(BamWriter *manager, Datagram &dg); virtual int complete_pointers(TypedWritable **plist, BamReader *manager); + virtual bool require_fully_complete() const; protected: void fillin(DatagramIterator &scan, BamReader *manager); diff --git a/panda/src/bullet/bulletConvexHullShape.cxx b/panda/src/bullet/bulletConvexHullShape.cxx index 016c0b24f6..45ccc87b4e 100644 --- a/panda/src/bullet/bulletConvexHullShape.cxx +++ b/panda/src/bullet/bulletConvexHullShape.cxx @@ -66,10 +66,17 @@ add_array(const PTA_LVecBase3 &points) { _shape->setUserPointer(this); PTA_LVecBase3::const_iterator it; - for (it=points.begin(); it!=points.end(); it++) { - LVecBase3 v = *it; - _shape->addPoint(LVecBase3_to_btVector3(v)); + +#if BT_BULLET_VERSION >= 282 + for (it = points.begin(); it != points.end(); ++it) { + _shape->addPoint(LVecBase3_to_btVector3(*it), false); } + _shape->recalcLocalAabb(); +#else + for (it = points.begin(); it != points.end(); ++it) { + _shape->addPoint(LVecBase3_to_btVector3(*it)); + } +#endif } //////////////////////////////////////////////////////////////////// @@ -100,8 +107,97 @@ add_geom(const Geom *geom, const TransformState *ts) { _shape->setUserPointer(this); pvector::const_iterator it; - for (it=points.begin(); it!=points.end(); it++) { + +#if BT_BULLET_VERSION >= 282 + for (it = points.begin(); it != points.end(); ++it) { + LVecBase3 v = *it; + _shape->addPoint(LVecBase3_to_btVector3(*it), false); + } + _shape->recalcLocalAabb(); +#else + for (it = points.begin(); it != points.end(); ++it) { + LVecBase3 v = *it; _shape->addPoint(LVecBase3_to_btVector3(*it)); } +#endif +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConvexHullShape::register_with_read_factory +// Access: Public, Static +// Description: Tells the BamReader how to create objects of type +// BulletShape. +//////////////////////////////////////////////////////////////////// +void BulletConvexHullShape:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConvexHullShape::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletConvexHullShape:: +write_datagram(BamWriter *manager, Datagram &dg) { + dg.add_stdfloat(get_margin()); + + unsigned int num_points = _shape->getNumPoints(); + dg.add_uint32(num_points); + + const btVector3 *points = _shape->getUnscaledPoints(); + + for (unsigned int i = 0; i < num_points; ++i) { + LVecBase3 point = btVector3_to_LVecBase3(points[i]); + point.write_datagram(dg); + } } +//////////////////////////////////////////////////////////////////// +// Function: BulletConvexHullShape::make_from_bam +// Access: Protected, Static +// Description: This function is called by the BamReader's factory +// when a new object of type BulletShape is encountered +// in the Bam file. It should create the BulletShape +// and extract its information from the file. +//////////////////////////////////////////////////////////////////// +TypedWritable *BulletConvexHullShape:: +make_from_bam(const FactoryParams ¶ms) { + BulletConvexHullShape *param = new BulletConvexHullShape; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletConvexHullShape::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletShape. +//////////////////////////////////////////////////////////////////// +void BulletConvexHullShape:: +fillin(DatagramIterator &scan, BamReader *manager) { + PN_stdfloat margin = scan.get_stdfloat(); + unsigned int num_points = scan.get_uint32(); + +#if BT_BULLET_VERSION >= 282 + for (unsigned int i = 0; i < num_points; ++i) { + LVecBase3 point; + point.read_datagram(scan); + _shape->addPoint(LVecBase3_to_btVector3(point), false); + } + _shape->recalcLocalAabb(); +#else + for (unsigned int i = 0; i < num_points; ++i) { + LVecBase3 point; + point.read_datagram(scan); + _shape->addPoint(LVecBase3_to_btVector3(point)); + } +#endif +} diff --git a/panda/src/bullet/bulletConvexHullShape.h b/panda/src/bullet/bulletConvexHullShape.h index a46a8c5cee..f51b33560f 100644 --- a/panda/src/bullet/bulletConvexHullShape.h +++ b/panda/src/bullet/bulletConvexHullShape.h @@ -29,7 +29,6 @@ // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDABULLET BulletConvexHullShape : public BulletShape { - PUBLISHED: BulletConvexHullShape(); INLINE BulletConvexHullShape(const BulletConvexHullShape ©); @@ -47,7 +46,14 @@ public: private: btConvexHullShape *_shape; -//////////////////////////////////////////////////////////////////// +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/bulletDebugNode.cxx b/panda/src/bullet/bulletDebugNode.cxx index cd23b77d8d..ce283267e9 100644 --- a/panda/src/bullet/bulletDebugNode.cxx +++ b/panda/src/bullet/bulletDebugNode.cxx @@ -463,3 +463,70 @@ drawSphere(btScalar radius, const btTransform &transform, const btVector3 &color drawArc(center, zoffs, xoffs, radius, radius, 0, SIMD_2_PI, color, false, 10.0); } +//////////////////////////////////////////////////////////////////// +// Function: BulletDebugNode::register_with_read_factory +// Access: Public, Static +// Description: Tells the BamReader how to create objects of type +// BulletDebugNode. +//////////////////////////////////////////////////////////////////// +void BulletDebugNode:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletDebugNode::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletDebugNode:: +write_datagram(BamWriter *manager, Datagram &dg) { + // Don't upcall to GeomNode since we're not interested in storing + // the actual debug Geoms in the .bam file. + PandaNode::write_datagram(manager, dg); + + dg.add_bool(_wireframe); + dg.add_bool(_constraints); + dg.add_bool(_bounds); + dg.add_bool(_drawer._normals); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletDebugNode::make_from_bam +// Access: Protected, Static +// Description: This function is called by the BamReader's factory +// when a new object of this type is encountered +// in the Bam file. It should create the rigid body +// and extract its information from the file. +//////////////////////////////////////////////////////////////////// +TypedWritable *BulletDebugNode:: +make_from_bam(const FactoryParams ¶ms) { + BulletDebugNode *param = new BulletDebugNode; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletDebugNode::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletDebugNode. +//////////////////////////////////////////////////////////////////// +void BulletDebugNode:: +fillin(DatagramIterator &scan, BamReader *manager) { + // Don't upcall to GeomNode since we're not interested in storing + // the actual debug Geoms in the .bam file. + PandaNode::fillin(scan, manager); + + _wireframe = scan.get_bool(); + _constraints = scan.get_bool(); + _bounds = scan.get_bool(); + _drawer._normals = scan.get_bool(); +} diff --git a/panda/src/bullet/bulletDebugNode.h b/panda/src/bullet/bulletDebugNode.h index 50f6fd7592..cae9628dbb 100644 --- a/panda/src/bullet/bulletDebugNode.h +++ b/panda/src/bullet/bulletDebugNode.h @@ -101,7 +101,14 @@ private: friend class BulletWorld; -//////////////////////////////////////////////////////////////////// +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/bulletTriangleMesh.cxx b/panda/src/bullet/bulletTriangleMesh.cxx index 928c728677..343f0138af 100644 --- a/panda/src/bullet/bulletTriangleMesh.cxx +++ b/panda/src/bullet/bulletTriangleMesh.cxx @@ -213,3 +213,125 @@ write(ostream &out, int indent_level) const { } } +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMesh::register_with_read_factory +// Access: Public, Static +// Description: Tells the BamReader how to create objects of type +// BulletTriangleMesh. +//////////////////////////////////////////////////////////////////// +void BulletTriangleMesh:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMesh::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletTriangleMesh:: +write_datagram(BamWriter *manager, Datagram &dg) { + dg.add_stdfloat(get_welding_distance()); + + // In case we ever want to represent more than 1 indexed mesh. + dg.add_int32(1); + + btIndexedMesh &mesh = _mesh->getIndexedMeshArray()[0]; + dg.add_int32(mesh.m_numVertices); + dg.add_int32(mesh.m_numTriangles); + + // In case we want to use this to distinguish 16-bit vs 32-bit indices. + dg.add_bool(true); + + // Add the vertices. + const unsigned char *vptr = mesh.m_vertexBase; + nassertv(vptr != NULL || mesh.m_numVertices == 0); + + for (int i = 0; i < mesh.m_numVertices; ++i) { + const btVector3 &vertex = *((btVector3 *)vptr); + dg.add_stdfloat(vertex.getX()); + dg.add_stdfloat(vertex.getY()); + dg.add_stdfloat(vertex.getZ()); + vptr += mesh.m_vertexStride; + } + + // Now add the triangle indices. + const unsigned char *iptr = mesh.m_triangleIndexBase; + nassertv(iptr != NULL || mesh.m_numTriangles == 0); + + if (_mesh->getUse32bitIndices()) { + for (int i = 0; i < mesh.m_numTriangles; ++i) { + int *triangle = (int *)iptr; + dg.add_int32(triangle[0]); + dg.add_int32(triangle[1]); + dg.add_int32(triangle[2]); + iptr += mesh.m_triangleIndexStride; + } + } else { + for (int i = 0; i < mesh.m_numTriangles; ++i) { + short int *triangle = (short int *)iptr; + dg.add_int32(triangle[0]); + dg.add_int32(triangle[1]); + dg.add_int32(triangle[2]); + iptr += mesh.m_triangleIndexStride; + } + } +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMesh::make_from_bam +// Access: Protected, Static +// Description: This function is called by the BamReader's factory +// when a new object of type BulletShape is encountered +// in the Bam file. It should create the BulletShape +// and extract its information from the file. +//////////////////////////////////////////////////////////////////// +TypedWritable *BulletTriangleMesh:: +make_from_bam(const FactoryParams ¶ms) { + BulletTriangleMesh *param = new BulletTriangleMesh; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMesh::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletTriangleMesh. +//////////////////////////////////////////////////////////////////// +void BulletTriangleMesh:: +fillin(DatagramIterator &scan, BamReader *manager) { + set_welding_distance(scan.get_stdfloat()); + + nassertv(scan.get_int32() == 1); + int num_vertices = scan.get_int32(); + int num_triangles = scan.get_int32(); + nassertv(scan.get_bool() == true); + + // Read and add the vertices. + _mesh->preallocateVertices(num_vertices); + for (int i = 0; i < num_vertices; ++i) { + PN_stdfloat x = scan.get_stdfloat(); + PN_stdfloat y = scan.get_stdfloat(); + PN_stdfloat z = scan.get_stdfloat(); + _mesh->findOrAddVertex(btVector3(x, y, z), false); + } + + // Now read and add the indices. + int num_indices = num_triangles * 3; + _mesh->preallocateIndices(num_indices); + for (int i = 0; i < num_indices; ++i) { + _mesh->addIndex(scan.get_int32()); + } + + // Since we manually added the vertices individually, we have to + // update the triangle count appropriately. + _mesh->getIndexedMeshArray()[0].m_numTriangles = num_triangles; +} diff --git a/panda/src/bullet/bulletTriangleMesh.h b/panda/src/bullet/bulletTriangleMesh.h index 6e6caf7188..8b363a1c48 100644 --- a/panda/src/bullet/bulletTriangleMesh.h +++ b/panda/src/bullet/bulletTriangleMesh.h @@ -20,7 +20,7 @@ #include "bullet_includes.h" #include "bullet_utils.h" -#include "typedReferenceCount.h" +#include "typedWritableReferenceCount.h" #include "nodePath.h" #include "luse.h" #include "geom.h" @@ -31,7 +31,7 @@ // Class : BulletTriangleMesh // Description : //////////////////////////////////////////////////////////////////// -class EXPCL_PANDABULLET BulletTriangleMesh : public TypedReferenceCount { +class EXPCL_PANDABULLET BulletTriangleMesh : public TypedWritableReferenceCount { PUBLISHED: BulletTriangleMesh(); @@ -63,15 +63,22 @@ public: private: btTriangleMesh *_mesh; -//////////////////////////////////////////////////////////////////// +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; } static void init_type() { - TypedReferenceCount::init_type(); + TypedWritableReferenceCount::init_type(); register_type(_type_handle, "BulletTriangleMesh", - TypedReferenceCount::get_class_type()); + TypedWritableReferenceCount::get_class_type()); } virtual TypeHandle get_type() const { return get_class_type(); diff --git a/panda/src/bullet/bulletTriangleMeshShape.cxx b/panda/src/bullet/bulletTriangleMeshShape.cxx index 441f2c449b..1df03d7e32 100644 --- a/panda/src/bullet/bulletTriangleMeshShape.cxx +++ b/panda/src/bullet/bulletTriangleMeshShape.cxx @@ -21,6 +21,21 @@ TypeHandle BulletTriangleMeshShape::_type_handle; +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMeshShape::Constructor +// Access: Private +// Description: Only used by make_from_bam. +//////////////////////////////////////////////////////////////////// +BulletTriangleMeshShape:: +BulletTriangleMeshShape() : + _mesh(NULL), + _gimpact_shape(NULL), + _bvh_shape(NULL), + _dynamic(false), + _compress(false), + _bvh(false) { +} + //////////////////////////////////////////////////////////////////// // Function: BulletTriangleMeshShape::Constructor // Access: Published @@ -28,7 +43,10 @@ TypeHandle BulletTriangleMeshShape::_type_handle; // if 'dynamic' is set to FALSE. //////////////////////////////////////////////////////////////////// BulletTriangleMeshShape:: -BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress, bool bvh) { +BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress, bool bvh) : + _dynamic(dynamic), + _compress(compress), + _bvh(bvh) { // Assert that mesh is not NULL if (!mesh) { @@ -101,3 +119,100 @@ refit_tree(const LPoint3 &aabb_min, const LPoint3 &aabb_max) { LVecBase3_to_btVector3(aabb_max)); } +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMeshShape::register_with_read_factory +// Access: Public, Static +// Description: Tells the BamReader how to create objects of type +// BulletTriangleMeshShape. +//////////////////////////////////////////////////////////////////// +void BulletTriangleMeshShape:: +register_with_read_factory() { + BamReader::get_factory()->register_factory(get_class_type(), make_from_bam); +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMeshShape::write_datagram +// Access: Public, Virtual +// Description: Writes the contents of this object to the datagram +// for shipping out to a Bam file. +//////////////////////////////////////////////////////////////////// +void BulletTriangleMeshShape:: +write_datagram(BamWriter *manager, Datagram &dg) { + dg.add_stdfloat(get_margin()); + + manager->write_pointer(dg, _mesh); + + dg.add_bool(_dynamic); + if (!_dynamic) { + dg.add_bool(_compress); + dg.add_bool(_bvh); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMeshShape::complete_pointers +// Access: Public, Virtual +// Description: Receives an array of pointers, one for each time +// manager->read_pointer() was called in fillin(). +// Returns the number of pointers processed. +//////////////////////////////////////////////////////////////////// +int BulletTriangleMeshShape:: +complete_pointers(TypedWritable **p_list, BamReader *manager) { + int pi = BulletShape::complete_pointers(p_list, manager); + + _mesh = DCAST(BulletTriangleMesh, p_list[pi++]); + + btTriangleMesh *mesh_ptr = _mesh->ptr(); + nassertr(mesh_ptr != NULL, pi); + + if (_dynamic) { + _gimpact_shape = new btGImpactMeshShape(mesh_ptr); + _gimpact_shape->updateBound(); + _gimpact_shape->setUserPointer(this); + } else { + _bvh_shape = new btBvhTriangleMeshShape(mesh_ptr, _compress, _bvh); + _bvh_shape->setUserPointer(this); + } + + return pi; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMeshShape::make_from_bam +// Access: Protected, Static +// Description: This function is called by the BamReader's factory +// when a new object of type BulletShape is encountered +// in the Bam file. It should create the BulletShape +// and extract its information from the file. +//////////////////////////////////////////////////////////////////// +TypedWritable *BulletTriangleMeshShape:: +make_from_bam(const FactoryParams ¶ms) { + BulletTriangleMeshShape *param = new BulletTriangleMeshShape; + DatagramIterator scan; + BamReader *manager; + + parse_params(params, scan, manager); + param->fillin(scan, manager); + + return param; +} + +//////////////////////////////////////////////////////////////////// +// Function: BulletTriangleMeshShape::fillin +// Access: Protected +// Description: This internal function is called by make_from_bam to +// read in all of the relevant data from the BamFile for +// the new BulletTriangleMeshShape. +//////////////////////////////////////////////////////////////////// +void BulletTriangleMeshShape:: +fillin(DatagramIterator &scan, BamReader *manager) { + PN_stdfloat margin = scan.get_stdfloat(); + + manager->read_pointer(scan); + + _dynamic = scan.get_bool(); + if (!_dynamic) { + _compress = scan.get_bool(); + _bvh = scan.get_bool(); + } +} diff --git a/panda/src/bullet/bulletTriangleMeshShape.h b/panda/src/bullet/bulletTriangleMeshShape.h index 31049c2606..5c8faa0cab 100644 --- a/panda/src/bullet/bulletTriangleMeshShape.h +++ b/panda/src/bullet/bulletTriangleMeshShape.h @@ -29,6 +29,8 @@ class BulletTriangleMesh; // Description : //////////////////////////////////////////////////////////////////// class EXPCL_PANDABULLET BulletTriangleMeshShape : public BulletShape { +private: + INLINE BulletTriangleMeshShape(); PUBLISHED: BulletTriangleMeshShape(BulletTriangleMesh *mesh, bool dynamic, bool compress=true, bool bvh=true); @@ -50,7 +52,20 @@ private: PT(BulletTriangleMesh) _mesh; -//////////////////////////////////////////////////////////////////// + bool _dynamic : 1; + bool _compress : 1; + bool _bvh : 1; + +public: + static void register_with_read_factory(); + virtual void write_datagram(BamWriter *manager, Datagram &dg); + virtual int complete_pointers(TypedWritable **plist, + BamReader *manager); + +protected: + static TypedWritable *make_from_bam(const FactoryParams ¶ms); + void fillin(DatagramIterator &scan, BamReader *manager); + public: static TypeHandle get_class_type() { return _type_handle; diff --git a/panda/src/bullet/config_bullet.cxx b/panda/src/bullet/config_bullet.cxx index 4448a1c16b..2b33b8dffe 100644 --- a/panda/src/bullet/config_bullet.cxx +++ b/panda/src/bullet/config_bullet.cxx @@ -184,9 +184,13 @@ init_libbullet() { // Register factory functions for constructing objects from .bam files BulletBoxShape::register_with_read_factory(); + BulletConvexHullShape::register_with_read_factory(); + BulletDebugNode::register_with_read_factory(); BulletPlaneShape::register_with_read_factory(); BulletRigidBodyNode::register_with_read_factory(); BulletSphereShape::register_with_read_factory(); + BulletTriangleMesh::register_with_read_factory(); + BulletTriangleMeshShape::register_with_read_factory(); // Custom contact callbacks gContactAddedCallback = contact_added_callback; From 48cc1aa496de23a02fa3a236a0078f4df53d46f1 Mon Sep 17 00:00:00 2001 From: Ed Swartz Date: Fri, 17 Apr 2015 13:20:14 -0500 Subject: [PATCH 59/73] Implement an M_confined mouse mode to ensure mouse stays in window. --- panda/src/display/graphicsWindow.cxx | 22 +--- panda/src/display/windowProperties.I | 35 ++++-- panda/src/display/windowProperties.cxx | 4 + panda/src/display/windowProperties.h | 1 + panda/src/windisplay/winGraphicsWindow.cxx | 46 +++++++ panda/src/windisplay/winGraphicsWindow.h | 3 + panda/src/x11display/x11GraphicsWindow.cxx | 132 ++++++++++++++------- 7 files changed, 169 insertions(+), 74 deletions(-) diff --git a/panda/src/display/graphicsWindow.cxx b/panda/src/display/graphicsWindow.cxx index caee3ea4ed..6166f9cbac 100644 --- a/panda/src/display/graphicsWindow.cxx +++ b/panda/src/display/graphicsWindow.cxx @@ -736,24 +736,10 @@ set_properties_now(WindowProperties &properties) { // Fullscreen property specified, but unchanged. properties.clear_fullscreen(); } - if (properties.has_mouse_mode() ) { - - if (properties.get_mouse_mode() == _properties.get_mouse_mode()) { - properties.clear_mouse_mode(); - } - else { - if(properties.get_mouse_mode() == WindowProperties::M_absolute) { - _properties.set_mouse_mode(WindowProperties::M_absolute); - mouse_mode_absolute(); - properties.clear_mouse_mode(); - } - else - { - _properties.set_mouse_mode(WindowProperties::M_relative); - mouse_mode_relative(); - properties.clear_mouse_mode(); - } - } + if (properties.has_mouse_mode() && + properties.get_mouse_mode() == _properties.get_mouse_mode()) { + // Mouse mode specified, but unchanged. + properties.clear_mouse_mode(); } } diff --git a/panda/src/display/windowProperties.I b/panda/src/display/windowProperties.I index ca307062a4..3597adbc55 100644 --- a/panda/src/display/windowProperties.I +++ b/panda/src/display/windowProperties.I @@ -798,19 +798,30 @@ clear_z_order() { // Function: WindowProperties::set_mouse_mode // Access: Published // Description: Specifies the mode in which the window is to operate -// its mouse pointer. The default is M_absolute, which -// is the normal mode in which a mouse pointer operates; -// but you can also set M_relative, which is -// particularly useful for FPS-style mouse movements -// where you have hidden the mouse pointer and are are -// more interested in how fast the mouse is moving, -// rather than precisely where the pointer is hovering. +// its mouse pointer. +// +// M_absolute: the normal mode in which a mouse pointer +// operates, where the mouse can move outside the window +// and the mouse coordinates are relative to its +// position in the window. +// +// M_relative (OSX or Unix/X11 only): a mode where only +// relative movements are reported; particularly useful +// for FPS-style mouse movements where you have hidden +// the mouse pointer and are are more interested in how +// fast the mouse is moving, rather than precisely where +// the pointer is hovering. +// +// This has no effect on Windows. On Unix/X11, this +// requires the Xxf86dga extension to be available. +// +// M_confined: this mode reports absolute mouse +// positions, but confines the mouse pointer to +// the window boundary. It can portably replace +// M_relative for an FPS, but you need to periodically +// move the pointer to the center of the window +// and track movement deltas. // -// This has no effect on Windows, which does not -// have this concept; but is important to do on OSX -// and Unix/X11 to properly enable a smooth FPS-style -// mouselook mode. On Unix/X11, this requires the -// Xxf86dga extension to be available. //////////////////////////////////////////////////////////////////// INLINE void WindowProperties:: set_mouse_mode(MouseMode mode) { diff --git a/panda/src/display/windowProperties.cxx b/panda/src/display/windowProperties.cxx index d38241f2ce..8e4178526f 100644 --- a/panda/src/display/windowProperties.cxx +++ b/panda/src/display/windowProperties.cxx @@ -400,6 +400,8 @@ operator << (ostream &out, WindowProperties::MouseMode mode) { return out << "absolute"; case WindowProperties::M_relative: return out << "relative"; + case WindowProperties::M_confined: + return out << "confined"; } return out << "**invalid WindowProperties::MouseMode(" << (int)mode << ")**"; } @@ -413,6 +415,8 @@ operator >> (istream &in, WindowProperties::MouseMode &mode) { mode = WindowProperties::M_absolute; } else if (word == "relative") { mode = WindowProperties::M_relative; + } else if (word == "confined") { + mode = WindowProperties::M_confined; } else { display_cat.warning() << "Unknown mouse mode: " << word << "\n"; diff --git a/panda/src/display/windowProperties.h b/panda/src/display/windowProperties.h index 5f8a6bb32d..dc0fcac84f 100644 --- a/panda/src/display/windowProperties.h +++ b/panda/src/display/windowProperties.h @@ -40,6 +40,7 @@ PUBLISHED: enum MouseMode { M_absolute, M_relative, + M_confined, }; WindowProperties(); diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 99d4c9629e..d4fcf6a9e2 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -35,6 +35,8 @@ WinGraphicsWindow *WinGraphicsWindow::_creating_window = NULL; WinGraphicsWindow *WinGraphicsWindow::_cursor_window = NULL; bool WinGraphicsWindow::_cursor_hidden = false; +RECT WinGraphicsWindow::_mouse_unconfined_cliprect; + // These are used to save the previous state of the fancy Win2000 // effects that interfere with rendering when the mouse wanders into a // window's client area. @@ -359,6 +361,50 @@ set_properties_now(WindowProperties &properties) { } } } + + if (properties.has_mouse_mode()) { + if (properties.get_mouse_mode() != _properties.get_mouse_mode()) { + switch (properties.get_mouse_mode()) { + case WindowProperties::M_absolute: + case WindowProperties::M_relative: // not implemented, treat as absolute + + if (_properties.get_mouse_mode() == WindowProperties::M_confined) { + ClipCursor(NULL); + windisplay_cat.info() << "Unconfining cursor from window\n"; + } + _properties.set_mouse_mode(WindowProperties::M_absolute); + break; + + case WindowProperties::M_confined: + { + RECT clip; + + if (!GetWindowRect(_hWnd, &clip)) { + if (windisplay_cat.is_debug()) { + windisplay_cat.debug() + << "GetWindowRect() failed in set_properties_now. Cannot confine cursor.\n"; + } + } else { + windisplay_cat.debug() + << "ClipCursor() to " << clip.left << "," << clip.top << " to " + << clip.right << "," << clip.bottom << endl; + + GetClipCursor(&_mouse_unconfined_cliprect); + if (!ClipCursor(&clip)) { + windisplay_cat.debug() + << "ClipCursor() failed in set_properties_now. Ignoring.\n"; + } else { + _properties.set_mouse_mode(WindowProperties::M_confined); + windisplay_cat.info() << "Confining cursor to window\n"; + } + } + } + break; + } + } + properties.clear_mouse_mode(); + } + } //////////////////////////////////////////////////////////////////// diff --git a/panda/src/windisplay/winGraphicsWindow.h b/panda/src/windisplay/winGraphicsWindow.h index cbd7c46bb6..1b3ee93f95 100644 --- a/panda/src/windisplay/winGraphicsWindow.h +++ b/panda/src/windisplay/winGraphicsWindow.h @@ -214,6 +214,9 @@ private: static BOOL _saved_cursor_shadow; static BOOL _saved_mouse_vanish; + // The mouse constraints before applying mouse mode M_confined. + static RECT _mouse_unconfined_cliprect; + // Since the Panda API requests icons and cursors by filename, we // need a table mapping filenames to handles, so we can avoid // re-reading the file each time we change icons. diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index 7f090ecd5c..f1484522a1 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -711,6 +711,92 @@ set_properties_now(WindowProperties &properties) { properties.clear_foreground(); } + if (properties.has_mouse_mode()) { + switch (properties.get_mouse_mode()) { + case WindowProperties::M_absolute: + XUngrabPointer(_display, CurrentTime); +#ifdef HAVE_XF86DGA + if (_dga_mouse_enabled) { + x11display_cat.info() << "Disabling relative mouse using XF86DGA extension\n"; + XF86DGADirectVideo(_display, _screen, 0); + _dga_mouse_enabled = false; + } +#endif + _properties.set_mouse_mode(WindowProperties::M_absolute); + properties.clear_mouse_mode(); + break; + + case WindowProperties::M_relative: +#ifdef HAVE_XF86DGA + if (!_dga_mouse_enabled) { + int major_ver, minor_ver; + if (XF86DGAQueryVersion(_display, &major_ver, &minor_ver)) { + + X11_Cursor cursor = None; + if (_properties.get_cursor_hidden()) { + x11GraphicsPipe *x11_pipe; + DCAST_INTO_V(x11_pipe, _pipe); + cursor = x11_pipe->get_hidden_cursor(); + } + + if (XGrabPointer(_display, _xwindow, True, 0, GrabModeAsync, + GrabModeAsync, _xwindow, cursor, CurrentTime) != GrabSuccess) { + x11display_cat.error() << "Failed to grab pointer!\n"; + } else { + x11display_cat.info() << "Enabling relative mouse using XF86DGA extension\n"; + XF86DGADirectVideo(_display, _screen, XF86DGADirectMouse); + + _properties.set_mouse_mode(WindowProperties::M_relative); + _dga_mouse_enabled = true; + + // Get the real mouse position, so we can add/subtract + // our relative coordinates later. + XEvent event; + XQueryPointer(_display, _xwindow, &event.xbutton.root, + &event.xbutton.window, &event.xbutton.x_root, &event.xbutton.y_root, + &event.xbutton.x, &event.xbutton.y, &event.xbutton.state); + _input_devices[0].set_pointer_in_window(event.xbutton.x, event.xbutton.y); + } + } else { + x11display_cat.info() << "XF86DGA extension not available\n"; + _dga_mouse_enabled = false; + } + } + else +#endif + { + // can't change + properties.clear_mouse_mode(); + } + break; + + case WindowProperties::M_confined: + { +#ifdef HAVE_XF86DGA + if (_dga_mouse_enabled) { + XF86DGADirectVideo(_display, _screen, 0); + _dga_mouse_enabled = false; + } +#endif + X11_Cursor cursor = None; + if (_properties.get_cursor_hidden()) { + x11GraphicsPipe *x11_pipe; + DCAST_INTO_V(x11_pipe, _pipe); + cursor = x11_pipe->get_hidden_cursor(); + } + + if (XGrabPointer(_display, _xwindow, True, 0, GrabModeAsync, + GrabModeAsync, _xwindow, cursor, CurrentTime) != GrabSuccess) { + x11display_cat.error() << "Failed to grab pointer!\n"; + } else { + _properties.set_mouse_mode(WindowProperties::M_confined); + properties.clear_mouse_mode(); + } + } + break; + } + } + set_wm_properties(wm_properties, true); } @@ -721,14 +807,7 @@ set_properties_now(WindowProperties &properties) { //////////////////////////////////////////////////////////////////// void x11GraphicsWindow:: mouse_mode_absolute() { -#ifdef HAVE_XF86DGA - if (!_dga_mouse_enabled) return; - - XUngrabPointer(_display, CurrentTime); - x11display_cat.info() << "Disabling relative mouse using XF86DGA extension\n"; - XF86DGADirectVideo(_display, _screen, 0); - _dga_mouse_enabled = false; -#endif + // unused: remove in 1.10! } //////////////////////////////////////////////////////////////////// @@ -738,42 +817,7 @@ mouse_mode_absolute() { //////////////////////////////////////////////////////////////////// void x11GraphicsWindow:: mouse_mode_relative() { -#ifdef HAVE_XF86DGA - if (_dga_mouse_enabled) return; - - int major_ver, minor_ver; - if (XF86DGAQueryVersion(_display, &major_ver, &minor_ver)) { - - X11_Cursor cursor = None; - if (_properties.get_cursor_hidden()) { - x11GraphicsPipe *x11_pipe; - DCAST_INTO_V(x11_pipe, _pipe); - cursor = x11_pipe->get_hidden_cursor(); - } - - if (XGrabPointer(_display, _xwindow, True, 0, GrabModeAsync, - GrabModeAsync, _xwindow, cursor, CurrentTime) != GrabSuccess) { - x11display_cat.error() << "Failed to grab pointer!\n"; - return; - } - - x11display_cat.info() << "Enabling relative mouse using XF86DGA extension\n"; - XF86DGADirectVideo(_display, _screen, XF86DGADirectMouse); - - _dga_mouse_enabled = true; - } else { - x11display_cat.info() << "XF86DGA extension not available\n"; - _dga_mouse_enabled = false; - } - - // Get the real mouse position, so we can add/subtract - // our relative coordinates later. - XEvent event; - XQueryPointer(_display, _xwindow, &event.xbutton.root, - &event.xbutton.window, &event.xbutton.x_root, &event.xbutton.y_root, - &event.xbutton.x, &event.xbutton.y, &event.xbutton.state); - _input_devices[0].set_pointer_in_window(event.xbutton.x, event.xbutton.y); -#endif + // unused: remove in 1.10! } //////////////////////////////////////////////////////////////////// From f6841d7fc5f043a9f7affeb999c81eebe54c7d7b Mon Sep 17 00:00:00 2001 From: Ed Swartz Date: Fri, 17 Apr 2015 14:58:53 -0500 Subject: [PATCH 60/73] Add sample program demonstrating the mouse modes --- samples/mouse-modes/main.py | 172 ++++++++++++++++++++++++++++++++++++ 1 file changed, 172 insertions(+) create mode 100644 samples/mouse-modes/main.py diff --git a/samples/mouse-modes/main.py b/samples/mouse-modes/main.py new file mode 100644 index 0000000000..50e81f550e --- /dev/null +++ b/samples/mouse-modes/main.py @@ -0,0 +1,172 @@ +#!/usr/bin/env python +''' +Demonstrate different mouse modes +''' + +# from panda3d.core import loadPrcFileData +# +# loadPrcFileData("", "notify-level-x11display debug") +# loadPrcFileData("", "notify-level-windisplay debug") +# +# loadPrcFileData("", "load-display p3tinydisplay") + +from panda3d.core import WindowProperties, TextNode +from direct.task.TaskManagerGlobal import taskMgr +from direct.gui.OnscreenText import OnscreenText +from direct.task import Task +from direct.showbase.ShowBase import ShowBase + +import sys + +class App(ShowBase): + def __init__(self): + ShowBase.__init__(self) + self.base = self + self.setup() + + def genLabelText(self, text, i): + text = OnscreenText(text = text, pos = (-1.3, .5-.05*i), fg=(0,1,0,1), + align = TextNode.ALeft, scale = .05) + return text + + + def setup(self): + # Disable the camera trackball controls. + self.disableMouse() + + self.mouseMagnitude = 144 + + self.rotateX, self.rotateY = 0, 0 + + self.genLabelText("[0] Absolute mode, [1] Relative mode, [2] Confined mode", 0) + + self.base.accept('0', lambda: self.setMouseMode(WindowProperties.M_absolute)) + self.base.accept('1', lambda: self.setMouseMode(WindowProperties.M_relative)) + self.base.accept('2', lambda: self.setMouseMode(WindowProperties.M_confined)) + + self.genLabelText("[C] Manually re-center mouse on each tick", 1) + self.base.accept('C', lambda: self.toggleRecenter()) + self.base.accept('c', lambda: self.toggleRecenter()) + + self.genLabelText("[S] Show mouse", 2) + self.base.accept('S', lambda: self.toggleMouse()) + self.base.accept('s', lambda: self.toggleMouse()) + + self.base.accept('escape', sys.exit, [0]) + + self.mouseText = self.genLabelText("", 5) + self.deltaText = self.genLabelText("", 6) + self.positionText = self.genLabelText("", 8) + + self.lastMouseX, self.lastMouseY = None, None + + self.hideMouse = False + + self.setMouseMode(WindowProperties.M_absolute) + self.manualRecenterMouse = True + + # make a box to move with the mouse + self.model = self.loader.loadModel("box.egg") + self.model.reparentTo(self.render) + + self.cam.setPos(0, -5, 0) + self.cam.lookAt(0, 0, 0) + + self.mouseTask = taskMgr.add(self.mouseTask, "Mouse Task") + + def setMouseMode(self, mode): + print "Changing mode to",mode + + self.mouseMode = mode + + wp = WindowProperties() + wp.setMouseMode(mode) + self.base.win.requestProperties(wp) + + # these changes may require a tick to apply + self.base.taskMgr.doMethodLater(0, self.resolveMouse, "Resolve mouse setting") + + def resolveMouse(self, t): + wp = self.base.win.getProperties() + + actualMode = wp.getMouseMode() + if self.mouseMode != actualMode: + print "ACTUAL MOUSE MODE:", actualMode + + self.mouseMode = actualMode + + self.rotateX, self.rotateY = -.5, -.5 + self.lastMouseX, self.lastMouseY = None, None + self.recenterMouse() + + def recenterMouse(self): + self.base.win.movePointer(0, + int(self.base.win.getProperties().getXSize() / 2), + int(self.base.win.getProperties().getYSize() / 2)) + + + def toggleRecenter(self): + print "Toggling re-center behavior" + self.manualRecenterMouse = not self.manualRecenterMouse + + def toggleMouse(self): + print "Toggling mouse visibility" + + self.hideMouse = not self.hideMouse + + wp = WindowProperties() + wp.setCursorHidden(self.hideMouse) + self.base.win.requestProperties(wp) + + def mouseTask(self, task): + mw = self.base.mouseWatcherNode + + hasMouse = mw.hasMouse() + if hasMouse: + # get the window manager's idea of the mouse position + x, y = mw.getMouseX(), mw.getMouseY() + + if self.lastMouseX is not None: + # get the delta + if self.manualRecenterMouse: + # when recentering, the position IS the delta + # since the center is reported as 0, 0 + dx, dy = x, y + else: + dx, dy = x - self.lastMouseX, y - self.lastMouseY + else: + # no data to compare with yet + dx, dy = 0, 0 + + self.lastMouseX, self.lastMouseY = x, y + + else: + x, y, dx, dy = 0, 0, 0, 0 + + if self.manualRecenterMouse: + # move mouse back to center + self.recenterMouse() + + # scale position and delta to pixels for user + w, h = self.win.getSize() + + self.mouseText.setText("Mode: {0}, Recenter: {1} | Mouse: {2}, {3} | hasMouse: {4}".format( + self.mouseMode, self.manualRecenterMouse, + int(x*w), int(y*h), + hasMouse)) + self.deltaText.setText("Delta: {0}, {1}".format( + int(dx*w), int(dy*h))) + + # rotate box by delta + self.rotateX += dx * 10 + self.rotateY += dy * 10 + + self.positionText.setText("Model rotation: {0}, {1}".format( + int(self.rotateX*1000)/1000., int(self.rotateY*1000)/1000.)) + + self.model.setH(self.rotateX) + self.model.setP(self.rotateY) + return Task.cont + +app = App() +app.run() From 0f5b1a819205f78d990374cfe360a04a1bb8e1ed Mon Sep 17 00:00:00 2001 From: Ed Swartz Date: Fri, 17 Apr 2015 15:50:11 -0500 Subject: [PATCH 61/73] Fix X11 M_relative case when missing XF86DGA --- panda/src/x11display/x11GraphicsWindow.cxx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index f1484522a1..c503bda1cc 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -747,6 +747,7 @@ set_properties_now(WindowProperties &properties) { XF86DGADirectVideo(_display, _screen, XF86DGADirectMouse); _properties.set_mouse_mode(WindowProperties::M_relative); + properties.clear_mouse_mode(); _dga_mouse_enabled = true; // Get the real mouse position, so we can add/subtract @@ -762,12 +763,7 @@ set_properties_now(WindowProperties &properties) { _dga_mouse_enabled = false; } } - else #endif - { - // can't change - properties.clear_mouse_mode(); - } break; case WindowProperties::M_confined: From 53171c93c853637af9a6d23a9ffa30e7701e62b5 Mon Sep 17 00:00:00 2001 From: Ed Swartz Date: Fri, 17 Apr 2015 15:55:46 -0500 Subject: [PATCH 62/73] Replace some debug() calls with info()/warning() calls. --- panda/src/windisplay/winGraphicsWindow.cxx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index d4fcf6a9e2..a226dcde1b 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -380,18 +380,16 @@ set_properties_now(WindowProperties &properties) { RECT clip; if (!GetWindowRect(_hWnd, &clip)) { - if (windisplay_cat.is_debug()) { - windisplay_cat.debug() + windisplay_cat.warning() << "GetWindowRect() failed in set_properties_now. Cannot confine cursor.\n"; - } } else { - windisplay_cat.debug() + windisplay_cat.info() << "ClipCursor() to " << clip.left << "," << clip.top << " to " << clip.right << "," << clip.bottom << endl; GetClipCursor(&_mouse_unconfined_cliprect); if (!ClipCursor(&clip)) { - windisplay_cat.debug() + windisplay_cat.warning() << "ClipCursor() failed in set_properties_now. Ignoring.\n"; } else { _properties.set_mouse_mode(WindowProperties::M_confined); From 8876f0939e48c9c026c706b18405c64ad15d2aee Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 25 Apr 2015 07:23:54 -0700 Subject: [PATCH 63/73] add PfmFile::gamma_correct(), PfmFile::apply_mask(), PNMImage::copy_channel_bits() --- panda/src/pnmimage/pfmFile.I | 73 +++++++++- panda/src/pnmimage/pfmFile.cxx | 209 ++++++++++++++++++++-------- panda/src/pnmimage/pfmFile.h | 10 +- panda/src/pnmimage/pnmImage.cxx | 61 +++++++- panda/src/pnmimage/pnmImage.h | 1 + panda/src/pnmimage/pnmImageHeader.I | 46 +++--- 6 files changed, 314 insertions(+), 86 deletions(-) diff --git a/panda/src/pnmimage/pfmFile.I b/panda/src/pnmimage/pfmFile.I index 928677ca65..f3ae0cb5a5 100644 --- a/panda/src/pnmimage/pfmFile.I +++ b/panda/src/pnmimage/pfmFile.I @@ -16,7 +16,7 @@ //////////////////////////////////////////////////////////////////// // Function: PfmFile::is_valid // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE bool PfmFile:: is_valid() const { @@ -155,7 +155,7 @@ set_point2(int x, int y, const LVecBase2f &point) { case 4: (*(LPoint4f *)&_table[(y * _x_size + x) * _num_channels]).set(point[0], point[1], 0.0, 0.0); break; - } + } } //////////////////////////////////////////////////////////////////// @@ -276,7 +276,7 @@ set_point3(int x, int y, const LVecBase3f &point) { case 4: (*(LPoint4f *)&_table[(y * _x_size + x) * _num_channels]).set(point[0], point[1], 0.0f, 0.0f); break; - } + } } //////////////////////////////////////////////////////////////////// @@ -350,7 +350,7 @@ set_point4(int x, int y, const LVecBase4f &point) { case 4: *(LPoint4f *)&_table[(y * _x_size + x) * _num_channels] = point; break; - } + } } //////////////////////////////////////////////////////////////////// @@ -593,6 +593,71 @@ compute_planar_bounds(const LPoint2d ¢er, PN_float32 point_dist, PN_float32 return compute_planar_bounds(LCAST(PN_float32, center), point_dist, sample_radius, points_only); } +//////////////////////////////////////////////////////////////////// +// Function: PfmFile::gamma_correct +// Access: Published +// Description: Assuming the image was constructed with a gamma curve +// of from_gamma in the RGB channels, converts it to an +// image with a gamma curve of to_gamma in the RGB +// channels. Does not affect the alpha channel. +//////////////////////////////////////////////////////////////////// +INLINE void PfmFile:: +gamma_correct(float from_gamma, float to_gamma) { + apply_exponent(from_gamma / to_gamma); +} + +//////////////////////////////////////////////////////////////////// +// Function: PfmFile::gamma_correct_alpha +// Access: Published +// Description: Assuming the image was constructed with a gamma curve +// of from_gamma in the alpha channel, converts it to an +// image with a gamma curve of to_gamma in the alpha +// channel. Does not affect the RGB channels. +//////////////////////////////////////////////////////////////////// +INLINE void PfmFile:: +gamma_correct_alpha(float from_gamma, float to_gamma) { + apply_exponent(1.0, from_gamma / to_gamma); +} + +//////////////////////////////////////////////////////////////////// +// Function: PfmFile::apply_exponent +// Access: Published +// Description: Adjusts each channel of the image by raising the +// corresponding component value to the indicated +// exponent, such that L' = L ^ exponent. +//////////////////////////////////////////////////////////////////// +INLINE void PfmFile:: +apply_exponent(float gray_exponent) { + apply_exponent(gray_exponent, gray_exponent, gray_exponent, 1.0); +} + +//////////////////////////////////////////////////////////////////// +// Function: PfmFile::apply_exponent +// Access: Published +// Description: Adjusts each channel of the image by raising the +// corresponding component value to the indicated +// exponent, such that L' = L ^ exponent. +//////////////////////////////////////////////////////////////////// +INLINE void PfmFile:: +apply_exponent(float gray_exponent, float alpha_exponent) { + apply_exponent(gray_exponent, gray_exponent, gray_exponent, alpha_exponent); +} + +//////////////////////////////////////////////////////////////////// +// Function: PfmFile::apply_exponent +// Access: Published +// Description: Adjusts each channel of the image by raising the +// corresponding component value to the indicated +// exponent, such that L' = L ^ exponent. For a +// grayscale image, the blue_exponent value is used for +// the grayscale value, and red_exponent and +// green_exponent are unused. +//////////////////////////////////////////////////////////////////// +INLINE void PfmFile:: +apply_exponent(float c0_exponent, float c1_exponent, float c2_exponent) { + apply_exponent(c0_exponent, c1_exponent, c2_exponent, 1.0); +} + //////////////////////////////////////////////////////////////////// // Function: PfmFile::get_table // Access: Public diff --git a/panda/src/pnmimage/pfmFile.cxx b/panda/src/pnmimage/pfmFile.cxx index 071985a4d6..3cad7c7e99 100644 --- a/panda/src/pnmimage/pfmFile.cxx +++ b/panda/src/pnmimage/pfmFile.cxx @@ -233,7 +233,7 @@ write(const Filename &fullpath) { << "Unable to open " << filename << "\n"; return false; } - + if (pnmimage_cat.is_debug()) { pnmimage_cat.debug() << "Writing PFM file " << filename << "\n"; @@ -514,7 +514,7 @@ fill(const LPoint4f &value) { } } break; - } + } } //////////////////////////////////////////////////////////////////// @@ -767,7 +767,7 @@ calc_min_max(LVecBase3f &min_depth, LVecBase3f &max_depth) const { if (!has_point(xi, yi)) { continue; } - + const LPoint3f &p = get_point(xi, yi); if (!any_points) { min_depth = p; @@ -783,7 +783,7 @@ calc_min_max(LVecBase3f &min_depth, LVecBase3f &max_depth) const { } } } - + return any_points; } @@ -839,7 +839,7 @@ calc_autocrop(int &x_begin, int &x_end, int &y_begin, int &y_end) const { //////////////////////////////////////////////////////////////////// bool PfmFile:: is_row_empty(int y, int x_begin, int x_end) const { - nassertr(y >= 0 && y < _y_size && + nassertr(y >= 0 && y < _y_size && x_begin >= 0 && x_begin <= x_end && x_end <= _x_size, false); if (!_has_no_data_value) { @@ -863,7 +863,7 @@ is_row_empty(int y, int x_begin, int x_end) const { //////////////////////////////////////////////////////////////////// bool PfmFile:: is_column_empty(int x, int y_begin, int y_end) const { - nassertr(x >= 0 && x < _x_size && + nassertr(x >= 0 && x < _x_size && y_begin >= 0 && y_begin <= y_end && y_end <= _y_size, false); if (!_has_no_data_value) { @@ -1012,7 +1012,7 @@ resize(int new_x_size, int new_y_size) { if (pfm_resize_quick && new_x_size <= _x_size && new_y_size <= _y_size) { // If we're downscaling, we can use quick_filter, which is faster. result.quick_filter_from(*this); - + } else { // Otherwise, we should use box_filter() or gaussian_filter, which // are more general. @@ -1068,18 +1068,18 @@ quick_filter_from(const PfmFile &from) { for (int to_y = 0; to_y < _y_size; ++to_y) { from_y1 = (to_y + 1.0) * y_scale; from_y1 = min(from_y1, (PN_float32)orig_y_size); - + from_x0 = 0.0; for (int to_x = 0; to_x < _x_size; ++to_x) { from_x1 = (to_x + 1.0) * x_scale; from_x1 = min(from_x1, (PN_float32)orig_x_size); - + // Now the box from (from_x0, from_y0) - (from_x1, from_y1) // but not including (from_x1, from_y1) maps to the pixel (to_x, to_y). PN_float32 result; from.box_filter_region(result, from_x0, from_y0, from_x1, from_y1); new_data.push_back(result); - + from_x0 = from_x1; } from_y0 = from_y1; @@ -1093,19 +1093,19 @@ quick_filter_from(const PfmFile &from) { for (int to_y = 0; to_y < _y_size; ++to_y) { from_y1 = (to_y + 1.0) * y_scale; from_y1 = min(from_y1, (PN_float32)orig_y_size); - + from_x0 = 0.0; for (int to_x = 0; to_x < _x_size; ++to_x) { from_x1 = (to_x + 1.0) * x_scale; from_x1 = min(from_x1, (PN_float32)orig_x_size); - + // Now the box from (from_x0, from_y0) - (from_x1, from_y1) // but not including (from_x1, from_y1) maps to the pixel (to_x, to_y). LPoint2f result; from.box_filter_region(result, from_x0, from_y0, from_x1, from_y1); new_data.push_back(result[0]); new_data.push_back(result[1]); - + from_x0 = from_x1; } from_y0 = from_y1; @@ -1119,12 +1119,12 @@ quick_filter_from(const PfmFile &from) { for (int to_y = 0; to_y < _y_size; ++to_y) { from_y1 = (to_y + 1.0) * y_scale; from_y1 = min(from_y1, (PN_float32)orig_y_size); - + from_x0 = 0.0; for (int to_x = 0; to_x < _x_size; ++to_x) { from_x1 = (to_x + 1.0) * x_scale; from_x1 = min(from_x1, (PN_float32)orig_x_size); - + // Now the box from (from_x0, from_y0) - (from_x1, from_y1) // but not including (from_x1, from_y1) maps to the pixel (to_x, to_y). LPoint3f result; @@ -1132,7 +1132,7 @@ quick_filter_from(const PfmFile &from) { new_data.push_back(result[0]); new_data.push_back(result[1]); new_data.push_back(result[2]); - + from_x0 = from_x1; } from_y0 = from_y1; @@ -1146,12 +1146,12 @@ quick_filter_from(const PfmFile &from) { for (int to_y = 0; to_y < _y_size; ++to_y) { from_y1 = (to_y + 1.0) * y_scale; from_y1 = min(from_y1, (PN_float32)orig_y_size); - + from_x0 = 0.0; for (int to_x = 0; to_x < _x_size; ++to_x) { from_x1 = (to_x + 1.0) * x_scale; from_x1 = min(from_x1, (PN_float32)orig_x_size); - + // Now the box from (from_x0, from_y0) - (from_x1, from_y1) // but not including (from_x1, from_y1) maps to the pixel (to_x, to_y). LPoint4f result; @@ -1160,14 +1160,14 @@ quick_filter_from(const PfmFile &from) { new_data.push_back(result[1]); new_data.push_back(result[2]); new_data.push_back(result[3]); - + from_x0 = from_x1; } from_y0 = from_y1; } } break; - + default: nassertv(false); } @@ -1196,7 +1196,7 @@ reverse_rows() { for (int yi = 0; yi < _y_size; ++yi) { int source_yi = _y_size - 1 - yi; int start = source_yi * row_size; - reversed.insert(reversed.end(), + reversed.insert(reversed.end(), _table.begin() + start, _table.begin() + start + row_size); } @@ -1290,7 +1290,7 @@ xform(const LMatrix4f &transform) { // Description: Applies the distortion indicated in the supplied dist // map to the current map. The dist map is understood // to be a mapping of points in the range 0..1 in the -// first two dimensions. +// first two dimensions. // // The operation can be expressed symbolically as: // @@ -1334,7 +1334,7 @@ forward_distort(const PfmFile &dist, PN_float32 scale_factor) { PfmFile result; result.clear(working_x_size, working_y_size, _num_channels); - + if (_has_no_data_value) { result.set_no_data_value(_no_data_value); result.fill(_no_data_value); @@ -1412,7 +1412,7 @@ reverse_distort(const PfmFile &dist, PN_float32 scale_factor) { PfmFile result; result.clear(working_x_size, working_y_size, _num_channels); - + if (_has_no_data_value) { result.set_no_data_value(_no_data_value); result.fill(_no_data_value); @@ -1466,6 +1466,36 @@ merge(const PfmFile &other) { } } +//////////////////////////////////////////////////////////////////// +// Function: PfmFile::apply_mask +// Access: Published +// Description: Wherever there is missing data in the other PfmFile, +// set this the corresponding point in this PfmFile to +// missing as well, so that this PfmFile has only points +// where both files have points. +// +// The point is set to "missing" by setting it the +// no_data_value. +//////////////////////////////////////////////////////////////////// +void PfmFile:: +apply_mask(const PfmFile &other) { + nassertv(is_valid() && other.is_valid()); + nassertv(other._x_size == _x_size && other._y_size == _y_size); + + if (!other._has_no_data_value || !_has_no_data_value) { + // Trivial no-op. + return; + } + + for (int yi = 0; yi < _y_size; ++yi) { + for (int xi = 0; xi < _x_size; ++xi) { + if (!other.has_point(xi, yi)) { + set_point4(xi, yi, _no_data_value); + } + } + } +} + //////////////////////////////////////////////////////////////////// // Function: PfmFile::copy_channel // Access: Published @@ -1774,7 +1804,7 @@ compute_planar_bounds(const LPoint2f ¢er, PN_float32 point_dist, PN_float32 } PT(BoundingHexahedron) bounds; - + // We create a BoundingHexahedron with the points in a particular // well-defined order, based on the current coordinate system. CoordinateSystem cs = get_default_coordinate_system(); @@ -1941,7 +1971,7 @@ copy_sub_image(const PfmFile ©, int xto, int yto, } } break; - } + } } //////////////////////////////////////////////////////////////////// @@ -2008,7 +2038,7 @@ add_sub_image(const PfmFile ©, int xto, int yto, } } break; - } + } } //////////////////////////////////////////////////////////////////// @@ -2101,7 +2131,11 @@ divide_sub_image(const PfmFile ©, int xto, int yto, for (y = ymin; y < ymax; y++) { for (x = xmin; x < xmax; x++) { if (has_point(x, y) && copy.has_point(x - xmin + xfrom, y - ymin + yfrom)) { - set_point1(x, y, get_point1(x, y) / copy.get_point1(x - xmin + xfrom, y - ymin + yfrom) * pixel_scale); + float val = get_point1(x, y) / copy.get_point1(x - xmin + xfrom, y - ymin + yfrom) * pixel_scale; + if (cnan(val)) { + val = 0.0f; + } + set_point1(x, y, val); } } } @@ -2224,6 +2258,69 @@ operator *= (float multiplier) { } } +//////////////////////////////////////////////////////////////////// +// Function: PfmFile::apply_exponent +// Access: Published +// Description: Adjusts each channel of the image by raising the +// corresponding component value to the indicated +// exponent, such that L' = L ^ exponent. +//////////////////////////////////////////////////////////////////// +void PfmFile:: +apply_exponent(float c0_exponent, float c1_exponent, float c2_exponent, + float c3_exponent) { + switch (_num_channels) { + case 1: + { + for (int yi = 0; yi < _y_size; ++yi) { + for (int xi = 0; xi < _x_size; ++xi) { + float *val = &_table[(yi * _x_size + xi)]; + val[0] = cpow(val[0], c0_exponent); + } + } + } + break; + + case 2: + { + for (int yi = 0; yi < _y_size; ++yi) { + for (int xi = 0; xi < _x_size; ++xi) { + float *val = &_table[(yi * _x_size + xi) * _num_channels]; + val[0] = cpow(val[0], c0_exponent); + val[1] = cpow(val[1], c1_exponent); + } + } + } + break; + + case 3: + { + for (int yi = 0; yi < _y_size; ++yi) { + for (int xi = 0; xi < _x_size; ++xi) { + float *val = &_table[(yi * _x_size + xi) * _num_channels]; + val[0] = cpow(val[0], c0_exponent); + val[1] = cpow(val[1], c1_exponent); + val[2] = cpow(val[2], c2_exponent); + } + } + } + break; + + case 4: + { + for (int yi = 0; yi < _y_size; ++yi) { + for (int xi = 0; xi < _x_size; ++xi) { + float *val = &_table[(yi * _x_size + xi) * _num_channels]; + val[0] = cpow(val[0], c0_exponent); + val[1] = cpow(val[1], c1_exponent); + val[2] = cpow(val[2], c2_exponent); + val[3] = cpow(val[3], c3_exponent); + } + } + } + break; + } +} + //////////////////////////////////////////////////////////////////// // Function: PfmFile::output // Access: Published @@ -2418,7 +2515,7 @@ box_filter_region(LPoint4f &result, //////////////////////////////////////////////////////////////////// // Function: PfmFile::box_filter_line // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PfmFile:: box_filter_line(PN_float32 &result, PN_float32 &coverage, @@ -2447,7 +2544,7 @@ box_filter_line(PN_float32 &result, PN_float32 &coverage, //////////////////////////////////////////////////////////////////// // Function: PfmFile::box_filter_line // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PfmFile:: box_filter_line(LPoint2f &result, PN_float32 &coverage, @@ -2476,7 +2573,7 @@ box_filter_line(LPoint2f &result, PN_float32 &coverage, //////////////////////////////////////////////////////////////////// // Function: PfmFile::box_filter_line // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PfmFile:: box_filter_line(LPoint3f &result, PN_float32 &coverage, @@ -2505,7 +2602,7 @@ box_filter_line(LPoint3f &result, PN_float32 &coverage, //////////////////////////////////////////////////////////////////// // Function: PfmFile::box_filter_line // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PfmFile:: box_filter_line(LPoint4f &result, PN_float32 &coverage, @@ -2534,7 +2631,7 @@ box_filter_line(LPoint4f &result, PN_float32 &coverage, //////////////////////////////////////////////////////////////////// // Function: PfmFile::box_filter_point // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PfmFile:: box_filter_point(PN_float32 &result, PN_float32 &coverage, @@ -2552,7 +2649,7 @@ box_filter_point(PN_float32 &result, PN_float32 &coverage, //////////////////////////////////////////////////////////////////// // Function: PfmFile::box_filter_point // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PfmFile:: box_filter_point(LPoint2f &result, PN_float32 &coverage, @@ -2570,7 +2667,7 @@ box_filter_point(LPoint2f &result, PN_float32 &coverage, //////////////////////////////////////////////////////////////////// // Function: PfmFile::box_filter_point // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PfmFile:: box_filter_point(LPoint3f &result, PN_float32 &coverage, @@ -2588,7 +2685,7 @@ box_filter_point(LPoint3f &result, PN_float32 &coverage, //////////////////////////////////////////////////////////////////// // Function: PfmFile::box_filter_point // Access: Private -// Description: +// Description: //////////////////////////////////////////////////////////////////// void PfmFile:: box_filter_point(LPoint4f &result, PN_float32 &coverage, @@ -2611,7 +2708,7 @@ box_filter_point(LPoint4f &result, PN_float32 &coverage, // with the index to the nearest value. //////////////////////////////////////////////////////////////////// void PfmFile:: -fill_mini_grid(MiniGridCell *mini_grid, int x_size, int y_size, +fill_mini_grid(MiniGridCell *mini_grid, int x_size, int y_size, int xi, int yi, int dist, int sxi, int syi) const { if (xi < 0 || xi >= x_size || yi < 0 || yi >= y_size) { // Out of bounds. @@ -2634,12 +2731,12 @@ fill_mini_grid(MiniGridCell *mini_grid, int x_size, int y_size, //////////////////////////////////////////////////////////////////// // Function: PfmFile::has_point_noop // Access: Private, Static -// Description: The implementation of has_point() for +// Description: The implementation of has_point() for // files without a no_data_value. //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_noop(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return true; } @@ -2654,7 +2751,7 @@ has_point_noop(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_1(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return self->_table[(y * self->_x_size + x)] != self->_no_data_value[0]; } @@ -2669,7 +2766,7 @@ has_point_1(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_2(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return *(LPoint2f *)&self->_table[(y * self->_x_size + x) * 2] != *(LPoint2f *)&self->_no_data_value; } @@ -2684,7 +2781,7 @@ has_point_2(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_3(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return *(LPoint3f *)&self->_table[(y * self->_x_size + x) * 3] != *(LPoint3f *)&self->_no_data_value; } @@ -2699,7 +2796,7 @@ has_point_3(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_4(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return *(LPoint4f *)&self->_table[(y * self->_x_size + x) * 4] != *(LPoint4f *)&self->_no_data_value; } @@ -2714,7 +2811,7 @@ has_point_4(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_threshold_1(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { const float *table = &self->_table[(y * self->_x_size + x)]; return table[0] >= self->_no_data_value[0]; @@ -2730,7 +2827,7 @@ has_point_threshold_1(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_threshold_2(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { const float *table = &self->_table[(y * self->_x_size + x) * 2]; return (table[0] >= self->_no_data_value[0] || @@ -2747,7 +2844,7 @@ has_point_threshold_2(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_threshold_3(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { const float *table = &self->_table[(y * self->_x_size + x) * 3]; return (table[0] >= self->_no_data_value[0] || @@ -2765,7 +2862,7 @@ has_point_threshold_3(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_threshold_4(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { const float *table = &self->_table[(y * self->_x_size + x) * 4]; return (table[0] >= self->_no_data_value[0] || @@ -2785,7 +2882,7 @@ has_point_threshold_4(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_chan4(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return self->_table[(y * self->_x_size + x) * 4 + 3] >= 0.0; } @@ -2795,13 +2892,13 @@ has_point_chan4(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// // Function: PfmFile::has_point_nan_1 // Access: Private, Static -// Description: The implementation of has_point() for +// Description: The implementation of has_point() for // files with set_no_data_nan() in effect. This means // that the data is valid iff no components involve NaN. //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_nan_1(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return !cnan(self->_table[(y * self->_x_size + x) * self->_num_channels]); } @@ -2811,13 +2908,13 @@ has_point_nan_1(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// // Function: PfmFile::has_point_nan_2 // Access: Private, Static -// Description: The implementation of has_point() for +// Description: The implementation of has_point() for // files with set_no_data_nan() in effect. This means // that the data is valid iff no components involve NaN. //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_nan_2(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return !((LVecBase2f *)&self->_table[(y * self->_x_size + x) * self->_num_channels])->is_nan(); } @@ -2827,13 +2924,13 @@ has_point_nan_2(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// // Function: PfmFile::has_point_nan_3 // Access: Private, Static -// Description: The implementation of has_point() for +// Description: The implementation of has_point() for // files with set_no_data_nan() in effect. This means // that the data is valid iff no components involve NaN. //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_nan_3(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return !((LVecBase3f *)&self->_table[(y * self->_x_size + x) * self->_num_channels])->is_nan(); } @@ -2843,13 +2940,13 @@ has_point_nan_3(const PfmFile *self, int x, int y) { //////////////////////////////////////////////////////////////////// // Function: PfmFile::has_point_nan_4 // Access: Private, Static -// Description: The implementation of has_point() for +// Description: The implementation of has_point() for // files with set_no_data_nan() in effect. This means // that the data is valid iff no components involve NaN. //////////////////////////////////////////////////////////////////// bool PfmFile:: has_point_nan_4(const PfmFile *self, int x, int y) { - if ((x >= 0 && x < self->_x_size) && + if ((x >= 0 && x < self->_x_size) && (y >= 0 && y < self->_y_size)) { return !((LVecBase4f *)&self->_table[(y * self->_x_size + x) * self->_num_channels])->is_nan(); } diff --git a/panda/src/pnmimage/pfmFile.h b/panda/src/pnmimage/pfmFile.h index 0249b71331..ab0347f739 100644 --- a/panda/src/pnmimage/pfmFile.h +++ b/panda/src/pnmimage/pfmFile.h @@ -123,6 +123,7 @@ PUBLISHED: BLOCKING void forward_distort(const PfmFile &dist, PN_float32 scale_factor = 1.0); BLOCKING void reverse_distort(const PfmFile &dist, PN_float32 scale_factor = 1.0); BLOCKING void merge(const PfmFile &other); + BLOCKING void apply_mask(const PfmFile &other); BLOCKING void copy_channel(int to_channel, const PfmFile &other, int from_channel); BLOCKING void copy_channel_masked(int to_channel, const PfmFile &other, int from_channel); BLOCKING void apply_crop(int x_begin, int x_end, int y_begin, int y_end); @@ -155,6 +156,13 @@ PUBLISHED: void operator *= (float multiplier); + INLINE void gamma_correct(float from_gamma, float to_gamma); + INLINE void gamma_correct_alpha(float from_gamma, float to_gamma); + INLINE void apply_exponent(float gray_exponent); + INLINE void apply_exponent(float gray_exponent, float alpha_exponent); + INLINE void apply_exponent(float c0_exponent, float c1_exponent, float c2_exponent); + void apply_exponent(float c0_exponent, float c1_exponent, float c2_exponent, float c3_exponent); + void output(ostream &out) const; EXTENSION(PyObject *get_points() const); @@ -204,7 +212,7 @@ private: int _dist; }; - void fill_mini_grid(MiniGridCell *mini_grid, int x_size, int y_size, + void fill_mini_grid(MiniGridCell *mini_grid, int x_size, int y_size, int xi, int yi, int dist, int sxi, int syi) const; static bool has_point_noop(const PfmFile *file, int x, int y); diff --git a/panda/src/pnmimage/pnmImage.cxx b/panda/src/pnmimage/pnmImage.cxx index 692e26b11d..b4b98ad6c8 100644 --- a/panda/src/pnmimage/pnmImage.cxx +++ b/panda/src/pnmimage/pnmImage.cxx @@ -152,6 +152,57 @@ copy_channel(const PNMImage ©, int src_channel, int dest_channel) { } } +//////////////////////////////////////////////////////////////////// +// Function: PNMImage::copy_channel_bits +// Access: Published +// Description: Copies some subset of the bits of the specified +// channel from one image into some subset of the bits +// of the specified channel in another image. Images +// must be the same size. +// +// If right_shift is negative, it means a left shift. +//////////////////////////////////////////////////////////////////// +void PNMImage:: +copy_channel_bits(const PNMImage ©, int src_channel, int dest_channel, xelval src_mask, int right_shift) { + // Make sure the channels are in range + nassertv(src_channel >= 0 && src_channel <= 3); + nassertv(dest_channel >= 0 && dest_channel <= 3); + // Make sure that images are valid + if (!copy.is_valid() || !is_valid()) { + pnmimage_cat.error() << "One of the images is invalid!\n"; + return; + } + // Make sure the images are the same size + if (_x_size != copy.get_x_size() || _y_size != copy.get_y_size()){ + pnmimage_cat.error() << "Image size doesn't match!\n"; + return; + } + + // Do the actual copying. + if (right_shift >= 0) { + xelval dest_mask = ~(src_mask >> right_shift); + for (int x = 0; x < _x_size; x++) { + for (int y = 0; y < _y_size; y++) { + xelval src = copy.get_channel_val(x, y, src_channel); + xelval dest = get_channel_val(x, y, dest_channel); + dest = (dest & dest_mask) | ((src & src_mask) >> right_shift); + set_channel_val(x, y, dest_channel, dest); + } + } + } else { + int left_shift = -right_shift; + xelval dest_mask = ~(src_mask << left_shift); + for (int x = 0; x < _x_size; x++) { + for (int y = 0; y < _y_size; y++) { + xelval src = copy.get_channel_val(x, y, src_channel); + xelval dest = get_channel_val(x, y, dest_channel); + dest = (dest & dest_mask) | ((src & src_mask) << left_shift); + set_channel_val(x, y, dest_channel, dest); + } + } + } +} + //////////////////////////////////////////////////////////////////// // Function: PNMImage::copy_header_from // Access: Published @@ -165,6 +216,12 @@ copy_header_from(const PNMImageHeader &header) { clear(); PNMImageHeader::operator = (header); + if (_maxval == 0) { + _inv_maxval = 0.0f; + } else { + _inv_maxval = 1.0f / (float)_maxval; + } + if (has_alpha()) { allocate_alpha(); } @@ -1708,7 +1765,7 @@ rescale(float min_val, float max_val) { for (int y = 0; y < get_y_size(); y++) { for (int x = 0; x < get_x_size(); x++) { LRGBColorf xel = get_xel(x, y); - set_xel(x, y, + set_xel(x, y, (xel[0] - min_val) / scale, (xel[1] - min_val) / scale, (xel[2] - min_val) / scale); @@ -1899,7 +1956,7 @@ unfiltered_stretch_from(const PNMImage ©) { } } - if (has_alpha() && copy.has_alpha()) { + if (has_alpha() && copy.has_alpha()) { for (int yt = 0; yt < get_y_size(); yt++) { int ys = yt * copy.get_y_size() / get_y_size(); for (int xt = 0; xt < get_x_size(); xt++) { diff --git a/panda/src/pnmimage/pnmImage.h b/panda/src/pnmimage/pnmImage.h index b01d5ec974..dd75fda118 100644 --- a/panda/src/pnmimage/pnmImage.h +++ b/panda/src/pnmimage/pnmImage.h @@ -90,6 +90,7 @@ PUBLISHED: void copy_from(const PNMImage ©); void copy_channel(const PNMImage ©, int src_channel, int dest_channel); + void copy_channel_bits(const PNMImage ©, int src_channel, int dest_channel, xelval src_mask, int right_shift); void copy_header_from(const PNMImageHeader &header); void take_from(PNMImage &orig); diff --git a/panda/src/pnmimage/pnmImageHeader.I b/panda/src/pnmimage/pnmImageHeader.I index 0e22848fdd..18d7d5b3df 100644 --- a/panda/src/pnmimage/pnmImageHeader.I +++ b/panda/src/pnmimage/pnmImageHeader.I @@ -255,7 +255,7 @@ set_type(PNMFileType *type) { // Description: Records the indicated color in the histogram. //////////////////////////////////////////////////////////////////// INLINE void PNMImageHeader:: -record_color(PNMImageHeader::HistMap &hist, +record_color(PNMImageHeader::HistMap &hist, const PNMImageHeader::PixelSpec &color) { // First, try to add the color with a count of 0, in case it does // not already exist in the table. @@ -270,7 +270,7 @@ record_color(PNMImageHeader::HistMap &hist, //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::PixelSpec:: PixelSpec(xelval gray_value) : @@ -284,7 +284,7 @@ PixelSpec(xelval gray_value) : //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::PixelSpec:: PixelSpec(xelval gray_value, xelval alpha) : @@ -298,7 +298,7 @@ PixelSpec(xelval gray_value, xelval alpha) : //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::PixelSpec:: PixelSpec(xelval red, xelval green, xelval blue) : @@ -312,7 +312,7 @@ PixelSpec(xelval red, xelval green, xelval blue) : //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::PixelSpec:: PixelSpec(xelval red, xelval green, xelval blue, xelval alpha) : @@ -326,7 +326,7 @@ PixelSpec(xelval red, xelval green, xelval blue, xelval alpha) : //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::PixelSpec:: PixelSpec(const xel &rgb) : @@ -340,7 +340,7 @@ PixelSpec(const xel &rgb) : //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::PixelSpec:: PixelSpec(const xel &rgb, xelval alpha) : @@ -354,7 +354,7 @@ PixelSpec(const xel &rgb, xelval alpha) : //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::Copy Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::PixelSpec:: PixelSpec(const PixelSpec ©) : @@ -368,7 +368,7 @@ PixelSpec(const PixelSpec ©) : //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::Copy Assignment Operator // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PNMImageHeader::PixelSpec:: operator = (const PixelSpec ©) { @@ -381,7 +381,7 @@ operator = (const PixelSpec ©) { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::operator < // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE bool PNMImageHeader::PixelSpec:: operator < (const PixelSpec &other) const { @@ -391,7 +391,7 @@ operator < (const PixelSpec &other) const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::operator == // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE bool PNMImageHeader::PixelSpec:: operator == (const PixelSpec &other) const { @@ -401,7 +401,7 @@ operator == (const PixelSpec &other) const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::operator != // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE bool PNMImageHeader::PixelSpec:: operator != (const PixelSpec &other) const { @@ -411,7 +411,7 @@ operator != (const PixelSpec &other) const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::compare_to // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE int PNMImageHeader::PixelSpec:: compare_to(const PixelSpec &other) const { @@ -433,7 +433,7 @@ compare_to(const PixelSpec &other) const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::get_red // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE xelval PNMImageHeader::PixelSpec:: get_red() const { @@ -443,7 +443,7 @@ get_red() const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::get_green // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE xelval PNMImageHeader::PixelSpec:: get_green() const { @@ -453,7 +453,7 @@ get_green() const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::get_blue // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE xelval PNMImageHeader::PixelSpec:: get_blue() const { @@ -463,7 +463,7 @@ get_blue() const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::get_alpha // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE xelval PNMImageHeader::PixelSpec:: get_alpha() const { @@ -473,7 +473,7 @@ get_alpha() const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::set_red // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PNMImageHeader::PixelSpec:: set_red(xelval red) { @@ -483,7 +483,7 @@ set_red(xelval red) { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::set_green // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PNMImageHeader::PixelSpec:: set_green(xelval green) { @@ -493,7 +493,7 @@ set_green(xelval green) { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::set_blue // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PNMImageHeader::PixelSpec:: set_blue(xelval blue) { @@ -503,7 +503,7 @@ set_blue(xelval blue) { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpec::set_alpha // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE void PNMImageHeader::PixelSpec:: set_alpha(xelval alpha) { @@ -541,7 +541,7 @@ size() { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::PixelSpecCount::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::PixelSpecCount:: PixelSpecCount(const PNMImageHeader::PixelSpec &pixel, int count) : @@ -565,7 +565,7 @@ operator < (const PNMImageHeader::PixelSpecCount &other) const { //////////////////////////////////////////////////////////////////// // Function: PNMImageHeader::Histogram::Constructor // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// INLINE PNMImageHeader::Histogram:: Histogram() { From 077d03a9f6a660473e3a17a5530848a70a03b696 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 25 Apr 2015 17:09:50 +0200 Subject: [PATCH 64/73] Center p3dCert on screen, and make it a modal dialog --- direct/src/plugin/p3dCert.cxx | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/direct/src/plugin/p3dCert.cxx b/direct/src/plugin/p3dCert.cxx index 528bde0d49..b920550092 100644 --- a/direct/src/plugin/p3dCert.cxx +++ b/direct/src/plugin/p3dCert.cxx @@ -157,6 +157,10 @@ AuthDialog(const string &cert_filename, const string &cert_dir) : _stack = NULL; _verify_result = -1; + // Center the window on the screen. + position((Fl::w() - w()) / 2, (Fl::h() - h()) / 2); + set_modal(); + read_cert_file(cert_filename); get_friendly_name(); verify_cert(); @@ -583,6 +587,10 @@ ViewCertDialog(AuthDialog *auth_dialog, X509 *cert) : _auth_dialog(auth_dialog), _cert(cert) { + // Center the window on the screen. + position((Fl::w() - w()) / 2, (Fl::h() - h()) / 2); + set_modal(); + layout(); } From f1ea25bfb1cc32549f7ad502bee0ed07a10453fb Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 25 Apr 2015 17:13:35 +0200 Subject: [PATCH 65/73] Unexpose BoundingVolume::around, add GraphicsOutput::get_fb_size --- panda/src/display/graphicsOutput.I | 48 ++++++++++++++++++++ panda/src/display/graphicsOutput.h | 3 ++ panda/src/mathutil/boundingVolume.h | 2 + panda/src/mathutil/geometricBoundingVolume.h | 2 + 4 files changed, 55 insertions(+) diff --git a/panda/src/display/graphicsOutput.I b/panda/src/display/graphicsOutput.I index 2b746ff09d..b24390146b 100644 --- a/panda/src/display/graphicsOutput.I +++ b/panda/src/display/graphicsOutput.I @@ -207,6 +207,20 @@ get_y_size() const { return _size.get_y(); } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsOutput::get_fb_size +// Access: Published +// Description: Returns the internal size of the window or buffer. +// This is almost always the same as get_size(), +// except when a pixel_zoom is in effect--see +// set_pixel_zoom(). +//////////////////////////////////////////////////////////////////// +INLINE LVecBase2i GraphicsOutput:: +get_fb_size() const { + return LVecBase2i(max(int(_size.get_x() * get_pixel_factor()), 1), + max(int(_size.get_y() * get_pixel_factor()), 1)); +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsOutput::get_fb_x_size // Access: Published @@ -233,6 +247,23 @@ get_fb_y_size() const { return max(int(_size.get_y() * get_pixel_factor()), 1); } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsOutput::get_sbs_left_size +// Access: Published +// Description: If side-by-side stereo is enabled, this returns the +// pixel size of the left eye, based on scaling +// get_size() by get_sbs_left_dimensions(). If +// side-by-side stereo is not enabled, this returns the +// same as get_size(). +//////////////////////////////////////////////////////////////////// +INLINE LVecBase2i GraphicsOutput:: +get_sbs_left_size() const { + PN_stdfloat left_w = _sbs_left_dimensions[1] - _sbs_left_dimensions[0]; + PN_stdfloat left_h = _sbs_left_dimensions[3] - _sbs_left_dimensions[2]; + return LVecBase2i(max(int(_size.get_x() * left_w), 1), + max(int(_size.get_y() * left_h), 1)); +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsOutput::get_sbs_left_x_size // Access: Published @@ -263,6 +294,23 @@ get_sbs_left_y_size() const { return max(int(_size.get_y() * left_h), 1); } +//////////////////////////////////////////////////////////////////// +// Function: GraphicsOutput::get_sbs_right_size +// Access: Published +// Description: If side-by-side stereo is enabled, this returns the +// pixel size of the right eye, based on scaling +// get_size() by get_sbs_right_dimensions(). If +// side-by-side stereo is not enabled, this returns the +// same as get_size(). +//////////////////////////////////////////////////////////////////// +INLINE LVecBase2i GraphicsOutput:: +get_sbs_right_size() const { + PN_stdfloat right_w = _sbs_right_dimensions[1] - _sbs_right_dimensions[0]; + PN_stdfloat right_h = _sbs_right_dimensions[3] - _sbs_right_dimensions[2]; + return LVecBase2i(max(int(_size.get_x() * right_w), 1), + max(int(_size.get_y() * right_h), 1)); +} + //////////////////////////////////////////////////////////////////// // Function: GraphicsOutput::get_sbs_right_x_size // Access: Published diff --git a/panda/src/display/graphicsOutput.h b/panda/src/display/graphicsOutput.h index cbcd787d90..7c01cff360 100644 --- a/panda/src/display/graphicsOutput.h +++ b/panda/src/display/graphicsOutput.h @@ -135,10 +135,13 @@ PUBLISHED: INLINE const LVecBase2i &get_size() const; INLINE int get_x_size() const; INLINE int get_y_size() const; + INLINE LVecBase2i get_fb_size() const; INLINE int get_fb_x_size() const; INLINE int get_fb_y_size() const; + INLINE LVecBase2i get_sbs_left_size() const; INLINE int get_sbs_left_x_size() const; INLINE int get_sbs_left_y_size() const; + INLINE LVecBase2i get_sbs_right_size() const; INLINE int get_sbs_right_x_size() const; INLINE int get_sbs_right_y_size() const; INLINE bool has_size() const; diff --git a/panda/src/mathutil/boundingVolume.h b/panda/src/mathutil/boundingVolume.h index ef7663ad2f..3af3e7fa2d 100644 --- a/panda/src/mathutil/boundingVolume.h +++ b/panda/src/mathutil/boundingVolume.h @@ -56,12 +56,14 @@ PUBLISHED: INLINE_MATHUTIL bool extend_by(const BoundingVolume *vol); +public: // It might be nice to make these template member functions so we // could have true STL-style first/last iterators, but that's // impossible for virtual functions. bool around(const BoundingVolume **first, const BoundingVolume **last); +PUBLISHED: // The contains() functions return the union of one or more of these // bits. enum IntersectionFlags { diff --git a/panda/src/mathutil/geometricBoundingVolume.h b/panda/src/mathutil/geometricBoundingVolume.h index 768db6063d..4bd53591e3 100644 --- a/panda/src/mathutil/geometricBoundingVolume.h +++ b/panda/src/mathutil/geometricBoundingVolume.h @@ -36,6 +36,7 @@ PUBLISHED: INLINE_MATHUTIL bool extend_by(const GeometricBoundingVolume *vol); INLINE_MATHUTIL bool extend_by(const LPoint3 &point); +public: // It might be nice to make these template member functions so we // could have true STL-style first/last iterators, but that's // impossible for virtual functions. @@ -43,6 +44,7 @@ PUBLISHED: const GeometricBoundingVolume **last); INLINE_MATHUTIL bool around(const LPoint3 *first, const LPoint3 *last); +PUBLISHED: INLINE_MATHUTIL int contains(const GeometricBoundingVolume *vol) const; INLINE_MATHUTIL int contains(const LPoint3 &point) const; INLINE_MATHUTIL int contains(const LPoint3 &a, const LPoint3 &b) const; From 66011a13526b89efc188469087672f5ffabce89c Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 25 Apr 2015 17:17:33 +0200 Subject: [PATCH 66/73] Expose _NET_WM_PID to window managers in X11 --- panda/src/x11display/x11GraphicsPipe.cxx | 1 + panda/src/x11display/x11GraphicsPipe.h | 1 + panda/src/x11display/x11GraphicsWindow.cxx | 57 ++++++++++++---------- panda/src/x11display/x11GraphicsWindow.h | 9 ---- 4 files changed, 33 insertions(+), 35 deletions(-) diff --git a/panda/src/x11display/x11GraphicsPipe.cxx b/panda/src/x11display/x11GraphicsPipe.cxx index e6402ce255..83ba8de3d4 100644 --- a/panda/src/x11display/x11GraphicsPipe.cxx +++ b/panda/src/x11display/x11GraphicsPipe.cxx @@ -140,6 +140,7 @@ x11GraphicsPipe(const string &display) { // Get some X atom numbers. _wm_delete_window = XInternAtom(_display, "WM_DELETE_WINDOW", false); + _net_wm_pid = XInternAtom(_display, "_NET_WM_PID", false); _net_wm_window_type = XInternAtom(_display, "_NET_WM_WINDOW_TYPE", false); _net_wm_window_type_splash = XInternAtom(_display, "_NET_WM_WINDOW_TYPE_SPLASH", false); _net_wm_window_type_fullscreen = XInternAtom(_display, "_NET_WM_WINDOW_TYPE_FULLSCREEN", false); diff --git a/panda/src/x11display/x11GraphicsPipe.h b/panda/src/x11display/x11GraphicsPipe.h index e9a54fa1ee..2cd07245b4 100644 --- a/panda/src/x11display/x11GraphicsPipe.h +++ b/panda/src/x11display/x11GraphicsPipe.h @@ -52,6 +52,7 @@ public: public: // Atom specifications. Atom _wm_delete_window; + Atom _net_wm_pid; Atom _net_wm_window_type; Atom _net_wm_window_type_splash; Atom _net_wm_window_type_fullscreen; diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index c503bda1cc..5195b8ac5d 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -105,15 +105,6 @@ x11GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, _awaiting_configure = false; _dga_mouse_enabled = false; _wm_delete_window = x11_pipe->_wm_delete_window; - _net_wm_window_type = x11_pipe->_net_wm_window_type; - _net_wm_window_type_splash = x11_pipe->_net_wm_window_type_splash; - _net_wm_window_type_fullscreen = x11_pipe->_net_wm_window_type_fullscreen; - _net_wm_state = x11_pipe->_net_wm_state; - _net_wm_state_fullscreen = x11_pipe->_net_wm_state_fullscreen; - _net_wm_state_above = x11_pipe->_net_wm_state_above; - _net_wm_state_below = x11_pipe->_net_wm_state_below; - _net_wm_state_add = x11_pipe->_net_wm_state_add; - _net_wm_state_remove = x11_pipe->_net_wm_state_remove; GraphicsWindowInputDevice device = GraphicsWindowInputDevice::pointer_and_keyboard(this, "keyboard_mouse"); @@ -175,7 +166,6 @@ move_pointer(int device, int x, int y) { } } - //////////////////////////////////////////////////////////////////// // Function: x11GraphicsWindow::begin_frame // Access: Public, Virtual @@ -1037,6 +1027,9 @@ open_window() { //////////////////////////////////////////////////////////////////// void x11GraphicsWindow:: set_wm_properties(const WindowProperties &properties, bool already_mapped) { + x11GraphicsPipe *x11_pipe; + DCAST_INTO_V(x11_pipe, _pipe); + // Name the window if there is a name XTextProperty window_name; XTextProperty *window_name_p = (XTextProperty *)NULL; @@ -1117,15 +1110,15 @@ set_wm_properties(const WindowProperties &properties, bool already_mapped) { if (properties.get_fullscreen()) { // For a "fullscreen" request, we pass this through, hoping the // window manager will support EWMH. - type_data[next_type_data++] = _net_wm_window_type_fullscreen; + type_data[next_type_data++] = x11_pipe->_net_wm_window_type_fullscreen; // We also request it as a state. - state_data[next_state_data++] = _net_wm_state_fullscreen; + state_data[next_state_data++] = x11_pipe->_net_wm_state_fullscreen; // Don't ask me why this has to be 1/0 and not _net_wm_state_add. // It doesn't seem to work otherwise. - set_data[next_set_data++] = SetAction(_net_wm_state_fullscreen, 1); + set_data[next_set_data++] = SetAction(x11_pipe->_net_wm_state_fullscreen, 1); } else { - set_data[next_set_data++] = SetAction(_net_wm_state_fullscreen, 0); + set_data[next_set_data++] = SetAction(x11_pipe->_net_wm_state_fullscreen, 0); } // If we asked for a window without a border, there's no excellent @@ -1152,26 +1145,32 @@ set_wm_properties(const WindowProperties &properties, bool already_mapped) { } if (properties.get_undecorated() && !properties.get_fullscreen()) { - type_data[next_type_data++] = _net_wm_window_type_splash; + type_data[next_type_data++] = x11_pipe->_net_wm_window_type_splash; } if (properties.has_z_order()) { switch (properties.get_z_order()) { case WindowProperties::Z_bottom: - state_data[next_state_data++] = _net_wm_state_below; - set_data[next_set_data++] = SetAction(_net_wm_state_below, _net_wm_state_add); - set_data[next_set_data++] = SetAction(_net_wm_state_above, _net_wm_state_remove); + state_data[next_state_data++] = x11_pipe->_net_wm_state_below; + set_data[next_set_data++] = SetAction(x11_pipe->_net_wm_state_below, + x11_pipe->_net_wm_state_add); + set_data[next_set_data++] = SetAction(x11_pipe->_net_wm_state_above, + x11_pipe->_net_wm_state_remove); break; case WindowProperties::Z_normal: - set_data[next_set_data++] = SetAction(_net_wm_state_below, _net_wm_state_remove); - set_data[next_set_data++] = SetAction(_net_wm_state_above, _net_wm_state_remove); + set_data[next_set_data++] = SetAction(x11_pipe->_net_wm_state_below, + x11_pipe->_net_wm_state_remove); + set_data[next_set_data++] = SetAction(x11_pipe->_net_wm_state_above, + x11_pipe->_net_wm_state_remove); break; case WindowProperties::Z_top: - state_data[next_state_data++] = _net_wm_state_above; - set_data[next_set_data++] = SetAction(_net_wm_state_below, _net_wm_state_remove); - set_data[next_set_data++] = SetAction(_net_wm_state_above, _net_wm_state_add); + state_data[next_state_data++] = x11_pipe->_net_wm_state_above; + set_data[next_set_data++] = SetAction(x11_pipe->_net_wm_state_below, + x11_pipe->_net_wm_state_remove); + set_data[next_set_data++] = SetAction(x11_pipe->_net_wm_state_above, + x11_pipe->_net_wm_state_add); break; } } @@ -1180,12 +1179,18 @@ set_wm_properties(const WindowProperties &properties, bool already_mapped) { nassertv(next_state_data < max_state_data); nassertv(next_set_data < max_set_data); - XChangeProperty(_display, _xwindow, _net_wm_window_type, + // Add the process ID as a convenience for other applications. + Cardinal pid = getpid(); + XChangeProperty(_display, _xwindow, x11_pipe->_net_wm_pid, + XA_CARDINAL, 32, PropModeReplace, + (unsigned char *)&pid, 1); + + XChangeProperty(_display, _xwindow, x11_pipe->_net_wm_window_type, XA_ATOM, 32, PropModeReplace, (unsigned char *)type_data, next_type_data); // Request the state properties all at once. - XChangeProperty(_display, _xwindow, _net_wm_state, + XChangeProperty(_display, _xwindow, x11_pipe->_net_wm_state, XA_ATOM, 32, PropModeReplace, (unsigned char *)state_data, next_state_data); @@ -1204,7 +1209,7 @@ set_wm_properties(const WindowProperties &properties, bool already_mapped) { event.send_event = True; event.display = _display; event.window = _xwindow; - event.message_type = _net_wm_state; + event.message_type = x11_pipe->_net_wm_state; event.format = 32; event.data.l[0] = set_data[i]._action; event.data.l[1] = set_data[i]._state; diff --git a/panda/src/x11display/x11GraphicsWindow.h b/panda/src/x11display/x11GraphicsWindow.h index e032cd7109..9fc7210f60 100644 --- a/panda/src/x11display/x11GraphicsWindow.h +++ b/panda/src/x11display/x11GraphicsWindow.h @@ -100,15 +100,6 @@ protected: bool _awaiting_configure; bool _dga_mouse_enabled; Atom _wm_delete_window; - Atom _net_wm_window_type; - Atom _net_wm_window_type_splash; - Atom _net_wm_window_type_fullscreen; - Atom _net_wm_state; - Atom _net_wm_state_fullscreen; - Atom _net_wm_state_above; - Atom _net_wm_state_below; - Atom _net_wm_state_add; - Atom _net_wm_state_remove; struct MouseDeviceInfo { int _fd; From 92d40c314427acd34f17cf3c7ef373b35a7a85a9 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 25 Apr 2015 18:48:48 +0200 Subject: [PATCH 67/73] Default vertex column alignment should be 4 --- panda/src/gobj/config_gobj.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index ce1cdce7c6..a1d3c43d03 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -279,7 +279,7 @@ ConfigVariableBool vertices_float64 "slower.")); ConfigVariableInt vertex_column_alignment -("vertex-column-alignment", 1, +("vertex-column-alignment", 4, PRC_DESC("This specifies the default byte alignment for each column of " "data within a GeomVertexData when it is assembled using the default " "interfaces. Normally, you should not change this config variable " From 589a1b52ac9c13ff2c2060fa6f46e23e923fb320 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 26 Apr 2015 15:07:09 +0200 Subject: [PATCH 68/73] Revert unintentional debug message check-in --- .../glstuff/glGraphicsStateGuardian_src.cxx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 5471dfeb87..d24448189f 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -6928,8 +6928,8 @@ query_gl_version() { string_to_int(components[1], _gl_version_minor); } - if (GLCAT.is_info()) { - GLCAT.info() + if (GLCAT.is_debug()) { + GLCAT.debug() << "GL_VERSION = " << version << ", decoded to " << _gl_version_major << "." << _gl_version_minor << "\n"; @@ -6949,19 +6949,21 @@ query_gl_version() { _gl_shadlang_ver_major = 1; _gl_shadlang_ver_minor = 1; const char *verstr = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION); - if (verstr == NULL || sscanf(verstr, "%d.%d", &_gl_shadlang_ver_major, &_gl_shadlang_ver_minor) != 2) { - GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; + if (verstr == NULL || + sscanf(verstr, "%d.%d", &_gl_shadlang_ver_major, + &_gl_shadlang_ver_minor) != 2) { + GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; } - cerr << verstr << " -> " << _gl_shadlang_ver_major << " . " << _gl_shadlang_ver_minor << "\n"; } #elif defined(OPENGLES_2) _gl_shadlang_ver_major = 1; _gl_shadlang_ver_minor = 0; const char *verstr = (const char *) glGetString(GL_SHADING_LANGUAGE_VERSION); - if (verstr == NULL || sscanf(verstr, "OpenGL ES GLSL %d.%d", &_gl_shadlang_ver_major, &_gl_shadlang_ver_minor) != 2) { - GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; + if (verstr == NULL || + sscanf(verstr, "OpenGL ES GLSL %d.%d", &_gl_shadlang_ver_major, + &_gl_shadlang_ver_minor) != 2) { + GLCAT.warning() << "Invalid GL_SHADING_LANGUAGE_VERSION format.\n"; } - cerr << verstr << " -> " << _gl_shadlang_ver_major << " . " << _gl_shadlang_ver_minor << "\n"; #endif } } From a745184f25f22160de049e89718bec2d810f2a0e Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 26 Apr 2015 15:27:39 +0200 Subject: [PATCH 69/73] Fix X11 compile and interrogate issues --- panda/src/display/get_x11.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/panda/src/display/get_x11.h b/panda/src/display/get_x11.h index 88f3a21ff2..7ea150a963 100644 --- a/panda/src/display/get_x11.h +++ b/panda/src/display/get_x11.h @@ -17,7 +17,7 @@ #include "pandabase.h" -#ifdef HAVE_X11 +#ifdef HAVE_X11 // This header file is designed to help work around some of the // namespace spamming that X11 causes, by renaming the symbols that // X11 declares that are known to conflict with other library names @@ -30,14 +30,21 @@ #ifdef CPPPARSER // A simple hack so interrogate can get all of the necessary // typenames. -typedef int X11_Display; -typedef int X11_Window; -typedef int X11_Cursor; -typedef int XErrorEvent; -typedef int XVisualInfo; -typedef int Atom; -typedef int XIM; -typedef int XIC; +typedef struct _XDisplay X11_Display; +typedef unsigned int XID; +typedef unsigned int Atom; +typedef unsigned int Cardinal; +typedef XID Colormap; +typedef XID X11_Window; +typedef XID X11_Cursor; +typedef struct _XIM *XIM; +typedef struct _XIC *XIC; +struct XErrorEvent; +struct XVisualInfo; +#define Bool int +#define Status int +#define True 1 +#define False 0 #else #include "pre_x11_include.h" @@ -45,6 +52,7 @@ typedef int XIC; #include #include #include +#include #ifdef HAVE_XRANDR #include From 9303c247b647e4b07f5a5750cb2c15f60ea19967 Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 30 Apr 2015 20:13:36 +0200 Subject: [PATCH 70/73] Support signed int vertex data, normalize 16-bit uint colors properly, don't normalize int columns passed to shaders --- panda/src/glstuff/glGeomMunger_src.cxx | 34 + .../glstuff/glGraphicsStateGuardian_src.cxx | 14 +- panda/src/glstuff/glShaderContext_src.cxx | 10 +- panda/src/gobj/geomEnums.cxx | 9 + panda/src/gobj/geomEnums.h | 11 +- panda/src/gobj/geomVertexArrayFormat.cxx | 17 + panda/src/gobj/geomVertexColumn.I | 292 --- panda/src/gobj/geomVertexColumn.cxx | 2133 +++++++++++++---- panda/src/gobj/geomVertexColumn.h | 42 +- panda/src/gobj/geomVertexData.cxx | 10 +- panda/src/gobj/geomVertexData.h | 2 +- panda/src/gobj/geomVertexWriter.I | 84 - panda/src/gobj/geomVertexWriter.h | 6 - 13 files changed, 1781 insertions(+), 883 deletions(-) diff --git a/panda/src/glstuff/glGeomMunger_src.cxx b/panda/src/glstuff/glGeomMunger_src.cxx index b2deb6e29f..fd2b494386 100644 --- a/panda/src/glstuff/glGeomMunger_src.cxx +++ b/panda/src/glstuff/glGeomMunger_src.cxx @@ -87,6 +87,23 @@ munge_format_impl(const GeomVertexFormat *orig, CLP(GraphicsStateGuardian) *glgsg; DCAST_INTO_R(glgsg, get_gsg(), NULL); +#ifndef OPENGLES + // OpenGL ES 1 does, but regular OpenGL doesn't support GL_BYTE vertices + // and texture coordinates. + const GeomVertexColumn *vertex_type = orig->get_vertex_column(); + if (vertex_type != (GeomVertexColumn *)NULL && + vertex_type->get_numeric_type() == NT_int8) { + int vertex_array = orig->get_array_with(InternalName::get_vertex()); + + PT(GeomVertexArrayFormat) new_array_format = new_format->modify_array(vertex_array); + + // Replace the existing vertex format with the new format. + new_array_format->add_column + (InternalName::get_vertex(), 3, NT_int16, + C_point, vertex_type->get_start(), vertex_type->get_column_alignment()); + } +#endif + const GeomVertexColumn *color_type = orig->get_color_column(); if (color_type != (GeomVertexColumn *)NULL && color_type->get_numeric_type() == NT_packed_dabc && @@ -237,6 +254,23 @@ premunge_format_impl(const GeomVertexFormat *orig) { CLP(GraphicsStateGuardian) *glgsg; DCAST_INTO_R(glgsg, get_gsg(), NULL); +#ifndef OPENGLES + // OpenGL ES 1 does, but regular OpenGL doesn't support GL_BYTE vertices + // and texture coordinates. + const GeomVertexColumn *vertex_type = orig->get_vertex_column(); + if (vertex_type != (GeomVertexColumn *)NULL && + vertex_type->get_numeric_type() == NT_int8) { + int vertex_array = orig->get_array_with(InternalName::get_vertex()); + + PT(GeomVertexArrayFormat) new_array_format = new_format->modify_array(vertex_array); + + // Replace the existing vertex format with the new format. + new_array_format->add_column + (InternalName::get_vertex(), 3, NT_int16, + C_point, vertex_type->get_start(), vertex_type->get_column_alignment()); + } +#endif + const GeomVertexColumn *color_type = orig->get_color_column(); if (color_type != (GeomVertexColumn *)NULL && color_type->get_numeric_type() == NT_packed_dabc && diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 5c1a3adc21..26809b9143 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -1013,8 +1013,9 @@ reset() { #ifdef OPENGLES _supports_packed_dabc = false; #else - _supports_packed_dabc = /*gl_support_packed_dabc &&*/ - has_extension("GL_ARB_vertex_array_bgra") || has_extension("GL_EXT_vertex_array_bgra"); + _supports_packed_dabc = is_at_least_gl_version(3, 2) || + has_extension("GL_ARB_vertex_array_bgra") || + has_extension("GL_EXT_vertex_array_bgra"); #endif _supports_multisample = @@ -7370,6 +7371,15 @@ get_numeric_type(Geom::NumericType numeric_type) { case Geom::NT_stdfloat: // Shouldn't happen, display error. break; + + case Geom::NT_int8: + return GL_BYTE; + + case Geom::NT_int16: + return GL_SHORT; + + case Geom::NT_int32: + return GL_INT; } GLCAT.error() diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index dc50428d00..6e136f818d 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1420,9 +1420,10 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { GLint p = _glsl_parameter_map[bind._id._seqno]; int num_elements, element_stride, divisor; + bool normalized; if (_glgsg->_data_reader->get_array_info(name, array_reader, num_values, numeric_type, - start, stride, divisor, + normalized, start, stride, divisor, num_elements, element_stride)) { const unsigned char *client_pointer; if (!_glgsg->setup_array_data(client_pointer, array_reader, force)) { @@ -1440,11 +1441,14 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { } else #endif if (numeric_type == GeomEnums::NT_packed_dabc) { + // GL_BGRA is a special accepted value available since OpenGL 3.2. + // It requires us to pass GL_TRUE for normalized. _glgsg->_glVertexAttribPointer(p, GL_BGRA, GL_UNSIGNED_BYTE, GL_TRUE, stride, client_pointer); } else { - _glgsg->_glVertexAttribPointer(p, num_values, _glgsg->get_numeric_type(numeric_type), - GL_TRUE, stride, client_pointer); + _glgsg->_glVertexAttribPointer(p, num_values, + _glgsg->get_numeric_type(numeric_type), + normalized, stride, client_pointer); } if (_glgsg->_supports_vertex_attrib_divisor) { diff --git a/panda/src/gobj/geomEnums.cxx b/panda/src/gobj/geomEnums.cxx index e105b0c246..4d7ed0f010 100644 --- a/panda/src/gobj/geomEnums.cxx +++ b/panda/src/gobj/geomEnums.cxx @@ -101,6 +101,15 @@ operator << (ostream &out, GeomEnums::NumericType numeric_type) { case GeomEnums::NT_stdfloat: return out << "stdfloat"; + + case GeomEnums::NT_int8: + return out << "int8"; + + case GeomEnums::NT_int16: + return out << "int16"; + + case GeomEnums::NT_int32: + return out << "int32"; } return out << "**invalid numeric type (" << (int)numeric_type << ")**"; diff --git a/panda/src/gobj/geomEnums.h b/panda/src/gobj/geomEnums.h index 62265cfc23..18f576efcc 100644 --- a/panda/src/gobj/geomEnums.h +++ b/panda/src/gobj/geomEnums.h @@ -144,12 +144,12 @@ PUBLISHED: // SM_uniform: all vertices across all faces have the same colors // and normals. It doesn't really matter which ShadeModelAttrib // mode is used to render this primitive. - SM_uniform, + SM_uniform, // SM_smooth: vertices within a single face have different // colors/normals that should be smoothed across the face. This // primitive should be rendered with SmoothModelAttrib::M_smooth. - SM_smooth, + SM_smooth, // SM_flat_(first,last)_vertex: each face within the primitive // might have a different color/normal than the other faces, but @@ -177,12 +177,15 @@ PUBLISHED: enum NumericType { NT_uint8, // An integer 0..255 NT_uint16, // An integer 0..65535 - NT_uint32, // An integer 0..4294967296 + NT_uint32, // An integer 0..4294967295 NT_packed_dcba, // DirectX style, four byte values packed in a uint32 NT_packed_dabc, // DirectX packed color order (ARGB) NT_float32, // A single-precision float NT_float64, // A double-precision float - NT_stdfloat // Either single- or double-precision, according to vertices-float64. + NT_stdfloat, // Either single- or double-precision, according to vertices-float64. + NT_int8, // An integer -128..127 + NT_int16, // An integer -32768..32767 + NT_int32, // An integer -2147483648..2147483647 }; // The contents determine the semantic meaning of a numeric value diff --git a/panda/src/gobj/geomVertexArrayFormat.cxx b/panda/src/gobj/geomVertexArrayFormat.cxx index 7f1deaff61..2c06afca7a 100644 --- a/panda/src/gobj/geomVertexArrayFormat.cxx +++ b/panda/src/gobj/geomVertexArrayFormat.cxx @@ -627,20 +627,37 @@ get_format_string(bool pad) const { case NT_uint8: fmt_code = 'B'; break; + case NT_uint16: fmt_code = 'H'; break; + case NT_uint32: case NT_packed_dcba: case NT_packed_dabc: fmt_code = 'I'; break; + case NT_float32: fmt_code = 'f'; break; + case NT_float64: fmt_code = 'd'; break; + + case NT_int8: + fmt_code = 'b'; + break; + + case NT_int16: + fmt_code = 'h'; + break; + + case NT_int32: + fmt_code = 'i'; + break; + default: gobj_cat.error() << "Unknown numeric type " << column->get_numeric_type() << "!\n"; diff --git a/panda/src/gobj/geomVertexColumn.I b/panda/src/gobj/geomVertexColumn.I index f2646a0fb0..f9a33bfaf6 100644 --- a/panda/src/gobj/geomVertexColumn.I +++ b/panda/src/gobj/geomVertexColumn.I @@ -365,295 +365,3 @@ operator << (ostream &out, const GeomVertexColumn &obj) { obj.output(out); return out; } - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_scale_color_f -// Access: Public -// Description: Converts an integer (typically a uint8) value to a -// floating-point value. If the contents value -// indicates this is a color value, scales it into the -// range 0..1 per convention; otherwise leaves it alone. -//////////////////////////////////////////////////////////////////// -INLINE float GeomVertexColumn::Packer:: -maybe_scale_color_f(unsigned int value) { - if (_column->get_contents() == C_color) { - return (float)value / 255.0f; - } else { - return (float)value; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_scale_color_f -// Access: Public -// Description: Converts a pair of integers into the _v2 member. See -// one-parameter maybe_scale_color_f() for more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_scale_color_f(unsigned int a, unsigned int b) { - if (_column->get_contents() == C_color) { - _v2.set((float)a / 255.0f, - (float)b / 255.0f); - } else { - _v2.set((float)a, (float)b); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_scale_color_f -// Access: Public -// Description: Converts a pair of integers into the _v3 member. See -// one-parameter maybe_scale_color_f() for more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_scale_color_f(unsigned int a, unsigned int b, unsigned int c) { - if (_column->get_contents() == C_color) { - _v3.set((float)a / 255.0f, - (float)b / 255.0f, - (float)c / 255.0f); - } else { - _v3.set((float)a, (float)b, (float)c); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_scale_color_f -// Access: Public -// Description: Converts a pair of integers into the _v4 member. See -// one-parameter maybe_scale_color_f() for more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_scale_color_f(unsigned int a, unsigned int b, unsigned int c, - unsigned int d) { - if (_column->get_contents() == C_color) { - _v4.set((float)a / 255.0f, - (float)b / 255.0f, - (float)c / 255.0f, - (float)d / 255.0f); - } else { - _v4.set((float)a, (float)b, (float)c, (float)d); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_unscale_color_f -// Access: Public -// Description: Converts a floating-point value to a uint8 value. If -// the contents value indicates this is a color value, -// scales it into the range 0..255 per convention; -// otherwise leaves it alone. -//////////////////////////////////////////////////////////////////// -INLINE unsigned int GeomVertexColumn::Packer:: -maybe_unscale_color_f(float data) { - if (_column->get_contents() == C_color) { - return (unsigned int)(data * 255.0f); - } else { - return (unsigned int)data; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_unscale_color_f -// Access: Public -// Description: Converts an LVecBase2f into a pair of uint8 -// values. See one-parameter maybe_unscale_color_f() for -// more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_unscale_color_f(const LVecBase2f &data) { - if (_column->get_contents() == C_color) { - _a = (unsigned int)(data[0] * 255.0f); - _b = (unsigned int)(data[1] * 255.0f); - } else { - _a = (unsigned int)data[0]; - _b = (unsigned int)data[1]; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_unscale_color_f -// Access: Public -// Description: Converts an LVecBase3f into a pair of uint8 -// values. See one-parameter maybe_unscale_color_f() for -// more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_unscale_color_f(const LVecBase3f &data) { - if (_column->get_contents() == C_color) { - _a = (unsigned int)(data[0] * 255.0f); - _b = (unsigned int)(data[1] * 255.0f); - _c = (unsigned int)(data[2] * 255.0f); - } else { - _a = (unsigned int)data[0]; - _b = (unsigned int)data[1]; - _c = (unsigned int)data[2]; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_unscale_color_f -// Access: Public -// Description: Converts an LVecBase4f into a pair of uint8 -// values. See one-parameter maybe_unscale_color_f() for -// more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_unscale_color_f(const LVecBase4f &data) { - if (_column->get_contents() == C_color) { - _a = (unsigned int)(data[0] * 255.0f); - _b = (unsigned int)(data[1] * 255.0f); - _c = (unsigned int)(data[2] * 255.0f); - _d = (unsigned int)(data[3] * 255.0f); - } else { - _a = (unsigned int)data[0]; - _b = (unsigned int)data[1]; - _c = (unsigned int)data[2]; - _d = (unsigned int)data[3]; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_scale_color_d -// Access: Public -// Description: Converts an integer (typically a uint8) value to a -// floating-point value. If the contents value -// indicates this is a color value, scales it into the -// range 0..1 per convention; otherwise leaves it alone. -//////////////////////////////////////////////////////////////////// -INLINE double GeomVertexColumn::Packer:: -maybe_scale_color_d(unsigned int value) { - if (_column->get_contents() == C_color) { - return (double)value / 255.0; - } else { - return (double)value; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_scale_color_d -// Access: Public -// Description: Converts a pair of integers into the _v2d member. See -// one-parameter maybe_scale_color_d() for more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_scale_color_d(unsigned int a, unsigned int b) { - if (_column->get_contents() == C_color) { - _v2d.set((double)a / 255.0, - (double)b / 255.0); - } else { - _v2d.set((double)a, (double)b); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_scale_color_d -// Access: Public -// Description: Converts a pair of integers into the _v3d member. See -// one-parameter maybe_scale_color_d() for more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_scale_color_d(unsigned int a, unsigned int b, unsigned int c) { - if (_column->get_contents() == C_color) { - _v3d.set((double)a / 255.0, - (double)b / 255.0, - (double)c / 255.0); - } else { - _v3d.set((double)a, (double)b, (double)c); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_scale_color_d -// Access: Public -// Description: Converts a pair of integers into the _v4d member. See -// one-parameter maybe_scale_color_d() for more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_scale_color_d(unsigned int a, unsigned int b, unsigned int c, - unsigned int d) { - if (_column->get_contents() == C_color) { - _v4d.set((double)a / 255.0, - (double)b / 255.0, - (double)c / 255.0, - (double)d / 255.0); - } else { - _v4d.set((double)a, (double)b, (double)c, (double)d); - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_unscale_color_d -// Access: Public -// Description: Converts a floating-point value to a uint8 value. If -// the contents value indicates this is a color value, -// scales it into the range 0..255 per convention; -// otherwise leaves it alone. -//////////////////////////////////////////////////////////////////// -INLINE unsigned int GeomVertexColumn::Packer:: -maybe_unscale_color_d(double data) { - if (_column->get_contents() == C_color) { - return (unsigned int)(data * 255.0); - } else { - return (unsigned int)data; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_unscale_color_d -// Access: Public -// Description: Converts an LVecBase2d into a pair of uint8 -// values. See one-parameter maybe_unscale_color_d() for -// more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_unscale_color_d(const LVecBase2d &data) { - if (_column->get_contents() == C_color) { - _a = (unsigned int)(data[0] * 255.0); - _b = (unsigned int)(data[1] * 255.0); - } else { - _a = (unsigned int)data[0]; - _b = (unsigned int)data[1]; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_unscale_color_d -// Access: Public -// Description: Converts an LVecBase3d into a pair of uint8 -// values. See one-parameter maybe_unscale_color_d() for -// more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_unscale_color_d(const LVecBase3d &data) { - if (_column->get_contents() == C_color) { - _a = (unsigned int)(data[0] * 255.0); - _b = (unsigned int)(data[1] * 255.0); - _c = (unsigned int)(data[2] * 255.0); - } else { - _a = (unsigned int)data[0]; - _b = (unsigned int)data[1]; - _c = (unsigned int)data[2]; - } -} - -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexColumn::Packer::maybe_unscale_color_d -// Access: Public -// Description: Converts an LVecBase4d into a pair of uint8 -// values. See one-parameter maybe_unscale_color_d() for -// more info. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexColumn::Packer:: -maybe_unscale_color_d(const LVecBase4d &data) { - if (_column->get_contents() == C_color) { - _a = (unsigned int)(data[0] * 255.0); - _b = (unsigned int)(data[1] * 255.0); - _c = (unsigned int)(data[2] * 255.0); - _d = (unsigned int)(data[3] * 255.0); - } else { - _a = (unsigned int)data[0]; - _b = (unsigned int)data[1]; - _c = (unsigned int)data[2]; - _d = (unsigned int)data[3]; - } -} diff --git a/panda/src/gobj/geomVertexColumn.cxx b/panda/src/gobj/geomVertexColumn.cxx index 1698384d07..05419c41b5 100644 --- a/panda/src/gobj/geomVertexColumn.cxx +++ b/panda/src/gobj/geomVertexColumn.cxx @@ -20,7 +20,7 @@ //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Copy Assignment Operator // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn:: operator = (const GeomVertexColumn ©) { @@ -115,21 +115,24 @@ set_column_alignment(int column_alignment) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::output // Access: Published -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn:: output(ostream &out) const { out << *get_name() << "(" << get_num_components(); switch (get_numeric_type()) { case NT_uint8: + case NT_int8: out << "b"; break; case NT_uint16: + case NT_int16: out << "s"; break; case NT_uint32: + case NT_int32: out << "l"; break; @@ -180,14 +183,17 @@ setup() { switch (_numeric_type) { case NT_uint16: + case NT_int16: _component_bytes = 2; // sizeof(PN_uint16) break; case NT_uint32: + case NT_int32: _component_bytes = 4; // sizeof(PN_uint32) break; case NT_uint8: + case NT_int8: _component_bytes = 1; break; @@ -230,7 +236,7 @@ setup() { if (_packer != NULL) { delete _packer; } - + _packer = make_packer(); _packer->_column = this; } @@ -302,28 +308,15 @@ make_packer() const { return new Packer_point; case C_color: - switch (get_numeric_type()) { - case NT_uint8: - switch (get_num_components()) { - case 4: + if (get_num_values() == 4) { + switch (get_numeric_type()) { + case NT_uint8: return new Packer_rgba_uint8_4; - - default: - break; - } - break; - case NT_packed_dabc: - switch (get_num_components()) { - case 1: + + case NT_packed_dabc: return new Packer_argb_packed; - - default: - break; - } - break; - case NT_float32: - switch (get_num_components()) { - case 4: + + case NT_float32: if (sizeof(float) == sizeof(PN_float32)) { // Use the native float type implementation for a tiny bit // more optimization. @@ -331,15 +324,16 @@ make_packer() const { } else { return new Packer_rgba_float32_4; } - + default: break; } - break; - default: - break; + } else if (get_num_values() != 3) { + gobj_cat.error() + << "GeomVertexColumn with contents C_color must have 3 or 4 components!\n"; } return new Packer_color; + default: // Otherwise, we just read it as a generic value. switch (get_numeric_type()) { @@ -439,7 +433,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::Destructor // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// GeomVertexColumn::Packer:: ~Packer() { @@ -448,13 +442,13 @@ GeomVertexColumn::Packer:: //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data1f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// float GeomVertexColumn::Packer:: get_data1f(const unsigned char *pointer) { switch (_column->get_numeric_type()) { case NT_uint8: - return maybe_scale_color_f(*pointer); + return *(const PN_uint8 *)pointer; case NT_uint16: return *(const PN_uint16 *)pointer; @@ -465,13 +459,13 @@ get_data1f(const unsigned char *pointer) { case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - return maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword)); + return GeomVertexData::unpack_abcd_d(dword); } case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - return maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword)); + return GeomVertexData::unpack_abcd_b(dword); } case NT_float32: @@ -480,6 +474,15 @@ get_data1f(const unsigned char *pointer) { case NT_float64: return *(const PN_float64 *)pointer; + case NT_int8: + return *(const PN_int8 *)pointer; + + case NT_int16: + return *(const PN_int16 *)pointer; + + case NT_int32: + return *(const PN_int32 *)pointer; + default: nassertr(false, 0.0f); } @@ -490,7 +493,7 @@ get_data1f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data2f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2f &GeomVertexColumn::Packer:: get_data2f(const unsigned char *pointer) { @@ -501,39 +504,42 @@ get_data2f(const unsigned char *pointer) { } else { switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_f(pointer[0], pointer[1]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v2.set(pi[0], pi[1]); + } return _v2; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v2.set(pi[0], pi[1]); } return _v2; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v2.set(pi[0], pi[1]); } return _v2; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword)); + _v2.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword)); } return _v2; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword)); + _v2.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword)); } return _v2; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; @@ -550,6 +556,28 @@ get_data2f(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v2); + return _v2; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v2.set(pi[0], pi[1]); + } + return _v2; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v2.set(pi[0], pi[1]); + } + return _v2; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v2.set(pi[0], pi[1]); + } + return _v2; } } @@ -559,7 +587,7 @@ get_data2f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3f &GeomVertexColumn::Packer:: get_data3f(const unsigned char *pointer) { @@ -578,48 +606,51 @@ get_data3f(const unsigned char *pointer) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_f(pointer[0], pointer[1], pointer[2]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + } return _v3; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v3.set(pi[0], pi[1], pi[2]); } return _v3; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v3.set(pi[0], pi[1], pi[2]); } return _v3; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_b(dword)); + _v3.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_b(dword)); } return _v3; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_d(dword)); + _v3.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword)); } return _v3; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v3.set(pi[0], pi[1], pi[2]); } return _v3; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -629,6 +660,28 @@ get_data3f(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v3); + return _v3; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + } + return _v3; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + } + return _v3; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + } + return _v3; } } @@ -638,7 +691,7 @@ get_data3f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer:: get_data4f(const unsigned char *pointer) { @@ -664,50 +717,53 @@ get_data4f(const unsigned char *pointer) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_f(pointer[0], pointer[1], pointer[2], pointer[3]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + } return _v4; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_a(dword)); } return _v4; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_a(dword)); } return _v4; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -717,6 +773,28 @@ get_data4f(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v4); + break; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4; } } @@ -726,13 +804,13 @@ get_data4f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data1d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// double GeomVertexColumn::Packer:: get_data1d(const unsigned char *pointer) { switch (_column->get_numeric_type()) { case NT_uint8: - return maybe_scale_color_d(*pointer); + return *(const PN_uint8 *)pointer; case NT_uint16: return *(const PN_uint16 *)pointer; @@ -743,13 +821,13 @@ get_data1d(const unsigned char *pointer) { case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - return maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword)); + return GeomVertexData::unpack_abcd_d(dword); } case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - return maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword)); + return GeomVertexData::unpack_abcd_b(dword); } case NT_float32: @@ -760,6 +838,16 @@ get_data1d(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, 0.0f); + return 0.0f; + + case NT_int8: + return *(const PN_int8 *)pointer; + + case NT_int16: + return *(const PN_int16 *)pointer; + + case NT_int32: + return *(const PN_int32 *)pointer; } return 0.0f; @@ -768,7 +856,7 @@ get_data1d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data2d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2d &GeomVertexColumn::Packer:: get_data2d(const unsigned char *pointer) { @@ -779,39 +867,42 @@ get_data2d(const unsigned char *pointer) { } else { switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_d(pointer[0], pointer[1]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v2d.set(pi[0], pi[1]); + } return _v2d; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v2d.set(pi[0], pi[1]); } return _v2d; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v2d.set(pi[0], pi[1]); } return _v2d; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword)); + _v2d.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword)); } return _v2d; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword)); + _v2d.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword)); } return _v2d; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; @@ -828,6 +919,28 @@ get_data2d(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v2d); + return _v2d; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v2d.set(pi[0], pi[1]); + } + return _v2d; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v2d.set(pi[0], pi[1]); + } + return _v2d; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v2d.set(pi[0], pi[1]); + } + return _v2d; } } @@ -837,7 +950,7 @@ get_data2d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3d &GeomVertexColumn::Packer:: get_data3d(const unsigned char *pointer) { @@ -856,48 +969,51 @@ get_data3d(const unsigned char *pointer) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_d(pointer[0], pointer[1], pointer[2]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + } return _v3d; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v3d.set(pi[0], pi[1], pi[2]); } return _v3d; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v3d.set(pi[0], pi[1], pi[2]); } return _v3d; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_b(dword)); + _v3d.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_b(dword)); } return _v3d; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_d(dword)); + _v3d.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword)); } return _v3d; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v3d.set(pi[0], pi[1], pi[2]); } return _v3d; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -907,6 +1023,28 @@ get_data3d(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v3d); + return _v3d; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + } + return _v3d; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + } + return _v3d; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + } + return _v3d; } } @@ -916,7 +1054,7 @@ get_data3d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data4d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4d &GeomVertexColumn::Packer:: get_data4d(const unsigned char *pointer) { @@ -942,50 +1080,53 @@ get_data4d(const unsigned char *pointer) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_d(pointer[0], pointer[1], pointer[2], pointer[3]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + } return _v4d; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4d.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_a(dword)); } return _v4d; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4d.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_a(dword)); } return _v4d; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -995,6 +1136,28 @@ get_data4d(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v4d); + break; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4d; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4d; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4d; } } @@ -1004,7 +1167,7 @@ get_data4d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data1i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// int GeomVertexColumn::Packer:: get_data1i(const unsigned char *pointer) { @@ -1038,6 +1201,16 @@ get_data1i(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, 0); + break; + + case NT_int8: + return *(const PN_int8 *)pointer; + + case NT_int16: + return *(const PN_int16 *)pointer; + + case NT_int32: + return *(const PN_int32 *)pointer; } return 0; @@ -1046,7 +1219,7 @@ get_data1i(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data2i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2i &GeomVertexColumn::Packer:: get_data2i(const unsigned char *pointer) { @@ -1060,21 +1233,21 @@ get_data2i(const unsigned char *pointer) { case NT_uint8: _v2i.set(pointer[0], pointer[1]); return _v2i; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v2i.set(pi[0], pi[1]); } return _v2i; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v2i.set(pi[0], pi[1]); } return _v2i; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; @@ -1082,7 +1255,7 @@ get_data2i(const unsigned char *pointer) { GeomVertexData::unpack_abcd_c(dword)); } return _v2i; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; @@ -1090,14 +1263,14 @@ get_data2i(const unsigned char *pointer) { GeomVertexData::unpack_abcd_c(dword)); } return _v2i; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v2i.set((int)pi[0], (int)pi[1]); } return _v2i; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -1107,6 +1280,28 @@ get_data2i(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v2i); + break; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v2i.set(pi[0], pi[1]); + } + return _v2i; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v2i.set(pi[0], pi[1]); + } + return _v2i; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v2i.set(pi[0], pi[1]); + } + return _v2i; } } @@ -1116,7 +1311,7 @@ get_data2i(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data3i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3i &GeomVertexColumn::Packer:: get_data3i(const unsigned char *pointer) { @@ -1186,6 +1381,28 @@ get_data3i(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v3i); + break; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v3i.set(pi[0], pi[1], pi[2]); + } + return _v3i; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v3i.set(pi[0], pi[1], pi[2]); + } + return _v3i; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v3i.set(pi[0], pi[1], pi[2]); + } + return _v3i; } } @@ -1195,7 +1412,7 @@ get_data3i(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::get_data4i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4i &GeomVertexColumn::Packer:: get_data4i(const unsigned char *pointer) { @@ -1223,21 +1440,21 @@ get_data4i(const unsigned char *pointer) { case NT_uint8: _v4i.set(pointer[0], pointer[1], pointer[2], pointer[3]); return _v4i; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v4i.set(pi[0], pi[1], pi[2], pi[3]); } return _v4i; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v4i.set(pi[0], pi[1], pi[2], pi[3]); } return _v4i; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; @@ -1247,7 +1464,7 @@ get_data4i(const unsigned char *pointer) { GeomVertexData::unpack_abcd_a(dword)); } return _v4i; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; @@ -1257,14 +1474,14 @@ get_data4i(const unsigned char *pointer) { GeomVertexData::unpack_abcd_a(dword)); } return _v4i; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v4i.set((int)pi[0], (int)pi[1], (int)pi[2], (int)pi[3]); } return _v4i; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -1274,6 +1491,28 @@ get_data4i(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v4i); + break; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v4i.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4i; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v4i.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4i; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v4i.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4i; } } @@ -1283,7 +1522,7 @@ get_data4i(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data1f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data1f(unsigned char *pointer, float data) { @@ -1291,32 +1530,45 @@ set_data1f(unsigned char *pointer, float data) { case 1: switch (_column->get_numeric_type()) { case NT_uint8: - *pointer = maybe_unscale_color_f(data); + *(PN_uint8 *)pointer = (unsigned int)data; break; - + case NT_uint16: *(PN_uint16 *)pointer = (unsigned int)data; break; - + case NT_uint32: *(PN_uint32 *)pointer = (unsigned int)data; break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: *(PN_float32 *)pointer = data; break; - + case NT_float64: *(PN_float64 *)pointer = data; break; case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + *(PN_int8 *)pointer = (int)data; + break; + + case NT_int16: + *(PN_int16 *)pointer = (int)data; + break; + + case NT_int32: + *(PN_int32 *)pointer = (int)data; + break; } break; @@ -1337,7 +1589,7 @@ set_data1f(unsigned char *pointer, float data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data2f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data2f(unsigned char *pointer, const LVecBase2f &data) { @@ -1348,11 +1600,13 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { case 2: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_unscale_color_f(data); - pointer[0] = _a; - pointer[1] = _b; + { + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + } break; - + case NT_uint16: { PN_uint16 *pi = (PN_uint16 *)pointer; @@ -1360,7 +1614,7 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { pi[1] = (unsigned int)data[1]; } break; - + case NT_uint32: { PN_uint32 *pi = (PN_uint32 *)pointer; @@ -1368,12 +1622,12 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { pi[1] = (unsigned int)data[1]; } break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -1381,7 +1635,7 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { pi[1] = data[1]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -1392,6 +1646,31 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + } + break; } break; @@ -1408,7 +1687,7 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data3f(unsigned char *pointer, const LVecBase3f &data) { @@ -1420,16 +1699,18 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { case 2: set_data2f(pointer, LVecBase2f(data[0], data[1])); break; - + case 3: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_unscale_color_f(data); - pointer[0] = _a; - pointer[1] = _b; - pointer[2] = _c; + { + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + } break; - + case NT_uint16: { PN_uint16 *pi = (PN_uint16 *)pointer; @@ -1438,7 +1719,7 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { pi[2] = (unsigned int)data[2]; } break; - + case NT_uint32: { PN_uint32 *pi = (PN_uint32 *)pointer; @@ -1447,12 +1728,12 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { pi[2] = (unsigned int)data[2]; } break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -1461,7 +1742,7 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { pi[2] = data[2]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -1473,6 +1754,34 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + } + break; } break; @@ -1485,7 +1794,7 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data4f(unsigned char *pointer, const LVecBase4f &data) { @@ -1505,11 +1814,13 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_unscale_color_f(data); - pointer[0] = _a; - pointer[1] = _b; - pointer[2] = _c; - pointer[3] = _d; + { + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + pi[3] = (unsigned int)data[3]; + } break; case NT_uint16: @@ -1531,17 +1842,15 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { pi[3] = (unsigned int)data[3]; } break; - + case NT_packed_dcba: - maybe_unscale_color_f(data); - *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _c, _b, _a); + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[2], data[1], data[0]); break; - + case NT_packed_dabc: - maybe_unscale_color_f(data); - *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _a, _b, _c); + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[0], data[1], data[2]); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -1551,7 +1860,7 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { pi[3] = data[3]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -1564,6 +1873,37 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; } break; } @@ -1572,7 +1912,7 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data1d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data1d(unsigned char *pointer, double data) { @@ -1580,32 +1920,45 @@ set_data1d(unsigned char *pointer, double data) { case 1: switch (_column->get_numeric_type()) { case NT_uint8: - *pointer = maybe_unscale_color_d(data); + *(PN_uint8 *)pointer = (unsigned int)data; break; - + case NT_uint16: *(PN_uint16 *)pointer = (unsigned int)data; break; - + case NT_uint32: *(PN_uint32 *)pointer = (unsigned int)data; break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: *(PN_float32 *)pointer = data; break; - + case NT_float64: *(PN_float64 *)pointer = data; break; case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + *(PN_int8 *)pointer = (int)data; + break; + + case NT_int16: + *(PN_int16 *)pointer = (int)data; + break; + + case NT_int32: + *(PN_int32 *)pointer = (int)data; + break; } break; @@ -1626,7 +1979,7 @@ set_data1d(unsigned char *pointer, double data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data2d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data2d(unsigned char *pointer, const LVecBase2d &data) { @@ -1637,11 +1990,13 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { case 2: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_unscale_color_d(data); - pointer[0] = _a; - pointer[1] = _b; + { + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + } break; - + case NT_uint16: { PN_uint16 *pi = (PN_uint16 *)pointer; @@ -1649,7 +2004,7 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { pi[1] = (unsigned int)data[1]; } break; - + case NT_uint32: { PN_uint32 *pi = (PN_uint32 *)pointer; @@ -1657,12 +2012,12 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { pi[1] = (unsigned int)data[1]; } break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -1670,7 +2025,7 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { pi[1] = data[1]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -1681,6 +2036,31 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + } + break; } break; @@ -1697,7 +2077,7 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data3d(unsigned char *pointer, const LVecBase3d &data) { @@ -1709,16 +2089,18 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { case 2: set_data2d(pointer, LVecBase2d(data[0], data[1])); break; - + case 3: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_unscale_color_d(data); - pointer[0] = _a; - pointer[1] = _b; - pointer[2] = _c; + { + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + } break; - + case NT_uint16: { PN_uint16 *pi = (PN_uint16 *)pointer; @@ -1727,7 +2109,7 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { pi[2] = (unsigned int)data[2]; } break; - + case NT_uint32: { PN_uint32 *pi = (PN_uint32 *)pointer; @@ -1736,12 +2118,12 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { pi[2] = (unsigned int)data[2]; } break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -1750,7 +2132,7 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { pi[2] = data[2]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -1762,6 +2144,34 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + } + break; } break; @@ -1774,7 +2184,7 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data4d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data4d(unsigned char *pointer, const LVecBase4d &data) { @@ -1794,11 +2204,13 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_unscale_color_d(data); - pointer[0] = _a; - pointer[1] = _b; - pointer[2] = _c; - pointer[3] = _d; + { + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + pi[3] = (unsigned int)data[3]; + } break; case NT_uint16: @@ -1820,17 +2232,15 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { pi[3] = (unsigned int)data[3]; } break; - + case NT_packed_dcba: - maybe_unscale_color_d(data); - *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _c, _b, _a); + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[2], data[1], data[0]); break; - + case NT_packed_dabc: - maybe_unscale_color_d(data); - *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _a, _b, _c); + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[0], data[1], data[2]); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -1840,7 +2250,7 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { pi[3] = data[3]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -1853,6 +2263,37 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; } break; } @@ -1861,7 +2302,7 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data1i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data1i(unsigned char *pointer, int data) { @@ -1872,31 +2313,46 @@ set_data1i(unsigned char *pointer, int data) { *pointer = data; nassertv((*pointer) == data); break; - + case NT_uint16: *(PN_uint16 *)pointer = data; nassertv(*(PN_uint16 *)pointer == data); break; - + case NT_uint32: *(PN_uint32 *)pointer = data; break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: *(PN_float32 *)pointer = (float)data; break; - + case NT_float64: *(PN_float64 *)pointer = (double)data; break; case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + *(PN_int8 *)pointer = data; + nassertv(*(PN_int8 *)pointer == data); + break; + + case NT_int16: + *(PN_int16 *)pointer = data; + nassertv(*(PN_int16 *)pointer == data); + break; + + case NT_int32: + *(PN_int32 *)pointer = data; + break; } break; @@ -1917,7 +2373,7 @@ set_data1i(unsigned char *pointer, int data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data2i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data2i(unsigned char *pointer, const LVecBase2i &data) { @@ -1948,12 +2404,12 @@ set_data2i(unsigned char *pointer, const LVecBase2i &data) { pi[1] = data[1]; } break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -1961,7 +2417,7 @@ set_data2i(unsigned char *pointer, const LVecBase2i &data) { pi[1] = data[1]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -1972,6 +2428,31 @@ set_data2i(unsigned char *pointer, const LVecBase2i &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + } + break; } break; @@ -1988,7 +2469,7 @@ set_data2i(unsigned char *pointer, const LVecBase2i &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data3i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data3i(unsigned char *pointer, const LVecBase3i &data) { @@ -2026,12 +2507,12 @@ set_data3i(unsigned char *pointer, const LVecBase3i &data) { pi[2] = data[2]; } break; - + case NT_packed_dcba: case NT_packed_dabc: nassertv(false); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -2040,7 +2521,7 @@ set_data3i(unsigned char *pointer, const LVecBase3i &data) { pi[2] = data[2]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -2052,6 +2533,34 @@ set_data3i(unsigned char *pointer, const LVecBase3i &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + } + break; } break; @@ -2064,7 +2573,7 @@ set_data3i(unsigned char *pointer, const LVecBase3i &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer::set_data4i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer:: set_data4i(unsigned char *pointer, const LVecBase4i &data) { @@ -2109,15 +2618,15 @@ set_data4i(unsigned char *pointer, const LVecBase4i &data) { pi[3] = data[3]; } break; - + case NT_packed_dcba: *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[2], data[1], data[0]); break; - + case NT_packed_dabc: *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[0], data[1], data[2]); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -2127,7 +2636,7 @@ set_data4i(unsigned char *pointer, const LVecBase4i &data) { pi[3] = data[3]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -2140,6 +2649,37 @@ set_data4i(unsigned char *pointer, const LVecBase4i &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + pi[3] = data[3]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + pi[3] = data[3]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + pi[3] = data[3]; + } + break; } break; } @@ -2148,7 +2688,7 @@ set_data4i(unsigned char *pointer, const LVecBase4i &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::get_data1f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// float GeomVertexColumn::Packer_point:: get_data1f(const unsigned char *pointer) { @@ -2163,7 +2703,7 @@ get_data1f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::get_data2f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2f &GeomVertexColumn::Packer_point:: get_data2f(const unsigned char *pointer) { @@ -2179,7 +2719,7 @@ get_data2f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::get_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3f &GeomVertexColumn::Packer_point:: get_data3f(const unsigned char *pointer) { @@ -2195,13 +2735,13 @@ get_data3f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer_point:: get_data4f(const unsigned char *pointer) { switch (_column->get_num_values()) { case 1: - _v4.set(get_data1i(pointer), 0.0f, 0.0f, 1.0f); + _v4.set(get_data1f(pointer), 0.0f, 0.0f, 1.0f); return _v4; case 2: @@ -2221,50 +2761,53 @@ get_data4f(const unsigned char *pointer) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_f(pointer[0], pointer[1], pointer[2], pointer[3]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + } return _v4; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_a(dword)); } return _v4; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_a(dword)); } return _v4; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -2274,6 +2817,28 @@ get_data4f(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v4); + break; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4; } } @@ -2283,7 +2848,7 @@ get_data4f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::get_data1d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// double GeomVertexColumn::Packer_point:: get_data1d(const unsigned char *pointer) { @@ -2298,7 +2863,7 @@ get_data1d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::get_data2d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2d &GeomVertexColumn::Packer_point:: get_data2d(const unsigned char *pointer) { @@ -2314,7 +2879,7 @@ get_data2d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::get_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3d &GeomVertexColumn::Packer_point:: get_data3d(const unsigned char *pointer) { @@ -2330,13 +2895,13 @@ get_data3d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::get_data4d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4d &GeomVertexColumn::Packer_point:: get_data4d(const unsigned char *pointer) { switch (_column->get_num_values()) { case 1: - _v4d.set(get_data1i(pointer), 0.0f, 0.0f, 1.0f); + _v4d.set(get_data1d(pointer), 0.0f, 0.0f, 1.0f); return _v4d; case 2: @@ -2356,50 +2921,53 @@ get_data4d(const unsigned char *pointer) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_d(pointer[0], pointer[1], pointer[2], pointer[3]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + } return _v4d; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4d.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_a(dword)); } return _v4d; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4d.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_a(dword)); } return _v4d; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -2409,6 +2977,28 @@ get_data4d(const unsigned char *pointer) { case NT_stdfloat: nassertr(false, _v4d); + break; + + case NT_int8: + { + const PN_int8 *pi = (const PN_int8 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4d; + + case NT_int16: + { + const PN_int16 *pi = (const PN_int16 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4d; + + case NT_int32: + { + const PN_int32 *pi = (const PN_int32 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + } + return _v4d; } } @@ -2418,7 +3008,7 @@ get_data4d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::set_data1f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point:: set_data1f(unsigned char *pointer, float data) { @@ -2432,7 +3022,7 @@ set_data1f(unsigned char *pointer, float data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::set_data2f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point:: set_data2f(unsigned char *pointer, const LVecBase2f &data) { @@ -2446,7 +3036,7 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::set_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point:: set_data3f(unsigned char *pointer, const LVecBase3f &data) { @@ -2460,7 +3050,7 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::set_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point:: set_data4f(unsigned char *pointer, const LVecBase4f &data) { @@ -2480,11 +3070,13 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_unscale_color_f(data); - pointer[0] = _a; - pointer[1] = _b; - pointer[2] = _c; - pointer[3] = _d; + { + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + pi[3] = (unsigned int)data[3]; + } break; case NT_uint16: @@ -2506,17 +3098,15 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { pi[3] = (unsigned int)data[3]; } break; - + case NT_packed_dcba: - maybe_unscale_color_f(data); - *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _c, _b, _a); + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[2], data[1], data[0]); break; - + case NT_packed_dabc: - maybe_unscale_color_f(data); - *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _a, _b, _c); + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[0], data[1], data[2]); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -2526,7 +3116,7 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { pi[3] = data[3]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -2539,6 +3129,37 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; } break; } @@ -2547,7 +3168,7 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::set_data1d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point:: set_data1d(unsigned char *pointer, double data) { @@ -2561,7 +3182,7 @@ set_data1d(unsigned char *pointer, double data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::set_data2d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point:: set_data2d(unsigned char *pointer, const LVecBase2d &data) { @@ -2575,7 +3196,7 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::set_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point:: set_data3d(unsigned char *pointer, const LVecBase3d &data) { @@ -2589,7 +3210,7 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point::set_data4d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point:: set_data4d(unsigned char *pointer, const LVecBase4d &data) { @@ -2609,11 +3230,13 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { default: switch (_column->get_numeric_type()) { case NT_uint8: - maybe_unscale_color_d(data); - pointer[0] = _a; - pointer[1] = _b; - pointer[2] = _c; - pointer[3] = _d; + { + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + pi[3] = (unsigned int)data[3]; + } break; case NT_uint16: @@ -2635,17 +3258,15 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { pi[3] = (unsigned int)data[3]; } break; - + case NT_packed_dcba: - maybe_unscale_color_d(data); - *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _c, _b, _a); + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[2], data[1], data[0]); break; - + case NT_packed_dabc: - maybe_unscale_color_d(data); - *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(_d, _a, _b, _c); + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd(data[3], data[0], data[1], data[2]); break; - + case NT_float32: { PN_float32 *pi = (PN_float32 *)pointer; @@ -2655,7 +3276,7 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { pi[3] = data[3]; } break; - + case NT_float64: { PN_float64 *pi = (PN_float64 *)pointer; @@ -2668,84 +3289,234 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { case NT_stdfloat: nassertv(false); + break; + + case NT_int8: + { + PN_int8 *pi = (PN_int8 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; + + case NT_int16: + { + PN_int16 *pi = (PN_int16 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; + + case NT_int32: + { + PN_int32 *pi = (PN_int32 *)pointer; + pi[0] = (int)data[0]; + pi[1] = (int)data[1]; + pi[2] = (int)data[2]; + pi[3] = (int)data[3]; + } + break; } break; } } +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexColumn::Packer_color::get_data1f +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +float GeomVertexColumn::Packer_color:: +get_data1f(const unsigned char *pointer) { + switch (_column->get_numeric_type()) { + case NT_uint8: + return (*(const PN_uint8 *)pointer) / 255.0f; + + case NT_uint16: + return (*(const PN_uint16 *)pointer) / 65535.0f; + + case NT_uint32: + return (*(const PN_uint32 *)pointer) / 4294967295.0f; + + case NT_packed_dcba: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + return GeomVertexData::unpack_abcd_d(dword) / 255.0f; + } + + case NT_packed_dabc: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + return GeomVertexData::unpack_abcd_b(dword) / 255.0f; + } + + case NT_float32: + return *(const PN_float32 *)pointer; + + case NT_float64: + return *(const PN_float64 *)pointer; + + default: + nassertr(false, 0.0f); + } + + return 0.0f; +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexColumn::Packer_color::get_data2f +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +const LVecBase2f &GeomVertexColumn::Packer_color:: +get_data2f(const unsigned char *pointer) { + if (_column->get_num_values() == 3) { + const LVecBase3f &v3 = get_data3f(pointer); + _v2.set(v3[0], v3[1]); + return _v2; + } else { + const LVecBase4f &v4 = get_data4f(pointer); + _v2.set(v4[0], v4[1]); + return _v2; + } +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexColumn::Packer_color::get_data3f +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +const LVecBase3f &GeomVertexColumn::Packer_color:: +get_data3f(const unsigned char *pointer) { + if (_column->get_num_values() == 3) { + switch (_column->get_numeric_type()) { + case NT_uint8: + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + _v3 /= 255.0f; + } + return _v3; + + case NT_uint16: + { + const PN_uint16 *pi = (const PN_uint16 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + _v3 /= 65535.0f; + } + return _v3; + + case NT_uint32: + { + const PN_uint32 *pi = (const PN_uint32 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + _v3 /= 4294967295.0f; + } + return _v3; + + case NT_packed_dcba: + case NT_packed_dabc: + nassertr(false, _v3); + return _v3; + + case NT_float32: + { + const PN_float32 *pi = (const PN_float32 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + } + return _v3; + + case NT_float64: + { + const PN_float64 *pi = (const PN_float64 *)pointer; + _v3.set(pi[0], pi[1], pi[2]); + } + return _v3; + + case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: + nassertr(false, _v3); + return _v3; + } + } else { + const LVecBase4f &v4 = get_data4f(pointer); + _v3.set(v4[0], v4[1], v4[2]); + return _v3; + } +} + //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_color::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer_color:: get_data4f(const unsigned char *pointer) { - switch (_column->get_num_values()) { - case 1: - _v4.set(get_data1i(pointer), 0.0f, 0.0f, 1.0f); + if (_column->get_num_values() == 3) { + const LVecBase3f &v3 = get_data3f(pointer); + _v4.set(v3[0], v3[1], v3[2], 1.0f); return _v4; - - case 2: - { - const LVecBase2f &v2 = get_data2f(pointer); - _v4.set(v2[0], v2[1], 0.0f, 1.0f); - } - return _v4; - - case 3: - { - const LVecBase3f &v3 = get_data3f(pointer); - _v4.set(v3[0], v3[1], v3[2], 1.0f); - } - return _v4; - - default: + } else { switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_f(pointer[0], pointer[1], pointer[2], pointer[3]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v4.set(pi[0], pi[1], pi[2], pi[3]); + _v4 /= 255.0f; + } return _v4; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); + _v4 /= 65535.0f; } return _v4; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); + _v4 /= 4294967295.0f; } return _v4; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_a(dword)); + _v4 /= 255.0f; } return _v4; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_f(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_a(dword)); + _v4 /= 255.0f; } return _v4; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -2754,86 +3525,207 @@ get_data4f(const unsigned char *pointer) { return _v4; case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: nassertr(false, _v4); + return _v4; } } +} - return _v4; +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexColumn::Packer_color::get_data1d +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +double GeomVertexColumn::Packer_color:: +get_data1d(const unsigned char *pointer) { + switch (_column->get_numeric_type()) { + case NT_uint8: + return (*(const PN_uint8 *)pointer) / 255.0; + + case NT_uint16: + return (*(const PN_uint16 *)pointer) / 65535.0; + + case NT_uint32: + return (*(const PN_uint32 *)pointer) / 4294967295.0; + + case NT_packed_dcba: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + return GeomVertexData::unpack_abcd_d(dword) / 255.0; + } + + case NT_packed_dabc: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + return GeomVertexData::unpack_abcd_b(dword) / 255.0; + } + + case NT_float32: + return *(const PN_float32 *)pointer; + + case NT_float64: + return *(const PN_float64 *)pointer; + + default: + nassertr(false, 0.0); + } + + return 0.0; +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexColumn::Packer_color::get_data2d +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +const LVecBase2d &GeomVertexColumn::Packer_color:: +get_data2d(const unsigned char *pointer) { + if (_column->get_num_values() == 3) { + const LVecBase3d &v3 = get_data3d(pointer); + _v2d.set(v3[0], v3[1]); + return _v2d; + } else { + const LVecBase4d &v4 = get_data4d(pointer); + _v2d.set(v4[0], v4[1]); + return _v2d; + } +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexColumn::Packer_color::get_data3d +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +const LVecBase3d &GeomVertexColumn::Packer_color:: +get_data3d(const unsigned char *pointer) { + if (_column->get_num_values() == 3) { + switch (_column->get_numeric_type()) { + case NT_uint8: + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + _v3d /= 255.0; + } + return _v3d; + + case NT_uint16: + { + const PN_uint16 *pi = (const PN_uint16 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + _v3d /= 65535.0; + } + return _v3d; + + case NT_uint32: + { + const PN_uint32 *pi = (const PN_uint32 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + _v3d /= 4294967295.0; + } + return _v3d; + + case NT_packed_dcba: + case NT_packed_dabc: + nassertr(false, _v3d); + return _v3d; + + case NT_float32: + { + const PN_float32 *pi = (const PN_float32 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + } + return _v3d; + + case NT_float64: + { + const PN_float64 *pi = (const PN_float64 *)pointer; + _v3d.set(pi[0], pi[1], pi[2]); + } + return _v3d; + + case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: + nassertr(false, _v3d); + return _v3d; + } + } else { + const LVecBase4d &v4 = get_data4d(pointer); + _v3d.set(v4[0], v4[1], v4[2]); + return _v3d; + } } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_color::get_data4d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4d &GeomVertexColumn::Packer_color:: get_data4d(const unsigned char *pointer) { - switch (_column->get_num_values()) { - case 1: - _v4d.set(get_data1i(pointer), 0.0f, 0.0f, 1.0f); + if (_column->get_num_values() == 3) { + const LVecBase3d &v3 = get_data3d(pointer); + _v4d.set(v3[0], v3[1], v3[2], 1.0); return _v4d; - - case 2: - { - const LVecBase2f &v2 = get_data2f(pointer); - _v4d.set(v2[0], v2[1], 0.0f, 1.0f); - } - return _v4d; - - case 3: - { - const LVecBase3f &v3 = get_data3f(pointer); - _v4d.set(v3[0], v3[1], v3[2], 1.0f); - } - return _v4d; - - default: + } else { switch (_column->get_numeric_type()) { case NT_uint8: - maybe_scale_color_d(pointer[0], pointer[1], pointer[2], pointer[3]); + { + const PN_uint8 *pi = (const PN_uint8 *)pointer; + _v4d.set(pi[0], pi[1], pi[2], pi[3]); + _v4d /= 255.0; + } return _v4d; - + case NT_uint16: { const PN_uint16 *pi = (const PN_uint16 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); + _v4d /= 65535.0; } return _v4d; - + case NT_uint32: { const PN_uint32 *pi = (const PN_uint32 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); + _v4d /= 4294967295.0; } return _v4d; - + case NT_packed_dcba: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4d.set(GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_a(dword)); + _v4d /= 255.0; } return _v4d; - + case NT_packed_dabc: { PN_uint32 dword = *(const PN_uint32 *)pointer; - maybe_scale_color_d(GeomVertexData::unpack_abcd_b(dword), - GeomVertexData::unpack_abcd_c(dword), - GeomVertexData::unpack_abcd_d(dword), - GeomVertexData::unpack_abcd_a(dword)); + _v4d.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_a(dword)); + _v4d /= 255.0; } return _v4d; - + case NT_float32: { const PN_float32 *pi = (const PN_float32 *)pointer; _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; - + case NT_float64: { const PN_float64 *pi = (const PN_float64 *)pointer; @@ -2842,101 +3734,425 @@ get_data4d(const unsigned char *pointer) { return _v4d; case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: nassertr(false, _v4d); + return _v4d; } } - - return _v4d; } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_color::set_data1f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_color:: set_data1f(unsigned char *pointer, float data) { - if (_column->get_num_values() == 4) { - set_data4f(pointer, LVecBase4f(data, 0.0f, 0.0f, 1.0f)); + if (_column->get_num_values() == 3) { + set_data3f(pointer, LVecBase3f(data, 0.0f, 0.0f)); } else { - Packer::set_data1f(pointer, data); + set_data4f(pointer, LVecBase4f(data, 0.0f, 0.0f, 1.0f)); } } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_color::set_data2f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_color:: set_data2f(unsigned char *pointer, const LVecBase2f &data) { - if (_column->get_num_values() == 4) { - set_data4f(pointer, LVecBase4f(data[0], data[1], 0.0f, 1.0f)); + if (_column->get_num_values() == 3) { + set_data3f(pointer, LVecBase3f(data[0], data[1], 0.0f)); } else { - Packer::set_data2f(pointer, data); + set_data4f(pointer, LVecBase4f(data[0], data[1], 0.0f, 1.0f)); } } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_color::set_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_color:: set_data3f(unsigned char *pointer, const LVecBase3f &data) { - if (_column->get_num_values() == 4) { - set_data4f(pointer, LVecBase4f(data[0], data[1], data[2], 1.0f)); + if (_column->get_num_values() == 3) { + switch (_column->get_numeric_type()) { + case NT_uint8: + { + LVecBase3f scaled = data * 255.0f; + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)scaled[0]; + pi[1] = (unsigned int)scaled[1]; + pi[2] = (unsigned int)scaled[2]; + } + break; + + case NT_uint16: + { + LVecBase3f scaled = data * 65535.0f; + PN_uint16 *pi = (PN_uint16 *)pointer; + pi[0] = (unsigned int)scaled[0]; + pi[1] = (unsigned int)scaled[1]; + pi[2] = (unsigned int)scaled[2]; + } + break; + + case NT_uint32: + { + LVecBase3f scaled = data * 4294967295.0f; + PN_uint32 *pi = (PN_uint32 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + } + break; + + case NT_packed_dcba: + { + LVecBase3f scaled = data * 255.0f; + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd( + 1.0f, scaled[2], scaled[1], scaled[0]); + } + break; + + case NT_packed_dabc: + { + LVecBase3f scaled = data * 255.0f; + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd( + 1.0f, scaled[0], scaled[1], scaled[2]); + } + break; + + case NT_float32: + { + PN_float32 *pi = (PN_float32 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + } + break; + + case NT_float64: + { + PN_float64 *pi = (PN_float64 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + } + break; + + case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: + nassertv(false); + break; + } } else { - Packer::set_data3f(pointer, data); + set_data4f(pointer, LVecBase4f(data[0], data[1], data[2], 1.0f)); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexColumn::Packer_color::set_data4f +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +void GeomVertexColumn::Packer_color:: +set_data4f(unsigned char *pointer, const LVecBase4f &data) { + if (_column->get_num_values() == 3) { + set_data3f(pointer, LVecBase3f(data[0], data[1], data[2])); + } else { + switch (_column->get_numeric_type()) { + case NT_uint8: + { + LVecBase4f scaled = data * 255.0f; + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)scaled[0]; + pi[1] = (unsigned int)scaled[1]; + pi[2] = (unsigned int)scaled[2]; + pi[3] = (unsigned int)scaled[3]; + } + break; + + case NT_uint16: + { + LVecBase4f scaled = data * 65535.0f; + PN_uint16 *pi = (PN_uint16 *)pointer; + pi[0] = (unsigned int)scaled[0]; + pi[1] = (unsigned int)scaled[1]; + pi[2] = (unsigned int)scaled[2]; + pi[3] = (unsigned int)scaled[3]; + } + break; + + case NT_uint32: + { + LVecBase4f scaled = data * 4294967295.0f; + PN_uint32 *pi = (PN_uint32 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + pi[3] = (unsigned int)data[3]; + } + break; + + case NT_packed_dcba: + { + LVecBase4f scaled = data * 255.0f; + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd( + scaled[3], scaled[2], scaled[1], scaled[0]); + } + break; + + case NT_packed_dabc: + { + LVecBase4f scaled = data * 255.0f; + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd( + scaled[3], scaled[0], scaled[1], scaled[2]); + } + break; + + case NT_float32: + { + PN_float32 *pi = (PN_float32 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + pi[3] = data[3]; + } + break; + + case NT_float64: + { + PN_float64 *pi = (PN_float64 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + pi[3] = data[3]; + } + break; + + case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: + nassertv(false); + break; + } } } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_color::set_data1d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_color:: set_data1d(unsigned char *pointer, double data) { - if (_column->get_num_values() == 4) { - set_data4d(pointer, LVecBase4d(data, 0.0f, 0.0f, 1.0f)); + if (_column->get_num_values() == 3) { + set_data3d(pointer, LVecBase3d(data, 0.0, 0.0)); } else { - Packer::set_data1d(pointer, data); + set_data4d(pointer, LVecBase4d(data, 0.0, 0.0, 1.0)); } } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_color::set_data2d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_color:: set_data2d(unsigned char *pointer, const LVecBase2d &data) { - if (_column->get_num_values() == 4) { - set_data4d(pointer, LVecBase4d(data[0], data[1], 0.0f, 1.0f)); + if (_column->get_num_values() == 3) { + set_data3d(pointer, LVecBase3d(data[0], data[1], 0.0)); } else { - Packer::set_data2d(pointer, data); + set_data4d(pointer, LVecBase4d(data[0], data[1], 0.0, 1.0)); } } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_color::set_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_color:: set_data3d(unsigned char *pointer, const LVecBase3d &data) { - if (_column->get_num_values() == 4) { - set_data4d(pointer, LVecBase4d(data[0], data[1], data[2], 1.0f)); + if (_column->get_num_values() == 3) { + switch (_column->get_numeric_type()) { + case NT_uint8: + { + LVecBase3d scaled = data * 255.0; + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)scaled[0]; + pi[1] = (unsigned int)scaled[1]; + pi[2] = (unsigned int)scaled[2]; + } + break; + + case NT_uint16: + { + LVecBase3d scaled = data * 65535.0; + PN_uint16 *pi = (PN_uint16 *)pointer; + pi[0] = (unsigned int)scaled[0]; + pi[1] = (unsigned int)scaled[1]; + pi[2] = (unsigned int)scaled[2]; + } + break; + + case NT_uint32: + { + LVecBase3d scaled = data * 4294967295.0; + PN_uint32 *pi = (PN_uint32 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + } + break; + + case NT_packed_dcba: + { + LVecBase3d scaled = data * 255.0; + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd( + 1.0, scaled[2], scaled[1], scaled[0]); + } + break; + + case NT_packed_dabc: + { + LVecBase3d scaled = data * 255.0; + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd( + 1.0, scaled[0], scaled[1], scaled[2]); + } + break; + + case NT_float32: + { + PN_float32 *pi = (PN_float32 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + } + break; + + case NT_float64: + { + PN_float64 *pi = (PN_float64 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + } + break; + + case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: + nassertv(false); + break; + } } else { - Packer::set_data3d(pointer, data); + set_data4d(pointer, LVecBase4d(data[0], data[1], data[2], 1.0f)); + } +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexColumn::Packer_color::set_data4d +// Access: Public, Virtual +// Description: +//////////////////////////////////////////////////////////////////// +void GeomVertexColumn::Packer_color:: +set_data4d(unsigned char *pointer, const LVecBase4d &data) { + if (_column->get_num_values() == 3) { + set_data3d(pointer, LVecBase3d(data[0], data[1], data[2])); + } else { + switch (_column->get_numeric_type()) { + case NT_uint8: + { + LVecBase4d scaled = data * 255.0; + PN_uint8 *pi = (PN_uint8 *)pointer; + pi[0] = (unsigned int)scaled[0]; + pi[1] = (unsigned int)scaled[1]; + pi[2] = (unsigned int)scaled[2]; + pi[3] = (unsigned int)scaled[3]; + } + break; + + case NT_uint16: + { + LVecBase4d scaled = data * 65535.0; + PN_uint16 *pi = (PN_uint16 *)pointer; + pi[0] = (unsigned int)scaled[0]; + pi[1] = (unsigned int)scaled[1]; + pi[2] = (unsigned int)scaled[2]; + pi[3] = (unsigned int)scaled[3]; + } + break; + + case NT_uint32: + { + LVecBase4d scaled = data * 4294967295.0; + PN_uint32 *pi = (PN_uint32 *)pointer; + pi[0] = (unsigned int)data[0]; + pi[1] = (unsigned int)data[1]; + pi[2] = (unsigned int)data[2]; + pi[3] = (unsigned int)data[3]; + } + break; + + case NT_packed_dcba: + { + LVecBase4d scaled = data * 255.0; + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd( + scaled[3], scaled[2], scaled[1], scaled[0]); + } + break; + + case NT_packed_dabc: + { + LVecBase4d scaled = data * 255.0; + *(PN_uint32 *)pointer = GeomVertexData::pack_abcd( + scaled[3], scaled[0], scaled[1], scaled[2]); + } + break; + + case NT_float32: + { + PN_float32 *pi = (PN_float32 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + pi[3] = data[3]; + } + break; + + case NT_float64: + { + PN_float64 *pi = (PN_float64 *)pointer; + pi[0] = data[0]; + pi[1] = data[1]; + pi[2] = data[2]; + pi[3] = data[3]; + } + break; + + case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: + nassertv(false); + break; + } } } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_float32_3::get_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3f &GeomVertexColumn::Packer_float32_3:: get_data3f(const unsigned char *pointer) { @@ -2948,7 +4164,7 @@ get_data3f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_float32_3::set_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_float32_3:: set_data3f(unsigned char *pointer, const LVecBase3f &data) { @@ -2961,7 +4177,7 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float32_2::get_data2f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2f &GeomVertexColumn::Packer_point_float32_2:: get_data2f(const unsigned char *pointer) { @@ -2973,7 +4189,7 @@ get_data2f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float32_2::set_data2f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point_float32_2:: set_data2f(unsigned char *pointer, const LVecBase2f &data) { @@ -2985,7 +4201,7 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float32_3::get_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3f &GeomVertexColumn::Packer_point_float32_3:: get_data3f(const unsigned char *pointer) { @@ -2997,7 +4213,7 @@ get_data3f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float32_3::set_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point_float32_3:: set_data3f(unsigned char *pointer, const LVecBase3f &data) { @@ -3010,7 +4226,7 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float32_4::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer_point_float32_4:: get_data4f(const unsigned char *pointer) { @@ -3022,7 +4238,7 @@ get_data4f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float32_4::set_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point_float32_4:: set_data4f(unsigned char *pointer, const LVecBase4f &data) { @@ -3036,7 +4252,7 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_nativefloat_3::get_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3f &GeomVertexColumn::Packer_nativefloat_3:: get_data3f(const unsigned char *pointer) { @@ -3046,7 +4262,7 @@ get_data3f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_nativefloat_2::get_data2f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2f &GeomVertexColumn::Packer_point_nativefloat_2:: get_data2f(const unsigned char *pointer) { @@ -3056,7 +4272,7 @@ get_data2f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_nativefloat_3::get_data3f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3f &GeomVertexColumn::Packer_point_nativefloat_3:: get_data3f(const unsigned char *pointer) { @@ -3066,7 +4282,7 @@ get_data3f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_nativefloat_4::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer_point_nativefloat_4:: get_data4f(const unsigned char *pointer) { @@ -3076,7 +4292,7 @@ get_data4f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_float64_3::get_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3d &GeomVertexColumn::Packer_float64_3:: get_data3d(const unsigned char *pointer) { @@ -3088,7 +4304,7 @@ get_data3d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_float64_3::set_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_float64_3:: set_data3d(unsigned char *pointer, const LVecBase3d &data) { @@ -3101,7 +4317,7 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float64_2::get_data2d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2d &GeomVertexColumn::Packer_point_float64_2:: get_data2d(const unsigned char *pointer) { @@ -3113,7 +4329,7 @@ get_data2d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float64_2::set_data2d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point_float64_2:: set_data2d(unsigned char *pointer, const LVecBase2d &data) { @@ -3125,7 +4341,7 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float64_3::get_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3d &GeomVertexColumn::Packer_point_float64_3:: get_data3d(const unsigned char *pointer) { @@ -3137,7 +4353,7 @@ get_data3d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float64_3::set_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point_float64_3:: set_data3d(unsigned char *pointer, const LVecBase3d &data) { @@ -3150,7 +4366,7 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float64_4::get_data4d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4d &GeomVertexColumn::Packer_point_float64_4:: get_data4d(const unsigned char *pointer) { @@ -3162,7 +4378,7 @@ get_data4d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_float64_4::set_data4d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_point_float64_4:: set_data4d(unsigned char *pointer, const LVecBase4d &data) { @@ -3176,7 +4392,7 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_nativedouble_3::get_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3d &GeomVertexColumn::Packer_nativedouble_3:: get_data3d(const unsigned char *pointer) { @@ -3186,7 +4402,7 @@ get_data3d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_nativedouble_2::get_data2d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase2d &GeomVertexColumn::Packer_point_nativedouble_2:: get_data2d(const unsigned char *pointer) { @@ -3196,7 +4412,7 @@ get_data2d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_nativedouble_3::get_data3d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase3d &GeomVertexColumn::Packer_point_nativedouble_3:: get_data3d(const unsigned char *pointer) { @@ -3206,7 +4422,7 @@ get_data3d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_point_nativedouble_4::get_data4d // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4d &GeomVertexColumn::Packer_point_nativedouble_4:: get_data4d(const unsigned char *pointer) { @@ -3216,73 +4432,66 @@ get_data4d(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_argb_packed::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer_argb_packed:: get_data4f(const unsigned char *pointer) { PN_uint32 dword = *(const PN_uint32 *)pointer; - _v4.set((float)GeomVertexData::unpack_abcd_b(dword) / 255.0f, - (float)GeomVertexData::unpack_abcd_c(dword) / 255.0f, - (float)GeomVertexData::unpack_abcd_d(dword) / 255.0f, - (float)GeomVertexData::unpack_abcd_a(dword) / 255.0f); + _v4.set(GeomVertexData::unpack_abcd_b(dword), + GeomVertexData::unpack_abcd_c(dword), + GeomVertexData::unpack_abcd_d(dword), + GeomVertexData::unpack_abcd_a(dword)); + _v4 /= 255.0f; return _v4; } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_argb_packed::set_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_argb_packed:: set_data4f(unsigned char *pointer, const LVecBase4f &data) { // when packing an argb, we want to make sure we cap // the input values at 1 since going above one will cause // the value to be truncated. - float newData[4]; - for (int i = 0; i < 4; i++) { - if (data[i] > 1.0) - newData[i] = 1.0; - else - newData[i] = data[i]; - } *(PN_uint32 *)pointer = GeomVertexData::pack_abcd - ((unsigned int)(newData[3] * 255.0f), - (unsigned int)(newData[0] * 255.0f), - (unsigned int)(newData[1] * 255.0f), - (unsigned int)(newData[2] * 255.0f)); + ((unsigned int)(min(max(data[3], 0.0f), 1.0f) * 255.0f), + (unsigned int)(min(max(data[0], 0.0f), 1.0f) * 255.0f), + (unsigned int)(min(max(data[1], 0.0f), 1.0f) * 255.0f), + (unsigned int)(min(max(data[2], 0.0f), 1.0f) * 255.0f)); } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_rgba_uint8_4::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer_rgba_uint8_4:: get_data4f(const unsigned char *pointer) { - _v4.set((float)pointer[0] / 255.0f, - (float)pointer[1] / 255.0f, - (float)pointer[2] / 255.0f, - (float)pointer[3] / 255.0f); + _v4.set((float)pointer[0], (float)pointer[1], + (float)pointer[2], (float)pointer[3]); + _v4 /= 255.0f; return _v4; } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_rgba_uint8_4::set_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_rgba_uint8_4:: set_data4f(unsigned char *pointer, const LVecBase4f &data) { - pointer[0] = (unsigned int)(data[0] * 255.0f); - pointer[1] = (unsigned int)(data[1] * 255.0f); - pointer[2] = (unsigned int)(data[2] * 255.0f); - pointer[3] = (unsigned int)(data[3] * 255.0f); + pointer[0] = (unsigned int)(min(max(data[0], 0.0f), 1.0f) * 255.0f); + pointer[1] = (unsigned int)(min(max(data[1], 0.0f), 1.0f) * 255.0f); + pointer[2] = (unsigned int)(min(max(data[2], 0.0f), 1.0f) * 255.0f); + pointer[3] = (unsigned int)(min(max(data[3], 0.0f), 1.0f) * 255.0f); } //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_rgba_float32_4::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer_rgba_float32_4:: get_data4f(const unsigned char *pointer) { @@ -3294,7 +4503,7 @@ get_data4f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_rgba_float32_4::set_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_rgba_float32_4:: set_data4f(unsigned char *pointer, const LVecBase4f &data) { @@ -3308,7 +4517,7 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_rgba_nativefloat_4::get_data4f // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// const LVecBase4f &GeomVertexColumn::Packer_rgba_nativefloat_4:: get_data4f(const unsigned char *pointer) { @@ -3318,7 +4527,7 @@ get_data4f(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_uint16_1::get_data1i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// int GeomVertexColumn::Packer_uint16_1:: get_data1i(const unsigned char *pointer) { @@ -3328,7 +4537,7 @@ get_data1i(const unsigned char *pointer) { //////////////////////////////////////////////////////////////////// // Function: GeomVertexColumn::Packer_uint16_1::set_data1i // Access: Public, Virtual -// Description: +// Description: //////////////////////////////////////////////////////////////////// void GeomVertexColumn::Packer_uint16_1:: set_data1i(unsigned char *pointer, int data) { diff --git a/panda/src/gobj/geomVertexColumn.h b/panda/src/gobj/geomVertexColumn.h index ab3ddf9f4f..8629c786d5 100644 --- a/panda/src/gobj/geomVertexColumn.h +++ b/panda/src/gobj/geomVertexColumn.h @@ -150,30 +150,6 @@ private: return "Packer"; } - INLINE float maybe_scale_color_f(unsigned int value); - INLINE void maybe_scale_color_f(unsigned int a, unsigned int b); - INLINE void maybe_scale_color_f(unsigned int a, unsigned int b, - unsigned int c); - INLINE void maybe_scale_color_f(unsigned int a, unsigned int b, - unsigned int c, unsigned int d); - - INLINE unsigned int maybe_unscale_color_f(float data); - INLINE void maybe_unscale_color_f(const LVecBase2f &data); - INLINE void maybe_unscale_color_f(const LVecBase3f &data); - INLINE void maybe_unscale_color_f(const LVecBase4f &data); - - INLINE double maybe_scale_color_d(unsigned int value); - INLINE void maybe_scale_color_d(unsigned int a, unsigned int b); - INLINE void maybe_scale_color_d(unsigned int a, unsigned int b, - unsigned int c); - INLINE void maybe_scale_color_d(unsigned int a, unsigned int b, - unsigned int c, unsigned int d); - - INLINE unsigned int maybe_unscale_color_d(double data); - INLINE void maybe_unscale_color_d(const LVecBase2d &data); - INLINE void maybe_unscale_color_d(const LVecBase3d &data); - INLINE void maybe_unscale_color_d(const LVecBase4d &data); - const GeomVertexColumn *_column; LVecBase2f _v2; LVecBase3f _v3; @@ -191,7 +167,7 @@ private: // This is a specialization on the generic Packer that handles // points, which are special because the fourth component, if not // present in the data, is implicitly 1.0; and if it is present, - // than any three-component or smaller return is implicitly divided + // then any three-component or smaller return is implicitly divided // by the fourth component. class Packer_point : public Packer { public: @@ -199,14 +175,17 @@ private: virtual const LVecBase2f &get_data2f(const unsigned char *pointer); virtual const LVecBase3f &get_data3f(const unsigned char *pointer); virtual const LVecBase4f &get_data4f(const unsigned char *pointer); + virtual double get_data1d(const unsigned char *pointer); virtual const LVecBase2d &get_data2d(const unsigned char *pointer); virtual const LVecBase3d &get_data3d(const unsigned char *pointer); virtual const LVecBase4d &get_data4d(const unsigned char *pointer); + virtual void set_data1f(unsigned char *pointer, float data); virtual void set_data2f(unsigned char *pointer, const LVecBase2f &data); virtual void set_data3f(unsigned char *pointer, const LVecBase3f &data); virtual void set_data4f(unsigned char *pointer, const LVecBase4f &data); + virtual void set_data1d(unsigned char *pointer, double data); virtual void set_data2d(unsigned char *pointer, const LVecBase2d &data); virtual void set_data3d(unsigned char *pointer, const LVecBase3d &data); @@ -219,17 +198,28 @@ private: // This is similar to Packer_point, in that the fourth component is // implicitly 1.0 if it is not present in the data, but we never - // divide by alpha. + // divide by alpha. It also transforms integer colors to the 0-1 range. class Packer_color : public Packer { public: + virtual float get_data1f(const unsigned char *pointer); + virtual const LVecBase2f &get_data2f(const unsigned char *pointer); + virtual const LVecBase3f &get_data3f(const unsigned char *pointer); virtual const LVecBase4f &get_data4f(const unsigned char *pointer); + + virtual double get_data1d(const unsigned char *pointer); + virtual const LVecBase2d &get_data2d(const unsigned char *pointer); + virtual const LVecBase3d &get_data3d(const unsigned char *pointer); virtual const LVecBase4d &get_data4d(const unsigned char *pointer); + virtual void set_data1f(unsigned char *pointer, float data); virtual void set_data2f(unsigned char *pointer, const LVecBase2f &data); virtual void set_data3f(unsigned char *pointer, const LVecBase3f &data); + virtual void set_data4f(unsigned char *pointer, const LVecBase4f &data); + virtual void set_data1d(unsigned char *pointer, double data); virtual void set_data2d(unsigned char *pointer, const LVecBase2d &data); virtual void set_data3d(unsigned char *pointer, const LVecBase3d &data); + virtual void set_data4d(unsigned char *pointer, const LVecBase4d &data); virtual const char *get_name() const { return "Packer_color"; diff --git a/panda/src/gobj/geomVertexData.cxx b/panda/src/gobj/geomVertexData.cxx index 7a265b66a0..5e5795f7fb 100644 --- a/panda/src/gobj/geomVertexData.cxx +++ b/panda/src/gobj/geomVertexData.cxx @@ -2368,7 +2368,7 @@ get_array_info(const InternalName *name, const GeomVertexArrayDataHandle *&array_reader, int &num_values, GeomVertexDataPipelineReader::NumericType &numeric_type, - int &start, int &stride, int &divisor, + bool &normalized, int &start, int &stride, int &divisor, int &num_elements, int &element_stride) const { nassertr(_got_array_readers, false); int array_index; @@ -2377,6 +2377,7 @@ get_array_info(const InternalName *name, array_reader = _array_readers[array_index]; num_values = column->get_num_values(); numeric_type = column->get_numeric_type(); + normalized = (column->get_contents() == GeomEnums::C_color); start = column->get_start(); stride = _cdata->_format->get_array(array_index)->get_stride(); divisor = _cdata->_format->get_array(array_index)->get_divisor(); @@ -2553,11 +2554,11 @@ set_num_rows(int n) { int num_values = column->get_num_values(); switch (column->get_numeric_type()) { - case NT_packed_dcba: - case NT_packed_dabc: case NT_uint8: case NT_uint16: case NT_uint32: + case NT_packed_dcba: + case NT_packed_dabc: while (pointer < stop) { memset(pointer, 0xff, column->get_total_bytes()); pointer += stride; @@ -2585,6 +2586,9 @@ set_num_rows(int n) { break; case NT_stdfloat: + case NT_int8: + case NT_int16: + case NT_int32: // Shouldn't have this type in the format. nassertr(false, false); } diff --git a/panda/src/gobj/geomVertexData.h b/panda/src/gobj/geomVertexData.h index 9bcdd7daec..b7a4fefe95 100644 --- a/panda/src/gobj/geomVertexData.h +++ b/panda/src/gobj/geomVertexData.h @@ -453,7 +453,7 @@ public: bool get_array_info(const InternalName *name, const GeomVertexArrayDataHandle *&array_reader, int &num_values, NumericType &numeric_type, - int &start, int &stride, int &divisor, + bool &normalized, int &start, int &stride, int &divisor, int &num_elements, int &element_stride) const; INLINE bool has_vertex() const; diff --git a/panda/src/gobj/geomVertexWriter.I b/panda/src/gobj/geomVertexWriter.I index 66a9f4ee6d..708ce474a1 100644 --- a/panda/src/gobj/geomVertexWriter.I +++ b/panda/src/gobj/geomVertexWriter.I @@ -906,20 +906,6 @@ set_data2i(int a, int b) { set_data2i(LVecBase2i(a, b)); } -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexWriter::set_data2i -// Access: Published -// Description: Sets the write row to a particular 2-component -// value, and advances the write row. -// -// It is an error for the write row to advance past -// the end of data. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexWriter:: -set_data2i(const int data[2]) { - set_data2i(LVecBase2i(data[0], data[1])); -} - //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::set_data2i // Access: Published @@ -949,20 +935,6 @@ set_data3i(int a, int b, int c) { set_data3i(LVecBase3i(a, b, c)); } -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexWriter::set_data3i -// Access: Published -// Description: Sets the write row to a particular 3-component -// value, and advances the write row. -// -// It is an error for the write row to advance past -// the end of data. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexWriter:: -set_data3i(const int data[3]) { - set_data3i(LVecBase3i(data[0], data[1], data[2])); -} - //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::set_data3i // Access: Published @@ -992,20 +964,6 @@ set_data4i(int a, int b, int c, int d) { set_data4i(LVecBase4i(a, b, c, d)); } -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexWriter::set_data4i -// Access: Published -// Description: Sets the write row to a particular 4-component -// value, and advances the write row. -// -// It is an error for the write row to advance past -// the end of data. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexWriter:: -set_data4i(const int data[4]) { - set_data4i(LVecBase4i(data[0], data[1], data[2], data[3])); -} - //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::set_data4i // Access: Published @@ -1526,20 +1484,6 @@ add_data2i(int a, int b) { add_data2i(LVecBase2i(a, b)); } -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexWriter::add_data2i -// Access: Published -// Description: Sets the write row to a particular 2-component -// value, and advances the write row. -// -// If the write row advances past the end of data, -// implicitly adds a new row to the data. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexWriter:: -add_data2i(const int data[2]) { - add_data2i(LVecBase2i(data[0], data[1])); -} - //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::add_data2i // Access: Published @@ -1569,20 +1513,6 @@ add_data3i(int a, int b, int c) { add_data3i(LVecBase3i(a, b, c)); } -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexWriter::add_data3i -// Access: Published -// Description: Sets the write row to a particular 3-component -// value, and advances the write row. -// -// If the write row advances past the end of data, -// implicitly adds a new row to the data. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexWriter:: -add_data3i(const int data[3]) { - add_data3i(LVecBase3i(data[0], data[1], data[2])); -} - //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::add_data3i // Access: Published @@ -1612,20 +1542,6 @@ add_data4i(int a, int b, int c, int d) { add_data4i(LVecBase4i(a, b, c, d)); } -//////////////////////////////////////////////////////////////////// -// Function: GeomVertexWriter::add_data4i -// Access: Published -// Description: Sets the write row to a particular 4-component -// value, and advances the write row. -// -// If the write row advances past the end of data, -// implicitly adds a new row to the data. -//////////////////////////////////////////////////////////////////// -INLINE void GeomVertexWriter:: -add_data4i(const int data[4]) { - add_data4i(LVecBase4i(data[0], data[1], data[2], data[3])); -} - //////////////////////////////////////////////////////////////////// // Function: GeomVertexWriter::add_data4i // Access: Published diff --git a/panda/src/gobj/geomVertexWriter.h b/panda/src/gobj/geomVertexWriter.h index 2a22f78f1f..7f49d81c54 100644 --- a/panda/src/gobj/geomVertexWriter.h +++ b/panda/src/gobj/geomVertexWriter.h @@ -144,13 +144,10 @@ PUBLISHED: INLINE void set_data1i(int data); INLINE void set_data2i(int a, int b); - INLINE void set_data2i(const int data[2]); INLINE void set_data2i(const LVecBase2i &data); INLINE void set_data3i(int a, int b, int c); - INLINE void set_data3i(const int data[3]); INLINE void set_data3i(const LVecBase3i &data); INLINE void set_data4i(int a, int b, int c, int d); - INLINE void set_data4i(const int data[4]); INLINE void set_data4i(const LVecBase4i &data); INLINE void add_data1f(float data); @@ -185,13 +182,10 @@ PUBLISHED: INLINE void add_data1i(int data); INLINE void add_data2i(int a, int b); - INLINE void add_data2i(const int data[2]); INLINE void add_data2i(const LVecBase2i &data); INLINE void add_data3i(int a, int b, int c); - INLINE void add_data3i(const int data[3]); INLINE void add_data3i(const LVecBase3i &data); INLINE void add_data4i(int a, int b, int c, int d); - INLINE void add_data4i(const int data[4]); INLINE void add_data4i(const LVecBase4i &data); void output(ostream &out) const; From 74f936115e6475fbd6aa5c5e13247a4e467b16fd Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 1 May 2015 20:15:00 +0200 Subject: [PATCH 71/73] Force p3d_Vertex to attribute location 0 to fix disappearing geometry when an attribute is not bound --- panda/src/glstuff/glShaderContext_src.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 3c031dc904..af09da5408 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1974,6 +1974,17 @@ glsl_compile_and_link() { // glsl_report_shader_errors(*it); //} + // Under core OpenGL, we have to make sure that we bind something to + // attribute 0. Make sure that this is the position array. + _glgsg->_glBindAttribLocation(_glsl_program, 0, "p3d_Vertex"); + _glgsg->_glBindAttribLocation(_glsl_program, 0, "vertex"); + + // While we're at it, let's also map these to fixed locations. These + // attributes were historically fixed to these locations, so it might + // help a buggy driver. + _glgsg->_glBindAttribLocation(_glsl_program, 2, "p3d_Normal"); + _glgsg->_glBindAttribLocation(_glsl_program, 3, "p3d_Color"); + // If we requested to retrieve the shader, we should indicate that before linking. #if !defined(NDEBUG) && !defined(OPENGLES) if (gl_dump_compiled_shaders && _glgsg->_supports_get_program_binary) { From fdc8918946e20870dbc37ec37aa281dd0a1b82f9 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 2 May 2015 14:20:51 +0200 Subject: [PATCH 72/73] Add packed unsigned 11/10/10-bit floating point vertex format --- panda/src/glstuff/glGeomMunger_src.cxx | 66 +++++-- .../glstuff/glGraphicsStateGuardian_src.cxx | 12 +- .../src/glstuff/glGraphicsStateGuardian_src.h | 1 + panda/src/glstuff/glShaderContext_src.cxx | 4 +- panda/src/gobj/geomEnums.cxx | 3 + panda/src/gobj/geomEnums.h | 1 + panda/src/gobj/geomVertexColumn.cxx | 182 +++++++++++++++++- panda/src/gobj/geomVertexData.I | 144 ++++++++++++++ panda/src/gobj/geomVertexData.cxx | 10 +- panda/src/gobj/geomVertexData.h | 5 + 10 files changed, 403 insertions(+), 25 deletions(-) diff --git a/panda/src/glstuff/glGeomMunger_src.cxx b/panda/src/glstuff/glGeomMunger_src.cxx index fd2b494386..fd98cbab1f 100644 --- a/panda/src/glstuff/glGeomMunger_src.cxx +++ b/panda/src/glstuff/glGeomMunger_src.cxx @@ -92,7 +92,8 @@ munge_format_impl(const GeomVertexFormat *orig, // and texture coordinates. const GeomVertexColumn *vertex_type = orig->get_vertex_column(); if (vertex_type != (GeomVertexColumn *)NULL && - vertex_type->get_numeric_type() == NT_int8) { + (vertex_type->get_numeric_type() == NT_int8 || + vertex_type->get_numeric_type() == NT_uint8)) { int vertex_array = orig->get_array_with(InternalName::get_vertex()); PT(GeomVertexArrayFormat) new_array_format = new_format->modify_array(vertex_array); @@ -102,7 +103,29 @@ munge_format_impl(const GeomVertexFormat *orig, (InternalName::get_vertex(), 3, NT_int16, C_point, vertex_type->get_start(), vertex_type->get_column_alignment()); } -#endif + + // Convert packed formats that OpenGL may not understand. + for (int i = 0; i < orig->get_num_columns(); ++i) { + const GeomVertexColumn *column = orig->get_column(i); + int array = orig->get_array_with(column->get_name()); + + if (column->get_numeric_type() == NT_packed_dabc && + !glgsg->_supports_packed_dabc) { + // Unpack the packed ARGB color into its four byte components. + PT(GeomVertexArrayFormat) array_format = new_format->modify_array(array); + array_format->add_column(column->get_name(), 4, NT_uint8, C_color, + column->get_start(), column->get_column_alignment()); + + } else if (column->get_numeric_type() == NT_packed_ufloat && + !glgsg->_supports_packed_ufloat) { + // Unpack to three 32-bit floats. (In future, should try 16-bit float) + PT(GeomVertexArrayFormat) array_format = new_format->modify_array(array); + array_format->add_column(column->get_name(), 3, NT_float32, + column->get_contents(), column->get_start(), + column->get_column_alignment()); + } + } +#endif // !OPENGLES const GeomVertexColumn *color_type = orig->get_color_column(); if (color_type != (GeomVertexColumn *)NULL && @@ -116,8 +139,8 @@ munge_format_impl(const GeomVertexFormat *orig, // Replace the existing color format with the new format. new_array_format->add_column - (InternalName::get_color(), 4, NT_uint8, - C_color, color_type->get_start(), color_type->get_column_alignment()); + (InternalName::get_color(), 4, NT_uint8, C_color, + color_type->get_start(), color_type->get_column_alignment()); } if (animation.get_animation_type() == AT_hardware) { @@ -259,7 +282,8 @@ premunge_format_impl(const GeomVertexFormat *orig) { // and texture coordinates. const GeomVertexColumn *vertex_type = orig->get_vertex_column(); if (vertex_type != (GeomVertexColumn *)NULL && - vertex_type->get_numeric_type() == NT_int8) { + (vertex_type->get_numeric_type() == NT_int8 || + vertex_type->get_numeric_type() == NT_uint8)) { int vertex_array = orig->get_array_with(InternalName::get_vertex()); PT(GeomVertexArrayFormat) new_array_format = new_format->modify_array(vertex_array); @@ -269,23 +293,29 @@ premunge_format_impl(const GeomVertexFormat *orig) { (InternalName::get_vertex(), 3, NT_int16, C_point, vertex_type->get_start(), vertex_type->get_column_alignment()); } -#endif - const GeomVertexColumn *color_type = orig->get_color_column(); - if (color_type != (GeomVertexColumn *)NULL && - color_type->get_numeric_type() == NT_packed_dabc && - !glgsg->_supports_packed_dabc) { - // We need to convert the color format; OpenGL doesn't support the - // byte order of DirectX's packed ARGB format. - int color_array = orig->get_array_with(InternalName::get_color()); + // Convert packed formats that OpenGL may not understand. + for (int i = 0; i < orig->get_num_columns(); ++i) { + const GeomVertexColumn *column = orig->get_column(i); + int array = orig->get_array_with(column->get_name()); - PT(GeomVertexArrayFormat) new_array_format = new_format->modify_array(color_array); + if (column->get_numeric_type() == NT_packed_dabc && + !glgsg->_supports_packed_dabc) { + // Unpack the packed ARGB color into its four byte components. + PT(GeomVertexArrayFormat) array_format = new_format->modify_array(array); + array_format->add_column(column->get_name(), 4, NT_uint8, C_color, + column->get_start(), column->get_column_alignment()); - // Replace the existing color format with the new format. - new_array_format->add_column - (InternalName::get_color(), 4, NT_uint8, - C_color, color_type->get_start(), color_type->get_column_alignment()); + } else if (column->get_numeric_type() == NT_packed_ufloat && + !glgsg->_supports_packed_ufloat) { + // Unpack to three 32-bit floats. (In future, should try 16-bit float) + PT(GeomVertexArrayFormat) array_format = new_format->modify_array(array); + array_format->add_column(column->get_name(), 3, NT_float32, + column->get_contents(), column->get_start(), + column->get_column_alignment()); + } } +#endif // !OPENGLES CPT(GeomVertexFormat) format = GeomVertexFormat::register_format(new_format); diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 26809b9143..e831b13915 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -1012,10 +1012,13 @@ reset() { #ifdef OPENGLES _supports_packed_dabc = false; + _supports_packed_ufloat = false; #else _supports_packed_dabc = is_at_least_gl_version(3, 2) || has_extension("GL_ARB_vertex_array_bgra") || has_extension("GL_EXT_vertex_array_bgra"); + _supports_packed_ufloat = is_at_least_gl_version(4, 4) || + has_extension("GL_ARB_vertex_type_10f_11f_11f_rev"); #endif _supports_multisample = @@ -3707,7 +3710,7 @@ update_standard_vertex_arrays(bool force) { return false; } glVertexPointer(num_values, get_numeric_type(numeric_type), - stride, client_pointer + start); + stride, client_pointer + start); glEnableClientState(GL_VERTEX_ARRAY); } } @@ -7380,6 +7383,13 @@ get_numeric_type(Geom::NumericType numeric_type) { case Geom::NT_int32: return GL_INT; + + case Geom::NT_packed_ufloat: +#ifndef OPENGLES + return GL_UNSIGNED_INT_10F_11F_11F_REV; +#else + break; +#endif } GLCAT.error() diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index cac7694f4e..0898dfe309 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -713,6 +713,7 @@ public: bool _supports_bgr; bool _supports_rescale_normal; bool _supports_packed_dabc; + bool _supports_packed_ufloat; PFNGLACTIVETEXTUREPROC _glActiveTexture; #ifndef OPENGLES_2 diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 0ee8ea01ca..87fafebb48 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -2002,8 +2002,8 @@ glsl_compile_and_link() { // glsl_report_shader_errors(*it); //} - // Under core OpenGL, we have to make sure that we bind something to - // attribute 0. Make sure that this is the position array. + // Under OpenGL's compatibility profile, we have to make sure that we bind + // something to attribute 0. Make sure that this is the position array. _glgsg->_glBindAttribLocation(_glsl_program, 0, "p3d_Vertex"); _glgsg->_glBindAttribLocation(_glsl_program, 0, "vertex"); diff --git a/panda/src/gobj/geomEnums.cxx b/panda/src/gobj/geomEnums.cxx index 4d7ed0f010..4158560ea5 100644 --- a/panda/src/gobj/geomEnums.cxx +++ b/panda/src/gobj/geomEnums.cxx @@ -110,6 +110,9 @@ operator << (ostream &out, GeomEnums::NumericType numeric_type) { case GeomEnums::NT_int32: return out << "int32"; + + case GeomEnums::NT_packed_ufloat: + return out << "packed_ufloat"; } return out << "**invalid numeric type (" << (int)numeric_type << ")**"; diff --git a/panda/src/gobj/geomEnums.h b/panda/src/gobj/geomEnums.h index 18f576efcc..f0e4482512 100644 --- a/panda/src/gobj/geomEnums.h +++ b/panda/src/gobj/geomEnums.h @@ -186,6 +186,7 @@ PUBLISHED: NT_int8, // An integer -128..127 NT_int16, // An integer -32768..32767 NT_int32, // An integer -2147483648..2147483647 + NT_packed_ufloat,// Three 10/11-bit float components packed in a uint32 }; // The contents determine the semantic meaning of a numeric value diff --git a/panda/src/gobj/geomVertexColumn.cxx b/panda/src/gobj/geomVertexColumn.cxx index 05419c41b5..e5cbe29e27 100644 --- a/panda/src/gobj/geomVertexColumn.cxx +++ b/panda/src/gobj/geomVertexColumn.cxx @@ -153,6 +153,7 @@ output(ostream &out) const { break; case NT_stdfloat: + case NT_packed_ufloat: out << "?"; break; } @@ -214,6 +215,11 @@ setup() { case NT_stdfloat: nassertv(false); break; + + case NT_packed_ufloat: + _component_bytes = 4; // sizeof(PN_uint32) + _num_values *= 3; + break; } if (_contents == C_matrix) { @@ -483,6 +489,12 @@ get_data1f(const unsigned char *pointer) { case NT_int32: return *(const PN_int32 *)pointer; + case NT_packed_ufloat: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + return GeomVertexData::unpack_ufloat_a(dword); + } + default: nassertr(false, 0.0f); } @@ -578,6 +590,10 @@ get_data2f(const unsigned char *pointer) { _v2.set(pi[0], pi[1]); } return _v2; + + case NT_packed_ufloat: + nassertr(false, _v2); + return _v2; } } @@ -682,6 +698,15 @@ get_data3f(const unsigned char *pointer) { _v3.set(pi[0], pi[1], pi[2]); } return _v3; + + case NT_packed_ufloat: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + _v3.set(GeomVertexData::unpack_ufloat_a(dword), + GeomVertexData::unpack_ufloat_b(dword), + GeomVertexData::unpack_ufloat_c(dword)); + } + return _v3; } } @@ -795,6 +820,10 @@ get_data4f(const unsigned char *pointer) { _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; + + case NT_packed_ufloat: + nassertr(false, _v4); + break; } } @@ -837,8 +866,8 @@ get_data1d(const unsigned char *pointer) { return *(const PN_float64 *)pointer; case NT_stdfloat: - nassertr(false, 0.0f); - return 0.0f; + nassertr(false, 0.0); + return 0.0; case NT_int8: return *(const PN_int8 *)pointer; @@ -848,9 +877,15 @@ get_data1d(const unsigned char *pointer) { case NT_int32: return *(const PN_int32 *)pointer; + + case NT_packed_ufloat: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + return GeomVertexData::unpack_ufloat_a(dword); + } } - return 0.0f; + return 0.0; } //////////////////////////////////////////////////////////////////// @@ -941,6 +976,10 @@ get_data2d(const unsigned char *pointer) { _v2d.set(pi[0], pi[1]); } return _v2d; + + case NT_packed_ufloat: + nassertr(false, _v2d); + break; } } @@ -1045,6 +1084,15 @@ get_data3d(const unsigned char *pointer) { _v3d.set(pi[0], pi[1], pi[2]); } return _v3d; + + case NT_packed_ufloat: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + _v3d.set(GeomVertexData::unpack_ufloat_a(dword), + GeomVertexData::unpack_ufloat_b(dword), + GeomVertexData::unpack_ufloat_c(dword)); + } + return _v3d; } } @@ -1158,6 +1206,10 @@ get_data4d(const unsigned char *pointer) { _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; + + case NT_packed_ufloat: + nassertr(false, _v4d); + break; } } @@ -1211,6 +1263,12 @@ get_data1i(const unsigned char *pointer) { case NT_int32: return *(const PN_int32 *)pointer; + + case NT_packed_ufloat: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + return (int)GeomVertexData::unpack_ufloat_a(dword); + } } return 0; @@ -1302,6 +1360,10 @@ get_data2i(const unsigned char *pointer) { _v2i.set(pi[0], pi[1]); } return _v2i; + + case NT_packed_ufloat: + nassertr(false, _v2i); + break; } } @@ -1403,6 +1465,15 @@ get_data3i(const unsigned char *pointer) { _v3i.set(pi[0], pi[1], pi[2]); } return _v3i; + + case NT_packed_ufloat: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + _v3i.set((int)GeomVertexData::unpack_ufloat_a(dword), + (int)GeomVertexData::unpack_ufloat_b(dword), + (int)GeomVertexData::unpack_ufloat_c(dword)); + } + return _v3i; } } @@ -1513,6 +1584,10 @@ get_data4i(const unsigned char *pointer) { _v4i.set(pi[0], pi[1], pi[2], pi[3]); } return _v4i; + + case NT_packed_ufloat: + nassertr(false, _v4i); + break; } } @@ -1569,6 +1644,10 @@ set_data1f(unsigned char *pointer, float data) { case NT_int32: *(PN_int32 *)pointer = (int)data; break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; @@ -1596,6 +1675,7 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { switch (_column->get_num_values()) { case 1: set_data1f(pointer, data[0]); + break; case 2: switch (_column->get_numeric_type()) { @@ -1671,6 +1751,10 @@ set_data2f(unsigned char *pointer, const LVecBase2f &data) { pi[1] = (int)data[1]; } break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; @@ -1782,6 +1866,10 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { pi[2] = (int)data[2]; } break; + + case NT_packed_ufloat: + *(PN_uint32 *)pointer = GeomVertexData::pack_ufloat(data[0], data[1], data[2]); + break; } break; @@ -1904,6 +1992,10 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { pi[3] = (int)data[3]; } break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; } @@ -1959,6 +2051,10 @@ set_data1d(unsigned char *pointer, double data) { case NT_int32: *(PN_int32 *)pointer = (int)data; break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; @@ -2061,6 +2157,10 @@ set_data2d(unsigned char *pointer, const LVecBase2d &data) { pi[1] = (int)data[1]; } break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; @@ -2172,6 +2272,10 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { pi[2] = (int)data[2]; } break; + + case NT_packed_ufloat: + *(PN_uint32 *)pointer = GeomVertexData::pack_ufloat(data[0], data[1], data[2]); + break; } break; @@ -2294,6 +2398,10 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { pi[3] = (int)data[3]; } break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; } @@ -2353,6 +2461,10 @@ set_data1i(unsigned char *pointer, int data) { case NT_int32: *(PN_int32 *)pointer = data; break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; @@ -2453,6 +2565,10 @@ set_data2i(unsigned char *pointer, const LVecBase2i &data) { pi[1] = data[1]; } break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; @@ -2561,6 +2677,10 @@ set_data3i(unsigned char *pointer, const LVecBase3i &data) { pi[2] = data[2]; } break; + + case NT_packed_ufloat: + *(PN_uint32 *)pointer = GeomVertexData::pack_ufloat(data[0], data[1], data[2]); + break; } break; @@ -2680,6 +2800,10 @@ set_data4i(unsigned char *pointer, const LVecBase4i &data) { pi[3] = data[3]; } break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; } @@ -2839,6 +2963,10 @@ get_data4f(const unsigned char *pointer) { _v4.set(pi[0], pi[1], pi[2], pi[3]); } return _v4; + + case NT_packed_ufloat: + nassertr(false, _v4); + break; } } @@ -2999,6 +3127,10 @@ get_data4d(const unsigned char *pointer) { _v4d.set(pi[0], pi[1], pi[2], pi[3]); } return _v4d; + + case NT_packed_ufloat: + nassertr(false, _v4d); + break; } } @@ -3160,6 +3292,10 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { pi[3] = (int)data[3]; } break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; } @@ -3320,6 +3456,10 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { pi[3] = (int)data[3]; } break; + + case NT_packed_ufloat: + nassertv(false); + break; } break; } @@ -3443,6 +3583,15 @@ get_data3f(const unsigned char *pointer) { case NT_int32: nassertr(false, _v3); return _v3; + + case NT_packed_ufloat: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + _v3.set(GeomVertexData::unpack_ufloat_a(dword), + GeomVertexData::unpack_ufloat_b(dword), + GeomVertexData::unpack_ufloat_c(dword)); + } + return _v3; } } else { const LVecBase4f &v4 = get_data4f(pointer); @@ -3528,6 +3677,7 @@ get_data4f(const unsigned char *pointer) { case NT_int8: case NT_int16: case NT_int32: + case NT_packed_ufloat: nassertr(false, _v4); return _v4; } @@ -3652,6 +3802,15 @@ get_data3d(const unsigned char *pointer) { case NT_int32: nassertr(false, _v3d); return _v3d; + + case NT_packed_ufloat: + { + PN_uint32 dword = *(const PN_uint32 *)pointer; + _v3d.set(GeomVertexData::unpack_ufloat_a(dword), + GeomVertexData::unpack_ufloat_b(dword), + GeomVertexData::unpack_ufloat_c(dword)); + } + return _v3d; } } else { const LVecBase4d &v4 = get_data4d(pointer); @@ -3737,6 +3896,7 @@ get_data4d(const unsigned char *pointer) { case NT_int8: case NT_int16: case NT_int32: + case NT_packed_ufloat: nassertr(false, _v4d); return _v4d; } @@ -3850,6 +4010,10 @@ set_data3f(unsigned char *pointer, const LVecBase3f &data) { case NT_int32: nassertv(false); break; + + case NT_packed_ufloat: + *(PN_uint32 *)pointer = GeomVertexData::pack_ufloat(data[0], data[1], data[2]); + break; } } else { set_data4f(pointer, LVecBase4f(data[0], data[1], data[2], 1.0f)); @@ -3942,6 +4106,10 @@ set_data4f(unsigned char *pointer, const LVecBase4f &data) { case NT_int32: nassertv(false); break; + + case NT_packed_ufloat: + nassertv(false); + break; } } } @@ -4053,6 +4221,10 @@ set_data3d(unsigned char *pointer, const LVecBase3d &data) { case NT_int32: nassertv(false); break; + + case NT_packed_ufloat: + *(PN_uint32 *)pointer = GeomVertexData::pack_ufloat(data[0], data[1], data[2]); + break; } } else { set_data4d(pointer, LVecBase4d(data[0], data[1], data[2], 1.0f)); @@ -4145,6 +4317,10 @@ set_data4d(unsigned char *pointer, const LVecBase4d &data) { case NT_int32: nassertv(false); break; + + case NT_packed_ufloat: + nassertv(false); + break; } } } diff --git a/panda/src/gobj/geomVertexData.I b/panda/src/gobj/geomVertexData.I index 9478e08fa7..908cb53118 100644 --- a/panda/src/gobj/geomVertexData.I +++ b/panda/src/gobj/geomVertexData.I @@ -403,6 +403,150 @@ unpack_abcd_d(PN_uint32 data) { return data & 0xff; } +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexData::pack_ufloat +// Access: Public, Static +// Description: Packs three float values in an unsigned 32-bit int. +//////////////////////////////////////////////////////////////////// +INLINE PN_uint32 GeomVertexData:: +pack_ufloat(float a, float b, float c) { + // Since we have to clamp both low exponents and negative numbers to 0, + // it's easier to see a float as having a 9-bit signed exponent. + union { + PN_int32 _packed; + float _float; + } f0, f1, f2; + + f0._float = a; + f1._float = b; + f2._float = c; + + // There are several cases here: + // 1. exponent 0xff: NaN or infinity (negative infinity excluded) + // 2. exponent too large: clamped to maximum value + // 3. normalized float + // 4. exponent 0: denormal float + // 5. zero or anything negative, clamped to 0 + + PN_uint32 packed = 0; + + if ((f0._packed & 0x7f800000) == 0x7f800000 && (unsigned)f0._packed != 0xff800000u) { + packed |= (f0._packed >> 17) & 0x7ffu; + } else if (f0._packed >= 0x47800000) { + packed |= 0x7bf; + } else if (f0._packed >= 0x38800000) { + packed |= (f0._packed >> 17) - 0x1c00; + } else if (f0._packed >= 0x35000000) { + packed |= ((f0._packed & 0x7c0000u) | 0x800000u) >> (130 - (f0._packed >> 23)); + } + + if ((f1._packed & 0x7f800000) == 0x7f800000 && (unsigned)f1._packed != 0xff800000u) { + packed |= (f1._packed >> 6) & 0x3ff800u; + } else if (f1._packed >= 0x47800000) { + packed |= 0x3df800; + } else if (f1._packed >= 0x38800000) { + packed |= ((f1._packed >> 6) - 0xe00000) & 0x3ff800; + } else if (f1._packed >= 0x35000000) { + packed |= (((f1._packed & 0x7c0000u) | 0x800000u) >> (119 - (f1._packed >> 23))) & 0x1f800u; + } + + if ((f2._packed & 0x7f800000) == 0x7f800000 && (unsigned)f2._packed != 0xff800000u) { + packed |= (f2._packed & 0x0ffe0000u) << 4; + } else if (f2._packed >= 0x47800000) { + packed |= 0xf7c00000; + } else if (f2._packed >= 0x38800000) { + packed |= ((f2._packed - 0x38000000) << 4) & 0xffc00000; + } else if (f2._packed >= 0x35000000) { + packed |= ((((f2._packed << 3) & 0x03c00000u) | 0x04000000u) >> (112 - (f2._packed >> 23))) & 0x07c00000u; + } + + return packed; +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexData::unpack_ufloat_a +// Access: Public, Static +// Description: Unpacks an unsigned float11 value from an uint32. +//////////////////////////////////////////////////////////////////// +INLINE float GeomVertexData:: +unpack_ufloat_a(PN_uint32 data) { + if ((data & 0x7c0) == 0) { + // Denormal float (includes zero). + return ldexpf((data & 63) / 64.0f, -14); + } + + union { + PN_uint32 _packed; + float _float; + } value; + value._packed = ((data & 0x7ff) << 17); + + if ((data & 0x7c0) == 0x7c0) { + // Infinity / NaN + value._packed |= 0x7f800000; + } else { + value._packed += 0x38000000; + } + + return value._float; +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexData::unpack_ufloat_b +// Access: Public, Static +// Description: Unpacks an unsigned float11 value from an uint32. +//////////////////////////////////////////////////////////////////// +INLINE float GeomVertexData:: +unpack_ufloat_b(PN_uint32 data) { + if ((data & 0x3e0000) == 0) { + // Denormal float (includes zero). + return ldexpf(((data >> 11) & 63) / 64.0f, -14); + } + + union { + PN_uint32 _packed; + float _float; + } value; + value._packed = ((data & 0x3ff800) << 6); + + if ((data & 0x3e0000) == 0x3e0000) { + // Infinity / NaN + value._packed |= 0x7f800000; + } else { + value._packed += 0x38000000; + } + + return value._float; +} + +//////////////////////////////////////////////////////////////////// +// Function: GeomVertexData::unpack_ufloat_c +// Access: Public, Static +// Description: Unpacks an unsigned float10 value from an uint32. +//////////////////////////////////////////////////////////////////// +INLINE float GeomVertexData:: +unpack_ufloat_c(PN_uint32 data) { + if ((data & 0xf8000000u) == 0) { + // Denormal float (includes zero). + return ldexpf(((data >> 22) & 31) / 32.0f, -14); + } + + union { + PN_uint32 _packed; + float _float; + } value; + value._packed = ((data & 0xffc00000u) >> 4); + + if ((data & 0xf8000000u) == 0xf8000000u) { + // Infinity / NaN + value._packed |= 0x7f800000; + } else { + value._packed += 0x38000000; + } + + return value._float; +} + //////////////////////////////////////////////////////////////////// // Function: GeomVertexData::add_transform // Access: Private, Static diff --git a/panda/src/gobj/geomVertexData.cxx b/panda/src/gobj/geomVertexData.cxx index 5e5795f7fb..29273254e1 100644 --- a/panda/src/gobj/geomVertexData.cxx +++ b/panda/src/gobj/geomVertexData.cxx @@ -2579,7 +2579,7 @@ set_num_rows(int n) { while (pointer < stop) { PN_float64 *pi = (PN_float64 *)pointer; for (int i = 0; i < num_values; i++) { - pi[i] = 1.0f; + pi[i] = 1.0; } pointer += stride; } @@ -2591,6 +2591,14 @@ set_num_rows(int n) { case NT_int32: // Shouldn't have this type in the format. nassertr(false, false); + break; + + case NT_packed_ufloat: + while (pointer < stop) { + *(PN_int32 *)pointer = 0x781e03c0; + pointer += stride; + } + break; } } diff --git a/panda/src/gobj/geomVertexData.h b/panda/src/gobj/geomVertexData.h index b7a4fefe95..034018430a 100644 --- a/panda/src/gobj/geomVertexData.h +++ b/panda/src/gobj/geomVertexData.h @@ -176,6 +176,11 @@ public: static INLINE unsigned int unpack_abcd_c(PN_uint32 data); static INLINE unsigned int unpack_abcd_d(PN_uint32 data); + static INLINE PN_uint32 pack_ufloat(float a, float b, float c); + static INLINE float unpack_ufloat_a(PN_uint32 data); + static INLINE float unpack_ufloat_b(PN_uint32 data); + static INLINE float unpack_ufloat_c(PN_uint32 data); + private: static void bytewise_copy(unsigned char *to, int to_stride, const unsigned char *from, int from_stride, From 90ad6f00bf24a1ac2e77ab6c3d21deec00789a5a Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 2 May 2015 15:48:21 +0200 Subject: [PATCH 73/73] Change p3d_Color behavior to take ColorAttrib into account; assign white if missing --- .../glstuff/glGraphicsStateGuardian_src.cxx | 6 ++++++ .../src/glstuff/glGraphicsStateGuardian_src.h | 4 ++++ panda/src/glstuff/glShaderContext_src.cxx | 18 ++++++++++++++++-- panda/src/glstuff/glShaderContext_src.h | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index e831b13915..62c25d5795 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -1373,6 +1373,10 @@ reset() { get_extension_func("glUniformMatrix4fv"); _glValidateProgram = (PFNGLVALIDATEPROGRAMPROC) get_extension_func("glValidateProgram"); + _glVertexAttrib4fv = (PFNGLVERTEXATTRIB4FVPROC) + get_extension_func("glVertexAttrib4fv"); + _glVertexAttrib4dv = (PFNGLVERTEXATTRIB4DVPROC) + get_extension_func("glVertexAttrib4dv"); _glVertexAttribPointer = (PFNGLVERTEXATTRIBPOINTERPROC) get_extension_func("glVertexAttribPointer"); @@ -1438,6 +1442,8 @@ reset() { _glUniformMatrix3fv = glUniformMatrix3fv; _glUniformMatrix4fv = glUniformMatrix4fv; _glValidateProgram = glValidateProgram; + _glVertexAttrib4fv = glVertexAttrib4fv; + _glVertexAttrib4dv = NULL; _glVertexAttribPointer = glVertexAttribPointer; _glVertexAttribIPointer = NULL; _glVertexAttribLPointer = NULL; diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.h b/panda/src/glstuff/glGraphicsStateGuardian_src.h index 0898dfe309..f9eaa36ccb 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.h +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.h @@ -180,6 +180,8 @@ typedef void (APIENTRYP PFNGLUNIFORM4IVPROC) (GLint location, GLsizei count, con typedef void (APIENTRYP PFNGLUNIFORMMATRIX3FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRYP PFNGLUNIFORMMATRIX4FVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); typedef void (APIENTRYP PFNGLVALIDATEPROGRAMPROC) (GLuint program); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4FVPROC) (GLuint index, const GLfloat *v); +typedef void (APIENTRYP PFNGLVERTEXATTRIB4DVPROC) (GLuint index, const GLdouble *v); typedef void (APIENTRYP PFNGLVERTEXATTRIBPOINTERPROC) (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLVERTEXATTRIBIPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); typedef void (APIENTRYP PFNGLVERTEXATTRIBLPOINTERPROC) (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); @@ -833,6 +835,8 @@ public: PFNGLUNIFORMMATRIX3FVPROC _glUniformMatrix3fv; PFNGLUNIFORMMATRIX4FVPROC _glUniformMatrix4fv; PFNGLVALIDATEPROGRAMPROC _glValidateProgram; + PFNGLVERTEXATTRIB4FVPROC _glVertexAttrib4fv; + PFNGLVERTEXATTRIB4DVPROC _glVertexAttrib4dv; PFNGLVERTEXATTRIBPOINTERPROC _glVertexAttribPointer; PFNGLVERTEXATTRIBIPOINTERPROC _glVertexAttribIPointer; PFNGLVERTEXATTRIBLPOINTERPROC _glVertexAttribLPointer; diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 87fafebb48..a6818f85de 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -197,6 +197,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext _glsl_program = 0; _uses_standard_vertex_arrays = false; _has_divisor = false; + _color_attrib_index = -1; nassertv(s->get_language() == Shader::SL_GLSL); @@ -925,7 +926,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext param_type == GL_UNSIGNED_INT_VEC3 || param_type == GL_UNSIGNED_INT_VEC4 || #endif - param_type == GL_UNSIGNED_INT ); + param_type == GL_UNSIGNED_INT); if (noprefix.empty()) { // Arbitrarily named attribute. @@ -940,6 +941,9 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext } else if (noprefix == "Color") { bind._name = InternalName::get_color(); + // Save the index, so we can apply special handling to this attrib. + _color_attrib_index = p; + } else if (noprefix.substr(0, 7) == "Tangent") { bind._name = InternalName::get_tangent(); if (noprefix.size() > 7) { @@ -1419,9 +1423,11 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { } GLint p = _glsl_parameter_map[bind._id._seqno]; + // Don't apply vertex colors if they are disabled with a ColorAttrib. int num_elements, element_stride, divisor; bool normalized; - if (_glgsg->_data_reader->get_array_info(name, array_reader, + if ((p != _color_attrib_index || _glgsg->_vertex_colors_enabled) && + _glgsg->_data_reader->get_array_info(name, array_reader, num_values, numeric_type, normalized, start, stride, divisor, num_elements, element_stride)) { @@ -1463,6 +1469,14 @@ update_shader_vertex_arrays(ShaderContext *prev, bool force) { for (int i = 0; i < bind._elements; ++i) { _glgsg->_glDisableVertexAttribArray(p + i); } + if (p == _color_attrib_index) { + // Vertex colors are disabled or not present. Apply flat color. +#if defined(STDFLOAT_DOUBLE) && !defined(OPENGLES) + _glgsg->_glVertexAttrib4dv(p, _glgsg->_scene_graph_color.get_data()); +#else + _glgsg->_glVertexAttrib4fv(p, _glgsg->_scene_graph_color.get_data()); +#endif + } } } } diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index e2a9aadc9d..f9ca285572 100644 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -65,6 +65,7 @@ private: //typedef pvector ParamContexts; //ParamContexts _params; + GLint _color_attrib_index; pvector _glsl_parameter_map; pmap _glsl_uniform_handles;