Panda3D
|
Indicates which set of lights should be considered "on" to illuminate geometry at this level and below. More...
Public Types | |
enum | Operation { OSet = 0, OAdd = 1, ORemove = 2 } |
enum | PandaCompareFunc { MNone = 0, MNever = 1, MLess = 2, MEqual = 3, MLessEqual = 4, MGreater = 5, MNotEqual = 6, MGreaterEqual = 7, MAlways = 8 } |
enum | TexGenMode { MOff = 0, MEyeSphereMap = 1, MWorldCubeMap = 2, MEyeCubeMap = 3, MWorldNormal = 4, MEyeNormal = 5, MWorldPosition = 6, MUnused = 7, MEyePosition = 8, MPointSprite = 9, MLightVector = 10, MConstant = 11 } |
Public Member Functions | |
RenderAttrib const | addLight (Light light) |
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights. | |
RenderAttrib const | addOffLight (NodePath const light) |
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights turned off by this attrib. | |
RenderAttrib const | addOnLight (NodePath const light) |
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights turned on by this attrib. | |
int | compareTo (RenderAttrib const 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. | |
RenderAttrib const | compose (RenderAttrib const other) |
Returns a new RenderAttrib object that represents the composition of this attrib with the other attrib. | |
string | encodeToBamStream () |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string. | |
bool | encodeToBamStream (basic_stringchar data, BamWriter writer) |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
bool | encodeToBamStream (basic_stringchar data) |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string. | |
LightAttrib const | filterToMax (int max_lights) |
Returns a new LightAttrib, very much like this one, but with the number of on_lights reduced to be no more than max_lights. | |
UpdateSeq | getBamModified () |
Returns the current bam_modified counter. | |
Light | getLight (int n) |
Returns the nth light listed in the attribute. | |
NodePath | getMostImportantLight () |
Returns the most important light (that is, the light with the highest priority) in the LightAttrib, excluding any ambient lights. | |
int | getNumLights () |
Returns the number of lights listed in the attribute. | |
int | getNumOffLights () |
Returns the number of lights that are turned off by the attribute. | |
int | getNumOnLights () |
Returns the number of lights that are turned on by the attribute. | |
NodePath | getOffLight (int n) |
Returns the nth light turned off by the attribute, sorted in arbitrary (pointer) order. | |
list | getOffLights () |
NodePath | getOnLight (int n) |
Returns the nth light turned on by the attribute, sorted in render order. | |
list | getOnLights () |
Operation | getOperation () |
Returns the basic operation type of the LightAttrib. | |
int | getRefCount () |
Returns the current reference count. | |
int | getSlot () |
TypeHandle | getType () |
int | getTypeIndex () |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. | |
RenderAttrib const | getUnique () |
Returns the pointer to the unique RenderAttrib in the cache that is equivalent to this one. | |
bool | hasAllOff () |
Returns true if this attrib turns off all lights (although it may also turn some on). | |
bool | hasLight (Light light) |
Returns true if the indicated light is listed in the attrib, false otherwise. | |
bool | hasOffLight (NodePath const light) |
Returns true if the indicated light is turned off by the attrib, false otherwise. | |
bool | hasOnLight (NodePath const light) |
Returns true if the indicated light is turned on by the attrib, false otherwise. | |
RenderAttrib const | invertCompose (RenderAttrib const other) |
Returns a new RenderAttrib object that represents the composition of the inverse of this attrib with the other attrib. | |
bool | isExactType (TypeHandle handle) |
Returns true if the current object is the indicated type exactly. | |
bool | isIdentity () |
Returns true if this is an identity attrib: it does not change the set of lights in use. | |
bool | isOfType (TypeHandle handle) |
Returns true if the current object is or derives from the indicated type. | |
bool | lowerAttribCanOverride () |
Intended to be overridden by derived RenderAttrib types to specify how two consecutive RenderAttrib objects of the same type interact. | |
markBamModified () | |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams. | |
output (ostream out) | |
PyObject | reduce (PyObject self) |
This special Python method is implement to provide support for the pickle module. | |
PyObject | reducePersist (PyObject self, PyObject pickler) |
This special Python method is implement to provide support for the pickle module. | |
ref () | |
Explicitly increments the reference count. | |
RenderAttrib const | removeLight (Light light) |
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights. | |
RenderAttrib const | removeOffLight (NodePath const light) |
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights turned off by this attrib. | |
RenderAttrib const | removeOnLight (NodePath const light) |
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights turned on by this attrib. | |
bool | testRefCountIntegrity () |
Does some easy checks to make sure that the reference count isn't completely bogus. | |
bool | testRefCountNonzero () |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. | |
bool | unref () |
Explicitly decrements the reference count. | |
write (ostream out, int indent_level) | |
Static Public Member Functions | |
static TypedWritableReferenceCount | decodeFromBamStream (string data, BamReader reader) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string. | |
static TypedWritableReferenceCount | decodeFromBamStream (string data) |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string. | |
static int | getClassSlot () |
static TypeHandle | getClassType () |
static int | getNumAttribs () |
Returns the total number of unique RenderAttrib objects allocated in the world. | |
static | listAttribs (ostream out) |
Lists all of the RenderAttribs in the cache to the output stream, one per line. | |
static RenderAttrib const | make (Operation op, Light light) |
Constructs a new LightAttrib object that turns on (or off, according to op) the indicated light(s). | |
static RenderAttrib const | make () |
Constructs a new LightAttrib object that does nothing. | |
static RenderAttrib const | make (Operation op, Light light1, Light light2, Light light3) |
Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s). | |
static RenderAttrib const | make (Operation op, Light light1, Light light2, Light light3, Light light4) |
Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s). | |
static RenderAttrib const | make (Operation op, Light light1, Light light2) |
Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s). | |
static RenderAttrib const | makeAllOff () |
Constructs a new LightAttrib object that turns off all lights (and hence disables lighting). | |
static RenderAttrib const | makeDefault () |
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attributes of this type ought to be. | |
static bool | validateAttribs () |
Ensures that the cache is still stored in sorted order. |
Indicates which set of lights should be considered "on" to illuminate geometry at this level and below.
A LightAttrib can either add lights or remove lights from the total set of "on" lights.
enum Operation |
enum PandaCompareFunc [inherited] |
enum TexGenMode [inherited] |
RenderAttrib const addLight | ( | Light | light | ) |
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights.
This method is now deprecated. Use add_on_light() or add_off_light() instead.
RenderAttrib const addOffLight | ( | NodePath const | light | ) |
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights turned off by this attrib.
RenderAttrib const addOnLight | ( | NodePath const | light | ) |
Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights turned on by this attrib.
int compareTo | ( | RenderAttrib const | other | ) | [inherited] |
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.
RenderAttrib const compose | ( | RenderAttrib const | other | ) | [inherited] |
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.
static TypedWritableReferenceCount decodeFromBamStream | ( | string | data, |
BamReader | reader | ||
) | [static, inherited] |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
Returns NULL on error.
This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.
static TypedWritableReferenceCount decodeFromBamStream | ( | string | data | ) | [static, inherited] |
Reads the string created by a previous call to encode_to_bam_stream(), and extracts and returns the single object on that string.
Returns NULL on error.
This method is intended to replace decode_raw_from_bam_stream() when you know the stream in question returns an object of type TypedWritableReferenceCount, allowing for easier reference count management. Note that the caller is still responsible for maintaining the reference count on the return value.
string encodeToBamStream | ( | ) | [inherited] |
Converts the TypedWritable object into a single stream of data using a BamWriter, and returns that data as a string string.
Returns empty string on failure.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
bool encodeToBamStream | ( | basic_stringchar | data, |
BamWriter | writer | ||
) | [inherited] |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
Returns true on success, false on failure.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
bool encodeToBamStream | ( | basic_stringchar | data | ) | [inherited] |
Converts the TypedWritable object into a single stream of data using a BamWriter, and stores that data in the indicated string.
Returns true on success, false on failure.
This is a convenience method particularly useful for cases when you are only serializing a single object. If you have many objects to process, it is more efficient to use the same BamWriter to serialize all of them together.
LightAttrib const filterToMax | ( | int | max_lights | ) |
Returns a new LightAttrib, very much like this one, but with the number of on_lights reduced to be no more than max_lights.
The number of off_lights in the new LightAttrib is undefined.
The number of AmbientLights is not included in the count. All AmbientLights in the original attrib are always included in the result, regardless of the value of max_lights.
UpdateSeq getBamModified | ( | ) | [inherited] |
Returns the current bam_modified counter.
This counter is normally incremented automatically whenever the object is modified.
static int getClassSlot | ( | ) | [static] |
static TypeHandle getClassType | ( | ) | [static] |
Reimplemented from RenderAttrib.
Returns the nth light listed in the attribute.
This method is now deprecated. LightAttribs nowadays have a separate list of on_lights and off_lights, so this method doesn't make sense. Query the lists independently.
NodePath getMostImportantLight | ( | ) |
Returns the most important light (that is, the light with the highest priority) in the LightAttrib, excluding any ambient lights.
Returns an empty NodePath if no non-ambient lights are found.
static int getNumAttribs | ( | ) | [static, inherited] |
Returns the total number of unique RenderAttrib objects allocated in the world.
This will go up and down during normal operations.
int getNumLights | ( | ) |
Returns the number of lights listed in the attribute.
This method is now deprecated. LightAttribs nowadays have a separate list of on_lights and off_lights, so this method doesn't make sense. Query the lists independently.
int getNumOffLights | ( | ) |
Returns the number of lights that are turned off by the attribute.
int getNumOnLights | ( | ) |
Returns the number of lights that are turned on by the attribute.
Returns the nth light turned off by the attribute, sorted in arbitrary (pointer) order.
list getOffLights | ( | ) |
Returns the nth light turned on by the attribute, sorted in render order.
list getOnLights | ( | ) |
Operation getOperation | ( | ) |
Returns the basic operation type of the LightAttrib.
If this is O_set, the lights listed here completely replace any lights that were already on. If this is O_add, the lights here are added to the set of of lights that were already on, and if O_remove, the lights here are removed from the set of lights that were on.
This method is now deprecated. LightAttribs nowadays have a separate list of on_lights and off_lights, so this method doesn't make sense. Query the lists independently.
int getRefCount | ( | ) | [inherited] |
Returns the current reference count.
int getSlot | ( | ) | [inherited] |
TypeHandle getType | ( | ) | [inherited] |
Reimplemented in AnimChannelBase.
int getTypeIndex | ( | ) | [inherited] |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type.
This is equivalent to get_type().get_index().
RenderAttrib const getUnique | ( | ) | [inherited] |
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.
bool hasAllOff | ( | ) |
Returns true if this attrib turns off all lights (although it may also turn some on).
bool hasLight | ( | Light | light | ) |
Returns true if the indicated light is listed in the attrib, false otherwise.
This method is now deprecated. LightAttribs nowadays have a separate list of on_lights and off_lights, so this method doesn't make sense. Query the lists independently.
bool hasOffLight | ( | NodePath const | light | ) |
Returns true if the indicated light is turned off by the attrib, false otherwise.
bool hasOnLight | ( | NodePath const | light | ) |
Returns true if the indicated light is turned on by the attrib, false otherwise.
RenderAttrib const invertCompose | ( | RenderAttrib const | other | ) | [inherited] |
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.
bool isExactType | ( | TypeHandle | handle | ) | [inherited] |
Returns true if the current object is the indicated type exactly.
bool isIdentity | ( | ) |
Returns true if this is an identity attrib: it does not change the set of lights in use.
bool isOfType | ( | TypeHandle | handle | ) | [inherited] |
Returns true if the current object is or derives from the indicated type.
static listAttribs | ( | ostream | out | ) | [static, inherited] |
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.
bool lowerAttribCanOverride | ( | ) | [inherited] |
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.
static RenderAttrib const make | ( | Operation | op, |
Light | light | ||
) | [static] |
Constructs a new LightAttrib object that turns on (or off, according to op) the indicated light(s).
This method is now deprecated. Use add_on_light() or add_off_light() instead.
static RenderAttrib const make | ( | Operation | op, |
Light | light1, | ||
Light | light2, | ||
Light | light3 | ||
) | [static] |
Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).
This method is now deprecated. Use add_on_light() or add_off_light() instead.
static RenderAttrib const make | ( | Operation | op, |
Light | light1, | ||
Light | light2 | ||
) | [static] |
Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).
This method is now deprecated. Use add_on_light() or add_off_light() instead.
static RenderAttrib const make | ( | Operation | op, |
Light | light1, | ||
Light | light2, | ||
Light | light3, | ||
Light | light4 | ||
) | [static] |
Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).
This method is now deprecated. Use add_on_light() or add_off_light() instead.
static RenderAttrib const make | ( | ) | [static] |
Constructs a new LightAttrib object that does nothing.
static RenderAttrib const makeAllOff | ( | ) | [static] |
Constructs a new LightAttrib object that turns off all lights (and hence disables lighting).
static RenderAttrib const makeDefault | ( | ) | [static] |
Returns a RenderAttrib that corresponds to whatever the standard default properties for render attributes of this type ought to be.
markBamModified | ( | ) | [inherited] |
Increments the bam_modified counter, so that this object will be invalidated and retransmitted on any open bam streams.
This should normally not need to be called by user code; it should be called internally when the object has been changed in a way that legitimately requires its retransmission to any connected clients.
output | ( | ostream | out | ) | [inherited] |
PyObject reduce | ( | PyObject | self | ) | [inherited] |
This special Python method is implement to provide support for the pickle module.
This hooks into the native pickle and cPickle modules, but it cannot properly handle self-referential BAM objects.
PyObject reducePersist | ( | PyObject | self, |
PyObject | pickler | ||
) | [inherited] |
This special Python method is implement to provide support for the pickle module.
This is similar to __reduce__, but it provides additional support for the missing persistent-state object needed to properly support self-referential BAM objects written to the pickle stream. This hooks into the pickle and cPickle modules implemented in direct/src/stdpy.
ref | ( | ) | [inherited] |
Explicitly increments the reference count.
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
RenderAttrib const removeLight | ( | Light | light | ) |
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights.
This method is now deprecated. Use remove_on_light() or remove_off_light() instead.
RenderAttrib const removeOffLight | ( | NodePath const | light | ) |
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights turned off by this attrib.
RenderAttrib const removeOnLight | ( | NodePath const | light | ) |
Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights turned on by this attrib.
bool testRefCountIntegrity | ( | ) | [inherited] |
Does some easy checks to make sure that the reference count isn't completely bogus.
Returns true if ok, false otherwise.
Reimplemented in NodeReferenceCount, CachedTypedWritableReferenceCount, and NodeCachedReferenceCount.
bool testRefCountNonzero | ( | ) | [inherited] |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
Returns true if ok, false otherwise.
bool unref | ( | ) | [inherited] |
Explicitly decrements the reference count.
Note that the object will not be implicitly deleted by unref() simply because the reference count drops to zero. (Having a member function delete itself is problematic.) However, see the helper function unref_delete().
User code should avoid using ref() and unref() directly, which can result in missed reference counts. Instead, let a PointerTo object manage the reference counting automatically.
This function is const, even though it changes the object, because generally fiddling with an object's reference count isn't considered part of fiddling with the object. An object might be const in other ways, but we still need to accurately count the number of references to it.
The return value is true if the new reference count is nonzero, false if it is zero.
Reimplemented in GeomVertexArrayFormat, and GeomVertexFormat.
static bool validateAttribs | ( | ) | [static, inherited] |
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).