Set matrixAutoUpdate to false for nodes and edges

This commit is contained in:
Ivan Danyliuk 2018-10-20 21:38:50 +02:00
parent c72c092286
commit 2edebc99c3
No known key found for this signature in database
GPG Key ID: 97ED33CE024E1DBF

View File

@ -50,6 +50,8 @@ func (w *WebGLScene) createNodes() {
Mesh: three.NewMesh(geometry, material),
}
mesh.Position.Set(node.X, node.Y, node.Z)
mesh.MatrixAutoUpdate = false
mesh.UpdateMatrix()
w.nodesGroup.Add(mesh.Mesh)
w.nodes = append(w.nodes, mesh)
}
@ -78,6 +80,7 @@ func (w *WebGLScene) createEdges(links []*graph.Link) {
To: to,
Line: three.NewLine(geom, material),
}
line.MatrixAutoUpdate = false
w.edgesGroup.Add(line.Line)
w.lines = append(w.lines, line)
}
@ -89,6 +92,7 @@ func (w *WebGLScene) updatePositions() {
for _, node := range w.nodes {
pos := w.positions[node.ID]
node.Position.Set(pos.X, pos.Y, pos.Z)
node.UpdateMatrix()
}
for i := range w.lines {
start := w.positions[w.lines[i].From]