Improve colors

This commit is contained in:
Ivan Danyliuk 2018-10-22 14:40:41 +02:00
parent 63618a9e93
commit 0565d7211a
No known key found for this signature in database
GPG Key ID: 97ED33CE024E1DBF
2 changed files with 10 additions and 10 deletions

View File

@ -16,8 +16,8 @@ const (
// NewNodeMaterial creates a new default material for the graph node.
func NewNodeMaterial() three.Material {
params := three.NewMaterialParameters()
params.Color = three.NewColor(0, 255, 0)
params.Transparent = true
params.Color = three.NewColorRGB(0, 255, 0)
params.Transparent = false
params.Opacity = DefaultTransparency
return three.NewMeshPhongMaterial(params)
}
@ -25,7 +25,7 @@ func NewNodeMaterial() three.Material {
// 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
params.Color = three.NewColorRGB(255, 0, 0) // red
params.Transparent = true
params.Opacity = DefaultTransparency
return three.NewMeshPhongMaterial(params)
@ -34,8 +34,8 @@ func NewBlinkedNodeMaterial() three.Material {
// NewEdgeMaterial creates a new default material for the graph edge lines.
func NewEdgeMaterial() three.Material {
params := three.NewMaterialParameters()
params.Color = three.NewColor(200, 200, 255)
params.Transparent = true
params.Color = three.NewColorRGB(200, 200, 255)
params.Transparent = false
params.Opacity = DefaultTransparency
return three.NewLineBasicMaterial(params)
}
@ -43,7 +43,7 @@ func NewEdgeMaterial() three.Material {
// 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)
params.Color = three.NewColorRGB(255, 0, 0)
params.Transparent = true
params.Opacity = DefaultTransparency
return three.NewLineBasicMaterial(params)

View File

@ -80,10 +80,10 @@ func (w *WebGLScene) Reset() {
// InitScene inits a new scene, sets up camera, lights and all that.
func (w *WebGLScene) InitScene(width, height float64) {
w.camera = three.NewPerspectiveCamera(70, width/height, 1, 1000)
w.camera.Position.Set(0, 0, 400)
w.camera.Position.Set(0, 0, 100)
w.scene = three.NewScene()
w.scene.Background = three.NewColor(0, 0, 17/256)
w.scene.Background = three.NewColorRGB(0, 0, 17)
w.InitLights()
w.InitControls()
@ -92,11 +92,11 @@ func (w *WebGLScene) InitScene(width, height float64) {
// InitLights init lights for the scene.
func (w *WebGLScene) InitLights() {
ambLight := three.NewAmbientLight(three.NewColor(0, 0, 0), 1)
ambLight := three.NewAmbientLight(three.NewColorHex(0xbbbbbb), 1)
ambLight.MatrixAutoUpdate = false
w.scene.Add(ambLight)
light := three.NewDirectionalLight(three.NewColor(1, 1, 1), 1)
light := three.NewDirectionalLight(three.NewColor("white"), 1)
light.MatrixAutoUpdate = false
w.scene.Add(light)
}