Bläddra i källkod

docs/lint fixes

leonsal 8 år sedan
förälder
incheckning
ccdf03ba3f
1 ändrade filer med 19 tillägg och 4 borttagningar
  1. 19 4
      math32/color.go

+ 19 - 4
math32/color.go

@@ -1,20 +1,21 @@
 // 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 math32
 
 import (
 	"strings"
 )
 
-// Type color describes an RGB color
+// Color describes an RGB color
 type Color struct {
 	R float32
 	G float32
 	B float32
 }
 
-// New creates and returns a pointer to a new Color
+// NewColor creates and returns a pointer to a new Color
 // with the specified web standard color name (case insensitive).
 // Returns nil if the color name not found
 func NewColor(name string) *Color {
@@ -26,8 +27,7 @@ func NewColor(name string) *Color {
 	return &c
 }
 
-// Name returns a Color with the specified standard web color
-// name (case insensitive).
+// ColorName returns a Color with the specified standard web color name (case insensitive).
 // Returns black color if the specified color name not found
 func ColorName(name string) Color {
 
@@ -71,6 +71,8 @@ func (c *Color) SetName(name string) *Color {
 	return c
 }
 
+// Add adds to each RGB component of this color the correspondent component of other color
+// Returns pointer to this updated color
 func (c *Color) Add(other *Color) *Color {
 
 	c.R += other.R
@@ -79,6 +81,8 @@ func (c *Color) Add(other *Color) *Color {
 	return c
 }
 
+// AddColors adds to each RGB component of this color the correspondent component of color1 and color2
+// Returns pointer to this updated color
 func (c *Color) AddColors(color1, color2 *Color) *Color {
 
 	c.R = color1.R + color2.R
@@ -87,6 +91,8 @@ func (c *Color) AddColors(color1, color2 *Color) *Color {
 	return c
 }
 
+// AddScalar adds the specified scalar value to each RGB component of this color
+// Returns pointer to this updated color
 func (c *Color) AddScalar(s float32) *Color {
 
 	c.R += s
@@ -95,6 +101,8 @@ func (c *Color) AddScalar(s float32) *Color {
 	return c
 }
 
+// Multiply multiplies each RGB component of this color by other
+// Returns pointer to this updated color
 func (c *Color) Multiply(other *Color) *Color {
 
 	c.R *= other.R
@@ -103,6 +111,8 @@ func (c *Color) Multiply(other *Color) *Color {
 	return c
 }
 
+// MultiplyScalar multiplies each RGB component of this color by the specified scalar.
+// Returns pointer to this updated color
 func (c *Color) MultiplyScalar(v float32) *Color {
 
 	c.R *= v
@@ -111,6 +121,9 @@ func (c *Color) MultiplyScalar(v float32) *Color {
 	return c
 }
 
+// Lerp linear sets this color as the linear interpolation of itself
+// with the specified color for the specified alpha.
+// Returns pointer to this updated color
 func (c *Color) Lerp(color *Color, alpha float32) *Color {
 
 	c.R += (color.R - c.R) * alpha
@@ -119,11 +132,13 @@ func (c *Color) Lerp(color *Color, alpha float32) *Color {
 	return c
 }
 
+// Equals returns if this color is equal to other
 func (c *Color) Equals(other *Color) bool {
 
 	return (c.R == other.R) && (c.G == other.G) && (c.B == other.B)
 }
 
+// IsColorName returns if the specified name is valid color name
 func IsColorName(name string) (Color, bool) {
 
 	c, ok := mapColorNames[strings.ToLower(name)]