38 lines
731 B
Go
38 lines
731 B
Go
package light
|
|
|
|
import (
|
|
"zworld/engine/object"
|
|
"zworld/engine/render/uniform"
|
|
"zworld/engine/renderapi/color"
|
|
"zworld/plugins/math/mat4"
|
|
"zworld/plugins/math/vec4"
|
|
)
|
|
|
|
type ShadowmapStore interface {
|
|
Lookup(T, int) (int, bool)
|
|
}
|
|
|
|
type T interface {
|
|
object.Component
|
|
|
|
Type() Type
|
|
CastShadows() bool
|
|
Shadowmaps() int
|
|
LightData(ShadowmapStore) uniform.Light
|
|
ShadowProjection(mapIndex int) uniform.Camera
|
|
}
|
|
|
|
// Descriptor holds rendering information for lights
|
|
type Descriptor struct {
|
|
Projection mat4.T // Light projection matrix
|
|
View mat4.T // Light view matrix
|
|
ViewProj mat4.T
|
|
Color color.T
|
|
Position vec4.T
|
|
Type Type
|
|
Range float32
|
|
Intensity float32
|
|
Shadows uint32
|
|
Index int
|
|
}
|