RenderAttrib
from panda3d.core import RenderAttrib
- class RenderAttrib
Bases:
TypedWritableReferenceCount
This is the base class for a number of render attributes (other than transform) that may be set on scene graph nodes to control the appearance of geometry. This includes TextureAttrib, ColorAttrib, etc.
RenderAttrib represents render attributes that always propagate down to the leaves without regard to the particular node they are assigned to. A RenderAttrib will have the same effect on a leaf node whether it is assigned to the graph at the leaf or several nodes above. This is different from RenderEffect, which represents a particular render property that is applied immediately to the node on which it is encountered, like billboarding or decaling.
You should not attempt to create or modify a RenderAttrib directly; instead, use the make() method of the appropriate kind of attrib you want. This will allocate and return a new RenderAttrib of the appropriate type, and it may share pointers if possible. Do not modify the new RenderAttrib if you wish to change its properties; instead, create a new one.
Inheritance diagram
- MAlways = 8
- MConstant = 11
- MEqual = 3
- MEyeCubeMap = 3
- MEyeNormal = 5
- MEyePosition = 8
- MEyeSphereMap = 1
- MGreater = 5
- MGreaterEqual = 7
- MLess = 2
- MLessEqual = 4
- MNever = 1
- MNone = 0
- MNotEqual = 6
- MOff = 0
- MPointSprite = 9
- MUnused = 7
- MUnused2 = 10
- MWorldCubeMap = 2
- MWorldNormal = 4
- MWorldPosition = 6
- M_always = 8
- M_constant = 11
- M_equal = 3
- M_eye_cube_map = 3
- M_eye_normal = 5
- M_eye_position = 8
- M_eye_sphere_map = 1
- M_greater = 5
- M_greater_equal = 7
- M_less = 2
- M_less_equal = 4
- M_never = 1
- M_none = 0
- M_not_equal = 6
- M_off = 0
- M_point_sprite = 9
- M_unused = 7
- M_unused2 = 10
- M_world_cube_map = 2
- M_world_normal = 4
- M_world_position = 6
- __init__(*args, **kwargs)
- compareTo()
C++ Interface: compare_to(RenderAttrib self, const RenderAttrib other)
- /**
Provides an arbitrary ordering among all unique RenderAttribs, so we can
store the essentially different ones in a big set and throw away the rest.
This method is not needed outside of the RenderAttrib class because all
equivalent RenderAttrib objects are guaranteed to share the same pointer;
thus, a pointer comparison is always sufficient.
*/
- compare_to()
C++ Interface: compare_to(RenderAttrib self, const RenderAttrib other)
- /**
Provides an arbitrary ordering among all unique RenderAttribs, so we can
store the essentially different ones in a big set and throw away the rest.
This method is not needed outside of the RenderAttrib class because all
equivalent RenderAttrib objects are guaranteed to share the same pointer;
thus, a pointer comparison is always sufficient.
*/
- compose()
C++ Interface: compose(RenderAttrib self, const RenderAttrib other)
- /**
Returns a new RenderAttrib object that represents the composition of this
attrib with the other attrib. In most cases, this is the same as the other
attrib; a compose b produces b. Some kinds of attributes, like a
TextureTransform, for instance, might produce a new result: a compose b
produces c.
*/
- garbageCollect()
C++ Interface: garbage_collect()
- /**
Performs a garbage-collection cycle. This is called automatically from
RenderState::garbage_collect(); see that method for more information.
*/
- garbage_collect()
C++ Interface: garbage_collect()
- /**
Performs a garbage-collection cycle. This is called automatically from
RenderState::garbage_collect(); see that method for more information.
*/
- getClassType()
C++ Interface: get_class_type()
- getHash()
C++ Interface: get_hash(RenderAttrib self)
- /**
Returns a suitable hash value for phash_map.
*/
- getNumAttribs()
C++ Interface: get_num_attribs()
- /**
Returns the total number of unique RenderAttrib objects allocated in the
world. This will go up and down during normal operations.
*/
- getSlot()
C++ Interface: get_slot(RenderAttrib self)
- getUnique()
C++ Interface: get_unique(RenderAttrib self)
- /**
Returns the pointer to the unique RenderAttrib in the cache that is
equivalent to this one. This may be the same pointer as this object, or it
may be a different pointer; but it will be an equivalent object, and it
will be a shared pointer. This may be called from time to time to improve
cache benefits.
*/
- get_class_type()
C++ Interface: get_class_type()
- get_hash()
C++ Interface: get_hash(RenderAttrib self)
- /**
Returns a suitable hash value for phash_map.
*/
- get_num_attribs()
C++ Interface: get_num_attribs()
- /**
Returns the total number of unique RenderAttrib objects allocated in the
world. This will go up and down during normal operations.
*/
- get_slot()
C++ Interface: get_slot(RenderAttrib self)
- get_unique()
C++ Interface: get_unique(RenderAttrib self)
- /**
Returns the pointer to the unique RenderAttrib in the cache that is
equivalent to this one. This may be the same pointer as this object, or it
may be a different pointer; but it will be an equivalent object, and it
will be a shared pointer. This may be called from time to time to improve
cache benefits.
*/
- invertCompose()
C++ Interface: invert_compose(RenderAttrib self, const RenderAttrib other)
- /**
Returns a new RenderAttrib object that represents the composition of the
inverse of this attrib with the other attrib. In most cases, this is the
same as the other attrib; !a compose b produces b. Some kinds of
attributes, like a TextureTransform, for instance, might produce a new
result: !a compose b produces c.
This is similar to compose() except that the source attrib is inverted
first. This is used to compute the relative attribute for one node as
viewed from some other node, which is especially useful for transform-type
attributes.
*/
- invert_compose()
C++ Interface: invert_compose(RenderAttrib self, const RenderAttrib other)
- /**
Returns a new RenderAttrib object that represents the composition of the
inverse of this attrib with the other attrib. In most cases, this is the
same as the other attrib; !a compose b produces b. Some kinds of
attributes, like a TextureTransform, for instance, might produce a new
result: !a compose b produces c.
This is similar to compose() except that the source attrib is inverted
first. This is used to compute the relative attribute for one node as
viewed from some other node, which is especially useful for transform-type
attributes.
*/
- listAttribs()
C++ Interface: list_attribs(ostream out)
- /**
Lists all of the RenderAttribs 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.
*/
- list_attribs()
C++ Interface: list_attribs(ostream out)
- /**
Lists all of the RenderAttribs 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.
*/
- lowerAttribCanOverride()
C++ Interface: lower_attrib_can_override(RenderAttrib self)
- /**
Intended to be overridden by derived RenderAttrib types to specify how two
consecutive RenderAttrib objects of the same type interact.
This should return false if a RenderAttrib on a higher node will compose
into a RenderAttrib on a lower node that has a higher override value, or
true if the lower RenderAttrib will completely replace the state.
The default behavior is false: normally, a RenderAttrib in the graph cannot
completely override a RenderAttrib above it, regardless of its override
value–instead, the two attribs are composed. But for some kinds of
RenderAttribs, it is useful to allow this kind of override.
This method only handles the one special case of a lower RenderAttrib with
a higher override value. If the higher RenderAttrib has a higher override
value, it always completely overrides. And if both RenderAttribs have the
same override value, they are always composed.
*/
- lower_attrib_can_override()
C++ Interface: lower_attrib_can_override(RenderAttrib self)
- /**
Intended to be overridden by derived RenderAttrib types to specify how two
consecutive RenderAttrib objects of the same type interact.
This should return false if a RenderAttrib on a higher node will compose
into a RenderAttrib on a lower node that has a higher override value, or
true if the lower RenderAttrib will completely replace the state.
The default behavior is false: normally, a RenderAttrib in the graph cannot
completely override a RenderAttrib above it, regardless of its override
value–instead, the two attribs are composed. But for some kinds of
RenderAttribs, it is useful to allow this kind of override.
This method only handles the one special case of a lower RenderAttrib with
a higher override value. If the higher RenderAttrib has a higher override
value, it always completely overrides. And if both RenderAttribs have the
same override value, they are always composed.
*/
- slot
- validateAttribs()
C++ Interface: validate_attribs()
- /**
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 RenderAttrib objects).
*/