Panda3D
eggCompositePrimitive.I
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 eggCompositePrimitive.I
10 * @author drose
11 * @date 2005-03-13
12 */
13
14/**
15 *
16 */
17INLINE EggCompositePrimitive::
18EggCompositePrimitive(const std::string &name) : EggPrimitive(name) {
19}
20
21/**
22 *
23 */
24INLINE EggCompositePrimitive::
25EggCompositePrimitive(const EggCompositePrimitive &copy) : EggPrimitive(copy) {
26}
27
28/**
29 *
30 */
31INLINE EggCompositePrimitive &EggCompositePrimitive::
32operator = (const EggCompositePrimitive &copy) {
33 EggPrimitive::operator = (copy);
34 return *this;
35}
36
37/**
38 * Returns the number of individual component triangles within the composite.
39 * Each one of these might have a different set of attributes.
40 */
41INLINE size_t EggCompositePrimitive::
42get_num_components() const {
43 return _components.size();
44}
45
46/**
47 * Returns the attributes for the nth component triangle.
48 */
50get_component(size_t i) const {
51 nassertr(i < _components.size(), nullptr);
52 return _components[i];
53}
54
55/**
56 * Returns the attributes for the nth component triangle.
57 */
59get_component(size_t i) {
60 nassertr(i < _components.size(), nullptr);
61 return _components[i];
62}
63
64/**
65 * Changes the attributes for the nth component triangle.
66 */
68set_component(size_t i, const EggAttributes *attrib) {
69 nassertv(i < _components.size());
70 _components[i] = new EggAttributes(*attrib);
71}
72
73/**
74 * Subdivides the composite primitive into triangles and adds those triangles
75 * to the indicated container. Does not remove the primitive from its
76 * existing parent or modify it in any way.
77 *
78 * Returns true if the triangulation is successful, or false if there was some
79 * error (in which case the container may contain some partial triangulation).
80 */
82triangulate_into(EggGroupNode *container) const {
83 return do_triangulate(container);
84}
The set of attributes that may be applied to vertices as well as polygons, such as surface normal and...
Definition: eggAttributes.h:33
The base class for primitives such as triangle strips and triangle fans, which include several compon...
bool triangulate_into(EggGroupNode *container) const
Subdivides the composite primitive into triangles and adds those triangles to the indicated container...
get_num_components
Returns the number of individual component triangles within the composite.
set_component
Changes the attributes for the nth component triangle.
get_component
Returns the attributes for the nth component triangle.
A base class for nodes in the hierarchy that are not leaf nodes.
Definition: eggGroupNode.h:46
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
Definition: eggPrimitive.h:49