Debian Codegraph @

vendor/github.com/xyproto/gfx/vertex.go

raw
1 package gfx
2
3 import "image/color"
4
5 // Vertex holds Position, Color, Picture and Intensity.
6 type Vertex struct {
7 Position Vec
8 Color color.NRGBA
9 Picture Vec
10 Intensity float64
11 }
12
13 // NewVertex returns a new vertex with the given position.
14 func NewVertex(pos Vec, args ...interface{}) Vertex {
15 vx := Vertex{Position: pos}
16
17 for _, a := range args {
18 switch v := a.(type) {
19 case color.NRGBA:
20 vx.Color = v
21 case Vec:
22 vx.Picture = v
23 case float64:
24 vx.Intensity = v
25 }
26 }
27
28 return vx
29 }
30
31 // Vx returns a new vertex with the given coordinates.
32 func Vx(pos Vec, args ...interface{}) Vertex {
33 return NewVertex(pos, args...)
34 }