const dbl->flt
This commit is contained in:
parent
89ef606bfd
commit
126dc1eebd
|
|
@ -27,7 +27,7 @@ bool audio_active
|
|||
=config_audio.GetBool("audio-active", true);
|
||||
|
||||
float audio_volume
|
||||
=config_audio.GetFloat("audio-volume", 1.0);
|
||||
=config_audio.GetFloat("audio-volume", 1.0f);
|
||||
|
||||
bool audio_software_midi
|
||||
=config_audio.GetBool("audio-software-midi", false);
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ MilesAudioSound::
|
|||
MilesAudioSound(MilesAudioManager* manager,
|
||||
HAUDIO audio, string file_name, float length)
|
||||
: _manager(manager), _file_name(file_name),
|
||||
_start_time(0), _volume(1.0), _balance(0),
|
||||
_start_time(0), _volume(1.0f), _balance(0),
|
||||
_loop_count(1), _length(length),
|
||||
_active(true), _paused(false) {
|
||||
nassertv(audio);
|
||||
|
|
@ -167,7 +167,7 @@ set_volume(float volume) {
|
|||
} else {
|
||||
// ...it's a wav or mp3.
|
||||
// Convert balance of -1.0..1.0 to 0..127:
|
||||
S32 milesBalance=((S32)(63.5*(_balance+1.0)))%128;
|
||||
S32 milesBalance=((S32)(63.5f*(_balance+1.0f)))%128;
|
||||
AIL_quick_set_volume(_audio, milesVolume, milesBalance);
|
||||
audio_debug(" volume for this wav or mp3 is now "<<milesVolume
|
||||
<<", balance="<<milesBalance);
|
||||
|
|
@ -230,7 +230,7 @@ get_balance() const {
|
|||
float MilesAudioSound::
|
||||
length() const {
|
||||
if (!_length) {
|
||||
_length=((float)AIL_quick_ms_length(_audio))*0.001;
|
||||
_length=((float)AIL_quick_ms_length(_audio))*0.001f;
|
||||
}
|
||||
miles_audio_debug("length() returning "<<_length);
|
||||
return _length;
|
||||
|
|
|
|||
|
|
@ -96,9 +96,9 @@ get_value_no_scale(int frame, ValueType &value) {
|
|||
template<class SwitchType>
|
||||
void AnimChannel<SwitchType>::
|
||||
get_scale(int, float scale[3]) {
|
||||
scale[0] = 1.0;
|
||||
scale[1] = 1.0;
|
||||
scale[2] = 1.0;
|
||||
scale[0] = 1.0f;
|
||||
scale[1] = 1.0f;
|
||||
scale[2] = 1.0f;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ void ACMatrixSwitchType::
|
|||
output_value(ostream &out, const ACMatrixSwitchType::ValueType &value) {
|
||||
LVecBase3f scale, hpr, translate;
|
||||
if (decompose_matrix(value, scale, hpr, translate)) {
|
||||
if (!scale.almost_equal(LVecBase3f(1.0, 1.0, 1.0))) {
|
||||
if (!scale.almost_equal(LVecBase3f(1.0f,1.0f,1.0f))) {
|
||||
if (IS_NEARLY_EQUAL(scale[0], scale[1]) &&
|
||||
IS_NEARLY_EQUAL(scale[1], scale[2])) {
|
||||
out << " scale " << scale[0];
|
||||
|
|
@ -44,11 +44,11 @@ output_value(ostream &out, const ACMatrixSwitchType::ValueType &value) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!hpr.almost_equal(LVecBase3f(0.0, 0.0, 0.0))) {
|
||||
if (!hpr.almost_equal(LVecBase3f(0.0f, 0.0f, 0.0f))) {
|
||||
out << " hpr " << hpr;
|
||||
}
|
||||
|
||||
if (!translate.almost_equal(LVecBase3f(0.0, 0.0, 0.0))) {
|
||||
if (!translate.almost_equal(LVecBase3f(0.0f, 0.0f, 0.0f))) {
|
||||
out << " trans " << translate;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ has_changed(int last_frame, int this_frame) {
|
|||
void AnimChannelScalarTable::
|
||||
get_value(int frame, float &value) {
|
||||
if (_table.empty()) {
|
||||
value = 0.0;
|
||||
value = 0.0f;
|
||||
} else {
|
||||
value = _table[frame % _table.size()];
|
||||
}
|
||||
|
|
@ -156,14 +156,14 @@ write_datagram(BamWriter *manager, Datagram &me)
|
|||
// only to the nearest 1000th for this purpose, because floats
|
||||
// aren't very good at being precisely equal to each other.
|
||||
static const int max_values = 16;
|
||||
static const float scale = 1000.0;
|
||||
static const float scale = 1000.0f;
|
||||
|
||||
pmap<int, int> index;
|
||||
int i;
|
||||
for (i = 0;
|
||||
i < (int)_table.size() && (int)index.size() <= max_values;
|
||||
i++) {
|
||||
int value = (int)floor(_table[i] * scale + 0.5);
|
||||
int value = (int)floor(_table[i] * scale + 0.5f);
|
||||
index.insert(pmap<int, int>::value_type(value, index.size()));
|
||||
}
|
||||
int index_length = index.size();
|
||||
|
|
@ -200,8 +200,8 @@ write_datagram(BamWriter *manager, Datagram &me)
|
|||
|
||||
} else {
|
||||
for (i = 0; i < table_length - 1; i+= 2) {
|
||||
int value1 = (int)floor(_table[i] * scale + 0.5);
|
||||
int value2 = (int)floor(_table[i + 1] * scale + 0.5);
|
||||
int value1 = (int)floor(_table[i] * scale + 0.5f);
|
||||
int value2 = (int)floor(_table[i + 1] * scale + 0.5f);
|
||||
int i1 = index[value1];
|
||||
int i2 = index[value2];
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ write_datagram(BamWriter *manager, Datagram &me)
|
|||
|
||||
// There might be one odd value.
|
||||
if (i < table_length) {
|
||||
int value1 = (int)floor(_table[i] * scale + 0.5);
|
||||
int value1 = (int)floor(_table[i] * scale + 0.5f);
|
||||
int i1 = index[value1];
|
||||
|
||||
me.add_uint8(i1 << 4);
|
||||
|
|
|
|||
|
|
@ -41,9 +41,9 @@ AnimControl(PartBundle *part, AnimBundle *anim, int channel_index) {
|
|||
_anim = anim;
|
||||
_channel_index = channel_index;
|
||||
|
||||
_play_rate = 1.0;
|
||||
_frame = 0.0;
|
||||
_as_of_time = 0.0;
|
||||
_play_rate = 1.0f;
|
||||
_frame = 0.0f;
|
||||
_as_of_time = 0.0f;
|
||||
_playing = false;
|
||||
|
||||
_marked_frame = -1;
|
||||
|
|
@ -60,7 +60,7 @@ void AnimControl::
|
|||
play(const CPT_Event &stop_event) {
|
||||
nassertv(get_num_frames() > 0);
|
||||
|
||||
if (get_play_rate() < 0.0) {
|
||||
if (get_play_rate() < 0.0f) {
|
||||
play(get_num_frames()-1, 0, stop_event);
|
||||
} else {
|
||||
play(0, get_num_frames()-1, stop_event);
|
||||
|
|
@ -115,7 +115,7 @@ loop(bool restart) {
|
|||
get_part()->control_activated(this);
|
||||
|
||||
if (restart) {
|
||||
if (get_play_rate() < 0.0) {
|
||||
if (get_play_rate() < 0.0f) {
|
||||
set_frame(get_num_frames() - 1);
|
||||
} else {
|
||||
set_frame(0);
|
||||
|
|
@ -143,7 +143,7 @@ loop(bool restart, int from, int to) {
|
|||
|
||||
_actions = _user_actions;
|
||||
|
||||
if (get_play_rate() < 0.0) {
|
||||
if (get_play_rate() < 0.0f) {
|
||||
// If we're playing backward, we need to set up the loop a little
|
||||
// differently.
|
||||
|
||||
|
|
@ -365,7 +365,7 @@ advance_time(double time) {
|
|||
double elapsed_frames = elapsed_time * get_frame_rate();
|
||||
_as_of_time = time;
|
||||
|
||||
if (_playing && elapsed_frames != 0.0) {
|
||||
if (_playing && elapsed_frames != 0.0f) {
|
||||
int orig_frame = get_frame();
|
||||
|
||||
_frame += elapsed_frames;
|
||||
|
|
@ -374,7 +374,7 @@ advance_time(double time) {
|
|||
int new_frame = get_frame();
|
||||
|
||||
// Now call all the actions.
|
||||
if (elapsed_frames < 0.0) {
|
||||
if (elapsed_frames < 0.0f) {
|
||||
// If we're playing the animation backward, we have to check the
|
||||
// actions in reverse order.
|
||||
|
||||
|
|
@ -663,7 +663,7 @@ do_action(int frame, const Action &action,
|
|||
case AT_forward:
|
||||
// We only see "forward" actions if we're currently playing
|
||||
// backwards.
|
||||
if (_play_rate < 0.0) {
|
||||
if (_play_rate < 0.0f) {
|
||||
sequence_frame = frame;
|
||||
sequence_action = &action;
|
||||
}
|
||||
|
|
@ -672,7 +672,7 @@ do_action(int frame, const Action &action,
|
|||
case AT_backward:
|
||||
// We only see "backward" actions if we're currently playing
|
||||
// forwards.
|
||||
if (_play_rate > 0.0) {
|
||||
if (_play_rate > 0.0f) {
|
||||
sequence_frame = frame;
|
||||
sequence_action = &action;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ get_blend_value(const PartBundle *root) {
|
|||
|
||||
if (root->get_blend_type() == PartBundle::BT_linear) {
|
||||
// An ordinary, linear blend.
|
||||
_value = 0.0;
|
||||
float net = 0.0;
|
||||
_value = 0.0f;
|
||||
float net = 0.0f;
|
||||
|
||||
PartBundle::ChannelBlend::const_iterator cbi;
|
||||
for (cbi = blend.begin(); cbi != blend.end(); ++cbi) {
|
||||
AnimControl *control = (*cbi).first;
|
||||
float effect = (*cbi).second;
|
||||
nassertv(effect != 0.0);
|
||||
nassertv(effect != 0.0f);
|
||||
|
||||
int channel_index = control->get_channel_index();
|
||||
nassertv(channel_index >= 0 && channel_index < (int)_channels.size());
|
||||
|
|
@ -84,7 +84,7 @@ get_blend_value(const PartBundle *root) {
|
|||
net += effect;
|
||||
}
|
||||
|
||||
nassertv(net != 0.0);
|
||||
nassertv(net != 0.0f);
|
||||
_value /= net;
|
||||
|
||||
} else if (root->get_blend_type() == PartBundle::BT_normalized_linear) {
|
||||
|
|
@ -93,15 +93,15 @@ get_blend_value(const PartBundle *root) {
|
|||
// resulting matrix to eliminate artificially-introduced scales,
|
||||
// and then reapply the scales.
|
||||
|
||||
_value = 0.0;
|
||||
LVector3f scale(0.0, 0.0, 0.0);
|
||||
float net = 0.0;
|
||||
_value = 0.0f;
|
||||
LVector3f scale(0.0f, 0.0f, 0.0f);
|
||||
float net = 0.0f;
|
||||
|
||||
PartBundle::ChannelBlend::const_iterator cbi;
|
||||
for (cbi = blend.begin(); cbi != blend.end(); ++cbi) {
|
||||
AnimControl *control = (*cbi).first;
|
||||
float effect = (*cbi).second;
|
||||
nassertv(effect != 0.0);
|
||||
nassertv(effect != 0.0f);
|
||||
|
||||
int channel_index = control->get_channel_index();
|
||||
nassertv(channel_index >= 0 && channel_index < (int)_channels.size());
|
||||
|
|
@ -118,7 +118,7 @@ get_blend_value(const PartBundle *root) {
|
|||
net += effect;
|
||||
}
|
||||
|
||||
nassertv(net != 0.0);
|
||||
nassertv(net != 0.0f);
|
||||
_value /= net;
|
||||
scale /= net;
|
||||
|
||||
|
|
|
|||
|
|
@ -58,14 +58,14 @@ get_blend_value(const PartBundle *root) {
|
|||
|
||||
} else {
|
||||
// A blend of two or more values.
|
||||
_value = 0.0;
|
||||
float net = 0.0;
|
||||
_value = 0.0f;
|
||||
float net = 0.0f;
|
||||
|
||||
PartBundle::ChannelBlend::const_iterator cbi;
|
||||
for (cbi = blend.begin(); cbi != blend.end(); ++cbi) {
|
||||
AnimControl *control = (*cbi).first;
|
||||
float effect = (*cbi).second;
|
||||
nassertv(effect != 0.0);
|
||||
nassertv(effect != 0.0f);
|
||||
|
||||
int channel_index = control->get_channel_index();
|
||||
nassertv(channel_index >= 0 && channel_index < (int)_channels.size());
|
||||
|
|
@ -79,7 +79,7 @@ get_blend_value(const PartBundle *root) {
|
|||
net += effect;
|
||||
}
|
||||
|
||||
nassertv(net != 0.0);
|
||||
nassertv(net != 0.0f);
|
||||
_value /= net;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ PartBundle(const PartBundle ©) :
|
|||
// We don't invoke the AnimControlCollection's copy, or any of the
|
||||
// bound animations.
|
||||
_last_control_set = NULL;
|
||||
_net_blend = 0.0;
|
||||
_net_blend = 0.0f;
|
||||
_anim_changed = false;
|
||||
}
|
||||
|
||||
|
|
@ -62,7 +62,7 @@ PartBundle(const string &name) : PartGroup(name) {
|
|||
_blend_type = BT_single;
|
||||
|
||||
_last_control_set = NULL;
|
||||
_net_blend = 0.0;
|
||||
_net_blend = 0.0f;
|
||||
_anim_changed = false;
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +135,7 @@ void PartBundle::
|
|||
clear_control_effects() {
|
||||
if (!_blend.empty()) {
|
||||
_blend.clear();
|
||||
_net_blend = 0.0;
|
||||
_net_blend = 0.0f;
|
||||
_anim_changed = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ void PartBundle::
|
|||
set_control_effect(AnimControl *control, float effect) {
|
||||
nassertv(control->get_part() == this);
|
||||
|
||||
if (effect == 0.0) {
|
||||
if (effect == 0.0f) {
|
||||
// An effect of zero means to eliminate the control.
|
||||
ChannelBlend::iterator cbi = _blend.find(control);
|
||||
if (cbi != _blend.end()) {
|
||||
|
|
@ -198,12 +198,12 @@ set_control_effect(AnimControl *control, float effect) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
float PartBundle::
|
||||
get_control_effect(AnimControl *control) {
|
||||
nassertr(control->get_part() == this, 0.0);
|
||||
nassertr(control->get_part() == this, 0.0f);
|
||||
|
||||
ChannelBlend::iterator cbi = _blend.find(control);
|
||||
if (cbi == _blend.end()) {
|
||||
// The control is not in effect.
|
||||
return 0.0;
|
||||
return 0.0f;
|
||||
} else {
|
||||
return (*cbi).second;
|
||||
}
|
||||
|
|
@ -374,7 +374,7 @@ control_activated(AnimControl *control) {
|
|||
// If (and only if) our blend type is BT_single, which means no
|
||||
// blending, then starting an animation implicitly enables it.
|
||||
if (get_blend_type() == BT_single) {
|
||||
set_control_effect(control, 1.0);
|
||||
set_control_effect(control, 1.0f);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -389,7 +389,7 @@ control_activated(AnimControl *control) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void PartBundle::
|
||||
recompute_net_blend() {
|
||||
_net_blend = 0.0;
|
||||
_net_blend = 0.0f;
|
||||
|
||||
ChannelBlend::const_iterator bti;
|
||||
for (bti = _blend.begin(); bti != _blend.end(); ++bti) {
|
||||
|
|
@ -449,7 +449,7 @@ register_with_read_factory(void)
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void PartBundle::
|
||||
clear_and_stop_except(AnimControl *control) {
|
||||
double new_net_blend = 0.0;
|
||||
double new_net_blend = 0.0f;
|
||||
ChannelBlend new_blend;
|
||||
bool any_changed = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -34,8 +34,8 @@ TypeHandle CollisionHandlerFloor::_type_handle;
|
|||
////////////////////////////////////////////////////////////////////
|
||||
CollisionHandlerFloor::
|
||||
CollisionHandlerFloor() {
|
||||
_offset = 0.0;
|
||||
_max_velocity = 0.0;
|
||||
_offset = 0.0f;
|
||||
_max_velocity = 0.0f;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -90,7 +90,7 @@ handle_entries() {
|
|||
} else {
|
||||
// Get the maximum height for all collisions with this node.
|
||||
bool got_max = false;
|
||||
float max_height = 0.0;
|
||||
float max_height = 0.0f;
|
||||
|
||||
Entries::const_iterator ei;
|
||||
for (ei = entries.begin(); ei != entries.end(); ++ei) {
|
||||
|
|
@ -121,7 +121,7 @@ handle_entries() {
|
|||
<< "Adjusting height by " << adjust << "\n";
|
||||
}
|
||||
|
||||
if (adjust < 0.0 && _max_velocity != 0.0) {
|
||||
if (adjust < 0.0f && _max_velocity != 0.0f) {
|
||||
float max_adjust =
|
||||
_max_velocity * ClockObject::get_global_clock()->get_dt();
|
||||
adjust = max(adjust, -max_adjust);
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ handle_entries() {
|
|||
|
||||
} else {
|
||||
// Shove it just enough to clear the volume.
|
||||
if (entry->get_into_depth() != 0.0) {
|
||||
if (entry->get_into_depth() != 0.0f) {
|
||||
ShoveData sd;
|
||||
sd._shove =
|
||||
entry->get_into_surface_normal() *
|
||||
|
|
@ -177,7 +177,7 @@ handle_entries() {
|
|||
}
|
||||
|
||||
// Now we can determine the net shove.
|
||||
LVector3f net_shove(0.0, 0.0, 0.0);
|
||||
LVector3f net_shove(0.0f, 0.0f, 0.0f);
|
||||
for (si = shoves.begin(); si != shoves.end(); ++si) {
|
||||
const ShoveData &sd = (*si);
|
||||
if (sd._valid) {
|
||||
|
|
@ -186,7 +186,7 @@ handle_entries() {
|
|||
}
|
||||
|
||||
if (_horizontal) {
|
||||
net_shove[2] = 0.0;
|
||||
net_shove[2] = 0.0f;
|
||||
}
|
||||
|
||||
if (collide_cat.is_debug()) {
|
||||
|
|
|
|||
|
|
@ -144,16 +144,21 @@ recompute_viz(Node *parent) {
|
|||
GeomLinestrip *ray = new GeomLinestrip;
|
||||
PTA_Vertexf verts;
|
||||
PTA_Colorf colors;
|
||||
for (int i = 0; i < 100; i++) {
|
||||
PTA_int lengths;
|
||||
|
||||
#define NUM_POINTS 100
|
||||
verts.reserve(NUM_POINTS);
|
||||
colors.reserve(NUM_POINTS);
|
||||
|
||||
for (int i = 0; i < NUM_POINTS; i++) {
|
||||
verts.push_back(_origin + (double)i * _direction);
|
||||
colors.push_back(Colorf(1.0, 1.0, 1.0, 1.0) +
|
||||
((double)i / 100.0) * Colorf(0.0, 0.0, 0.0, -1.0));
|
||||
colors.push_back(Colorf(1.0f, 1.0f, 1.0f, 1.0f)+
|
||||
((double)i / 100.0) * Colorf(0.0f, 0.0f, 0.0f, -1.0f));
|
||||
}
|
||||
ray->set_coords(verts);
|
||||
ray->set_colors(colors, G_PER_VERTEX);
|
||||
|
||||
PTA_int lengths;
|
||||
lengths.push_back(99);
|
||||
lengths.push_back(NUM_POINTS-1);
|
||||
ray->set_lengths(lengths);
|
||||
|
||||
ray->set_num_prims(1);
|
||||
|
|
|
|||
|
|
@ -217,9 +217,9 @@ add_solid_viz(Node *parent, GeomNode *viz) {
|
|||
arc->set_transition(new TransparencyTransition(TransparencyProperty::M_alpha));
|
||||
|
||||
if (is_tangible()) {
|
||||
arc->set_transition(new ColorTransition(1.0, 1.0, 1.0, 0.5));
|
||||
arc->set_transition(new ColorTransition(1.0f, 1.0f, 1.0f, 0.5));
|
||||
} else {
|
||||
arc->set_transition(new ColorTransition(1.0, 0.3, 0.5, 0.5));
|
||||
arc->set_transition(new ColorTransition(1.0f, 0.3, 0.5, 0.5));
|
||||
}
|
||||
|
||||
_solid_viz_arcs.push_back(arc);
|
||||
|
|
@ -238,12 +238,13 @@ add_wireframe_viz(Node *parent, GeomNode *viz) {
|
|||
arc->set_transition(new LightTransition(LightTransition::all_off()));
|
||||
arc->set_transition(new TextureTransition(TextureTransition::off()));
|
||||
arc->set_transition(new TransparencyTransition(TransparencyProperty::M_none));
|
||||
float r,g,b;
|
||||
if (is_tangible()) {
|
||||
arc->set_transition(new ColorTransition(0.0, 0.0, 1.0, 1.0));
|
||||
r=1.0f; g=1.0f; b=0.0f;
|
||||
} else {
|
||||
arc->set_transition(new ColorTransition(1.0, 1.0, 0.0, 1.0));
|
||||
r=0.0f; g=0.0f; b=1.0f;
|
||||
}
|
||||
|
||||
arc->set_transition(new ColorTransition(r,g,b,1.0f));
|
||||
_wireframe_viz_arcs.push_back(arc);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ intersects_line(double &t1, double &t2,
|
|||
nassertr(A != 0.0, false);
|
||||
|
||||
LVector3f fc = from - _center;
|
||||
double B = 2.0 * dot(delta, fc);
|
||||
double B = 2.0f* dot(delta, fc);
|
||||
double fc_d2 = dot(fc, fc);
|
||||
double C = fc_d2 - _radius * _radius;
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ TypeHandle Producer::_xyz_type;
|
|||
Producer::
|
||||
Producer(const string &name) : DataNode(name) {
|
||||
_t = new DoubleDataTransition(0.0);
|
||||
_xyz = new Vec3DataTransition(LPoint3f(0.0, 0.0, 0.0));
|
||||
_xyz = new Vec3DataTransition(LPoint3f(0.0f, 0.0f, 0.0f));
|
||||
|
||||
// Set up our _attrib member to directly reference our data members.
|
||||
// This way we can simply return a reference to our _attrib member,
|
||||
|
|
@ -183,11 +183,11 @@ main() {
|
|||
new DataRelation(root, producer);
|
||||
DataRelation *arc1 = new DataRelation(producer, consumer);
|
||||
|
||||
producer->_t->set_value(10.0);
|
||||
producer->_xyz->set_value(LPoint3f(1.0, 2.0, 3.0));
|
||||
producer->_t->set_value(10.0f);
|
||||
producer->_xyz->set_value(LPoint3f(1.0f, 2.0f, 3.0f));
|
||||
|
||||
arc1->set_transition(Producer::_xyz_type,
|
||||
new Vec3DataTransition(LMatrix4f::scale_mat(2.0)));
|
||||
new Vec3DataTransition(LMatrix4f::scale_mat(2.0f)));
|
||||
|
||||
producer->set_spam_mode(true);
|
||||
|
||||
|
|
|
|||
|
|
@ -242,9 +242,9 @@ get_float32() {
|
|||
// For now, we assume the float format is portable across all
|
||||
// architectures we are concerned with. If we come across one that
|
||||
// is different, we will have to convert.
|
||||
nassertr(sizeof(float) == 4, 0.0);
|
||||
nassertr(sizeof(float) == 4, 0.0f);
|
||||
nassertr(_datagram != (const Datagram *)NULL &&
|
||||
_current_index < _datagram->get_length(), 0.0);
|
||||
_current_index < _datagram->get_length(), 0.0f);
|
||||
|
||||
float tempvar;
|
||||
LittleEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
|
||||
|
|
@ -393,9 +393,9 @@ get_be_float32() {
|
|||
// For now, we assume the float format is portable across all
|
||||
// architectures we are concerned with. If we come across one that
|
||||
// is different, we will have to convert.
|
||||
nassertr(sizeof(float) == 4, 0.0);
|
||||
nassertr(sizeof(float) == 4, 0.0f);
|
||||
nassertr(_datagram != (const Datagram *)NULL &&
|
||||
_current_index < _datagram->get_length(), 0.0);
|
||||
_current_index < _datagram->get_length(), 0.0f);
|
||||
|
||||
float tempvar;
|
||||
BigEndian s(_datagram->get_data(), _current_index, sizeof(tempvar));
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ get_progress(void) const {
|
|||
if (false == _initiated) {
|
||||
express_cat.warning()
|
||||
<< "Patchfile::get_progress() - Patch has not been initiated" << endl;
|
||||
return 0.0;
|
||||
return 0.0f;
|
||||
}
|
||||
nassertr(_result_file_length > 0, 0.0);
|
||||
nassertr(_result_file_length > 0, 0.0f);
|
||||
return ((float)_total_bytes_processed / (float)_result_file_length);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ get_num_vertices() const {
|
|||
INLINE Vertexf LineSegs::
|
||||
get_vertex(int vertex) const {
|
||||
nassertr(vertex >= 0 && vertex < (int)_created_verts.size(),
|
||||
Vertexf(0.0, 0.0, 0.0));
|
||||
Vertexf(0.0f, 0.0f, 0.0f));
|
||||
return _created_verts[vertex];
|
||||
}
|
||||
|
||||
|
|
@ -210,7 +210,7 @@ set_vertex(int vertex, float x, float y, float z) {
|
|||
INLINE Colorf LineSegs::
|
||||
get_vertex_color(int vertex) const {
|
||||
nassertr(vertex >= 0 && vertex < (int)_created_colors.size(),
|
||||
Colorf(0.0, 0.0, 0.0, 0.0));
|
||||
Colorf(0.0f, 0.0f, 0.0f, 0.0f));
|
||||
return _created_colors[vertex];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ PUBLISHED:
|
|||
~LineSegs();
|
||||
|
||||
void reset();
|
||||
INLINE void set_color(float r, float g, float b, float a = 1.0);
|
||||
INLINE void set_color(float r, float g, float b, float a = 1.0f);
|
||||
INLINE void set_color(const Colorf &color);
|
||||
INLINE void set_thickness(float thick);
|
||||
|
||||
|
|
@ -69,7 +69,7 @@ PUBLISHED:
|
|||
|
||||
INLINE Colorf get_vertex_color(int vertex) const;
|
||||
INLINE void set_vertex_color(int vertex, const Colorf &color);
|
||||
INLINE void set_vertex_color(int vertex, float r, float g, float b, float a = 1.0);
|
||||
INLINE void set_vertex_color(int vertex, float r, float g, float b, float a = 1.0f);
|
||||
|
||||
private:
|
||||
class Point {
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ static INLINE float scale_t(float t, float start, float end) {
|
|||
if (ret > end)
|
||||
ret = end;
|
||||
// Avoid a possible divide-by-zero
|
||||
if (end == 0.0)
|
||||
return 0.0;
|
||||
if (end == 0.0f)
|
||||
return 0.0f;
|
||||
return ret / end;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ EaseInBlendType& EaseInBlendType::operator=(const EaseInBlendType& c) {
|
|||
|
||||
float EaseInBlendType::operator()(float t) {
|
||||
float x = t*t;
|
||||
return ((3. * x) - (t * x)) * 0.5;
|
||||
return ((3.0f * x) - (t * x)) * 0.5f;
|
||||
}
|
||||
|
||||
EaseOutBlendType::EaseOutBlendType(const EaseOutBlendType& c)
|
||||
|
|
@ -63,7 +63,7 @@ EaseOutBlendType& EaseOutBlendType::operator=(const EaseOutBlendType& c) {
|
|||
}
|
||||
|
||||
float EaseOutBlendType::operator()(float t) {
|
||||
return ((3. * t) - (t * t * t)) * 0.5;
|
||||
return ((3.0f * t) - (t * t * t)) * 0.5f;
|
||||
}
|
||||
|
||||
EaseInOutBlendType::EaseInOutBlendType(const EaseInOutBlendType& c)
|
||||
|
|
@ -79,7 +79,7 @@ EaseInOutBlendType& EaseInOutBlendType::operator=(const EaseInOutBlendType& c)
|
|||
|
||||
float EaseInOutBlendType::operator()(float t) {
|
||||
float x = t*t;
|
||||
return (3. * x) - (2. * t * x);
|
||||
return (3.0f * x) - (2.0f * t * x);
|
||||
}
|
||||
|
||||
NoBlendType::NoBlendType(const NoBlendType& c) : LerpBlendType(c) {}
|
||||
|
|
|
|||
|
|
@ -32,11 +32,11 @@ PhysicsObject(void) :
|
|||
_process_me(false),
|
||||
_oriented(true)
|
||||
{
|
||||
_position.set(0, 0, 0);
|
||||
_position.set(0.0f, 0.0f, 0.0f);
|
||||
_last_position = _position;
|
||||
_velocity.set(0, 0, 0);
|
||||
_orientation.set(1, 0, 0, 0);
|
||||
_rotation.set(0, 0, 0);
|
||||
_velocity.set(0.0f, 0.0f, 0.0f);
|
||||
_orientation.set(1.0 ,0.0f, 0.0f, 0.0f);
|
||||
_rotation.set(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -43,10 +43,10 @@ DrawBoundsTransition::
|
|||
DrawBoundsTransition() {
|
||||
RenderModeTransition *rma = new RenderModeTransition(RenderModeProperty::M_wireframe);
|
||||
CullFaceTransition *cfao = new CullFaceTransition(CullFaceProperty::M_cull_clockwise);
|
||||
ColorTransition *cao = new ColorTransition(0.3, 1.0, 0.5, 1.0);
|
||||
ColorTransition *cao = new ColorTransition(0.3f, 1.0f, 0.5f, 1.0f);
|
||||
|
||||
CullFaceTransition *cfai = new CullFaceTransition(CullFaceProperty::M_cull_counter_clockwise);
|
||||
ColorTransition *cai = new ColorTransition(0.15, 0.5, 0.25, 1.0);
|
||||
ColorTransition *cai = new ColorTransition(0.15f, 0.5f, 0.25f, 1.0f);
|
||||
|
||||
_outside_attrib.set_transition(rma);
|
||||
_outside_attrib.set_transition(cfao);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ Fog(const string &name) : NamedNode(name) {
|
|||
_bits_per_color_channel = 8;
|
||||
_color.set(1.0f, 1.0f, 1.0f, 1.0f);
|
||||
_linear_onset_point.set(0.0f, 0.0f, 0.0f);
|
||||
_linear_opaque_point.set(0.0, 100.0f, 0.0f);
|
||||
_linear_opaque_point.set(0.0f, 100.0f, 0.0f);
|
||||
_exp_density = 0.5f;
|
||||
_linear_fallback_cosa = -1.0f;
|
||||
_linear_fallback_onset = 0.0f;
|
||||
|
|
@ -223,7 +223,7 @@ compute_linear_range(float &onset, float &opaque,
|
|||
// fog at the linear fog's 'fog-end' distance. usefulness of this is
|
||||
// debatable since the exponential fog that matches will be very very
|
||||
// close to observer, and it's harder to guess a good end fog distance
|
||||
// than it is to manipulate the [0.0,1.0] density range directly, so
|
||||
// than it is to manipulate the [0.0,1.0f] density range directly, so
|
||||
// taking this out
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -84,9 +84,9 @@ main(int argc, char *argv[]) {
|
|||
PT(Texture) beta = new Texture;
|
||||
beta->set_name("beta");
|
||||
|
||||
r_a->set_transition(new ColorTransition(1.0, 1.0, 1.0, 1.0));
|
||||
r_a->set_transition(new ColorTransition(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
r_a->set_transition(new TextureTransition(alpha));
|
||||
a_aa->set_transition(new ColorTransition(0.5, 1.0, 0.5, 0.2));
|
||||
a_aa->set_transition(new ColorTransition(0.5f, 1.0f, 0.5f, 0.2f));
|
||||
a_ab->set_transition(new TextureTransition(beta));
|
||||
|
||||
cerr << "\nr to a has:\n";
|
||||
|
|
|
|||
|
|
@ -1133,7 +1133,7 @@ set_z(float z) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
LPoint3f NodePath::
|
||||
get_pos() const {
|
||||
nassertr(has_arcs(), LPoint3f(0.0, 0.0, 0.0));
|
||||
nassertr(has_arcs(), LPoint3f(0.0f, 0.0f, 0.0f));
|
||||
LMatrix4f mat = get_mat();
|
||||
return mat.get_row3(3);
|
||||
}
|
||||
|
|
@ -1193,7 +1193,7 @@ set_r(float r) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
LVecBase3f NodePath::
|
||||
get_hpr() const {
|
||||
nassertr(has_arcs(), LVecBase3f(0.0, 0.0, 0.0));
|
||||
nassertr(has_arcs(), LVecBase3f(0.0f, 0.0f, 0.0f));
|
||||
LMatrix4f mat = get_mat();
|
||||
LVecBase3f scale, hpr, pos;
|
||||
decompose_matrix(mat, scale, hpr, pos);
|
||||
|
|
@ -1207,7 +1207,7 @@ get_hpr() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
LVecBase3f NodePath::
|
||||
get_hpr(float roll) const {
|
||||
nassertr(has_arcs(), LVecBase3f(0.0, 0.0, 0.0));
|
||||
nassertr(has_arcs(), LVecBase3f(0.0f, 0.0f, 0.0f));
|
||||
LMatrix4f mat = get_mat();
|
||||
LVecBase3f scale, hpr, pos;
|
||||
decompose_matrix(mat, scale, hpr, pos, roll);
|
||||
|
|
@ -1270,7 +1270,7 @@ set_sz(float sz) {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
LVecBase3f NodePath::
|
||||
get_scale() const {
|
||||
nassertr(has_arcs(), LVecBase3f(1.0, 1.0, 1.0));
|
||||
nassertr(has_arcs(), LVecBase3f(1.0f, 1.0f, 1.0f));
|
||||
LMatrix4f mat = get_mat();
|
||||
|
||||
// We decompose the scale directly instead of calling
|
||||
|
|
@ -2883,8 +2883,8 @@ write_bounds(ostream &out) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
bool NodePath::
|
||||
calc_tight_bounds(LPoint3f &min_point, LPoint3f &max_point) {
|
||||
min_point.set(0.0, 0.0, 0.0);
|
||||
max_point.set(0.0, 0.0, 0.0);
|
||||
min_point.set(0.0f, 0.0f, 0.0f);
|
||||
max_point.set(0.0f, 0.0f, 0.0f);
|
||||
nassertr_always(!is_empty(), false);
|
||||
|
||||
bool found_any = false;
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ transform_texcoords(Geom *geom, const LMatrix4f &mat) {
|
|||
PTA_TexCoordf::const_iterator tci;
|
||||
for (tci = texcoords.begin(); tci != texcoords.end(); ++tci) {
|
||||
const TexCoordf &tc = (*tci);
|
||||
LVecBase4f v4(tc[0], tc[1], 0.0, 1.0);
|
||||
LVecBase4f v4(tc[0], tc[1], 0.0f, 1.0f);
|
||||
v4 = v4 * mat;
|
||||
new_texcoords.push_back(TexCoordf(v4[0] / v4[3], v4[1] / v4[3]));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ get_perspective_params(float &xfov, float &yfov, float &aspect, float &cnear,
|
|||
////////////////////////////////////////////////////////////////////
|
||||
float ProjectionNode::
|
||||
get_hfov(void) const {
|
||||
float xfov=0.0, yfov=0.0, aspect, cnear, cfar;
|
||||
float xfov=0.0f, yfov=0.0f, aspect, cnear, cfar;
|
||||
get_perspective_params(xfov, yfov, aspect, cnear, cfar);
|
||||
return xfov;
|
||||
}
|
||||
|
|
@ -155,7 +155,7 @@ get_hfov(void) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
float ProjectionNode::
|
||||
get_vfov(void) const {
|
||||
float xfov=0.0, yfov=0.0, aspect, cnear, cfar;
|
||||
float xfov=0.0f, yfov=0.0f, aspect, cnear, cfar;
|
||||
get_perspective_params(xfov, yfov, aspect, cnear, cfar);
|
||||
return yfov;
|
||||
}
|
||||
|
|
@ -169,7 +169,7 @@ get_vfov(void) const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
float ProjectionNode::
|
||||
get_aspect(void) const {
|
||||
float yfov, aspect=0.0, cnear, cfar;
|
||||
float yfov, aspect=0.0f, cnear, cfar;
|
||||
get_perspective_params(yfov, aspect, cnear, cfar);
|
||||
return aspect;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ get_rel_pos(const Node *node, const Node *relative_to,
|
|||
|
||||
if (!get_transition_into(tt, ntw)) {
|
||||
// No relative transform.
|
||||
return LPoint3f(0.0, 0.0, 0.0);
|
||||
return LPoint3f(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
LVector3f pos;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ clear() {
|
|||
|
||||
_num_long_normals = 0;
|
||||
_num_short_normals = 0;
|
||||
_total_normal_length = 0.0;
|
||||
_total_normal_length = 0.0f;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -411,11 +411,11 @@ consider_normals(const Normalf *norms, const ushort *nindex, int num) {
|
|||
for (int i = 0; i < num; i++) {
|
||||
const Normalf &norm = norms[nindex[i]];
|
||||
float l = norm.length();
|
||||
if (IS_THRESHOLD_EQUAL(l, 1.0, 0.01)) {
|
||||
if (IS_THRESHOLD_EQUAL(l, 1.0f, 0.01f)) {
|
||||
// This normal is close enough to unit length to be ok.
|
||||
} else if (l > 1.0) {
|
||||
} else if (l > 1.0f) {
|
||||
_num_long_normals++;
|
||||
} else { // l < 1.0
|
||||
} else { // l < 1.0f
|
||||
_num_short_normals++;
|
||||
}
|
||||
_total_normal_length += l;
|
||||
|
|
@ -425,9 +425,9 @@ consider_normals(const Normalf *norms, const ushort *nindex, int num) {
|
|||
for (int i = 0; i < num; i++) {
|
||||
const Normalf &norm = norms[i];
|
||||
float l = norm.length();
|
||||
if (IS_THRESHOLD_EQUAL(l, 1.0, 0.01)) {
|
||||
if (IS_THRESHOLD_EQUAL(l, 1.0f, 0.01f)) {
|
||||
// This normal is close enough to unit length to be ok.
|
||||
} else if (l > 1.0) {
|
||||
} else if (l > 1.0f) {
|
||||
_num_long_normals++;
|
||||
} else { // l < 1.0
|
||||
_num_short_normals++;
|
||||
|
|
|
|||
|
|
@ -42,9 +42,9 @@ TypeHandle DriveInterface::_transform_type;
|
|||
DriveInterface::KeyHeld::
|
||||
KeyHeld() {
|
||||
_down = false;
|
||||
_changed_time = 0.0;
|
||||
_effect = 0.0;
|
||||
_effect_at_change = 0.0;
|
||||
_changed_time = 0.0f;
|
||||
_effect = 0.0f;
|
||||
_effect_at_change = 0.0f;
|
||||
}
|
||||
|
||||
float DriveInterface::KeyHeld::
|
||||
|
|
@ -54,8 +54,8 @@ get_effect(float ramp_up_time, float ramp_down_time) {
|
|||
if (_down) {
|
||||
// We are currently holding down the key. That means we base our
|
||||
// effect on the ramp_up_time.
|
||||
if (ramp_up_time == 0.0) {
|
||||
_effect = 1.0;
|
||||
if (ramp_up_time == 0.0f) {
|
||||
_effect = 1.0f;
|
||||
|
||||
} else {
|
||||
float change = elapsed / ramp_up_time;
|
||||
|
|
@ -65,8 +65,8 @@ get_effect(float ramp_up_time, float ramp_down_time) {
|
|||
} else {
|
||||
// We are *not* currently holding down the key. That means we
|
||||
// base our effect on the ramp_down_time.
|
||||
if (ramp_down_time == 0.0) {
|
||||
_effect = 0.0;
|
||||
if (ramp_down_time == 0.0f) {
|
||||
_effect = 0.0f;
|
||||
|
||||
} else {
|
||||
float change = elapsed / ramp_down_time;
|
||||
|
|
@ -89,9 +89,9 @@ set_key(bool down) {
|
|||
void DriveInterface::KeyHeld::
|
||||
clear() {
|
||||
_down = false;
|
||||
_changed_time = 0.0;
|
||||
_effect = 0.0;
|
||||
_effect_at_change = 0.0;
|
||||
_changed_time = 0.0f;
|
||||
_effect = 0.0f;
|
||||
_effect_at_change = 0.0f;
|
||||
}
|
||||
|
||||
bool DriveInterface::KeyHeld::
|
||||
|
|
@ -126,13 +126,13 @@ DriveInterface(const string &name) : DataNode(name) {
|
|||
_horizontal_ramp_up_time = drive_horizontal_ramp_up_time;
|
||||
_horizontal_ramp_down_time = drive_horizontal_ramp_down_time;
|
||||
|
||||
_speed = 0.0;
|
||||
_rot_speed = 0.0;
|
||||
_speed = 0.0f;
|
||||
_rot_speed = 0.0f;
|
||||
|
||||
_xyz.set(0.0, 0.0, 0.0);
|
||||
_hpr.set(0.0, 0.0, 0.0);
|
||||
_xyz.set(0.0f, 0.0f, 0.0f);
|
||||
_hpr.set(0.0f, 0.0f, 0.0f);
|
||||
_mat = LMatrix4f::ident_mat();
|
||||
_force_roll = 0.0;
|
||||
_force_roll = 0.0f;
|
||||
_is_force_roll = true;
|
||||
|
||||
_cs = default_coordinate_system;
|
||||
|
|
@ -166,9 +166,9 @@ DriveInterface::
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void DriveInterface::
|
||||
reset() {
|
||||
_xyz.set(0.0, 0.0, 0.0);
|
||||
_hpr.set(0.0, 0.0, 0.0);
|
||||
_force_roll = 0.0;
|
||||
_xyz.set(0.0f, 0.0f, 0.0f);
|
||||
_hpr.set(0.0f, 0.0f, 0.0f);
|
||||
_force_roll = 0.0f;
|
||||
_mat = LMatrix4f::ident_mat();
|
||||
_up_arrow.clear();
|
||||
_down_arrow.clear();
|
||||
|
|
@ -232,8 +232,8 @@ void DriveInterface::
|
|||
apply(double x, double y, bool any_button) {
|
||||
|
||||
// First reset the speeds
|
||||
_speed = 0.0;
|
||||
_rot_speed = 0.0;
|
||||
_speed = 0.0f;
|
||||
_rot_speed = 0.0f;
|
||||
|
||||
if (any_button) {
|
||||
// If we're holding down any of the mouse buttons, do this
|
||||
|
|
@ -253,15 +253,15 @@ apply(double x, double y, bool any_button) {
|
|||
// Motion is forward. Compute the throttle value: the ratio of
|
||||
// the mouse pointer within the range of vertical movement.
|
||||
float throttle =
|
||||
(min(y, 1.0) - dead_zone_top) /
|
||||
(1.0 - dead_zone_top);
|
||||
(min(y, 1.0f) - dead_zone_top) /
|
||||
(1.0f - dead_zone_top);
|
||||
_speed = throttle * _forward_speed;
|
||||
|
||||
} else if (y <= dead_zone_bottom) {
|
||||
// Motion is backward.
|
||||
float throttle =
|
||||
(max(y, -1.0) - dead_zone_bottom) /
|
||||
(-1.0 - dead_zone_bottom);
|
||||
(max(y, -1.0f) - dead_zone_bottom) /
|
||||
(-1.0f - dead_zone_bottom);
|
||||
_speed = -throttle * _reverse_speed;
|
||||
}
|
||||
|
||||
|
|
@ -276,15 +276,15 @@ apply(double x, double y, bool any_button) {
|
|||
// ratio of the mouse pointer within the range of horizontal
|
||||
// movement.
|
||||
float throttle =
|
||||
(min(x, 1.0) - dead_zone_right) /
|
||||
(1.0 - dead_zone_right);
|
||||
(min(x, 1.0f) - dead_zone_right) /
|
||||
(1.0f - dead_zone_right);
|
||||
_rot_speed = throttle * _rotate_speed;
|
||||
|
||||
} else if (x <= dead_zone_left) {
|
||||
// Rotation is to the left.
|
||||
float throttle =
|
||||
(max(x, -1.0) - dead_zone_left) /
|
||||
(-1.0 - dead_zone_left);
|
||||
(max(x, -1.0f) - dead_zone_left) /
|
||||
(-1.0f - dead_zone_left);
|
||||
_rot_speed = -throttle * _rotate_speed;
|
||||
}
|
||||
|
||||
|
|
@ -299,13 +299,13 @@ apply(double x, double y, bool any_button) {
|
|||
throttle = _up_arrow.get_effect(_vertical_ramp_up_time,
|
||||
_vertical_ramp_down_time);
|
||||
_speed = throttle * _forward_speed;
|
||||
_down_arrow._effect = 0.0;
|
||||
_down_arrow._effect = 0.0f;
|
||||
|
||||
} else {
|
||||
throttle = _down_arrow.get_effect(_vertical_ramp_up_time,
|
||||
_vertical_ramp_down_time);
|
||||
_speed = -throttle * _reverse_speed;
|
||||
_up_arrow._effect = 0.0;
|
||||
_up_arrow._effect = 0.0f;
|
||||
}
|
||||
|
||||
// Which horizontal arrow key changed state more recently?
|
||||
|
|
@ -313,19 +313,19 @@ apply(double x, double y, bool any_button) {
|
|||
throttle = _right_arrow.get_effect(_horizontal_ramp_up_time,
|
||||
_horizontal_ramp_down_time);
|
||||
_rot_speed = throttle * _rotate_speed;
|
||||
_left_arrow._effect = 0.0;
|
||||
_left_arrow._effect = 0.0f;
|
||||
|
||||
} else {
|
||||
throttle = _left_arrow.get_effect(_horizontal_ramp_up_time,
|
||||
_horizontal_ramp_down_time);
|
||||
_rot_speed = -throttle * _rotate_speed;
|
||||
_right_arrow._effect = 0.0;
|
||||
_right_arrow._effect = 0.0f;
|
||||
}
|
||||
_right_arrow._effect = throttle;
|
||||
_left_arrow._effect = throttle;
|
||||
}
|
||||
|
||||
if (_speed == 0.0 && _rot_speed == 0.0) {
|
||||
if (_speed == 0.0f && _rot_speed == 0.0f) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -349,12 +349,12 @@ apply(double x, double y, bool any_button) {
|
|||
switch (_cs) {
|
||||
case CS_zup_right:
|
||||
case CS_zup_left:
|
||||
step[2] = 0.0;
|
||||
step[2] = 0.0f;
|
||||
break;
|
||||
|
||||
case CS_yup_right:
|
||||
case CS_yup_left:
|
||||
step[1] = 0.0;
|
||||
step[1] = 0.0f;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -400,7 +400,7 @@ reextract() {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
void DriveInterface::
|
||||
recompute() {
|
||||
compose_matrix(_mat, LVecBase3f(1.0, 1.0, 1.0), _hpr, _xyz, _cs);
|
||||
compose_matrix(_mat, LVecBase3f(1.0f, 1.0f, 1.0f), _hpr, _xyz, _cs);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -413,8 +413,8 @@ void DriveInterface::
|
|||
transmit_data(AllTransitionsWrapper &data) {
|
||||
|
||||
// Look for mouse activity.
|
||||
double x = 0.0;
|
||||
double y = 0.0;
|
||||
double x = 0.0f;
|
||||
double y = 0.0f;
|
||||
|
||||
bool got_mouse = false;
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ is_mouse_open() const {
|
|||
INLINE const LPoint2f &MouseWatcher::
|
||||
get_mouse() const {
|
||||
#ifndef NDEBUG
|
||||
static LPoint2f bogus_mouse(0.0, 0.0);
|
||||
static LPoint2f bogus_mouse(0.0f, 0.0f);
|
||||
nassertr(_has_mouse, bogus_mouse);
|
||||
#endif
|
||||
return _mouse;
|
||||
|
|
@ -66,7 +66,7 @@ get_mouse() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE float MouseWatcher::
|
||||
get_mouse_x() const {
|
||||
nassertr(_has_mouse, 0.0);
|
||||
nassertr(_has_mouse, 0.0f);
|
||||
return _mouse[0];
|
||||
}
|
||||
|
||||
|
|
@ -79,7 +79,7 @@ get_mouse_x() const {
|
|||
////////////////////////////////////////////////////////////////////
|
||||
INLINE float MouseWatcher::
|
||||
get_mouse_y() const {
|
||||
nassertr(_has_mouse, 0.0);
|
||||
nassertr(_has_mouse, 0.0f);
|
||||
return _mouse[1];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ PlanarSlider::
|
|||
PlanarSlider(const string &name) : DataNode(name) {
|
||||
_cs = default_coordinate_system;
|
||||
|
||||
_mouse_pos.set(0.0, 0.0);
|
||||
_mouse_pos.set(0.0f, 0.0f);
|
||||
_transform_mat = LMatrix4f::ident_mat();
|
||||
|
||||
_transform = new MatrixDataTransition;
|
||||
|
|
@ -103,7 +103,7 @@ void PlanarSlider::
|
|||
set_transform(const LMatrix4f &trans) {
|
||||
_transform_mat = trans;
|
||||
_inverse_mat = invert(trans);
|
||||
_inverse_mat.set_row(3, LVector3f(0.0, 0.0, 0.0));
|
||||
_inverse_mat.set_row(3, LVector3f(0.0f, 0.0f, 0.0f));
|
||||
set_mouse_pos(_mouse_pos);
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +137,7 @@ set_mouse_pos(const LPoint2f &mouse_pos) {
|
|||
_inverse_mat *
|
||||
LMatrix4f::translate_mat(LVector3f::rfu(_mouse_pos[0],
|
||||
_mouse_pos[1],
|
||||
0.0,
|
||||
0.0f,
|
||||
_cs)) *
|
||||
_transform_mat;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,13 +44,13 @@ TypeHandle Trackball::_transform_type;
|
|||
////////////////////////////////////////////////////////////////////
|
||||
Trackball::
|
||||
Trackball(const string &name) : DataNode(name) {
|
||||
_rotscale = 0.3;
|
||||
_fwdscale = 0.3;
|
||||
_rotscale = 0.3f;
|
||||
_fwdscale = 0.3f;
|
||||
|
||||
_lastx = _lasty = 0.5;
|
||||
_lastx = _lasty = 0.5f;
|
||||
|
||||
_rotation = LMatrix4f::ident_mat();
|
||||
_translation.set(0.0, 0.0, 0.0);
|
||||
_translation.set(0.0f, 0.0f, 0.0f);
|
||||
_mat = LMatrix4f::ident_mat();
|
||||
_orig = LMatrix4f::ident_mat();
|
||||
_invert = true;
|
||||
|
|
@ -83,7 +83,7 @@ Trackball::
|
|||
void Trackball::
|
||||
reset() {
|
||||
_rotation = LMatrix4f::ident_mat();
|
||||
_translation.set(0.0, 0.0, 0.0);
|
||||
_translation.set(0.0f, 0.0f, 0.0f);
|
||||
_orig = LMatrix4f::ident_mat();
|
||||
_mat = LMatrix4f::ident_mat();
|
||||
}
|
||||
|
|
@ -246,7 +246,7 @@ void Trackball::
|
|||
reset_origin_here() {
|
||||
recompute();
|
||||
_rotation = _orig;
|
||||
_translation.set(0.0, 0.0, 0.0);
|
||||
_translation.set(0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -448,7 +448,7 @@ reextract() {
|
|||
|
||||
m.get_row3(_translation,3);
|
||||
_rotation = m;
|
||||
_rotation.set_row(3, LVecBase3f(0.0, 0.0, 0.0));
|
||||
_rotation.set_row(3, LVecBase3f(0.0f, 0.0f, 0.0f));
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue