*** empty log message ***

This commit is contained in:
Mike Goslin 2000-10-05 02:43:08 +00:00
parent f8533164b9
commit fb650026ae
15 changed files with 53 additions and 45 deletions

View File

@ -1,4 +1,4 @@
#define OTHER_LIBS interrogatedb dconfig dtoolutil dtoolbase #define OTHER_LIBS dtool
#begin lib_target #begin lib_target
#define TARGET audio #define TARGET audio

View File

@ -42,7 +42,7 @@ AnimControl(PartBundle *part, AnimBundle *anim, int channel_index) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void AnimControl:: void AnimControl::
play(const CPT_Event &stop_event) { play(const CPT_Event &stop_event) {
assert(get_num_frames() > 0); nassertv(get_num_frames() > 0);
if (get_play_rate() < 0.0) { if (get_play_rate() < 0.0) {
play(get_num_frames()-1, 0, stop_event); play(get_num_frames()-1, 0, stop_event);
@ -64,10 +64,10 @@ play(const CPT_Event &stop_event) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void AnimControl:: void AnimControl::
play(int from, int to, const CPT_Event &stop_event) { 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()); nassertv(from >= 0 && from < get_num_frames());
assert(to >= 0 && to < get_num_frames()); nassertv(to >= 0 && to < get_num_frames());
_as_of_time = ClockObject::get_global_clock()->get_time(); _as_of_time = ClockObject::get_global_clock()->get_time();
_playing = true; _playing = true;
@ -90,7 +90,7 @@ play(int from, int to, const CPT_Event &stop_event) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void AnimControl:: void AnimControl::
loop(bool restart) { loop(bool restart) {
assert(get_num_frames() > 0); nassertv(get_num_frames() > 0);
_as_of_time = ClockObject::get_global_clock()->get_time(); _as_of_time = ClockObject::get_global_clock()->get_time();
_playing = true; _playing = true;
@ -118,10 +118,10 @@ loop(bool restart) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void AnimControl:: void AnimControl::
loop(bool restart, int from, int to) { loop(bool restart, int from, int to) {
assert(get_num_frames() > 0); nassertv(get_num_frames() > 0);
assert(from >= 0 && from < get_num_frames()); nassertv(from >= 0 && from < get_num_frames());
assert(to >= 0 && to < get_num_frames()); nassertv(to >= 0 && to < get_num_frames());
_as_of_time = ClockObject::get_global_clock()->get_time(); _as_of_time = ClockObject::get_global_clock()->get_time();
_playing = true; _playing = true;
@ -194,9 +194,9 @@ stop() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void AnimControl:: void AnimControl::
pose(int frame) { 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(); _as_of_time = ClockObject::get_global_clock()->get_time();
_playing = false; _playing = false;
@ -267,7 +267,7 @@ remove_event(const string &event_name) {
new_actions.insert(*ai); new_actions.insert(*ai);
} }
} }
assert(p_removed == removed); nassertr(p_removed == removed, removed);
_actions.swap(new_actions); _actions.swap(new_actions);
} }
} }

View File

@ -27,7 +27,7 @@ TypeHandle AnimGroup::_type_handle;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
AnimGroup:: AnimGroup::
AnimGroup(AnimGroup *parent, const string &name) : Namable(name) { AnimGroup(AnimGroup *parent, const string &name) : Namable(name) {
assert(parent != NULL); nassertv(parent != NULL);
parent->_children.push_back(this); parent->_children.push_back(this);
_root = parent->_root; _root = parent->_root;
@ -52,7 +52,7 @@ get_num_children() const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
AnimGroup *AnimGroup:: AnimGroup *AnimGroup::
get_child(int n) const { get_child(int n) const {
assert(n >= 0 && n < _children.size()); nassertr(n >= 0 && n < _children.size(), NULL);
return _children[n]; return _children[n];
} }

View File

@ -67,9 +67,9 @@ do_update(PartBundle *root, PartGroup *parent,
++bci) { ++bci) {
AnimControl *control = (*bci); AnimControl *control = (*bci);
int channel_index = control->get_channel_index(); 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]; AnimChannelBase *channel = _channels[channel_index];
assert(channel != (AnimChannelBase*)0L); nassertv(channel != (AnimChannelBase*)0L);
needs_update = control->channel_has_changed(channel); needs_update = control->channel_has_changed(channel);
} }
@ -123,7 +123,7 @@ pick_channel_index(list<int> &holes, int &next) const {
++ii_next; ++ii_next;
int hole = (*ii); int hole = (*ii);
assert(hole >= 0 && hole < next); nassertv(hole >= 0 && hole < next);
if (hole < _channels.size() || if (hole < _channels.size() ||
_channels[hole] != (AnimChannelBase *)NULL) { _channels[hole] != (AnimChannelBase *)NULL) {
// We can't accept this hole; we're using it! // 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); _channels.push_back((AnimChannelBase*)0L);
} }
assert(_channels[channel_index] == (AnimChannelBase*)0L); nassertv(_channels[channel_index] == (AnimChannelBase*)0L);
if (anim == (AnimGroup*)0L) { if (anim == (AnimGroup*)0L) {
// If we're binding to the NULL anim, it means actually to create // If we're binding to the NULL anim, it means actually to create

View File

@ -38,9 +38,9 @@ get_blend_value(const PartBundle *root) {
AnimControl *control = (*blend.begin()).first; AnimControl *control = (*blend.begin()).first;
int channel_index = control->get_channel_index(); 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]); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]);
assert(channel != NULL); nassertv(channel != NULL);
channel->get_value(control->get_frame(), _value); 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) { for (cbi = blend.begin(); cbi != blend.end(); ++cbi) {
AnimControl *control = (*cbi).first; AnimControl *control = (*cbi).first;
float effect = (*cbi).second; float effect = (*cbi).second;
assert(effect != 0.0); nassertv(effect != 0.0);
int channel_index = control->get_channel_index(); 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]); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]);
assert(channel != NULL); nassertv(channel != NULL);
ValueType v; ValueType v;
channel->get_value(control->get_frame(), v); channel->get_value(control->get_frame(), v);
@ -70,7 +70,7 @@ get_blend_value(const PartBundle *root) {
net += effect; net += effect;
} }
assert(net != 0.0); nassertv(net != 0.0);
_value /= net; _value /= net;
} else if (root->get_blend_type() == PartBundle::BT_normalized_linear) { } 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) { for (cbi = blend.begin(); cbi != blend.end(); ++cbi) {
AnimControl *control = (*cbi).first; AnimControl *control = (*cbi).first;
float effect = (*cbi).second; float effect = (*cbi).second;
assert(effect != 0.0); nassertv(effect != 0.0);
int channel_index = control->get_channel_index(); 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]); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]);
assert(channel != NULL); nassertv(channel != NULL);
ValueType v; ValueType v;
channel->get_value_no_scale(control->get_frame(), v); channel->get_value_no_scale(control->get_frame(), v);
@ -104,7 +104,7 @@ get_blend_value(const PartBundle *root) {
net += effect; net += effect;
} }
assert(net != 0.0); nassertv(net != 0.0);
_value /= net; _value /= net;
scale /= net; scale /= net;

View File

@ -36,9 +36,9 @@ get_blend_value(const PartBundle *root) {
AnimControl *control = (*blend.begin()).first; AnimControl *control = (*blend.begin()).first;
int channel_index = control->get_channel_index(); 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]); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]);
assert(channel != NULL); nassertv(channel != NULL);
channel->get_value(control->get_frame(), _value); 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) { for (cbi = blend.begin(); cbi != blend.end(); ++cbi) {
AnimControl *control = (*cbi).first; AnimControl *control = (*cbi).first;
float effect = (*cbi).second; float effect = (*cbi).second;
assert(effect != 0.0); nassertv(effect != 0.0);
int channel_index = control->get_channel_index(); 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]); ChannelType *channel = DCAST(ChannelType, _channels[channel_index]);
assert(channel != NULL); nassertv(channel != NULL);
ValueType v; ValueType v;
channel->get_value(control->get_frame(), v); channel->get_value(control->get_frame(), v);
@ -65,7 +65,7 @@ get_blend_value(const PartBundle *root) {
net += effect; net += effect;
} }
assert(net != 0.0); nassertv(net != 0.0);
_value /= net; _value /= net;
} }
} }

View File

@ -145,7 +145,7 @@ clear_control_effects() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void PartBundle:: void PartBundle::
set_control_effect(AnimControl *control, float effect) { set_control_effect(AnimControl *control, float effect) {
assert(control->get_part() == this); nassertv(control->get_part() == this);
if (effect == 0.0) { if (effect == 0.0) {
// An effect of zero means to eliminate the control. // An effect of zero means to eliminate the control.
@ -184,7 +184,7 @@ set_control_effect(AnimControl *control, float effect) {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
float PartBundle:: float PartBundle::
get_control_effect(AnimControl *control) { get_control_effect(AnimControl *control) {
assert(control->get_part() == this); nassertr(control->get_part() == this, 0.0);
ChannelBlend::iterator cbi = _blend.find(control); ChannelBlend::iterator cbi = _blend.find(control);
if (cbi == _blend.end()) { if (cbi == _blend.end()) {
@ -355,7 +355,7 @@ update() {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void PartBundle:: void PartBundle::
control_activated(AnimControl *control) { 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 // If (and only if) our blend type is BT_single, which means no
// blending, then starting an animation implicitly enables it. // blending, then starting an animation implicitly enables it.

View File

@ -26,7 +26,7 @@ TypeHandle PartGroup::_type_handle;
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
PartGroup:: PartGroup::
PartGroup(PartGroup *parent, const string &name) : Namable(name) { PartGroup(PartGroup *parent, const string &name) : Namable(name) {
assert(parent != NULL); nassertv(parent != NULL);
parent->_children.push_back(this); parent->_children.push_back(this);
} }
@ -94,7 +94,7 @@ get_num_children() const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
PartGroup *PartGroup:: PartGroup *PartGroup::
get_child(int n) const { get_child(int n) const {
assert(n >= 0 && n < _children.size()); nassertr(n >= 0 && n < _children.size(), NULL);
return _children[n]; return _children[n];
} }

View File

@ -75,7 +75,7 @@ make_copy() const {
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void CharacterJoint:: void CharacterJoint::
update_internals(PartGroup *parent, bool self_changed, bool) { update_internals(PartGroup *parent, bool self_changed, bool) {
assert(parent != NULL); nassertv(parent != NULL);
bool net_changed = false; bool net_changed = false;
if (parent->is_of_type(CharacterJoint::get_class_type())) { if (parent->is_of_type(CharacterJoint::get_class_type())) {

View File

@ -150,7 +150,7 @@ void CollisionNode::
recompute_bound() { recompute_bound() {
// First, get ourselves a fresh, empty bounding volume. // First, get ourselves a fresh, empty bounding volume.
BoundedObject::recompute_bound(); BoundedObject::recompute_bound();
assert(_bound != (BoundingVolume *)NULL); nassertv(_bound != (BoundingVolume *)NULL);
// Now actually compute the bounding volume by putting it around all // Now actually compute the bounding volume by putting it around all
// of our solids' bounding volumes. // of our solids' bounding volumes.

View File

@ -1,5 +1,9 @@
#include <pandabase.h> #include <pandabase.h>
#ifndef HAVE_GETOPT
#include <gnu_getopt.h>
#else
#include <getopt.h> #include <getopt.h>
#endif
#include <patchfile.h> #include <patchfile.h>
#include <filename.h> #include <filename.h>

View File

@ -10,6 +10,8 @@
#include "fog.h" #include "fog.h"
#include <mathNumbers.h>
#include <stddef.h> #include <stddef.h>
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
@ -71,12 +73,12 @@ void Fog::compute_density(void) {
break; break;
case M_exponential: case M_exponential:
// Multiplier = ln(2^bits) // Multiplier = ln(2^bits)
opaque_multiplier = M_LN2 * _hardware_bits; opaque_multiplier = MathNumbers::ln2 * _hardware_bits;
_density = opaque_multiplier / (_opaque + _opaque_offset); _density = opaque_multiplier / (_opaque + _opaque_offset);
break; break;
case M_super_exponential: case M_super_exponential:
// Multiplier = ln(squrt(2^bits)) // 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; opaque_multiplier *= opaque_multiplier;
_density = opaque_multiplier / (_opaque + _opaque_offset); _density = opaque_multiplier / (_opaque + _opaque_offset);
break; break;

View File

@ -7,3 +7,4 @@
#include <math.h> #include <math.h>
const double MathNumbers::pi = 4.0 * atan(1); const double MathNumbers::pi = 4.0 * atan(1);
const double MathNumbers::ln2 = log(2);

View File

@ -11,6 +11,7 @@
class EXPCL_PANDA MathNumbers { class EXPCL_PANDA MathNumbers {
public: public:
static const double pi; static const double pi;
static const double ln2;
}; };
#endif #endif

View File

@ -44,7 +44,7 @@ void RenderRelation::
recompute_bound() { recompute_bound() {
// First, compute the bounding volume around all of our children. // First, compute the bounding volume around all of our children.
NodeRelation::recompute_bound(); NodeRelation::recompute_bound();
assert(_bound != (BoundingVolume *)NULL); nassertv(_bound != (BoundingVolume *)NULL);
// Now, if we have a transform transition on the arc, apply it to // Now, if we have a transform transition on the arc, apply it to
// the bounding volume. // the bounding volume.