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

Inheritance diagram for CardMaker:
Namable

Public Member Functions

 __init__ (const CardMaker)
 
 __init__ (str name)
 
 clearSourceGeometry ()
 Removes the node specified by an earlier call to set_source_geometry(). More...
 
PandaNode generate ()
 Generates a GeomNode that renders the specified geometry. More...
 
 reset ()
 Resets all the parameters to their initial defaults. More...
 
 setColor (const LColor color)
 
 setColor (float r, float g, float b, float a)
 Sets the color of the card. More...
 
 setFrame (const LVecBase4 frame)
 Sets the size of the card. More...
 
 setFrame (const LVertex ll, const LVertex lr, const LVertex ur, const LVertex ul)
 Sets the size of the card. More...
 
 setFrame (float left, float right, float bottom, float top)
 Sets the size of the card. More...
 
 setFrameFullscreenQuad ()
 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...
 
 setHas3dUvs (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...
 
 setHasNormals (bool flag)
 Sets the flag indicating whether vertices will be generated with normals or not. More...
 
 setHasUvs (bool flag)
 Sets the flag indicating whether vertices will be generated with UV's or not. More...
 
 setSourceGeometry (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...
 
 setUvRange (const LTexCoord ll, const LTexCoord ur)
 Sets the range of UV's that will be applied to the vertices. More...
 
 setUvRange (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...
 
 setUvRange (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...
 
 setUvRange (const LVector4 x, const LVector4 y, const LVector4 z)
 Sets the range of UV's that will be applied to the vertices. More...
 
 setUvRange (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...
 
 setUvRangeCube (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
 __init__ (const Namable)
 
 __init__ (str initial_name)
 
 clearName ()
 Resets the Namable's name to empty. More...
 
str getName ()
 
bool hasName ()
 Returns true if the Namable has a nonempty name set, false if the name is empty. More...
 
 output (Ostream out)
 Outputs the Namable. More...
 
 setName (str name)
 

Additional Inherited Members

- Static Public Member Functions inherited from Namable
static TypeHandle getClassType ()
 
- Public Attributes inherited from Namable
const String 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.

Member Function Documentation

◆ __init__() [1/2]

__init__ ( const  CardMaker)

◆ __init__() [2/2]

__init__ ( str  name)

◆ clearSourceGeometry()

clearSourceGeometry ( )

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

◆ generate()

PandaNode generate ( )

Generates a GeomNode that renders the specified geometry.

◆ reset()

reset ( )

Resets all the parameters to their initial defaults.

◆ setColor() [1/2]

setColor ( const LColor  color)

◆ setColor() [2/2]

setColor ( float  r,
float  g,
float  b,
float  a 
)

Sets the color of the card.

◆ setFrame() [1/3]

setFrame ( const LVecBase4  frame)

Sets the size of the card.

◆ setFrame() [2/3]

setFrame ( const LVertex  ll,
const LVertex  lr,
const LVertex  ur,
const LVertex  ul 
)

Sets the size of the card.

◆ setFrame() [3/3]

setFrame ( float  left,
float  right,
float  bottom,
float  top 
)

Sets the size of the card.

◆ setFrameFullscreenQuad()

setFrameFullscreenQuad ( )

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.

◆ setHas3dUvs()

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

Normally, this will be implicitly set by setting the uv_range.

◆ setHasNormals()

setHasNormals ( bool  flag)

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.

◆ setHasUvs()

setHasUvs ( bool  flag)

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

◆ setSourceGeometry()

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

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

◆ setUvRange() [1/5]

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

◆ setUvRange() [2/5]

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

◆ setUvRange() [3/5]

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

◆ setUvRange() [4/5]

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

◆ setUvRange() [5/5]

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

◆ setUvRangeCube()

setUvRangeCube ( int  face)

Sets the range of UV's that will be applied to the vertices appropriately for a cube-map face.