Panda3D
pgFrameStyle.h
1 // Filename: pgFrameStyle.h
2 // Created by: drose (03Jul01)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PGFRAMESTYLE_H
16 #define PGFRAMESTYLE_H
17 
18 #include "pandabase.h"
19 
20 #include "luse.h"
21 #include "texture.h"
22 #include "pointerTo.h"
23 
24 class PandaNode;
25 class NodePath;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : PGFrameStyle
29 // Description :
30 ////////////////////////////////////////////////////////////////////
31 class EXPCL_PANDA_PGUI PGFrameStyle {
32 PUBLISHED:
33  INLINE PGFrameStyle();
34  INLINE PGFrameStyle(const PGFrameStyle &copy);
35  INLINE void operator = (const PGFrameStyle &copy);
36 
37  INLINE ~PGFrameStyle();
38 
39  enum Type {
40  T_none,
41  T_flat,
42  T_bevel_out,
43  T_bevel_in,
44  T_groove,
45  T_ridge,
46  T_texture_border
47  };
48 
49  INLINE void set_type(Type type);
50  INLINE Type get_type() const;
51 
52  INLINE void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
53  INLINE void set_color(const LColor &color);
54  INLINE LColor get_color() const;
55 
56  INLINE void set_texture(Texture *texture);
57  INLINE bool has_texture() const;
58  INLINE Texture *get_texture() const;
59  INLINE void clear_texture();
60 
61  INLINE void set_width(PN_stdfloat x, PN_stdfloat y);
62  INLINE void set_width(const LVecBase2 &width);
63  INLINE const LVecBase2 &get_width() const;
64 
65  INLINE void set_uv_width(PN_stdfloat u, PN_stdfloat v);
66  INLINE void set_uv_width(const LVecBase2 &uv_width);
67  INLINE const LVecBase2 &get_uv_width() const;
68 
69  INLINE void set_visible_scale(PN_stdfloat x, PN_stdfloat y);
70  INLINE void set_visible_scale(const LVecBase2 &visible_scale);
71  INLINE const LVecBase2 &get_visible_scale() const;
72 
73  LVecBase4 get_internal_frame(const LVecBase4 &frame) const;
74 
75  void output(ostream &out) const;
76 
77 public:
78  bool xform(const LMatrix4 &mat);
79  NodePath generate_into(const NodePath &parent, const LVecBase4 &frame,
80  int sort = 0);
81 
82 private:
83  PT(PandaNode) generate_flat_geom(const LVecBase4 &frame);
84  PT(PandaNode) generate_bevel_geom(const LVecBase4 &frame, bool in);
85  PT(PandaNode) generate_groove_geom(const LVecBase4 &frame, bool in);
86  PT(PandaNode) generate_texture_border_geom(const LVecBase4 &frame);
87 
88 private:
89  Type _type;
90  UnalignedLVecBase4 _color;
91  PT(Texture) _texture;
92  LVecBase2 _width;
93  LVecBase2 _uv_width;
94  LVecBase2 _visible_scale;
95 };
96 
97 INLINE ostream &operator << (ostream &out, const PGFrameStyle &pfs);
98 ostream &operator << (ostream &out, PGFrameStyle::Type type);
99 
100 #include "pgFrameStyle.I"
101 
102 #endif
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:75
This is an "unaligned" LVecBase4.
Definition: lvecBase4.h:300
This is a 4-by-4 transform matrix.
Definition: lmatrix.h:451
This is the base class for all two-component vectors and points.
Definition: lvecBase2.h:105
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165