-
Notifications
You must be signed in to change notification settings - Fork 5
/
material.go
38 lines (32 loc) · 1.13 KB
/
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
package main
import "github.com/divan/three"
var (
DefaultNodeMaterial = NewNodeMaterial()
TransparentNodeMaterial = NewTransparentNodeMaterial()
DefaultEdgeMaterial = NewEdgeMaterial()
)
const DefaultTransparency = 0.9
// NewNodeMaterial creates a new default material for the graph node.
func NewNodeMaterial() three.Material {
params := three.NewMaterialParameters()
params.Color = three.NewColorRGB(0, 255, 0)
params.Transparent = false
params.Opacity = DefaultTransparency
return three.NewMeshPhongMaterial(params)
}
// NewTransparentNodeMaterial creates a new transparent material for the graph normal node.
func NewTransparentNodeMaterial() three.Material {
params := three.NewMaterialParameters()
params.Color = three.NewColorRGB(0, 255, 0)
params.Transparent = true
params.Opacity = 0.7
return three.NewMeshPhongMaterial(params)
}
// NewEdgeMaterial creates a new default material for the graph edge lines.
func NewEdgeMaterial() three.Material {
params := three.NewMaterialParameters()
params.Color = three.NewColorHex(0xf0f0f0)
params.Transparent = true
params.Opacity = 0.7
return three.NewLineBasicMaterial(params)
}