diff --git a/panda/src/display/frameBufferProperties.I b/panda/src/display/frameBufferProperties.I index 6f2d3257ee..70c809c64b 100644 --- a/panda/src/display/frameBufferProperties.I +++ b/panda/src/display/frameBufferProperties.I @@ -11,21 +11,6 @@ * @date 2003-01-27 */ -/** - * - */ -INLINE FrameBufferProperties:: -FrameBufferProperties(const FrameBufferProperties ©) { - (*this) = copy; -} - -/** - * - */ -INLINE FrameBufferProperties:: -~FrameBufferProperties() { -} - /** * */ diff --git a/panda/src/display/frameBufferProperties.cxx b/panda/src/display/frameBufferProperties.cxx index ea37cc4381..81d12a98ba 100644 --- a/panda/src/display/frameBufferProperties.cxx +++ b/panda/src/display/frameBufferProperties.cxx @@ -17,28 +17,6 @@ #include "config_display.h" #include "texture.h" -/** - * - */ -FrameBufferProperties:: -FrameBufferProperties() { - clear(); -} - -/** - * - */ -void FrameBufferProperties:: -operator = (const FrameBufferProperties ©) { - _flags_specified = copy._flags_specified; - _flags = copy._flags; - _specified = copy._specified; - - for (int i = 0; i < FBP_COUNT; ++i) { - _property[i] = copy._property[i]; - } -} - /** * Returns true if this set of properties makes strictly greater or equal * demands of the framebuffer than the other set of framebuffer properties. diff --git a/panda/src/display/frameBufferProperties.h b/panda/src/display/frameBufferProperties.h index 9ac6c015ea..67e0c50d1e 100644 --- a/panda/src/display/frameBufferProperties.h +++ b/panda/src/display/frameBufferProperties.h @@ -63,11 +63,11 @@ private: FBF_all = 0x100-1, }; - int _property[FBP_COUNT]; - int _specified; + int _property[FBP_COUNT] = {0}; + int _specified = 0; - int _flags; - int _flags_specified; + int _flags = 0; + int _flags_specified = 0; PUBLISHED: @@ -145,10 +145,8 @@ PUBLISHED: // Other. - FrameBufferProperties(); - INLINE FrameBufferProperties(const FrameBufferProperties ©); - INLINE ~FrameBufferProperties(); - void operator = (const FrameBufferProperties ©); + constexpr FrameBufferProperties() = default; + static const FrameBufferProperties &get_default(); bool operator == (const FrameBufferProperties &other) const; INLINE bool operator != (const FrameBufferProperties &other) const; diff --git a/panda/src/egg/eggParameters.cxx b/panda/src/egg/eggParameters.cxx index 14b63ba8ea..b9fc709fcd 100644 --- a/panda/src/egg/eggParameters.cxx +++ b/panda/src/egg/eggParameters.cxx @@ -17,26 +17,3 @@ static EggParameters default_egg_parameters; EggParameters *egg_parameters = &default_egg_parameters; - - -/** - * Initializes all the parameters with default values. - */ -EggParameters:: -EggParameters() { - _pos_threshold = 0.0001; - _normal_threshold = 0.0001; - _uv_threshold = 0.0001; - _color_threshold = 1.0/256.0; - - _table_threshold = 0.0001; -} - - -/** - * - */ -EggParameters:: -EggParameters(const EggParameters &other) { - memcpy(this, &other, sizeof(EggParameters)); -} diff --git a/panda/src/egg/eggParameters.h b/panda/src/egg/eggParameters.h index 36bd1e48f6..93b1aff8b0 100644 --- a/panda/src/egg/eggParameters.h +++ b/panda/src/egg/eggParameters.h @@ -31,28 +31,27 @@ */ class EXPCL_PANDAEGG EggParameters { public: - EggParameters(); - EggParameters(const EggParameters ©); + constexpr EggParameters() = default; // The per-component difference below which two vertices are deemed to be at // the same position. - double _pos_threshold; + double _pos_threshold = 0.0001; // The per-component difference below which two vertices are deemed to have // the same normal. - double _normal_threshold; + double _normal_threshold = 0.0001; // The per-component difference below which two vertices are deemed to have // the same texture coordinates. - double _uv_threshold; + double _uv_threshold = 0.0001; // The per-component difference below which two vertices are deemed to have // the same color. - PN_stdfloat _color_threshold; + PN_stdfloat _color_threshold = 1.0/256.0; // The per-component difference below which two anim table values are deemed // to be equivalent. - double _table_threshold; + double _table_threshold = 0.0001; }; extern EXPCL_PANDAEGG EggParameters *egg_parameters; diff --git a/panda/src/pgraph/cacheStats.I b/panda/src/pgraph/cacheStats.I index a83e480757..e84ff83878 100644 --- a/panda/src/pgraph/cacheStats.I +++ b/panda/src/pgraph/cacheStats.I @@ -17,7 +17,7 @@ INLINE void CacheStats:: maybe_report(const char *name) { #ifndef NDEBUG - if (_cache_report) { + if (UNLIKELY(_cache_report)) { double now = ClockObject::get_global_clock()->get_real_time(); if (now - _last_reset < _cache_report_interval) { return; diff --git a/panda/src/pgraph/cacheStats.cxx b/panda/src/pgraph/cacheStats.cxx index 88a5498384..e16c14801e 100644 --- a/panda/src/pgraph/cacheStats.cxx +++ b/panda/src/pgraph/cacheStats.cxx @@ -22,10 +22,7 @@ void CacheStats:: init() { #ifndef NDEBUG // Let's not use the clock at static init time. - reset(0.0); - // reset(ClockObject::get_global_clock()->get_real_time()); - _total_cache_size = 0; - _num_states = 0; + //reset(ClockObject::get_global_clock()->get_real_time()); _cache_report = ConfigVariableBool("cache-report", false); _cache_report_interval = ConfigVariableDouble("cache-report-interval", 5.0); diff --git a/panda/src/pgraph/cacheStats.h b/panda/src/pgraph/cacheStats.h index 45fb1e6043..12707c4bf0 100644 --- a/panda/src/pgraph/cacheStats.h +++ b/panda/src/pgraph/cacheStats.h @@ -24,6 +24,7 @@ */ class EXPCL_PANDA_PGRAPH CacheStats { public: + constexpr CacheStats() = default; void init(); void reset(double now); void write(ostream &out, const char *name) const; @@ -38,17 +39,17 @@ public: private: #ifndef NDEBUG - int _cache_hits; - int _cache_misses; - int _cache_adds; - int _cache_new_adds; - int _cache_dels; - int _total_cache_size; - int _num_states; - double _last_reset; + int _cache_hits = 0; + int _cache_misses = 0; + int _cache_adds = 0; + int _cache_new_adds = 0; + int _cache_dels = 0; + int _total_cache_size = 0; + int _num_states = 0; + double _last_reset = 0.0; - bool _cache_report; - double _cache_report_interval; + bool _cache_report = false; + double _cache_report_interval = 0.0; #endif // NDEBUG }; diff --git a/panda/src/pgraph/nodePath.I b/panda/src/pgraph/nodePath.I index 8860fff331..74bcc01bd9 100644 --- a/panda/src/pgraph/nodePath.I +++ b/panda/src/pgraph/nodePath.I @@ -16,9 +16,9 @@ */ INLINE NodePath:: NodePath() : - _error_type(ET_ok) + _error_type(ET_ok), + _backup_key(0) { - _backup_key = 0; } /** diff --git a/panda/src/putil/loaderOptions.I b/panda/src/putil/loaderOptions.I index b15780c847..6e407e7840 100644 --- a/panda/src/putil/loaderOptions.I +++ b/panda/src/putil/loaderOptions.I @@ -14,7 +14,7 @@ /** * */ -INLINE LoaderOptions:: +constexpr LoaderOptions:: LoaderOptions(int flags, int texture_flags) : _flags(flags), _texture_flags(texture_flags), @@ -23,29 +23,6 @@ LoaderOptions(int flags, int texture_flags) : { } -/** - * - */ -INLINE LoaderOptions:: -LoaderOptions(const LoaderOptions ©) : - _flags(copy._flags), - _texture_flags(copy._texture_flags), - _texture_num_views(copy._texture_num_views), - _auto_texture_scale(copy._auto_texture_scale) -{ -} - -/** - * - */ -INLINE void LoaderOptions:: -operator = (const LoaderOptions ©) { - _flags = copy._flags; - _texture_flags = copy._texture_flags; - _texture_num_views = copy._texture_num_views; - _auto_texture_scale = copy._auto_texture_scale; -} - /** * */ diff --git a/panda/src/putil/loaderOptions.h b/panda/src/putil/loaderOptions.h index 50c73f983e..971353e723 100644 --- a/panda/src/putil/loaderOptions.h +++ b/panda/src/putil/loaderOptions.h @@ -49,9 +49,7 @@ PUBLISHED: }; LoaderOptions(int flags = LF_search | LF_report_errors); - INLINE LoaderOptions(int flags, int texture_flags); - INLINE LoaderOptions(const LoaderOptions ©); - INLINE void operator = (const LoaderOptions ©); + constexpr LoaderOptions(int flags, int texture_flags); INLINE void set_flags(int flags); INLINE int get_flags() const;