Panda3D
 All Classes Functions Variables Enumerations
objToEggConverter.I
1 // Filename: objToEggConverter.I
2 // Created by: drose (03Jan13)
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: ObjToEggConverter::VertexEntry::operator <
18 // Access: Public
19 // Description: Provides a unique but arbitrary ordering for
20 // VertexEntry objects in a map.
21 ////////////////////////////////////////////////////////////////////
22 INLINE bool ObjToEggConverter::VertexEntry::
23 operator < (const VertexEntry &other) const {
24  if (_vi != other._vi) {
25  return _vi < other._vi;
26  }
27  if (_vti != other._vti) {
28  return _vti < other._vti;
29  }
30 
31  // It's important that these two tests are made last, so we can find
32  // the first vertex that has any normal but also matches the above
33  // properties.
34  if (_vni != other._vni) {
35  return _vni < other._vni;
36  }
37  if (_synth_vni != other._synth_vni) {
38  return _synth_vni < other._synth_vni;
39  }
40  return false;
41 }
42 
43 ////////////////////////////////////////////////////////////////////
44 // Function: ObjToEggConverter::VertexEntry::operator ==
45 // Access: Public
46 // Description:
47 ////////////////////////////////////////////////////////////////////
48 INLINE bool ObjToEggConverter::VertexEntry::
49 operator == (const VertexEntry &other) const {
50  return (_vi == other._vi && _vti == other._vti &&
51  _vni == other._vni && _synth_vni == other._synth_vni);
52 }
53 
54 ////////////////////////////////////////////////////////////////////
55 // Function: ObjToEggConverter::VertexEntry::matches_except_normal
56 // Access: Public
57 // Description: Returns true if all the properties except _vni and _synth_vni
58 // are equivalent.
59 ////////////////////////////////////////////////////////////////////
60 INLINE bool ObjToEggConverter::VertexEntry::
61 matches_except_normal(const VertexEntry &other) const {
62  return (_vi == other._vi && _vti == other._vti);
63 }