This class generates 2-d "cards", that is, rectangular polygons, particularly useful for showing textures etc. More...
#include "cardMaker.h"
Public Member Functions | |
CardMaker (const std::string &name) | |
void | clear_source_geometry () |
Removes the node specified by an earlier call to set_source_geometry(). More... | |
PT (PandaNode) generate() | |
void | reset () |
Resets all the parameters to their initial defaults. More... | |
void | set_color (PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a) |
Sets the color of the card. More... | |
void | set_color (const LColor &color) |
Sets the color of the card. More... | |
void | set_frame (PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top) |
Sets the size of the card. More... | |
void | set_frame (const LVecBase4 &frame) |
Sets the size of the card. More... | |
void | set_frame (const LVertex &ll, const LVertex &lr, const LVertex &ur, const LVertex &ul) |
Sets the size of the card. More... | |
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 a fullscreen quad. More... | |
void | set_has_3d_uvs (bool flag) |
Sets the flag indicating whether vertices will be generated with 3-component UVW's (true) or 2-component UV's (the default, false). More... | |
void | set_has_normals (bool flag) |
Sets the flag indicating whether vertices will be generated with normals or not. More... | |
void | set_has_uvs (bool flag) |
Sets the flag indicating whether vertices will be generated with UV's or not. More... | |
void | set_source_geometry (PandaNode *node, const LVecBase4 &frame) |
Sets a node that will be copied (and scaled and translated) to generate the frame, instead of generating a new polygon. More... | |
void | set_uv_range (const LTexCoord &ll, const LTexCoord &ur) |
Sets the range of UV's that will be applied to the vertices. More... | |
void | set_uv_range (const LTexCoord &ll, const LTexCoord &lr, const LTexCoord &ur, const LTexCoord &ul) |
Sets the range of UV's that will be applied to the vertices. More... | |
void | set_uv_range (const LTexCoord3 &ll, const LTexCoord3 &lr, const LTexCoord3 &ur, const LTexCoord3 &ul) |
Sets the range of UV's that will be applied to the vertices. More... | |
void | set_uv_range (const LVector4 &x, const LVector4 &y, const LVector4 &z) |
Sets the range of UV's that will be applied to the vertices. More... | |
void | set_uv_range (const Texture *tex) |
Sets the range of UV's that will be applied to the vertices appropriately to show the non-pad region of the texture. More... | |
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. More... | |
Public Member Functions inherited from Namable | |
Namable (const std::string &initial_name="") | |
void | clear_name () |
Resets the Namable's name to empty. More... | |
const std::string & | get_name () const |
bool | has_name () const |
Returns true if the Namable has a nonempty name set, false if the name is empty. More... | |
void | output (std::ostream &out) const |
Outputs the Namable. More... | |
void | set_name (const std::string &name) |
Additional Inherited Members | |
Static Public Member Functions inherited from Namable | |
static TypeHandle | get_class_type () |
static void | init_type () |
Public Attributes inherited from Namable | |
get_name | |
set_name | |
This class generates 2-d "cards", that is, rectangular polygons, particularly useful for showing textures etc.
in the 2-d scene graph.
Definition at line 29 of file cardMaker.h.
|
inline |
Removes the node specified by an earlier call to set_source_geometry().
Definition at line 136 of file cardMaker.I.
void CardMaker::reset | ( | ) |
Resets all the parameters to their initial defaults.
Definition at line 28 of file cardMaker.cxx.
References set_frame(), and set_uv_range().
|
inline |
Sets the color of the card.
Definition at line 91 of file cardMaker.I.
|
inline |
Sets the color of the card.
Definition at line 99 of file cardMaker.I.
|
inline |
Sets the size of the card.
Definition at line 52 of file cardMaker.I.
Referenced by reset(), set_frame(), and set_frame_fullscreen_quad().
|
inline |
|
inline |
Sets the size of the card.
Definition at line 71 of file cardMaker.I.
|
inline |
Sets the card to (-1,1,-1,1), which is appropriate if you plan to parent it to render2d and use it as a fullscreen quad.
Definition at line 83 of file cardMaker.I.
References set_frame().
|
inline |
Sets the flag indicating whether vertices will be generated with 3-component UVW's (true) or 2-component UV's (the default, false).
Normally, this will be implicitly set by setting the uv_range.
Definition at line 44 of file cardMaker.I.
|
inline |
Sets the flag indicating whether vertices will be generated with normals or not.
Normals are required if you intend to enable lighting on the card, but are just wasted space and bandwidth otherwise, so there is a (slight) optimization for disabling them. If enabled, the normals will be generated perpendicular to the card's face.
Definition at line 112 of file cardMaker.I.
|
inline |
Sets the flag indicating whether vertices will be generated with UV's or not.
Definition at line 34 of file cardMaker.I.
|
inline |
Sets a node that will be copied (and scaled and translated) to generate the frame, instead of generating a new polygon.
The node may contain arbitrary geometry that describes a flat polygon contained within the indicated left, right, bottom, top frame.
When generate() is called, the geometry in this node will be scaled and translated appropriately to give it the size and aspect ratio specified by set_frame().
Definition at line 127 of file cardMaker.I.
void CardMaker::set_uv_range | ( | const LTexCoord & | ll, |
const LTexCoord & | ur | ||
) |
Sets the range of UV's that will be applied to the vertices.
If set_has_uvs() is true (as it is by default), the vertices will be generated with the indicated range of UV's, which will be useful if a texture is applied.
Definition at line 178 of file cardMaker.cxx.
Referenced by reset(), and set_uv_range_cube().
void CardMaker::set_uv_range | ( | const LTexCoord & | ll, |
const LTexCoord & | lr, | ||
const LTexCoord & | ur, | ||
const LTexCoord & | ul | ||
) |
Sets the range of UV's that will be applied to the vertices.
If set_has_uvs() is true (as it is by default), the vertices will be generated with the indicated range of UV's, which will be useful if a texture is applied.
Definition at line 162 of file cardMaker.cxx.
void CardMaker::set_uv_range | ( | const LTexCoord3 & | ll, |
const LTexCoord3 & | lr, | ||
const LTexCoord3 & | ur, | ||
const LTexCoord3 & | ul | ||
) |
Sets the range of UV's that will be applied to the vertices.
If set_has_uvs() is true (as it is by default), the vertices will be generated with the indicated range of UV's, which will be useful if a texture is applied.
Definition at line 146 of file cardMaker.cxx.
void CardMaker::set_uv_range | ( | const LVector4 & | x, |
const LVector4 & | y, | ||
const LVector4 & | z | ||
) |
Sets the range of UV's that will be applied to the vertices.
If set_has_uvs() is true (as it is by default), the vertices will be generated with the indicated range of UV's, which will be useful if a texture is applied.
Definition at line 194 of file cardMaker.cxx.
void CardMaker::set_uv_range | ( | const Texture * | tex | ) |
Sets the range of UV's that will be applied to the vertices appropriately to show the non-pad region of the texture.
Definition at line 227 of file cardMaker.cxx.
void CardMaker::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 at line 208 of file cardMaker.cxx.
References set_uv_range().