-
Notifications
You must be signed in to change notification settings - Fork 0
/
hud_display.go
81 lines (69 loc) · 1.49 KB
/
hud_display.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
77
78
79
80
81
package opengl
import (
uuid "github.com/satori/go.uuid"
"github.com/xmn-services/buckets-network/domain/memory/worlds/viewports"
)
type hudDisplay struct {
id *uuid.UUID
index uint
viewport viewports.Viewport
cam Camera
mat Material
}
func createHudDisplay(
id *uuid.UUID,
index uint,
viewport viewports.Viewport,
cam Camera,
) HudDisplay {
return createHudDisplayInternally(id, index, viewport, cam, nil)
}
func createHudDisplayWithMaterial(
id *uuid.UUID,
index uint,
viewport viewports.Viewport,
cam Camera,
mat Material,
) HudDisplay {
return createHudDisplayInternally(id, index, viewport, cam, mat)
}
func createHudDisplayInternally(
id *uuid.UUID,
index uint,
viewport viewports.Viewport,
cam Camera,
mat Material,
) HudDisplay {
out := hudDisplay{
id: id,
index: index,
viewport: viewport,
cam: cam,
mat: mat,
}
return &out
}
// ID returns the id
func (obj *hudDisplay) ID() *uuid.UUID {
return obj.id
}
// Index returns the index
func (obj *hudDisplay) Index() uint {
return obj.index
}
// Viewport returns the viewport
func (obj *hudDisplay) Viewport() viewports.Viewport {
return obj.viewport
}
// Camera returns the camera
func (obj *hudDisplay) Camera() Camera {
return obj.cam
}
// HasMaterial returns true if there is material, false otherwise
func (obj *hudDisplay) HasMaterial() bool {
return obj.mat != nil
}
// Material returns the material, if any
func (obj *hudDisplay) Material() Material {
return obj.mat
}