lightspuntual

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2022 License: BSD-2-Clause Imports: 3 Imported by: 3

Documentation

Overview

Package lightspuntual 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) (interface{}, 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]float32 `json:"color,omitempty" validate:"omitempty,dive,gte=0,lte=1"`
	Intensity *float32    `json:"intensity,omitempty"`
	Range     *float32    `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]float32

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

func (*Light) IntensityOrDefault

func (l *Light) IntensityOrDefault() float32

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 uint32

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 float32  `json:"innerConeAngle,omitempty"`
	OuterConeAngle *float32 `json:"outerConeAngle,omitempty"`
}

Spot defines the spot cone.

func (*Spot) OuterConeAngleOrDefault

func (s *Spot) OuterConeAngleOrDefault() float32

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