point.go 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. // Copyright 2016 The G3N Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. package material
  5. import (
  6. "github.com/g3n/engine/math32"
  7. )
  8. // Point material is normally used for single point sprites
  9. type Point struct {
  10. Standard // Embedded standard material
  11. }
  12. // NewPoint creates and returns a pointer to a new point material
  13. func NewPoint(color *math32.Color) *Point {
  14. pm := new(Point)
  15. pm.Standard.Init("point", color)
  16. // Sets uniform's initial values
  17. pm.udata.emissive = *color
  18. pm.udata.psize = 1.0
  19. pm.udata.protationZ = 0
  20. return pm
  21. }
  22. // SetEmissiveColor sets the material emissive color
  23. // The default is {0,0,0}
  24. func (pm *Point) SetEmissiveColor(color *math32.Color) {
  25. pm.udata.emissive = *color
  26. }
  27. // SetSize sets the point size
  28. func (pm *Point) SetSize(size float32) {
  29. pm.udata.psize = size
  30. }
  31. // SetRotationZ sets the point rotation around the Z axis.
  32. func (pm *Point) SetRotationZ(rot float32) {
  33. pm.udata.protationZ = rot
  34. }