Panda3D
Public Member Functions

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

List of all members.

Public Member Functions

 CardMaker (const string &name)
void clear_source_geometry ()
 Removes the node specified by an earlier call to set_source_geometry().
 PT (PandaNode) generate()
void reset ()
 Resets all the parameters to their initial defaults.
void set_color (PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
 Sets the color of the card.
void set_color (const LColor &color)
 Sets the color of the card.
void set_frame (PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
 Sets the size of the card.
void set_frame (const LVecBase4 &frame)
 Sets the size of the card.
void set_frame (const LVertex &ll, const LVertex &lr, const LVertex &ur, const LVertex &ul)
 Sets the size of the card.
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.
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).
void set_has_normals (bool flag)
 Sets the flag indicating whether vertices will be generated with normals or not.
void set_has_uvs (bool flag)
 Sets the flag indicating whether vertices will be generated with UV's or not.
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.
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.
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.
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.
void set_uv_range (const LTexCoord &ll, const LTexCoord &ur)
 Sets the range of UV's that will be applied to the vertices.
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.
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.

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 32 of file cardMaker.h.


Member Function Documentation

void CardMaker::clear_source_geometry ( ) [inline]

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

Definition at line 174 of file cardMaker.I.

void CardMaker::reset ( )

Resets all the parameters to their initial defaults.

Definition at line 31 of file cardMaker.cxx.

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 115 of file cardMaker.I.

Referenced by MultitexReducer::flatten().

void CardMaker::set_color ( const LColor color) [inline]

Sets the color of the card.

Definition at line 125 of file cardMaker.I.

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 65 of file cardMaker.I.

Referenced by MultitexReducer::flatten(), set_frame(), and set_frame_fullscreen_quad().

void CardMaker::set_frame ( const LVecBase4 frame) [inline]

Sets the size of the card.

Definition at line 78 of file cardMaker.I.

References set_frame().

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 88 of file cardMaker.I.

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 104 of file cardMaker.I.

References set_frame().

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 55 of file cardMaker.I.

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 142 of file cardMaker.I.

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 42 of file cardMaker.I.

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 162 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 203 of file cardMaker.cxx.

Referenced by set_uv_range(), 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 184 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 260 of file cardMaker.cxx.

References Texture::get_pad_x_size(), Texture::get_pad_y_size(), Texture::get_texture_type(), Texture::get_x_size(), Texture::get_y_size(), and set_uv_range().

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 222 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 165 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 238 of file cardMaker.cxx.

References set_uv_range().


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations