Panda3D
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Light Class Reference

The abstract interface to all kinds of lights. More...

Inheritance diagram for Light:
LightLensNode LightNode DirectionalLight PointLight RectangleLight Spotlight AmbientLight SphereLight

Public Member Functions

PandaNode asNode ()
 
const LVecBase3 getAttenuation ()
 Returns the terms of the attenuation equation for the light. More...
 
int getClassPriority ()
 
const LColor getColor ()
 Returns the basic color of the light. More...
 
float getColorTemperature ()
 Returns the basic color temperature of the light, assuming has_color_temperature() returns true. More...
 
float getExponent ()
 For spotlights, returns the exponent that controls the amount of light falloff from the center of the spotlight. More...
 
int getPriority ()
 Returns the priority associated with this light. More...
 
const LColor getSpecularColor ()
 Returns the color of specular highlights generated by the light. More...
 
bool hasColorTemperature ()
 Returns true if the color was specified as a temperature in kelvins, and get_color_temperature is defined. More...
 
bool isAmbientLight ()
 Returns true if this is an AmbientLight, false if it is some other kind of light. More...
 
 setColor (const LColor color)
 Sets the basic color of the light. More...
 
 setColorTemperature (float temperature)
 Sets the color temperature of the light in kelvins. More...
 
 setPriority (int priority)
 Changes the relative importance of this light relative to the other lights that are applied simultaneously. More...
 

Static Public Member Functions

static TypeHandle getClassType ()
 

Public Attributes

const LColor color
 Returns the basic color of the light. More...
 
float color_temperature
 Returns the basic color temperature of the light, assuming has_color_temperature() returns true. More...
 
int priority
 Returns the priority associated with this light. More...
 

Detailed Description

The abstract interface to all kinds of lights.

The actual light objects also inherit from PandaNode, and can therefore be added to the scene graph at some arbitrary point to define the coordinate system of effect.

Member Function Documentation

◆ asNode()

PandaNode asNode ( )

◆ getAttenuation()

const LVecBase3 getAttenuation ( )

Returns the terms of the attenuation equation for the light.

These are, in order, the constant, linear, and quadratic terms based on the distance from the point to the vertex.

◆ getClassPriority()

int getClassPriority ( )

◆ getClassType()

static TypeHandle getClassType ( )
static

◆ getColor()

const LColor getColor ( )

Returns the basic color of the light.

◆ getColorTemperature()

float getColorTemperature ( )

Returns the basic color temperature of the light, assuming has_color_temperature() returns true.

Since
1.10.0

◆ getExponent()

float getExponent ( )

For spotlights, returns the exponent that controls the amount of light falloff from the center of the spotlight.

For other kinds of lights, returns 0.

◆ getPriority()

int getPriority ( )

Returns the priority associated with this light.

See set_priority().

◆ getSpecularColor()

const LColor getSpecularColor ( )

Returns the color of specular highlights generated by the light.

This value is meaningless for ambient lights.

◆ hasColorTemperature()

bool hasColorTemperature ( )

Returns true if the color was specified as a temperature in kelvins, and get_color_temperature is defined.

Since
1.10.0

◆ isAmbientLight()

bool isAmbientLight ( )

Returns true if this is an AmbientLight, false if it is some other kind of light.

◆ setColor()

setColor ( const LColor  color)

Sets the basic color of the light.

◆ setColorTemperature()

setColorTemperature ( float  temperature)

Sets the color temperature of the light in kelvins.

This will recalculate the light's color.

The default value is 6500 K, corresponding to a perfectly white light assuming a D65 white point.

Since
1.10.0

◆ setPriority()

setPriority ( int  priority)

Changes the relative importance of this light relative to the other lights that are applied simultaneously.

The priority number is used to decide which of the requested lights are to be selected for rendering when more lights are requested than the hardware will support. The highest-priority n lights are selected for rendering.

This is similar to TextureStage::set_priority().

Member Data Documentation

◆ color

const LColor color

Returns the basic color of the light.

◆ color_temperature

float color_temperature

Returns the basic color temperature of the light, assuming has_color_temperature() returns true.

Since
1.10.0

◆ priority

int priority

Returns the priority associated with this light.

See set_priority().