RenderEffects

class RenderEffects

Bases: TypedWritableReferenceCount

This represents a unique collection of RenderEffect objects that correspond to a particular renderable state.

You should not attempt to create or modify a RenderEffects object directly. Instead, call one of the make() functions to create one for you. And instead of modifying a RenderEffects object, create a new one.

Inheritance diagram

Inheritance diagram of RenderEffects

ConstPointerTo<RenderEffects> add_effect(RenderEffect const *effect) const

Returns a new RenderEffects object that represents the same as the source state, with the new RenderEffect added. If there is already a RenderEffect with the same type, it is replaced.

int find_effect(TypeHandle type) const

Searches for an effect with the indicated type in the state, and returns its index if it is found, or -1 if it is not.

static TypeHandle get_class_type(void)
RenderEffect const *get_effect(std::size_t n) const
RenderEffect const *get_effect(TypeHandle type) const

Returns the nth effect in the state.

Looks for a RenderEffect of the indicated type in the state, and returns it if it is found, or NULL if it is not.

std::size_t get_num_effects(void) const

Returns the number of separate effects indicated in the state.

Deprecated: in Python, use len(effects) instead, or effects.size() in C++.

static int get_num_states(void)

Returns the total number of unique RenderEffects objects allocated in the world. This will go up and down during normal operations.

bool is_empty(void) const

Returns true if the state is empty, false otherwise.

static void list_states(std::ostream &out)

Lists all of the RenderEffects in the cache to the output stream, one per line. This can be quite a lot of output if the cache is large, so be prepared.

static ConstPointerTo<RenderEffects> make(RenderEffect const *effect)
static ConstPointerTo<RenderEffects> make(RenderEffect const *effect1, RenderEffect const *effect2)
static ConstPointerTo<RenderEffects> make(RenderEffect const *effect1, RenderEffect const *effect2, RenderEffect const *effect3)
static ConstPointerTo<RenderEffects> make(RenderEffect const *effect1, RenderEffect const *effect2, RenderEffect const *effect3, RenderEffect const *effect4)

Returns a RenderEffects with one effect set.

Returns a RenderEffects with two effects set.

Returns a RenderEffects with three effects set.

Returns a RenderEffects with four effects set.

static ConstPointerTo<RenderEffects> make_empty(void)

Returns a RenderEffects with no effects set.

void output(std::ostream &out) const
ConstPointerTo<RenderEffects> remove_effect(TypeHandle type) const

Returns a new RenderEffects object that represents the same as the source state, with the indicated RenderEffect removed.

std::size_t size(void) const

Returns the number of separate effects indicated in the state.

static bool validate_states(void)

Ensures that the cache is still stored in sorted order. Returns true if so, false if there is a problem (which implies someone has modified one of the supposedly-const RenderEffects objects).

void write(std::ostream &out, int indent_level) const