Panda3D
Loading...
Searching...
No Matches
eggLine.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 eggLine.cxx
10 * @author drose
11 * @date 2003-10-14
12 */
13
14#include "eggLine.h"
15
16#include "indent.h"
17
18TypeHandle EggLine::_type_handle;
19
20/**
21 *
22 */
23EggLine::
24~EggLine() {
25 clear();
26}
27
28/**
29 * Makes a copy of this object.
30 */
32make_copy() const {
33 return new EggLine(*this);
34}
35
36/**
37 * Writes the point to the indicated output stream in Egg format.
38 */
40write(std::ostream &out, int indent_level) const {
41 write_header(out, indent_level, "<Line>");
42
43 if (has_thick()) {
44 indent(out, indent_level + 2)
45 << "<Scalar> thick { " << get_thick() << " }\n";
46 }
47
48 write_body(out, indent_level + 2);
49 indent(out, indent_level) << "}\n";
50}
51
52/**
53 * Returns the number of initial vertices that are not used in defining any
54 * component; the first component is defined by the (n + 1)th vertex, and then
55 * a new component at each vertex thereafter.
56 */
57int EggLine::
58get_num_lead_vertices() const {
59 return 1;
60}
A line segment, or a series of connected line segments, defined by a <Line> entry.
Definition eggLine.h:25
virtual void write(std::ostream &out, int indent_level) const override
Writes the point to the indicated output stream in Egg format.
Definition eggLine.cxx:40
virtual EggLine * make_copy() const override
Makes a copy of this object.
Definition eggLine.cxx:32
double get_thick() const
Returns the thickness set on this particular line.
Definition eggLine.I: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.
void clear()
Removes all of the vertices 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.