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 ¶
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" )
const (
// ExtensionName defines the KHR_lights_punctual unique key.
ExtensionName = "KHR_lights_punctual"
)
Variables ¶
This section is empty.
Functions ¶
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 ¶
ColorOrDefault returns the color if it is not nil, else return the default one.
func (*Light) IntensityOrDefault ¶
IntensityOrDefault returns the itensity if it is not nil, else return the default one.
func (*Light) UnmarshalJSON ¶
UnmarshalJSON unmarshal the light with the correct default values.
type Spot ¶
type Spot struct { InnerConeAngle float32 `json:"innerConeAngle,omitempty"` OuterConeAngle *float32 `json:"outerConeAngle,omitempty"` }
Spot defines the spot cone.
func (*Spot) OuterConeAngleOrDefault ¶
OuterConeAngleOrDefault returns the OuterConeAngle if it is not nil, else return the default one.
func (*Spot) UnmarshalJSON ¶
UnmarshalJSON unmarshal the spot with the correct default values.