danaugrs vor 7 Jahren
Ursprung
Commit
753095026f
53 geänderte Dateien mit 426 neuen und 286 gelöschten Zeilen
  1. 9 9
      audio/audio_file.go
  2. 1 0
      camera/perspective.go
  3. 1 0
      geometry/circle.go
  4. 1 0
      geometry/cylinder.go
  5. 7 6
      geometry/plane.go
  6. 2 0
      geometry/sphere.go
  7. 1 0
      gls/build.go
  8. 1 0
      gls/consts.go
  9. 1 0
      gls/glapi2go/template.go
  10. 1 0
      gls/gls.go
  11. 2 0
      graphic/axis_helper.go
  12. 4 3
      graphic/graphic.go
  13. 7 6
      graphic/grid_helper.go
  14. 2 0
      graphic/lines.go
  15. 1 0
      graphic/normals_helper.go
  16. 1 0
      graphic/points.go
  17. 1 0
      gui/button.go
  18. 1 1
      gui/chart.go
  19. 12 0
      gui/control_folder.go
  20. 5 5
      gui/dropdown.go
  21. 3 0
      gui/edit.go
  22. 3 0
      gui/folder.go
  23. 1 0
      gui/ilayout.go
  24. 1 0
      gui/image_button.go
  25. 2 2
      gui/imagelabel.go
  26. 9 6
      gui/list.go
  27. 2 1
      gui/style.go
  28. 4 1
      gui/window.go
  29. 1 0
      light/ambient.go
  30. 1 0
      light/spot.go
  31. 1 0
      loader/collada/animation.go
  32. 4 0
      loader/collada/collada.go
  33. 5 0
      loader/collada/common.go
  34. 2 2
      loader/collada/geometry.go
  35. 4 0
      loader/collada/library_animations.go
  36. 15 2
      loader/collada/library_effects.go
  37. 9 1
      loader/collada/library_geometries.go
  38. 5 2
      loader/collada/library_images.go
  39. 9 1
      loader/collada/library_lights.go
  40. 4 1
      loader/collada/library_materials.go
  41. 14 3
      loader/collada/library_visual_scenes.go
  42. 1 0
      loader/collada/scene.go
  43. 4 2
      material/material.go
  44. 147 147
      math32/color.go
  45. 40 31
      math32/frustum.go
  46. 4 10
      math32/math.go
  47. 51 35
      math32/triangle.go
  48. 3 1
      renderer/shaman.go
  49. 3 0
      text/atlas.go
  50. 6 3
      text/font.go
  51. 1 0
      texture/animator.go
  52. 1 1
      texture/doc.go
  53. 5 4
      texture/texture2D.go

+ 9 - 9
audio/audio_file.go

@@ -13,6 +13,7 @@ import (
 	"unsafe"
 )
 
+// AudioInfo represents the information associated to an audio file
 type AudioInfo struct {
 	Format     int     // OpenAl Format
 	Channels   int     // Number of channels
@@ -23,6 +24,7 @@ type AudioInfo struct {
 	TotalTime  float64 // Total time in seconds
 }
 
+// AudioFile represents an audio file
 type AudioFile struct {
 	wavef   *os.File  // Pointer to wave file opened filed (nil for vorbis)
 	vorbisf *ov.File  // Pointer to vorbis file structure (nil for wave)
@@ -131,26 +133,24 @@ func (af *AudioFile) Seek(pos uint) error {
 	return ov.PcmSeek(af.vorbisf, int64(pos))
 }
 
-// AudioInfo returns the audio info structure for this audio file
+// Info returns the audio info structure for this audio file
 func (af *AudioFile) Info() AudioInfo {
 
 	return af.info
 }
 
-// CurrenTime returns the current time in seconds for the current
-// file read position
+// CurrentTime returns the current time in seconds for the current file read position
 func (af *AudioFile) CurrentTime() float64 {
 
 	if af.vorbisf != nil {
 		pos, _ := ov.TimeTell(af.vorbisf)
 		return pos
-	} else {
-		pos, err := af.wavef.Seek(0, 1)
-		if err != nil {
-			return 0
-		}
-		return float64(pos) / float64(af.info.BytesSec)
 	}
+	pos, err := af.wavef.Seek(0, 1)
+	if err != nil {
+		return 0
+	}
+	return float64(pos) / float64(af.info.BytesSec)
 }
 
 // Looping returns the current looping state of this audio file

+ 1 - 0
camera/perspective.go

@@ -9,6 +9,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Perspective represents a perspective camera
 type Perspective struct {
 	Camera                     // Embedded camera
 	fov         float32        // field of view in degrees

+ 1 - 0
geometry/circle.go

@@ -10,6 +10,7 @@ import (
 	"math"
 )
 
+// Circle represents a circle geometry
 type Circle struct {
 	Geometry
 	Radius      float64

+ 1 - 0
geometry/cylinder.go

@@ -10,6 +10,7 @@ import (
 	"math"
 )
 
+// Cylinder represents a cylinder geometry
 type Cylinder struct {
 	Geometry
 	RadiusTop      float64

+ 7 - 6
geometry/plane.go

@@ -9,6 +9,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Plane represents a plane geometry
 type Plane struct {
 	Geometry
 	Width          float32
@@ -31,14 +32,14 @@ func NewPlane(width, height float32, widthSegments, heightSegments int) *Plane {
 	plane.WidthSegments = widthSegments
 	plane.HeightSegments = heightSegments
 
-	width_half := width / 2
-	height_half := height / 2
+	widthHalf := width / 2
+	heightHalf := height / 2
 	gridX := widthSegments
 	gridY := heightSegments
 	gridX1 := gridX + 1
 	gridY1 := gridY + 1
-	segment_width := width / float32(gridX)
-	segment_height := height / float32(gridY)
+	segmentWidth := width / float32(gridX)
+	segmentHeight := height / float32(gridY)
 
 	// Create buffers
 	positions := math32.NewArrayF32(0, 16)
@@ -48,9 +49,9 @@ func NewPlane(width, height float32, widthSegments, heightSegments int) *Plane {
 
 	// Generate plane vertices, vertices normals and vertices texture mappings.
 	for iy := 0; iy < gridY1; iy++ {
-		y := float32(iy)*segment_height - height_half
+		y := float32(iy)*segmentHeight - heightHalf
 		for ix := 0; ix < gridX1; ix++ {
-			x := float32(ix)*segment_width - width_half
+			x := float32(ix)*segmentWidth - widthHalf
 			positions.Append(float32(x), float32(-y), 0)
 			normals.Append(0, 0, 1)
 			uvs.Append(float32(float64(ix)/float64(gridX)), float32(float64(1)-(float64(iy)/float64(gridY))))

+ 2 - 0
geometry/sphere.go

@@ -10,6 +10,7 @@ import (
 	"math"
 )
 
+// Sphere represents a sphere geometry
 type Sphere struct {
 	Geometry
 	Radius         float64
@@ -21,6 +22,7 @@ type Sphere struct {
 	ThetaLength    float64
 }
 
+// NewSphere returns a pointer to a new Sphere geometry object
 func NewSphere(radius float64, widthSegments, heightSegments int, phiStart, phiLength, thetaStart, thetaLength float64) *Sphere {
 
 	s := new(Sphere)

+ 1 - 0
gls/build.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 gls
 
 // Generation of API files: glapi.c, glapi.h, consts.go

+ 1 - 0
gls/consts.go

@@ -1,6 +1,7 @@
 // This file was generated automatically by "glapi2go" and contains all
 // OpenGL constants specified by "#define GL_*" directives contained in
 // "glcorearb.h" for an specific OpenGL version converted to Go constants.
+
 package gls
 
 const (

+ 1 - 0
gls/glapi2go/template.go

@@ -336,6 +336,7 @@ const templCONSTS = `
 // This file was generated automatically by "glapi2go" and contains all
 // OpenGL constants specified by "#define GL_*" directives contained in
 // "glcorearb.h" for an specific OpenGL version converted to Go constants.
+
 package gls
 
 const (

+ 1 - 0
gls/gls.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 gls
 
 // #include <stdlib.h>

+ 2 - 0
graphic/axis_helper.go

@@ -11,10 +11,12 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// AxisHelper is the visual representation of the three axes
 type AxisHelper struct {
 	Lines
 }
 
+// NewAxisHelper returns a pointer to a new AxisHelper object
 func NewAxisHelper(size float32) *AxisHelper {
 
 	axis := new(AxisHelper)

+ 4 - 3
graphic/graphic.go

@@ -33,7 +33,7 @@ type GraphicMaterial struct {
 	igraphic IGraphic           // Graphic which contains this GraphicMaterial
 }
 
-// Interface for all Graphics
+// IGraphic is the interface for all Graphic objects
 type IGraphic interface {
 	core.INode
 	GetGraphic() *Graphic
@@ -101,7 +101,7 @@ func (gr *Graphic) Renderable() bool {
 	return gr.renderable
 }
 
-// Add material for the specified subset of vertices.
+// AddMaterial adds a material for the specified subset of vertices.
 // If the material applies to all vertices, start and count must be 0.
 func (gr *Graphic) AddMaterial(igr IGraphic, imat material.IMaterial, start, count int) {
 
@@ -114,7 +114,7 @@ func (gr *Graphic) AddMaterial(igr IGraphic, imat material.IMaterial, start, cou
 	gr.materials = append(gr.materials, gmat)
 }
 
-// Add group material
+// AddGroupMaterial adds a material for the specified geometry group
 func (gr *Graphic) AddGroupMaterial(igr IGraphic, imat material.IMaterial, gindex int) {
 
 	geom := gr.igeom.GetGeometry()
@@ -146,6 +146,7 @@ func (gr *Graphic) GetMaterial(vpos int) material.IMaterial {
 	return nil
 }
 
+// GetMaterial returns the material associated with the GraphicMaterial
 func (grmat *GraphicMaterial) GetMaterial() material.IMaterial {
 
 	return grmat.imat

+ 7 - 6
graphic/grid_helper.go

@@ -11,6 +11,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// GridHelper is the visual representation of a grid
 type GridHelper struct {
 	Lines
 }
@@ -21,14 +22,14 @@ func NewGridHelper(size, step float32, color *math32.Color) *GridHelper {
 
 	grid := new(GridHelper)
 
-	half_size := size / 2
+	half := size / 2
 	positions := math32.NewArrayF32(0, 0)
-	for i := -half_size; i <= half_size; i += step {
+	for i := -half; i <= half; i += step {
 		positions.Append(
-			-half_size, 0, i, color.R, color.G, color.B,
-			half_size, 0, i, color.R, color.G, color.B,
-			i, 0, -half_size, color.R, color.G, color.B,
-			i, 0, half_size, color.R, color.G, color.B,
+			-half, 0, i, color.R, color.G, color.B,
+			half, 0, i, color.R, color.G, color.B,
+			i, 0, -half, color.R, color.G, color.B,
+			i, 0, half, color.R, color.G, color.B,
 		)
 	}
 

+ 2 - 0
graphic/lines.go

@@ -18,6 +18,7 @@ type Lines struct {
 	uniMVP  gls.Uniform // Model view projection matrix uniform location cache
 }
 
+// Init initializes the Lines object and adds the specified material
 func (l *Lines) Init(igeom geometry.IGeometry, imat material.IMaterial) {
 
 	l.Graphic.Init(igeom, gls.LINES)
@@ -25,6 +26,7 @@ func (l *Lines) Init(igeom geometry.IGeometry, imat material.IMaterial) {
 	l.uniMVP.Init("MVP")
 }
 
+// NewLines returns a pointer to a new Lines object
 func NewLines(igeom geometry.IGeometry, imat material.IMaterial) *Lines {
 
 	l := new(Lines)

+ 1 - 0
graphic/normals_helper.go

@@ -12,6 +12,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// NormalsHelper is the visual representation of the normals of a target object
 type NormalsHelper struct {
 	Lines
 	size   float32

+ 1 - 0
graphic/points.go

@@ -12,6 +12,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Points represents a geometry containing only points
 type Points struct {
 	Graphic             // Embedded graphic
 	uniMVPM gls.Uniform // Model view projection matrix uniform location cache

+ 1 - 0
gui/button.go

@@ -21,6 +21,7 @@ import (
 
 ****************************************/
 
+// Button represents a button GUI element
 type Button struct {
 	*Panel                  // Embedded Panel
 	Label     *Label        // Label panel

+ 1 - 1
gui/chart.go

@@ -282,7 +282,7 @@ func (ch *Chart) SetRangeYauto(auto bool) {
 	ch.updateGraphs()
 }
 
-// Returns the current y range
+// RangeY returns the current y range
 func (ch *Chart) RangeY() (minY, maxY float32) {
 
 	return ch.minY, ch.maxY

+ 12 - 0
gui/control_folder.go

@@ -8,17 +8,20 @@ import (
 	"fmt"
 )
 
+// ControlFolder represents a folder with controls
 type ControlFolder struct {
 	Folder                      // Embedded folder
 	tree   Tree                 // control tree
 	styles *ControlFolderStyles // Pointer to styles
 }
 
+// ControlFolderStyles
 type ControlFolderStyles struct {
 	Folder *FolderStyles
 	Tree   *TreeStyles
 }
 
+// ControlFolderGroup
 type ControlFolderGroup struct {
 	control *ControlFolder
 	node    *TreeNode
@@ -48,21 +51,25 @@ func (f *ControlFolder) Initialize(text string, width float32) {
 	f.Folder.SetAlignRight(false)
 }
 
+// Clear clears the control folder's tree
 func (f *ControlFolder) Clear() {
 
 	f.tree.Clear()
 }
 
+// RemoveAt removes the IPanel at the specified position from the control folder's tree
 func (f *ControlFolder) RemoveAt(pos int) IPanel {
 
 	return f.tree.RemoveAt(pos)
 }
 
+// AddPanel adds an IPanel to the control folder's tree
 func (f *ControlFolder) AddPanel(pan IPanel) {
 
 	f.tree.Add(pan)
 }
 
+// AddCheckBox adds a checkbox to the control folder's tree
 func (f *ControlFolder) AddCheckBox(text string) *CheckRadio {
 
 	cb := NewCheckBox(text)
@@ -70,6 +77,7 @@ func (f *ControlFolder) AddCheckBox(text string) *CheckRadio {
 	return cb
 }
 
+// AddSlider adds a slider to the control folder's tree
 func (f *ControlFolder) AddSlider(text string, sf, v float32) *Slider {
 
 	cont, slider := f.newSlider(text, sf, v)
@@ -77,6 +85,7 @@ func (f *ControlFolder) AddSlider(text string, sf, v float32) *Slider {
 	return slider
 }
 
+// AddGroup adds a group to the control folder
 func (f *ControlFolder) AddGroup(text string) *ControlFolderGroup {
 
 	g := new(ControlFolderGroup)
@@ -98,6 +107,7 @@ func (f *ControlFolder) SetStyles(fs *ControlFolderStyles) {
 
 }
 
+// AddCheckBox adds a checkbox to the control folder group
 func (g *ControlFolderGroup) AddCheckBox(text string) *CheckRadio {
 
 	cb := NewCheckBox(text)
@@ -105,6 +115,7 @@ func (g *ControlFolderGroup) AddCheckBox(text string) *CheckRadio {
 	return cb
 }
 
+// AddSlider adds a slider to the control folder group
 func (g *ControlFolderGroup) AddSlider(text string, sf, v float32) *Slider {
 
 	cont, slider := g.control.newSlider(text, sf, v)
@@ -112,6 +123,7 @@ func (g *ControlFolderGroup) AddSlider(text string, sf, v float32) *Slider {
 	return slider
 }
 
+// AddPanel adds a panel to the control folder group
 func (g *ControlFolderGroup) AddPanel(pan IPanel) {
 
 	g.node.Add(pan)

+ 5 - 5
gui/dropdown.go

@@ -9,6 +9,7 @@ import (
 	"github.com/g3n/engine/window"
 )
 
+// DropDown represents a dropdown GUI element
 type DropDown struct {
 	Panel                        // Embedded panel
 	icon         *Label          // internal label with icon
@@ -22,10 +23,10 @@ type DropDown struct {
 	clickOut     bool
 }
 
-// DropDown list style
+// DropDownStyle
 type DropDownStyle BasicStyle
 
-// DropDown list styles
+// DropDownStyles
 type DropDownStyles struct {
 	Normal   DropDownStyle
 	Over     DropDownStyle
@@ -73,7 +74,7 @@ func NewDropDown(width float32, item *ImageLabel) *DropDown {
 	return dd
 }
 
-// Add add a list item at the end of the list
+// Add adds a list item at the end of the list
 func (dd *DropDown) Add(item *ImageLabel) {
 
 	dd.list.Add(item)
@@ -105,8 +106,7 @@ func (dd *DropDown) Len() int {
 	return dd.list.Len()
 }
 
-// Returns the currently selected item or nil if not item
-// was selected
+// Selected returns the currently selected item or nil if no item was selected
 func (dd *DropDown) Selected() *ImageLabel {
 
 	return dd.selItem

+ 3 - 0
gui/edit.go

@@ -12,6 +12,7 @@ import (
 	"time"
 )
 
+// Edit represents a text edit box GUI element
 type Edit struct {
 	Label              // Embedded label
 	MaxLength   int    // Maximum number of characters
@@ -26,6 +27,7 @@ type Edit struct {
 	styles      *EditStyles
 }
 
+// EditStyle
 type EditStyle struct {
 	Border      RectBounds
 	Paddings    RectBounds
@@ -36,6 +38,7 @@ type EditStyle struct {
 	HolderColor math32.Color4
 }
 
+// EditStyles
 type EditStyles struct {
 	Normal   EditStyle
 	Over     EditStyle

+ 3 - 0
gui/folder.go

@@ -8,6 +8,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Folder represents a folder GUI element
 type Folder struct {
 	Panel               // Embedded panel
 	label        Label  // Folder label
@@ -18,12 +19,14 @@ type Folder struct {
 	alignRight   bool
 }
 
+// FolderStyle
 type FolderStyle struct {
 	PanelStyle
 	FgColor     math32.Color4
 	Icons       [2]string
 }
 
+// FolderStyles
 type FolderStyles struct {
 	Normal   FolderStyle
 	Over     FolderStyle

+ 1 - 0
gui/ilayout.go

@@ -4,6 +4,7 @@
 
 package gui
 
+// ILayout is the interface for layouts
 type ILayout interface {
 	Recalc(ipan IPanel)
 }

+ 1 - 0
gui/image_button.go

@@ -9,6 +9,7 @@ import (
 	"github.com/g3n/engine/window"
 )
 
+// ImageButton represents an image button GUI element
 type ImageButton struct {
 	*Panel                                             // Embedded Panel
 	label       *Label                                 // Label panel

+ 2 - 2
gui/imagelabel.go

@@ -29,7 +29,7 @@ type ImageLabel struct {
 	icon  *Label // optional internal icon label
 }
 
-// ImageLabel style
+// ImageLabelStyle
 type ImageLabelStyle BasicStyle
 
 // NewImageLabel creates and returns a pointer to a new image label widget
@@ -203,7 +203,7 @@ func (il *ImageLabel) recalc() {
 	height := il.Panel.ContentHeight()
 
 	// Image or icon width
-	var imgWidth float32 = 0
+	var imgWidth float32
 	var spacing float32
 	if il.image != nil {
 		imgWidth = il.image.Width()

+ 9 - 6
gui/list.go

@@ -8,6 +8,7 @@ import (
 	"github.com/g3n/engine/window"
 )
 
+// List represents a list GUI element
 type List struct {
 	Scroller             // Embedded scroller
 	styles   *ListStyles // Pointer to styles
@@ -18,8 +19,7 @@ type List struct {
 	keyPrev  window.Key  // Code of key to select previous item
 }
 
-// All items inserted into the list are
-// encapsulated inside a ListItem
+// ListItem encapsulates each item inserted into the list
 type ListItem struct {
 	Panel               // Container panel
 	item        IPanel  // Original item
@@ -29,11 +29,13 @@ type ListItem struct {
 	list        *List   // Pointer to list
 }
 
+// ListStyles
 type ListStyles struct {
 	Scroller *ScrollerStyles
 	Item     *ListItemStyles
 }
 
+// ListItemStyles
 type ListItemStyles struct {
 	Normal      ListItemStyle
 	Over        ListItemStyle
@@ -42,9 +44,10 @@ type ListItemStyles struct {
 	SelHigh     ListItemStyle
 }
 
+// ListItemStyle
 type ListItemStyle BasicStyle
 
-// Event sent to list item child panel on resize
+// OnListItemResize is the identifier of the event dispatched when a ListItem's child panel is resized
 const OnListItemResize = "gui.OnListItemResize"
 
 // NewVList creates and returns a pointer to a new vertical list panel
@@ -190,7 +193,7 @@ func (li *List) Selected() []IPanel {
 	return sel
 }
 
-// Select selects or unselects the specified item
+// SetSelected selects or unselects the specified item
 func (li *List) SetSelected(item IPanel, state bool) {
 
 	for _, curr := range li.items {
@@ -495,14 +498,14 @@ func (litem *ListItem) onCursor(evname string, ev interface{}) {
 	}
 }
 
-// setSelected sets this item selected state
+// SetSelected sets this item selected state
 func (litem *ListItem) SetSelected(state bool) {
 
 	litem.selected = state
 	//litem.item.SetSelected2(state)
 }
 
-// setHighlighted sets this item selected state
+// SetHighlighted sets this item selected state
 func (litem *ListItem) SetHighlighted(state bool) {
 
 	litem.highlighted = state

+ 2 - 1
gui/style.go

@@ -8,7 +8,7 @@ import (
 	"github.com/g3n/engine/text"
 )
 
-// All styles
+// Style contains the styles for all GUI elements
 type Style struct {
 	Font          *text.Font
 	FontIcon      *text.Font
@@ -31,6 +31,7 @@ type Style struct {
 	TabBar        TabBarStyles
 }
 
+// States that a GUI element can be in
 const (
 	StyleOver = iota + 1
 	StyleFocus

+ 4 - 1
gui/window.go

@@ -29,6 +29,7 @@ import (
 
 *********************************************/
 
+// Window represents a window GUI element
 type Window struct {
 	Panel      // Embedded Panel
 	styles     *WindowStyles
@@ -41,6 +42,7 @@ type Window struct {
 	mouseY     float32
 }
 
+// WindowStyle
 type WindowStyle struct {
 	Border           RectBounds
 	Paddings         RectBounds
@@ -51,7 +53,7 @@ type WindowStyle struct {
 	TitleFgColor     math32.Color4
 }
 
-// All Window styles
+// WindowStyles
 type WindowStyles struct {
 	Normal   WindowStyle
 	Over     WindowStyle
@@ -263,6 +265,7 @@ func (w *Window) recalc() {
 	w.client.SetSize(width, height)
 }
 
+// WindowTitle represents the title bar of a Window
 type WindowTitle struct {
 	Panel   // Embedded panel
 	win     *Window

+ 1 - 0
light/ambient.go

@@ -10,6 +10,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Ambient represents an ambient light
 type Ambient struct {
 	core.Node              // Embedded node
 	color     math32.Color // Light color

+ 1 - 0
light/spot.go

@@ -12,6 +12,7 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
+// Spot represents a spotlight
 type Spot struct {
 	core.Node                // Embedded node
 	color     math32.Color   // Light color

+ 1 - 0
loader/collada/animation.go

@@ -56,6 +56,7 @@ func (at *AnimationTarget) SetLoop(loop bool) {
 	at.loop = loop
 }
 
+// SetStart sets the initial offset value
 func (at *AnimationTarget) SetStart(v float32) {
 
 	at.start = v

+ 4 - 0
loader/collada/collada.go

@@ -111,6 +111,7 @@ type Contributor struct {
 	SourceData    string
 }
 
+// Dump prints out information about the Contributor
 func (c *Contributor) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sContributor:\n", sIndent(indent))
@@ -148,6 +149,7 @@ type Asset struct {
 	UpAxis      string
 }
 
+// Dump prints out information about the Asset
 func (a *Asset) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sAsset:\n", sIndent(indent))
@@ -165,6 +167,7 @@ type Scene struct {
 	InstanceVisualScene *InstanceVisualScene
 }
 
+// Dump prints out information about the Scene
 func (s *Scene) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sScene:\n", sIndent(indent))
@@ -181,6 +184,7 @@ type InstanceVisualScene struct {
 	Url  string
 }
 
+// Dump prints out information about the InstanceVisualScene
 func (ivs *InstanceVisualScene) Dump(out io.Writer, indent int) {
 
 	if ivs == nil {

+ 5 - 0
loader/collada/common.go

@@ -25,6 +25,7 @@ type Source struct {
 	}
 }
 
+// Dump prints out information about the Source
 func (s *Source) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sSource id:%s name:%s\n", sIndent(indent), s.Id, s.Name)
@@ -49,6 +50,7 @@ type NameArray struct {
 	Data  []string
 }
 
+// Dump prints out information about the NameArray
 func (na *NameArray) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sNameArray id:%s count:%d\n", sIndent(indent), na.Id, na.Count)
@@ -65,6 +67,7 @@ type FloatArray struct {
 	Data  []float32
 }
 
+// Dump prints out information about the FloatArray
 func (fa *FloatArray) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sFloatArray id:%s count:%d\n", sIndent(indent), fa.Id, fa.Count)
@@ -82,6 +85,7 @@ type Accessor struct {
 	Params []Param
 }
 
+// Dump prints out information about the Accessor
 func (ac *Accessor) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sAccessor source:%s count:%d stride:%d\n",
@@ -100,6 +104,7 @@ type Param struct {
 	Type string
 }
 
+// Dump prints out information about the Param
 func (p *Param) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sParam name:%s type:%s\n", sIndent(indent), p.Name, p.Type)

+ 2 - 2
loader/collada/geometry.go

@@ -141,7 +141,7 @@ func newMeshPolylist(m *Mesh, pels []interface{}) (*geometry.Geometry, uint32, e
 
 	// Creates vertices attributes map for reusing indices
 	mVindex := make(map[[8]float32]uint32)
-	var index uint32 = 0
+	var index uint32
 	geomGroups := make([]geometry.Group, 0)
 	groupMatindex := 0
 	// For each Polylist
@@ -358,7 +358,7 @@ func newMeshLines(m *Mesh, ln *Lines) (*geometry.Geometry, uint32, error) {
 
 	mVindex := make(map[[3]float32]uint32)
 	inputCount := len(ln.Input)
-	var index uint32 = 0
+	var index uint32
 	for i := 0; i < len(ln.P); i += inputCount {
 		// Vertex position
 		var vx [3]float32

+ 4 - 0
loader/collada/library_animations.go

@@ -20,6 +20,7 @@ type LibraryAnimations struct {
 	Animation []*Animation
 }
 
+// Dump prints out information about the LibraryAnimations
 func (la *LibraryAnimations) Dump(out io.Writer, indent int) {
 
 	if la == nil {
@@ -43,6 +44,7 @@ type Animation struct {
 	Channel   []*Channel
 }
 
+// Dump prints out information about the Animation
 func (an *Animation) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sAnimation id:%s name:%s\n", sIndent(indent), an.Id, an.Name)
@@ -70,6 +72,7 @@ type Sampler struct {
 
 }
 
+// Dump prints out information about the Sampler
 func (sp *Sampler) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sSampler id:%s\n", sIndent(indent), sp.Id)
@@ -87,6 +90,7 @@ type Channel struct {
 	Target string
 }
 
+// Dump prints out information about the Channel
 func (ch *Channel) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sChannel source:%s target:%s\n", sIndent(indent), ch.Source, ch.Target)

+ 15 - 2
loader/collada/library_effects.go

@@ -12,7 +12,7 @@ import (
 )
 
 //
-// Library Effects
+// LibraryEffects
 //
 type LibraryEffects struct {
 	Id     string
@@ -21,6 +21,7 @@ type LibraryEffects struct {
 	Effect []*Effect
 }
 
+// Dump prints out information about the LibraryEffects
 func (le *LibraryEffects) Dump(out io.Writer, indent int) {
 
 	if le == nil {
@@ -42,6 +43,7 @@ type Effect struct {
 	Profile []interface{}
 }
 
+// Dump prints out information about the Effect
 func (ef *Effect) Dump(out io.Writer, indent int) {
 
 	fmt.Printf("%sEffect id:%s name:%s\n", sIndent(indent), ef.Id, ef.Name)
@@ -56,7 +58,7 @@ func (ef *Effect) Dump(out io.Writer, indent int) {
 }
 
 //
-// Profile COMMON
+// ProfileCOMMON
 //
 type ProfileCOMMON struct {
 	Id        string
@@ -70,6 +72,7 @@ type ProfileCOMMON struct {
 	}
 }
 
+// Dump prints out information about the ProfileCOMMON
 func (pc *ProfileCOMMON) Dump(out io.Writer, indent int) {
 
 	fmt.Printf("%sProfileCOMMON id:%s\n", sIndent(indent), pc.Id)
@@ -97,6 +100,7 @@ type Newparam struct {
 	ParameterType interface{}
 }
 
+// Dump prints out information about the Newparam
 func (np *Newparam) Dump(out io.Writer, indent int) {
 
 	fmt.Printf("%sNewparam sid:%s\n", sIndent(indent), np.Sid)
@@ -117,6 +121,7 @@ type Surface struct {
 	Init interface{}
 }
 
+// Dump prints out information about the Surface
 func (sf *Surface) Dump(out io.Writer, indent int) {
 
 	fmt.Printf("%sSurface type:%s\n", sIndent(indent), sf.Type)
@@ -134,6 +139,7 @@ type Sampler2D struct {
 	Source string
 }
 
+// Dump prints out information about the Sampler2D
 func (sp *Sampler2D) Dump(out io.Writer, indent int) {
 
 	fmt.Printf("%sSampler2D\n", sIndent(indent))
@@ -157,6 +163,7 @@ type Blinn struct {
 	IndexOfRefraction interface{}
 }
 
+// Dump prints out information about the Blinn
 func (bl *Blinn) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sBlinn\n", sIndent(indent))
@@ -215,6 +222,7 @@ type Phong struct {
 	IndexOfRefraction interface{}
 }
 
+// Dump prints out information about the Phong
 func (ph *Phong) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sPhong\n", sIndent(indent))
@@ -231,6 +239,7 @@ func (ph *Phong) Dump(out io.Writer, indent int) {
 	DumpFloatOrParam("IndexOfRefraction", ph.IndexOfRefraction, out, ind)
 }
 
+// DumpColorOrTexture prints out information about the Color or Texture
 func DumpColorOrTexture(name string, v interface{}, out io.Writer, indent int) {
 
 	if v == nil {
@@ -246,6 +255,7 @@ func DumpColorOrTexture(name string, v interface{}, out io.Writer, indent int) {
 	}
 }
 
+// DumpFloatOrParam prints out information about the Float or Param
 func DumpFloatOrParam(name string, v interface{}, out io.Writer, indent int) {
 
 	if v == nil {
@@ -268,6 +278,7 @@ type Color struct {
 	Data [4]float32
 }
 
+// Dump prints out information about the Color
 func (c *Color) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sColor sid:%s data:%v\n", sIndent(indent), c.Sid, c.Data)
@@ -281,6 +292,7 @@ type Float struct {
 	Data float32
 }
 
+// Dump prints out information about the Float
 func (f *Float) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sFloat sid:%s data:%v\n", sIndent(indent), f.Sid, f.Data)
@@ -294,6 +306,7 @@ type Texture struct {
 	Texcoord string
 }
 
+// Dump prints out information about the Texture
 func (t *Texture) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sTexture texture:%s texcoord:%v\n", sIndent(indent), t.Texture, t.Texcoord)

+ 9 - 1
loader/collada/library_geometries.go

@@ -12,13 +12,14 @@ import (
 )
 
 //
-// Library Geometries
+// LibraryGeometries
 //
 type LibraryGeometries struct {
 	Asset    *Asset
 	Geometry []*Geometry
 }
 
+// Dump prints out information about the LibraryGeometries
 func (lg *LibraryGeometries) Dump(out io.Writer, indent int) {
 
 	if lg == nil {
@@ -43,6 +44,7 @@ type Geometry struct {
 	GeometricElement interface{} // Geometry type object (Mesh|others)
 }
 
+// Dump prints out information about the Geometry
 func (g *Geometry) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sGeometry id:%s name:%s\n", sIndent(indent), g.Id, g.Name)
@@ -64,6 +66,7 @@ type Mesh struct {
 	PrimitiveElements []interface{} // Geometry primitives (polylist|others)
 }
 
+// Dump prints out information about the Mesh
 func (m *Mesh) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sMesh:\n", sIndent(indent))
@@ -91,6 +94,7 @@ type Vertices struct {
 	Input []Input
 }
 
+// Dump prints out information about the Vertices
 func (v *Vertices) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sVertices id:%s name:%s\n", sIndent(indent), v.Id, v.Name)
@@ -107,6 +111,7 @@ type Input struct {
 	Source   string // source URL
 }
 
+// Dump prints out information about the Input
 func (i *Input) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sInput semantic:%s source:%s\n", sIndent(indent), i.Semantic, i.Source)
@@ -124,6 +129,7 @@ type Polylist struct {
 	P        []int
 }
 
+// Dump prints out information about the Polylist
 func (pl *Polylist) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sPolylist name:%s count:%d material:%s\n", sIndent(indent), pl.Name, pl.Count, pl.Material)
@@ -167,6 +173,7 @@ type Lines struct {
 	P        []int
 }
 
+// Dump prints out information about the Lines
 func (ln *Lines) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sLines name:%s count:%d material:%s\n", sIndent(indent), ln.Name, ln.Count, ln.Material)
@@ -210,6 +217,7 @@ type Tristrips struct {
 	P        []int
 }
 
+// Dump prints out information about the Tristrips
 func (is *InputShared) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sInputShared offset:%d semantic:%s source:%s set:%d\n",

+ 5 - 2
loader/collada/library_images.go

@@ -11,7 +11,7 @@ import (
 )
 
 //
-// Library Images
+// LibraryImages
 //
 type LibraryImages struct {
 	Id    string
@@ -20,6 +20,7 @@ type LibraryImages struct {
 	Image []*Image
 }
 
+// Dump prints out information about the LibraryImages
 func (li *LibraryImages) Dump(out io.Writer, indent int) {
 
 	if li == nil {
@@ -44,6 +45,7 @@ type Image struct {
 	ImageSource interface{}
 }
 
+// Dump prints out information about the Image
 func (img *Image) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sImage id:%s name:%s\n", sIndent(indent), img.Id, img.Name)
@@ -55,12 +57,13 @@ func (img *Image) Dump(out io.Writer, indent int) {
 }
 
 //
-//
+// InitFrom
 //
 type InitFrom struct {
 	Uri string
 }
 
+// Dump prints out information about the InitFrom
 func (initf *InitFrom) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sInitFrom:%s\n", sIndent(indent), initf.Uri)

+ 9 - 1
loader/collada/library_lights.go

@@ -12,7 +12,7 @@ import (
 )
 
 //
-// Library Lights
+// LibraryLights
 //
 type LibraryLights struct {
 	Id    string
@@ -21,6 +21,7 @@ type LibraryLights struct {
 	Light []*Light
 }
 
+// Dump prints out information about the LibraryLights
 func (ll *LibraryLights) Dump(out io.Writer, indent int) {
 
 	if ll == nil {
@@ -43,6 +44,7 @@ type Light struct {
 	}
 }
 
+// Dump prints out information about the Light
 func (li *Light) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sLights id:%s name:%s\n", sIndent(indent), li.Id, li.Name)
@@ -68,6 +70,7 @@ type Ambient struct {
 	Color LightColor
 }
 
+// Dump prints out information about the Ambient
 func (amb *Ambient) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sAmbient\n", sIndent(indent))
@@ -82,6 +85,7 @@ type Directional struct {
 	Color LightColor
 }
 
+// Dump prints out information about the Directional
 func (dir *Directional) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sDirectional\n", sIndent(indent))
@@ -99,6 +103,7 @@ type Point struct {
 	QuadraticAttenuation *FloatValue
 }
 
+// Dump prints out information about the Point
 func (pl *Point) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sPoint\n", sIndent(indent))
@@ -121,6 +126,7 @@ type Spot struct {
 	FalloffExponent      *FloatValue
 }
 
+// Dump prints out information about the Spot
 func (sl *Spot) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sSpot\n", sIndent(indent))
@@ -141,6 +147,7 @@ type FloatValue struct {
 	Value float32
 }
 
+// Dump prints out information about the FloatValue
 func (fv *FloatValue) Dump(name string, out io.Writer, indent int) {
 
 	if fv == nil {
@@ -157,6 +164,7 @@ type LightColor struct {
 	Data [3]float32
 }
 
+// Dump prints out information about the LightColor
 func (lc *LightColor) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sColor sid:%s data:%v\n", sIndent(indent), lc.Sid, lc.Data)

+ 4 - 1
loader/collada/library_materials.go

@@ -11,7 +11,7 @@ import (
 )
 
 //
-// Library Materials
+// LibraryMaterials
 //
 type LibraryMaterials struct {
 	Id       string
@@ -20,6 +20,7 @@ type LibraryMaterials struct {
 	Material []*Material
 }
 
+// Dump prints out information about the LibraryMaterials
 func (lm *LibraryMaterials) Dump(out io.Writer, indent int) {
 
 	if lm == nil {
@@ -41,6 +42,7 @@ type Material struct {
 	InstanceEffect InstanceEffect
 }
 
+// Dump prints out information about the Material
 func (mat *Material) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sMaterial id:%s name:%s\n", sIndent(indent), mat.Id, mat.Name)
@@ -57,6 +59,7 @@ type InstanceEffect struct {
 	Url  string
 }
 
+// Dump prints out information about the InstanceEffect
 func (ie *InstanceEffect) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sInstanceEffect id:%s name:%s url:%s\n",

+ 14 - 3
loader/collada/library_visual_scenes.go

@@ -12,13 +12,14 @@ import (
 )
 
 //
-// Library Visual Scenes
+// LibraryVisualScenes
 //
 type LibraryVisualScenes struct {
 	Asset       *Asset
 	VisualScene []*VisualScene
 }
 
+// Dump prints out information about the LibraryVisualScenes
 func (lv *LibraryVisualScenes) Dump(out io.Writer, indent int) {
 
 	if lv == nil {
@@ -35,7 +36,7 @@ func (lv *LibraryVisualScenes) Dump(out io.Writer, indent int) {
 }
 
 //
-// A visual scene contain all the nodes of a visual scene
+// VisualScene contains all the nodes of a visual scene
 //
 type VisualScene struct {
 	Id   string
@@ -43,6 +44,7 @@ type VisualScene struct {
 	Node []*Node // Array of nodes
 }
 
+// Dump prints out information about the VisualScene
 func (vs *VisualScene) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sVisualScene id:%s name:%s\n", sIndent(indent), vs.Id, vs.Name)
@@ -52,7 +54,7 @@ func (vs *VisualScene) Dump(out io.Writer, indent int) {
 }
 
 //
-// Base Node is embedded in each node instance
+// Node is embedded in each node instance
 //
 type Node struct {
 	Id                     string
@@ -65,6 +67,7 @@ type Node struct {
 	Node                   []*Node // Array of children nodes
 }
 
+// Dump prints out information about the Node
 func (n *Node) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sNode id:%s name:%s sid:%s type:%s layer:%v\n",
@@ -101,6 +104,7 @@ type Matrix struct {
 	Data [16]float32
 }
 
+// Dump prints out information about the Matrix
 func (m *Matrix) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sMatrix sid:%s data:%v\n", sIndent(indent), m.Sid, m.Data)
@@ -114,6 +118,7 @@ type Rotate struct {
 	Data [4]float32
 }
 
+// Dump prints out information about the Rotate
 func (r *Rotate) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sRotate sid:%s data:%v\n", sIndent(indent), r.Sid, r.Data)
@@ -127,6 +132,7 @@ type Translate struct {
 	Data [3]float32
 }
 
+// Dump prints out information about the Translate
 func (t *Translate) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sTranslate sid:%s data:%v\n", sIndent(indent), t.Sid, t.Data)
@@ -140,6 +146,7 @@ type Scale struct {
 	Data [3]float32
 }
 
+// Dump prints out information about the Scale
 func (s *Scale) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sScale sid:%s data:%v\n", sIndent(indent), s.Sid, s.Data)
@@ -154,6 +161,7 @@ type InstanceGeometry struct {
 	BindMaterial *BindMaterial
 }
 
+// Dump prints out information about the InstanceGeometry
 func (ig *InstanceGeometry) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sInstanceGeometry url:%s name:%s\n", sIndent(indent), ig.Url, ig.Name)
@@ -172,6 +180,7 @@ type BindMaterial struct {
 	}
 }
 
+// Dump prints out information about the BindMaterial
 func (bm *BindMaterial) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sBindMaterial\n", sIndent(indent))
@@ -195,6 +204,7 @@ type InstanceMaterial struct {
 	BindVertexInput []BindVertexInput
 }
 
+// Dump prints out information about the InstanceMaterial
 func (im *InstanceMaterial) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sInstanceMaterial sid:%s name:%s target:%s symbol:%s\n",
@@ -222,6 +232,7 @@ type BindVertexInput struct {
 	InputSet      uint
 }
 
+// Dump prints out information about the BindVertexInput
 func (bvi *BindVertexInput) Dump(out io.Writer, indent int) {
 
 	fmt.Fprintf(out, "%sBindVertexInput semantic:%s InputSemantic:%s InputSet:%d\n",

+ 1 - 0
loader/collada/scene.go

@@ -14,6 +14,7 @@ import (
 	"strings"
 )
 
+// NewScene returns a new collada empty scene
 func (d *Decoder) NewScene() (core.INode, error) {
 
 	sc := d.dom.Scene

+ 4 - 2
material/material.go

@@ -11,9 +11,10 @@ import (
 	"github.com/g3n/engine/texture"
 )
 
-// Material visible side(s)
+// Side represents the material's visible side(s)
 type Side int
 
+// The face side(s) to be rendered. The non-rendered side will be culled to improve performance.
 const (
 	SideFront  Side = 0
 	SideBack   Side = 1
@@ -23,6 +24,7 @@ const (
 // Blending
 type Blending int
 
+// The various blending types
 const (
 	BlendingNone        Blending = 0
 	BlendingNormal      Blending = 1
@@ -32,7 +34,7 @@ const (
 	BlendingCustom      Blending = 5
 )
 
-// Use lights flags
+// UseLights flags
 type UseLights int
 
 const (

+ 147 - 147
math32/color.go

@@ -148,151 +148,151 @@ func IsColorName(name string) (Color, bool) {
 // mapColorNames maps standard web color names to a Color with
 // the standard web color's RGB component values
 var mapColorNames = map[string]Color{
-	"aliceblue":            Color{0.941, 0.973, 1.000},
-	"antiquewhite":         Color{0.980, 0.922, 0.843},
-	"aqua":                 Color{0.000, 1.000, 1.000},
-	"aquamarine":           Color{0.498, 1.000, 0.831},
-	"azure":                Color{0.941, 1.000, 1.000},
-	"beige":                Color{0.961, 0.961, 0.863},
-	"bisque":               Color{1.000, 0.894, 0.769},
-	"black":                Color{0.000, 0.000, 0.000},
-	"blanchedalmond":       Color{1.000, 0.922, 0.804},
-	"blue":                 Color{0.000, 0.000, 1.000},
-	"blueviolet":           Color{0.541, 0.169, 0.886},
-	"brown":                Color{0.647, 0.165, 0.165},
-	"burlywood":            Color{0.871, 0.722, 0.529},
-	"cadetblue":            Color{0.373, 0.620, 0.627},
-	"chartreuse":           Color{0.498, 1.000, 0.000},
-	"chocolate":            Color{0.824, 0.412, 0.118},
-	"coral":                Color{1.000, 0.498, 0.314},
-	"cornflowerblue":       Color{0.392, 0.584, 0.929},
-	"cornsilk":             Color{1.000, 0.973, 0.863},
-	"crimson":              Color{0.863, 0.078, 0.235},
-	"cyan":                 Color{0.000, 1.000, 1.000},
-	"darkblue":             Color{0.000, 0.000, 0.545},
-	"darkcyan":             Color{0.000, 0.545, 0.545},
-	"darkgoldenrod":        Color{0.722, 0.525, 0.043},
-	"darkgray":             Color{0.663, 0.663, 0.663},
-	"darkgreen":            Color{0.000, 0.392, 0.000},
-	"darkgrey":             Color{0.663, 0.663, 0.663},
-	"darkkhaki":            Color{0.741, 0.718, 0.420},
-	"darkmagenta":          Color{0.545, 0.000, 0.545},
-	"darkolivegreen":       Color{0.333, 0.420, 0.184},
-	"darkorange":           Color{1.000, 0.549, 0.000},
-	"darkorchid":           Color{0.600, 0.196, 0.800},
-	"darkred":              Color{0.545, 0.000, 0.000},
-	"darksalmon":           Color{0.914, 0.588, 0.478},
-	"darkseagreen":         Color{0.561, 0.737, 0.561},
-	"darkslateblue":        Color{0.282, 0.239, 0.545},
-	"darkslategray":        Color{0.184, 0.310, 0.310},
-	"darkslategrey":        Color{0.184, 0.310, 0.310},
-	"darkturquoise":        Color{0.000, 0.808, 0.820},
-	"darkviolet":           Color{0.580, 0.000, 0.827},
-	"deeppink":             Color{1.000, 0.078, 0.576},
-	"deepskyblue":          Color{0.000, 0.749, 1.000},
-	"dimgray":              Color{0.412, 0.412, 0.412},
-	"dimgrey":              Color{0.412, 0.412, 0.412},
-	"dodgerblue":           Color{0.118, 0.565, 1.000},
-	"firebrick":            Color{0.698, 0.133, 0.133},
-	"floralwhite":          Color{1.000, 0.980, 0.941},
-	"forestgreen":          Color{0.133, 0.545, 0.133},
-	"fuchsia":              Color{1.000, 0.000, 1.000},
-	"gainsboro":            Color{0.863, 0.863, 0.863},
-	"ghostwhite":           Color{0.973, 0.973, 1.000},
-	"gold":                 Color{1.000, 0.843, 0.000},
-	"goldenrod":            Color{0.855, 0.647, 0.125},
-	"gray":                 Color{0.502, 0.502, 0.502},
-	"green":                Color{0.000, 0.502, 0.000},
-	"greenyellow":          Color{0.678, 1.000, 0.184},
-	"grey":                 Color{0.502, 0.502, 0.502},
-	"honeydew":             Color{0.941, 1.000, 0.941},
-	"hotpink":              Color{1.000, 0.412, 0.706},
-	"indianred":            Color{0.804, 0.361, 0.361},
-	"indigo":               Color{0.294, 0.000, 0.510},
-	"ivory":                Color{1.000, 1.000, 0.941},
-	"khaki":                Color{0.941, 0.902, 0.549},
-	"lavender":             Color{0.902, 0.902, 0.980},
-	"lavenderblush":        Color{1.000, 0.941, 0.961},
-	"lawngreen":            Color{0.486, 0.988, 0.000},
-	"lemonchiffon":         Color{1.000, 0.980, 0.804},
-	"lightblue":            Color{0.678, 0.847, 0.902},
-	"lightcoral":           Color{0.941, 0.502, 0.502},
-	"lightcyan":            Color{0.878, 1.000, 1.000},
-	"lightgoldenrodyellow": Color{0.980, 0.980, 0.824},
-	"lightgray":            Color{0.827, 0.827, 0.827},
-	"lightgreen":           Color{0.565, 0.933, 0.565},
-	"lightgrey":            Color{0.827, 0.827, 0.827},
-	"lightpink":            Color{1.000, 0.714, 0.757},
-	"lightsalmon":          Color{1.000, 0.627, 0.478},
-	"lightseagreen":        Color{0.125, 0.698, 0.667},
-	"lightskyblue":         Color{0.529, 0.808, 0.980},
-	"lightslategray":       Color{0.467, 0.533, 0.600},
-	"lightslategrey":       Color{0.467, 0.533, 0.600},
-	"lightsteelblue":       Color{0.690, 0.769, 0.871},
-	"lightyellow":          Color{1.000, 1.000, 0.878},
-	"lime":                 Color{0.000, 1.000, 0.000},
-	"limegreen":            Color{0.196, 0.804, 0.196},
-	"linen":                Color{0.980, 0.941, 0.902},
-	"magenta":              Color{1.000, 0.000, 1.000},
-	"maroon":               Color{0.502, 0.000, 0.000},
-	"mediumaquamarine":     Color{0.400, 0.804, 0.667},
-	"mediumblue":           Color{0.000, 0.000, 0.804},
-	"mediumorchid":         Color{0.729, 0.333, 0.827},
-	"mediumpurple":         Color{0.576, 0.439, 0.859},
-	"mediumseagreen":       Color{0.235, 0.702, 0.443},
-	"mediumslateblue":      Color{0.482, 0.408, 0.933},
-	"mediumspringgreen":    Color{0.000, 0.980, 0.604},
-	"mediumturquoise":      Color{0.282, 0.820, 0.800},
-	"mediumvioletred":      Color{0.780, 0.082, 0.522},
-	"midnightblue":         Color{0.098, 0.098, 0.439},
-	"mintcream":            Color{0.961, 1.000, 0.980},
-	"mistyrose":            Color{1.000, 0.894, 0.882},
-	"moccasin":             Color{1.000, 0.894, 0.710},
-	"navajowhite":          Color{1.000, 0.871, 0.678},
-	"navy":                 Color{0.000, 0.000, 0.502},
-	"oldlace":              Color{0.992, 0.961, 0.902},
-	"olive":                Color{0.502, 0.502, 0.000},
-	"olivedrab":            Color{0.420, 0.557, 0.137},
-	"orange":               Color{1.000, 0.647, 0.000},
-	"orangered":            Color{1.000, 0.271, 0.000},
-	"orchid":               Color{0.855, 0.439, 0.839},
-	"palegoldenrod":        Color{0.933, 0.910, 0.667},
-	"palegreen":            Color{0.596, 0.984, 0.596},
-	"paleturquoise":        Color{0.686, 0.933, 0.933},
-	"palevioletred":        Color{0.859, 0.439, 0.576},
-	"papayawhip":           Color{1.000, 0.937, 0.835},
-	"peachpuff":            Color{1.000, 0.855, 0.725},
-	"peru":                 Color{0.804, 0.522, 0.247},
-	"pink":                 Color{1.000, 0.753, 0.796},
-	"plum":                 Color{0.867, 0.627, 0.867},
-	"powderblue":           Color{0.690, 0.878, 0.902},
-	"purple":               Color{0.502, 0.000, 0.502},
-	"red":                  Color{1.000, 0.000, 0.000},
-	"rosybrown":            Color{0.737, 0.561, 0.561},
-	"royalblue":            Color{0.255, 0.412, 0.882},
-	"saddlebrown":          Color{0.545, 0.271, 0.075},
-	"salmon":               Color{0.980, 0.502, 0.447},
-	"sandybrown":           Color{0.957, 0.643, 0.376},
-	"seagreen":             Color{0.180, 0.545, 0.341},
-	"seashell":             Color{1.000, 0.961, 0.933},
-	"sienna":               Color{0.627, 0.322, 0.176},
-	"silver":               Color{0.753, 0.753, 0.753},
-	"skyblue":              Color{0.529, 0.808, 0.922},
-	"slateblue":            Color{0.416, 0.353, 0.804},
-	"slategray":            Color{0.439, 0.502, 0.565},
-	"slategrey":            Color{0.439, 0.502, 0.565},
-	"snow":                 Color{1.000, 0.980, 0.980},
-	"springgreen":          Color{0.000, 1.000, 0.498},
-	"steelblue":            Color{0.275, 0.510, 0.706},
-	"tan":                  Color{0.824, 0.706, 0.549},
-	"teal":                 Color{0.000, 0.502, 0.502},
-	"thistle":              Color{0.847, 0.749, 0.847},
-	"tomato":               Color{1.000, 0.388, 0.278},
-	"turquoise":            Color{0.251, 0.878, 0.816},
-	"violet":               Color{0.933, 0.510, 0.933},
-	"wheat":                Color{0.961, 0.871, 0.702},
-	"white":                Color{1.000, 1.000, 1.000},
-	"whitesmoke":           Color{0.961, 0.961, 0.961},
-	"yellow":               Color{1.000, 1.000, 0.000},
-	"yellowgreen":          Color{0.604, 0.804, 0.196},
+	"aliceblue":            {0.941, 0.973, 1.000},
+	"antiquewhite":         {0.980, 0.922, 0.843},
+	"aqua":                 {0.000, 1.000, 1.000},
+	"aquamarine":           {0.498, 1.000, 0.831},
+	"azure":                {0.941, 1.000, 1.000},
+	"beige":                {0.961, 0.961, 0.863},
+	"bisque":               {1.000, 0.894, 0.769},
+	"black":                {0.000, 0.000, 0.000},
+	"blanchedalmond":       {1.000, 0.922, 0.804},
+	"blue":                 {0.000, 0.000, 1.000},
+	"blueviolet":           {0.541, 0.169, 0.886},
+	"brown":                {0.647, 0.165, 0.165},
+	"burlywood":            {0.871, 0.722, 0.529},
+	"cadetblue":            {0.373, 0.620, 0.627},
+	"chartreuse":           {0.498, 1.000, 0.000},
+	"chocolate":            {0.824, 0.412, 0.118},
+	"coral":                {1.000, 0.498, 0.314},
+	"cornflowerblue":       {0.392, 0.584, 0.929},
+	"cornsilk":             {1.000, 0.973, 0.863},
+	"crimson":              {0.863, 0.078, 0.235},
+	"cyan":                 {0.000, 1.000, 1.000},
+	"darkblue":             {0.000, 0.000, 0.545},
+	"darkcyan":             {0.000, 0.545, 0.545},
+	"darkgoldenrod":        {0.722, 0.525, 0.043},
+	"darkgray":             {0.663, 0.663, 0.663},
+	"darkgreen":            {0.000, 0.392, 0.000},
+	"darkgrey":             {0.663, 0.663, 0.663},
+	"darkkhaki":            {0.741, 0.718, 0.420},
+	"darkmagenta":          {0.545, 0.000, 0.545},
+	"darkolivegreen":       {0.333, 0.420, 0.184},
+	"darkorange":           {1.000, 0.549, 0.000},
+	"darkorchid":           {0.600, 0.196, 0.800},
+	"darkred":              {0.545, 0.000, 0.000},
+	"darksalmon":           {0.914, 0.588, 0.478},
+	"darkseagreen":         {0.561, 0.737, 0.561},
+	"darkslateblue":        {0.282, 0.239, 0.545},
+	"darkslategray":        {0.184, 0.310, 0.310},
+	"darkslategrey":        {0.184, 0.310, 0.310},
+	"darkturquoise":        {0.000, 0.808, 0.820},
+	"darkviolet":           {0.580, 0.000, 0.827},
+	"deeppink":             {1.000, 0.078, 0.576},
+	"deepskyblue":          {0.000, 0.749, 1.000},
+	"dimgray":              {0.412, 0.412, 0.412},
+	"dimgrey":              {0.412, 0.412, 0.412},
+	"dodgerblue":           {0.118, 0.565, 1.000},
+	"firebrick":            {0.698, 0.133, 0.133},
+	"floralwhite":          {1.000, 0.980, 0.941},
+	"forestgreen":          {0.133, 0.545, 0.133},
+	"fuchsia":              {1.000, 0.000, 1.000},
+	"gainsboro":            {0.863, 0.863, 0.863},
+	"ghostwhite":           {0.973, 0.973, 1.000},
+	"gold":                 {1.000, 0.843, 0.000},
+	"goldenrod":            {0.855, 0.647, 0.125},
+	"gray":                 {0.502, 0.502, 0.502},
+	"green":                {0.000, 0.502, 0.000},
+	"greenyellow":          {0.678, 1.000, 0.184},
+	"grey":                 {0.502, 0.502, 0.502},
+	"honeydew":             {0.941, 1.000, 0.941},
+	"hotpink":              {1.000, 0.412, 0.706},
+	"indianred":            {0.804, 0.361, 0.361},
+	"indigo":               {0.294, 0.000, 0.510},
+	"ivory":                {1.000, 1.000, 0.941},
+	"khaki":                {0.941, 0.902, 0.549},
+	"lavender":             {0.902, 0.902, 0.980},
+	"lavenderblush":        {1.000, 0.941, 0.961},
+	"lawngreen":            {0.486, 0.988, 0.000},
+	"lemonchiffon":         {1.000, 0.980, 0.804},
+	"lightblue":            {0.678, 0.847, 0.902},
+	"lightcoral":           {0.941, 0.502, 0.502},
+	"lightcyan":            {0.878, 1.000, 1.000},
+	"lightgoldenrodyellow": {0.980, 0.980, 0.824},
+	"lightgray":            {0.827, 0.827, 0.827},
+	"lightgreen":           {0.565, 0.933, 0.565},
+	"lightgrey":            {0.827, 0.827, 0.827},
+	"lightpink":            {1.000, 0.714, 0.757},
+	"lightsalmon":          {1.000, 0.627, 0.478},
+	"lightseagreen":        {0.125, 0.698, 0.667},
+	"lightskyblue":         {0.529, 0.808, 0.980},
+	"lightslategray":       {0.467, 0.533, 0.600},
+	"lightslategrey":       {0.467, 0.533, 0.600},
+	"lightsteelblue":       {0.690, 0.769, 0.871},
+	"lightyellow":          {1.000, 1.000, 0.878},
+	"lime":                 {0.000, 1.000, 0.000},
+	"limegreen":            {0.196, 0.804, 0.196},
+	"linen":                {0.980, 0.941, 0.902},
+	"magenta":              {1.000, 0.000, 1.000},
+	"maroon":               {0.502, 0.000, 0.000},
+	"mediumaquamarine":     {0.400, 0.804, 0.667},
+	"mediumblue":           {0.000, 0.000, 0.804},
+	"mediumorchid":         {0.729, 0.333, 0.827},
+	"mediumpurple":         {0.576, 0.439, 0.859},
+	"mediumseagreen":       {0.235, 0.702, 0.443},
+	"mediumslateblue":      {0.482, 0.408, 0.933},
+	"mediumspringgreen":    {0.000, 0.980, 0.604},
+	"mediumturquoise":      {0.282, 0.820, 0.800},
+	"mediumvioletred":      {0.780, 0.082, 0.522},
+	"midnightblue":         {0.098, 0.098, 0.439},
+	"mintcream":            {0.961, 1.000, 0.980},
+	"mistyrose":            {1.000, 0.894, 0.882},
+	"moccasin":             {1.000, 0.894, 0.710},
+	"navajowhite":          {1.000, 0.871, 0.678},
+	"navy":                 {0.000, 0.000, 0.502},
+	"oldlace":              {0.992, 0.961, 0.902},
+	"olive":                {0.502, 0.502, 0.000},
+	"olivedrab":            {0.420, 0.557, 0.137},
+	"orange":               {1.000, 0.647, 0.000},
+	"orangered":            {1.000, 0.271, 0.000},
+	"orchid":               {0.855, 0.439, 0.839},
+	"palegoldenrod":        {0.933, 0.910, 0.667},
+	"palegreen":            {0.596, 0.984, 0.596},
+	"paleturquoise":        {0.686, 0.933, 0.933},
+	"palevioletred":        {0.859, 0.439, 0.576},
+	"papayawhip":           {1.000, 0.937, 0.835},
+	"peachpuff":            {1.000, 0.855, 0.725},
+	"peru":                 {0.804, 0.522, 0.247},
+	"pink":                 {1.000, 0.753, 0.796},
+	"plum":                 {0.867, 0.627, 0.867},
+	"powderblue":           {0.690, 0.878, 0.902},
+	"purple":               {0.502, 0.000, 0.502},
+	"red":                  {1.000, 0.000, 0.000},
+	"rosybrown":            {0.737, 0.561, 0.561},
+	"royalblue":            {0.255, 0.412, 0.882},
+	"saddlebrown":          {0.545, 0.271, 0.075},
+	"salmon":               {0.980, 0.502, 0.447},
+	"sandybrown":           {0.957, 0.643, 0.376},
+	"seagreen":             {0.180, 0.545, 0.341},
+	"seashell":             {1.000, 0.961, 0.933},
+	"sienna":               {0.627, 0.322, 0.176},
+	"silver":               {0.753, 0.753, 0.753},
+	"skyblue":              {0.529, 0.808, 0.922},
+	"slateblue":            {0.416, 0.353, 0.804},
+	"slategray":            {0.439, 0.502, 0.565},
+	"slategrey":            {0.439, 0.502, 0.565},
+	"snow":                 {1.000, 0.980, 0.980},
+	"springgreen":          {0.000, 1.000, 0.498},
+	"steelblue":            {0.275, 0.510, 0.706},
+	"tan":                  {0.824, 0.706, 0.549},
+	"teal":                 {0.000, 0.502, 0.502},
+	"thistle":              {0.847, 0.749, 0.847},
+	"tomato":               {1.000, 0.388, 0.278},
+	"turquoise":            {0.251, 0.878, 0.816},
+	"violet":               {0.933, 0.510, 0.933},
+	"wheat":                {0.961, 0.871, 0.702},
+	"white":                {1.000, 1.000, 1.000},
+	"whitesmoke":           {0.961, 0.961, 0.961},
+	"yellow":               {1.000, 1.000, 0.000},
+	"yellowgreen":          {0.604, 0.804, 0.196},
 }

+ 40 - 31
math32/frustum.go

@@ -4,69 +4,74 @@
 
 package math32
 
+// Frustum represents a frustum
 type Frustum struct {
 	planes []Plane
 }
 
+// NewFrustum returns a pointer to a new Frustum object
 func NewFrustum(p0, p1, p2, p3, p4, p5 *Plane) *Frustum {
 
-	this := new(Frustum)
-	this.planes = make([]Plane, 6)
+	f := new(Frustum)
+	f.planes = make([]Plane, 6)
 	if p0 != nil {
-		this.planes[0] = *p0
+		f.planes[0] = *p0
 	}
 	if p1 != nil {
-		this.planes[1] = *p1
+		f.planes[1] = *p1
 	}
 	if p2 != nil {
-		this.planes[2] = *p2
+		f.planes[2] = *p2
 	}
 	if p3 != nil {
-		this.planes[3] = *p3
+		f.planes[3] = *p3
 	}
 	if p4 != nil {
-		this.planes[4] = *p4
+		f.planes[4] = *p4
 	}
 	if p5 != nil {
-		this.planes[5] = *p5
+		f.planes[5] = *p5
 	}
-	return this
+	return f
 }
 
-func (this *Frustum) Set(p0, p1, p2, p3, p4, p5 *Plane) *Frustum {
+// Set sets the frustum's planes
+func (f *Frustum) Set(p0, p1, p2, p3, p4, p5 *Plane) *Frustum {
 
 	if p0 != nil {
-		this.planes[0] = *p0
+		f.planes[0] = *p0
 	}
 	if p1 != nil {
-		this.planes[1] = *p1
+		f.planes[1] = *p1
 	}
 	if p2 != nil {
-		this.planes[2] = *p2
+		f.planes[2] = *p2
 	}
 	if p3 != nil {
-		this.planes[3] = *p3
+		f.planes[3] = *p3
 	}
 	if p4 != nil {
-		this.planes[4] = *p4
+		f.planes[4] = *p4
 	}
 	if p5 != nil {
-		this.planes[5] = *p5
+		f.planes[5] = *p5
 	}
-	return this
+	return f
 }
 
-func (this *Frustum) Copy(frustum *Frustum) *Frustum {
+// Copy modifies the receiver frustum to match the provided frustum
+func (f *Frustum) Copy(frustum *Frustum) *Frustum {
 
 	for i := 0; i < 6; i++ {
-		this.planes[i] = frustum.planes[i]
+		f.planes[i] = frustum.planes[i]
 	}
-	return this
+	return f
 }
 
-func (this *Frustum) SetFromMatrix(m *Matrix4) *Frustum {
+// SetFromMatrix sets the frustum's planes based on the specified Matrix4
+func (f *Frustum) SetFromMatrix(m *Matrix4) *Frustum {
 
-	planes := this.planes
+	planes := f.planes
 	me0 := m[0]
 	me1 := m[1]
 	me2 := m[2]
@@ -91,7 +96,7 @@ func (this *Frustum) SetFromMatrix(m *Matrix4) *Frustum {
 	planes[4].SetComponents(me3-me2, me7-me6, me11-me10, me15-me14).Normalize()
 	planes[5].SetComponents(me3+me2, me7+me6, me11+me10, me15+me14).Normalize()
 
-	return this
+	return f
 }
 
 /**
@@ -103,9 +108,10 @@ func (this *Frustum) IntersectsObject(geometry *core.Geometry) bool {
 }
 */
 
-func (this *Frustum) IntersectsSphere(sphere *Sphere) bool {
+// IntersectsSphere determines whether the specified sphere is intersecting the frustum
+func (f *Frustum) IntersectsSphere(sphere *Sphere) bool {
 
-	planes := this.planes
+	planes := f.planes
 	negRadius := -sphere.Radius
 
 	for i := 0; i < 6; i++ {
@@ -118,13 +124,14 @@ func (this *Frustum) IntersectsSphere(sphere *Sphere) bool {
 	return true
 }
 
-func (this *Frustum) IntersectsBox(box *Box3) bool {
+// IntersectsBox determines whether the specified box is intersecting the frustum
+func (f *Frustum) IntersectsBox(box *Box3) bool {
 
 	var p1 Vector3
 	var p2 Vector3
 
 	for i := 0; i < 6; i++ {
-		plane := &this.planes[i]
+		plane := &f.planes[i]
 		if plane.normal.X > 0 {
 			p1.X = box.Min.X
 		} else {
@@ -169,17 +176,19 @@ func (this *Frustum) IntersectsBox(box *Box3) bool {
 	return true
 }
 
-func (this *Frustum) ContainsPoint(point *Vector3) bool {
+// ContainsPoint determines whether the frustum contains the specified point
+func (f *Frustum) ContainsPoint(point *Vector3) bool {
 
 	for i := 0; i < 6; i++ {
-		if this.planes[i].DistanceToPoint(point) < 0 {
+		if f.planes[i].DistanceToPoint(point) < 0 {
 			return false
 		}
 	}
 	return true
 }
 
-func (this *Frustum) Clone() *Frustum {
+// Clone returns a pointer to a new Frustum object with the same planes as the original
+func (f *Frustum) Clone() *Frustum {
 
-	return NewFrustum(nil, nil, nil, nil, nil, nil).Copy(this)
+	return NewFrustum(nil, nil, nil, nil, nil, nil).Copy(f)
 }

+ 4 - 10
math32/math.go

@@ -18,19 +18,21 @@ const radianToDegreesFactor = 180.0 / math.Pi
 
 var Infinity = float32(math.Inf(1))
 
+// DegToRad converts a number from degrees to radians
 func DegToRad(degrees float32) float32 {
 
 	return degrees * degreeToRadiansFactor
 }
 
+// RadToDeg converts a number from radians to degrees
 func RadToDeg(radians float32) float32 {
 
 	return radians * radianToDegreesFactor
 }
 
+// Clamp clamps x to the provided closed interval [a, b]
 func Clamp(x, a, b float32) float32 {
 
-	// Clamp value to range <a, b>
 	if x < a {
 		return a
 	}
@@ -40,6 +42,7 @@ func Clamp(x, a, b float32) float32 {
 	return x
 }
 
+// ClampInt clamps x to the provided closed interval [a, b]
 func ClampInt(x, a, b int) int {
 
 	if x < a {
@@ -51,15 +54,6 @@ func ClampInt(x, a, b int) int {
 	return x
 }
 
-func ClampBotton(x, a float32) float32 {
-
-	// Clamp value to range <a, inf)
-	if x < a {
-		return a
-	}
-	return x
-}
-
 func Abs(v float32) float32 {
 	return float32(math.Abs(float64(v)))
 }

+ 51 - 35
math32/triangle.go

@@ -4,27 +4,30 @@
 
 package math32
 
+// Triangle represents a triangle of vertices
 type Triangle struct {
 	a Vector3
 	b Vector3
 	c Vector3
 }
 
+// New Triangle returns a pointer to a new Triangle object
 func NewTriangle(a, b, c *Vector3) *Triangle {
 
-	this := new(Triangle)
+	t := new(Triangle)
 	if a != nil {
-		this.a = *a
+		t.a = *a
 	}
 	if b != nil {
-		this.b = *b
+		t.b = *b
 	}
 	if c != nil {
-		this.c = *c
+		t.c = *c
 	}
-	return this
+	return t
 }
 
+// Normal returns the triangle's normal
 func Normal(a, b, c, optionalTarget *Vector3) *Vector3 {
 
 	var v0 Vector3
@@ -46,6 +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
 func BarycoordFromPoint(point, a, b, c, optionalTarget *Vector3) *Vector3 {
 
 	var v0 Vector3
@@ -87,6 +91,7 @@ func BarycoordFromPoint(point, a, b, c, optionalTarget *Vector3) *Vector3 {
 
 }
 
+// ContainsPoint returns whether a triangle contains a point
 func ContainsPoint(point, a, b, c *Vector3) bool {
 
 	var v1 Vector3
@@ -95,39 +100,44 @@ func ContainsPoint(point, a, b, c *Vector3) bool {
 	return (result.X >= 0) && (result.Y >= 0) && ((result.X + result.Y) <= 1)
 }
 
-func (this *Triangle) Set(a, b, c *Vector3) *Triangle {
+// Set sets the triangle's three vertices
+func (t *Triangle) Set(a, b, c *Vector3) *Triangle {
 
-	this.a = *a
-	this.b = *b
-	this.c = *c
-	return this
+	t.a = *a
+	t.b = *b
+	t.c = *c
+	return t
 }
 
-func (this *Triangle) SetFromPointsAndIndices(points []*Vector3, i0, i1, i2 int) *Triangle {
+// SetFromPointsAndIndices sets the triangle's vertices based on the specified points and indices
+func (t *Triangle) SetFromPointsAndIndices(points []*Vector3, i0, i1, i2 int) *Triangle {
 
-	this.a = *points[i0]
-	this.b = *points[i1]
-	this.c = *points[i2]
-	return this
+	t.a = *points[i0]
+	t.b = *points[i1]
+	t.c = *points[i2]
+	return t
 }
 
-func (this *Triangle) Copy(triangle *Triangle) *Triangle {
+// Copy modifies the receiver triangle to match the provided triangle
+func (t *Triangle) Copy(triangle *Triangle) *Triangle {
 
-	*this = *triangle
-	return this
+	*t = *triangle
+	return t
 }
 
-func (this *Triangle) Area() float32 {
+// Area returns the triangle's area
+func (t *Triangle) Area() float32 {
 
 	var v0 Vector3
 	var v1 Vector3
 
-	v0.SubVectors(&this.c, &this.b)
-	v1.SubVectors(&this.a, &this.b)
+	v0.SubVectors(&t.c, &t.b)
+	v1.SubVectors(&t.a, &t.b)
 	return v0.Cross(&v1).Length() * 0.5
 }
 
-func (this *Triangle) Midpoint(optionalTarget *Vector3) *Vector3 {
+// Midpoint returns the triangle's midpoint
+func (t *Triangle) Midpoint(optionalTarget *Vector3) *Vector3 {
 
 	var result *Vector3
 	if optionalTarget != nil {
@@ -135,15 +145,17 @@ func (this *Triangle) Midpoint(optionalTarget *Vector3) *Vector3 {
 	} else {
 		result = NewVector3(0, 0, 0)
 	}
-	return result.AddVectors(&this.a, &this.b).Add(&this.c).MultiplyScalar(1 / 3)
+	return result.AddVectors(&t.a, &t.b).Add(&t.c).MultiplyScalar(1 / 3)
 }
 
-func (this *Triangle) Normal(optionalTarget *Vector3) *Vector3 {
+// Normal returns the triangle's normal
+func (t *Triangle) Normal(optionalTarget *Vector3) *Vector3 {
 
-	return Normal(&this.a, &this.b, &this.c, optionalTarget)
+	return Normal(&t.a, &t.b, &t.c, optionalTarget)
 }
 
-func (this *Triangle) Plane(optionalTarget *Plane) *Plane {
+// Plane returns a Plane object aligned with the triangle
+func (t *Triangle) Plane(optionalTarget *Plane) *Plane {
 
 	var result *Plane
 	if optionalTarget != nil {
@@ -151,25 +163,29 @@ func (this *Triangle) Plane(optionalTarget *Plane) *Plane {
 	} else {
 		result = NewPlane(nil, 0)
 	}
-	return result.SetFromCoplanarPoints(&this.a, &this.b, &this.c)
+	return result.SetFromCoplanarPoints(&t.a, &t.b, &t.c)
 }
 
-func (this *Triangle) BarycoordFromPoint(point, optionalTarget *Vector3) *Vector3 {
+// BarycoordFromPoint returns the barycentric coordinates for the specified point
+func (t *Triangle) BarycoordFromPoint(point, optionalTarget *Vector3) *Vector3 {
 
-	return BarycoordFromPoint(point, &this.a, &this.b, &this.c, optionalTarget)
+	return BarycoordFromPoint(point, &t.a, &t.b, &t.c, optionalTarget)
 }
 
-func (this *Triangle) ContainsPoint(point *Vector3) bool {
+// ContainsPoint returns whether the triangle contains a point
+func (t *Triangle) ContainsPoint(point *Vector3) bool {
 
-	return ContainsPoint(point, &this.a, &this.b, &this.c)
+	return ContainsPoint(point, &t.a, &t.b, &t.c)
 }
 
-func (this *Triangle) Equals(triangle *Triangle) bool {
+// Equals returns whether the triangles are equal in all their vertices
+func (t *Triangle) Equals(triangle *Triangle) bool {
 
-	return triangle.a.Equals(&this.a) && triangle.b.Equals(&this.b) && triangle.c.Equals(&this.c)
+	return triangle.a.Equals(&t.a) && triangle.b.Equals(&t.b) && triangle.c.Equals(&t.c)
 }
 
-func (this *Triangle) Clone(triangle *Triangle) *Triangle {
+// Clone clones a triangle
+func (t *Triangle) Clone(triangle *Triangle) *Triangle {
 
-	return NewTriangle(nil, nil, nil).Copy(this)
+	return NewTriangle(nil, nil, nil).Copy(t)
 }

+ 3 - 1
renderer/shaman.go

@@ -36,11 +36,13 @@ type ShaderSpecs struct {
 	MatTexturesMax   int                // Current Number of material textures
 }
 
+// ProgSpecs represents a compiled shader program along with its specs
 type ProgSpecs struct {
 	program *gls.Program // program object
 	specs   ShaderSpecs  // associated specs
 }
 
+// Shaman is the shader manager
 type Shaman struct {
 	gs       *gls.GLS
 	includes map[string]string              // include files sources
@@ -162,7 +164,7 @@ func (sm *Shaman) SetProgram(s *ShaderSpecs) (bool, error) {
 	return true, nil
 }
 
-// Generates shader program from the specified specs
+// GenProgram generates shader program from the specified specs
 func (sm *Shaman) GenProgram(specs *ShaderSpecs) (*gls.Program, error) {
 
 	// Get info for the specified shader program

+ 3 - 0
text/atlas.go

@@ -14,6 +14,7 @@ import (
 	"unicode/utf8"
 )
 
+// CharInfo contains the information to locate a character in an Atlas
 type CharInfo struct {
 	X      int // Position X in pixels in the sheet image from left to right
 	Y      int // Position Y in pixels in the sheet image from top to bottom
@@ -26,6 +27,7 @@ type CharInfo struct {
 	RepeatY float32
 }
 
+// Atlas represents an image containing characters and the information about their location in the image
 type Atlas struct {
 	Chars   []CharInfo
 	Image   *image.RGBA
@@ -34,6 +36,7 @@ type Atlas struct {
 	Descent int // Distance from the bottom of a line to its baseline
 }
 
+// NewAtlas returns a pointer to a new Atlas object
 func NewAtlas(font *Font, first, last rune) *Atlas {
 
 	a := new(Atlas)

+ 6 - 3
text/font.go

@@ -17,6 +17,7 @@ import (
 	"strings"
 )
 
+// Font represents a TrueType font
 type Font struct {
 	ttf         *truetype.Font
 	face        font.Face
@@ -31,6 +32,7 @@ type Font struct {
 	changed     bool
 }
 
+// Font hinting types
 const (
 	HintingNone     = font.HintingNone
 	HintingVertical = font.HintingVertical
@@ -138,7 +140,7 @@ func (f *Font) SetFgColor4(color *math32.Color4) {
 	f.fg = image.NewUniform(Color4NRGBA(color))
 }
 
-// FgColor returns the current foreground color
+// FgColor4 returns the current foreground color
 func (f *Font) FgColor4() math32.Color4 {
 
 	return f.fgColor
@@ -155,14 +157,14 @@ func (f *Font) SetBgColor(color *math32.Color) {
 	f.bg = image.NewUniform(Color4NRGBA(&f.fgColor))
 }
 
-// SetBgColor sets the current background color of the font
+// SetBgColor4 sets the current background color of the font
 func (f *Font) SetBgColor4(color *math32.Color4) {
 
 	f.bgColor = *color
 	f.bg = image.NewUniform(Color4NRGBA(color))
 }
 
-// BgColor returns the current background color
+// BgColor4 returns the current background color
 func (f *Font) BgColor4() math32.Color4 {
 
 	return f.bgColor
@@ -201,6 +203,7 @@ func (f *Font) MeasureText(text string) (int, int) {
 	return width, height
 }
 
+// Metrics returns the font metrics
 func (f *Font) Metrics() font.Metrics {
 
 	f.updateFace()

+ 1 - 0
texture/animator.go

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

+ 1 - 1
texture/doc.go

@@ -2,7 +2,7 @@
 // Use of this source code is governed by a BSD-style
 // license that can be found in the LICENSE file.
 
-// Package textures contains several types of texture which
+// Package texture contains several types of textures which
 // can be added to materials.
 package texture
 

+ 5 - 4
texture/texture2D.go

@@ -17,6 +17,7 @@ import (
 	"github.com/g3n/engine/gls"
 )
 
+// Texture2D represents a texture
 type Texture2D struct {
 	gs           *gls.GLS    // Pointer to OpenGL state
 	refcount     int         // Current number of references
@@ -94,7 +95,7 @@ func NewTexture2DFromRGBA(rgba *image.RGBA) *Texture2D {
 	return t
 }
 
-// NewFromData creates a new texture from data
+// NewTexture2DFromData creates a new texture from data
 func NewTexture2DFromData(width, height int, format int, formatType, iformat int, data interface{}) *Texture2D {
 
 	t := newTexture2D()
@@ -179,9 +180,9 @@ func (t *Texture2D) Visible() bool {
 
 	if t.udata.visible == 0 {
 		return false
-	} else {
-		return true
 	}
+
+	return true
 }
 
 // SetMagFilter sets the filter to be applied when the texture element
@@ -290,7 +291,7 @@ func DecodeImage(imgfile string) (*image.RGBA, error) {
 	return rgba, nil
 }
 
-// Called by material render setup
+// RenderSetup is called by the material render setup
 func (t *Texture2D) RenderSetup(gs *gls.GLS, idx int) {
 
 	// One time initialization