… | |
… | |
2518 | |
2518 | |
2519 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
2519 | MODULE = cf PACKAGE = cf::face PREFIX = face_ |
2520 | |
2520 | |
2521 | INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
2521 | INCLUDE: $PERL $srcdir/genacc faceset ../include/face.h | |
2522 | |
2522 | |
2523 | int face_find (const char *name, int defidx = 0) |
2523 | faceidx face_find (const char *name, faceidx defidx = 0) |
2524 | |
2524 | |
2525 | int alloc (const char *name) |
2525 | faceidx alloc (const char *name) |
2526 | CODE: |
2526 | CODE: |
2527 | { |
2527 | { |
2528 | do |
2528 | do |
2529 | { |
2529 | { |
2530 | RETVAL = faces.size (); |
2530 | RETVAL = faces.size (); |
2531 | faces.resize (RETVAL + 1); |
2531 | faces.resize (RETVAL + 1); |
2532 | face32.resize (RETVAL + 1); |
|
|
2533 | face64.resize (RETVAL + 1); |
|
|
2534 | } |
2532 | } |
2535 | while (!RETVAL); // crude way to leave index 0 |
2533 | while (!RETVAL); // crude way to leave index 0 |
2536 | |
2534 | |
2537 | faces [RETVAL].name = name; |
2535 | faces [RETVAL].name = name; |
2538 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
2536 | facehash.insert (std::make_pair (faces [RETVAL].name, RETVAL)); |
… | |
… | |
2540 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
2538 | if (!strcmp (name, BLANK_FACE_NAME)) blank_face = RETVAL; |
2541 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
2539 | if (!strcmp (name, EMPTY_FACE_NAME)) empty_face = RETVAL; |
2542 | } |
2540 | } |
2543 | OUTPUT: RETVAL |
2541 | OUTPUT: RETVAL |
2544 | |
2542 | |
2545 | void set (int idx, int visibility, int magicmap) |
2543 | void set (faceidx idx, int visibility, int magicmap) |
2546 | CODE: |
2544 | CODE: |
|
|
2545 | faceinfo *f = face_info (idx); |
|
|
2546 | assert (f); |
2547 | faces [idx].visibility = visibility; |
2547 | f->visibility = visibility; |
2548 | faces [idx].magicmap = magicmap; |
2548 | f->magicmap = magicmap; |
2549 | |
2549 | |
|
|
2550 | void set_smooth (faceidx idx, faceidx smooth) |
|
|
2551 | CODE: |
|
|
2552 | faceinfo *f = face_info (idx); |
|
|
2553 | assert (f); |
|
|
2554 | f->smooth = smooth; |
|
|
2555 | |
2550 | void set_data (int idx, int faceset, SV *data, SV *chksum) |
2556 | void set_data (faceidx idx, int faceset, SV *data, SV *chksum) |
2551 | CODE: |
2557 | CODE: |
2552 | facedata *d = face_data (idx, faceset); |
2558 | facedata *d = face_data (idx, faceset); |
|
|
2559 | assert (d); |
2553 | assert (sv_len (chksum) == CHKSUM_SIZE); |
2560 | assert (sv_len (chksum) == CHKSUM_SIZE); |
2554 | sv_to (data, d->data); memcpy (d->chksum, SvPVbyte_nolen (chksum), CHKSUM_SIZE); |
2561 | sv_to (data, d->data); memcpy (d->chksum, SvPVbyte_nolen (chksum), CHKSUM_SIZE); |
2555 | |
2562 | |
|
|
2563 | void invalidate (faceidx idx) |
|
|
2564 | CODE: |
|
|
2565 | for_all_clients (ns) |
|
|
2566 | ns->faces_sent [idx] = 0; |
|
|
2567 | |
|
|
2568 | void invalidate_all () |
|
|
2569 | CODE: |
|
|
2570 | for_all_clients (ns) |
|
|
2571 | memset (ns->faces_sent, 0, sizeof (ns->faces_sent)); |
|
|
2572 | |