diff --git a/direct/src/dcparser/dcNumericRange.I b/direct/src/dcparser/dcNumericRange.I index bd41418205..92973d4410 100644 --- a/direct/src/dcparser/dcNumericRange.I +++ b/direct/src/dcparser/dcNumericRange.I @@ -52,7 +52,7 @@ operator = (const DCNumericRange ©) { * otherwise. */ template -bool DCNumericRange:: +INLINE bool DCNumericRange:: is_in_range(Number num) const { if (_ranges.empty()) { return true; @@ -106,7 +106,7 @@ get_one_value() const { * */ template -void DCNumericRange:: +INLINE void DCNumericRange:: generate_hash(HashGenerator &hashgen) const { if (!_ranges.empty()) { hashgen.add_int(_ranges.size()); @@ -124,7 +124,7 @@ generate_hash(HashGenerator &hashgen) const { * */ template -void DCNumericRange:: +INLINE void DCNumericRange:: output(std::ostream &out, Number divisor) const { if (!_ranges.empty()) { typename Ranges::const_iterator ri; @@ -144,7 +144,7 @@ output(std::ostream &out, Number divisor) const { * characters. */ template -void DCNumericRange:: +INLINE void DCNumericRange:: output_char(std::ostream &out, Number divisor) const { if (divisor != 1) { output(out, divisor); @@ -179,7 +179,7 @@ clear() { * minmax overlaps an existing minmax. */ template -bool DCNumericRange:: +INLINE bool DCNumericRange:: add_range(Number min, Number max) { // Check for an overlap. This is probably indicative of a typo and should // be reported. diff --git a/direct/src/dcparser/dcNumericRange.h b/direct/src/dcparser/dcNumericRange.h index f751323b01..888c54939e 100644 --- a/direct/src/dcparser/dcNumericRange.h +++ b/direct/src/dcparser/dcNumericRange.h @@ -32,20 +32,20 @@ public: INLINE DCNumericRange(const DCNumericRange ©); INLINE void operator = (const DCNumericRange ©); - bool is_in_range(Number num) const; + INLINE bool is_in_range(Number num) const; INLINE void validate(Number num, bool &range_error) const; INLINE bool has_one_value() const; INLINE Number get_one_value() const; - void generate_hash(HashGenerator &hashgen) const; + INLINE void generate_hash(HashGenerator &hashgen) const; - void output(std::ostream &out, Number divisor = 1) const; - void output_char(std::ostream &out, Number divisor = 1) const; + INLINE void output(std::ostream &out, Number divisor = 1) const; + INLINE void output_char(std::ostream &out, Number divisor = 1) const; public: INLINE void clear(); - bool add_range(Number min, Number max); + INLINE bool add_range(Number min, Number max); INLINE bool is_empty() const; INLINE int get_num_ranges() const; diff --git a/direct/src/deadrec/config_deadrec.cxx b/direct/src/deadrec/config_deadrec.cxx index eb1c43a9c6..87e1cffe68 100644 --- a/direct/src/deadrec/config_deadrec.cxx +++ b/direct/src/deadrec/config_deadrec.cxx @@ -15,7 +15,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_DEADREC) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DIRECT_DEADREC) #error Buildsystem error: BUILDING_DIRECT_DEADREC not defined #endif diff --git a/direct/src/directd/directd.cxx b/direct/src/directd/directd.cxx index 817706acb5..93a4df905c 100644 --- a/direct/src/directd/directd.cxx +++ b/direct/src/directd/directd.cxx @@ -30,7 +30,7 @@ #include "pset.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_DIRECTD) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DIRECT_DIRECTD) #error Buildsystem error: BUILDING_DIRECT_DIRECTD not defined #endif diff --git a/direct/src/distributed/PyDatagram.py b/direct/src/distributed/PyDatagram.py index eebc06e440..f45c3c52c1 100755 --- a/direct/src/distributed/PyDatagram.py +++ b/direct/src/distributed/PyDatagram.py @@ -25,8 +25,8 @@ class PyDatagram(Datagram): STUint64: (Datagram.addUint64, int), STFloat64: (Datagram.addFloat64, None), STString: (Datagram.addString, None), - STBlob: (Datagram.addString, None), - STBlob32: (Datagram.addString32, None), + STBlob: (Datagram.addBlob, None), + STBlob32: (Datagram.addBlob32, None), } #def addChannel(self, channelId): diff --git a/direct/src/distributed/PyDatagramIterator.py b/direct/src/distributed/PyDatagramIterator.py index 60267a1ab9..6ce96e77e4 100755 --- a/direct/src/distributed/PyDatagramIterator.py +++ b/direct/src/distributed/PyDatagramIterator.py @@ -23,8 +23,8 @@ class PyDatagramIterator(DatagramIterator): STUint64: DatagramIterator.getUint64, STFloat64: DatagramIterator.getFloat64, STString: DatagramIterator.getString, - STBlob: DatagramIterator.getString, - STBlob32: DatagramIterator.getString32, + STBlob: DatagramIterator.getBlob, + STBlob32: DatagramIterator.getBlob32, } getChannel = DatagramIterator.getUint64 diff --git a/direct/src/distributed/config_distributed.cxx b/direct/src/distributed/config_distributed.cxx index 312964568f..0160f5f1bf 100644 --- a/direct/src/distributed/config_distributed.cxx +++ b/direct/src/distributed/config_distributed.cxx @@ -14,7 +14,7 @@ #include "config_distributed.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_DISTRIBUTED) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DIRECT_DISTRIBUTED) #error Buildsystem error: BUILDING_DIRECT_DISTRIBUTED not defined #endif diff --git a/direct/src/interval/config_interval.cxx b/direct/src/interval/config_interval.cxx index f56ce67e17..767ad32695 100644 --- a/direct/src/interval/config_interval.cxx +++ b/direct/src/interval/config_interval.cxx @@ -29,7 +29,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_INTERVAL) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DIRECT_INTERVAL) #error Buildsystem error: BUILDING_DIRECT_INTERVAL not defined #endif diff --git a/direct/src/leveleditor/ProtoPalette.py b/direct/src/leveleditor/ProtoPalette.py index 0f8aacee3b..12a3c4605c 100755 --- a/direct/src/leveleditor/ProtoPalette.py +++ b/direct/src/leveleditor/ProtoPalette.py @@ -3,6 +3,7 @@ Palette for Prototyping """ from .ProtoPaletteBase import * +import os class ProtoPalette(ProtoPaletteBase): def __init__(self): diff --git a/direct/src/motiontrail/config_motiontrail.cxx b/direct/src/motiontrail/config_motiontrail.cxx index 997a1a3059..c60a67f95c 100644 --- a/direct/src/motiontrail/config_motiontrail.cxx +++ b/direct/src/motiontrail/config_motiontrail.cxx @@ -14,7 +14,7 @@ #include "config_motiontrail.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_MOTIONTRAIL) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DIRECT_MOTIONTRAIL) #error Buildsystem error: BUILDING_DIRECT_MOTIONTRAIL not defined #endif diff --git a/direct/src/showbase/showBase.cxx b/direct/src/showbase/showBase.cxx index f14d9610a4..7d8973996f 100644 --- a/direct/src/showbase/showBase.cxx +++ b/direct/src/showbase/showBase.cxx @@ -37,7 +37,7 @@ FILTERKEYS g_StartupFilterKeys = {sizeof(FILTERKEYS), 0}; using std::max; using std::min; -#if !defined(CPPPARSER) && !defined(BUILDING_DIRECT_SHOWBASE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DIRECT_SHOWBASE) #error Buildsystem error: BUILDING_DIRECT_SHOWBASE not defined #endif diff --git a/dtool/src/cppparser/cppFunctionType.cxx b/dtool/src/cppparser/cppFunctionType.cxx index 27699d711b..731b6b0cf5 100644 --- a/dtool/src/cppparser/cppFunctionType.cxx +++ b/dtool/src/cppparser/cppFunctionType.cxx @@ -292,6 +292,10 @@ output_instance(ostream &out, int indent_level, CPPScope *scope, out << str; + } else if (_flags & F_operator_typecast) { + out << "operator "; + _return_type->output_instance(out, indent_level, scope, complete, "", prename + str); + } else { if (prename.empty()) { _return_type->output_instance(out, indent_level, scope, complete, diff --git a/dtool/src/dconfig/config_dconfig.cxx b/dtool/src/dconfig/config_dconfig.cxx index d0800084ca..f828fc8f7d 100644 --- a/dtool/src/dconfig/config_dconfig.cxx +++ b/dtool/src/dconfig/config_dconfig.cxx @@ -13,7 +13,7 @@ #include "config_dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DTOOL_DCONFIG) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DTOOL_DCONFIG) #error Buildsystem error: BUILDING_DTOOL_DCONFIG not defined #endif diff --git a/dtool/src/dtoolbase/atomicAdjust.h b/dtool/src/dtoolbase/atomicAdjust.h index 1180529ded..804224e5c3 100644 --- a/dtool/src/dtoolbase/atomicAdjust.h +++ b/dtool/src/dtoolbase/atomicAdjust.h @@ -30,6 +30,20 @@ struct AtomicAdjust { #include "atomicAdjustDummyImpl.h" typedef AtomicAdjustDummyImpl AtomicAdjust; +#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (defined(__clang__) && (__clang_major__ >= 3)) +// GCC 4.7 and above has built-in __atomic functions for atomic operations. +// Clang 3.0 and above also supports them. + +#include "atomicAdjustGccImpl.h" +typedef AtomicAdjustGccImpl AtomicAdjust; + +#if (__GCC_ATOMIC_INT_LOCK_FREE + __GCC_ATOMIC_LONG_LOCK_FREE) > 0 +#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE 1 +#endif +#if __GCC_ATOMIC_POINTER_LOCK_FREE > 0 +#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR 1 +#endif + #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- @@ -45,20 +59,6 @@ typedef AtomicAdjustI386Impl AtomicAdjust; #define HAVE_ATOMIC_COMPARE_AND_EXCHANGE 1 #define HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR 1 -#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7))) || (defined(__clang__) && (__clang_major__ >= 3)) -// GCC 4.7 and above has built-in __atomic functions for atomic operations. -// Clang 3.0 and above also supports them. - -#include "atomicAdjustGccImpl.h" -typedef AtomicAdjustGccImpl AtomicAdjust; - -#if (__GCC_ATOMIC_INT_LOCK_FREE + __GCC_ATOMIC_INT_LOCK_FREE) > 0 -#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE 1 -#endif -#if __GCC_ATOMIC_POINTER_LOCK_FREE > 0 -#define HAVE_ATOMIC_COMPARE_AND_EXCHANGE_PTR 1 -#endif - #elif defined(THREAD_WIN32_IMPL) #include "atomicAdjustWin32Impl.h" diff --git a/dtool/src/dtoolbase/dtool_platform.h b/dtool/src/dtoolbase/dtool_platform.h index 2a6ed12a9b..16ea54d88a 100644 --- a/dtool/src/dtoolbase/dtool_platform.h +++ b/dtool/src/dtoolbase/dtool_platform.h @@ -63,6 +63,9 @@ #define DTOOL_PLATFORM "android_i386" #endif +#elif defined(__aarch64__) +#define DTOOL_PLATFORM "linux_aarch64" + #elif defined(__x86_64) #define DTOOL_PLATFORM "linux_amd64" diff --git a/dtool/src/dtoolbase/dtoolbase.cxx b/dtool/src/dtoolbase/dtoolbase.cxx index 10d1790ccf..a45a1de4e0 100644 --- a/dtool/src/dtoolbase/dtoolbase.cxx +++ b/dtool/src/dtoolbase/dtoolbase.cxx @@ -14,7 +14,7 @@ #include "dtoolbase.h" #include "memoryHook.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DTOOL_DTOOLBASE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DTOOL_DTOOLBASE) #error Buildsystem error: BUILDING_DTOOL_DTOOLBASE not defined #endif diff --git a/dtool/src/dtoolbase/stl_compares.I b/dtool/src/dtoolbase/stl_compares.I index 501435f547..4190cca45f 100644 --- a/dtool/src/dtoolbase/stl_compares.I +++ b/dtool/src/dtoolbase/stl_compares.I @@ -169,7 +169,7 @@ add_hash(size_t hash, const Key &key) { #ifdef _DEBUG // We assume that the sequence is laid out sequentially in memory. if (key.size() > 0) { - assert(&key[key.size() - 1] - &key[0] == key.size() - 1); + assert(&key[key.size() - 1] - &key[0] == (ptrdiff_t)key.size() - 1); } #endif size_t num_bytes = (key.size() * sizeof(key[0])); diff --git a/dtool/src/dtoolutil/config_dtoolutil.cxx b/dtool/src/dtoolutil/config_dtoolutil.cxx index 98b3c42760..b7b6505d28 100644 --- a/dtool/src/dtoolutil/config_dtoolutil.cxx +++ b/dtool/src/dtoolutil/config_dtoolutil.cxx @@ -16,7 +16,7 @@ #include "filename.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DTOOL_DTOOLUTIL) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DTOOL_DTOOLUTIL) #error Buildsystem error: BUILDING_DTOOL_DCTOOLUTIL not defined #endif diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 3134fcb2eb..5752fe126b 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -789,8 +789,6 @@ InterfaceMakerPythonNative:: */ void InterfaceMakerPythonNative:: write_prototypes(ostream &out_code, ostream *out_h) { - Functions::iterator fi; - if (out_h != nullptr) { *out_h << "#include \"py_panda.h\"\n\n"; } @@ -917,7 +915,6 @@ write_prototypes_class_external(ostream &out, Object *obj) { void InterfaceMakerPythonNative:: write_prototypes_class(ostream &out_code, ostream *out_h, Object *obj) { std::string ClassName = make_safe_name(obj->_itype.get_scoped_name()); - Functions::iterator fi; out_code << "/**\n"; out_code << " * Forward declarations for top-level class " << ClassName << "\n"; @@ -1089,6 +1086,27 @@ write_class_details(ostream &out, Object *obj) { } } + // Are there any implicit cast operators that can cast this object to our + // desired pointer? + for (Function *func : obj->_methods) { + for (FunctionRemap *remap : func->_remaps) { + if (remap->_type == FunctionRemap::T_typecast_method && + is_remap_legal(remap) && + !remap->_return_type->return_value_needs_management() && + (remap->_cppfunc->_storage_class & CPPInstance::SC_explicit) == 0 && + TypeManager::is_pointer(remap->_return_type->get_new_type())) { + + CPPType *cast_type = remap->_return_type->get_orig_type(); + CPPType *obj_type = TypeManager::unwrap(TypeManager::resolve_type(remap->_return_type->get_new_type())); + string return_expr = "(" + cast_type->get_local_name(&parser) + ")*local_this"; + out << " // " << *remap->_cppfunc << "\n"; + out << " if (requested_type == Dtool_Ptr_" << make_safe_name(obj_type->get_local_name(&parser)) << ") {\n"; + out << " return (void *)(" << remap->_return_type->get_return_expr(return_expr) << ");\n"; + out << " }\n"; + } + } + } + out << " return nullptr;\n"; out << "}\n\n"; @@ -3301,7 +3319,7 @@ write_prototype_for(ostream &out, InterfaceMaker::Function *func) { */ void InterfaceMakerPythonNative:: write_prototype_for_name(ostream &out, InterfaceMaker::Function *func, const std::string &function_namename) { - Function::Remaps::const_iterator ri; +// Function::Remaps::const_iterator ri; // for (ri = func->_remaps.begin(); ri != func->_remaps.end(); ++ri) { // FunctionRemap *remap = (*ri); diff --git a/dtool/src/prc/config_prc.cxx b/dtool/src/prc/config_prc.cxx index 2728e642bd..65b7c77265 100644 --- a/dtool/src/prc/config_prc.cxx +++ b/dtool/src/prc/config_prc.cxx @@ -16,7 +16,7 @@ #include "configVariableEnum.h" #include "pandaFileStreamBuf.h" -#if !defined(CPPPARSER) && !defined(BUILDING_DTOOL_PRC) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_DTOOL_PRC) #error Buildsystem error: BUILDING_DTOOL_PRC not defined #endif diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 6181ccf87e..00dd2c3cd3 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -5219,7 +5219,7 @@ if (PkgSkip("DIRECT")==0): # if (PkgSkip("DIRECT")==0): - OPTS=['DIR:direct/src/dcparser', 'WITHINPANDA', 'BISONPREFIX_dcyy', 'PYTHON'] + OPTS=['DIR:direct/src/dcparser', 'BUILDING:DIRECT_DCPARSER', 'WITHINPANDA', 'BISONPREFIX_dcyy', 'PYTHON'] CreateFile(GetOutputDir()+"/include/dcParser.h") TargetAdd('p3dcparser_dcParser.obj', opts=OPTS, input='dcParser.yxx') TargetAdd('dcParser.h', input='p3dcparser_dcParser.obj', opts=['DEPENDENCYONLY']) diff --git a/makepanda/test_wheel.py b/makepanda/test_wheel.py new file mode 100755 index 0000000000..00555a5e60 --- /dev/null +++ b/makepanda/test_wheel.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python +""" +Tests a .whl file by installing it and pytest into a virtual environment and +running the test suite. + +Requires pip to be installed, as well as 'virtualenv' on Python 2. +""" + +import os +import sys +import shutil +import subprocess +import tempfile +from optparse import OptionParser + + +def test_wheel(wheel, verbose=False): + envdir = tempfile.mkdtemp(prefix="venv-") + print("Setting up virtual environment in {0}".format(envdir)) + + if sys.version_info >= (3, 0): + subprocess.call([sys.executable, "-m", "venv", "--clear", envdir]) + else: + subprocess.call([sys.executable, "-m", "virtualenv", "--clear", envdir]) + + # Install pytest into the environment, as well as our wheel. + if sys.platform == "win32": + pip = os.path.join(envdir, "Scripts", "pip.exe") + else: + pip = os.path.join(envdir, "bin", "pip") + if subprocess.call([pip, "install", "pytest", wheel]) != 0: + shutil.rmtree(envdir) + sys.exit(1) + + # Run the test suite. + if sys.platform == "win32": + python = os.path.join(envdir, "Scripts", "python.exe") + else: + python = os.path.join(envdir, "bin", "python") + test_cmd = [python, "-m", "pytest", "tests"] + if verbose: + test_cmd.append("--verbose") + + exit_code = subprocess.call(test_cmd) + shutil.rmtree(envdir) + + if exit_code != 0: + sys.exit(exit_code) + + +if __name__ == "__main__": + parser = OptionParser(usage="%prog [options] file...") + parser.add_option('', '--verbose', dest = 'verbose', help = 'Enable verbose output', action = 'store_true', default = False) + (options, args) = parser.parse_args() + + if not args: + parser.print_usage() + sys.exit(1) + + for arg in args: + test_wheel(arg, verbose=options.verbose) diff --git a/panda/metalibs/panda/panda.cxx b/panda/metalibs/panda/panda.cxx index 9c9cb8bb60..99da6b4f5b 100644 --- a/panda/metalibs/panda/panda.cxx +++ b/panda/metalibs/panda/panda.cxx @@ -14,7 +14,7 @@ #include "config_pstatclient.h" #endif -#if !defined(CPPPARSER) && !defined(BUILDING_LIBPANDA) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_LIBPANDA) #error Buildsystem error: BUILDING_LIBPANDA not defined #endif diff --git a/panda/src/audio/audioManager.h b/panda/src/audio/audioManager.h index 2ee14f10cb..62d9a5d090 100644 --- a/panda/src/audio/audioManager.h +++ b/panda/src/audio/audioManager.h @@ -86,7 +86,7 @@ PUBLISHED: virtual bool is_valid() = 0; // Get a sound: - virtual PT(AudioSound) get_sound(const std::string& file_name, bool positional = false, int mode=SM_heuristic) = 0; + virtual PT(AudioSound) get_sound(const Filename &file_name, bool positional = false, int mode=SM_heuristic) = 0; virtual PT(AudioSound) get_sound(MovieAudio *source, bool positional = false, int mode=SM_heuristic) = 0; PT(AudioSound) get_null_sound(); @@ -95,7 +95,7 @@ PUBLISHED: // doesn't break any connection between AudioSounds that have already given // by get_sound() from this manager. It's only affecting whether the // AudioManager keeps a copy of the sound in its poolcache. - virtual void uncache_sound(const std::string& file_name) = 0; + virtual void uncache_sound(const Filename &file_name) = 0; virtual void clear_cache() = 0; virtual void set_cache_limit(unsigned int count) = 0; virtual unsigned int get_cache_limit() const = 0; diff --git a/panda/src/audio/config_audio.cxx b/panda/src/audio/config_audio.cxx index 1ea8053eb6..ce9b1413d3 100644 --- a/panda/src/audio/config_audio.cxx +++ b/panda/src/audio/config_audio.cxx @@ -21,7 +21,7 @@ #include "nullAudioSound.h" #include "string_utils.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_AUDIO) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_AUDIO) #error Buildsystem error: BUILDING_PANDA_AUDIO not defined #endif diff --git a/panda/src/audio/nullAudioManager.cxx b/panda/src/audio/nullAudioManager.cxx index dabeb8c825..c9f490e54f 100644 --- a/panda/src/audio/nullAudioManager.cxx +++ b/panda/src/audio/nullAudioManager.cxx @@ -49,7 +49,7 @@ is_valid() { * */ PT(AudioSound) NullAudioManager:: -get_sound(const std::string&, bool positional, int mode) { +get_sound(const Filename &, bool positional, int mode) { return get_null_sound(); } @@ -65,7 +65,7 @@ get_sound(MovieAudio *sound, bool positional, int mode) { * */ void NullAudioManager:: -uncache_sound(const std::string&) { +uncache_sound(const Filename &) { // intentionally blank. } diff --git a/panda/src/audio/nullAudioManager.h b/panda/src/audio/nullAudioManager.h index 9a8ff921e4..a4e2c47511 100644 --- a/panda/src/audio/nullAudioManager.h +++ b/panda/src/audio/nullAudioManager.h @@ -29,9 +29,9 @@ public: virtual bool is_valid(); - virtual PT(AudioSound) get_sound(const std::string&, bool positional = false, int mode=SM_heuristic); + virtual PT(AudioSound) get_sound(const Filename &, bool positional = false, int mode=SM_heuristic); virtual PT(AudioSound) get_sound(MovieAudio *sound, bool positional = false, int mode=SM_heuristic); - virtual void uncache_sound(const std::string&); + virtual void uncache_sound(const Filename &); virtual void clear_cache(); virtual void set_cache_limit(unsigned int); virtual unsigned int get_cache_limit() const; diff --git a/panda/src/audiotraits/config_fmodAudio.cxx b/panda/src/audiotraits/config_fmodAudio.cxx index f0a188fbc5..c49b54f730 100644 --- a/panda/src/audiotraits/config_fmodAudio.cxx +++ b/panda/src/audiotraits/config_fmodAudio.cxx @@ -19,7 +19,7 @@ #include "pandaSystem.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_FMOD_AUDIO) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_FMOD_AUDIO) #error Buildsystem error: BUILDING_FMOD_AUDIO not defined #endif diff --git a/panda/src/audiotraits/config_milesAudio.cxx b/panda/src/audiotraits/config_milesAudio.cxx index 6877b3700e..87cd36321c 100644 --- a/panda/src/audiotraits/config_milesAudio.cxx +++ b/panda/src/audiotraits/config_milesAudio.cxx @@ -22,7 +22,7 @@ #include "pandaSystem.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_MILES_AUDIO) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_MILES_AUDIO) #error Buildsystem error: BUILDING_MILES_AUDIO not defined #endif diff --git a/panda/src/audiotraits/config_openalAudio.cxx b/panda/src/audiotraits/config_openalAudio.cxx index ad51368d75..72b6923928 100644 --- a/panda/src/audiotraits/config_openalAudio.cxx +++ b/panda/src/audiotraits/config_openalAudio.cxx @@ -18,7 +18,7 @@ #include "pandaSystem.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_OPENAL_AUDIO) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_OPENAL_AUDIO) #error Buildsystem error: BUILDING_OPENAL_AUDIO not defined #endif diff --git a/panda/src/audiotraits/fmodAudioManager.cxx b/panda/src/audiotraits/fmodAudioManager.cxx index 42fd08c536..cdccbfbd0e 100644 --- a/panda/src/audiotraits/fmodAudioManager.cxx +++ b/panda/src/audiotraits/fmodAudioManager.cxx @@ -409,7 +409,7 @@ configure_filters(FilterProperties *config) { * This is what creates a sound instance. */ PT(AudioSound) FmodAudioManager:: -get_sound(const std::string &file_name, bool positional, int) { +get_sound(const Filename &file_name, bool positional, int) { ReMutexHolder holder(_lock); // Needed so People use Panda's Generic UNIX Style Paths for Filename. // path.to_os_specific() converts it back to the proper OS version later on. @@ -772,7 +772,7 @@ reduce_sounds_playing_to(unsigned int count) { * NOT USED FOR FMOD-EX!!! Clears a sound out of the sound cache. */ void FmodAudioManager:: -uncache_sound(const std::string& file_name) { +uncache_sound(const Filename &file_name) { audio_debug("FmodAudioManager::uncache_sound(\""<= 285 static const btVector3 up_vectors[3] = {btVector3(1.0f, 0.0f, 0.0f), btVector3(0.0f, 1.0f, 0.0f), btVector3(0.0f, 0.0f, 1.0f)}; #endif diff --git a/panda/src/bullet/bulletConeShape.cxx b/panda/src/bullet/bulletConeShape.cxx index c4c554ba2f..f9c952402d 100644 --- a/panda/src/bullet/bulletConeShape.cxx +++ b/panda/src/bullet/bulletConeShape.cxx @@ -13,6 +13,10 @@ #include "bulletConeShape.h" +#include "config_bullet.h" + +#include "bulletWorld.h" + TypeHandle BulletConeShape::_type_handle; /** diff --git a/panda/src/bullet/bulletConeTwistConstraint.cxx b/panda/src/bullet/bulletConeTwistConstraint.cxx index 9b60ab31ce..b5ccc17d05 100644 --- a/panda/src/bullet/bulletConeTwistConstraint.cxx +++ b/panda/src/bullet/bulletConeTwistConstraint.cxx @@ -12,7 +12,9 @@ */ #include "bulletConeTwistConstraint.h" + #include "bulletRigidBodyNode.h" +#include "bulletWorld.h" #include "deg_2_rad.h" diff --git a/panda/src/bullet/bulletConstraint.cxx b/panda/src/bullet/bulletConstraint.cxx index 28efe703ff..44eddc37e5 100644 --- a/panda/src/bullet/bulletConstraint.cxx +++ b/panda/src/bullet/bulletConstraint.cxx @@ -12,7 +12,9 @@ */ #include "bulletConstraint.h" + #include "bulletRigidBodyNode.h" +#include "bulletShape.h" TypeHandle BulletConstraint::_type_handle; diff --git a/panda/src/bullet/bulletConvexHullShape.cxx b/panda/src/bullet/bulletConvexHullShape.cxx index 487219c7fd..b61722e773 100644 --- a/panda/src/bullet/bulletConvexHullShape.cxx +++ b/panda/src/bullet/bulletConvexHullShape.cxx @@ -13,6 +13,8 @@ #include "bulletConvexHullShape.h" +#include "bulletWorld.h" + #include "nodePathCollection.h" #include "geomNode.h" #include "geomVertexReader.h" diff --git a/panda/src/bullet/bulletConvexHullShape.h b/panda/src/bullet/bulletConvexHullShape.h index 78485ed12c..27e006f1d0 100644 --- a/panda/src/bullet/bulletConvexHullShape.h +++ b/panda/src/bullet/bulletConvexHullShape.h @@ -22,6 +22,7 @@ #include "luse.h" #include "geom.h" #include "pta_LVecBase3.h" +#include "transformState.h" /** * diff --git a/panda/src/bullet/bulletConvexPointCloudShape.cxx b/panda/src/bullet/bulletConvexPointCloudShape.cxx index 1a4cb6e16c..8b7ca82f79 100644 --- a/panda/src/bullet/bulletConvexPointCloudShape.cxx +++ b/panda/src/bullet/bulletConvexPointCloudShape.cxx @@ -13,6 +13,10 @@ #include "bulletConvexPointCloudShape.h" +#include "bulletWorld.h" + +#include "bullet_utils.h" + #include "geomVertexReader.h" TypeHandle BulletConvexPointCloudShape::_type_handle; diff --git a/panda/src/bullet/bulletCylinderShape.cxx b/panda/src/bullet/bulletCylinderShape.cxx index 976daac96e..8b2d7986a3 100644 --- a/panda/src/bullet/bulletCylinderShape.cxx +++ b/panda/src/bullet/bulletCylinderShape.cxx @@ -13,6 +13,8 @@ #include "bulletCylinderShape.h" +#include "config_bullet.h" + using std::endl; TypeHandle BulletCylinderShape::_type_handle; diff --git a/panda/src/bullet/bulletDebugNode.cxx b/panda/src/bullet/bulletDebugNode.cxx index ce0c044758..2f221eb447 100644 --- a/panda/src/bullet/bulletDebugNode.cxx +++ b/panda/src/bullet/bulletDebugNode.cxx @@ -13,6 +13,10 @@ #include "bulletDebugNode.h" +#include "config_bullet.h" + +#include "bulletWorld.h" + #include "cullHandler.h" #include "cullTraverser.h" #include "cullableObject.h" diff --git a/panda/src/bullet/bulletDebugNode.h b/panda/src/bullet/bulletDebugNode.h index c780429a79..f42bd4722d 100644 --- a/panda/src/bullet/bulletDebugNode.h +++ b/panda/src/bullet/bulletDebugNode.h @@ -16,8 +16,13 @@ #include "pandabase.h" +#include "pandaNode.h" + #include "bullet_includes.h" +class CullTraverser; +class CullTraverserData; + /** * */ diff --git a/panda/src/bullet/bulletGenericConstraint.cxx b/panda/src/bullet/bulletGenericConstraint.cxx index de98b5d40b..dfd1fe5b68 100644 --- a/panda/src/bullet/bulletGenericConstraint.cxx +++ b/panda/src/bullet/bulletGenericConstraint.cxx @@ -12,7 +12,9 @@ */ #include "bulletGenericConstraint.h" + #include "bulletRigidBodyNode.h" +#include "bulletWorld.h" TypeHandle BulletGenericConstraint::_type_handle; diff --git a/panda/src/bullet/bulletGhostNode.cxx b/panda/src/bullet/bulletGhostNode.cxx index b4008820a1..d3dcb7aaf5 100644 --- a/panda/src/bullet/bulletGhostNode.cxx +++ b/panda/src/bullet/bulletGhostNode.cxx @@ -12,7 +12,9 @@ */ #include "bulletGhostNode.h" + #include "bulletShape.h" +#include "bulletWorld.h" TypeHandle BulletGhostNode::_type_handle; diff --git a/panda/src/bullet/bulletHeightfieldShape.cxx b/panda/src/bullet/bulletHeightfieldShape.cxx index 15e8d6f75f..08f91bd036 100644 --- a/panda/src/bullet/bulletHeightfieldShape.cxx +++ b/panda/src/bullet/bulletHeightfieldShape.cxx @@ -13,6 +13,10 @@ #include "bulletHeightfieldShape.h" +#include "config_bullet.h" + +#include "bulletWorld.h" + TypeHandle BulletHeightfieldShape::_type_handle; /** diff --git a/panda/src/bullet/bulletHelper.cxx b/panda/src/bullet/bulletHelper.cxx index e786e34d40..fcf0678f1a 100644 --- a/panda/src/bullet/bulletHelper.cxx +++ b/panda/src/bullet/bulletHelper.cxx @@ -12,13 +12,17 @@ */ #include "bulletHelper.h" + #include "bulletRigidBodyNode.h" +#include "bulletSoftBodyNode.h" #include "bulletGhostNode.h" #include "geomLines.h" #include "geomTriangles.h" #include "geomVertexRewriter.h" +#include "bullet_utils.h" + PT(InternalName) BulletHelper::_sb_index; PT(InternalName) BulletHelper::_sb_flip; diff --git a/panda/src/bullet/bulletHelper.h b/panda/src/bullet/bulletHelper.h index f2195d4d92..4633c40928 100644 --- a/panda/src/bullet/bulletHelper.h +++ b/panda/src/bullet/bulletHelper.h @@ -23,6 +23,8 @@ #include "nodePath.h" #include "nodePathCollection.h" +class BulletSoftBodyNode; + /** * */ diff --git a/panda/src/bullet/bulletHingeConstraint.cxx b/panda/src/bullet/bulletHingeConstraint.cxx index 5cbfa44d94..9e96c82cf4 100644 --- a/panda/src/bullet/bulletHingeConstraint.cxx +++ b/panda/src/bullet/bulletHingeConstraint.cxx @@ -12,7 +12,9 @@ */ #include "bulletHingeConstraint.h" + #include "bulletRigidBodyNode.h" +#include "bulletWorld.h" #include "deg_2_rad.h" diff --git a/panda/src/bullet/bulletManifoldPoint.cxx b/panda/src/bullet/bulletManifoldPoint.cxx index b56244ed29..c32a437ac2 100644 --- a/panda/src/bullet/bulletManifoldPoint.cxx +++ b/panda/src/bullet/bulletManifoldPoint.cxx @@ -13,6 +13,8 @@ #include "bulletManifoldPoint.h" +#include "bulletWorld.h" + /** * */ diff --git a/panda/src/bullet/bulletMinkowskiSumShape.cxx b/panda/src/bullet/bulletMinkowskiSumShape.cxx index d750e22244..586968ae6d 100644 --- a/panda/src/bullet/bulletMinkowskiSumShape.cxx +++ b/panda/src/bullet/bulletMinkowskiSumShape.cxx @@ -13,6 +13,8 @@ #include "bulletMinkowskiSumShape.h" +#include "bulletWorld.h" + TypeHandle BulletMinkowskiSumShape::_type_handle; /** diff --git a/panda/src/bullet/bulletMultiSphereShape.cxx b/panda/src/bullet/bulletMultiSphereShape.cxx index 52d1edc42f..2cbf63fcfd 100644 --- a/panda/src/bullet/bulletMultiSphereShape.cxx +++ b/panda/src/bullet/bulletMultiSphereShape.cxx @@ -13,6 +13,8 @@ #include "bulletMultiSphereShape.h" +#include "bulletWorld.h" + #include "geomVertexReader.h" TypeHandle BulletMultiSphereShape::_type_handle; diff --git a/panda/src/bullet/bulletMultiSphereShape.h b/panda/src/bullet/bulletMultiSphereShape.h index d6fd7af7b7..2beb123bf5 100644 --- a/panda/src/bullet/bulletMultiSphereShape.h +++ b/panda/src/bullet/bulletMultiSphereShape.h @@ -19,6 +19,7 @@ #include "bullet_includes.h" #include "bulletShape.h" +#include "factoryParams.h" #include "pta_LVecBase3.h" #include "pta_stdfloat.h" diff --git a/panda/src/bullet/bulletPersistentManifold.cxx b/panda/src/bullet/bulletPersistentManifold.cxx index 67d760e8df..9876ff35ee 100644 --- a/panda/src/bullet/bulletPersistentManifold.cxx +++ b/panda/src/bullet/bulletPersistentManifold.cxx @@ -12,7 +12,9 @@ */ #include "bulletPersistentManifold.h" + #include "bulletManifoldPoint.h" +#include "bulletWorld.h" /** * diff --git a/panda/src/bullet/bulletPlaneShape.cxx b/panda/src/bullet/bulletPlaneShape.cxx index 98dce53577..f5dc9f9514 100644 --- a/panda/src/bullet/bulletPlaneShape.cxx +++ b/panda/src/bullet/bulletPlaneShape.cxx @@ -13,6 +13,8 @@ #include "bulletPlaneShape.h" +#include "bulletWorld.h" + TypeHandle BulletPlaneShape::_type_handle; /** diff --git a/panda/src/bullet/bulletRigidBodyNode.cxx b/panda/src/bullet/bulletRigidBodyNode.cxx index b0d36f705e..6f5bff0d46 100644 --- a/panda/src/bullet/bulletRigidBodyNode.cxx +++ b/panda/src/bullet/bulletRigidBodyNode.cxx @@ -12,7 +12,11 @@ */ #include "bulletRigidBodyNode.h" + +#include "config_bullet.h" + #include "bulletShape.h" +#include "bulletWorld.h" TypeHandle BulletRigidBodyNode::_type_handle; diff --git a/panda/src/bullet/bulletRotationalLimitMotor.cxx b/panda/src/bullet/bulletRotationalLimitMotor.cxx index d521b7ad94..3fed47f4f7 100644 --- a/panda/src/bullet/bulletRotationalLimitMotor.cxx +++ b/panda/src/bullet/bulletRotationalLimitMotor.cxx @@ -13,6 +13,8 @@ #include "bulletRotationalLimitMotor.h" +#include "bulletWorld.h" + /** * */ diff --git a/panda/src/bullet/bulletShape.cxx b/panda/src/bullet/bulletShape.cxx index 49bd6e4f92..dcc41f1243 100644 --- a/panda/src/bullet/bulletShape.cxx +++ b/panda/src/bullet/bulletShape.cxx @@ -12,6 +12,9 @@ */ #include "bulletShape.h" + +#include "bulletWorld.h" + #include "bullet_utils.h" TypeHandle BulletShape::_type_handle; diff --git a/panda/src/bullet/bulletShape.h b/panda/src/bullet/bulletShape.h index e9dd08bf14..7b368c987c 100644 --- a/panda/src/bullet/bulletShape.h +++ b/panda/src/bullet/bulletShape.h @@ -18,7 +18,7 @@ #include "bullet_includes.h" -#include "typedReferenceCount.h" +#include "typedWritableReferenceCount.h" #include "boundingSphere.h" /** diff --git a/panda/src/bullet/bulletSliderConstraint.cxx b/panda/src/bullet/bulletSliderConstraint.cxx index c803f509cd..6712120cd8 100644 --- a/panda/src/bullet/bulletSliderConstraint.cxx +++ b/panda/src/bullet/bulletSliderConstraint.cxx @@ -12,7 +12,9 @@ */ #include "bulletSliderConstraint.h" + #include "bulletRigidBodyNode.h" +#include "bulletWorld.h" #include "deg_2_rad.h" diff --git a/panda/src/bullet/bulletSoftBodyConfig.cxx b/panda/src/bullet/bulletSoftBodyConfig.cxx index a6db77cb96..861387a397 100644 --- a/panda/src/bullet/bulletSoftBodyConfig.cxx +++ b/panda/src/bullet/bulletSoftBodyConfig.cxx @@ -13,6 +13,10 @@ #include "bulletSoftBodyConfig.h" +#include "bulletWorld.h" + +#include "lightMutexHolder.h" + /** * */ diff --git a/panda/src/bullet/bulletSoftBodyConfig.h b/panda/src/bullet/bulletSoftBodyConfig.h index 18bbd49dfa..3d2bf30e42 100644 --- a/panda/src/bullet/bulletSoftBodyConfig.h +++ b/panda/src/bullet/bulletSoftBodyConfig.h @@ -18,6 +18,8 @@ #include "bullet_includes.h" +#include "numeric_types.h" + /** * */ diff --git a/panda/src/bullet/bulletSoftBodyMaterial.I b/panda/src/bullet/bulletSoftBodyMaterial.I index 7514fc7cbf..13326a54d9 100644 --- a/panda/src/bullet/bulletSoftBodyMaterial.I +++ b/panda/src/bullet/bulletSoftBodyMaterial.I @@ -30,3 +30,12 @@ empty() { return BulletSoftBodyMaterial(material); } + +/** + * + */ +INLINE btSoftBody::Material &BulletSoftBodyMaterial:: +get_material() const { + + return _material; +} diff --git a/panda/src/bullet/bulletSoftBodyMaterial.cxx b/panda/src/bullet/bulletSoftBodyMaterial.cxx index d40a7bd984..052cd5a8aa 100644 --- a/panda/src/bullet/bulletSoftBodyMaterial.cxx +++ b/panda/src/bullet/bulletSoftBodyMaterial.cxx @@ -13,6 +13,8 @@ #include "bulletSoftBodyMaterial.h" +#include "bulletWorld.h" + /** * */ @@ -21,15 +23,6 @@ BulletSoftBodyMaterial(btSoftBody::Material &material) : _material(material) { } -/** - * - */ -btSoftBody::Material &BulletSoftBodyMaterial:: -get_material() const { - - return _material; -} - /** * Getter for the property m_kLST. */ diff --git a/panda/src/bullet/bulletSoftBodyMaterial.h b/panda/src/bullet/bulletSoftBodyMaterial.h index bf8c8589a9..3df77904d8 100644 --- a/panda/src/bullet/bulletSoftBodyMaterial.h +++ b/panda/src/bullet/bulletSoftBodyMaterial.h @@ -18,6 +18,8 @@ #include "bullet_includes.h" +#include "numeric_types.h" + /** * */ diff --git a/panda/src/bullet/bulletSoftBodyNode.cxx b/panda/src/bullet/bulletSoftBodyNode.cxx index cf027f208d..f4ae8d2120 100644 --- a/panda/src/bullet/bulletSoftBodyNode.cxx +++ b/panda/src/bullet/bulletSoftBodyNode.cxx @@ -12,12 +12,14 @@ */ #include "bulletSoftBodyNode.h" + #include "bulletSoftBodyConfig.h" #include "bulletSoftBodyControl.h" #include "bulletSoftBodyMaterial.h" #include "bulletSoftBodyShape.h" #include "bulletSoftBodyWorldInfo.h" #include "bulletHelper.h" +#include "bulletWorld.h" #include "geomVertexRewriter.h" #include "geomVertexReader.h" diff --git a/panda/src/bullet/bulletSoftBodyNode.h b/panda/src/bullet/bulletSoftBodyNode.h index 26d7cc6fce..e19b6c730f 100644 --- a/panda/src/bullet/bulletSoftBodyNode.h +++ b/panda/src/bullet/bulletSoftBodyNode.h @@ -29,6 +29,7 @@ #include "nurbsSurfaceEvaluator.h" #include "pta_LVecBase3.h" +class BulletRigidBodyNode; class BulletSoftBodyConfig; class BulletSoftBodyControl; class BulletSoftBodyMaterial; diff --git a/panda/src/bullet/bulletSoftBodyShape.cxx b/panda/src/bullet/bulletSoftBodyShape.cxx index c6df128687..0f47e470e0 100644 --- a/panda/src/bullet/bulletSoftBodyShape.cxx +++ b/panda/src/bullet/bulletSoftBodyShape.cxx @@ -12,7 +12,9 @@ */ #include "bulletSoftBodyShape.h" + #include "bulletSoftBodyNode.h" +#include "bulletWorld.h" TypeHandle BulletSoftBodyShape::_type_handle; diff --git a/panda/src/bullet/bulletSoftBodyWorldInfo.cxx b/panda/src/bullet/bulletSoftBodyWorldInfo.cxx index 2fb6957c29..eb18b9d6fc 100644 --- a/panda/src/bullet/bulletSoftBodyWorldInfo.cxx +++ b/panda/src/bullet/bulletSoftBodyWorldInfo.cxx @@ -13,6 +13,8 @@ #include "bulletSoftBodyWorldInfo.h" +#include "bulletWorld.h" + /** * */ diff --git a/panda/src/bullet/bulletSphereShape.cxx b/panda/src/bullet/bulletSphereShape.cxx index b05e09e418..a2965bb16a 100644 --- a/panda/src/bullet/bulletSphereShape.cxx +++ b/panda/src/bullet/bulletSphereShape.cxx @@ -13,6 +13,8 @@ #include "bulletSphereShape.h" +#include "bulletWorld.h" + TypeHandle BulletSphereShape::_type_handle; /** diff --git a/panda/src/bullet/bulletSphericalConstraint.cxx b/panda/src/bullet/bulletSphericalConstraint.cxx index 8686e1d546..b07d96c649 100644 --- a/panda/src/bullet/bulletSphericalConstraint.cxx +++ b/panda/src/bullet/bulletSphericalConstraint.cxx @@ -12,7 +12,9 @@ */ #include "bulletSphericalConstraint.h" + #include "bulletRigidBodyNode.h" +#include "bulletWorld.h" TypeHandle BulletSphericalConstraint::_type_handle; diff --git a/panda/src/bullet/bulletTranslationalLimitMotor.cxx b/panda/src/bullet/bulletTranslationalLimitMotor.cxx index 48dd7ae3e8..fb5e6b93a4 100644 --- a/panda/src/bullet/bulletTranslationalLimitMotor.cxx +++ b/panda/src/bullet/bulletTranslationalLimitMotor.cxx @@ -13,6 +13,8 @@ #include "bulletTranslationalLimitMotor.h" +#include "bulletWorld.h" + /** * */ diff --git a/panda/src/bullet/bulletTriangleMesh.cxx b/panda/src/bullet/bulletTriangleMesh.cxx index 368aa22fac..ac487be61e 100644 --- a/panda/src/bullet/bulletTriangleMesh.cxx +++ b/panda/src/bullet/bulletTriangleMesh.cxx @@ -13,7 +13,10 @@ #include "bulletTriangleMesh.h" +#include "bulletWorld.h" + #include "pvector.h" +#include "geomTriangles.h" #include "geomVertexData.h" #include "geomVertexReader.h" diff --git a/panda/src/bullet/bulletTriangleMeshShape.cxx b/panda/src/bullet/bulletTriangleMeshShape.cxx index 8416c52cbc..688bccd478 100644 --- a/panda/src/bullet/bulletTriangleMeshShape.cxx +++ b/panda/src/bullet/bulletTriangleMeshShape.cxx @@ -12,7 +12,11 @@ */ #include "bulletTriangleMeshShape.h" + +#include "config_bullet.h" + #include "bulletTriangleMesh.h" +#include "bulletWorld.h" #include "nodePathCollection.h" #include "geomNode.h" diff --git a/panda/src/bullet/bulletTriangleMeshShape.h b/panda/src/bullet/bulletTriangleMeshShape.h index 199efb75d1..fcfb9281a0 100644 --- a/panda/src/bullet/bulletTriangleMeshShape.h +++ b/panda/src/bullet/bulletTriangleMeshShape.h @@ -19,6 +19,7 @@ #include "bullet_includes.h" #include "bulletShape.h" +#include "factoryParams.h" #include "luse.h" class BulletTriangleMesh; diff --git a/panda/src/bullet/bulletVehicle.cxx b/panda/src/bullet/bulletVehicle.cxx index 5dbb70cc7f..f4321cd911 100644 --- a/panda/src/bullet/bulletVehicle.cxx +++ b/panda/src/bullet/bulletVehicle.cxx @@ -12,6 +12,9 @@ */ #include "bulletVehicle.h" + +#include "config_bullet.h" + #include "bulletWorld.h" #include "bulletRigidBodyNode.h" #include "bulletWheel.h" diff --git a/panda/src/bullet/bulletWheel.cxx b/panda/src/bullet/bulletWheel.cxx index c24369546b..21a6eefd76 100644 --- a/panda/src/bullet/bulletWheel.cxx +++ b/panda/src/bullet/bulletWheel.cxx @@ -13,6 +13,8 @@ #include "bulletWheel.h" +#include "bulletWorld.h" + /** * */ diff --git a/panda/src/bullet/bulletWorld.cxx b/panda/src/bullet/bulletWorld.cxx index e1e416a2bb..930fe10111 100644 --- a/panda/src/bullet/bulletWorld.cxx +++ b/panda/src/bullet/bulletWorld.cxx @@ -12,9 +12,14 @@ */ #include "bulletWorld.h" + +#include "config_bullet.h" + +#include "bulletFilterCallbackData.h" #include "bulletPersistentManifold.h" #include "bulletShape.h" #include "bulletSoftBodyWorldInfo.h" +#include "bulletTickCallbackData.h" #include "collideMask.h" #include "lightMutexHolder.h" diff --git a/panda/src/bullet/bullet_utils.h b/panda/src/bullet/bullet_utils.h index b1577ede5e..080c70986a 100644 --- a/panda/src/bullet/bullet_utils.h +++ b/panda/src/bullet/bullet_utils.h @@ -44,6 +44,8 @@ EXPCL_PANDABULLET CPT(TransformState) btTrans_to_TransformState( EXPCL_PANDABULLET btTransform TransformState_to_btTrans( CPT(TransformState) ts); +EXPCL_PANDABULLET void get_node_transform(btTransform &trans, PandaNode *node); + // UpAxis BEGIN_PUBLISH diff --git a/panda/src/bullet/config_bullet.cxx b/panda/src/bullet/config_bullet.cxx index 5997bf575b..f9eed1b6b8 100644 --- a/panda/src/bullet/config_bullet.cxx +++ b/panda/src/bullet/config_bullet.cxx @@ -56,7 +56,7 @@ extern ContactDestroyedCallback gContactDestroyedCallback; #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDABULLET) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDABULLET) #error Buildsystem error: BUILDING_PANDABULLET not defined #endif diff --git a/panda/src/chan/config_chan.cxx b/panda/src/chan/config_chan.cxx index 8992cfbbf9..3a049d67f6 100644 --- a/panda/src/chan/config_chan.cxx +++ b/panda/src/chan/config_chan.cxx @@ -34,7 +34,7 @@ #include "luse.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_CHAN) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_CHAN) #error Buildsystem error: BUILDING_PANDA_CHAN not defined #endif diff --git a/panda/src/char/config_char.cxx b/panda/src/char/config_char.cxx index 5d536bfc4c..25ab775316 100644 --- a/panda/src/char/config_char.cxx +++ b/panda/src/char/config_char.cxx @@ -21,7 +21,7 @@ #include "jointVertexTransform.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_CHAR) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_CHAR) #error Buildsystem error: BUILDING_PANDA_CHAR not defined #endif diff --git a/panda/src/cocoadisplay/config_cocoadisplay.mm b/panda/src/cocoadisplay/config_cocoadisplay.mm index a41e5bc579..96662d6c9c 100644 --- a/panda/src/cocoadisplay/config_cocoadisplay.mm +++ b/panda/src/cocoadisplay/config_cocoadisplay.mm @@ -20,7 +20,7 @@ #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_COCOADISPLAY) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_COCOADISPLAY) #error Buildsystem error: BUILDING_PANDA_COCOADISPLAY not defined #endif diff --git a/panda/src/collada/config_collada.cxx b/panda/src/collada/config_collada.cxx index fa97023656..1fec2da68e 100644 --- a/panda/src/collada/config_collada.cxx +++ b/panda/src/collada/config_collada.cxx @@ -17,7 +17,7 @@ #include "loaderFileTypeDae.h" #include "loaderFileTypeRegistry.h" -#if !defined(CPPPARSER) && !defined(BUILDING_COLLADA) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_COLLADA) #error Buildsystem error: BUILDING_COLLADA not defined #endif diff --git a/panda/src/collide/config_collide.cxx b/panda/src/collide/config_collide.cxx index 01d517df04..38c821ed05 100644 --- a/panda/src/collide/config_collide.cxx +++ b/panda/src/collide/config_collide.cxx @@ -42,7 +42,7 @@ #include "collisionVisualizer.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_COLLIDE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_COLLIDE) #error Buildsystem error: BUILDING_PANDA_COLLIDE not defined #endif diff --git a/panda/src/cull/config_cull.cxx b/panda/src/cull/config_cull.cxx index 452c69ea0c..04ce4ca63c 100644 --- a/panda/src/cull/config_cull.cxx +++ b/panda/src/cull/config_cull.cxx @@ -22,7 +22,7 @@ #include "cullBinManager.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_CULL) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_CULL) #error Buildsystem error: BUILDING_PANDA_CULL not defined #endif diff --git a/panda/src/device/config_device.cxx b/panda/src/device/config_device.cxx index eb8d1a2f10..fb7f4d8928 100644 --- a/panda/src/device/config_device.cxx +++ b/panda/src/device/config_device.cxx @@ -27,7 +27,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DEVICE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_DEVICE) #error Buildsystem error: BUILDING_PANDA_DEVICE not defined #endif diff --git a/panda/src/dgraph/config_dgraph.cxx b/panda/src/dgraph/config_dgraph.cxx index 3c91aeea18..5a107635b7 100644 --- a/panda/src/dgraph/config_dgraph.cxx +++ b/panda/src/dgraph/config_dgraph.cxx @@ -17,7 +17,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DGRAPH) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_DGRAPH) #error Buildsystem error: BUILDING_PANDA_DGRAPH not defined #endif diff --git a/panda/src/display/config_display.cxx b/panda/src/display/config_display.cxx index 0d3fea3937..1c2f612fcc 100644 --- a/panda/src/display/config_display.cxx +++ b/panda/src/display/config_display.cxx @@ -31,7 +31,7 @@ #include "subprocessWindow.h" #include "windowHandle.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DISPLAY) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_DISPLAY) #error Buildsystem error: BUILDING_PANDA_DISPLAY not defined #endif diff --git a/panda/src/distort/config_distort.cxx b/panda/src/distort/config_distort.cxx index eaa0147dae..b14f9aae45 100644 --- a/panda/src/distort/config_distort.cxx +++ b/panda/src/distort/config_distort.cxx @@ -20,7 +20,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDAFX) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAFX) #error Buildsystem error: BUILDING_PANDAFX not defined #endif diff --git a/panda/src/downloader/config_downloader.cxx b/panda/src/downloader/config_downloader.cxx index 4e60b4028c..cd8f1de723 100644 --- a/panda/src/downloader/config_downloader.cxx +++ b/panda/src/downloader/config_downloader.cxx @@ -19,7 +19,7 @@ #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DOWNLOADER) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_DOWNLOADER) #error Buildsystem error: BUILDING_PANDA_DOWNLOADER not defined #endif diff --git a/panda/src/dxgsg9/config_dxgsg9.cxx b/panda/src/dxgsg9/config_dxgsg9.cxx index d5777602db..07ebca58a0 100644 --- a/panda/src/dxgsg9/config_dxgsg9.cxx +++ b/panda/src/dxgsg9/config_dxgsg9.cxx @@ -27,7 +27,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDADX) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDADX) #error Buildsystem error: BUILDING_PANDADX not defined #endif diff --git a/panda/src/dxml/config_dxml.cxx b/panda/src/dxml/config_dxml.cxx index 0441f1fdc5..bbc119cb14 100644 --- a/panda/src/dxml/config_dxml.cxx +++ b/panda/src/dxml/config_dxml.cxx @@ -19,7 +19,7 @@ BEGIN_PUBLISH #include "tinyxml.h" END_PUBLISH -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_DXML) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_DXML) #error Buildsystem error: BUILDING_PANDA_DXML not defined #endif diff --git a/panda/src/egg/config_egg.cxx b/panda/src/egg/config_egg.cxx index ec0009819f..cbcc00d32f 100644 --- a/panda/src/egg/config_egg.cxx +++ b/panda/src/egg/config_egg.cxx @@ -58,7 +58,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_EGG) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_EGG) #error Buildsystem error: BUILDING_PANDA_EGG not defined #endif diff --git a/panda/src/egg/eggPrimitive.cxx b/panda/src/egg/eggPrimitive.cxx index f4985dfc90..158866855f 100644 --- a/panda/src/egg/eggPrimitive.cxx +++ b/panda/src/egg/eggPrimitive.cxx @@ -558,7 +558,7 @@ remove_doubled_verts(bool closed) { */ void EggPrimitive:: remove_nonunique_verts() { - Vertices::iterator vi, vj; + Vertices::iterator vi; Vertices new_vertices; int num_removed = 0; diff --git a/panda/src/egg2pg/config_egg2pg.cxx b/panda/src/egg2pg/config_egg2pg.cxx index 36247ad2c4..e32aa19914 100644 --- a/panda/src/egg2pg/config_egg2pg.cxx +++ b/panda/src/egg2pg/config_egg2pg.cxx @@ -20,7 +20,7 @@ #include "configVariableCore.h" #include "eggRenderState.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_EGG2PG) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_EGG2PG) #error Buildsystem error: BUILDING_PANDA_EGG2PG not defined #endif diff --git a/panda/src/egg2pg/eggLoader.cxx b/panda/src/egg2pg/eggLoader.cxx index e26a4120b9..9d885e0234 100644 --- a/panda/src/egg2pg/eggLoader.cxx +++ b/panda/src/egg2pg/eggLoader.cxx @@ -2661,7 +2661,6 @@ set_occluder_polygon(EggGroup *egg_group, OccluderNode *pnode) { } else { LMatrix4d mat = poly->get_vertex_to_node(); - EggPolygon::const_iterator vi; LPoint3d v0 = (*poly)[0]->get_pos3() * mat; LPoint3d v1 = (*poly)[1]->get_pos3() * mat; LPoint3d v2 = (*poly)[2]->get_pos3() * mat; diff --git a/panda/src/egldisplay/config_egldisplay.cxx b/panda/src/egldisplay/config_egldisplay.cxx index f76b1b9d1f..2f8e99cc0f 100644 --- a/panda/src/egldisplay/config_egldisplay.cxx +++ b/panda/src/egldisplay/config_egldisplay.cxx @@ -19,7 +19,7 @@ #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGLES) && !defined(BUILDING_PANDAGLES2) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAGLES) && !defined(BUILDING_PANDAGLES2) #error Buildsystem error: BUILDING_PANDAGLES(2) not defined #endif diff --git a/panda/src/event/asyncTask.cxx b/panda/src/event/asyncTask.cxx index 806d8e87af..e00b4f46e3 100644 --- a/panda/src/event/asyncTask.cxx +++ b/panda/src/event/asyncTask.cxx @@ -403,6 +403,9 @@ unlock_and_do_task() { Thread *current_thread = Thread::get_current_thread(); nassertr(current_thread->_current_task == nullptr, DS_interrupt); +#ifdef __GNUC__ + __attribute__((unused)) +#endif void *ptr = AtomicAdjust::compare_and_exchange_ptr (current_thread->_current_task, nullptr, (TypedReferenceCount *)this); diff --git a/panda/src/event/asyncTaskManager.cxx b/panda/src/event/asyncTaskManager.cxx index b80908ddc5..a570609f8a 100644 --- a/panda/src/event/asyncTaskManager.cxx +++ b/panda/src/event/asyncTaskManager.cxx @@ -643,6 +643,7 @@ void AsyncTaskManager:: make_global_ptr() { nassertv(_global_ptr == nullptr); + init_memory_hook(); _global_ptr = new AsyncTaskManager("TaskManager"); _global_ptr->ref(); } diff --git a/panda/src/event/config_event.cxx b/panda/src/event/config_event.cxx index c7f1c8eecc..ccae0d95ae 100644 --- a/panda/src/event/config_event.cxx +++ b/panda/src/event/config_event.cxx @@ -27,7 +27,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_EVENT) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_EVENT) #error Buildsystem error: BUILDING_PANDA_EVENT not defined #endif diff --git a/panda/src/event/eventHandler.cxx b/panda/src/event/eventHandler.cxx index f74bd8c519..e3e389e1bf 100644 --- a/panda/src/event/eventHandler.cxx +++ b/panda/src/event/eventHandler.cxx @@ -351,6 +351,7 @@ remove_all_hooks() { */ void EventHandler:: make_global_event_handler() { + init_memory_hook(); _global_event_handler = new EventHandler(EventQueue::get_global_event_queue()); } diff --git a/panda/src/event/eventQueue.cxx b/panda/src/event/eventQueue.cxx index bbd07a3725..69c025734c 100644 --- a/panda/src/event/eventQueue.cxx +++ b/panda/src/event/eventQueue.cxx @@ -106,5 +106,6 @@ dequeue_event() { */ void EventQueue:: make_global_event_queue() { + init_memory_hook(); _global_event_queue = new EventQueue; } diff --git a/panda/src/express/config_express.cxx b/panda/src/express/config_express.cxx index 3a4343ac32..c9e664db34 100644 --- a/panda/src/express/config_express.cxx +++ b/panda/src/express/config_express.cxx @@ -36,7 +36,7 @@ #include "dconfig.h" #include "streamWrapper.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_EXPRESS) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_EXPRESS) #error Buildsystem error: BUILDING_PANDA_EXPRESS not defined #endif diff --git a/panda/src/express/datagram.I b/panda/src/express/datagram.I index 98b71820e5..42cc6b9cf1 100644 --- a/panda/src/express/datagram.I +++ b/panda/src/express/datagram.I @@ -11,30 +11,11 @@ * @date 2000-06-06 */ -/** - * Constructs an empty datagram. - */ -INLINE Datagram:: -Datagram() : -#ifdef STDFLOAT_DOUBLE - _stdfloat_double(true) -#else - _stdfloat_double(false) -#endif -{ -} - /** * Constructs a datagram from an existing block of data. */ INLINE Datagram:: -Datagram(const void *data, size_t size) : -#ifdef STDFLOAT_DOUBLE - _stdfloat_double(true) -#else - _stdfloat_double(false) -#endif -{ +Datagram(const void *data, size_t size) { append_data(data, size); } @@ -43,13 +24,7 @@ Datagram(const void *data, size_t size) : */ INLINE Datagram:: Datagram(vector_uchar data) : - _data(std::move(data)), -#ifdef STDFLOAT_DOUBLE - _stdfloat_double(true) -#else - _stdfloat_double(false) -#endif -{ + _data(std::move(data)) { } /** @@ -295,6 +270,35 @@ add_fixed_string(const std::string &str, size_t size) { } } +/** + * Adds a variable-length binary blob to the datagram. This actually adds a + * count followed by n bytes. + */ +INLINE void Datagram:: +add_blob(const vector_uchar &data) { + // The max sendable size for a blob is 2^16. + nassertv(data.size() <= (uint16_t)0xffff); + + // Blobs always are preceded by their size + add_uint16((uint16_t)data.size()); + + // Add the blob + append_data(data.data(), data.size()); +} + +/** + * Adds a variable-length binary blob to the datagram, using a 32-bit length + * field to allow very long blobs. + */ +INLINE void Datagram:: +add_blob32(const vector_uchar &data) { + // Blobs always are preceded by their size + add_uint32((uint32_t)data.size()); + + // Add the blob + append_data(data.data(), data.size()); +} + /** * Appends some more raw data to the end of the datagram. */ @@ -316,18 +320,6 @@ get_message() const { } } -/** - * Returns the datagram's data as a bytes object. - */ -INLINE vector_uchar Datagram:: -__bytes__() const { - if (!_data.empty()) { - return vector_uchar(_data.v()); - } else { - return vector_uchar(); - } -} - /** * Returns a pointer to the beginning of the datagram's data. */ @@ -482,3 +474,8 @@ INLINE void generic_write_datagram(Datagram &dest, const std::wstring &value) { dest.add_wstring(value); } + +INLINE void +generic_write_datagram(Datagram &dest, const vector_uchar &value) { + dest.add_blob(value); +} diff --git a/panda/src/express/datagram.h b/panda/src/express/datagram.h index 69dce69e31..9611645eed 100644 --- a/panda/src/express/datagram.h +++ b/panda/src/express/datagram.h @@ -37,7 +37,7 @@ */ class EXPCL_PANDA_EXPRESS Datagram : public TypedObject { PUBLISHED: - INLINE Datagram(); + INLINE Datagram() = default; INLINE Datagram(const void *data, size_t size); INLINE explicit Datagram(vector_uchar data); Datagram(const Datagram ©) = default; @@ -81,15 +81,23 @@ PUBLISHED: INLINE void add_fixed_string(const std::string &str, size_t size); void add_wstring(const std::wstring &str); + INLINE void add_blob(const vector_uchar &); + INLINE void add_blob32(const vector_uchar &); + void pad_bytes(size_t size); void append_data(const void *data, size_t size); INLINE void append_data(const vector_uchar &data); +public: void assign(const void *data, size_t size); INLINE std::string get_message() const; - INLINE vector_uchar __bytes__() const; INLINE const void *get_data() const; + +PUBLISHED: + EXTENSION(INLINE PyObject *get_message() const); + EXTENSION(INLINE PyObject *__bytes__() const); + INLINE size_t get_length() const; INLINE void set_array(PTA_uchar data); @@ -109,7 +117,12 @@ PUBLISHED: private: PTA_uchar _data; - bool _stdfloat_double; + +#ifdef STDFLOAT_DOUBLE + bool _stdfloat_double = true; +#else + bool _stdfloat_double = false; +#endif public: @@ -148,6 +161,8 @@ INLINE void generic_write_datagram(Datagram &dest, const std::string &value); INLINE void generic_write_datagram(Datagram &dest, const std::wstring &value); +INLINE void +generic_write_datagram(Datagram &dest, const vector_uchar &value); #include "datagram.I" diff --git a/panda/src/express/datagramIterator.I b/panda/src/express/datagramIterator.I index 763850b60c..140151089a 100644 --- a/panda/src/express/datagramIterator.I +++ b/panda/src/express/datagramIterator.I @@ -400,6 +400,22 @@ get_be_float64() { return tempvar; } +/** + * Extracts a variable-length binary blob. + */ +INLINE vector_uchar DatagramIterator:: +get_blob() { + return extract_bytes(get_uint16()); +} + +/** + * Extracts a variable-length binary blob with a 32-bit size field. + */ +INLINE vector_uchar DatagramIterator:: +get_blob32() { + return extract_bytes(get_uint32()); +} + /** * Skips over the indicated number of bytes in the datagram. */ @@ -485,3 +501,8 @@ INLINE void generic_read_datagram(std::wstring &result, DatagramIterator &source) { result = source.get_wstring(); } + +INLINE void +generic_read_datagram(vector_uchar &result, DatagramIterator &source) { + result = source.get_blob(); +} diff --git a/panda/src/express/datagramIterator.h b/panda/src/express/datagramIterator.h index 570e34c3c4..867c7de58c 100644 --- a/panda/src/express/datagramIterator.h +++ b/panda/src/express/datagramIterator.h @@ -61,6 +61,9 @@ PUBLISHED: std::string get_fixed_string(size_t size); std::wstring get_wstring(); + INLINE vector_uchar get_blob(); + INLINE vector_uchar get_blob32(); + INLINE void skip_bytes(size_t size); vector_uchar extract_bytes(size_t size); size_t extract_bytes(unsigned char *into, size_t size); diff --git a/panda/src/express/datagram_ext.I b/panda/src/express/datagram_ext.I new file mode 100644 index 0000000000..a35c5410b2 --- /dev/null +++ b/panda/src/express/datagram_ext.I @@ -0,0 +1,35 @@ +/** + * 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." + * + * @file datagram_ext.I + * @author rdb + * @date 2018-08-19 + */ + +/** + * Returns the datagram's data as a bytes object. + */ +INLINE PyObject *Extension:: +get_message() const { + const char *data = (const char *)_this->get_data(); + size_t size = _this->get_length(); + +#if PY_MAJOR_VERSION >= 3 + return PyBytes_FromStringAndSize((char *)data, size); +#else + return PyString_FromStringAndSize((char *)data, size); +#endif +} + +/** + * Returns the datagram's data as a bytes object. + */ +PyObject *Extension:: +__bytes__() const { + return get_message(); +} diff --git a/panda/src/express/datagram_ext.h b/panda/src/express/datagram_ext.h new file mode 100644 index 0000000000..35f2e32bc6 --- /dev/null +++ b/panda/src/express/datagram_ext.h @@ -0,0 +1,40 @@ +/** + * 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." + * + * @file datagram_ext.h + * @author rdb + * @date 2018-08-19 + */ + +#ifndef DATAGRAM_EXT_H +#define DATAGRAM_EXT_H + +#include "dtoolbase.h" + +#ifdef HAVE_PYTHON + +#include "extension.h" +#include "datagram.h" +#include "py_panda.h" + +/** + * This class defines the extension methods for Datagram, which are called + * instead of any C++ methods with the same prototype. + */ +template<> +class Extension : public ExtensionBase { +public: + INLINE PyObject *get_message() const; + INLINE PyObject *__bytes__() const; +}; + +#include "datagram_ext.I" + +#endif // HAVE_PYTHON + +#endif // DATAGRAM_EXT_H diff --git a/panda/src/ffmpeg/config_ffmpeg.cxx b/panda/src/ffmpeg/config_ffmpeg.cxx index 850cf62937..27270757a8 100644 --- a/panda/src/ffmpeg/config_ffmpeg.cxx +++ b/panda/src/ffmpeg/config_ffmpeg.cxx @@ -26,7 +26,7 @@ extern "C" { #include "libavutil/avutil.h" } -#if !defined(CPPPARSER) && !defined(BUILDING_FFMPEG) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_FFMPEG) #error Buildsystem error: BUILDING_FFMPEG not defined #endif diff --git a/panda/src/framework/config_framework.cxx b/panda/src/framework/config_framework.cxx index 4ddc4b553a..febf588dd8 100644 --- a/panda/src/framework/config_framework.cxx +++ b/panda/src/framework/config_framework.cxx @@ -16,7 +16,7 @@ #include "dconfig.h" #include "windowFramework.h" -#if !defined(CPPPARSER) && !defined(BUILDING_FRAMEWORK) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_FRAMEWORK) #error Buildsystem error: BUILDING_FRAMEWORK not defined #endif diff --git a/panda/src/gles2gsg/config_gles2gsg.cxx b/panda/src/gles2gsg/config_gles2gsg.cxx index aee9c925fb..0e5a71aadb 100644 --- a/panda/src/gles2gsg/config_gles2gsg.cxx +++ b/panda/src/gles2gsg/config_gles2gsg.cxx @@ -16,7 +16,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGLES2) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAGLES2) #error Buildsystem error: BUILDING_PANDAGLES2 not defined #endif diff --git a/panda/src/glesgsg/config_glesgsg.cxx b/panda/src/glesgsg/config_glesgsg.cxx index b30cf23322..77d711f1f5 100644 --- a/panda/src/glesgsg/config_glesgsg.cxx +++ b/panda/src/glesgsg/config_glesgsg.cxx @@ -16,7 +16,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDAGLES) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAGLES) #error Buildsystem error: BUILDING_PANDAGLES not defined #endif diff --git a/panda/src/glgsg/config_glgsg.cxx b/panda/src/glgsg/config_glgsg.cxx index 1c7ddcbfd5..21a3a2ec61 100644 --- a/panda/src/glgsg/config_glgsg.cxx +++ b/panda/src/glgsg/config_glgsg.cxx @@ -16,7 +16,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_GLGSG) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_GLGSG) #error Buildsystem error: BUILDING_PANDA_GLGSG not defined #endif diff --git a/panda/src/glxdisplay/config_glxdisplay.cxx b/panda/src/glxdisplay/config_glxdisplay.cxx index 23b8aef8fa..c7a66644d9 100644 --- a/panda/src/glxdisplay/config_glxdisplay.cxx +++ b/panda/src/glxdisplay/config_glxdisplay.cxx @@ -23,7 +23,7 @@ #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_GLXDISPLAY) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_GLXDISPLAY) #error Buildsystem error: BUILDING_PANDA_GLXDISPLAY not defined #endif diff --git a/panda/src/gobj/config_gobj.cxx b/panda/src/gobj/config_gobj.cxx index 7da3b1d31e..12840f7d04 100644 --- a/panda/src/gobj/config_gobj.cxx +++ b/panda/src/gobj/config_gobj.cxx @@ -70,7 +70,7 @@ #include "dconfig.h" #include "string_utils.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_GOBJ) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_GOBJ) #error Buildsystem error: BUILDING_PANDA_GOBJ not defined #endif diff --git a/panda/src/gobj/shader.h b/panda/src/gobj/shader.h index 99b8d45e53..67906210f6 100644 --- a/panda/src/gobj/shader.h +++ b/panda/src/gobj/shader.h @@ -53,6 +53,7 @@ PUBLISHED: SL_Cg, SL_GLSL, SL_HLSL, + SL_SPIR_V, }; enum ShaderType { diff --git a/panda/src/gobj/texture.I b/panda/src/gobj/texture.I index 4abb480348..7d859dbda8 100644 --- a/panda/src/gobj/texture.I +++ b/panda/src/gobj/texture.I @@ -2390,8 +2390,13 @@ get_half_float(const unsigned char *&p) { uint32_t t3 = in & 0x7c00; // Exponent t1 <<= 13; // Align mantissa on MSB t2 <<= 16; // Shift sign bit into position - t1 += 0x38000000; // Adjust bias - t1 = (t3 == 0 ? 0 : t1); // Denormals-as-zero + if (t3 != 0x7c00) { + t1 += 0x38000000; // Adjust bias + t1 = (t3 == 0 ? 0 : t1); // Denormals-as-zero + } else { + // Infinity / NaN + t1 |= 0x7f800000; + } t1 |= t2; // Re-insert sign bit v.ui = t1; return v.uf; diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index c538391018..c0cd14db0a 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -5594,180 +5594,114 @@ do_set_ram_mipmap_image(CData *cdata, int n, CPTA_uchar image, size_t page_size) size_t Texture:: do_get_clear_data(const CData *cdata, unsigned char *into) const { nassertr(cdata->_has_clear_color, 0); - nassertr(cdata->_num_components <= 4, 0); + + int num_components = cdata->_num_components; + nassertr(num_components > 0, 0); + nassertr(num_components <= 4, 0); + + LVecBase4 clear_value = cdata->_clear_color; + + // Swap red and blue components. + if (num_components >= 3) { + std::swap(clear_value[0], clear_value[2]); + } switch (cdata->_component_type) { case T_unsigned_byte: if (is_srgb(cdata->_format)) { xel color; xelval alpha; - encode_sRGB_uchar(cdata->_clear_color, color, alpha); - switch (cdata->_num_components) { - case 2: - into[1] = (unsigned char)color.g; - case 1: - into[0] = (unsigned char)color.r; - break; - case 4: - into[3] = (unsigned char)alpha; - case 3: // BGR <-> RGB - into[0] = (unsigned char)color.b; - into[1] = (unsigned char)color.g; - into[2] = (unsigned char)color.r; - break; + encode_sRGB_uchar(clear_value, color, alpha); + switch (num_components) { + case 4: into[3] = (unsigned char)alpha; + case 3: into[2] = (unsigned char)color.b; + case 2: into[1] = (unsigned char)color.g; + case 1: into[0] = (unsigned char)color.r; } - break; } else { - LColor scaled = cdata->_clear_color.fmin(LColor(1)).fmax(LColor::zero()); + LColor scaled = clear_value.fmin(LColor(1)).fmax(LColor::zero()); scaled *= 255; - switch (cdata->_num_components) { - case 2: - into[1] = (unsigned char)scaled[1]; - case 1: - into[0] = (unsigned char)scaled[0]; - break; - case 4: - into[3] = (unsigned char)scaled[3]; - case 3: // BGR <-> RGB - into[0] = (unsigned char)scaled[2]; - into[1] = (unsigned char)scaled[1]; - into[2] = (unsigned char)scaled[0]; - break; + for (int i = 0; i < num_components; ++i) { + into[i] = (unsigned char)scaled[i]; } - break; } + break; case T_unsigned_short: { - LColor scaled = cdata->_clear_color.fmin(LColor(1)).fmax(LColor::zero()); + LColor scaled = clear_value.fmin(LColor(1)).fmax(LColor::zero()); scaled *= 65535; - switch (cdata->_num_components) { - case 2: - ((unsigned short *)into)[1] = (unsigned short)scaled[1]; - case 1: - ((unsigned short *)into)[0] = (unsigned short)scaled[0]; - break; - case 4: - ((unsigned short *)into)[3] = (unsigned short)scaled[3]; - case 3: // BGR <-> RGB - ((unsigned short *)into)[0] = (unsigned short)scaled[2]; - ((unsigned short *)into)[1] = (unsigned short)scaled[1]; - ((unsigned short *)into)[2] = (unsigned short)scaled[0]; - break; + for (int i = 0; i < num_components; ++i) { + ((unsigned short *)into)[i] = (unsigned short)scaled[i]; } break; } case T_float: - switch (cdata->_num_components) { - case 2: - ((float *)into)[1] = cdata->_clear_color[1]; - case 1: - ((float *)into)[0] = cdata->_clear_color[0]; - break; - case 4: - ((float *)into)[3] = cdata->_clear_color[3]; - case 3: // BGR <-> RGB - ((float *)into)[0] = cdata->_clear_color[2]; - ((float *)into)[1] = cdata->_clear_color[1]; - ((float *)into)[2] = cdata->_clear_color[0]; - break; + for (int i = 0; i < num_components; ++i) { + ((float *)into)[i] = clear_value[i]; } break; case T_unsigned_int_24_8: - nassertr(cdata->_num_components == 1, 0); + nassertr(num_components == 1, 0); *((unsigned int *)into) = - ((unsigned int)(cdata->_clear_color[0] * 16777215) << 8) + - (unsigned int)max(min(cdata->_clear_color[1], (PN_stdfloat)255), (PN_stdfloat)0); + ((unsigned int)(clear_value[0] * 16777215) << 8) + + (unsigned int)max(min(clear_value[1], (PN_stdfloat)255), (PN_stdfloat)0); break; case T_int: - { - // Note: there are no 32-bit UNORM textures. Therefore, we don't do any - // normalization here, either. - switch (cdata->_num_components) { - case 2: - ((int *)into)[1] = (int)cdata->_clear_color[1]; - case 1: - ((int *)into)[0] = (int)cdata->_clear_color[0]; - break; - case 4: - ((int *)into)[3] = (int)cdata->_clear_color[3]; - case 3: // BGR <-> RGB - ((int *)into)[0] = (int)cdata->_clear_color[2]; - ((int *)into)[1] = (int)cdata->_clear_color[1]; - ((int *)into)[2] = (int)cdata->_clear_color[0]; - break; - } - break; + // Note: there are no 32-bit UNORM textures. Therefore, we don't do any + // normalization here, either. + for (int i = 0; i < num_components; ++i) { + ((int *)into)[i] = (int)clear_value[i]; } + break; case T_byte: { - LColor scaled = cdata->_clear_color.fmin(LColor(1)).fmax(LColor(-1)); + LColor scaled = clear_value.fmin(LColor(1)).fmax(LColor(-1)); scaled *= 127; - switch (cdata->_num_components) { - case 2: - into[1] = (char)scaled[1]; - case 1: - into[0] = (char)scaled[0]; - break; - case 4: - into[3] = (char)scaled[3]; - case 3: // BGR <-> RGB - into[0] = (char)scaled[2]; - into[1] = (char)scaled[1]; - into[2] = (char)scaled[0]; - break; + for (int i = 0; i < num_components; ++i) { + ((signed char *)into)[i] = (signed char)scaled[i]; } break; } case T_short: { - LColor scaled = cdata->_clear_color.fmin(LColor(1)).fmax(LColor(-1)); + LColor scaled = clear_value.fmin(LColor(1)).fmax(LColor(-1)); scaled *= 32767; - switch (cdata->_num_components) { - case 2: - ((short *)into)[1] = (short)scaled[1]; - case 1: - ((short *)into)[0] = (short)scaled[0]; - break; - case 4: - ((short *)into)[3] = (short)scaled[3]; - case 3: // BGR <-> RGB - ((short *)into)[0] = (short)scaled[2]; - ((short *)into)[1] = (short)scaled[1]; - ((short *)into)[2] = (short)scaled[0]; - break; + for (int i = 0; i < num_components; ++i) { + ((short *)into)[i] = (short)scaled[i]; } break; } + case T_half_float: + for (int i = 0; i < num_components; ++i) { + union { + uint32_t ui; + float uf; + } v; + v.uf = clear_value[i]; + uint16_t sign = ((v.ui & 0x80000000u) >> 16u); + uint32_t mantissa = (v.ui & 0x007fffffu); + uint16_t exponent = (uint16_t)std::min(std::max((int)((v.ui & 0x7f800000u) >> 23u) - 112, 0), 31); + mantissa += (mantissa & 0x00001000u) << 1u; + ((uint16_t *)into)[i] = (uint16_t)(sign | ((exponent << 10u) | (mantissa >> 13u))); + } + break; + case T_unsigned_int: - { - // Note: there are no 32-bit UNORM textures. Therefore, we don't do any - // normalization here, either. - switch (cdata->_num_components) { - case 2: - ((unsigned int *)into)[1] = (unsigned int)cdata->_clear_color[1]; - case 1: - ((unsigned int *)into)[0] = (unsigned int)cdata->_clear_color[0]; - break; - case 4: - ((unsigned int *)into)[3] = (unsigned int)cdata->_clear_color[3]; - case 3: // BGR <-> RGB - ((unsigned int *)into)[0] = (unsigned int)cdata->_clear_color[2]; - ((unsigned int *)into)[1] = (unsigned int)cdata->_clear_color[1]; - ((unsigned int *)into)[2] = (unsigned int)cdata->_clear_color[0]; - break; - } - break; + // Note: there are no 32-bit UNORM textures. Therefore, we don't do any + // normalization here, either. + for (int i = 0; i < num_components; ++i) { + ((unsigned int *)into)[i] = (unsigned int)clear_value[i]; } } - return cdata->_num_components * cdata->_component_width; + return num_components * cdata->_component_width; } /** diff --git a/panda/src/grutil/config_grutil.cxx b/panda/src/grutil/config_grutil.cxx index 337abd11bb..6f74fd5e1b 100644 --- a/panda/src/grutil/config_grutil.cxx +++ b/panda/src/grutil/config_grutil.cxx @@ -27,7 +27,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_GRUTIL) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_GRUTIL) #error Buildsystem error: BUILDING_PANDA_GRUTIL not defined #endif diff --git a/panda/src/gsgbase/config_gsgbase.cxx b/panda/src/gsgbase/config_gsgbase.cxx index 52da83f9c8..bb60e50533 100644 --- a/panda/src/gsgbase/config_gsgbase.cxx +++ b/panda/src/gsgbase/config_gsgbase.cxx @@ -17,7 +17,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_GSGBASE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_GSGBASE) #error Buildsystem error: BUILDING_PANDA_GSGBASE not defined #endif diff --git a/panda/src/linmath/config_linmath.cxx b/panda/src/linmath/config_linmath.cxx index fb0942aa55..c93eb8caac 100644 --- a/panda/src/linmath/config_linmath.cxx +++ b/panda/src/linmath/config_linmath.cxx @@ -17,7 +17,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_LINMATH) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_LINMATH) #error Buildsystem error: BUILDING_PANDA_LINMATH not defined #endif diff --git a/panda/src/linmath/lmatrix3_src.I b/panda/src/linmath/lmatrix3_src.I index 8bfb3909ce..782c8599ee 100644 --- a/panda/src/linmath/lmatrix3_src.I +++ b/panda/src/linmath/lmatrix3_src.I @@ -44,6 +44,14 @@ size() { return 3; } +/** + * + */ +INLINE_LINMATH FLOATNAME(LMatrix3)::Row:: +operator const FLOATNAME(LVecBase3) &() const { + return *(const FLOATNAME(LVecBase3) *)_row; +} + /** * Defines a row-level constant accessor to the matrix. */ @@ -68,6 +76,14 @@ size() { return 3; } +/** + * + */ +INLINE_LINMATH FLOATNAME(LMatrix3)::CRow:: +operator const FLOATNAME(LVecBase3) &() const { + return *(const FLOATNAME(LVecBase3) *)_row; +} + /** * Returns an identity matrix. * @@ -132,6 +148,32 @@ FLOATNAME(LMatrix3)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, _m(2, 2) = e22; } +/** + * Constructs the matrix from three individual rows. + */ +INLINE_LINMATH FLOATNAME(LMatrix3):: +FLOATNAME(LMatrix3)(const FLOATNAME(LVecBase3) &row0, + const FLOATNAME(LVecBase3) &row1, + const FLOATNAME(LVecBase3) &row2) { + TAU_PROFILE("LMatrix3::LMatrix3(const LVecBase3 &, ...)", " ", TAU_USER); + +#ifdef HAVE_EIGEN + _m.row(0) = row0._v; + _m.row(1) = row1._v; + _m.row(2) = row2._v; +#else + _m(0, 0) = row0._v(0); + _m(0, 1) = row0._v(1); + _m(0, 2) = row0._v(2); + _m(1, 0) = row1._v(0); + _m(1, 1) = row1._v(1); + _m(1, 2) = row1._v(2); + _m(2, 0) = row2._v(0); + _m(2, 1) = row2._v(1); + _m(2, 2) = row2._v(2); +#endif // HAVE_EIGEN +} + /** * */ diff --git a/panda/src/linmath/lmatrix3_src.h b/panda/src/linmath/lmatrix3_src.h index 399508ed5f..2138f0fc39 100644 --- a/panda/src/linmath/lmatrix3_src.h +++ b/panda/src/linmath/lmatrix3_src.h @@ -38,6 +38,7 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); INLINE_LINMATH static int size(); + INLINE_LINMATH operator const FLOATNAME(LVecBase3) &() const; public: FLOATTYPE *_row; friend class FLOATNAME(LMatrix3); @@ -48,6 +49,7 @@ PUBLISHED: PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH static int size(); + INLINE_LINMATH operator const FLOATNAME(LVecBase3) &() const; public: const FLOATTYPE *_row; friend class FLOATNAME(LMatrix3); @@ -58,10 +60,12 @@ PUBLISHED: INLINE_LINMATH FLOATNAME(LMatrix3) &operator = ( const FLOATNAME(LMatrix3) &other); INLINE_LINMATH FLOATNAME(LMatrix3) &operator = (FLOATTYPE fill_value); - INLINE_LINMATH FLOATNAME(LMatrix3)( - FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, - FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, - FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22); + INLINE_LINMATH FLOATNAME(LMatrix3)(FLOATTYPE, FLOATTYPE, FLOATTYPE, + FLOATTYPE, FLOATTYPE, FLOATTYPE, + FLOATTYPE, FLOATTYPE, FLOATTYPE); + INLINE_LINMATH FLOATNAME(LMatrix3)(const FLOATNAME(LVecBase3) &, + const FLOATNAME(LVecBase3) &, + const FLOATNAME(LVecBase3) &); ALLOC_DELETED_CHAIN(FLOATNAME(LMatrix3)); EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const); diff --git a/panda/src/linmath/lmatrix4_src.I b/panda/src/linmath/lmatrix4_src.I index d5c16d5ce7..a887d393f1 100644 --- a/panda/src/linmath/lmatrix4_src.I +++ b/panda/src/linmath/lmatrix4_src.I @@ -44,6 +44,14 @@ size() { return 4; } +/** + * + */ +INLINE_LINMATH FLOATNAME(LMatrix4)::Row:: +operator const FLOATNAME(LVecBase4) &() const { + return *(const FLOATNAME(LVecBase4) *)_row; +} + /** * Defines a row-level constant accessor to the matrix. */ @@ -68,6 +76,14 @@ size() { return 4; } +/** + * + */ +INLINE_LINMATH FLOATNAME(LMatrix4)::CRow:: +operator const FLOATNAME(LVecBase4) &() const { + return *(const FLOATNAME(LVecBase4) *)_row; +} + /** * Returns an identity matrix. * @@ -178,6 +194,41 @@ FLOATNAME(LMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03, _m(3, 3) = e33; } +/** + * Constructs the matrix from four individual rows. + */ +INLINE_LINMATH FLOATNAME(LMatrix4):: +FLOATNAME(LMatrix4)(const FLOATNAME(LVecBase4) &row0, + const FLOATNAME(LVecBase4) &row1, + const FLOATNAME(LVecBase4) &row2, + const FLOATNAME(LVecBase4) &row3) { + TAU_PROFILE("LMatrix4::LMatrix4(const LVecBase4 &, ...)", " ", TAU_USER); + +#ifdef HAVE_EIGEN + _m.row(0) = row0._v; + _m.row(1) = row1._v; + _m.row(2) = row2._v; + _m.row(3) = row3._v; +#else + _m(0, 0) = row0._v(0); + _m(0, 1) = row0._v(1); + _m(0, 2) = row0._v(2); + _m(0, 3) = row0._v(3); + _m(1, 0) = row1._v(0); + _m(1, 1) = row1._v(1); + _m(1, 2) = row1._v(2); + _m(1, 3) = row1._v(3); + _m(2, 0) = row2._v(0); + _m(2, 1) = row2._v(1); + _m(2, 2) = row2._v(2); + _m(2, 3) = row2._v(3); + _m(3, 0) = row3._v(0); + _m(3, 1) = row3._v(1); + _m(3, 2) = row3._v(2); + _m(3, 3) = row3._v(3); +#endif // HAVE_EIGEN +} + /** * */ diff --git a/panda/src/linmath/lmatrix4_src.h b/panda/src/linmath/lmatrix4_src.h index 4d749cddd5..a66a5ab45f 100644 --- a/panda/src/linmath/lmatrix4_src.h +++ b/panda/src/linmath/lmatrix4_src.h @@ -36,6 +36,7 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); INLINE_LINMATH static int size(); + INLINE_LINMATH operator const FLOATNAME(LVecBase4) &() const; public: FLOATTYPE *_row; friend class FLOATNAME(LMatrix4); @@ -46,6 +47,7 @@ PUBLISHED: PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH static int size(); + INLINE_LINMATH operator const FLOATNAME(LVecBase4) &() const; public: const FLOATTYPE *_row; friend class FLOATNAME(LMatrix4); @@ -60,10 +62,14 @@ PUBLISHED: const FLOATNAME(UnalignedLMatrix4) &other); INLINE_LINMATH FLOATNAME(LMatrix4) &operator = (FLOATTYPE fill_value); - INLINE_LINMATH FLOATNAME(LMatrix4)(FLOATTYPE e00, FLOATTYPE e01, FLOATTYPE e02, FLOATTYPE e03, - FLOATTYPE e10, FLOATTYPE e11, FLOATTYPE e12, FLOATTYPE e13, - FLOATTYPE e20, FLOATTYPE e21, FLOATTYPE e22, FLOATTYPE e23, - FLOATTYPE e30, FLOATTYPE e31, FLOATTYPE e32, FLOATTYPE e33); + INLINE_LINMATH FLOATNAME(LMatrix4)(FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE, + FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE, + FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE, + FLOATTYPE, FLOATTYPE, FLOATTYPE, FLOATTYPE); + INLINE_LINMATH FLOATNAME(LMatrix4)(const FLOATNAME(LVecBase4) &, + const FLOATNAME(LVecBase4) &, + const FLOATNAME(LVecBase4) &, + const FLOATNAME(LVecBase4) &); ALLOC_DELETED_CHAIN(FLOATNAME(LMatrix4)); EXTENSION(INLINE_LINMATH PyObject *__reduce__(PyObject *self) const); diff --git a/panda/src/mathutil/config_mathutil.cxx b/panda/src/mathutil/config_mathutil.cxx index 2084b2b670..bb10014f0c 100644 --- a/panda/src/mathutil/config_mathutil.cxx +++ b/panda/src/mathutil/config_mathutil.cxx @@ -26,7 +26,7 @@ #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_MATHUTIL) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_MATHUTIL) #error Buildsystem error: BUILDING_PANDA_MATHUTIL not defined #endif diff --git a/panda/src/movies/config_movies.cxx b/panda/src/movies/config_movies.cxx index 93448cfe8d..f6e889b6e8 100644 --- a/panda/src/movies/config_movies.cxx +++ b/panda/src/movies/config_movies.cxx @@ -32,7 +32,7 @@ #include "wavAudio.h" #include "wavAudioCursor.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_MOVIES) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_MOVIES) #error Buildsystem error: BUILDING_PANDA_MOVIES not defined #endif diff --git a/panda/src/nativenet/config_nativenet.cxx b/panda/src/nativenet/config_nativenet.cxx index 172e56afa8..f90e106e81 100644 --- a/panda/src/nativenet/config_nativenet.cxx +++ b/panda/src/nativenet/config_nativenet.cxx @@ -26,7 +26,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_NATIVENET) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_NATIVENET) #error Buildsystem error: BUILDING_PANDA_NATIVENET not defined #endif diff --git a/panda/src/net/config_net.cxx b/panda/src/net/config_net.cxx index 80af80147a..753a5beb53 100644 --- a/panda/src/net/config_net.cxx +++ b/panda/src/net/config_net.cxx @@ -18,7 +18,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_NET) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_NET) #error Buildsystem error: BUILDING_PANDA_NET not defined #endif diff --git a/panda/src/ode/config_ode.cxx b/panda/src/ode/config_ode.cxx index 214281d579..a87bb6922e 100644 --- a/panda/src/ode/config_ode.cxx +++ b/panda/src/ode/config_ode.cxx @@ -47,7 +47,7 @@ #include "odeCollisionEntry.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDAODE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAODE) #error Buildsystem error: BUILDING_PANDAODE not defined #endif diff --git a/panda/src/osxdisplay/config_osxdisplay.cxx b/panda/src/osxdisplay/config_osxdisplay.cxx index 43f897b862..0ebc9454bd 100644 --- a/panda/src/osxdisplay/config_osxdisplay.cxx +++ b/panda/src/osxdisplay/config_osxdisplay.cxx @@ -20,7 +20,7 @@ #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_OSXDISPLAY) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_OSXDISPLAY) #error Buildsystem error: BUILDING_PANDA_OSXDISPLAY not defined #endif diff --git a/panda/src/parametrics/config_parametrics.cxx b/panda/src/parametrics/config_parametrics.cxx index 2b07e493bd..0ab86efcf7 100644 --- a/panda/src/parametrics/config_parametrics.cxx +++ b/panda/src/parametrics/config_parametrics.cxx @@ -22,7 +22,7 @@ #include "ropeNode.h" #include "sheetNode.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PARAMETRICS) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PARAMETRICS) #error Buildsystem error: BUILDING_PANDA_PARAMETRICS not defined #endif diff --git a/panda/src/particlesystem/config_particlesystem.cxx b/panda/src/particlesystem/config_particlesystem.cxx index 61f1224ea4..92f19c8f15 100644 --- a/panda/src/particlesystem/config_particlesystem.cxx +++ b/panda/src/particlesystem/config_particlesystem.cxx @@ -16,7 +16,7 @@ #include "geomParticleRenderer.h" #include "geomNode.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PARTICLESYSTEM) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PARTICLESYSTEM) #error Buildsystem error: BUILDING_PANDA_PARTICLESYSTEM not defined #endif diff --git a/panda/src/pgraph/config_pgraph.cxx b/panda/src/pgraph/config_pgraph.cxx index 54fa621f7b..e969dee72f 100644 --- a/panda/src/pgraph/config_pgraph.cxx +++ b/panda/src/pgraph/config_pgraph.cxx @@ -92,7 +92,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PGRAPH) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PGRAPH) #error Buildsystem error: BUILDING_PANDA_PGRAPH not defined #endif diff --git a/panda/src/pgraph/cullableObject.cxx b/panda/src/pgraph/cullableObject.cxx index dae73b00ed..920e524659 100644 --- a/panda/src/pgraph/cullableObject.cxx +++ b/panda/src/pgraph/cullableObject.cxx @@ -90,6 +90,15 @@ munge_geom(GraphicsStateGuardianBase *gsg, GeomMunger *munger, geom_rendering = _internal_transform->get_geom_rendering(geom_rendering); unsupported_bits = geom_rendering & ~gsg_bits; + if (unsupported_bits & Geom::GR_per_point_size) { + // If we have a shader that processes the point size, we can assume it + // does the right thing. + const ShaderAttrib *sattr; + if (_state->get_attrib(sattr) && sattr->get_flag(ShaderAttrib::F_shader_point_size)) { + unsupported_bits &= ~Geom::GR_per_point_size; + } + } + if (geom_rendering & Geom::GR_point_bits) { if (geom_reader.get_primitive_type() != Geom::PT_points) { if (singular_points || diff --git a/panda/src/pgraph/geomNode.cxx b/panda/src/pgraph/geomNode.cxx index 328870364a..16e95442c2 100644 --- a/panda/src/pgraph/geomNode.cxx +++ b/panda/src/pgraph/geomNode.cxx @@ -115,7 +115,6 @@ apply_attribs_to_vertices(const AccumulatedAttribs &attribs, int attrib_types, Thread *current_thread = Thread::get_current_thread(); OPEN_ITERATE_CURRENT_AND_UPSTREAM(_cycler, current_thread) { CDStageWriter cdata(_cycler, pipeline_stage, current_thread); - GeomList::iterator gi; PT(GeomList) geoms = cdata->modify_geoms(); // Iterate based on the number of geoms, not using STL iterators. This diff --git a/panda/src/pgraph/geomTransformer.cxx b/panda/src/pgraph/geomTransformer.cxx index cfc023b528..fe6b022d2d 100644 --- a/panda/src/pgraph/geomTransformer.cxx +++ b/panda/src/pgraph/geomTransformer.cxx @@ -742,7 +742,6 @@ make_compatible_state(GeomNode *node) { } GeomNode::CDWriter cdata(node->_cycler); - GeomNode::GeomList::iterator gi; PT(GeomNode::GeomList) geoms = cdata->modify_geoms(); // For each geom, calculate a canonicalized RenderState, and classify all diff --git a/panda/src/pgraphnodes/config_pgraphnodes.cxx b/panda/src/pgraphnodes/config_pgraphnodes.cxx index 3879a980b3..309605b201 100644 --- a/panda/src/pgraphnodes/config_pgraphnodes.cxx +++ b/panda/src/pgraphnodes/config_pgraphnodes.cxx @@ -37,7 +37,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PGRAPHNODES) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PGRAPHNODES) #error Buildsystem error: BUILDING_PANDA_PGRAPHNODES not defined #endif diff --git a/panda/src/pgui/config_pgui.cxx b/panda/src/pgui/config_pgui.cxx index c2c3e72405..bb334756e3 100644 --- a/panda/src/pgui/config_pgui.cxx +++ b/panda/src/pgui/config_pgui.cxx @@ -28,7 +28,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PGUI) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PGUI) #error Buildsystem error: BUILDING_PANDA_PGUI not defined #endif diff --git a/panda/src/physics/config_physics.cxx b/panda/src/physics/config_physics.cxx index b4ad867f66..b952dae04f 100644 --- a/panda/src/physics/config_physics.cxx +++ b/panda/src/physics/config_physics.cxx @@ -26,7 +26,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PHYSICS) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PHYSICS) #error Buildsystem error: BUILDING_PANDA_PHYSICS not defined #endif diff --git a/panda/src/physx/config_physx.cxx b/panda/src/physx/config_physx.cxx index 4880e37e88..6a1b421eaf 100644 --- a/panda/src/physx/config_physx.cxx +++ b/panda/src/physx/config_physx.cxx @@ -67,7 +67,7 @@ #include "physxWheel.h" #include "physxWheelShape.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDAPHYSX) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAPHYSX) #error Buildsystem error: BUILDING_PANDAPHYSX not defined #endif diff --git a/panda/src/pipeline/config_pipeline.cxx b/panda/src/pipeline/config_pipeline.cxx index 60f077688f..2e7bf6487e 100644 --- a/panda/src/pipeline/config_pipeline.cxx +++ b/panda/src/pipeline/config_pipeline.cxx @@ -21,7 +21,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PIPELINE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PIPELINE) #error Buildsystem error: BUILDING_PANDA_PIPELINE not defined #endif diff --git a/panda/src/pipeline/thread.cxx b/panda/src/pipeline/thread.cxx index 351e316033..80c32fa7f5 100644 --- a/panda/src/pipeline/thread.cxx +++ b/panda/src/pipeline/thread.cxx @@ -211,6 +211,7 @@ init_main_thread() { static int count = 0; ++count; if (count == 1 && _main_thread == nullptr) { + init_memory_hook(); _main_thread = new MainThread; _main_thread->ref(); } @@ -222,6 +223,7 @@ init_main_thread() { void Thread:: init_external_thread() { if (_external_thread == nullptr) { + init_memory_hook(); _external_thread = new ExternalThread; _external_thread->ref(); } diff --git a/panda/src/pnmimage/config_pnmimage.cxx b/panda/src/pnmimage/config_pnmimage.cxx index 5bb734cf85..7bafe9fb09 100644 --- a/panda/src/pnmimage/config_pnmimage.cxx +++ b/panda/src/pnmimage/config_pnmimage.cxx @@ -17,7 +17,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PNMIMAGE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PNMIMAGE) #error Buildsystem error: BUILDING_PANDA_PNMIMAGE not defined #endif diff --git a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx index 551c351c43..bf70c56d1f 100644 --- a/panda/src/pnmimagetypes/config_pnmimagetypes.cxx +++ b/panda/src/pnmimagetypes/config_pnmimagetypes.cxx @@ -32,7 +32,7 @@ #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PNMIMAGETYPES) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PNMIMAGETYPES) #error Buildsystem error: BUILDING_PANDA_PNMIMAGETYPES not defined #endif diff --git a/panda/src/pnmtext/config_pnmtext.cxx b/panda/src/pnmtext/config_pnmtext.cxx index a0a627aca7..a653fac26f 100644 --- a/panda/src/pnmtext/config_pnmtext.cxx +++ b/panda/src/pnmtext/config_pnmtext.cxx @@ -16,7 +16,7 @@ #include "dconfig.h" #include "freetypeFace.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PNMTEXT) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PNMTEXT) #error Buildsystem error: BUILDING_PANDA_PNMTEXT not defined #endif diff --git a/panda/src/pstatclient/config_pstatclient.cxx b/panda/src/pstatclient/config_pstatclient.cxx index 4be7472441..1335254590 100644 --- a/panda/src/pstatclient/config_pstatclient.cxx +++ b/panda/src/pstatclient/config_pstatclient.cxx @@ -15,7 +15,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PSTATCLIENT) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PSTATCLIENT) #error Buildsystem error: BUILDING_PANDA_PSTATCLIENT not defined #endif diff --git a/panda/src/putil/bitMask.h b/panda/src/putil/bitMask.h index cb11fe10bf..ca5c9d8362 100644 --- a/panda/src/putil/bitMask.h +++ b/panda/src/putil/bitMask.h @@ -37,7 +37,7 @@ PUBLISHED: enum { num_bits = nbits }; constexpr BitMask() = default; - constexpr BitMask(WordType init_value); + ALWAYS_INLINE constexpr BitMask(WordType init_value); INLINE static BitMask all_on(); INLINE static BitMask all_off(); diff --git a/panda/src/putil/config_putil.cxx b/panda/src/putil/config_putil.cxx index c3083f306f..593da51fd0 100644 --- a/panda/src/putil/config_putil.cxx +++ b/panda/src/putil/config_putil.cxx @@ -47,7 +47,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_PUTIL) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_PUTIL) #error Buildsystem error: BUILDING_PANDA_PUTIL not defined #endif diff --git a/panda/src/recorder/config_recorder.cxx b/panda/src/recorder/config_recorder.cxx index 97335e17cd..c24e320391 100644 --- a/panda/src/recorder/config_recorder.cxx +++ b/panda/src/recorder/config_recorder.cxx @@ -22,7 +22,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_RECORDER) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_RECORDER) #error Buildsystem error: BUILDING_PANDA_RECORDER not defined #endif diff --git a/panda/src/recorder/socketStreamRecorder.cxx b/panda/src/recorder/socketStreamRecorder.cxx index 5ee6168d44..8418485b20 100644 --- a/panda/src/recorder/socketStreamRecorder.cxx +++ b/panda/src/recorder/socketStreamRecorder.cxx @@ -82,10 +82,7 @@ play_frame(DatagramIterator &scan, BamReader *manager) { int num_packets = scan.get_uint16(); for (int i = 0; i < num_packets; i++) { - size_t size = scan.get_uint16(); - vector_uchar packet(size); - scan.extract_bytes(&packet[0], size); - _data.push_back(Datagram(std::move(packet))); + _data.push_back(Datagram(scan.get_blob())); } } diff --git a/panda/src/rocket/config_rocket.cxx b/panda/src/rocket/config_rocket.cxx index 4de7bf3e28..61b5c634e2 100644 --- a/panda/src/rocket/config_rocket.cxx +++ b/panda/src/rocket/config_rocket.cxx @@ -26,7 +26,7 @@ #include #undef Factory -#if !defined(CPPPARSER) && !defined(BUILDING_ROCKET) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_ROCKET) #error Buildsystem error: BUILDING_ROCKET not defined #endif diff --git a/panda/src/skel/config_skel.cxx b/panda/src/skel/config_skel.cxx index 5fa6f6595c..dd6e808502 100644 --- a/panda/src/skel/config_skel.cxx +++ b/panda/src/skel/config_skel.cxx @@ -16,7 +16,7 @@ #include "typedSkel.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDASKEL) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDASKEL) #error Buildsystem error: BUILDING_PANDASKEL not defined #endif diff --git a/panda/src/speedtree/config_speedtree.cxx b/panda/src/speedtree/config_speedtree.cxx index f820239665..dfc4d455c6 100644 --- a/panda/src/speedtree/config_speedtree.cxx +++ b/panda/src/speedtree/config_speedtree.cxx @@ -21,7 +21,7 @@ #include "loaderFileTypeRegistry.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDASPEEDTREE) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDASPEEDTREE) #error Buildsystem error: BUILDING_PANDASPEEDTREE not defined #endif diff --git a/panda/src/text/config_text.cxx b/panda/src/text/config_text.cxx index 77dd27beba..dee79539ba 100644 --- a/panda/src/text/config_text.cxx +++ b/panda/src/text/config_text.cxx @@ -27,7 +27,7 @@ #include "dconfig.h" #include "config_express.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_TEXT) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_TEXT) #error Buildsystem error: BUILDING_PANDA_TEXT not defined #endif diff --git a/panda/src/text/dynamicTextFont.cxx b/panda/src/text/dynamicTextFont.cxx index 4eb4afc96a..347841a92f 100644 --- a/panda/src/text/dynamicTextFont.cxx +++ b/panda/src/text/dynamicTextFont.cxx @@ -1072,7 +1072,6 @@ render_polygon_contours(TextGlyph *glyph, bool face, bool extrude) { // create more vertices--they don't share the same normals. for (ci = _contours.begin(); ci != _contours.end(); ++ci) { const Contour &contour = (*ci); - Points::const_iterator pi; for (size_t i = 0; i < contour._points.size(); ++i) { const ContourPoint &cp = contour._points[i]; diff --git a/panda/src/tform/config_tform.cxx b/panda/src/tform/config_tform.cxx index b8a578d07c..6620e5724c 100644 --- a/panda/src/tform/config_tform.cxx +++ b/panda/src/tform/config_tform.cxx @@ -25,7 +25,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_TFORM) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_TFORM) #error Buildsystem error: BUILDING_PANDA_TFORM not defined #endif diff --git a/panda/src/tinydisplay/config_tinydisplay.cxx b/panda/src/tinydisplay/config_tinydisplay.cxx index 31ef112ee5..9740001c01 100644 --- a/panda/src/tinydisplay/config_tinydisplay.cxx +++ b/panda/src/tinydisplay/config_tinydisplay.cxx @@ -29,7 +29,7 @@ #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_TINYDISPLAY) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_TINYDISPLAY) #error Buildsystem error: BUILDING_TINYDISPLAY not defined #endif diff --git a/panda/src/vision/config_vision.cxx b/panda/src/vision/config_vision.cxx index ffe3719962..4b4eee02f8 100644 --- a/panda/src/vision/config_vision.cxx +++ b/panda/src/vision/config_vision.cxx @@ -23,7 +23,7 @@ #include "texturePool.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_VISION) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_VISION) #error Buildsystem error: BUILDING_VISION not defined #endif diff --git a/panda/src/vrpn/config_vrpn.cxx b/panda/src/vrpn/config_vrpn.cxx index cc577bd328..54ac23f565 100644 --- a/panda/src/vrpn/config_vrpn.cxx +++ b/panda/src/vrpn/config_vrpn.cxx @@ -21,7 +21,7 @@ #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_VRPN) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_VRPN) #error Buildsystem error: BUILDING_VRPN not defined #endif diff --git a/panda/src/wgldisplay/config_wgldisplay.cxx b/panda/src/wgldisplay/config_wgldisplay.cxx index fa04606dca..63d40fdea8 100644 --- a/panda/src/wgldisplay/config_wgldisplay.cxx +++ b/panda/src/wgldisplay/config_wgldisplay.cxx @@ -20,7 +20,7 @@ #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDA_WGLDISPLAY) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_WGLDISPLAY) #error Buildsystem error: BUILDING_PANDA_WGLDISPLAY not defined #endif diff --git a/panda/src/windisplay/config_windisplay.cxx b/panda/src/windisplay/config_windisplay.cxx index 1af5cf95da..6e0ea2406d 100644 --- a/panda/src/windisplay/config_windisplay.cxx +++ b/panda/src/windisplay/config_windisplay.cxx @@ -16,7 +16,7 @@ #include "winGraphicsWindow.h" #include "dconfig.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDAWIN) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAWIN) #error Buildsystem error: BUILDING_PANDAWIN not defined #endif diff --git a/panda/src/x11display/config_x11display.cxx b/panda/src/x11display/config_x11display.cxx index bca59d5a17..4a633303ba 100644 --- a/panda/src/x11display/config_x11display.cxx +++ b/panda/src/x11display/config_x11display.cxx @@ -18,7 +18,7 @@ #include "dconfig.h" #include "pandaSystem.h" -#if !defined(CPPPARSER) && !defined(BUILDING_PANDAX11) +#if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAX11) #error Buildsystem error: BUILDING_PANDAX11 not defined #endif diff --git a/pandatool/src/mayaegg/mayaEggLoader.cxx b/pandatool/src/mayaegg/mayaEggLoader.cxx index 4baf1dff86..68fcb8d0f7 100644 --- a/pandatool/src/mayaegg/mayaEggLoader.cxx +++ b/pandatool/src/mayaegg/mayaEggLoader.cxx @@ -837,12 +837,12 @@ int MayaEggGeom::GetVert(EggVertex *vert, EggGroup *context) void MayaEggGeom::AssignNames(void) { string name = _pool->get_name(); - int nsize = name.size(); - if ((nsize > 6) && (name.rfind(".verts")==(nsize-6))) { - name.resize(nsize-6); + size_t nsize = name.size(); + if (nsize > 6 && name.rfind(".verts") == (nsize - 6)) { + name.resize(nsize - 6); } - if ((nsize > 4) && (name.rfind(".cvs")==(nsize-4))) { - name.resize(nsize-4); + if (nsize > 4 && name.rfind(".cvs") == (nsize - 4)) { + name.resize(nsize - 4); } MFnDependencyNode dnshape(_shapeNode); @@ -913,7 +913,7 @@ void MayaEggGeom::AddEggFlag(MString fieldName) { typedef phash_map TVertTable; typedef phash_map CVertTable; -class MayaEggMesh : public MayaEggGeom +class MayaEggMesh final : public MayaEggGeom { public: MColorArray _faceColorArray; @@ -937,7 +937,7 @@ public: int GetCVert(const LColor &col); int AddFace(unsigned numVertices, MIntArray mvertIndices, MIntArray mtvertIndices, MayaEggTex *tex); - void ConnectTextures(void); + void ConnectTextures(void) override; }; int MayaEggMesh::GetTVert(const LTexCoordd &uv) @@ -2012,7 +2012,7 @@ void MayaEggLoader::PrintData(MayaEggMesh *mesh) void MayaEggLoader::ParseFrameInfo(string comment) { - int pos, ls, le; + size_t pos, ls, le; pos = comment.find("-fri"); if (pos != string::npos) { @@ -2143,7 +2143,7 @@ bool MayaEggLoader::ConvertEggFile(const char *name, bool merge, bool model, boo MObject MayaEggLoader::GetDependencyNode(string givenName) { MObject node = MObject::kNullObj; - int pos; + size_t pos; string name; pos = givenName.find(":"); diff --git a/pandatool/src/mayaegg/mayaToEggConverter.cxx b/pandatool/src/mayaegg/mayaToEggConverter.cxx index 747c8ac279..3f693dd004 100644 --- a/pandatool/src/mayaegg/mayaToEggConverter.cxx +++ b/pandatool/src/mayaegg/mayaToEggConverter.cxx @@ -2742,7 +2742,7 @@ set_shader_legacy(EggPrimitive &primitive, const MayaShader &shader, // shader on the list is the base one, which should always pick up // the alpha from the texture file. But the top textures may have // to strip the alpha - if (i!=shader._color.size()-1) { + if ((size_t)i != shader._color.size() - 1) { if (!i && is_interpolate) { // this is the grass path mode where alpha on this texture // determines whether to show layer1 or layer2. Since by now @@ -2846,7 +2846,7 @@ set_shader_legacy(EggPrimitive &primitive, const MayaShader &shader, _textures.create_unique_texture(tex, ~0); if (mesh) { - if (uvset_name.find("not found") == -1) { + if (uvset_name.find("not found") == string::npos) { primitive.add_texture(new_tex); color_def->_uvset_name.assign(uvset_name.c_str()); if (uvset_name != "map1") { diff --git a/tests/egg2pg/test_egg_coordsys.py b/tests/egg2pg/test_egg_coordsys.py index b3c5583075..1c014ebf46 100644 --- a/tests/egg2pg/test_egg_coordsys.py +++ b/tests/egg2pg/test_egg_coordsys.py @@ -37,7 +37,8 @@ def test_egg2pg_transform_ident(egg_coordsys, coordsys): @pytest.mark.parametrize("coordsys", COORD_SYSTEMS) def test_egg2pg_transform_mat_unchanged(coordsys): # Ensures that the matrix remains unchanged if coordinate system is same. - mat = (5, 2, -3, 4, 5, 6, 7, 8, 9, 1, -3, 2, 5, 2, 5, 2) + matv = (5, 2, -3, 4, 5, 6, 7, 8, 9, 1, -3, 2, 5, 2, 5, 2) + mat = core.Mat4D(*matv) group = egg.EggGroup("group") group.add_matrix4(mat) assert not group.transform_is_identity() @@ -57,7 +58,7 @@ def test_egg2pg_transform_mat_unchanged(coordsys): assert root node, = root.children - assert node.transform.mat == mat + assert node.transform.mat == core.Mat4(*matv) @pytest.mark.parametrize("egg_coordsys", COORD_SYSTEMS) diff --git a/tests/gobj/test_texture.py b/tests/gobj/test_texture.py index 8fa0ed27c8..4bf917a8c2 100644 --- a/tests/gobj/test_texture.py +++ b/tests/gobj/test_texture.py @@ -1,5 +1,6 @@ -from panda3d.core import Texture, PNMImage +from panda3d.core import Texture, PNMImage, LColor from array import array +import math def image_from_stored_pixel(component_type, format, data): @@ -15,6 +16,20 @@ def image_from_stored_pixel(component_type, format, data): return img +def peek_tex_with_clear_color(component_type, format, clear_color): + """ Creates a 1-pixel texture with the given settings and clear color, + then peeks the value at this pixel and returns it. """ + + tex = Texture("") + tex.setup_1d_texture(1, component_type, format) + tex.set_clear_color(clear_color) + tex.make_ram_image() + + col = LColor() + tex.peek().fetch_pixel(col, 0, 0) + return col + + def test_texture_store_unsigned_byte(): data = array('B', (2, 1, 0, 0xff)) img = image_from_stored_pixel(Texture.T_unsigned_byte, Texture.F_rgba, data) @@ -88,3 +103,34 @@ def test_texture_store_srgb_alpha(): assert img.maxval == 0xff col = img.get_xel_a(0, 0) assert col.almost_equal((0.5, 0.5, 0.5, 188 / 255.0), 1 / 255.0) + + +def test_texture_clear_unsigned_byte(): + col = peek_tex_with_clear_color(Texture.T_unsigned_byte, Texture.F_rgba, (0, 1 / 255.0, 254 / 255.0, 1.0)) + assert col == LColor(0, 1 / 255.0, 254 / 255.0, 1.0) + + +def test_texture_clear_float(): + col = peek_tex_with_clear_color(Texture.T_float, Texture.F_rgba, (0, 0.25, -0.5, 2)) + assert col == LColor(0, 0.25, -0.5, 2) + + +def test_texture_clear_half(): + col = peek_tex_with_clear_color(Texture.T_half_float, Texture.F_rgba, (0, 0.25, -0.5, 2)) + assert col == LColor(0, 0.25, -0.5, 2) + + # Test edge cases + inf = float('inf') + nan = float('nan') + col = peek_tex_with_clear_color(Texture.T_half_float, Texture.F_rgba, (65504, 65536, inf, nan)) + assert col.x == 65504 + assert col.y == inf + assert col.z == inf + assert math.isnan(col.w) + + # Negative edge case + col = peek_tex_with_clear_color(Texture.T_half_float, Texture.F_rgba, (-65504, -65536, -inf, -nan)) + assert col.x == -65504 + assert col.y == -inf + assert col.z == -inf + assert math.isnan(col.w) diff --git a/tests/gobj/test_texture_pool.py b/tests/gobj/test_texture_pool.py index b07e8a0cb9..c8ac5ae44a 100644 --- a/tests/gobj/test_texture_pool.py +++ b/tests/gobj/test_texture_pool.py @@ -22,8 +22,10 @@ def image_rgb_path(): "Generates an RGB image." file = tempfile.NamedTemporaryFile(suffix='-rgb.png') - write_image(file.name, 3) - yield file.name + path = core.Filename.from_os_specific(file.name) + path.make_true_case() + write_image(path, 3) + yield path file.close() @@ -32,8 +34,10 @@ def image_rgba_path(): "Generates an RGBA image." file = tempfile.NamedTemporaryFile(suffix='-rgba.png') - write_image(file.name, 4) - yield file.name + path = core.Filename.from_os_specific(file.name) + path.make_true_case() + write_image(path, 4) + yield path file.close() @@ -42,8 +46,10 @@ def image_gray_path(): "Generates a grayscale image." file = tempfile.NamedTemporaryFile(suffix='-gray.png') - write_image(file.name, 1) - yield file.name + path = core.Filename.from_os_specific(file.name) + path.make_true_case() + write_image(path, 1) + yield path file.close() diff --git a/tests/linmath/test_lmatrix3.py b/tests/linmath/test_lmatrix3.py new file mode 100644 index 0000000000..b0ce53685a --- /dev/null +++ b/tests/linmath/test_lmatrix3.py @@ -0,0 +1,62 @@ +import pytest +from copy import copy +from panda3d import core + + +def test_mat3_aliases(): + assert core.LMatrix3 is core.Mat3 + assert core.LMatrix3f is core.Mat3F + assert core.LMatrix3d is core.Mat3D + + assert (core.LMatrix3f is core.Mat3) != (core.LMatrix3d is core.Mat3) + + +@pytest.mark.parametrize("type", (core.LMatrix3f, core.LMatrix3d)) +def test_mat3_constructor(type): + # Test that three ways of construction produce the same matrix. + mat1 = type((1, 2, 3), + (4, 5, 6), + (7, 8, 9)) + + mat2 = type(1, 2, 3, 4, 5, 6, 7, 8, 9) + + mat3 = type((1, 2, 3, 4, 5, 6, 7, 8, 9)) + + assert mat1 == mat2 + assert mat2 == mat3 + assert mat1 == mat3 + + +@pytest.mark.parametrize("type", (core.LMatrix3d, core.LMatrix3f)) +def test_mat3_copy_constuctor(type): + mat1 = type((1, 2, 3), + (4, 5, 6), + (7, 8, 9)) + + # Make a copy. Changing it should not change the original. + mat2 = type(mat1) + assert mat1 == mat2 + mat2[0][0] = 100 + assert mat1 != mat2 + + # Make a copy by unpacking. + mat2 = type(*mat1) + assert mat1 == mat2 + mat2[0][0] = 100 + assert mat1 != mat2 + + # Make a copy by calling copy.copy. + mat2 = copy(mat1) + assert mat1 == mat2 + mat2[0][0] = 100 + assert mat1 != mat2 + + +@pytest.mark.parametrize("type", (core.LMatrix3d, core.LMatrix3f)) +def test_mat3_invert_same_type(type): + mat = type((1, 0, 0, + 0, 1, 0, + 1, 2, 3)) + + inv = core.invert(mat) + assert mat.__class__ == inv.__class__ diff --git a/tests/linmath/test_lmatrix4.py b/tests/linmath/test_lmatrix4.py new file mode 100644 index 0000000000..23c1bcc5e9 --- /dev/null +++ b/tests/linmath/test_lmatrix4.py @@ -0,0 +1,89 @@ +import pytest +from copy import copy +from panda3d import core + + +def test_mat4_aliases(): + assert core.LMatrix4 is core.Mat4 + assert core.LMatrix4f is core.Mat4F + assert core.LMatrix4d is core.Mat4D + + assert (core.LMatrix4f is core.Mat4) != (core.LMatrix4d is core.Mat4) + + +@pytest.mark.parametrize("type", (core.LMatrix4d, core.LMatrix4f)) +def test_mat4_constructor(type): + # Test that three ways of construction produce the same matrix. + mat1 = type((1, 2, 3, 4), + (5, 6, 7, 8), + (9, 10, 11, 12), + (13, 14, 15, 16)) + + mat2 = type(1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16) + + mat3 = type((1, 2, 3, 4, + 5, 6, 7, 8, + 9, 10, 11, 12, + 13, 14, 15, 16)) + + assert mat1 == mat2 + assert mat2 == mat3 + assert mat1 == mat3 + + +@pytest.mark.parametrize("type", (core.LMatrix4d, core.LMatrix4f)) +def test_mat4_copy_constuctor(type): + mat1 = type((1, 2, 3, 4), + (5, 6, 7, 8), + (9, 10, 11, 12), + (13, 14, 15, 16)) + + # Make a copy. Changing it should not change the original. + mat2 = type(mat1) + assert mat1 == mat2 + mat2[0][0] = 100 + assert mat1 != mat2 + + # Make a copy by unpacking. + mat2 = type(*mat1) + assert mat1 == mat2 + mat2[0][0] = 100 + assert mat1 != mat2 + + # Make a copy by calling copy.copy. + mat2 = copy(mat1) + assert mat1 == mat2 + mat2[0][0] = 100 + assert mat1 != mat2 + + +@pytest.mark.parametrize("type", (core.LMatrix4d, core.LMatrix4f)) +def test_mat4_invert_same_type(type): + mat = type((1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1)) + + inv = core.invert(mat) + assert mat.__class__ == inv.__class__ + + +@pytest.mark.parametrize("type", (core.LMatrix4d, core.LMatrix4f)) +def test_mat4_invert_correct(type): + mat = type((1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 2, 3, 1)) + inv = type() + assert inv.invert_from(mat) + + assert inv == type(( 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + -1, -2, -3, 1)) + + assert (mat * inv).is_identity() + assert (inv * mat).is_identity() diff --git a/tests/linmath/test_matrix_invert.py b/tests/linmath/test_matrix_invert.py deleted file mode 100644 index b2e6dd49bf..0000000000 --- a/tests/linmath/test_matrix_invert.py +++ /dev/null @@ -1,20 +0,0 @@ -import pytest -from panda3d import core - - -@pytest.mark.parametrize("type", (core.Mat4, core.Mat4D)) -def test_mat4_invert(type): - mat = type((1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 2, 3, 1)) - inv = type() - assert inv.invert_from(mat) - - assert inv == type(( 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - -1, -2, -3, 1)) - - assert (mat * inv).is_identity() - assert (inv * mat).is_identity() diff --git a/tests/putil/test_datagram.py b/tests/putil/test_datagram.py index 171363109a..5a654b75ed 100644 --- a/tests/putil/test_datagram.py +++ b/tests/putil/test_datagram.py @@ -1,6 +1,7 @@ import pytest from panda3d import core import sys +import tempfile # Fixtures for generating interesting datagrams (and verification functions) on # the fly... @@ -28,6 +29,9 @@ def datagram_small(request): dg.add_string32('this is another string') dg.add_string('this is yet a third string') + dg.add_blob(b'blob data \x00\xf2\xa0\x00\x00') + dg.add_blob32(b'\xc9\x8f\x00 test blob32') + dg.add_stdfloat(800.2) dg.add_stdfloat(3.1415926) dg.add_stdfloat(2.7182818) @@ -49,6 +53,9 @@ def datagram_small(request): assert dgi.get_string32() == 'this is another string' assert dgi.get_string() == 'this is yet a third string' + assert dgi.get_blob() == b'blob data \x00\xf2\xa0\x00\x00' + assert dgi.get_blob32() == b'\xc9\x8f\x00 test blob32' + assert dgi.get_stdfloat() == pytest.approx(800.2) assert dgi.get_stdfloat() == pytest.approx(3.1415926) assert dgi.get_stdfloat() == pytest.approx(2.7182818) @@ -88,6 +95,12 @@ def test_datagram_bytes(): dgi.get_remaining_bytes() == b'abc\x00\xff123' +def test_datagram_get_message(): + dg = core.Datagram(b'abc\x00') + dg.append_data(b'\xff123') + assert dg.get_message() == b'abc\x00\xff123' + + def test_iterator(datagram_small): """This tests Datagram/DatagramIterator, and sort of serves as a self-check of the test fixtures too.""" @@ -135,30 +148,33 @@ def do_file_test(dg, verify, filename): dgi = core.DatagramIterator(dg2) verify(dgi) -def test_file_small(datagram_small, tmpdir): +def test_file_small(datagram_small): """This tests DatagramOutputFile/DatagramInputFile on small datagrams.""" dg, verify = datagram_small - p = tmpdir.join('datagram.bin') - filename = core.Filename.from_os_specific(str(p)) + file = tempfile.NamedTemporaryFile(suffix='.bin') + filename = core.Filename.from_os_specific(file.name) + filename.make_true_case() do_file_test(dg, verify, filename) -def test_file_large(datagram_large, tmpdir): +def test_file_large(datagram_large): """This tests DatagramOutputFile/DatagramInputFile on very large datagrams.""" dg, verify = datagram_large - p = tmpdir.join('datagram.bin') - filename = core.Filename.from_os_specific(str(p)) + file = tempfile.NamedTemporaryFile(suffix='.bin') + filename = core.Filename.from_os_specific(file.name) + filename.make_true_case() do_file_test(dg, verify, filename) -def test_file_corrupt(datagram_small, tmpdir): +def test_file_corrupt(datagram_small): """This tests DatagramInputFile's handling of a corrupt size header.""" dg, verify = datagram_small - p = tmpdir.join('datagram.bin') - filename = core.Filename.from_os_specific(str(p)) + file = tempfile.NamedTemporaryFile(suffix='.bin') + filename = core.Filename.from_os_specific(file.name) + filename.make_true_case() dof = core.DatagramOutputFile() dof.open(filename) @@ -166,9 +182,9 @@ def test_file_corrupt(datagram_small, tmpdir): dof.close() # Corrupt the size header to 1GB - with p.open(mode='r+b') as f: - f.seek(0) - f.write(b'\xFF\xFF\xFF\x4F') + file.seek(0) + file.write(b'\xFF\xFF\xFF\x4F') + file.flush() dg2 = core.Datagram() dif = core.DatagramInputFile() @@ -178,8 +194,7 @@ def test_file_corrupt(datagram_small, tmpdir): # Truncate the file for size in [12, 8, 4, 3, 2, 1, 0]: - with p.open(mode='r+b') as f: - f.truncate(size) + file.truncate(size) dg2 = core.Datagram() dif = core.DatagramInputFile()