light

package
v0.0.0-...-b8d9494 Latest Latest
Warning

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

Go to latest
Published: May 13, 2021 License: BSD-3-Clause, BSD-2-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package light contains common light types which can be add to a 3D scene to illuminate it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Ambient

type Ambient struct {
	core.Node // Embedded node
	// contains filtered or unexported fields
}

Ambient represents an ambient light

func NewAmbient

func NewAmbient(color *math32.Color, intensity float32) *Ambient

NewAmbient returns a pointer to a new ambient color with the specified color and intensity

func (*Ambient) Color

func (la *Ambient) Color() math32.Color

Color returns the current color of this light

func (*Ambient) Intensity

func (la *Ambient) Intensity() float32

Intensity returns the current intensity of this light

func (*Ambient) RenderSetup

func (la *Ambient) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo, idx int)

RenderSetup is called by the engine before rendering the scene

func (*Ambient) SetColor

func (la *Ambient) SetColor(color *math32.Color)

SetColor sets the color of this light

func (*Ambient) SetIntensity

func (la *Ambient) SetIntensity(intensity float32)

SetIntensity sets the intensity of this light

type Directional

type Directional struct {
	core.Node // Embedded node
	// contains filtered or unexported fields
}

Directional represents a directional, positionless light

func NewDirectional

func NewDirectional(color *math32.Color, intensity float32) *Directional

NewDirectional creates and returns a pointer of a new directional light the specified color and intensity.

func (*Directional) Color

func (ld *Directional) Color() math32.Color

Color returns the current color of this light

func (*Directional) Intensity

func (ld *Directional) Intensity() float32

Intensity returns the current intensity of this light

func (*Directional) RenderSetup

func (ld *Directional) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo, idx int)

RenderSetup is called by the engine before rendering the scene

func (*Directional) SetColor

func (ld *Directional) SetColor(color *math32.Color)

SetColor sets the color of this light

func (*Directional) SetIntensity

func (ld *Directional) SetIntensity(intensity float32)

SetIntensity sets the intensity of this light

type ILight

type ILight interface {
	RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo, idx int)
}

ILight is the interface that must be implemented for all light types.

type Point

type Point struct {
	core.Node // Embedded node
	// contains filtered or unexported fields
}

Point is an omnidirectional light source

func NewPoint

func NewPoint(color *math32.Color, intensity float32) *Point

NewPoint creates and returns a point light with the specified color and intensity

func (*Point) Color

func (lp *Point) Color() math32.Color

Color returns the current color of this light

func (*Point) Intensity

func (lp *Point) Intensity() float32

Intensity returns the current intensity of this light

func (*Point) LinearDecay

func (lp *Point) LinearDecay() float32

LinearDecay returns the current linear decay factor

func (*Point) QuadraticDecay

func (lp *Point) QuadraticDecay() float32

QuadraticDecay returns the current quadratic decay factor

func (*Point) RenderSetup

func (lp *Point) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo, idx int)

RenderSetup is called by the engine before rendering the scene

func (*Point) SetColor

func (lp *Point) SetColor(color *math32.Color)

SetColor sets the color of this light

func (*Point) SetIntensity

func (lp *Point) SetIntensity(intensity float32)

SetIntensity sets the intensity of this light

func (*Point) SetLinearDecay

func (lp *Point) SetLinearDecay(decay float32)

SetLinearDecay sets the linear decay factor as a function of the distance

func (*Point) SetQuadraticDecay

func (lp *Point) SetQuadraticDecay(decay float32)

SetQuadraticDecay sets the quadratic decay factor as a function of the distance

type Spot

type Spot struct {
	core.Node // Embedded node
	// contains filtered or unexported fields
}

Spot represents a spotlight

func NewSpot

func NewSpot(color *math32.Color, intensity float32) *Spot

NewSpot creates and returns a spot light with the specified color and intensity

func (*Spot) AngularDecay

func (l *Spot) AngularDecay() float32

AngularDecay returns the current angular decay exponent

func (*Spot) Color

func (l *Spot) Color() math32.Color

Color returns the current color of this light

func (*Spot) CutoffAngle

func (l *Spot) CutoffAngle() float32

CutoffAngle returns the current cutoff angle in degrees from 0 to 90

func (*Spot) Intensity

func (l *Spot) Intensity() float32

Intensity returns the current intensity of this light

func (*Spot) LinearDecay

func (l *Spot) LinearDecay() float32

LinearDecay returns the current linear decay factor

func (*Spot) QuadraticDecay

func (l *Spot) QuadraticDecay() float32

QuadraticDecay returns the current quadratic decay factor

func (*Spot) RenderSetup

func (l *Spot) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo, idx int)

RenderSetup is called by the engine before rendering the scene

func (*Spot) SetAngularDecay

func (l *Spot) SetAngularDecay(decay float32)

SetAngularDecay sets the angular decay exponent

func (*Spot) SetColor

func (l *Spot) SetColor(color *math32.Color)

SetColor sets the color of this light

func (*Spot) SetCutoffAngle

func (l *Spot) SetCutoffAngle(angle float32)

SetCutoffAngle sets the cutoff angle in degrees from 0 to 90

func (*Spot) SetIntensity

func (l *Spot) SetIntensity(intensity float32)

SetIntensity sets the intensity of this light

func (*Spot) SetLinearDecay

func (l *Spot) SetLinearDecay(decay float32)

SetLinearDecay sets the linear decay factor as a function of the distance

func (*Spot) SetQuadraticDecay

func (l *Spot) SetQuadraticDecay(decay float32)

SetQuadraticDecay sets the quadratic decay factor as a function of the distance

Jump to

Keyboard shortcuts

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