Panda3D
texGenAttrib.I
1 // Filename: texGenAttrib.I
2 // Created by: masad (21Jun04)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: TexGenAttrib::Constructor
18 // Access: Protected
19 // Description: Use TexGenAttrib::make() to construct a new
20 // TexGenAttrib object.
21 ////////////////////////////////////////////////////////////////////
22 INLINE TexGenAttrib::
23 TexGenAttrib() :
24  _num_point_sprites(0),
25  _point_geom_rendering(0),
26  _geom_rendering(0)
27 {
28 }
29 
30 ////////////////////////////////////////////////////////////////////
31 // Function: TexGenAttrib::Copy Constructor
32 // Access: Protected
33 // Description: Use TexGenAttrib::make() to construct a new
34 // TexGenAttrib object.
35 ////////////////////////////////////////////////////////////////////
36 INLINE TexGenAttrib::
37 TexGenAttrib(const TexGenAttrib &copy) :
38  _stages(copy._stages),
39  _no_texcoords(copy._no_texcoords),
40  _num_point_sprites(copy._num_point_sprites),
41  _point_geom_rendering(copy._point_geom_rendering),
42  _geom_rendering(copy._geom_rendering)
43 {
44 }
45 
46 ////////////////////////////////////////////////////////////////////
47 // Function: TexGenAttrib::get_geom_rendering
48 // Access: Published
49 // Description: Returns the union of the Geom::GeomRendering bits
50 // that will be required once this TexGenAttrib is
51 // applied to a geom which includes the indicated
52 // geom_rendering bits.
53 ////////////////////////////////////////////////////////////////////
54 INLINE int TexGenAttrib::
55 get_geom_rendering(int geom_rendering) const {
56  if ((geom_rendering & Geom::GR_point) != 0) {
57  geom_rendering |= _point_geom_rendering;
58  }
59 
60  return geom_rendering | _geom_rendering;
61 }
62 
63 ////////////////////////////////////////////////////////////////////
64 // Function: TexGenAttrib::ModeDef::Constructor
65 // Access: Public
66 // Description:
67 ////////////////////////////////////////////////////////////////////
68 INLINE TexGenAttrib::ModeDef::
69 ModeDef() :
70  _mode(M_off)
71 {
72 }
73 
74 ////////////////////////////////////////////////////////////////////
75 // Function: TexGenAttrib::ModeDef::compare_to
76 // Access: Public
77 // Description:
78 ////////////////////////////////////////////////////////////////////
79 INLINE int TexGenAttrib::ModeDef::
80 compare_to(const TexGenAttrib::ModeDef &other) const {
81  if (_mode != other._mode) {
82  return (int)_mode < (int)other._mode ? -1 : 1;
83  }
84  int compare = _light.compare_to(other._light);
85  if (compare != 0) {
86  return compare;
87  }
88  compare = strcmp(_source_name.c_str(), other._source_name.c_str());
89  if (compare != 0) {
90  return compare;
91  }
92  compare = _constant_value.compare_to(other._constant_value);
93  return compare;
94 }
95 
int get_geom_rendering(int geom_rendering) const
Returns the union of the Geom::GeomRendering bits that will be required once this TexGenAttrib is app...
Definition: texGenAttrib.I:55
Computes texture coordinates for geometry automatically based on vertex position and/or normal...
Definition: texGenAttrib.h:36