Panda3D
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  */
29 class EXPCL_PANDA_GRUTIL CardMaker : public Namable {
30 PUBLISHED:
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 
53  INLINE void set_has_normals(bool flag);
54 
55  INLINE void set_source_geometry(PandaNode *node, const LVecBase4 &frame);
56  INLINE void clear_source_geometry();
57 
58  PT(PandaNode) generate();
59 
60 private:
61  PT(PandaNode) rescale_source_geometry();
62 
63  bool _has_uvs, _has_3d_uvs;
64  LVertex _ul_tex, _ll_tex, _lr_tex, _ur_tex;
65  LTexCoord3 _ul_pos, _ll_pos, _lr_pos, _ur_pos;
66 
67  bool _has_color;
68  LColor _color;
69 
70  bool _has_normals;
71 
72  PT(PandaNode) _source_geometry;
73  LVecBase4 _source_frame;
74 };
75 
76 #include "cardMaker.I"
77 
78 #endif
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
Definition: texture.h:71
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A base class for all things which can have a name.
Definition: namable.h:26
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.