forked from krux02/assimp
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Light.go
76 lines (58 loc) · 1.59 KB
/
Light.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package assimp
//#cgo pkg-config: assimp
//#include <assimp/light.h>
import "C"
import "math"
type LightSourceType C.enum_aiLightSourceType
const (
LightSource_Undefined LightSourceType = C.aiLightSource_UNDEFINED
LightSource_Directional LightSourceType = C.aiLightSource_DIRECTIONAL
LightSource_Point LightSourceType = C.aiLightSource_POINT
LightSource_Spot LightSourceType = C.aiLightSource_SPOT
)
type Light C.struct_aiLight
func (l *Light) Name() string {
return C.GoStringN(&l.mName.data[0], C.int(l.mName.length))
}
func (l *Light) Type() LightSourceType {
return LightSourceType(l.mType)
}
func (l *Light) Position() Vector3 {
return Vector3(l.mPosition)
}
func (l *Light) Direction() Vector3 {
return Vector3(l.mDirection)
}
func (l *Light) AttenuationConstant() float32 {
return float32(l.mAttenuationConstant)
}
func (l *Light) AttenuationLinear() float32 {
return float32(l.mAttenuationLinear)
}
func (l *Light) AttenuationQuadratic() float32 {
return float32(l.mAttenuationQuadratic)
}
func (l *Light) ColorDiffuse() Color3 {
return Color3(l.mColorDiffuse)
}
func (l *Light) ColorSpecular() Color3 {
return Color3(l.mColorSpecular)
}
func (l *Light) ColorAmbient() Color3 {
return Color3(l.mColorAmbient)
}
func (l *Light) AngleInnerCone() float32 {
return float32(l.mAngleInnerCone)
}
func (l *Light) AngleOuterCone() float32 {
return float32(l.mAngleOuterCone)
}
func NewLight() *Light {
l := new(Light)
l.mAttenuationConstant = 0
l.mAttenuationLinear = 1
l.mAttenuationQuadratic = 0
l.mAngleInnerCone = math.Pi * 2
l.mAngleOuterCone = math.Pi * 2
return l
}