107 check_started(get_class_type(),
"priv_step");
109 double d = compute_delta(t);
114 if ((_flags & (F_end_pos | F_end_hpr | F_end_quat | F_end_scale | F_end_shear)) != 0) {
118 if (_other.is_empty()) {
120 transform = _node.get_transform();
124 transform = _node.get_transform(_other);
133 if ((_flags & F_end_pos) != 0) {
134 if ((_flags & F_start_pos) != 0) {
137 }
else if ((_flags & F_bake_in_start) != 0) {
144 pos = transform->get_pos();
148 if ((_flags & F_end_hpr) != 0) {
149 if ((_flags & F_start_hpr) != 0) {
152 }
else if ((_flags & F_start_quat) != 0) {
153 _start_hpr = _start_quat.get_hpr();
154 _flags |= F_start_hpr;
157 }
else if ((_flags & F_bake_in_start) != 0) {
162 hpr = transform->get_hpr();
166 if ((_flags & F_end_quat) != 0) {
167 if ((_flags & F_slerp_setup) == 0) {
168 if ((_flags & F_start_quat) != 0) {
171 }
else if ((_flags & F_start_hpr) != 0) {
172 _start_quat.set_hpr(_start_hpr);
173 _flags |= F_start_quat;
176 }
else if ((_flags & F_bake_in_start) != 0) {
181 if (_prev_d == 1.0) {
182 _start_quat = _end_quat;
184 LQuaternion prev_value = transform->get_norm_quat();
185 _start_quat = (prev_value - _prev_d * _end_quat) / (1.0 - _prev_d);
191 _flags &= ~F_slerp_setup;
194 nassertv(_slerp !=
nullptr);
195 (this->*_slerp)(quat, d);
197 if ((_flags & F_end_scale) != 0) {
198 if ((_flags & F_start_scale) != 0) {
199 lerp_value(scale, d, _start_scale, _end_scale);
201 }
else if ((_flags & F_bake_in_start) != 0) {
203 lerp_value(scale, d, _start_scale, _end_scale);
206 scale = transform->get_scale();
210 if ((_flags & F_end_shear) != 0) {
211 if ((_flags & F_start_shear) != 0) {
212 lerp_value(shear, d, _start_shear, _end_shear);
214 }
else if ((_flags & F_bake_in_start) != 0) {
216 lerp_value(shear, d, _start_shear, _end_shear);
219 shear = transform->get_shear();
228 unsigned int transform_flags = _flags & (F_end_pos | F_end_hpr | F_end_quat | F_end_scale);
229 switch (transform_flags) {
234 if (_other.is_empty()) {
237 _node.set_pos(_other, pos);
242 if (_other.is_empty()) {
245 _node.set_hpr(_other, hpr);
250 if (_other.is_empty()) {
251 _node.set_quat(quat);
253 _node.set_quat(_other, quat);
258 if (_other.is_empty()) {
259 _node.set_scale(scale);
261 _node.set_scale(_other, scale);
265 case F_end_hpr | F_end_scale:
266 if (_other.is_empty()) {
267 _node.set_hpr_scale(hpr, scale);
269 _node.set_hpr_scale(hpr, scale);
273 case F_end_quat | F_end_scale:
274 if (_other.is_empty()) {
275 _node.set_quat_scale(quat, scale);
277 _node.set_quat_scale(quat, scale);
281 case F_end_pos | F_end_hpr:
282 if (_other.is_empty()) {
283 _node.set_pos_hpr(pos, hpr);
285 _node.set_pos_hpr(_other, pos, hpr);
289 case F_end_pos | F_end_quat:
290 if (_other.is_empty()) {
291 _node.set_pos_quat(pos, quat);
293 _node.set_pos_quat(_other, pos, quat);
297 case F_end_pos | F_end_scale:
298 if (transform->quat_given()) {
299 if (_other.is_empty()) {
300 _node.set_pos_quat_scale(pos, transform->get_quat(), scale);
302 _node.set_pos_quat_scale(_other, pos, transform->get_quat(), scale);
305 if (_other.is_empty()) {
306 _node.set_pos_hpr_scale(pos, transform->get_hpr(), scale);
308 _node.set_pos_hpr_scale(_other, pos, transform->get_hpr(), scale);
313 case F_end_pos | F_end_hpr | F_end_scale:
314 if ((_flags & F_end_shear) != 0) {
316 if (_other.is_empty()) {
317 _node.set_pos_hpr_scale_shear(pos, hpr, scale, shear);
319 _node.set_pos_hpr_scale_shear(_other, pos, hpr, scale, shear);
323 if (_other.is_empty()) {
324 _node.set_pos_hpr_scale(pos, hpr, scale);
326 _node.set_pos_hpr_scale(_other, pos, hpr, scale);
331 case F_end_pos | F_end_quat | F_end_scale:
332 if ((_flags & F_end_shear) != 0) {
334 if (_other.is_empty()) {
335 _node.set_pos_quat_scale_shear(pos, quat, scale, shear);
337 _node.set_pos_quat_scale_shear(_other, pos, quat, scale, shear);
341 if (_other.is_empty()) {
342 _node.set_pos_quat_scale(pos, quat, scale);
344 _node.set_pos_quat_scale(_other, pos, quat, scale);
352 <<
"Internal error in CLerpNodePathInterval::priv_step().\n";
354 if ((_flags & F_end_shear) != 0) {
356 if (transform_flags == (F_end_pos | F_end_hpr | F_end_scale) ||
357 transform_flags == (F_end_pos | F_end_quat | F_end_scale)) {
361 if (_other.is_empty()) {
362 _node.set_shear(shear);
364 _node.set_shear(_other, shear);
370 if ((_flags & F_fluid) != 0) {
374 _node.set_prev_transform(prev_transform);
377 if ((_flags & (F_end_color | F_end_color_scale | F_end_tex_offset | F_end_tex_rotate | F_end_tex_scale)) != 0) {
381 if (_other.is_empty()) {
384 state = _node.get_state();
389 state = _node.get_state(_other);
396 if ((_flags & F_end_color) != 0) {
399 if ((_flags & F_start_color) != 0) {
400 lerp_value(color, d, _start_color, _end_color);
404 color.set(1.0f, 1.0f, 1.0f, 1.0f);
406 state->get_attrib(ColorAttrib::get_class_type());
407 if (attrib !=
nullptr) {
420 if ((_flags & F_end_color_scale) != 0) {
421 LVecBase4 color_scale;
423 if ((_flags & F_start_color_scale) != 0) {
424 lerp_value(color_scale, d, _start_color_scale, _end_color_scale);
428 color_scale.set(1.0f, 1.0f, 1.0f, 1.0f);
430 state->get_attrib(ColorScaleAttrib::get_class_type());
431 if (attrib !=
nullptr) {
442 if ((_flags & (F_end_tex_offset | F_end_tex_rotate | F_end_tex_scale)) != 0) {
447 state->get_attrib(TexMatrixAttrib::get_class_type());
449 if (attrib !=
nullptr) {
451 transform = tma->get_transform(_texture_stage);
456 if ((_flags & F_end_tex_offset) != 0) {
457 LVecBase2 tex_offset;
459 if ((_flags & F_start_tex_offset) != 0) {
460 lerp_value(tex_offset, d, _start_tex_offset, _end_tex_offset);
462 tex_offset = transform->get_pos2d();
467 transform = transform->set_pos2d(tex_offset);
470 if ((_flags & F_end_tex_rotate) != 0) {
471 PN_stdfloat tex_rotate;
473 if ((_flags & F_start_tex_rotate) != 0) {
474 lerp_value(tex_rotate, d, _start_tex_rotate, _end_tex_rotate);
476 tex_rotate = transform->get_rotate2d();
481 transform = transform->set_rotate2d(tex_rotate);
484 if ((_flags & F_end_tex_scale) != 0) {
487 if ((_flags & F_start_tex_scale) != 0) {
488 lerp_value(tex_scale, d, _start_tex_scale, _end_tex_scale);
490 tex_scale = transform->get_scale2d();
495 transform = transform->set_scale2d(tex_scale);
499 state = state->set_attrib(tma->add_stage(_texture_stage, transform, _override));
504 if (_other.is_empty()) {
505 _node.set_state(state);
507 _node.set_state(_other, state);