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 */
29 class 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
61 private:
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
cardMaker.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
CardMaker::set_uv_range_cube
void set_uv_range_cube(int face)
Sets the range of UV's that will be applied to the vertices appropriately for a cube-map face.
Definition cardMaker.cxx:208
CardMaker::set_has_uvs
void set_has_uvs(bool flag)
Sets the flag indicating whether vertices will be generated with UV's or not.
Definition cardMaker.I:34
CardMaker::set_has_3d_uvs
void set_has_3d_uvs(bool flag)
Sets the flag indicating whether vertices will be generated with 3-component UVW's (true) or 2-compon...
Definition cardMaker.I:44
CardMaker::clear_source_geometry
void clear_source_geometry()
Removes the node specified by an earlier call to set_source_geometry().
Definition cardMaker.I:145
CardMaker::clear_color
void clear_color()
Unsets the color of the card.
Definition cardMaker.I:108
CardMaker::reset
void reset()
Resets all the parameters to their initial defaults.
Definition cardMaker.cxx:28
CardMaker::set_frame_fullscreen_quad
void set_frame_fullscreen_quad()
Sets the card to (-1,1,-1,1), which is appropriate if you plan to parent it to render2d and use it as...
Definition cardMaker.I:83
CardMaker::set_source_geometry
void set_source_geometry(PandaNode *node, const LVecBase4 &frame)
Sets a node that will be copied (and scaled and translated) to generate the frame,...
Definition cardMaker.I:136
CardMaker::set_color
void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
Sets the color of the card.
Definition cardMaker.I:91
CardMaker::set_uv_range
void set_uv_range(const LTexCoord &ll, const LTexCoord &ur)
Sets the range of UV's that will be applied to the vertices.
Definition cardMaker.cxx:178
CardMaker::set_frame
void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
Sets the size of the card.
Definition cardMaker.I:52
CardMaker::set_has_normals
void set_has_normals(bool flag)
Sets the flag indicating whether vertices will be generated with normals or not.
Definition cardMaker.I:121
PandaNode
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
Texture
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
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
namable.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandaNode.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pointerTo.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
texture.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.