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 */
33class 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
63private:
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
74public:
75 static TypeHandle get_class_type() {
76 return _type_handle;
77 }
78 static void init_type() {
79 register_type(_type_handle, "EggAttributes");
80 }
81
82private:
83 static TypeHandle _type_handle;
84};
85
86#include "eggAttributes.I"
87
88#endif
bool matches_normal(const EggAttributes &other) const
Returns true if this normal matches that of the other EggAttributes object, include the morph list.
void transform(const LMatrix4d &mat)
Applies the indicated transformation matrix to the attributes.
void copy_normal(const EggAttributes &other)
Sets this normal to be the same as the other's, include morphs.
int compare_to(const EggAttributes &other) const
An ordering operator to compare two vertices for sorting order.
void copy_color(const EggAttributes &other)
Sets this color to be the same as the other's, include morphs.
LColor get_color() const
Returns the color set on this particular attribute.
bool matches_color(const EggAttributes &other) const
Returns true if this color matches that of the other EggAttributes object, include the morph list.
void write(std::ostream &out, int indent_level) const
Writes the attributes to the indicated output stream in Egg format.
bool sorts_less_than(const EggAttributes &other) const
An ordering operator to compare two vertices for sorting order.
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 is the identifier used to differentiate C++ class types.
Definition typeHandle.h:81
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.