Capítulo 148 de 859

Chapter 148: SpotLightNode

Core Idea

Module for representing spot lights as nodes.

Key Concepts

  • colorNode : UniformNode.<Color>: Uniform node representing the light color.
  • coneCosNode : UniformNode.<float>: Uniform node representing the cone cosine.
  • cutoffDistanceNode : UniformNode.<float>: Uniform node representing the cutoff distance.
  • decayExponentNode : UniformNode.<float>: Uniform node representing the decay exponent.
  • penumbraCosNode : UniformNode.<float>: Uniform node representing the penumbra cosine.

Reference Tables

Constructor

Signature
new SpotLightNode( light : SpotLight )

Properties

PropertyDescription
.colorNode : UniformNode.<Color>Uniform node representing the light color.
.coneCosNode : UniformNode.<float>Uniform node representing the cone cosine.
.cutoffDistanceNode : UniformNode.<float>Uniform node representing the cutoff distance.
.decayExponentNode : UniformNode.<float>Uniform node representing the decay exponent.
.penumbraCosNode : UniformNode.<float>Uniform node representing the penumbra cosine.

Methods

MethodDescription
.getSpotAttenuation( builder : NodeBuilder, angleCosine : Node.<float> ) : Node.<float>Computes the spot attenuation for the given angle.
.update( frame : NodeFrame )Overwritten to updated spot light specific uniforms.

Key Takeaways

  1. SpotLightNode extends: EventDispatcher → Node → LightingNode → AnalyticLightNode
  2. Most relevant properties: colorNode, coneCosNode, cutoffDistanceNode, decayExponentNode.
  3. Key methods: getSpotAttenuation, update.

Connects To