eggAttributes.I 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Filename: eggAttributes.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: EggAttributes::has_normal
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE bool EggAttributes::
  24. has_normal() const {
  25. return (_flags & F_has_normal) != 0;
  26. }
  27. ////////////////////////////////////////////////////////////////////
  28. // Function: EggAttributes::get_normal
  29. // Access: Public
  30. // Description:
  31. ////////////////////////////////////////////////////////////////////
  32. INLINE const Normald &EggAttributes::
  33. get_normal() const {
  34. nassertr(has_normal(), _normal);
  35. return _normal;
  36. }
  37. ////////////////////////////////////////////////////////////////////
  38. // Function: EggAttributes::set_normal
  39. // Access: Public
  40. // Description:
  41. ////////////////////////////////////////////////////////////////////
  42. INLINE void EggAttributes::
  43. set_normal(const Normald &normal) {
  44. _normal = normal;
  45. _flags |= F_has_normal;
  46. }
  47. ////////////////////////////////////////////////////////////////////
  48. // Function: EggAttributes::clear_normal
  49. // Access: Public
  50. // Description:
  51. ////////////////////////////////////////////////////////////////////
  52. INLINE void EggAttributes::
  53. clear_normal() {
  54. _flags &= ~F_has_normal;
  55. }
  56. ////////////////////////////////////////////////////////////////////
  57. // Function: EggAttributes::has_color
  58. // Access: Public
  59. // Description:
  60. ////////////////////////////////////////////////////////////////////
  61. INLINE bool EggAttributes::
  62. has_color() const {
  63. return (_flags & F_has_color) != 0;
  64. }
  65. ////////////////////////////////////////////////////////////////////
  66. // Function: EggAttributes::get_color
  67. // Access: Public
  68. // Description: Returns the color set on this particular attribute.
  69. // If there is no color set, returns white.
  70. ////////////////////////////////////////////////////////////////////
  71. INLINE Colorf EggAttributes::
  72. get_color() const {
  73. if (has_color()) {
  74. return _color;
  75. } else {
  76. return Colorf(1.0, 1.0, 1.0, 1.0);
  77. }
  78. }
  79. ////////////////////////////////////////////////////////////////////
  80. // Function: EggAttributes::
  81. // Access: Public
  82. // Description:
  83. ////////////////////////////////////////////////////////////////////
  84. INLINE void EggAttributes::
  85. set_color(const Colorf &color) {
  86. _color = color;
  87. _flags |= F_has_color;
  88. }
  89. ////////////////////////////////////////////////////////////////////
  90. // Function: EggAttributes::
  91. // Access: Public
  92. // Description:
  93. ////////////////////////////////////////////////////////////////////
  94. INLINE void EggAttributes::
  95. clear_color() {
  96. _flags &= ~F_has_color;
  97. }