whispervis/material.go

39 lines
1.2 KiB
Go
Raw Normal View History

2018-09-05 17:09:56 +03:00
package main
2018-09-20 15:41:24 +03:00
import "github.com/divan/three"
2018-09-05 17:09:56 +03:00
2018-09-20 22:16:21 +03:00
var (
DefaultNodeMaterial = NewNodeMaterial()
BlinkedNodeMaterial = NewBlinkedNodeMaterial()
DefaultEdgeMaterial = NewEdgeMaterial()
BlinkedEdgeMaterial = NewBlinkedEdgeMaterial()
)
// NewNodeMaterial creates a new default material for the graph node.
2018-09-05 17:09:56 +03:00
func NewNodeMaterial() three.Material {
params := three.NewMaterialParameters()
params.Color = three.NewColor(0, 255, 0)
return three.NewMeshPhongMaterial(params)
}
2018-09-20 22:16:21 +03:00
// NewBlinkedNodeMaterial creates a new default material for the graph blinked node.
func NewBlinkedNodeMaterial() three.Material {
params := three.NewMaterialParameters()
params.Color = three.NewColor(255, 0, 0) // red
return three.NewMeshPhongMaterial(params)
}
2018-09-05 17:09:56 +03:00
// NewEdgeMaterial creates a new default material for the graph edge lines.
2018-09-20 22:16:21 +03:00
func NewEdgeMaterial() three.Material {
2018-09-05 17:09:56 +03:00
params := three.NewMaterialParameters()
params.Color = three.NewColor(200, 200, 255)
return three.NewLineBasicMaterial(params)
}
2018-09-20 22:16:21 +03:00
// NewBlinkedEdgeMaterial creates a new default material for the graph blinked edge lines.
func NewBlinkedEdgeMaterial() three.Material {
params := three.NewMaterialParameters()
params.Color = three.NewColor(255, 0, 0)
return three.NewLineBasicMaterial(params)
}