Panda3D

Loading...
Searching...
No Matches
eggAttributes.h
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 eggAttributes.h
10 * @author drose
11 * @date 1999-01-16
12 */
13
14#ifndef EGGATTRIBUTES_H
15#define EGGATTRIBUTES_H
16
17#include "pandabase.h"
18
19#include "eggMorphList.h"
20#include "eggParameters.h"
21#include "typedObject.h"
22#include "luse.h"
23#include "pnotify.h"
24
25/**
26 * The set of attributes that may be applied to vertices as well as polygons,
27 * such as surface normal and color.
28 *
29 * This class cannot inherit from EggObject, because it causes problems at the
30 * EggPolygon level with multiple appearances of the EggObject base class.
31 * And making EggObject a virtual base class is just no fun.
32 */
33 class EXPCL_PANDA_EGG EggAttributes : public MemoryBase {
34PUBLISHED:
35 EggAttributes();
36 EggAttributes(const EggAttributes &copy);
37 EggAttributes &operator = (const EggAttributes &copy);
38 virtual ~EggAttributes();
39
40 INLINE bool has_normal() const;
41 INLINE const LNormald &get_normal() const;
42 INLINE void set_normal(const LNormald &normal);
43 INLINE void clear_normal();
44 INLINE bool matches_normal(const EggAttributes &other) const;
45 INLINE void copy_normal(const EggAttributes &other);
46
47 INLINE bool has_color() const;
48 INLINE LColor get_color() const;
49 INLINE void set_color(const LColor &Color);
50 INLINE void clear_color();
51 INLINE bool matches_color(const EggAttributes &other) const;
52 INLINE void copy_color(const EggAttributes &other);
53
54 void write(std::ostream &out, int indent_level) const;
55 INLINE bool sorts_less_than(const EggAttributes &other) const;
56 int compare_to(const EggAttributes &other) const;
57
58 void transform(const LMatrix4d &mat);
59
60 EggMorphNormalList _dnormals;
61 EggMorphColorList _drgbas;
62
63 private:
64 enum Flags {
65 F_has_normal = 0x001,
66 F_has_color = 0x002,
67 };
68
69 int _flags;
70 LNormald _normal;
71 LColor _color;
72
73
74 public:
75 static TypeHandle get_class_type() {
76 return _type_handle;
77 }
78 static void init_type() {
79 register_type(_type_handle, "EggAttributes");
80 }
81
82 private:
83 static TypeHandle _type_handle;
84};
85
86#include "eggAttributes.I"
87
88#endif
EggAttributes::matches_normal
bool matches_normal(const EggAttributes &other) const
Returns true if this normal matches that of the other EggAttributes object, include the morph list.
Definition eggAttributes.I:53
EggAttributes::transform
void transform(const LMatrix4d &mat)
Applies the indicated transformation matrix to the attributes.
Definition eggAttributes.cxx:132
EggAttributes::copy_normal
void copy_normal(const EggAttributes &other)
Sets this normal to be the same as the other's, include morphs.
Definition eggAttributes.I:69
EggAttributes::compare_to
int compare_to(const EggAttributes &other) const
An ordering operator to compare two vertices for sorting order.
Definition eggAttributes.cxx:96
EggAttributes::copy_color
void copy_color(const EggAttributes &other)
Sets this color to be the same as the other's, include morphs.
Definition eggAttributes.I:137
EggAttributes::get_color
LColor get_color() const
Returns the color set on this particular attribute.
Definition eggAttributes.I:91
EggAttributes::matches_color
bool matches_color(const EggAttributes &other) const
Returns true if this color matches that of the other EggAttributes object, include the morph list.
Definition eggAttributes.I:121
EggAttributes::write
void write(std::ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
Definition eggAttributes.cxx:65
EggAttributes::sorts_less_than
bool sorts_less_than(const EggAttributes &other) const
An ordering operator to compare two vertices for sorting order.
Definition eggAttributes.I:151
MemoryBase
This class is intended to be the base class of all objects in Panda that might be allocated and delet...
Definition memoryBase.h:65
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
eggAttributes.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggMorphList.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
eggParameters.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pnotify.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition register_type.I:22
typedObject.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.