Panda3D
Loading...
Searching...
No Matches
eggPoint.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file eggPoint.cxx
10 * @author drose
11 * @date 1999-12-15
12 */
13
14#include "eggPoint.h"
15
16#include "indent.h"
17
18TypeHandle EggPoint::_type_handle;
19
20/**
21 * Makes a copy of this object.
22 */
24make_copy() const {
25 return new EggPoint(*this);
26}
27
28/**
29 * Cleans up modeling errors in whatever context this makes sense. For
30 * instance, for a polygon, this calls remove_doubled_verts(true). For a
31 * point, it calls remove_nonunique_verts(). Returns true if the primitive is
32 * valid, or false if it is degenerate.
33 */
35cleanup() {
37 return !empty();
38}
39
40/**
41 * Writes the point to the indicated output stream in Egg format.
42 */
44write(std::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(std::ostream &out, int indent_level, const char *egg_keyword) const
Writes the first line of the egg object, e.g.
A single point, or a collection of points as defined by a single <PointLight> entry.
Definition eggPoint.h:25
virtual bool cleanup() override
Cleans up modeling errors in whatever context this makes sense.
Definition eggPoint.cxx:35
virtual void write(std::ostream &out, int indent_level) const override
Writes the point to the indicated output stream in Egg format.
Definition eggPoint.cxx:44
bool get_perspective() const
Returns the perspective flag set on this particular point.
Definition eggPoint.I:95
double get_thick() const
Returns the thickness set on this particular point.
Definition eggPoint.I:60
virtual EggPoint * make_copy() const override
Makes a copy of this object.
Definition eggPoint.cxx:24
void remove_nonunique_verts()
Removes any multiple appearances of the same vertex from the primitive.
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
std::ostream & indent(std::ostream &out, int indent_level)
A handy function for doing text formatting.
Definition indent.cxx:20
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.