Panda3D
Public Member Functions | List of all members
CardMaker Class Reference

This class generates 2-d "cards", that is, rectangular polygons, particularly useful for showing textures etc. More...

#include "cardMaker.h"

Inheritance diagram for CardMaker:
Namable MemoryBase

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
 

Detailed Description

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.

Member Function Documentation

◆ clear_source_geometry()

void CardMaker::clear_source_geometry ( )
inline

Removes the node specified by an earlier call to set_source_geometry().

Definition at line 136 of file cardMaker.I.

◆ reset()

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().

◆ set_color() [1/2]

void CardMaker::set_color ( PN_stdfloat  r,
PN_stdfloat  g,
PN_stdfloat  b,
PN_stdfloat  a 
)
inline

Sets the color of the card.

Definition at line 91 of file cardMaker.I.

◆ set_color() [2/2]

void CardMaker::set_color ( const LColor &  color)
inline

Sets the color of the card.

Definition at line 99 of file cardMaker.I.

◆ set_frame() [1/3]

void CardMaker::set_frame ( PN_stdfloat  left,
PN_stdfloat  right,
PN_stdfloat  bottom,
PN_stdfloat  top 
)
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().

◆ set_frame() [2/3]

void CardMaker::set_frame ( const LVecBase4 &  frame)
inline

Sets the size of the card.

Definition at line 63 of file cardMaker.I.

References set_frame().

◆ set_frame() [3/3]

void CardMaker::set_frame ( const LVertex &  ll,
const LVertex &  lr,
const LVertex &  ur,
const LVertex &  ul 
)
inline

Sets the size of the card.

Definition at line 71 of file cardMaker.I.

◆ set_frame_fullscreen_quad()

void CardMaker::set_frame_fullscreen_quad ( )
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().

◆ set_has_3d_uvs()

void CardMaker::set_has_3d_uvs ( bool  flag)
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.

◆ set_has_normals()

void CardMaker::set_has_normals ( bool  flag)
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.

◆ set_has_uvs()

void CardMaker::set_has_uvs ( bool  flag)
inline

Sets the flag indicating whether vertices will be generated with UV's or not.

Definition at line 34 of file cardMaker.I.

◆ set_source_geometry()

void CardMaker::set_source_geometry ( PandaNode node,
const LVecBase4 &  frame 
)
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.

◆ set_uv_range() [1/5]

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().

◆ set_uv_range() [2/5]

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.

◆ set_uv_range() [3/5]

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.

◆ set_uv_range() [4/5]

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.

◆ set_uv_range() [5/5]

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.

◆ set_uv_range_cube()

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().


The documentation for this class was generated from the following files: