Panda3D
Loading...
Searching...
No Matches
pgFrameStyle.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 pgFrameStyle.h
10 * @author drose
11 * @date 2001-07-03
12 */
13
14#ifndef PGFRAMESTYLE_H
15#define PGFRAMESTYLE_H
16
17#include "pandabase.h"
18
19#include "luse.h"
20#include "texture.h"
21#include "pointerTo.h"
22
23class PandaNode;
24class NodePath;
25
26/**
27 *
28 */
29class EXPCL_PANDA_PGUI PGFrameStyle {
30PUBLISHED:
31 INLINE PGFrameStyle();
32 INLINE PGFrameStyle(const PGFrameStyle &copy);
33 INLINE void operator = (const PGFrameStyle &copy);
34
35 INLINE ~PGFrameStyle();
36
37 enum Type {
38 T_none,
39 T_flat,
40 T_bevel_out,
41 T_bevel_in,
42 T_groove,
43 T_ridge,
44 T_texture_border
45 };
46
47 INLINE void set_type(Type type);
48 INLINE Type get_type() const;
49
50 INLINE void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
51 INLINE void set_color(const LColor &color);
52 INLINE LColor get_color() const;
53
54 INLINE void set_texture(Texture *texture);
55 INLINE bool has_texture() const;
56 INLINE Texture *get_texture() const;
57 INLINE void clear_texture();
58
59 INLINE void set_width(PN_stdfloat x, PN_stdfloat y);
60 INLINE void set_width(const LVecBase2 &width);
61 INLINE const LVecBase2 &get_width() const;
62
63 INLINE void set_uv_width(PN_stdfloat u, PN_stdfloat v);
64 INLINE void set_uv_width(const LVecBase2 &uv_width);
65 INLINE const LVecBase2 &get_uv_width() const;
66
67 INLINE void set_visible_scale(PN_stdfloat x, PN_stdfloat y);
68 INLINE void set_visible_scale(const LVecBase2 &visible_scale);
69 INLINE const LVecBase2 &get_visible_scale() const;
70
71 LVecBase4 get_internal_frame(const LVecBase4 &frame) const;
72
73 void output(std::ostream &out) const;
74
75public:
76 bool xform(const LMatrix4 &mat);
77 NodePath generate_into(const NodePath &parent, const LVecBase4 &frame,
78 int sort = 0);
79
80private:
81 PT(PandaNode) generate_flat_geom(const LVecBase4 &frame);
82 PT(PandaNode) generate_bevel_geom(const LVecBase4 &frame, bool in);
83 PT(PandaNode) generate_groove_geom(const LVecBase4 &frame, bool in);
84 PT(PandaNode) generate_texture_border_geom(const LVecBase4 &frame);
85
86private:
87 Type _type;
88 UnalignedLVecBase4 _color;
89 PT(Texture) _texture;
90 LVecBase2 _width;
91 LVecBase2 _uv_width;
92 LVecBase2 _visible_scale;
93};
94
95INLINE std::ostream &operator << (std::ostream &out, const PGFrameStyle &pfs);
96std::ostream &operator << (std::ostream &out, PGFrameStyle::Type type);
97
98#include "pgFrameStyle.I"
99
100#endif
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition nodePath.h:159
void set_type(Type type)
Sets the basic type of frame.
bool xform(const LMatrix4 &mat)
Applies the indicated transform to the FrameStyle.
void set_texture(Texture *texture)
Specifies a texture that should be applied to the frame.
const LVecBase2 & get_visible_scale() const
Returns the scale factor on the visible representation of the frame, in the X and Y directions.
Type get_type() const
Returns the basic type of frame.
void set_visible_scale(PN_stdfloat x, PN_stdfloat y)
Sets a scale factor on the visible representation of the frame, in the X and Y directions.
LColor get_color() const
Returns the dominant color of the frame.
void set_uv_width(PN_stdfloat u, PN_stdfloat v)
Sets the uv_width parameter, which indicates the amount of the texture that is consumed by the inner ...
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the dominant color of the frame.
NodePath generate_into(const NodePath &parent, const LVecBase4 &frame, int sort=0)
Generates geometry representing a frame of the indicated size, and parents it to the indicated node,...
bool has_texture() const
Returns true if a texture has been applied to the frame.
LVecBase4 get_internal_frame(const LVecBase4 &frame) const
Computes the size of the internal frame, given the indicated external frame, appropriate for this kin...
const LVecBase2 & get_width() const
Returns the width parameter, which has meaning only for certain frame types.
void clear_texture()
Removes the texture from the frame.
Texture * get_texture() const
Returns the texture that has been applied to the frame, or NULL if no texture has been applied.
void set_width(PN_stdfloat x, PN_stdfloat y)
Sets the width parameter, which has meaning only for certain frame types.
const LVecBase2 & get_uv_width() const
See set_uv_width().
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition texture.h:72
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.