-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbasic_material.go
59 lines (48 loc) · 1.4 KB
/
basic_material.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
package three
// BasicMaterial describes a material with basic shading. No lights or shadows
// are considered.
type BasicMaterial struct {
program *Program
color *Color
texture *Texture
wireframe bool
}
// NewBasicMaterial creates a new Basic material.
func NewBasicMaterial() *BasicMaterial {
material := BasicMaterial{}
return &material
}
// SetColor sets a solid color for this material.
func (b *BasicMaterial) SetColor(color *Color) *BasicMaterial {
b.color = color
return b
}
// Color returns the set color for this material.
func (b BasicMaterial) Color() *Color {
return b.color
}
// SetTexture sets the texture for this material.
func (b *BasicMaterial) SetTexture(texture *Texture) {
b.texture = texture
}
// Texture returns the set texture for this material.
func (b BasicMaterial) Texture() *Texture {
return b.texture
}
// SetWireframe enables or disables wireframes for the material.
func (b *BasicMaterial) SetWireframe(wireframe bool) *BasicMaterial {
b.wireframe = wireframe
return b
}
// Wireframe returns the current value for wireframe rendering.
func (b BasicMaterial) Wireframe() bool {
return b.wireframe
}
// SetProgram stores the given program for further use (cache).
func (b *BasicMaterial) SetProgram(p *Program) {
b.program = p
}
// Program returns the current program which is used for this material.
func (b *BasicMaterial) Program() *Program {
return b.program
}