forked from g3n/engine
/
point.go
46 lines (34 loc) · 1019 Bytes
/
point.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
42
43
44
45
46
// Copyright 2016 The G3N Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package material
import (
"engine/math32"
)
// Point material is normally used for single point sprites
type Point struct {
Standard // Embedded standard material
}
// NewPoint creates and returns a pointer to a new point material
func NewPoint(color *math32.Color) *Point {
pm := new(Point)
pm.Standard.Init("point", color)
// Sets uniform's initial values
pm.udata.emissive = *color
pm.udata.psize = 1.0
pm.udata.protationZ = 0
return pm
}
// SetEmissiveColor sets the material emissive color
// The default is {0,0,0}
func (pm *Point) SetEmissiveColor(color *math32.Color) {
pm.udata.emissive = *color
}
// SetSize sets the point size
func (pm *Point) SetSize(size float32) {
pm.udata.psize = size
}
// SetRotationZ sets the point rotation around the Z axis.
func (pm *Point) SetRotationZ(rot float32) {
pm.udata.protationZ = rot
}