-
Notifications
You must be signed in to change notification settings - Fork 0
/
leaf.go
44 lines (34 loc) · 919 Bytes
/
leaf.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
package sge
import "github.com/klkblake/s3dm"
type Leaf interface {
Xform() *s3dm.XformScale
Update(delta float64)
Passes() int
AABB() s3dm.AABB
Render(view *View, mvpMatrix s3dm.Mat4, pass int)
XformNode() *XformNode
}
type BasicLeaf struct {
xformNode *XformNode
}
func NewBasicLeaf() *BasicLeaf {
return &BasicLeaf{xformNode: NewXformNode()}
}
func (leaf *BasicLeaf) Link(self Leaf) {
leaf.xformNode.Leaf = self
}
func (leaf *BasicLeaf) Xform() *s3dm.XformScale {
return &leaf.xformNode.Xform
}
func (leaf *BasicLeaf) Passes() int {
return PassOpaque
}
func (leaf *BasicLeaf) AABB() s3dm.AABB {
pos := leaf.XformNode().WorldXform.Position
return s3dm.AABB{pos, pos}
}
func (leaf *BasicLeaf) XformNode() *XformNode {
return leaf.xformNode
}
func (leaf *BasicLeaf) Update(delta float64) {}
func (leaf *BasicLeaf) Render(view *View, mvpMatrix s3dm.Mat4, pass int) {}