goat3d

annotate src/xform_node.cc @ 58:d317eb4f83da

- made everything compile properly on windows again - removed libanim/libvmath, we'll use them as external dependencies - added new maxgoat_stub 3dsmax plugin project. Gets loaded as a max plugin and loads the actual maxgoat (and later maxgoat_anim) exporters on demand, to allow reloading the actual exporters without having to restart 3dsmax (which takes AGES).
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 25 Mar 2014 03:19:55 +0200
parents 498ca7ac7047
children dad392c710df 3751aabbc5b3
rev   line source
nuclear@1 1 #include <assert.h>
nuclear@1 2 #include <algorithm>
nuclear@1 3 #include "xform_node.h"
nuclear@47 4 #include "anim/anim.h"
nuclear@47 5 #include "anim/track.h"
nuclear@47 6
nuclear@47 7 using namespace g3dimpl;
nuclear@1 8
nuclear@1 9 static inline anm_interpolator track_interpolator(Interp in);
nuclear@1 10 static inline anm_extrapolator track_extrapolator(Extrap ex);
nuclear@1 11
nuclear@1 12 XFormNode::XFormNode()
nuclear@1 13 {
nuclear@1 14 anm = new anm_node;
nuclear@1 15 anm_init_node(anm);
nuclear@47 16 parent = 0;
nuclear@30 17
nuclear@47 18 // TODO read them from anm to get the correct initial values
nuclear@47 19 interp = INTERP_LINEAR;
nuclear@47 20 extrap = EXTRAP_EXTEND;
nuclear@1 21 }
nuclear@1 22
nuclear@1 23 XFormNode::~XFormNode()
nuclear@1 24 {
nuclear@1 25 anm_destroy_node(anm);
nuclear@1 26 delete anm;
nuclear@1 27 }
nuclear@1 28
nuclear@47 29 struct anm_node *XFormNode::get_libanim_node() const
nuclear@47 30 {
nuclear@47 31 return anm;
nuclear@47 32 }
nuclear@47 33
nuclear@1 34 void XFormNode::set_name(const char *name)
nuclear@1 35 {
nuclear@1 36 anm_set_node_name(anm, name);
nuclear@1 37 }
nuclear@1 38
nuclear@1 39 const char *XFormNode::get_name() const
nuclear@1 40 {
nuclear@1 41 return anm_get_node_name(anm);
nuclear@1 42 }
nuclear@1 43
nuclear@1 44 void XFormNode::set_interpolator(Interp in)
nuclear@1 45 {
nuclear@1 46 anm_set_interpolator(anm, track_interpolator(in));
nuclear@1 47 interp = in;
nuclear@1 48 }
nuclear@1 49
nuclear@1 50 Interp XFormNode::get_interpolator() const
nuclear@1 51 {
nuclear@1 52 return interp;
nuclear@1 53 }
nuclear@1 54
nuclear@1 55 void XFormNode::set_extrapolator(Extrap ex)
nuclear@1 56 {
nuclear@1 57 anm_set_extrapolator(anm, track_extrapolator(ex));
nuclear@1 58 extrap = ex;
nuclear@1 59 }
nuclear@1 60
nuclear@1 61 Extrap XFormNode::get_extrapolator() const
nuclear@1 62 {
nuclear@1 63 return extrap;
nuclear@1 64 }
nuclear@1 65
nuclear@47 66 XFormNode *XFormNode::get_parent()
nuclear@47 67 {
nuclear@47 68 return parent;
nuclear@47 69 }
nuclear@47 70
nuclear@47 71 const XFormNode *XFormNode::get_parent() const
nuclear@47 72 {
nuclear@47 73 return parent;
nuclear@47 74 }
nuclear@47 75
nuclear@1 76 void XFormNode::add_child(XFormNode *child)
nuclear@1 77 {
nuclear@1 78 children.push_back(child);
nuclear@1 79 anm_link_node(anm, child->anm);
nuclear@30 80 child->parent = this;
nuclear@1 81 }
nuclear@1 82
nuclear@1 83 void XFormNode::remove_child(XFormNode *child)
nuclear@1 84 {
nuclear@1 85 std::vector<XFormNode*>::iterator it;
nuclear@1 86 it = std::find(children.begin(), children.end(), child);
nuclear@1 87 if(it != children.end()) {
nuclear@1 88 children.erase(it);
nuclear@1 89 anm_unlink_node(anm, child->anm);
nuclear@47 90
nuclear@47 91 if(child->parent == this) {
nuclear@47 92 child->parent = 0;
nuclear@47 93 }
nuclear@1 94 }
nuclear@1 95 }
nuclear@1 96
nuclear@1 97 int XFormNode::get_children_count() const
nuclear@1 98 {
nuclear@1 99 return (int)children.size();
nuclear@1 100 }
nuclear@1 101
nuclear@1 102 XFormNode *XFormNode::get_child(int idx)
nuclear@1 103 {
nuclear@1 104 if(idx >= 0 && idx < get_children_count()) {
nuclear@1 105 return children[idx];
nuclear@1 106 }
nuclear@1 107 return 0;
nuclear@1 108 }
nuclear@1 109
nuclear@1 110 const XFormNode *XFormNode::get_child(int idx) const
nuclear@1 111 {
nuclear@1 112 if(idx >= 0 && idx < get_children_count()) {
nuclear@1 113 return children[idx];
nuclear@1 114 }
nuclear@1 115 return 0;
nuclear@1 116 }
nuclear@1 117
nuclear@47 118
nuclear@47 119 void XFormNode::use_animation(int idx)
nuclear@30 120 {
nuclear@47 121 if(idx >= 0) {
nuclear@47 122 anm_use_animation(anm, idx);
nuclear@47 123 }
nuclear@30 124 }
nuclear@30 125
nuclear@47 126 void XFormNode::use_animation(const char *name)
nuclear@47 127 {
nuclear@47 128 anm_use_animation(anm, anm_find_animation(anm, name));
nuclear@47 129 }
nuclear@47 130
nuclear@47 131 void XFormNode::use_animation(int aidx, int bidx, float t)
nuclear@47 132 {
nuclear@47 133 anm_use_animations(anm, aidx, bidx, t);
nuclear@47 134 }
nuclear@47 135
nuclear@47 136 void XFormNode::use_animation(const char *aname, const char *bname, float t)
nuclear@47 137 {
nuclear@47 138 int aidx = anm_find_animation(anm, aname);
nuclear@47 139 int bidx = anm_find_animation(anm, bname);
nuclear@47 140
nuclear@47 141 if(aidx == -1) {
nuclear@47 142 use_animation(bidx);
nuclear@47 143 }
nuclear@47 144 if(bidx == -1) {
nuclear@47 145 use_animation(aidx);
nuclear@47 146 }
nuclear@47 147 anm_use_animations(anm, aidx, bidx, t);
nuclear@47 148 }
nuclear@47 149
nuclear@47 150 int XFormNode::get_active_animation_index(int which) const
nuclear@47 151 {
nuclear@47 152 return anm_get_active_animation_index(anm, which);
nuclear@47 153 }
nuclear@47 154
nuclear@47 155 float XFormNode::get_active_animation_mix() const
nuclear@47 156 {
nuclear@47 157 return anm_get_active_animation_mix(anm);
nuclear@47 158 }
nuclear@47 159
nuclear@47 160 int XFormNode::get_animation_count() const
nuclear@47 161 {
nuclear@47 162 return anm_get_animation_count(anm);
nuclear@47 163 }
nuclear@47 164
nuclear@47 165 void XFormNode::add_animation(const char *name)
nuclear@47 166 {
nuclear@47 167 int idx = get_animation_count();
nuclear@47 168
nuclear@47 169 anm_add_animation(anm);
nuclear@47 170 use_animation(idx);
nuclear@47 171
nuclear@47 172 if(name) {
nuclear@47 173 set_animation_name(name);
nuclear@47 174 }
nuclear@47 175 }
nuclear@47 176
nuclear@47 177 void XFormNode::set_animation_name(const char *name)
nuclear@47 178 {
nuclear@47 179 anm_set_active_animation_name(anm, name);
nuclear@47 180 }
nuclear@47 181
nuclear@47 182 const char *XFormNode::get_animation_name() const
nuclear@47 183 {
nuclear@47 184 return anm_get_active_animation_name(anm);
nuclear@47 185 }
nuclear@47 186
nuclear@48 187 static const int track_type_base[] = {ANM_TRACK_POS_X, ANM_TRACK_ROT_X, ANM_TRACK_SCL_X};
nuclear@48 188 static const int track_type_nelem[] = {3, 4, 3};
nuclear@47 189
nuclear@48 190 int XFormNode::get_key_count(int trackid) const
nuclear@48 191 {
nuclear@48 192 struct anm_animation *anim = anm_get_active_animation(anm, 0);
nuclear@48 193 return anim->tracks[track_type_base[trackid]].count;
nuclear@48 194 }
nuclear@48 195
nuclear@48 196 int XFormNode::get_position_key_count() const
nuclear@48 197 {
nuclear@48 198 return get_key_count(POSITION_TRACK);
nuclear@48 199 }
nuclear@48 200
nuclear@48 201 int XFormNode::get_rotation_key_count() const
nuclear@48 202 {
nuclear@48 203 return get_key_count(ROTATION_TRACK);
nuclear@48 204 }
nuclear@48 205
nuclear@48 206 int XFormNode::get_scaling_key_count() const
nuclear@48 207 {
nuclear@48 208 return get_key_count(SCALING_TRACK);
nuclear@48 209 }
nuclear@48 210
nuclear@48 211 long XFormNode::get_key_time(int trackid, int idx) const
nuclear@48 212 {
nuclear@48 213 struct anm_animation *anim = anm_get_active_animation(anm, 0);
nuclear@48 214 struct anm_keyframe *key = anm_get_keyframe(anim->tracks + track_type_base[trackid], idx);
nuclear@48 215 return ANM_TM2MSEC(key->time);
nuclear@48 216 }
nuclear@48 217
nuclear@48 218 long XFormNode::get_position_key_time(int idx) const
nuclear@48 219 {
nuclear@48 220 return get_key_time(POSITION_TRACK, idx);
nuclear@48 221 }
nuclear@48 222
nuclear@48 223 long XFormNode::get_rotation_key_time(int idx) const
nuclear@48 224 {
nuclear@48 225 return get_key_time(ROTATION_TRACK, idx);
nuclear@48 226 }
nuclear@48 227
nuclear@48 228 long XFormNode::get_scaling_key_time(int idx) const
nuclear@48 229 {
nuclear@48 230 return get_key_time(SCALING_TRACK, idx);
nuclear@48 231 }
nuclear@48 232
nuclear@48 233 int XFormNode::get_key_value(int trackid, int idx, float *val) const
nuclear@48 234 {
nuclear@48 235 struct anm_animation *anim = anm_get_active_animation(anm, 0);
nuclear@48 236
nuclear@48 237 int nelem = track_type_nelem[trackid];
nuclear@48 238 for(int i=0; i<nelem; i++) {
nuclear@48 239 struct anm_keyframe *key = anm_get_keyframe(anim->tracks + track_type_base[trackid] + i, idx);
nuclear@48 240 val[i] = key->val;
nuclear@48 241 }
nuclear@48 242 return nelem;
nuclear@48 243 }
nuclear@48 244
nuclear@48 245 Vector3 XFormNode::get_position_key_value(int idx) const
nuclear@48 246 {
nuclear@48 247 float val[3];
nuclear@48 248 get_key_value(POSITION_TRACK, idx, val);
nuclear@48 249 return Vector3(val[0], val[1], val[2]);
nuclear@48 250 }
nuclear@48 251
nuclear@48 252 Quaternion XFormNode::get_rotation_key_value(int idx) const
nuclear@48 253 {
nuclear@48 254 float val[4];
nuclear@48 255 get_key_value(ROTATION_TRACK, idx, val);
nuclear@48 256 return Quaternion(val[3], val[0], val[1], val[2]);
nuclear@48 257 }
nuclear@48 258
nuclear@48 259 Vector3 XFormNode::get_scaling_key_value(int idx) const
nuclear@48 260 {
nuclear@48 261 float val[3];
nuclear@48 262 get_key_value(SCALING_TRACK, idx, val);
nuclear@48 263 return Vector3(val[0], val[1], val[2]);
nuclear@48 264 }
nuclear@47 265
nuclear@1 266 void XFormNode::set_position(const Vector3 &pos, long tmsec)
nuclear@1 267 {
nuclear@1 268 anm_set_position(anm, v3_cons(pos.x, pos.y, pos.z), ANM_MSEC2TM(tmsec));
nuclear@1 269 }
nuclear@1 270
nuclear@1 271 Vector3 XFormNode::get_node_position(long tmsec) const
nuclear@1 272 {
nuclear@1 273 vec3_t p = anm_get_node_position(anm, ANM_MSEC2TM(tmsec));
nuclear@1 274 return Vector3(p.x, p.y, p.z);
nuclear@1 275 }
nuclear@1 276
nuclear@1 277 void XFormNode::set_rotation(const Quaternion &quat, long tmsec)
nuclear@1 278 {
nuclear@1 279 anm_set_rotation(anm, quat_cons(quat.s, quat.v.x, quat.v.y, quat.v.z), ANM_MSEC2TM(tmsec));
nuclear@1 280 }
nuclear@1 281
nuclear@1 282 Quaternion XFormNode::get_node_rotation(long tmsec) const
nuclear@1 283 {
nuclear@1 284 quat_t q = anm_get_node_rotation(anm, ANM_MSEC2TM(tmsec));
nuclear@1 285 return Quaternion(q.w, q.x, q.y, q.z);
nuclear@1 286 }
nuclear@1 287
nuclear@1 288 void XFormNode::set_scaling(const Vector3 &pos, long tmsec)
nuclear@1 289 {
nuclear@1 290 anm_set_scaling(anm, v3_cons(pos.x, pos.y, pos.z), ANM_MSEC2TM(tmsec));
nuclear@1 291 }
nuclear@1 292
nuclear@1 293 Vector3 XFormNode::get_node_scaling(long tmsec) const
nuclear@1 294 {
nuclear@1 295 vec3_t s = anm_get_node_scaling(anm, ANM_MSEC2TM(tmsec));
nuclear@1 296 return Vector3(s.x, s.y, s.z);
nuclear@1 297 }
nuclear@1 298
nuclear@1 299 // these take hierarchy into account
nuclear@1 300 Vector3 XFormNode::get_position(long tmsec) const
nuclear@1 301 {
nuclear@1 302 vec3_t v = anm_get_position(anm, ANM_MSEC2TM(tmsec));
nuclear@1 303 return Vector3(v.x, v.y, v.z);
nuclear@1 304 }
nuclear@1 305
nuclear@1 306 Quaternion XFormNode::get_rotation(long tmsec) const
nuclear@1 307 {
nuclear@1 308 quat_t q = anm_get_rotation(anm, tmsec);
nuclear@1 309 return Quaternion(q.w, q.x, q.y, q.z);
nuclear@1 310 }
nuclear@1 311
nuclear@1 312 Vector3 XFormNode::get_scaling(long tmsec) const
nuclear@1 313 {
nuclear@1 314 vec3_t v = anm_get_scaling(anm, ANM_MSEC2TM(tmsec));
nuclear@1 315 return Vector3(v.x, v.y, v.z);
nuclear@1 316 }
nuclear@1 317
nuclear@1 318 void XFormNode::set_pivot(const Vector3 &pivot)
nuclear@1 319 {
nuclear@1 320 anm_set_pivot(anm, v3_cons(pivot.x, pivot.y, pivot.z));
nuclear@1 321 }
nuclear@1 322
nuclear@1 323 Vector3 XFormNode::get_pivot() const
nuclear@1 324 {
nuclear@1 325 vec3_t p = anm_get_pivot(anm);
nuclear@1 326 return Vector3(p.x, p.y, p.z);
nuclear@1 327 }
nuclear@1 328
nuclear@1 329 void XFormNode::set_local_matrix(const Matrix4x4 &mat)
nuclear@1 330 {
nuclear@1 331 local_matrix = mat;
nuclear@1 332 }
nuclear@1 333
nuclear@1 334 const Matrix4x4 &XFormNode::get_local_matrix() const
nuclear@1 335 {
nuclear@1 336 return local_matrix;
nuclear@1 337 }
nuclear@1 338
nuclear@1 339 void XFormNode::set_bone_matrix(const Matrix4x4 &bmat)
nuclear@1 340 {
nuclear@1 341 bone_matrix = bmat;
nuclear@1 342 }
nuclear@1 343
nuclear@1 344 const Matrix4x4 &XFormNode::get_bone_matrix() const
nuclear@1 345 {
nuclear@1 346 return bone_matrix;
nuclear@1 347 }
nuclear@1 348
nuclear@1 349 #define FOO
nuclear@1 350
nuclear@1 351 void XFormNode::get_node_xform(long tmsec, Matrix4x4 *mat, Matrix4x4 *inv_mat) const
nuclear@1 352 {
nuclear@1 353 anm_time_t tm = ANM_MSEC2TM(tmsec);
nuclear@1 354
nuclear@1 355 if(mat) {
nuclear@1 356 anm_get_node_matrix(anm, (scalar_t(*)[4])mat, tm);
nuclear@1 357 #ifdef FOO
nuclear@1 358 *mat = local_matrix * *mat;
nuclear@1 359 #else
nuclear@1 360 *mat = *mat * local_matrix;
nuclear@1 361 #endif
nuclear@1 362 }
nuclear@1 363 if(inv_mat) {
nuclear@1 364 anm_get_inv_matrix(anm, (scalar_t(*)[4])inv_mat, tm);
nuclear@1 365 }
nuclear@1 366 }
nuclear@1 367
nuclear@1 368 void XFormNode::get_xform(long tmsec, Matrix4x4 *mat, Matrix4x4 *inv_mat) const
nuclear@1 369 {
nuclear@1 370 anm_time_t tm = ANM_MSEC2TM(tmsec);
nuclear@1 371
nuclear@1 372 if(mat) {
nuclear@1 373 anm_get_matrix(anm, (scalar_t(*)[4])mat, tm);
nuclear@1 374 #ifdef FOO
nuclear@1 375 *mat = local_matrix * *mat;
nuclear@1 376 #else
nuclear@1 377 *mat = *mat * local_matrix;
nuclear@1 378 #endif
nuclear@1 379 }
nuclear@1 380 if(inv_mat) {
nuclear@1 381 anm_get_inv_matrix(anm, (scalar_t(*)[4])inv_mat, tm);
nuclear@1 382 }
nuclear@1 383 }
nuclear@1 384
nuclear@1 385
nuclear@1 386 // ---- Track ----
nuclear@1 387
nuclear@1 388 Track::Track()
nuclear@1 389 {
nuclear@1 390 trk = new anm_track;
nuclear@1 391 anm_init_track(trk);
nuclear@1 392 }
nuclear@1 393
nuclear@1 394 Track::~Track()
nuclear@1 395 {
nuclear@1 396 anm_destroy_track(trk);
nuclear@1 397 delete trk;
nuclear@1 398 }
nuclear@1 399
nuclear@1 400 Track::Track(const Track &rhs)
nuclear@1 401 {
nuclear@1 402 trk = new anm_track;
nuclear@1 403 anm_init_track(trk);
nuclear@1 404 anm_copy_track(trk, rhs.trk);
nuclear@1 405 interp = rhs.interp;
nuclear@1 406 extrap = rhs.extrap;
nuclear@1 407 }
nuclear@1 408
nuclear@1 409 Track &Track::operator =(const Track &rhs)
nuclear@1 410 {
nuclear@1 411 if(&rhs == this) {
nuclear@1 412 return *this;
nuclear@1 413 }
nuclear@1 414
nuclear@1 415 anm_copy_track(trk, rhs.trk);
nuclear@1 416 interp = rhs.interp;
nuclear@1 417 extrap = rhs.extrap;
nuclear@1 418 return *this;
nuclear@1 419 }
nuclear@1 420
nuclear@1 421
nuclear@1 422 void Track::set_interpolator(Interp in)
nuclear@1 423 {
nuclear@1 424 anm_set_track_interpolator(trk, track_interpolator(in));
nuclear@1 425 interp = in;
nuclear@1 426 }
nuclear@1 427
nuclear@1 428 Interp Track::get_interpolator() const
nuclear@1 429 {
nuclear@1 430 return interp;
nuclear@1 431 }
nuclear@1 432
nuclear@1 433 void Track::set_extrapolator(Extrap ex)
nuclear@1 434 {
nuclear@1 435 anm_set_track_extrapolator(trk, track_extrapolator(ex));
nuclear@1 436 extrap = ex;
nuclear@1 437 }
nuclear@1 438
nuclear@1 439 Extrap Track::get_extrapolator() const
nuclear@1 440 {
nuclear@1 441 return extrap;
nuclear@1 442 }
nuclear@1 443
nuclear@1 444 void Track::set_default(double def)
nuclear@1 445 {
nuclear@1 446 anm_set_track_default(trk, def);
nuclear@1 447 }
nuclear@1 448
nuclear@1 449 void Track::set_value(float val, long tmsec)
nuclear@1 450 {
nuclear@1 451 anm_set_value(trk, ANM_MSEC2TM(tmsec), val);
nuclear@1 452 }
nuclear@1 453
nuclear@1 454 float Track::get_value(long tmsec) const
nuclear@1 455 {
nuclear@1 456 return anm_get_value(trk, ANM_MSEC2TM(tmsec));
nuclear@1 457 }
nuclear@1 458
nuclear@1 459 float Track::operator ()(long tmsec) const
nuclear@1 460 {
nuclear@1 461 return anm_get_value(trk, ANM_MSEC2TM(tmsec));
nuclear@1 462 }
nuclear@1 463
nuclear@1 464
nuclear@1 465 // ---- Track3 ----
nuclear@1 466
nuclear@1 467 void Track3::set_interpolator(Interp in)
nuclear@1 468 {
nuclear@1 469 for(int i=0; i<3; i++) {
nuclear@1 470 track[i].set_interpolator(in);
nuclear@1 471 }
nuclear@1 472 }
nuclear@1 473
nuclear@1 474 Interp Track3::get_interpolator() const
nuclear@1 475 {
nuclear@1 476 return track[0].get_interpolator();
nuclear@1 477 }
nuclear@1 478
nuclear@1 479 void Track3::set_extrapolator(Extrap ex)
nuclear@1 480 {
nuclear@1 481 for(int i=0; i<3; i++) {
nuclear@1 482 track[i].set_extrapolator(ex);
nuclear@1 483 }
nuclear@1 484 }
nuclear@1 485
nuclear@1 486 Extrap Track3::get_extrapolator() const
nuclear@1 487 {
nuclear@1 488 return track[0].get_extrapolator();
nuclear@1 489 }
nuclear@1 490
nuclear@1 491 void Track3::set_default(const Vector3 &def)
nuclear@1 492 {
nuclear@1 493 for(int i=0; i<3; i++) {
nuclear@1 494 track[i].set_default(def[i]);
nuclear@1 495 }
nuclear@1 496 }
nuclear@1 497
nuclear@1 498 void Track3::set_value(const Vector3 &val, long tmsec)
nuclear@1 499 {
nuclear@1 500 for(int i=0; i<3; i++) {
nuclear@1 501 track[i].set_value(val[i], tmsec);
nuclear@1 502 }
nuclear@1 503 }
nuclear@1 504
nuclear@1 505 Vector3 Track3::get_value(long tmsec) const
nuclear@1 506 {
nuclear@1 507 return Vector3(track[0](tmsec), track[1](tmsec), track[2](tmsec));
nuclear@1 508 }
nuclear@1 509
nuclear@1 510 Vector3 Track3::operator ()(long tmsec) const
nuclear@1 511 {
nuclear@1 512 return Vector3(track[0](tmsec), track[1](tmsec), track[2](tmsec));
nuclear@1 513 }
nuclear@1 514
nuclear@1 515
nuclear@1 516 static inline anm_interpolator track_interpolator(Interp in)
nuclear@1 517 {
nuclear@1 518 switch(in) {
nuclear@1 519 case INTERP_STEP:
nuclear@1 520 return ANM_INTERP_STEP;
nuclear@1 521 case INTERP_LINEAR:
nuclear@1 522 return ANM_INTERP_LINEAR;
nuclear@1 523 case INTERP_CUBIC:
nuclear@1 524 return ANM_INTERP_CUBIC;
nuclear@1 525 }
nuclear@1 526
nuclear@1 527 assert(0);
nuclear@1 528 return ANM_INTERP_STEP;
nuclear@1 529 }
nuclear@1 530
nuclear@1 531 static inline anm_extrapolator track_extrapolator(Extrap ex)
nuclear@1 532 {
nuclear@1 533 switch(ex) {
nuclear@1 534 case EXTRAP_EXTEND:
nuclear@1 535 return ANM_EXTRAP_EXTEND;
nuclear@1 536 case EXTRAP_CLAMP:
nuclear@1 537 return ANM_EXTRAP_CLAMP;
nuclear@1 538 case EXTRAP_REPEAT:
nuclear@1 539 return ANM_EXTRAP_REPEAT;
nuclear@1 540 }
nuclear@1 541
nuclear@1 542 assert(0);
nuclear@1 543 return ANM_EXTRAP_EXTEND;
nuclear@1 544 }
nuclear@1 545