lightspunctual

package
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: BSD-2-Clause Imports: 3 Imported by: 1

Documentation

Overview

Package lightspunctual defines three "punctual" light types: directional, point and spot. Punctual lights are defined as parameterized, infinitely small points that emit light in well-defined directions and intensities.

Index

Constants

View Source
const (
	// TypeDirectional lights act as though they are infinitely far away and emit light in the direction of the local -z axis.
	TypeDirectional = "directional"
	// TypePoint lights emit light in all directions from their position in space.
	TypePoint = "point"
	// TypeSpot lights emit light in a cone in the direction of the local -z axis.
	TypeSpot = "spot"
)
View Source
const (
	// ExtensionName defines the KHR_lights_punctual unique key.
	ExtensionName = "KHR_lights_punctual"
)

Variables

This section is empty.

Functions

func Unmarshal

func Unmarshal(data []byte) (any, error)

Unmarshal decodes the json data into the correct type.

Types

type Light

type Light struct {
	Type      string      `json:"type"`
	Name      string      `json:"name,omitempty"`
	Color     *[3]float64 `json:"color,omitempty"`
	Intensity *float64    `json:"intensity,omitempty"`
	Range     *float64    `json:"range,omitempty"`
	Spot      *Spot       `json:"spot,omitempty"`
}

Light defines a directional, point, or spot light. When a light's type is spot, the spot property on the light is required.

func (*Light) ColorOrDefault

func (l *Light) ColorOrDefault() [3]float64

ColorOrDefault returns the color if it is not nil, else return the default one.

func (*Light) IntensityOrDefault

func (l *Light) IntensityOrDefault() float64

IntensityOrDefault returns the itensity if it is not nil, else return the default one.

func (*Light) UnmarshalJSON

func (l *Light) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal the light with the correct default values.

type LightIndex

type LightIndex int

LightIndex is the id of the light referenced by this node.

type Lights

type Lights []*Light

Lights defines a list of Lights.

type Spot

type Spot struct {
	InnerConeAngle float64  `json:"innerConeAngle,omitempty"`
	OuterConeAngle *float64 `json:"outerConeAngle,omitempty"`
}

Spot defines the spot cone.

func (*Spot) OuterConeAngleOrDefault

func (s *Spot) OuterConeAngleOrDefault() float64

OuterConeAngleOrDefault returns the OuterConeAngle if it is not nil, else return the default one.

func (*Spot) UnmarshalJSON

func (s *Spot) UnmarshalJSON(data []byte) error

UnmarshalJSON unmarshal the spot with the correct default values.

Jump to

Keyboard shortcuts

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