Panda3D
 All Classes Functions Variables Enumerations
eggPoint.cxx
1 // Filename: eggPoint.cxx
2 // Created by: drose (15Dec99)
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 #include "eggPoint.h"
16 
17 #include "indent.h"
18 
19 TypeHandle EggPoint::_type_handle;
20 
21 
22 ////////////////////////////////////////////////////////////////////
23 // Function: EggPoint::cleanup
24 // Access: Public, Virtual
25 // Description: Cleans up modeling errors in whatever context this
26 // makes sense. For instance, for a polygon, this calls
27 // remove_doubled_verts(true). For a point, it calls
28 // remove_nonunique_verts(). Returns true if the
29 // primitive is valid, or false if it is degenerate.
30 ////////////////////////////////////////////////////////////////////
31 bool EggPoint::
34  return !empty();
35 }
36 
37 ////////////////////////////////////////////////////////////////////
38 // Function: EggPoint::write
39 // Access: Public, Virtual
40 // Description: Writes the point to the indicated output stream in
41 // Egg format.
42 ////////////////////////////////////////////////////////////////////
43 void EggPoint::
44 write(ostream &out, int indent_level) const {
45  write_header(out, indent_level, "<PointLight>");
46 
47  if (has_thick()) {
48  indent(out, indent_level + 2)
49  << "<Scalar> thick { " << get_thick() << " }\n";
50  }
51 
52  if (has_perspective()) {
53  indent(out, indent_level + 2)
54  << "<Scalar> perspective { " << get_perspective() << " }\n";
55  }
56 
57  write_body(out, indent_level + 2);
58  indent(out, indent_level) << "}\n";
59 }
void write_header(ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
virtual bool cleanup()
Cleans up modeling errors in whatever context this makes sense.
Definition: eggPoint.cxx:32
bool get_perspective() const
Returns the perspective flag set on this particular point.
Definition: eggPoint.I:116
double get_thick() const
Returns the thickness set on this particular point.
Definition: eggPoint.I:72
void remove_nonunique_verts()
Removes any multiple appearances of the same vertex from the primitive.
virtual void write(ostream &out, int indent_level) const
Writes the point to the indicated output stream in Egg format.
Definition: eggPoint.cxx:44
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85