panda3d.core.LightAttrib

class LightAttrib

Bases: RenderAttrib

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.

Inheritance diagram

Inheritance diagram of LightAttrib

static make() → RenderAttrib

The following is the new, more general interface to the LightAttrib.

Return type

RenderAttrib

static make(op: Operation, light: Light) → RenderAttrib

Constructs a new LightAttrib object that turns on (or off, according to op) the indicated light(s).

Deprecated: Use addOnLight() or addOffLight() instead.

Return type

RenderAttrib

static make(op: Operation, light1: Light, light2: Light) → RenderAttrib

Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).

Deprecated: Use addOnLight() or addOffLight() instead.

Return type

RenderAttrib

static make(op: Operation, light1: Light, light2: Light, light3: Light) → RenderAttrib

Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).

Deprecated: Use addOnLight() or addOffLight() instead.

Return type

RenderAttrib

static make(op: Operation, light1: Light, light2: Light, light3: Light, light4: Light) → RenderAttrib

Constructs a new LightAttrib object that turns on (or off, according to op) the indicate light(s).

Deprecated: Use addOnLight() or addOffLight() instead.

Return type

RenderAttrib

static makeDefault() → RenderAttrib

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

Return type

RenderAttrib

getOperation() → Operation

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 lights that were already on, and if O_remove, the lights here are removed from the set of lights that were on.

Deprecated: LightAttribs nowadays have a separate list of on_lights and

off_lights, so this method no longer makes sense. Query the lists independently.

Return type

Operation

getNumLights() → int

Returns the number of lights listed in the attribute.

Deprecated: LightAttribs nowadays have a separate list of on_lights and

off_lights, so this method no longer makes sense. Query the lists independently.

getLight(n: int) → Light

Returns the nth light listed in the attribute.

Deprecated: LightAttribs nowadays have a separate list of on_lights and

off_lights, so this method no longer makes sense. Query the lists independently.

Return type

Light

hasLight(light: Light) → bool

Returns true if the indicated light is listed in the attrib, false otherwise.

Deprecated: LightAttribs nowadays have a separate list of on_lights and

off_lights, so this method no longer makes sense. Query the lists independently.

addLight(light: Light) → RenderAttrib

Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights.

Deprecated: Use addOnLight() or addOffLight() instead.

Return type

RenderAttrib

removeLight(light: Light) → RenderAttrib

Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights.

Deprecated: Use removeOnLight() or removeOffLight() instead.

Return type

RenderAttrib

static makeAllOff() → RenderAttrib

Constructs a new LightAttrib object that turns off all lights (and hence disables lighting).

Return type

RenderAttrib

getNumOnLights() → size_t

Returns the number of lights that are turned on by the attribute.

Return type

size_t

getNumNonAmbientLights() → size_t

Returns the number of non-ambient lights that are turned on by this attribute.

Return type

size_t

getOnLight(n: size_t) → NodePath

Returns the nth light turned on by the attribute, sorted in render order.

Return type

NodePath

hasOnLight(light: NodePath) → bool

Returns true if the indicated light is turned on by the attrib, false otherwise.

hasAnyOnLight() → bool

Returns true if any light is turned on by the attrib, false otherwise.

getNumOffLights() → size_t

Returns the number of lights that are turned off by the attribute.

Return type

size_t

getOffLight(n: size_t) → NodePath

Returns the nth light turned off by the attribute, sorted in arbitrary (pointer) order.

Return type

NodePath

hasOffLight(light: NodePath) → bool

Returns true if the indicated light is turned off by the attrib, false otherwise.

hasAllOff() → bool

Returns true if this attrib turns off all lights (although it may also turn some on).

isIdentity() → bool

Returns true if this is an identity attrib: it does not change the set of lights in use.

addOnLight(light: NodePath) → RenderAttrib

Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights turned on by this attrib.

Return type

RenderAttrib

removeOnLight(light: NodePath) → RenderAttrib

Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights turned on by this attrib.

Return type

RenderAttrib

addOffLight(light: NodePath) → RenderAttrib

Returns a new LightAttrib, just like this one, but with the indicated light added to the list of lights turned off by this attrib.

Return type

RenderAttrib

removeOffLight(light: NodePath) → RenderAttrib

Returns a new LightAttrib, just like this one, but with the indicated light removed from the list of lights turned off by this attrib.

Return type

RenderAttrib

getMostImportantLight() → NodePath

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.

Return type

NodePath

getAmbientContribution() → LColor

Returns the total contribution of all the ambient lights.

Return type

LColor

static getClassSlot() → int
static getClassType() → TypeHandle
Return type

TypeHandle

getOnLights() → list
getOffLights() → list
property on_lights

Returns the nth light turned on by the attribute, sorted in render order.

Return type

Sequence[NodePath]

property off_lights

Returns the nth light turned off by the attribute, sorted in arbitrary (pointer) order.

Return type

Sequence[NodePath]

property class_slot
Return type

int

enum Operation

This is the old, deprecated interface to LightAttrib. Do not use any of these methods for new code; these methods will be removed soon.

enumerator O_set = 0
enumerator O_add = 1
enumerator O_remove = 2