diff --git a/panda/src/audio/Sources.pp b/panda/src/audio/Sources.pp index b7e2e5fc5c..148ce6ec93 100644 --- a/panda/src/audio/Sources.pp +++ b/panda/src/audio/Sources.pp @@ -1,4 +1,4 @@ -#define OTHER_LIBS interrogatedb dconfig dtoolutil dtoolbase +#define OTHER_LIBS dtool #begin lib_target #define TARGET audio diff --git a/panda/src/chan/animControl.cxx b/panda/src/chan/animControl.cxx index 25bd512ed5..4adf01bf4c 100644 --- a/panda/src/chan/animControl.cxx +++ b/panda/src/chan/animControl.cxx @@ -42,7 +42,7 @@ AnimControl(PartBundle *part, AnimBundle *anim, int channel_index) { //////////////////////////////////////////////////////////////////// void AnimControl:: play(const CPT_Event &stop_event) { - assert(get_num_frames() > 0); + nassertv(get_num_frames() > 0); if (get_play_rate() < 0.0) { play(get_num_frames()-1, 0, stop_event); @@ -64,10 +64,10 @@ play(const CPT_Event &stop_event) { //////////////////////////////////////////////////////////////////// void AnimControl:: play(int from, int to, const CPT_Event &stop_event) { - assert(get_num_frames() > 0); + nassertv(get_num_frames() > 0); - assert(from >= 0 && from < get_num_frames()); - assert(to >= 0 && to < get_num_frames()); + nassertv(from >= 0 && from < get_num_frames()); + nassertv(to >= 0 && to < get_num_frames()); _as_of_time = ClockObject::get_global_clock()->get_time(); _playing = true; @@ -90,7 +90,7 @@ play(int from, int to, const CPT_Event &stop_event) { //////////////////////////////////////////////////////////////////// void AnimControl:: loop(bool restart) { - assert(get_num_frames() > 0); + nassertv(get_num_frames() > 0); _as_of_time = ClockObject::get_global_clock()->get_time(); _playing = true; @@ -118,10 +118,10 @@ loop(bool restart) { //////////////////////////////////////////////////////////////////// void AnimControl:: loop(bool restart, int from, int to) { - assert(get_num_frames() > 0); + nassertv(get_num_frames() > 0); - assert(from >= 0 && from < get_num_frames()); - assert(to >= 0 && to < get_num_frames()); + nassertv(from >= 0 && from < get_num_frames()); + nassertv(to >= 0 && to < get_num_frames()); _as_of_time = ClockObject::get_global_clock()->get_time(); _playing = true; @@ -194,9 +194,9 @@ stop() { //////////////////////////////////////////////////////////////////// void AnimControl:: pose(int frame) { - assert(get_num_frames() > 0); + nassertv(get_num_frames() > 0); - assert(frame >= 0 && frame < get_num_frames()); + nassertv(frame >= 0 && frame < get_num_frames()); _as_of_time = ClockObject::get_global_clock()->get_time(); _playing = false; @@ -267,7 +267,7 @@ remove_event(const string &event_name) { new_actions.insert(*ai); } } - assert(p_removed == removed); + nassertr(p_removed == removed, removed); _actions.swap(new_actions); } } diff --git a/panda/src/chan/animGroup.cxx b/panda/src/chan/animGroup.cxx index 242d75c03c..ae0463a9da 100644 --- a/panda/src/chan/animGroup.cxx +++ b/panda/src/chan/animGroup.cxx @@ -27,7 +27,7 @@ TypeHandle AnimGroup::_type_handle; //////////////////////////////////////////////////////////////////// AnimGroup:: AnimGroup(AnimGroup *parent, const string &name) : Namable(name) { - assert(parent != NULL); + nassertv(parent != NULL); parent->_children.push_back(this); _root = parent->_root; @@ -52,7 +52,7 @@ get_num_children() const { //////////////////////////////////////////////////////////////////// AnimGroup *AnimGroup:: get_child(int n) const { - assert(n >= 0 && n < _children.size()); + nassertr(n >= 0 && n < _children.size(), NULL); return _children[n]; } diff --git a/panda/src/chan/movingPartBase.cxx b/panda/src/chan/movingPartBase.cxx index 95b5b7ce64..cd9f739810 100644 --- a/panda/src/chan/movingPartBase.cxx +++ b/panda/src/chan/movingPartBase.cxx @@ -67,9 +67,9 @@ do_update(PartBundle *root, PartGroup *parent, ++bci) { AnimControl *control = (*bci); int channel_index = control->get_channel_index(); - assert(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < _channels.size()); AnimChannelBase *channel = _channels[channel_index]; - assert(channel != (AnimChannelBase*)0L); + nassertv(channel != (AnimChannelBase*)0L); needs_update = control->channel_has_changed(channel); } @@ -123,7 +123,7 @@ pick_channel_index(list &holes, int &next) const { ++ii_next; int hole = (*ii); - assert(hole >= 0 && hole < next); + nassertv(hole >= 0 && hole < next); if (hole < _channels.size() || _channels[hole] != (AnimChannelBase *)NULL) { // We can't accept this hole; we're using it! @@ -161,7 +161,7 @@ bind_hierarchy(AnimGroup *anim, int channel_index) { _channels.push_back((AnimChannelBase*)0L); } - assert(_channels[channel_index] == (AnimChannelBase*)0L); + nassertv(_channels[channel_index] == (AnimChannelBase*)0L); if (anim == (AnimGroup*)0L) { // If we're binding to the NULL anim, it means actually to create diff --git a/panda/src/chan/movingPartMatrix.cxx b/panda/src/chan/movingPartMatrix.cxx index eb9002cfac..c24f36d8ea 100644 --- a/panda/src/chan/movingPartMatrix.cxx +++ b/panda/src/chan/movingPartMatrix.cxx @@ -38,9 +38,9 @@ get_blend_value(const PartBundle *root) { AnimControl *control = (*blend.begin()).first; int channel_index = control->get_channel_index(); - assert(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < _channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); - assert(channel != NULL); + nassertv(channel != NULL); channel->get_value(control->get_frame(), _value); @@ -56,12 +56,12 @@ get_blend_value(const PartBundle *root) { for (cbi = blend.begin(); cbi != blend.end(); ++cbi) { AnimControl *control = (*cbi).first; float effect = (*cbi).second; - assert(effect != 0.0); + nassertv(effect != 0.0); int channel_index = control->get_channel_index(); - assert(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < _channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); - assert(channel != NULL); + nassertv(channel != NULL); ValueType v; channel->get_value(control->get_frame(), v); @@ -70,7 +70,7 @@ get_blend_value(const PartBundle *root) { net += effect; } - assert(net != 0.0); + nassertv(net != 0.0); _value /= net; } else if (root->get_blend_type() == PartBundle::BT_normalized_linear) { @@ -87,12 +87,12 @@ get_blend_value(const PartBundle *root) { for (cbi = blend.begin(); cbi != blend.end(); ++cbi) { AnimControl *control = (*cbi).first; float effect = (*cbi).second; - assert(effect != 0.0); + nassertv(effect != 0.0); int channel_index = control->get_channel_index(); - assert(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < _channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); - assert(channel != NULL); + nassertv(channel != NULL); ValueType v; channel->get_value_no_scale(control->get_frame(), v); @@ -104,7 +104,7 @@ get_blend_value(const PartBundle *root) { net += effect; } - assert(net != 0.0); + nassertv(net != 0.0); _value /= net; scale /= net; diff --git a/panda/src/chan/movingPartScalar.cxx b/panda/src/chan/movingPartScalar.cxx index ebd03be39d..5335c7b4f7 100644 --- a/panda/src/chan/movingPartScalar.cxx +++ b/panda/src/chan/movingPartScalar.cxx @@ -36,9 +36,9 @@ get_blend_value(const PartBundle *root) { AnimControl *control = (*blend.begin()).first; int channel_index = control->get_channel_index(); - assert(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < _channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); - assert(channel != NULL); + nassertv(channel != NULL); channel->get_value(control->get_frame(), _value); @@ -51,12 +51,12 @@ get_blend_value(const PartBundle *root) { for (cbi = blend.begin(); cbi != blend.end(); ++cbi) { AnimControl *control = (*cbi).first; float effect = (*cbi).second; - assert(effect != 0.0); + nassertv(effect != 0.0); int channel_index = control->get_channel_index(); - assert(channel_index >= 0 && channel_index < _channels.size()); + nassertv(channel_index >= 0 && channel_index < _channels.size()); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]); - assert(channel != NULL); + nassertv(channel != NULL); ValueType v; channel->get_value(control->get_frame(), v); @@ -65,7 +65,7 @@ get_blend_value(const PartBundle *root) { net += effect; } - assert(net != 0.0); + nassertv(net != 0.0); _value /= net; } } diff --git a/panda/src/chan/partBundle.cxx b/panda/src/chan/partBundle.cxx index 19ef18d31a..614c75faf5 100644 --- a/panda/src/chan/partBundle.cxx +++ b/panda/src/chan/partBundle.cxx @@ -145,7 +145,7 @@ clear_control_effects() { //////////////////////////////////////////////////////////////////// void PartBundle:: set_control_effect(AnimControl *control, float effect) { - assert(control->get_part() == this); + nassertv(control->get_part() == this); if (effect == 0.0) { // An effect of zero means to eliminate the control. @@ -184,7 +184,7 @@ set_control_effect(AnimControl *control, float effect) { //////////////////////////////////////////////////////////////////// float PartBundle:: get_control_effect(AnimControl *control) { - assert(control->get_part() == this); + nassertr(control->get_part() == this, 0.0); ChannelBlend::iterator cbi = _blend.find(control); if (cbi == _blend.end()) { @@ -355,7 +355,7 @@ update() { //////////////////////////////////////////////////////////////////// void PartBundle:: control_activated(AnimControl *control) { - assert(control->get_part() == this); + nassertv(control->get_part() == this); // If (and only if) our blend type is BT_single, which means no // blending, then starting an animation implicitly enables it. diff --git a/panda/src/chan/partGroup.cxx b/panda/src/chan/partGroup.cxx index 2d5342fd2f..a6e7302f54 100644 --- a/panda/src/chan/partGroup.cxx +++ b/panda/src/chan/partGroup.cxx @@ -26,7 +26,7 @@ TypeHandle PartGroup::_type_handle; //////////////////////////////////////////////////////////////////// PartGroup:: PartGroup(PartGroup *parent, const string &name) : Namable(name) { - assert(parent != NULL); + nassertv(parent != NULL); parent->_children.push_back(this); } @@ -94,7 +94,7 @@ get_num_children() const { //////////////////////////////////////////////////////////////////// PartGroup *PartGroup:: get_child(int n) const { - assert(n >= 0 && n < _children.size()); + nassertr(n >= 0 && n < _children.size(), NULL); return _children[n]; } diff --git a/panda/src/char/characterJoint.cxx b/panda/src/char/characterJoint.cxx index 8b88fa6f72..f94bbdda53 100644 --- a/panda/src/char/characterJoint.cxx +++ b/panda/src/char/characterJoint.cxx @@ -75,7 +75,7 @@ make_copy() const { //////////////////////////////////////////////////////////////////// void CharacterJoint:: update_internals(PartGroup *parent, bool self_changed, bool) { - assert(parent != NULL); + nassertv(parent != NULL); bool net_changed = false; if (parent->is_of_type(CharacterJoint::get_class_type())) { diff --git a/panda/src/collide/collisionNode.cxx b/panda/src/collide/collisionNode.cxx index b5c1b3521b..c1082dfaef 100644 --- a/panda/src/collide/collisionNode.cxx +++ b/panda/src/collide/collisionNode.cxx @@ -150,7 +150,7 @@ void CollisionNode:: recompute_bound() { // First, get ourselves a fresh, empty bounding volume. BoundedObject::recompute_bound(); - assert(_bound != (BoundingVolume *)NULL); + nassertv(_bound != (BoundingVolume *)NULL); // Now actually compute the bounding volume by putting it around all // of our solids' bounding volumes. diff --git a/panda/src/downloadertools/apply_patch.cxx b/panda/src/downloadertools/apply_patch.cxx index 59b1e0d3c0..c7acff9d4b 100644 --- a/panda/src/downloadertools/apply_patch.cxx +++ b/panda/src/downloadertools/apply_patch.cxx @@ -1,5 +1,9 @@ #include -#include +#ifndef HAVE_GETOPT + #include +#else + #include +#endif #include #include diff --git a/panda/src/gobj/fog.cxx b/panda/src/gobj/fog.cxx index ae4786fd12..f3a8c03f6a 100644 --- a/panda/src/gobj/fog.cxx +++ b/panda/src/gobj/fog.cxx @@ -10,6 +10,8 @@ #include "fog.h" +#include + #include //////////////////////////////////////////////////////////////////// @@ -71,12 +73,12 @@ void Fog::compute_density(void) { break; case M_exponential: // Multiplier = ln(2^bits) - opaque_multiplier = M_LN2 * _hardware_bits; + opaque_multiplier = MathNumbers::ln2 * _hardware_bits; _density = opaque_multiplier / (_opaque + _opaque_offset); break; case M_super_exponential: // Multiplier = ln(squrt(2^bits)) - opaque_multiplier = 0.5f * M_LN2 * _hardware_bits; + opaque_multiplier = 0.5f * MathNumbers::ln2 * _hardware_bits; opaque_multiplier *= opaque_multiplier; _density = opaque_multiplier / (_opaque + _opaque_offset); break; diff --git a/panda/src/linmath/mathNumbers.cxx b/panda/src/linmath/mathNumbers.cxx index f018d450b8..1788a6e080 100644 --- a/panda/src/linmath/mathNumbers.cxx +++ b/panda/src/linmath/mathNumbers.cxx @@ -7,3 +7,4 @@ #include const double MathNumbers::pi = 4.0 * atan(1); +const double MathNumbers::ln2 = log(2); diff --git a/panda/src/linmath/mathNumbers.h b/panda/src/linmath/mathNumbers.h index ead5515629..07182e2686 100644 --- a/panda/src/linmath/mathNumbers.h +++ b/panda/src/linmath/mathNumbers.h @@ -11,6 +11,7 @@ class EXPCL_PANDA MathNumbers { public: static const double pi; + static const double ln2; }; #endif diff --git a/panda/src/sgattrib/renderRelation.cxx b/panda/src/sgattrib/renderRelation.cxx index d1fa5b2ff0..7a31ffd688 100644 --- a/panda/src/sgattrib/renderRelation.cxx +++ b/panda/src/sgattrib/renderRelation.cxx @@ -44,7 +44,7 @@ void RenderRelation:: recompute_bound() { // First, compute the bounding volume around all of our children. NodeRelation::recompute_bound(); - assert(_bound != (BoundingVolume *)NULL); + nassertv(_bound != (BoundingVolume *)NULL); // Now, if we have a transform transition on the arc, apply it to // the bounding volume.