Panda3D
Loading...
Searching...
No Matches
cardMaker.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 cardMaker.h
10 * @author drose
11 * @date 2002-03-16
12 */
13
14#ifndef CARDMAKER_H
15#define CARDMAKER_H
16
17#include "pandabase.h"
18
19#include "luse.h"
20#include "pandaNode.h"
21#include "pointerTo.h"
22#include "namable.h"
23#include "texture.h"
24
25/**
26 * This class generates 2-d "cards", that is, rectangular polygons,
27 * particularly useful for showing textures etc. in the 2-d scene graph.
28 */
29class EXPCL_PANDA_GRUTIL CardMaker : public Namable {
30PUBLISHED:
31 INLINE explicit CardMaker(const std::string &name);
32 INLINE ~CardMaker();
33
34 void reset();
35 void set_uv_range(const LTexCoord &ll, const LTexCoord &ur);
36 void set_uv_range(const LTexCoord &ll, const LTexCoord &lr, const LTexCoord &ur, const LTexCoord &ul);
37 void set_uv_range(const LTexCoord3 &ll, const LTexCoord3 &lr, const LTexCoord3 &ur, const LTexCoord3 &ul);
38 void set_uv_range(const LVector4 &x, const LVector4 &y, const LVector4 &z);
39 void set_uv_range_cube(int face);
40 void set_uv_range(const Texture *tex);
41
42 INLINE void set_has_uvs(bool flag);
43 INLINE void set_has_3d_uvs(bool flag);
44
45 INLINE void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top);
46 INLINE void set_frame(const LVecBase4 &frame);
47 INLINE void set_frame(const LVertex &ll, const LVertex &lr, const LVertex &ur, const LVertex &ul);
48 INLINE void set_frame_fullscreen_quad();
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 void clear_color();
53
54 INLINE void set_has_normals(bool flag);
55
56 INLINE void set_source_geometry(PandaNode *node, const LVecBase4 &frame);
57 INLINE void clear_source_geometry();
58
59 PT(PandaNode) generate();
60
61private:
62 PT(PandaNode) rescale_source_geometry();
63
64 bool _has_uvs, _has_3d_uvs;
65 LVertex _ul_tex, _ll_tex, _lr_tex, _ur_tex;
66 LTexCoord3 _ul_pos, _ll_pos, _lr_pos, _ur_pos;
67
68 bool _has_color;
69 LColor _color;
70
71 bool _has_normals;
72
73 PT(PandaNode) _source_geometry;
74 LVecBase4 _source_frame;
75};
76
77#include "cardMaker.I"
78
79#endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class generates 2-d "cards", that is, rectangular polygons, particularly useful for showing text...
Definition cardMaker.h:29
A base class for all things which can have a name.
Definition namable.h:26
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.