Panda3D

Loading...
Searching...
No Matches
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::
42 get_num_components() const {
43 return _components.size();
44}
45
46/**
47 * Returns the attributes for the nth component triangle.
48 */
49INLINE const EggAttributes *EggCompositePrimitive::
50 get_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 */
58INLINE EggAttributes *EggCompositePrimitive::
59 get_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 */
67INLINE void EggCompositePrimitive::
68 set_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 */
81INLINE bool EggCompositePrimitive::
82 triangulate_into(EggGroupNode *container) const {
83 return do_triangulate(container);
84}
EggAttributes
The set of attributes that may be applied to vertices as well as polygons, such as surface normal and...
Definition eggAttributes.h:33
EggCompositePrimitive
The base class for primitives such as triangle strips and triangle fans, which include several compon...
Definition eggCompositePrimitive.h:26
EggCompositePrimitive::triangulate_into
bool triangulate_into(EggGroupNode *container) const
Subdivides the composite primitive into triangles and adds those triangles to the indicated container...
Definition eggCompositePrimitive.I:82
EggCompositePrimitive::get_num_components
get_num_components
Returns the number of individual component triangles within the composite.
Definition eggCompositePrimitive.h:38
EggCompositePrimitive::set_component
set_component
Changes the attributes for the nth component triangle.
Definition eggCompositePrimitive.h:41
EggCompositePrimitive::get_component
get_component
Returns the attributes for the nth component triangle.
Definition eggCompositePrimitive.h:38
EggPrimitive
A base class for any of a number of kinds of geometry primitives: polygons, point lights,...
Definition eggPrimitive.h:49