-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathline.go
41 lines (32 loc) · 974 Bytes
/
line.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
package three
import "github.com/go-gl/gl"
// Line is a representation of a line in 3D space. It consists
// of a geometry which defines all vertices of the lines to render
// and a material. Lines can be transformed.
type Line struct {
Object3D
geometry Shape
material Appearance
}
// NewLine creates a new line for the given geometry (set of vertices) and material.
func NewLine(geometry Shape, material Appearance) *Line {
l := Line{
Object3D: NewObject3D(),
geometry: geometry,
material: material,
}
l.vertexBuffer = newVertexBuffer(geometry)
return &l
}
// Geometry returns an object which describes the shape of the line.
func (l *Line) Geometry() Shape {
return l.geometry
}
// Material returns an objects which described the appaerance of the line.
func (l *Line) Material() Appearance {
return l.material
}
// Mode returns an enum which is used to define the type of primitive to render.
func (l *Line) Mode() gl.GLenum {
return gl.LINES
}