Daniel Salvadori 6 anni fa
parent
commit
d81117574a
4 ha cambiato i file con 30 aggiunte e 25 eliminazioni
  1. 8 8
      util/axis_helper.go
  2. 7 0
      util/helper/camera.go
  3. 8 9
      util/grid_helper.go
  4. 7 8
      util/normals_helper.go

+ 8 - 8
util/axis_helper.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 util
+package helper
 
 import (
 	"github.com/g3n/engine/geometry"
@@ -12,15 +12,15 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
-// AxisHelper is a visual representation of the three axes.
-type AxisHelper struct {
+// Axes is a visual representation of the three axes.
+type Axes struct {
 	graphic.Lines
 }
 
-// NewAxisHelper returns a pointer to a new AxisHelper object.
-func NewAxisHelper(size float32) *AxisHelper {
+// NewAxes returns a pointer to a new Axes object.
+func NewAxes(size float32) *Axes {
 
-	axis := new(AxisHelper)
+	axes := new(Axes)
 
 	// Create geometry with three orthogonal lines starting at the origin
 	geom := geometry.NewGeometry()
@@ -43,6 +43,6 @@ func NewAxisHelper(size float32) *AxisHelper {
 	mat := material.NewBasic()
 
 	// Initialize lines with the specified geometry and material
-	axis.Lines.Init(geom, mat)
-	return axis
+	axes.Lines.Init(geom, mat)
+	return axes
 }

+ 7 - 0
util/helper/camera.go

@@ -0,0 +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 helper
+
+// TODO: draw the camera frustum

+ 8 - 9
util/grid_helper.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 util
+package helper
 
 import (
 	"github.com/g3n/engine/geometry"
@@ -12,16 +12,15 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
-// GridHelper is a visual representation of a grid.
-type GridHelper struct {
+// Grid is a visual representation of a grid.
+type Grid struct {
 	graphic.Lines
 }
 
-// NewGridHelper creates and returns a pointer to a new grid help object
-// with the specified size and step.
-func NewGridHelper(size, step float32, color *math32.Color) *GridHelper {
+// NewGrid creates and returns a pointer to a new grid helper with the specified size and step.
+func NewGrid(size, step float32, color *math32.Color) *Grid {
 
-	grid := new(GridHelper)
+	grid := new(Grid)
 
 	half := size / 2
 	positions := math32.NewArrayF32(0, 0)
@@ -34,7 +33,7 @@ func NewGridHelper(size, step float32, color *math32.Color) *GridHelper {
 		)
 	}
 
-	// Creates geometry
+	// Create geometry
 	geom := geometry.NewGeometry()
 	geom.AddVBO(
 		gls.NewVBO(positions).
@@ -42,7 +41,7 @@ func NewGridHelper(size, step float32, color *math32.Color) *GridHelper {
 			AddAttrib(gls.VertexColor),
 	)
 
-	// Creates material
+	// Create material
 	mat := material.NewBasic()
 
 	// Initialize lines with the specified geometry and material

+ 7 - 8
util/normals_helper.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 util
+package helper
 
 import (
 	"github.com/g3n/engine/core"
@@ -13,20 +13,19 @@ import (
 	"github.com/g3n/engine/math32"
 )
 
-// NormalsHelper is the visual representation of the normals of a target object.
-type NormalsHelper struct {
+// Normals is the visual representation of the normals of a target object.
+type Normals struct {
 	graphic.Lines
 	size           float32
 	targetNode     *core.Node
 	targetGeometry *geometry.Geometry
 }
 
-// NewNormalsHelper creates, initializes and returns a pointer to Normals helper object.
-// This helper shows the surface normals of the specified object.
-func NewNormalsHelper(ig graphic.IGraphic, size float32, color *math32.Color, lineWidth float32) *NormalsHelper {
+// NewNormals creates a normals helper for the specified IGraphic, with the specified size, color, and lineWidth.
+func NewNormals(ig graphic.IGraphic, size float32, color *math32.Color, lineWidth float32) *Normals {
 
 	// Creates new Normals helper
-	nh := new(NormalsHelper)
+	nh := new(Normals)
 	nh.size = size
 
 	// Save the object to show the normals
@@ -57,7 +56,7 @@ func NewNormalsHelper(ig graphic.IGraphic, size float32, color *math32.Color, li
 
 // Update should be called in the render loop to
 // update the normals based on the target object.
-func (nh *NormalsHelper) Update() {
+func (nh *Normals) Update() {
 
 	var v1 math32.Vector3
 	var v2 math32.Vector3