void SGSampleGroup::update_pos_and_orientation() {
SGVec3d position = _base_pos - _smgr->get_position();
+ SGQuatd hlOr = SGQuatd::fromLonLat(_position_geod) * _orientation;
sample_map_iterator sample_current = _samples.begin();
sample_map_iterator sample_end = _samples.end();
SGSoundSample *sample = sample_current->second;
sample->set_position( position );
sample->set_orientation( _orientation );
+ sample->set_rotation( hlOr );
}
}
_orientation(SGQuatd::zeros()),
_orivec(SGVec3f::zeros()),
_base_pos(SGVec3d::zeros()),
+ _rotation(SGQuatd::zeros()),
_refname(random_string()),
_data(NULL),
_format(AL_FORMAT_MONO8),
_orientation(SGQuatd::zeros()),
_orivec(SGVec3f::zeros()),
_base_pos(SGVec3d::zeros()),
+ _rotation(SGQuatd::zeros()),
_refname(file),
_data(NULL),
_format(AL_FORMAT_MONO8),
_orientation(SGQuatd::zeros()),
_orivec(SGVec3f::zeros()),
_base_pos(SGVec3d::zeros()),
+ _rotation(SGQuatd::zeros()),
_refname(random_string()),
_format(format),
_size(len),
_orientation(SGQuatd::zeros()),
_orivec(SGVec3f::zeros()),
_base_pos(SGVec3d::zeros()),
+ _rotation(SGQuatd::zeros()),
_refname(random_string()),
_format(format),
_size(len),
_absolute_pos = _base_pos;
if ( _relative_pos[0] || _relative_pos[1] || _relative_pos[2] ) {
- _absolute_pos += _orientation.backTransform(_relative_pos);
+ _absolute_pos += _rotation.backTransform(_relative_pos);
}
if ( _direction[0] || _direction[1] || _direction[2] ) {
- _orivec = toVec3f( _orientation.rotate(_direction) );
+ _orivec = toVec3f(_rotation.rotate(_direction) );
}
else
_orivec = SGVec3f::zeros();
_orientation = ori; _changed = true;
}
+ inline void set_rotation( const SGQuatd& ori ) {
+ _rotation = ori; _changed = true;
+ }
+
/**
* Set direction of this sound relative to the orientation.
* This is in the same coordinate system as OpenGL; y=up, z=back, x=right
SGVec3f _orivec; // orientation vector for OpenAL
SGVec3d _base_pos; // base position
+ SGQuatd _rotation;
+
std::string _refname; // name or file path
unsigned char* _data;