CardMaker

class CardMaker

Bases: Namable

This class generates 2-d “cards”, that is, rectangular polygons, particularly useful for showing textures etc. in the 2-d scene graph.

Inheritance diagram

Inheritance diagram of CardMaker

explicit CardMaker(std::string const &name)
CardMaker(CardMaker const&) = default
void clear_source_geometry(void)

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

PointerTo<PandaNode> generate(void)

Generates a GeomNode that renders the specified geometry.

void reset(void)

Resets all the parameters to their initial defaults.

void set_color(PN_stdfloat r, PN_stdfloat g, PN_stdfloat b, PN_stdfloat a)
void set_color(LColor const &color)

Sets the color of the card.

void set_frame(PN_stdfloat left, PN_stdfloat right, PN_stdfloat bottom, PN_stdfloat top)
void set_frame(LVecBase4 const &frame)
void set_frame(LVertex const &ll, LVertex const &lr, LVertex const &ur, LVertex const &ul)

Sets the size of the card.

void set_frame_fullscreen_quad(void)

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). Normally, this will be implicitly set by setting the uv_range.

void set_has_normals(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.

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, LVecBase4 const &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().

void set_uv_range(LTexCoord const &ll, LTexCoord const &ur)
void set_uv_range(LTexCoord const &ll, LTexCoord const &lr, LTexCoord const &ur, LTexCoord const &ul)
void set_uv_range(LTexCoord3 const &ll, LTexCoord3 const &lr, LTexCoord3 const &ur, LTexCoord3 const &ul)
void set_uv_range(LVector4 const &x, LVector4 const &y, LVector4 const &z)
void set_uv_range(Texture const *tex)

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.

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.

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.

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.

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_cube(int face)

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