eggGroup.I 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002
  1. // Filename: eggGroup.I
  2. // Created by: drose (16Jan99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: EggGroup::get_group_type
  20. // Access: Published
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE EggGroup::GroupType EggGroup::
  24. get_group_type() const {
  25. return (GroupType)(_flags & F_group_type);
  26. }
  27. ////////////////////////////////////////////////////////////////////
  28. // Function: EggGroup::is_instance_type
  29. // Access: Published
  30. // Description: Returns true if this group is an instance type node;
  31. // i.e. it begins the root of a local coordinate space.
  32. // This is not related to instancing (multiple copies of
  33. // a node in a scene graph).
  34. //
  35. // This also includes the case of the node including a
  36. // billboard flag without an explicit center, which
  37. // implicitly makes the node behave like an instance.
  38. ////////////////////////////////////////////////////////////////////
  39. INLINE bool EggGroup::
  40. is_instance_type() const {
  41. return
  42. (get_group_type() == GT_instance) ||
  43. (get_billboard_type() != BT_none && !has_billboard_center());
  44. }
  45. ////////////////////////////////////////////////////////////////////
  46. // Function: EggGroup::set_billboard_type
  47. // Access: Published
  48. // Description:
  49. ////////////////////////////////////////////////////////////////////
  50. INLINE void EggGroup::
  51. set_billboard_type(BillboardType type) {
  52. // Make sure the user didn't give us any stray bits.
  53. nassertv((type & ~F_billboard_type)==0);
  54. _flags = (_flags & ~F_billboard_type) | type;
  55. // This may change the transform space of this node.
  56. update_under(0);
  57. }
  58. ////////////////////////////////////////////////////////////////////
  59. // Function: EggGroup::get_billboard_type
  60. // Access: Published
  61. // Description:
  62. ////////////////////////////////////////////////////////////////////
  63. INLINE EggGroup::BillboardType EggGroup::
  64. get_billboard_type() const {
  65. return (BillboardType)(_flags & F_billboard_type);
  66. }
  67. ////////////////////////////////////////////////////////////////////
  68. // Function: EggGroup::set_billboard_center
  69. // Access: Published
  70. // Description: Sets the point around which the billboard will
  71. // rotate, if this node contains a billboard
  72. // specification.
  73. //
  74. // If a billboard type is given but no billboard_center
  75. // is specified, then the group node is treated as an
  76. // <Instance>, and the billboard rotates around the
  77. // origin. If, however, a billboard_center is
  78. // specified, then the group node is *not* treated as an
  79. // <Instance>, and the billboard rotates around the
  80. // specified point.
  81. //
  82. // The point is in the same coordinate system as the
  83. // vertices of this node: usually global, but possibly
  84. // local if there is an <Instance> somewhere above.
  85. // Specifically, this is the coordinate system defined
  86. // by get_vertex_frame().
  87. ////////////////////////////////////////////////////////////////////
  88. INLINE void EggGroup::
  89. set_billboard_center(const LPoint3d &billboard_center) {
  90. _billboard_center = billboard_center;
  91. _flags2 |= F2_billboard_center;
  92. // This may change the transform space of this node.
  93. update_under(0);
  94. }
  95. ////////////////////////////////////////////////////////////////////
  96. // Function: EggGroup::clear_billboard_center
  97. // Access: Published
  98. // Description:
  99. ////////////////////////////////////////////////////////////////////
  100. INLINE void EggGroup::
  101. clear_billboard_center() {
  102. _flags2 &= ~F2_billboard_center;
  103. // This may change the transform space of this node.
  104. update_under(0);
  105. }
  106. ////////////////////////////////////////////////////////////////////
  107. // Function: EggGroup::has_billboard_center
  108. // Access: Published
  109. // Description:
  110. ////////////////////////////////////////////////////////////////////
  111. INLINE bool EggGroup::
  112. has_billboard_center() const {
  113. return (_flags2 & F2_billboard_center) != 0;
  114. }
  115. ////////////////////////////////////////////////////////////////////
  116. // Function: EggGroup::get_billboard_center
  117. // Access: Published
  118. // Description:
  119. ////////////////////////////////////////////////////////////////////
  120. INLINE const LPoint3d &EggGroup::
  121. get_billboard_center() const {
  122. nassertr(has_billboard_center(), _billboard_center);
  123. return _billboard_center;
  124. }
  125. ////////////////////////////////////////////////////////////////////
  126. // Function: EggGroup::set_cs_type
  127. // Access: Published
  128. // Description:
  129. ////////////////////////////////////////////////////////////////////
  130. INLINE void EggGroup::
  131. set_cs_type(CollisionSolidType type) {
  132. // Make sure the user didn't give us any stray bits.
  133. nassertv((type & ~F_cs_type)==0);
  134. _flags = (_flags & ~F_cs_type) | type;
  135. }
  136. ////////////////////////////////////////////////////////////////////
  137. // Function: EggGroup::get_cs_type
  138. // Access: Published
  139. // Description:
  140. ////////////////////////////////////////////////////////////////////
  141. INLINE EggGroup::CollisionSolidType EggGroup::
  142. get_cs_type() const {
  143. return (CollisionSolidType)(_flags & F_cs_type);
  144. }
  145. ////////////////////////////////////////////////////////////////////
  146. // Function: EggGroup::set_collision_name
  147. // Access: Published
  148. // Description:
  149. ////////////////////////////////////////////////////////////////////
  150. INLINE void EggGroup::
  151. set_collision_name(const string &collision_name) {
  152. _collision_name = collision_name;
  153. }
  154. ////////////////////////////////////////////////////////////////////
  155. // Function: EggGroup::clear_collision_name
  156. // Access: Published
  157. // Description:
  158. ////////////////////////////////////////////////////////////////////
  159. INLINE void EggGroup::
  160. clear_collision_name() {
  161. _collision_name = "";
  162. }
  163. ////////////////////////////////////////////////////////////////////
  164. // Function: EggGroup::has_collision_name
  165. // Access: Published
  166. // Description:
  167. ////////////////////////////////////////////////////////////////////
  168. INLINE bool EggGroup::
  169. has_collision_name() const {
  170. return !_collision_name.empty();
  171. }
  172. ////////////////////////////////////////////////////////////////////
  173. // Function: EggGroup::get_collision_name
  174. // Access: Published
  175. // Description:
  176. ////////////////////////////////////////////////////////////////////
  177. INLINE const string &EggGroup::
  178. get_collision_name() const {
  179. return _collision_name;
  180. }
  181. ////////////////////////////////////////////////////////////////////
  182. // Function: EggGroup::set_collide_flags
  183. // Access: Published
  184. // Description:
  185. ////////////////////////////////////////////////////////////////////
  186. INLINE void EggGroup::
  187. set_collide_flags(int flags) {
  188. // Make sure the user didn't give us any stray bits.
  189. nassertv((flags & ~F_collide_flags)==0);
  190. _flags = (_flags & ~F_collide_flags) | flags;
  191. }
  192. ////////////////////////////////////////////////////////////////////
  193. // Function: EggGroup::get_collide_flags
  194. // Access: Published
  195. // Description:
  196. ////////////////////////////////////////////////////////////////////
  197. INLINE EggGroup::CollideFlags EggGroup::
  198. get_collide_flags() const {
  199. return (EggGroup::CollideFlags)(_flags & F_collide_flags);
  200. }
  201. ////////////////////////////////////////////////////////////////////
  202. // Function: EggGroup::set_dcs_type
  203. // Access: Published
  204. // Description:
  205. ////////////////////////////////////////////////////////////////////
  206. INLINE void EggGroup::
  207. set_dcs_type(EggGroup::DCSType type) {
  208. // Make sure the user didn't give us any stray bits.
  209. nassertv((type & ~F2_dcs_type)==0);
  210. _flags2 = (_flags2 & ~F2_dcs_type) | type;
  211. }
  212. ////////////////////////////////////////////////////////////////////
  213. // Function: EggGroup::get_dcs_type
  214. // Access: Published
  215. // Description:
  216. ////////////////////////////////////////////////////////////////////
  217. INLINE EggGroup::DCSType EggGroup::
  218. get_dcs_type() const {
  219. return (DCSType)(_flags2 & F2_dcs_type);
  220. }
  221. ////////////////////////////////////////////////////////////////////
  222. // Function: EggGroup::has_dcs_type
  223. // Access: Published
  224. // Description: Returns true if the specified DCS type is not
  225. // DC_none and not DC_unspecified.
  226. ////////////////////////////////////////////////////////////////////
  227. INLINE bool EggGroup::
  228. has_dcs_type() const {
  229. DCSType type = get_dcs_type();
  230. return (type != DC_none && type != DC_unspecified);
  231. }
  232. ////////////////////////////////////////////////////////////////////
  233. // Function: EggGroup::set_dart_type
  234. // Access: Published
  235. // Description:
  236. ////////////////////////////////////////////////////////////////////
  237. INLINE void EggGroup::
  238. set_dart_type(EggGroup::DartType type) {
  239. // Make sure the user didn't give us any stray bits.
  240. nassertv((type & ~F_dart_type)==0);
  241. _flags = (_flags & ~F_dart_type) | type;
  242. }
  243. ////////////////////////////////////////////////////////////////////
  244. // Function: EggGroup::get_dart_type
  245. // Access: Published
  246. // Description:
  247. ////////////////////////////////////////////////////////////////////
  248. INLINE EggGroup::DartType EggGroup::
  249. get_dart_type() const {
  250. return (DartType)(_flags & F_dart_type);
  251. }
  252. ////////////////////////////////////////////////////////////////////
  253. // Function: EggGroup::set_switch_flag
  254. // Access: Published
  255. // Description:
  256. ////////////////////////////////////////////////////////////////////
  257. INLINE void EggGroup::
  258. set_switch_flag(bool flag) {
  259. if (flag) {
  260. _flags |= F_switch_flag;
  261. } else {
  262. _flags &= ~F_switch_flag;
  263. }
  264. }
  265. ////////////////////////////////////////////////////////////////////
  266. // Function: EggGroup::get_switch_flag
  267. // Access: Published
  268. // Description:
  269. ////////////////////////////////////////////////////////////////////
  270. INLINE bool EggGroup::
  271. get_switch_flag() const {
  272. return ((_flags & F_switch_flag) != 0);
  273. }
  274. ////////////////////////////////////////////////////////////////////
  275. // Function: EggGroup::set_switch_fps
  276. // Access: Published
  277. // Description:
  278. ////////////////////////////////////////////////////////////////////
  279. INLINE void EggGroup::
  280. set_switch_fps(double fps) {
  281. _fps = fps;
  282. }
  283. ////////////////////////////////////////////////////////////////////
  284. // Function: EggGroup::get_switch_fps
  285. // Access: Published
  286. // Description:
  287. ////////////////////////////////////////////////////////////////////
  288. INLINE double EggGroup::
  289. get_switch_fps() const {
  290. return _fps;
  291. }
  292. ////////////////////////////////////////////////////////////////////
  293. // Function: EggGroup::add_object_type
  294. // Access: Published
  295. // Description:
  296. ////////////////////////////////////////////////////////////////////
  297. INLINE void EggGroup::
  298. add_object_type(const string &object_type) {
  299. _object_types.push_back(object_type);
  300. }
  301. ////////////////////////////////////////////////////////////////////
  302. // Function: EggGroup::clear_object_types
  303. // Access: Published
  304. // Description:
  305. ////////////////////////////////////////////////////////////////////
  306. INLINE void EggGroup::
  307. clear_object_types() {
  308. _object_types.clear();
  309. }
  310. ////////////////////////////////////////////////////////////////////
  311. // Function: EggGroup::get_num_object_types
  312. // Access: Published
  313. // Description:
  314. ////////////////////////////////////////////////////////////////////
  315. INLINE int EggGroup::
  316. get_num_object_types() const {
  317. return _object_types.size();
  318. }
  319. ////////////////////////////////////////////////////////////////////
  320. // Function: EggGroup::get_object_type
  321. // Access: Published
  322. // Description:
  323. ////////////////////////////////////////////////////////////////////
  324. INLINE string EggGroup::
  325. get_object_type(int index) const {
  326. nassertr(index >= 0 && index < (int)_object_types.size(), string());
  327. return _object_types[index];
  328. }
  329. ////////////////////////////////////////////////////////////////////
  330. // Function: EggGroup::set_model_flag
  331. // Access: Published
  332. // Description:
  333. ////////////////////////////////////////////////////////////////////
  334. INLINE void EggGroup::
  335. set_model_flag(bool flag) {
  336. if (flag) {
  337. _flags |= F_model_flag;
  338. } else {
  339. _flags &= ~F_model_flag;
  340. }
  341. }
  342. ////////////////////////////////////////////////////////////////////
  343. // Function: EggGroup::get_model_flag
  344. // Access: Published
  345. // Description:
  346. ////////////////////////////////////////////////////////////////////
  347. INLINE bool EggGroup::
  348. get_model_flag() const {
  349. return ((_flags & F_model_flag) != 0);
  350. }
  351. ////////////////////////////////////////////////////////////////////
  352. // Function: EggGroup::set_texlist_flag
  353. // Access: Published
  354. // Description:
  355. ////////////////////////////////////////////////////////////////////
  356. INLINE void EggGroup::
  357. set_texlist_flag(bool flag) {
  358. if (flag) {
  359. _flags |= F_texlist_flag;
  360. } else {
  361. _flags &= ~F_texlist_flag;
  362. }
  363. }
  364. ////////////////////////////////////////////////////////////////////
  365. // Function: EggGroup::get_texlist_flag
  366. // Access: Published
  367. // Description:
  368. ////////////////////////////////////////////////////////////////////
  369. INLINE bool EggGroup::
  370. get_texlist_flag() const {
  371. return ((_flags & F_texlist_flag) != 0);
  372. }
  373. ////////////////////////////////////////////////////////////////////
  374. // Function: EggGroup::set_nofog_flag
  375. // Access: Published
  376. // Description:
  377. ////////////////////////////////////////////////////////////////////
  378. INLINE void EggGroup::
  379. set_nofog_flag(bool flag) {
  380. if (flag) {
  381. _flags |= F_nofog_flag;
  382. } else {
  383. _flags &= ~F_nofog_flag;
  384. }
  385. }
  386. ////////////////////////////////////////////////////////////////////
  387. // Function: EggGroup::get_nofog_flag
  388. // Access: Published
  389. // Description:
  390. ////////////////////////////////////////////////////////////////////
  391. INLINE bool EggGroup::
  392. get_nofog_flag() const {
  393. return ((_flags & F_nofog_flag) != 0);
  394. }
  395. ////////////////////////////////////////////////////////////////////
  396. // Function: EggGroup::set_decal_flag
  397. // Access: Published
  398. // Description:
  399. ////////////////////////////////////////////////////////////////////
  400. INLINE void EggGroup::
  401. set_decal_flag(bool flag) {
  402. if (flag) {
  403. _flags |= F_decal_flag;
  404. } else {
  405. _flags &= ~F_decal_flag;
  406. }
  407. }
  408. ////////////////////////////////////////////////////////////////////
  409. // Function: EggGroup::get_decal_flag
  410. // Access: Published
  411. // Description:
  412. ////////////////////////////////////////////////////////////////////
  413. INLINE bool EggGroup::
  414. get_decal_flag() const {
  415. return ((_flags & F_decal_flag) != 0);
  416. }
  417. ////////////////////////////////////////////////////////////////////
  418. // Function: EggGroup::set_direct_flag
  419. // Access: Published
  420. // Description:
  421. ////////////////////////////////////////////////////////////////////
  422. INLINE void EggGroup::
  423. set_direct_flag(bool flag) {
  424. if (flag) {
  425. _flags |= F_direct_flag;
  426. } else {
  427. _flags &= ~F_direct_flag;
  428. }
  429. }
  430. ////////////////////////////////////////////////////////////////////
  431. // Function: EggGroup::get_direct_flag
  432. // Access: Published
  433. // Description:
  434. ////////////////////////////////////////////////////////////////////
  435. INLINE bool EggGroup::
  436. get_direct_flag() const {
  437. return ((_flags & F_direct_flag) != 0);
  438. }
  439. ////////////////////////////////////////////////////////////////////
  440. // Function: EggGroup::set_portal_flag
  441. // Access: Published
  442. // Description:
  443. ////////////////////////////////////////////////////////////////////
  444. INLINE void EggGroup::
  445. set_portal_flag(bool flag) {
  446. if (flag) {
  447. _flags2 |= F2_portal_flag;
  448. } else {
  449. _flags2 &= ~F2_portal_flag;
  450. }
  451. }
  452. ////////////////////////////////////////////////////////////////////
  453. // Function: EggGroup::get_portal_flag
  454. // Access: Published
  455. // Description:
  456. ////////////////////////////////////////////////////////////////////
  457. INLINE bool EggGroup::
  458. get_portal_flag() const {
  459. return ((_flags2 & F2_portal_flag) != 0);
  460. }
  461. ////////////////////////////////////////////////////////////////////
  462. // Function: EggGroup::set_polylight_flag
  463. // Access: Published
  464. // Description:
  465. ////////////////////////////////////////////////////////////////////
  466. INLINE void EggGroup::
  467. set_polylight_flag(bool flag) {
  468. if (flag) {
  469. _flags2 |= F2_polylight_flag;
  470. } else {
  471. _flags2 &= ~F2_polylight_flag;
  472. }
  473. }
  474. ////////////////////////////////////////////////////////////////////
  475. // Function: EggGroup::get_polylight_flag
  476. // Access: Published
  477. // Description:
  478. ////////////////////////////////////////////////////////////////////
  479. INLINE bool EggGroup::
  480. get_polylight_flag() const {
  481. return ((_flags2 & F2_polylight_flag) != 0);
  482. }
  483. ////////////////////////////////////////////////////////////////////
  484. // Function: EggGroup::set_indexed_flag
  485. // Access: Published
  486. // Description: If this flag is true, geometry at this node and below
  487. // will be generated as indexed geometry.
  488. ////////////////////////////////////////////////////////////////////
  489. INLINE void EggGroup::
  490. set_indexed_flag(bool flag) {
  491. if (flag) {
  492. _flags2 |= F2_indexed_flag;
  493. } else {
  494. _flags2 &= ~F2_indexed_flag;
  495. }
  496. _flags2 |= F2_has_indexed_flag;
  497. }
  498. ////////////////////////////////////////////////////////////////////
  499. // Function: EggGroup::clear_indexed_flag
  500. // Access: Published
  501. // Description:
  502. ////////////////////////////////////////////////////////////////////
  503. INLINE void EggGroup::
  504. clear_indexed_flag() {
  505. _flags2 &= ~(F2_indexed_flag | F2_has_indexed_flag);
  506. }
  507. ////////////////////////////////////////////////////////////////////
  508. // Function: EggGroup::has_indexed_flag
  509. // Access: Published
  510. // Description:
  511. ////////////////////////////////////////////////////////////////////
  512. INLINE bool EggGroup::
  513. has_indexed_flag() const {
  514. return (_flags2 & F2_has_indexed_flag) != 0;
  515. }
  516. ////////////////////////////////////////////////////////////////////
  517. // Function: EggGroup::get_indexed_flag
  518. // Access: Published
  519. // Description:
  520. ////////////////////////////////////////////////////////////////////
  521. INLINE bool EggGroup::
  522. get_indexed_flag() const {
  523. nassertr(has_indexed_flag(), false);
  524. return ((_flags2 & F2_indexed_flag) != 0);
  525. }
  526. ////////////////////////////////////////////////////////////////////
  527. // Function: EggGroup::set_collide_mask
  528. // Access: Published
  529. // Description:
  530. ////////////////////////////////////////////////////////////////////
  531. INLINE void EggGroup::
  532. set_collide_mask(CollideMask mask) {
  533. _collide_mask = mask;
  534. _flags2 |= F2_collide_mask;
  535. }
  536. ////////////////////////////////////////////////////////////////////
  537. // Function: EggGroup::clear_collide_mask
  538. // Access: Published
  539. // Description:
  540. ////////////////////////////////////////////////////////////////////
  541. INLINE void EggGroup::
  542. clear_collide_mask() {
  543. _flags2 &= ~F2_collide_mask;
  544. _collide_mask = CollideMask::all_off();
  545. }
  546. ////////////////////////////////////////////////////////////////////
  547. // Function: EggGroup::has_collide_mask
  548. // Access: Published
  549. // Description:
  550. ////////////////////////////////////////////////////////////////////
  551. INLINE bool EggGroup::
  552. has_collide_mask() const {
  553. return (_flags2 & F2_collide_mask) != 0;
  554. }
  555. ////////////////////////////////////////////////////////////////////
  556. // Function: EggGroup::get_collide_mask
  557. // Access: Published
  558. // Description:
  559. ////////////////////////////////////////////////////////////////////
  560. INLINE CollideMask EggGroup::
  561. get_collide_mask() const {
  562. return _collide_mask;
  563. }
  564. ////////////////////////////////////////////////////////////////////
  565. // Function: EggGroup::set_from_collide_mask
  566. // Access: Published
  567. // Description:
  568. ////////////////////////////////////////////////////////////////////
  569. INLINE void EggGroup::
  570. set_from_collide_mask(CollideMask mask) {
  571. _from_collide_mask = mask;
  572. _flags2 |= F2_from_collide_mask;
  573. }
  574. ////////////////////////////////////////////////////////////////////
  575. // Function: EggGroup::clear_from_collide_mask
  576. // Access: Published
  577. // Description:
  578. ////////////////////////////////////////////////////////////////////
  579. INLINE void EggGroup::
  580. clear_from_collide_mask() {
  581. _flags2 &= ~F2_from_collide_mask;
  582. _from_collide_mask = CollideMask::all_off();
  583. }
  584. ////////////////////////////////////////////////////////////////////
  585. // Function: EggGroup::has_from_collide_mask
  586. // Access: Published
  587. // Description:
  588. ////////////////////////////////////////////////////////////////////
  589. INLINE bool EggGroup::
  590. has_from_collide_mask() const {
  591. return (_flags2 & F2_from_collide_mask) != 0;
  592. }
  593. ////////////////////////////////////////////////////////////////////
  594. // Function: EggGroup::get_from_collide_mask
  595. // Access: Published
  596. // Description:
  597. ////////////////////////////////////////////////////////////////////
  598. INLINE CollideMask EggGroup::
  599. get_from_collide_mask() const {
  600. return _from_collide_mask;
  601. }
  602. ////////////////////////////////////////////////////////////////////
  603. // Function: EggGroup::set_into_collide_mask
  604. // Access: Published
  605. // Description:
  606. ////////////////////////////////////////////////////////////////////
  607. INLINE void EggGroup::
  608. set_into_collide_mask(CollideMask mask) {
  609. _into_collide_mask = mask;
  610. _flags2 |= F2_into_collide_mask;
  611. }
  612. ////////////////////////////////////////////////////////////////////
  613. // Function: EggGroup::clear_into_collide_mask
  614. // Access: Published
  615. // Description:
  616. ////////////////////////////////////////////////////////////////////
  617. INLINE void EggGroup::
  618. clear_into_collide_mask() {
  619. _flags2 &= ~F2_into_collide_mask;
  620. _into_collide_mask = CollideMask::all_off();
  621. }
  622. ////////////////////////////////////////////////////////////////////
  623. // Function: EggGroup::has_into_collide_mask
  624. // Access: Published
  625. // Description:
  626. ////////////////////////////////////////////////////////////////////
  627. INLINE bool EggGroup::
  628. has_into_collide_mask() const {
  629. return (_flags2 & F2_into_collide_mask) != 0;
  630. }
  631. ////////////////////////////////////////////////////////////////////
  632. // Function: EggGroup::get_into_collide_mask
  633. // Access: Published
  634. // Description:
  635. ////////////////////////////////////////////////////////////////////
  636. INLINE CollideMask EggGroup::
  637. get_into_collide_mask() const {
  638. return _into_collide_mask;
  639. }
  640. ////////////////////////////////////////////////////////////////////
  641. // Function: EggGroup::set_blend_mode
  642. // Access: Published
  643. // Description:
  644. ////////////////////////////////////////////////////////////////////
  645. INLINE void EggGroup::
  646. set_blend_mode(EggGroup::BlendMode blend_mode) {
  647. _blend_mode = blend_mode;
  648. }
  649. ////////////////////////////////////////////////////////////////////
  650. // Function: EggGroup::get_blend_mode
  651. // Access: Published
  652. // Description:
  653. ////////////////////////////////////////////////////////////////////
  654. INLINE EggGroup::BlendMode EggGroup::
  655. get_blend_mode() const {
  656. return _blend_mode;
  657. }
  658. ////////////////////////////////////////////////////////////////////
  659. // Function: EggGroup::set_blend_operand_a
  660. // Access: Published
  661. // Description:
  662. ////////////////////////////////////////////////////////////////////
  663. INLINE void EggGroup::
  664. set_blend_operand_a(EggGroup::BlendOperand blend_operand_a) {
  665. _blend_operand_a = blend_operand_a;
  666. }
  667. ////////////////////////////////////////////////////////////////////
  668. // Function: EggGroup::get_blend_operand_a
  669. // Access: Published
  670. // Description:
  671. ////////////////////////////////////////////////////////////////////
  672. INLINE EggGroup::BlendOperand EggGroup::
  673. get_blend_operand_a() const {
  674. return _blend_operand_a;
  675. }
  676. ////////////////////////////////////////////////////////////////////
  677. // Function: EggGroup::set_blend_operand_b
  678. // Access: Published
  679. // Description:
  680. ////////////////////////////////////////////////////////////////////
  681. INLINE void EggGroup::
  682. set_blend_operand_b(EggGroup::BlendOperand blend_operand_b) {
  683. _blend_operand_b = blend_operand_b;
  684. }
  685. ////////////////////////////////////////////////////////////////////
  686. // Function: EggGroup::get_blend_operand_b
  687. // Access: Published
  688. // Description:
  689. ////////////////////////////////////////////////////////////////////
  690. INLINE EggGroup::BlendOperand EggGroup::
  691. get_blend_operand_b() const {
  692. return _blend_operand_b;
  693. }
  694. ////////////////////////////////////////////////////////////////////
  695. // Function: EggGroup::set_blend_color
  696. // Access: Published
  697. // Description:
  698. ////////////////////////////////////////////////////////////////////
  699. INLINE void EggGroup::
  700. set_blend_color(const Colorf &blend_color) {
  701. _blend_color = blend_color;
  702. _flags2 |= F2_has_blend_color;
  703. }
  704. ////////////////////////////////////////////////////////////////////
  705. // Function: EggGroup::clear_blend_color
  706. // Access: Published
  707. // Description: Removes the blend color specification.
  708. ////////////////////////////////////////////////////////////////////
  709. INLINE void EggGroup::
  710. clear_blend_color() {
  711. _blend_color = Colorf::zero();
  712. _flags2 &= ~F2_has_blend_color;
  713. }
  714. ////////////////////////////////////////////////////////////////////
  715. // Function: EggGroup::has_blend_color
  716. // Access: Published
  717. // Description: Returns true if the blend color has been specified,
  718. // false otherwise.
  719. ////////////////////////////////////////////////////////////////////
  720. INLINE bool EggGroup::
  721. has_blend_color() const {
  722. return (_flags2 & F2_has_blend_color) != 0;
  723. }
  724. ////////////////////////////////////////////////////////////////////
  725. // Function: EggGroup::get_blend_color
  726. // Access: Published
  727. // Description: Returns the blend color if one has been specified, or
  728. // (0, 0, 0, 0) if one has not.
  729. ////////////////////////////////////////////////////////////////////
  730. INLINE const Colorf &EggGroup::
  731. get_blend_color() const {
  732. return _blend_color;
  733. }
  734. ////////////////////////////////////////////////////////////////////
  735. // Function: EggGroup::set_lod
  736. // Access: Published
  737. // Description:
  738. ////////////////////////////////////////////////////////////////////
  739. INLINE void EggGroup::
  740. set_lod(const EggSwitchCondition &lod) {
  741. _lod = lod.make_copy();
  742. }
  743. ////////////////////////////////////////////////////////////////////
  744. // Function: EggGroup::clear_lod
  745. // Access: Published
  746. // Description:
  747. ////////////////////////////////////////////////////////////////////
  748. INLINE void EggGroup::
  749. clear_lod() {
  750. _lod = NULL;
  751. }
  752. ////////////////////////////////////////////////////////////////////
  753. // Function: EggGroup::has_lod
  754. // Access: Published
  755. // Description:
  756. ////////////////////////////////////////////////////////////////////
  757. INLINE bool EggGroup::
  758. has_lod() const {
  759. return (_lod != (EggSwitchCondition *)NULL);
  760. }
  761. ////////////////////////////////////////////////////////////////////
  762. // Function: EggGroup::get_lod
  763. // Access: Published
  764. // Description:
  765. ////////////////////////////////////////////////////////////////////
  766. INLINE const EggSwitchCondition &EggGroup::
  767. get_lod() const {
  768. return *_lod;
  769. }
  770. ////////////////////////////////////////////////////////////////////
  771. // Function: EggGroup::set_tag
  772. // Access: Published
  773. // Description: Associates a user-defined value with a user-defined
  774. // key which is stored on the node. This value has no
  775. // meaning to Panda; but it is stored indefinitely on
  776. // the node until it is requested again. This value
  777. // will be copied to the PandaNode that is created for
  778. // this particular EggGroup if the egg file is loaded as
  779. // a scene.
  780. //
  781. // Each unique key stores a different string value.
  782. // There is no effective limit on the number of
  783. // different keys that may be stored or on the length of
  784. // any one key's value.
  785. ////////////////////////////////////////////////////////////////////
  786. INLINE void EggGroup::
  787. set_tag(const string &key, const string &value) {
  788. _tag_data[key] = value;
  789. }
  790. ////////////////////////////////////////////////////////////////////
  791. // Function: EggGroup::get_tag
  792. // Access: Published
  793. // Description: Retrieves the user-defined value that was previously
  794. // set on this node for the particular key, if any. If
  795. // no value has been previously set, returns the empty
  796. // string.
  797. ////////////////////////////////////////////////////////////////////
  798. INLINE string EggGroup::
  799. get_tag(const string &key) const {
  800. TagData::const_iterator ti;
  801. ti = _tag_data.find(key);
  802. if (ti != _tag_data.end()) {
  803. return (*ti).second;
  804. }
  805. return string();
  806. }
  807. ////////////////////////////////////////////////////////////////////
  808. // Function: EggGroup::has_tag
  809. // Access: Published
  810. // Description: Returns true if a value has been defined on this node
  811. // for the particular key (even if that value is the
  812. // empty string), or false if no value has been set.
  813. ////////////////////////////////////////////////////////////////////
  814. INLINE bool EggGroup::
  815. has_tag(const string &key) const {
  816. TagData::const_iterator ti;
  817. ti = _tag_data.find(key);
  818. return (ti != _tag_data.end());
  819. }
  820. ////////////////////////////////////////////////////////////////////
  821. // Function: EggGroup::clear_tag
  822. // Access: Published
  823. // Description: Removes the value defined for this key on this
  824. // particular node. After a call to clear_tag(),
  825. // has_tag() will return false for the indicated key.
  826. ////////////////////////////////////////////////////////////////////
  827. INLINE void EggGroup::
  828. clear_tag(const string &key) {
  829. _tag_data.erase(key);
  830. }
  831. ////////////////////////////////////////////////////////////////////
  832. // Function: EggGroup::tag_begin
  833. // Access: Public
  834. // Description: Returns an iterator that can, in conjunction with
  835. // tag_end(), be used to traverse the entire set of
  836. // tag keys. Each iterator returns a pair<string,
  837. // string>.
  838. //
  839. // This interface is not safe to use outside of
  840. // PANDAEGG.DLL.
  841. ////////////////////////////////////////////////////////////////////
  842. INLINE EggGroup::TagData::const_iterator EggGroup::
  843. tag_begin() const {
  844. return _tag_data.begin();
  845. }
  846. ////////////////////////////////////////////////////////////////////
  847. // Function: EggGroup::tag_end
  848. // Access: Public
  849. // Description: Returns an iterator that can, in conjunction with
  850. // tag_begin(), be used to traverse the entire set of
  851. // tag keys. Each iterator returns a pair<string,
  852. // string>.
  853. //
  854. // This interface is not safe to use outside of
  855. // PANDAEGG.DLL.
  856. ////////////////////////////////////////////////////////////////////
  857. INLINE EggGroup::TagData::const_iterator EggGroup::
  858. tag_end() const {
  859. return _tag_data.end();
  860. }
  861. ////////////////////////////////////////////////////////////////////
  862. // Function: EggGroup::tag_size
  863. // Access: Published
  864. // Description: Returns the number of elements between tag_begin()
  865. // and tag_end().
  866. //
  867. // This interface is not safe to use outside of
  868. // PANDAEGG.DLL.
  869. ////////////////////////////////////////////////////////////////////
  870. INLINE EggGroup::TagData::size_type EggGroup::
  871. tag_size() const {
  872. return _tag_data.size();
  873. }
  874. ////////////////////////////////////////////////////////////////////
  875. // Function: EggGroup::vref_begin
  876. // Access: Public
  877. // Description: Returns an iterator that can, in conjunction with
  878. // vref_end(), be used to traverse the entire set of
  879. // referenced vertices. Each iterator returns a
  880. // pair<PT(EggVertex), double>.
  881. //
  882. // This interface is not safe to use outside of
  883. // PANDAEGG.DLL.
  884. ////////////////////////////////////////////////////////////////////
  885. INLINE EggGroup::VertexRef::const_iterator EggGroup::
  886. vref_begin() const {
  887. return _vref.begin();
  888. }
  889. ////////////////////////////////////////////////////////////////////
  890. // Function: EggGroup::vref_end
  891. // Access: Public
  892. // Description: Returns an iterator that can, in conjunction with
  893. // vref_begin(), be used to traverse the entire set of
  894. // referenced vertices. Each iterator returns a
  895. // pair<PT(EggVertex), double>.
  896. //
  897. // This interface is not safe to use outside of
  898. // PANDAEGG.DLL.
  899. ////////////////////////////////////////////////////////////////////
  900. INLINE EggGroup::VertexRef::const_iterator EggGroup::
  901. vref_end() const {
  902. return _vref.end();
  903. }
  904. ////////////////////////////////////////////////////////////////////
  905. // Function: EggGroup::vref_size
  906. // Access: Published
  907. // Description: Returns the number of elements between vref_begin()
  908. // and vref_end().
  909. //
  910. // This interface is not safe to use outside of
  911. // PANDAEGG.DLL.
  912. ////////////////////////////////////////////////////////////////////
  913. INLINE EggGroup::VertexRef::size_type EggGroup::
  914. vref_size() const {
  915. return _vref.size();
  916. }