TexGenAttrib

class TexGenAttrib

Bases: RenderAttrib

Computes texture coordinates for geometry automatically based on vertex position and/or normal. This can be used to implement reflection and/or refraction maps, for instance to make shiny surfaces, as well as other special effects such as projective texturing.

Inheritance diagram

Inheritance diagram of TexGenAttrib

ConstPointerTo<RenderAttrib> add_stage(TextureStage *stage, Mode mode) const
ConstPointerTo<RenderAttrib> add_stage(TextureStage *stage, Mode mode, LTexCoord3 const &constant_value) const

Returns a new TexGenAttrib just like this one, with the indicated generation mode for the given stage. If this stage already exists, its mode is replaced.

Returns a new TexGenAttrib just like this one, with the indicated generation mode for the given stage. If this stage already exists, its mode is replaced.

This variant also accepts constant_value, which is only meaningful if mode is M_constant.

static int get_class_slot(void)
static TypeHandle get_class_type(void)
LTexCoord3 const &get_constant_value(TextureStage *stage) const

Returns the constant value associated with the named texture stage. This is only meaningful if the mode is M_constant.

int get_geom_rendering(int geom_rendering) const

Returns the union of the Geom::GeomRendering bits that will be required once this TexGenAttrib is applied to a geom which includes the indicated geom_rendering bits.

Mode get_mode(TextureStage *stage) const

Returns the generation mode associated with the named texture stage, or M_off if nothing is associated with the indicated stage.

bool has_gen_texcoord_stage(TextureStage *stage) const

Returns true if the indicated TextureStage will have texture coordinates generated for it automatically (and thus there is no need to upload the texture coordinates encoded in the vertices).

bool has_stage(TextureStage *stage) const

Returns true if there is a mode associated with the indicated stage, or false otherwise (in which case get_transform(stage) will return M_off).

bool is_empty(void) const

Returns true if no stages are defined in the TexGenAttrib, false if at least one is.

static ConstPointerTo<RenderAttrib> make(void)
static ConstPointerTo<RenderAttrib> make(TextureStage *stage, Mode mode)

Constructs a TexGenAttrib that generates no stages at all.

Constructs a TexGenAttrib that generates just the indicated stage.

static ConstPointerTo<RenderAttrib> make_default(void)

Returns a RenderAttrib that corresponds to whatever the standard default properties for render attributes of this type ought to be.

ConstPointerTo<RenderAttrib> remove_stage(TextureStage *stage) const

Returns a new TexGenAttrib just like this one, with the indicated stage removed.