소스 검색

cleanup/docs/golint

danaugrs 7 년 전
부모
커밋
690273855c
19개의 변경된 파일152개의 추가작업 그리고 117개의 파일을 삭제
  1. 3 2
      core/raycaster.go
  2. 16 15
      geometry/box.go
  3. 5 1
      gls/glapi2go/template.go
  4. 3 3
      gls/program.go
  5. 5 3
      graphic/sprite.go
  6. 4 4
      gui/assets/icon/icodes.go
  7. 2 1
      gui/chart.go
  8. 3 3
      gui/control_folder.go
  9. 3 3
      gui/dropdown.go
  10. 9 9
      gui/folder.go
  11. 10 6
      gui/scrollbar.go
  12. 2 2
      gui/style_default.go
  13. 1 0
      gui/style_light.go
  14. 13 8
      gui/tree.go
  15. 16 16
      math32/triangle.go
  16. 3 3
      text/str.go
  17. 1 1
      texture/animator.go
  18. 5 4
      tools/g3nicodes/main.go
  19. 48 33
      util/logger/logger.go

+ 3 - 2
core/raycaster.go

@@ -9,6 +9,7 @@ import (
 	"sort"
 )
 
+// Raycaster represents an empty object that can cast rays and check for ray intersections.
 type Raycaster struct {
 	// The distance from the ray origin to the intersected points
 	// must be greater than the value of this field to be considered.
@@ -51,7 +52,7 @@ type Intersect struct {
 	Index uint32
 }
 
-// New creates and returns a pointer to a new raycaster object
+// NewRaycaster creates and returns a pointer to a new raycaster object
 // with the specified origin and direction.
 func NewRaycaster(origin, direction *math32.Vector3) *Raycaster {
 
@@ -105,7 +106,7 @@ func (rc *Raycaster) intersectObject(inode INode, intersects *[]Intersect, recur
 	return
 }
 
-// For sorting Intersects by distance
+// Intersects is the array type for Intersect objects. It's used for sorting intersects by distance.
 type Intersects []Intersect
 
 func (is Intersects) Len() int      { return len(is) }

+ 16 - 15
geometry/box.go

@@ -9,6 +9,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Box represents a box or cube geometry.
 type Box struct {
 	Geometry
 	Width          float64
@@ -40,17 +41,17 @@ func NewBox(width, height, depth float64, widthSegments, heightSegments, depthSe
 	uvs := math32.NewArrayF32(0, 16)
 	indices := math32.NewArrayU32(0, 16)
 
-	width_half := width / 2
-	height_half := height / 2
-	depth_half := depth / 2
+	wHalf := width / 2
+	vHalf := height / 2
+	dHalf := depth / 2
 
 	// Internal function to build each box plane
 	buildPlane := func(u, v string, udir, vdir int, width, height, depth float64, materialIndex uint) {
 
 		gridX := widthSegments
 		gridY := heightSegments
-		width_half := width / 2
-		height_half := height / 2
+		wHalf := width / 2
+		hHalf := height / 2
 		offset := positions.Len() / 3
 		var w string
 
@@ -66,8 +67,8 @@ func NewBox(width, height, depth float64, widthSegments, heightSegments, depthSe
 
 		gridX1 := gridX + 1
 		gridY1 := gridY + 1
-		segment_width := width / float64(gridX)
-		segment_height := height / float64(gridY)
+		segmentWidth := width / float64(gridX)
+		segmentHeight := height / float64(gridY)
 		var normal math32.Vector3
 		if depth > 0 {
 			normal.SetByName(w, 1)
@@ -79,8 +80,8 @@ func NewBox(width, height, depth float64, widthSegments, heightSegments, depthSe
 		for iy := 0; iy < gridY1; iy++ {
 			for ix := 0; ix < gridX1; ix++ {
 				var vector math32.Vector3
-				vector.SetByName(u, float32((float64(ix)*segment_width-width_half)*float64(udir)))
-				vector.SetByName(v, float32((float64(iy)*segment_height-height_half)*float64(vdir)))
+				vector.SetByName(u, float32((float64(ix)*segmentWidth-wHalf)*float64(udir)))
+				vector.SetByName(v, float32((float64(iy)*segmentHeight-hHalf)*float64(vdir)))
 				vector.SetByName(w, float32(depth))
 				positions.AppendVector3(&vector)
 				normals.AppendVector3(&normal)
@@ -104,12 +105,12 @@ func NewBox(width, height, depth float64, widthSegments, heightSegments, depthSe
 		box.AddGroup(gstart, gcount, int(matIndex))
 	}
 
-	buildPlane("z", "y", -1, -1, depth, height, width_half, 0)  // px
-	buildPlane("z", "y", 1, -1, depth, height, -width_half, 1)  // nx
-	buildPlane("x", "z", 1, 1, width, depth, height_half, 2)    // py
-	buildPlane("x", "z", 1, -1, width, depth, -height_half, 3)  // ny
-	buildPlane("x", "y", 1, -1, width, height, depth_half, 4)   // pz
-	buildPlane("x", "y", -1, -1, width, height, -depth_half, 5) // nz
+	buildPlane("z", "y", -1, -1, depth, height, wHalf, 0)  // px
+	buildPlane("z", "y", 1, -1, depth, height, -wHalf, 1)  // nx
+	buildPlane("x", "z", 1, 1, width, depth, vHalf, 2)     // py
+	buildPlane("x", "z", 1, -1, width, depth, -vHalf, 3)   // ny
+	buildPlane("x", "y", 1, -1, width, height, dHalf, 4)   // pz
+	buildPlane("x", "y", -1, -1, width, height, -dHalf, 5) // nz
 
 	box.SetIndices(indices)
 	box.AddVBO(gls.NewVBO().AddAttrib("VertexPosition", 3).SetBuffer(positions))

+ 5 - 1
gls/glapi2go/template.go

@@ -7,16 +7,19 @@ import (
 	"text/template"
 )
 
+// GLHeader is the definition of an OpenGL header file, with functions and constant definitions.
 type GLHeader struct {
 	Defines []GLDefine
 	Funcs   []GLFunc
 }
 
+// GLDefine is the definition of an OpenGL constant.
 type GLDefine struct {
 	Name  string
 	Value string
 }
 
+// GLFunc is the definition of an OpenGL function.
 type GLFunc struct {
 	Ptype    string    // type of function pointer (ex: PFNCULLFACEPROC)
 	Spacer   string    // spacer string for formatting
@@ -30,6 +33,7 @@ type GLFunc struct {
 	Params   []GLParam // array of function parameters
 }
 
+// GLParam is the definition of an argument to an OpenGL function (GLFunc).
 type GLParam struct {
 	Qualif string // optional parameter qualifier (ex: const)
 	CType  string // parameter C type
@@ -37,7 +41,7 @@ type GLParam struct {
 	Name   string // parameter name with possible pointer operator
 }
 
-// genFile generates file from the specified template
+// genFile generates file from the specified template.
 func genFile(templText string, td *GLHeader, fout string, gosrc bool) error {
 
 	// Parses the template

+ 3 - 3
gls/program.go

@@ -13,7 +13,7 @@ import (
 	"strings"
 )
 
-// Shader Program Object
+// Program represents a shader program.
 type Program struct {
 	// Shows source code in error messages
 	ShowSource bool
@@ -50,7 +50,7 @@ func (gs *GLS) NewProgram() *Program {
 	return prog
 }
 
-// AddShaders adds a shader to this program.
+// AddShader adds a shader to this program.
 // This must be done before the program is built.
 func (prog *Program) AddShader(stype uint32, source string, defines map[string]interface{}) {
 
@@ -144,7 +144,7 @@ func (prog *Program) Handle() uint32 {
 	return prog.handle
 }
 
-// GetAttributeLocation returns the location of the specified attribute
+// GetAttribLocation returns the location of the specified attribute
 // in this program. This location is internally cached.
 func (prog *Program) GetAttribLocation(name string) int32 {
 

+ 5 - 3
graphic/sprite.go

@@ -12,6 +12,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Sprite is a potentially animated image positioned in space that always faces the camera.
 type Sprite struct {
 	Graphic             // Embedded graphic
 	uniMVPM gls.Uniform // Model view projection matrix uniform location cache
@@ -55,6 +56,7 @@ func NewSprite(width, height float32, imat material.IMaterial) *Sprite {
 	return s
 }
 
+// RenderSetup sets up the rendering of the sprite.
 func (s *Sprite) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo) {
 
 	// Calculates model view matrix
@@ -73,12 +75,12 @@ func (s *Sprite) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo) {
 	rotation.X = 0
 	rotation.Y = 0
 	quaternion.SetFromEuler(&rotation)
-	var mvm_new math32.Matrix4
-	mvm_new.Compose(&position, &quaternion, &scale)
+	var mvmNew math32.Matrix4
+	mvmNew.Compose(&position, &quaternion, &scale)
 
 	// Calculates final MVP and updates uniform
 	var mvpm math32.Matrix4
-	mvpm.MultiplyMatrices(&rinfo.ProjMatrix, &mvm_new)
+	mvpm.MultiplyMatrices(&rinfo.ProjMatrix, &mvmNew)
 	location := s.uniMVPM.Location(gs)
 	gs.UniformMatrix4fv(location, 1, false, &mvpm[0])
 }

+ 4 - 4
gui/assets/icon/icodes.go

@@ -1,8 +1,8 @@
-//
-// This file was generated from the original 'codepoints' file
+// File generated by g3nicodes. Do not edit.
+// This file is based on the original 'codepoints' file
 // from the material design icon fonts:
 // https://github.com/google/material-design-icons
-//
+
 package icon
 
 const (
@@ -940,7 +940,7 @@ const (
 	ZoomOutMap                            = string(0xe56b)
 )
 
-// IconCodepoint returns the codepoint for the specified icon name.
+// Codepoint returns the codepoint for the specified icon name.
 // Returns 0 if the name not found
 func Codepoint(name string) string {
 

+ 2 - 1
gui/chart.go

@@ -601,7 +601,8 @@ func (sy *chartScaleY) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo) {
 }
 
 //
-// Graph
+// Graph is the GUI element that represents a single plotted function.
+// A Chart has an array of Graph objects.
 //
 type Graph struct {
 	Panel                   // Embedded panel

+ 3 - 3
gui/control_folder.go

@@ -8,20 +8,20 @@ import (
 	"fmt"
 )
 
-// ControlFolder represents a folder with controls
+// ControlFolder represents a folder with controls.
 type ControlFolder struct {
 	Folder                      // Embedded folder
 	tree   Tree                 // control tree
 	styles *ControlFolderStyles // Pointer to styles
 }
 
-// ControlFolderStyles
+// ControlFolderStyles contains the styling for the valid GUI states of the components of a ControlFolder.
 type ControlFolderStyles struct {
 	Folder *FolderStyles
 	Tree   *TreeStyles
 }
 
-// ControlFolderGroup
+// ControlFolderGroup represents a group of controls in the control folder.
 type ControlFolderGroup struct {
 	control *ControlFolder
 	node    *TreeNode

+ 3 - 3
gui/dropdown.go

@@ -9,7 +9,7 @@ import (
 	"github.com/g3n/engine/window"
 )
 
-// DropDown represents a dropdown GUI element
+// DropDown represents a dropdown GUI element.
 type DropDown struct {
 	Panel                        // Embedded panel
 	icon         *Label          // internal label with icon
@@ -23,10 +23,10 @@ type DropDown struct {
 	clickOut     bool
 }
 
-// DropDownStyle
+// DropDownStyle contains the styling of a DropDown.
 type DropDownStyle BasicStyle
 
-// DropDownStyles
+// DropDownStyles contains a DropDownStyle for each valid GUI state.
 type DropDownStyles struct {
 	Normal   DropDownStyle
 	Over     DropDownStyle

+ 9 - 9
gui/folder.go

@@ -8,7 +8,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
-// Folder represents a folder GUI element
+// Folder represents a folder GUI element.
 type Folder struct {
 	Panel               // Embedded panel
 	label        Label  // Folder label
@@ -19,14 +19,14 @@ type Folder struct {
 	alignRight   bool
 }
 
-// FolderStyle
+// FolderStyle contains the styling of a Folder.
 type FolderStyle struct {
 	PanelStyle
 	FgColor     math32.Color4
 	Icons       [2]string
 }
 
-// FolderStyles
+// FolderStyles contains a FolderStyle for each valid GUI state.
 type FolderStyles struct {
 	Normal   FolderStyle
 	Over     FolderStyle
@@ -35,7 +35,7 @@ type FolderStyles struct {
 }
 
 // NewFolder creates and returns a pointer to a new folder widget
-// with the specified text and initial width
+// with the specified text and initial width.
 func NewFolder(text string, width float32, contentPanel IPanel) *Folder {
 
 	f := new(Folder)
@@ -44,7 +44,7 @@ func NewFolder(text string, width float32, contentPanel IPanel) *Folder {
 }
 
 // Initialize initializes the Folder with the specified text and initial width
-// It is normally used when the folder is embedded in another object
+// It is normally used when the folder is embedded in another object.
 func (f *Folder) Initialize(text string, width float32, contentPanel IPanel) {
 
 	f.Panel.Initialize(width, 0)
@@ -75,7 +75,7 @@ func (f *Folder) Initialize(text string, width float32, contentPanel IPanel) {
 	f.recalc()
 }
 
-// SetStyles set the folder styles overriding the default style
+// SetStyles set the folder styles overriding the default style.
 func (f *Folder) SetStyles(fs *FolderStyles) {
 
 	f.styles = fs
@@ -83,7 +83,7 @@ func (f *Folder) SetStyles(fs *FolderStyles) {
 }
 
 // SetAlignRight sets the side of the alignment of the content panel
-// in relation to the folder
+// in relation to the folder.
 func (f *Folder) SetAlignRight(state bool) {
 
 	f.alignRight = state
@@ -91,7 +91,7 @@ func (f *Folder) SetAlignRight(state bool) {
 }
 
 // TotalHeight returns this folder total height
-// considering the contents panel, if visible
+// considering the contents panel, if visible.
 func (f *Folder) TotalHeight() float32 {
 
 	height := f.Height()
@@ -101,7 +101,7 @@ func (f *Folder) TotalHeight() float32 {
 	return height
 }
 
-// onMouse receives mouse button events over the folder panel
+// onMouse receives mouse button events over the folder panel.
 func (f *Folder) onMouse(evname string, ev interface{}) {
 
 	switch evname {

+ 10 - 6
gui/scrollbar.go

@@ -22,6 +22,7 @@ import (
 
 **/
 
+// ScrollBar is the scrollbar GUI element.
 type ScrollBar struct {
 	Panel                       // Embedded panel
 	styles     *ScrollBarStyles // styles of the scrollbar
@@ -40,12 +41,14 @@ type scrollBarButton struct {
 	MinSize float32    // minimum button size
 }
 
+// ScrollBarStyles contains a ScrollBarStyle for each valid GUI state.
 type ScrollBarStyles struct {
 	Normal   ScrollBarStyle
 	Over     ScrollBarStyle
 	Disabled ScrollBarStyle
 }
 
+// ScrollBarStyle contains the styling of a ScrollBar.
 type ScrollBarStyle struct {
 	PanelStyle
 	Button       PanelStyle
@@ -120,13 +123,14 @@ func (sb *ScrollBar) Value() float64 {
 			return 0
 		}
 		return float64(sb.button.Position().Y) / den
-	} else {
-		den := float64(sb.content.Width) - float64(sb.button.width)
-		if den == 0 {
-			return 0
-		}
-		return float64(sb.button.Position().X) / den
 	}
+
+	// horizontal
+	den := float64(sb.content.Width) - float64(sb.button.width)
+	if den == 0 {
+		return 0
+	}
+	return float64(sb.button.Position().X) / den
 }
 
 // SetValue sets the position of the button of the scrollbar

+ 2 - 2
gui/style_default.go

@@ -6,13 +6,13 @@ package gui
 
 var defaultStyle *Style
 
-// Sets the default style
+// init sets the default style
 func init() {
 
 	defaultStyle = NewLightStyle()
 }
 
-// StyleDefault() returns a pointer to the current default style
+// StyleDefault returns a pointer to the current default style
 func StyleDefault() *Style {
 
 	return defaultStyle

+ 1 - 0
gui/style_light.go

@@ -1,6 +1,7 @@
 // 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 gui
 
 import (

+ 13 - 8
gui/tree.go

@@ -9,27 +9,32 @@ import (
 	"github.com/g3n/engine/window"
 )
 
+// Tree is the tree structure GUI element.
 type Tree struct {
 	List               // Embedded list panel
 	styles *TreeStyles // Pointer to styles
 }
 
+// TreeStyles contains the styling of all tree components for each valid GUI state.
 type TreeStyles struct {
 	List     *ListStyles     // Styles for the embedded list
 	Node     *TreeNodeStyles // Styles for the node panel
 	Padlevel float32         // Left padding indentation
 }
 
+// TreeNodeStyles contains a TreeNodeStyle for each valid GUI state.
 type TreeNodeStyles struct {
 	Normal TreeNodeStyle
 }
 
+// TreeNodeStyle contains the styling of a TreeNode.
 type TreeNodeStyle struct {
 	PanelStyle
 	FgColor     math32.Color4
 	Icons       [2]string
 }
 
+// TreeNode is a tree node.
 type TreeNode struct {
 	Panel              // Embedded panel
 	label    Label     // Node label
@@ -40,7 +45,7 @@ type TreeNode struct {
 	expanded bool      // Node expanded flag
 }
 
-// NewTree creates and returns a pointer to a new tree widget
+// NewTree creates and returns a pointer to a new tree widget.
 func NewTree(width, height float32) *Tree {
 
 	t := new(Tree)
@@ -49,7 +54,7 @@ func NewTree(width, height float32) *Tree {
 }
 
 // Initialize initializes the tree with the specified initial width and height
-// It is normally used when the folder is embedded in another object
+// It is normally used when the folder is embedded in another object.
 func (t *Tree) Initialize(width, height float32) {
 
 	t.List.initialize(true, width, height)
@@ -59,7 +64,7 @@ func (t *Tree) Initialize(width, height float32) {
 	t.List.Subscribe(OnCursor, t.onCursor)
 }
 
-// SetStyles set the tree styles overriding the default style
+// SetStyles sets the tree styles overriding the default style.
 func (t *Tree) SetStyles(s *TreeStyles) {
 
 	t.styles = s
@@ -67,13 +72,13 @@ func (t *Tree) SetStyles(s *TreeStyles) {
 	t.update()
 }
 
-// InsertAt inserts a child panel at the specified position in the tree
+// InsertAt inserts a child panel at the specified position in the tree.
 func (t *Tree) InsertAt(pos int, child IPanel) {
 
 	t.List.InsertAt(pos, child)
 }
 
-// Add child panel to the end tree
+// Add child panel to the end tree.
 func (t *Tree) Add(ichild IPanel) {
 
 	t.List.Add(ichild)
@@ -81,7 +86,7 @@ func (t *Tree) Add(ichild IPanel) {
 
 // InsertNodeAt inserts at the specified position a new tree node
 // with the specified text at the end of this tree
-// and returns pointer to the new node
+// and returns pointer to the new node.
 func (t *Tree) InsertNodeAt(pos int, text string) *TreeNode {
 
 	n := newTreeNode(text, t, nil)
@@ -91,8 +96,8 @@ func (t *Tree) InsertNodeAt(pos int, text string) *TreeNode {
 	return n
 }
 
-// Add adds a new tree node with the specified text
-// at the end of this tree and returns pointer to the new node
+// AddNode adds a new tree node with the specified text
+// at the end of this tree and returns a pointer to the new node.
 func (t *Tree) AddNode(text string) *TreeNode {
 
 	n := newTreeNode(text, t, nil)

+ 16 - 16
math32/triangle.go

@@ -4,14 +4,14 @@
 
 package math32
 
-// Triangle represents a triangle of vertices
+// Triangle represents a triangle made of three vertices.
 type Triangle struct {
 	a Vector3
 	b Vector3
 	c Vector3
 }
 
-// New Triangle returns a pointer to a new Triangle object
+// NewTriangle returns a pointer to a new Triangle object.
 func NewTriangle(a, b, c *Vector3) *Triangle {
 
 	t := new(Triangle)
@@ -27,7 +27,7 @@ func NewTriangle(a, b, c *Vector3) *Triangle {
 	return t
 }
 
-// Normal returns the triangle's normal
+// Normal returns the triangle's normal.
 func Normal(a, b, c, optionalTarget *Vector3) *Vector3 {
 
 	var v0 Vector3
@@ -49,7 +49,7 @@ func Normal(a, b, c, optionalTarget *Vector3) *Vector3 {
 	return result.Set(0, 0, 0)
 }
 
-// BarycoordFromPoint returns the barycentric coordinates for the specified point
+// BarycoordFromPoint returns the barycentric coordinates for the specified point.
 func BarycoordFromPoint(point, a, b, c, optionalTarget *Vector3) *Vector3 {
 
 	var v0 Vector3
@@ -91,7 +91,7 @@ func BarycoordFromPoint(point, a, b, c, optionalTarget *Vector3) *Vector3 {
 
 }
 
-// ContainsPoint returns whether a triangle contains a point
+// ContainsPoint returns whether a triangle contains a point.
 func ContainsPoint(point, a, b, c *Vector3) bool {
 
 	var v1 Vector3
@@ -100,7 +100,7 @@ func ContainsPoint(point, a, b, c *Vector3) bool {
 	return (result.X >= 0) && (result.Y >= 0) && ((result.X + result.Y) <= 1)
 }
 
-// Set sets the triangle's three vertices
+// Set sets the triangle's three vertices.
 func (t *Triangle) Set(a, b, c *Vector3) *Triangle {
 
 	t.a = *a
@@ -109,7 +109,7 @@ func (t *Triangle) Set(a, b, c *Vector3) *Triangle {
 	return t
 }
 
-// SetFromPointsAndIndices sets the triangle's vertices based on the specified points and indices
+// SetFromPointsAndIndices sets the triangle's vertices based on the specified points and indices.
 func (t *Triangle) SetFromPointsAndIndices(points []*Vector3, i0, i1, i2 int) *Triangle {
 
 	t.a = *points[i0]
@@ -118,14 +118,14 @@ func (t *Triangle) SetFromPointsAndIndices(points []*Vector3, i0, i1, i2 int) *T
 	return t
 }
 
-// Copy modifies the receiver triangle to match the provided triangle
+// Copy modifies the receiver triangle to match the provided triangle.
 func (t *Triangle) Copy(triangle *Triangle) *Triangle {
 
 	*t = *triangle
 	return t
 }
 
-// Area returns the triangle's area
+// Area returns the triangle's area.
 func (t *Triangle) Area() float32 {
 
 	var v0 Vector3
@@ -136,7 +136,7 @@ func (t *Triangle) Area() float32 {
 	return v0.Cross(&v1).Length() * 0.5
 }
 
-// Midpoint returns the triangle's midpoint
+// Midpoint returns the triangle's midpoint.
 func (t *Triangle) Midpoint(optionalTarget *Vector3) *Vector3 {
 
 	var result *Vector3
@@ -148,13 +148,13 @@ func (t *Triangle) Midpoint(optionalTarget *Vector3) *Vector3 {
 	return result.AddVectors(&t.a, &t.b).Add(&t.c).MultiplyScalar(1 / 3)
 }
 
-// Normal returns the triangle's normal
+// Normal returns the triangle's normal.
 func (t *Triangle) Normal(optionalTarget *Vector3) *Vector3 {
 
 	return Normal(&t.a, &t.b, &t.c, optionalTarget)
 }
 
-// Plane returns a Plane object aligned with the triangle
+// Plane returns a Plane object aligned with the triangle.
 func (t *Triangle) Plane(optionalTarget *Plane) *Plane {
 
 	var result *Plane
@@ -166,25 +166,25 @@ func (t *Triangle) Plane(optionalTarget *Plane) *Plane {
 	return result.SetFromCoplanarPoints(&t.a, &t.b, &t.c)
 }
 
-// BarycoordFromPoint returns the barycentric coordinates for the specified point
+// BarycoordFromPoint returns the barycentric coordinates for the specified point.
 func (t *Triangle) BarycoordFromPoint(point, optionalTarget *Vector3) *Vector3 {
 
 	return BarycoordFromPoint(point, &t.a, &t.b, &t.c, optionalTarget)
 }
 
-// ContainsPoint returns whether the triangle contains a point
+// ContainsPoint returns whether the triangle contains a point.
 func (t *Triangle) ContainsPoint(point *Vector3) bool {
 
 	return ContainsPoint(point, &t.a, &t.b, &t.c)
 }
 
-// Equals returns whether the triangles are equal in all their vertices
+// Equals returns whether the triangles are equal in all their vertices.
 func (t *Triangle) Equals(triangle *Triangle) bool {
 
 	return triangle.a.Equals(&t.a) && triangle.b.Equals(&t.b) && triangle.c.Equals(&t.c)
 }
 
-// Clone clones a triangle
+// Clone clones a triangle.
 func (t *Triangle) Clone(triangle *Triangle) *Triangle {
 
 	return NewTriangle(nil, nil, nil).Copy(t)

+ 3 - 3
text/str.go

@@ -4,7 +4,7 @@
 
 package text
 
-// strCount returns the number of runes in the specified string
+// StrCount returns the number of runes in the specified string
 func StrCount(s string) int {
 
 	count := 0
@@ -19,7 +19,7 @@ func StrCount(s string) int {
 func StrFind(s string, pos int) (start, length int) {
 
 	count := 0
-	for index, _ := range s {
+	for index := range s {
 		if count == pos {
 			start = index
 			count++
@@ -56,7 +56,7 @@ func StrInsert(s, data string, col int) string {
 func StrPrefix(text string, pos int) string {
 
 	count := 0
-	for index, _ := range text {
+	for index := range text {
 		if count == pos {
 			return text[:index]
 		}

+ 1 - 1
texture/animator.go

@@ -9,7 +9,7 @@ import (
 	"time"
 )
 
-// Animator
+// Animator can generate a texture animation based on a texture sheet
 type Animator struct {
 	tex       *Texture2D    // pointer to texture being displayed
 	dispTime  time.Duration // disply duration of each tile (default = 1.0/30.0)

+ 5 - 4
tools/g3nicodes/main.go

@@ -145,19 +145,20 @@ func usage() {
 	os.Exit(0)
 }
 
-const templText = `//
-// This file was generated from the original 'codepoints' file
+const templText = `// File generated by g3nicodes. Do not edit.
+// This file is based on the original 'codepoints' file
 // from the material design icon fonts:
 // https://github.com/google/material-design-icons
-//
+
 package {{.Packname}}
+
 const (
 	{{range .Consts}}
 		{{.Name}} = string({{.Value}})
 	{{- end}}
 )
 
-// IconCodepoint returns the codepoint for the specified icon name.
+// Codepoint returns the codepoint for the specified icon name.
 // Returns 0 if the name not found
 func Codepoint(name string) string {
 

+ 48 - 33
util/logger/logger.go

@@ -102,28 +102,28 @@ func New(name string, parent *Logger) *Logger {
 	return self
 }
 
-// SetLevel set the current level of this logger
+// SetLevel sets the current level of this logger.
 // Only log messages with levels with the same or higher
 // priorities than the current level will be emitted.
-func (self *Logger) SetLevel(level int) {
+func (l *Logger) SetLevel(level int) {
 
 	if level < DEBUG || level > FATAL {
 		return
 	}
-	self.level = level
+	l.level = level
 }
 
 // SetLevelByName sets the current level of this logger by level name:
 // debug|info|warn|error|fatal (case ignored.)
 // Only log messages with levels with the same or higher
 // priorities than the current level will be emitted.
-func (self *Logger) SetLevelByName(lname string) error {
+func (l *Logger) SetLevelByName(lname string) error {
 	var level int
 
 	lname = strings.ToUpper(lname)
 	for level = 0; level < len(levelNames); level++ {
 		if lname == levelNames[level] {
-			self.level = level
+			l.level = level
 			return nil
 		}
 	}
@@ -131,33 +131,33 @@ func (self *Logger) SetLevelByName(lname string) error {
 }
 
 // SetFormat sets the logger date/time message format
-func (self *Logger) SetFormat(format int) {
+func (l *Logger) SetFormat(format int) {
 
-	self.format = format
+	l.format = format
 }
 
 // AddWriter adds a writer to the current outputs of this logger.
-func (self *Logger) AddWriter(writer LoggerWriter) {
+func (l *Logger) AddWriter(writer LoggerWriter) {
 
-	self.outputs = append(self.outputs, writer)
+	l.outputs = append(l.outputs, writer)
 }
 
 // RemoveWriter removes the specified writer from  the current outputs of this logger.
-func (self *Logger) RemoveWriter(writer LoggerWriter) {
+func (l *Logger) RemoveWriter(writer LoggerWriter) {
 
-	for pos, w := range self.outputs {
+	for pos, w := range l.outputs {
 		if w != writer {
 			continue
 		}
-		self.outputs = append(self.outputs[:pos], self.outputs[pos+1:]...)
+		l.outputs = append(l.outputs[:pos], l.outputs[pos+1:]...)
 	}
 }
 
 // EnableChild enables or disables this logger child logger with
 // the specified name.
-func (self *Logger) EnableChild(name string, state bool) {
+func (l *Logger) EnableChild(name string, state bool) {
 
-	for _, c := range self.children {
+	for _, c := range l.children {
 		if c.name == name {
 			c.enabled = state
 		}
@@ -165,15 +165,15 @@ func (self *Logger) EnableChild(name string, state bool) {
 }
 
 // Debug emits a DEBUG level log message
-func (self *Logger) Debug(format string, v ...interface{}) {
+func (l *Logger) Debug(format string, v ...interface{}) {
 
-	self.Log(DEBUG, format, v...)
+	l.Log(DEBUG, format, v...)
 }
 
 // Info emits an INFO level log message
-func (self *Logger) Info(format string, v ...interface{}) {
+func (l *Logger) Info(format string, v ...interface{}) {
 
-	self.Log(INFO, format, v...)
+	l.Log(INFO, format, v...)
 }
 
 // Warn emits a WARN level log message
@@ -194,11 +194,11 @@ func (self *Logger) Fatal(format string, v ...interface{}) {
 	self.Log(FATAL, format, v...)
 }
 
-// Logs emits a log message with the specified level
-func (self *Logger) Log(level int, format string, v ...interface{}) {
+// Log emits a log message with the specified level
+func (l *Logger) Log(level int, format string, v ...interface{}) {
 
 	// Ignores message if logger not enabled or with level bellow the current one.
-	if !self.enabled || level < self.level {
+	if !l.enabled || level < l.level {
 		return
 	}
 
@@ -208,20 +208,20 @@ func (self *Logger) Log(level int, format string, v ...interface{}) {
 	hour, min, sec := now.Clock()
 	fdate := []string{}
 
-	if self.format&FDATE != 0 {
+	if l.format&FDATE != 0 {
 		fdate = append(fdate, fmt.Sprintf("%04d/%02d/%02d", year, month, day))
 	}
-	if self.format&FTIME != 0 {
+	if l.format&FTIME != 0 {
 		if len(fdate) > 0 {
 			fdate = append(fdate, "-")
 		}
 		fdate = append(fdate, fmt.Sprintf("%02d:%02d:%02d", hour, min, sec))
 		var sdecs string
-		if self.format&FMILIS != 0 {
+		if l.format&FMILIS != 0 {
 			sdecs = fmt.Sprintf(".%.03d", now.Nanosecond()/1000000)
-		} else if self.format&FMICROS != 0 {
+		} else if l.format&FMICROS != 0 {
 			sdecs = fmt.Sprintf(".%.06d", now.Nanosecond()/1000)
-		} else if self.format&FNANOS != 0 {
+		} else if l.format&FNANOS != 0 {
 			sdecs = fmt.Sprintf(".%.09d", now.Nanosecond())
 		}
 		fdate = append(fdate, sdecs)
@@ -229,7 +229,7 @@ func (self *Logger) Log(level int, format string, v ...interface{}) {
 
 	// Formats message
 	usermsg := fmt.Sprintf(format, v...)
-	prefix := self.prefix
+	prefix := l.prefix
 	msg := fmt.Sprintf("%s:%s:%s:%s\n", strings.Join(fdate, ""), levelNames[level][:1], prefix, usermsg)
 
 	// Log event
@@ -243,11 +243,11 @@ func (self *Logger) Log(level int, format string, v ...interface{}) {
 	// Writes message to this logger and its ancestors.
 	mutex.Lock()
 	defer mutex.Unlock()
-	self.writeAll(&event)
+	l.writeAll(&event)
 
 	// Close all logger writers
 	if level == FATAL {
-		for _, w := range self.outputs {
+		for _, w := range l.outputs {
 			w.Close()
 		}
 		panic("LOG FATAL")
@@ -255,14 +255,14 @@ func (self *Logger) Log(level int, format string, v ...interface{}) {
 }
 
 // write message to this logger output and of all of its ancestors.
-func (self *Logger) writeAll(event *Event) {
+func (l *Logger) writeAll(event *Event) {
 
-	for _, w := range self.outputs {
+	for _, w := range l.outputs {
 		w.Write(event)
 		w.Sync()
 	}
-	if self.parent != nil {
-		self.parent.writeAll(event)
+	if l.parent != nil {
+		l.parent.writeAll(event)
 	}
 }
 
@@ -270,51 +270,66 @@ func (self *Logger) writeAll(event *Event) {
 // Functions for the Default Logger
 //
 
+// Log emits a log message with the specified level
 func Log(level int, format string, v ...interface{}) {
 
 	Default.Log(level, format, v...)
 }
 
+// SetLevel sets the current level of the default logger.
+// Only log messages with levels with the same or higher
+// priorities than the current level will be emitted.
 func SetLevel(level int) {
 
 	Default.SetLevel(level)
 }
 
+// SetLevelByName sets the current level of the default logger by level name:
+// debug|info|warn|error|fatal (case ignored.)
+// Only log messages with levels with the same or higher
+// priorities than the current level will be emitted.
 func SetLevelByName(lname string) {
 
 	Default.SetLevelByName(lname)
 }
 
+// SetFormat sets the date/time message format of the default logger.
 func SetFormat(format int) {
 
 	Default.SetFormat(format)
 }
 
+// AddWriter adds a writer to the current outputs of the default logger.
 func AddWriter(writer LoggerWriter) {
 
 	Default.AddWriter(writer)
 }
 
+// Debug emits a DEBUG level log message
 func Debug(format string, v ...interface{}) {
 
 	Default.Debug(format, v...)
 }
 
+// Info emits an INFO level log message
 func Info(format string, v ...interface{}) {
 
 	Default.Info(format, v...)
 }
 
+// Warn emits a WARN level log message
 func Warn(format string, v ...interface{}) {
 
 	Default.Warn(format, v...)
 }
 
+// Error emits an ERROR level log message
 func Error(format string, v ...interface{}) {
 
 	Default.Error(format, v...)
 }
 
+// Fatal emits a FATAL level log message
 func Fatal(format string, v ...interface{}) {
 
 	Default.Fatal(format, v...)