Panda3D
cardMaker.h
1 // Filename: cardMaker.h
2 // Created by: drose (16Mar02)
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 CARDMAKER_H
16 #define CARDMAKER_H
17 
18 #include "pandabase.h"
19 
20 #include "luse.h"
21 #include "pandaNode.h"
22 #include "pointerTo.h"
23 #include "namable.h"
24 #include "texture.h"
25 
26 ////////////////////////////////////////////////////////////////////
27 // Class : CardMaker
28 // Description : This class generates 2-d "cards", that is,
29 // rectangular polygons, particularly useful for showing
30 // textures etc. in the 2-d scene graph.
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDA_GRUTIL CardMaker : public Namable {
33 PUBLISHED:
34  INLINE CardMaker(const string &name);
35  INLINE ~CardMaker();
36 
37  void reset();
38  void set_uv_range(const LTexCoord &ll, const LTexCoord &ur);
39  void set_uv_range(const LTexCoord &ll, const LTexCoord &lr, const LTexCoord &ur, const LTexCoord &ul);
40  void set_uv_range(const LTexCoord3 &ll, const LTexCoord3 &lr, const LTexCoord3 &ur, const LTexCoord3 &ul);
41  void set_uv_range(const LVector4 &x, const LVector4 &y, const LVector4 &z);
42  void set_uv_range_cube(int face);
43  void set_uv_range(const Texture *tex);
44 
45  INLINE void set_has_uvs(bool flag);
46  INLINE void set_has_3d_uvs(bool flag);
47 
48  INLINE void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top);
49  INLINE void set_frame(const LVecBase4 &frame);
50  INLINE void set_frame(const LVertex &ll, const LVertex &lr, const LVertex &ur, const LVertex &ul);
51  INLINE void set_frame_fullscreen_quad();
52 
53  INLINE void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a);
54  INLINE void set_color(const LColor &color);
55 
56  INLINE void set_has_normals(bool flag);
57 
58  INLINE void set_source_geometry(PandaNode *node, const LVecBase4 &frame);
59  INLINE void clear_source_geometry();
60 
61  PT(PandaNode) generate();
62 
63 private:
64  PT(PandaNode) rescale_source_geometry();
65 
66  bool _has_uvs, _has_3d_uvs;
67  LVertex _ul_tex, _ll_tex, _lr_tex, _ur_tex;
68  LTexCoord3 _ul_pos, _ll_pos, _lr_pos, _ur_pos;
69 
70  bool _has_color;
71  LColor _color;
72 
73  bool _has_normals;
74 
75  PT(PandaNode) _source_geometry;
76  LVecBase4 _source_frame;
77 };
78 
79 #include "cardMaker.I"
80 
81 #endif
82 
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 a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
A base class for all things which can have a name.
Definition: namable.h:29
This class generates 2-d "cards", that is, rectangular polygons, particularly useful for showing text...
Definition: cardMaker.h:32
This is a four-component vector distance.
Definition: lvector4.h:91
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
This is a two-component point in space.
Definition: lpoint2.h:92