Panda3D
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties
Public Member Functions | Static Public Member Functions
TexProjectorEffect Class Reference

This effect automatically applies a computed texture matrix to the specified texture stage, according to the relative position of two specified nodes. More...

Inheritance diagram for TexProjectorEffect:
RenderEffect TypedWritableReferenceCount TypedWritable ReferenceCount TypedObject

List of all members.

Public Member Functions

RenderEffect const addStage (TextureStage stage, NodePath const from, NodePath const to)
 Returns a new TexProjectorEffect just like this one, with the indicated projection for the given stage.
NodePath getFrom (TextureStage stage)
 Returns the "from" node associated with the TexProjectorEffect on the indicated stage.
NodePath getTo (TextureStage stage)
 Returns the "to" node associated with the TexProjectorEffect on the indicated stage.
bool hasStage (TextureStage stage)
 Returns true if there is a transform associated with the indicated stage, or false otherwise (in which case get_transform(stage) will return the identity transform).
bool isEmpty ()
 Returns true if no stages are defined in the TexProjectorEffect, false if at least one is.
RenderEffect const removeStage (TextureStage stage)
 Returns a new TexProjectorEffect just like this one, with the indicated stage removed.

Static Public Member Functions

static TypeHandle getClassType ()
static RenderEffect const make ()
 Constructs a TexProjectorEffect that modifies no stages at all.

Detailed Description

This effect automatically applies a computed texture matrix to the specified texture stage, according to the relative position of two specified nodes.

The relative transform from the "from" node to the "to" node is applied directly to the texture matrix each frame. If the "to" node happens to be a LensNode, its lens projection matrix is applied as well.

This can be used to apply a number of special effects. Fundamentally, it may simply be used to provide a separate PandaNode that may be adjusted (e.g. via a LerpInterval) in order to easily apply a linear transformation to an object's texture coordinates (rather than having to explicitly call NodePath.set_tex_transform() each frame).

In a more sophisticated case, the TexProjectorEffect is particularly useful in conjunction with a TexGenAttrib that specifies a mode of M_world_position (which copies the world position of each vertex to the texture coordinates). Then the TexProjector can be used to convert these world coordinates to the relative coordinates of a particular node, causing (for instance) a texture to appear to follow a node around as it moves through the world. With a LensNode, you can project a texture onto the walls, for instance to apply a flashlight effect or an image-based shadow.


Member Function Documentation

RenderEffect const addStage ( TextureStage  stage,
NodePath const  from,
NodePath const  to 
)

Returns a new TexProjectorEffect just like this one, with the indicated projection for the given stage.

If this stage already exists, its projection definition is replaced.

The relative transform between the "from" and the "to" nodes is automatically applied to the texture transform each frame.

Furthermore, if the "to" node is a LensNode, its projection matrix is also applied to the texture transform.

static TypeHandle getClassType ( ) [static]

Reimplemented from RenderEffect.

Returns the "from" node associated with the TexProjectorEffect on the indicated stage.

The relative transform between the "from" and the "to" nodes is automatically applied to the texture transform each frame.

Returns the "to" node associated with the TexProjectorEffect on the indicated stage.

The relative transform between the "from" and the "to" nodes is automatically applied to the texture transform each frame.

Furthermore, if the "to" node is a LensNode, its projection matrix is also applied to the texture transform.

bool hasStage ( TextureStage  stage)

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

bool isEmpty ( )

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

static RenderEffect const make ( ) [static]

Constructs a TexProjectorEffect that modifies no stages at all.

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

 All Classes Namespaces Functions Variables Enumerations Enumerator Properties