light

package
v0.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int
const (
	AmbientKind Kind = iota
	PointKind
	DirectionalKind
)

type Light

type Light struct {
	transform.Transform
	Kind  Kind
	Point point.Point

	// Color is the color of the light.
	Color color.Color

	// Intensity should be a value between 0.0 and 1.0 that determines the
	// ammount of light contributed by this light. An intensity of 0.0
	// effectively turns the light off while a value of 1.0 will add the
	// value of the Color field to the face being lit.
	Intensity intensity.Intensity

	Normal  point.Point
	Enabled bool
}

Light object holds the attributes and transformation of a light source.

func AmbientLight

func AmbientLight() Light

AmbientLight is a light that emits a constant amount of light everywhere at once. Transformation of the light has no effect.

func DefaultLights

func DefaultLights() []*Light

DefaultLights are a set of lights to setup a standard Hollywood-style 3-part lighting

func DirectionalLight

func DirectionalLight() Light

DirectionalLight is a light that emits light in parallel lines, not eminating from any single point. For these lights, only the Normal property is used to determine the direction of the light. This may also be transformed.

func Of

func Of(kind Kind) (l Light)

func PointLight

func PointLight() Light

PointLight is a Light that emits light in all directions from a single point. The Point property determines the location of the point light. Note, though, that it may also be moved through the transformation of the light. A point light is also called an "Omni" light in some 3D editors.

func (Light) IsEnabled

func (l Light) IsEnabled() bool

func (Light) ShaderData

func (l Light) ShaderData(model matrix.Matrix) (lsd ShaderData)

ShaderData pre-computes values necessary for shading.

type ShaderData

type ShaderData struct {
	Kind      Kind
	Point     point.Point
	Color     color.Color
	Intensity intensity.Intensity
	Normal    point.Point
}

ShaderData stores pre-computed values necessary for shading with a certain light.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL