danaugrs 7 년 전
부모
커밋
84132e511c
18개의 변경된 파일87개의 추가작업 그리고 91개의 파일을 삭제
  1. 0 1
      core/doc.go
  2. 1 2
      core/logger.go
  3. 1 1
      core/node.go
  4. 2 2
      graphic/graphic.go
  5. 2 2
      gui/folder.go
  6. 2 2
      gui/itemscroller.go
  7. 7 7
      gui/list.go
  8. 27 27
      gui/panel.go
  9. 1 1
      gui/scroller.go
  10. 9 9
      gui/style_dark.go
  11. 2 2
      gui/style_light.go
  12. 2 2
      gui/tree.go
  13. 0 1
      light/doc.go
  14. 5 5
      light/spot.go
  15. 1 1
      material/material.go
  16. 24 24
      renderer/renderer.go
  17. 1 1
      text/font.go
  18. 0 1
      texture/doc.go

+ 0 - 1
core/doc.go

@@ -4,4 +4,3 @@
 
 // Package core implements some basic types used by other packages.
 package core
-

+ 1 - 2
core/logger.go

@@ -1,9 +1,8 @@
 package core
 
 import (
-    "github.com/g3n/engine/util/logger"
+	"github.com/g3n/engine/util/logger"
 )
 
 // Package logger
 var log = logger.New("CORE", logger.Default)
-

+ 1 - 1
core/node.go

@@ -689,4 +689,4 @@ func (n *Node) updateMatrixWorldNoCheck(parentMatrixWorld *math32.Matrix4) {
 	for _, ichild := range n.children {
 		ichild.GetNode().updateMatrixWorldNoCheck(&n.matrixWorld)
 	}
-}
+}

+ 2 - 2
graphic/graphic.go

@@ -24,8 +24,8 @@ type Graphic struct {
 	renderable bool               // Renderable flag
 	cullable   bool               // Cullable flag
 
-	mvm        math32.Matrix4     // Cached ModelView matrix
-	mvpm       math32.Matrix4     // Cached ModelViewProjection matrix
+	mvm  math32.Matrix4 // Cached ModelView matrix
+	mvpm math32.Matrix4 // Cached ModelViewProjection matrix
 }
 
 // GraphicMaterial specifies the material to be used for

+ 2 - 2
gui/folder.go

@@ -22,8 +22,8 @@ type Folder struct {
 // FolderStyle contains the styling of a Folder.
 type FolderStyle struct {
 	PanelStyle
-	FgColor     math32.Color4
-	Icons       [2]string
+	FgColor math32.Color4
+	Icons   [2]string
 }
 
 // FolderStyles contains a FolderStyle for each valid GUI state.

+ 2 - 2
gui/itemscroller.go

@@ -405,7 +405,7 @@ func (s *ItemScroller) vRecalc() {
 			// Break when the view/content proportion becomes smaller than the minimum button size
 			totalHeight += item.TotalHeight()
 		}
-		s.vscroll.SetButtonSize(s.height * s.height/totalHeight)
+		s.vscroll.SetButtonSize(s.height * s.height / totalHeight)
 	}
 
 	// Items width
@@ -470,7 +470,7 @@ func (s *ItemScroller) hRecalc() {
 			// Break when the view/content proportion becomes smaller than the minimum button size
 			totalWidth += item.GetPanel().Width()
 		}
-		s.hscroll.SetButtonSize(s.width * s.width/totalWidth)
+		s.hscroll.SetButtonSize(s.width * s.width / totalWidth)
 	}
 
 	// Items height

+ 7 - 7
gui/list.go

@@ -10,13 +10,13 @@ import (
 
 // List represents a list GUI element
 type List struct {
-	ItemScroller         // Embedded scroller
-	styles   *ListStyles // Pointer to styles
-	single   bool        // Single selection flag (default is true)
-	focus    bool        // has keyboard focus
-	dropdown bool        // this is used as dropdown
-	keyNext  window.Key  // Code of key to select next item
-	keyPrev  window.Key  // Code of key to select previous item
+	ItemScroller             // Embedded scroller
+	styles       *ListStyles // Pointer to styles
+	single       bool        // Single selection flag (default is true)
+	focus        bool        // has keyboard focus
+	dropdown     bool        // this is used as dropdown
+	keyNext      window.Key  // Code of key to select next item
+	keyPrev      window.Key  // Code of key to select previous item
 }
 
 // ListItem encapsulates each item inserted into the list

+ 27 - 27
gui/panel.go

@@ -58,30 +58,30 @@ type IPanel interface {
 // and a content area. The content area can be associated with a texture
 // It is the building block of most GUI widgets.
 type Panel struct {
-	*graphic.Graphic                // Embedded graphic
-	root         *Root              // pointer to root container
-	width        float32            // external width in pixels
-	height       float32            // external height in pixels
-	mat          *material.Material // panel material
-	marginSizes  RectBounds         // external margin sizes in pixel coordinates
-	borderSizes  RectBounds         // border sizes in pixel coordinates
-	paddingSizes RectBounds         // padding sizes in pixel coordinates
-	content      Rect               // current content rectangle in pixel coordinates
-	pospix       math32.Vector3     // absolute position in pixels
-	posclip      math32.Vector3     // position in clip (NDC) coordinates
-	wclip        float32            // width in clip coordinates
-	hclip        float32            // height in clip coordinates
-	xmin         float32            // minimum absolute x this panel can use
-	xmax         float32            // maximum absolute x this panel can use
-	ymin             float32        // minimum absolute y this panel can use
-	ymax             float32        // maximum absolute y this panel can use
-	bounded          bool           // panel is bounded by its parent
-	enabled          bool           // enable event processing
-	cursorEnter      bool           // mouse enter dispatched
-	layout           ILayout        // current layout for children
-	layoutParams     interface{}    // current layout parameters used by container panel
-	uniMatrix        gls.Uniform    // model matrix uniform location cache
-	uniPanel         gls.Uniform    // panel parameters uniform location cache
+	*graphic.Graphic                    // Embedded graphic
+	root             *Root              // pointer to root container
+	width            float32            // external width in pixels
+	height           float32            // external height in pixels
+	mat              *material.Material // panel material
+	marginSizes      RectBounds         // external margin sizes in pixel coordinates
+	borderSizes      RectBounds         // border sizes in pixel coordinates
+	paddingSizes     RectBounds         // padding sizes in pixel coordinates
+	content          Rect               // current content rectangle in pixel coordinates
+	pospix           math32.Vector3     // absolute position in pixels
+	posclip          math32.Vector3     // position in clip (NDC) coordinates
+	wclip            float32            // width in clip coordinates
+	hclip            float32            // height in clip coordinates
+	xmin             float32            // minimum absolute x this panel can use
+	xmax             float32            // maximum absolute x this panel can use
+	ymin             float32            // minimum absolute y this panel can use
+	ymax             float32            // maximum absolute y this panel can use
+	bounded          bool               // panel is bounded by its parent
+	enabled          bool               // enable event processing
+	cursorEnter      bool               // mouse enter dispatched
+	layout           ILayout            // current layout for children
+	layoutParams     interface{}        // current layout parameters used by container panel
+	uniMatrix        gls.Uniform        // model matrix uniform location cache
+	uniPanel         gls.Uniform        // panel parameters uniform location cache
 	udata            struct {           // Combined uniform data 8 * vec4
 		bounds        math32.Vector4 // panel bounds in texture coordinates
 		borders       math32.Vector4 // panel borders in texture coordinates
@@ -108,7 +108,7 @@ type PanelStyle struct {
 // Many GUI components can be styled using BasicStyle or redeclared versions thereof (e.g. ButtonStyle)
 type BasicStyle struct {
 	PanelStyle
-	FgColor     math32.Color4
+	FgColor math32.Color4
 }
 
 const (
@@ -599,8 +599,8 @@ func (p *Panel) ContainsPosition(x, y float32) bool {
 // Unlike "ContainsPosition" is does not consider the panel margins.
 func (p *Panel) InsideBorders(x, y float32) bool {
 
-	if 	x < (p.pospix.X + p.marginSizes.Left) || x >= (p.pospix.X + p.width - p.marginSizes.Right) ||
-		y < (p.pospix.Y + p.marginSizes.Top) ||	y >= (p.pospix.Y + p.height - p.marginSizes.Bottom) {
+	if x < (p.pospix.X+p.marginSizes.Left) || x >= (p.pospix.X+p.width-p.marginSizes.Right) ||
+		y < (p.pospix.Y+p.marginSizes.Top) || y >= (p.pospix.Y+p.height-p.marginSizes.Bottom) {
 		return false
 	}
 	return true

+ 1 - 1
gui/scroller.go

@@ -604,4 +604,4 @@ func (s *Scroller) applyStyle(ss *ScrollerStyle) {
 	s.corner.ApplyStyle(&s.style.CornerPanel)
 
 	s.Update()
-}
+}

+ 9 - 9
gui/style_dark.go

@@ -39,12 +39,12 @@ func NewDarkStyle() *Style {
 	oneBounds := RectBounds{1, 1, 1, 1}
 	twoBounds := RectBounds{2, 2, 2, 2}
 
-	s.Color.BgDark = math32.Color4{43.0/256.0, 43.0/256.0, 43.0/256.0, 1}
-	s.Color.BgMed = math32.Color4{49.0/256.0, 51.0/256.0, 53.0/256.0, 1}
-	s.Color.BgNormal = math32.Color4{60.0/256.0, 63.0/256.0, 65.0/256.0, 1}
-	s.Color.BgOver = math32.Color4{70.0/256.0, 74.0/256.0, 77.0/256.0, 1}
-	s.Color.Highlight = math32.Color4{75.0/256.0, 110.0/256.0, 175.0/256.0, 1}
-	s.Color.Select = math32.Color4{13.0/256.0, 41.0/256.0, 62.0/256.0, 1}
+	s.Color.BgDark = math32.Color4{43.0 / 256.0, 43.0 / 256.0, 43.0 / 256.0, 1}
+	s.Color.BgMed = math32.Color4{49.0 / 256.0, 51.0 / 256.0, 53.0 / 256.0, 1}
+	s.Color.BgNormal = math32.Color4{60.0 / 256.0, 63.0 / 256.0, 65.0 / 256.0, 1}
+	s.Color.BgOver = math32.Color4{70.0 / 256.0, 74.0 / 256.0, 77.0 / 256.0, 1}
+	s.Color.Highlight = math32.Color4{75.0 / 256.0, 110.0 / 256.0, 175.0 / 256.0, 1}
+	s.Color.Select = math32.Color4{13.0 / 256.0, 41.0 / 256.0, 62.0 / 256.0, 1}
 	s.Color.Text = math32.Color4{1, 1, 1, 1}
 	s.Color.TextDis = math32.Color4{0.4, 0.4, 0.4, 1}
 
@@ -65,8 +65,8 @@ func NewDarkStyle() *Style {
 	s.Label.FontAttributes.DPI = 72
 	s.Label.FontAttributes.Hinting = text.HintingNone
 	s.Label.FontAttributes.LineSpacing = 1.0
-	s.Label.BgColor = math32.Color4{1,1,1, 0}
-	s.Label.FgColor = math32.Color4{1,1,1,1}
+	s.Label.BgColor = math32.Color4{1, 1, 1, 0}
+	s.Label.FgColor = math32.Color4{1, 1, 1, 1}
 
 	// Button styles
 	s.Button = ButtonStyles{}
@@ -122,7 +122,7 @@ func NewDarkStyle() *Style {
 	s.ScrollBar.Normal.BgColor = math32.Color4{0, 0, 0, 0.2}
 	s.ScrollBar.Normal.ButtonLength = 32
 	s.ScrollBar.Normal.Button = PanelStyle{
-		BgColor:     math32.Color4{0.8, 0.8, 0.8, 0.5},
+		BgColor: math32.Color4{0.8, 0.8, 0.8, 0.5},
 	}
 	s.ScrollBar.Over = s.ScrollBar.Normal
 	s.ScrollBar.Disabled = s.ScrollBar.Normal

+ 2 - 2
gui/style_light.go

@@ -59,8 +59,8 @@ func NewLightStyle() *Style {
 	s.Label.FontAttributes.DPI = 72
 	s.Label.FontAttributes.Hinting = text.HintingNone
 	s.Label.FontAttributes.LineSpacing = 1.0
-	s.Label.BgColor = math32.Color4{0,0,0,0}
-	s.Label.FgColor = math32.Color4{0,0,0,1}
+	s.Label.BgColor = math32.Color4{0, 0, 0, 0}
+	s.Label.FgColor = math32.Color4{0, 0, 0, 1}
 
 	// Button styles
 	s.Button = ButtonStyles{}

+ 2 - 2
gui/tree.go

@@ -30,8 +30,8 @@ type TreeNodeStyles struct {
 // TreeNodeStyle contains the styling of a TreeNode.
 type TreeNodeStyle struct {
 	PanelStyle
-	FgColor     math32.Color4
-	Icons       [2]string
+	FgColor math32.Color4
+	Icons   [2]string
 }
 
 // TreeNode is a tree node.

+ 0 - 1
light/doc.go

@@ -5,4 +5,3 @@
 // Package light contains common light types which can be
 // add to a 3D scene to illuminate it.
 package light
-

+ 5 - 5
light/spot.go

@@ -14,11 +14,11 @@ import (
 
 // Spot represents a spotlight
 type Spot struct {
-	core.Node                // Embedded node
-	color     math32.Color   // Light color
-	intensity float32        // Light intensity
-	uni       gls.Uniform    // Uniform location cache
-	udata     struct {       // Combined uniform data in 5 vec3:
+	core.Node              // Embedded node
+	color     math32.Color // Light color
+	intensity float32      // Light intensity
+	uni       gls.Uniform  // Uniform location cache
+	udata     struct {     // Combined uniform data in 5 vec3:
 		color          math32.Color   // Light color
 		position       math32.Vector3 // Light position
 		direction      math32.Vector3 // Light direction

+ 1 - 1
material/material.go

@@ -331,7 +331,7 @@ func (mat *Material) RenderSetup(gs *gls.GLS) {
 		samplerName, _ := tex.GetUniformNames()
 		uniIdx, _ := samplerCounts[samplerName]
 		tex.RenderSetup(gs, slotIdx, uniIdx)
-		samplerCounts[samplerName] = uniIdx+1
+		samplerCounts[samplerName] = uniIdx + 1
 	}
 }
 

+ 24 - 24
renderer/renderer.go

@@ -18,29 +18,29 @@ import (
 // Renderer renders a 3D scene and/or a 2D GUI on the current window.
 type Renderer struct {
 	gs           *gls.GLS
-	shaman       Shaman                      // Internal shader manager
-	stats        Stats                       // Renderer statistics
-	prevStats    Stats                       // Renderer statistics for previous frame
-	scene        core.INode                  // Node containing 3D scene to render
-	panelGui     gui.IPanel                  // Panel containing GUI to render
-	panel3D      gui.IPanel                  // Panel which contains the 3D scene
-	ambLights    []*light.Ambient            // Array of ambient lights for last scene
-	dirLights    []*light.Directional        // Array of directional lights for last scene
-	pointLights  []*light.Point              // Array of point
-	spotLights   []*light.Spot               // Array of spot lights for the scene
-	others       []core.INode                // Other nodes (audio, players, etc)
-	rgraphics    []*graphic.Graphic          // Array of rendered graphics
-	cgraphics    []*graphic.Graphic          // Array of rendered graphics
-	grmatsOpaque []*graphic.GraphicMaterial  // Array of rendered opaque graphic materials for scene
-	grmatsTransp []*graphic.GraphicMaterial  // Array of rendered transparent graphic materials for scene
-	rinfo        core.RenderInfo             // Preallocated Render info
-	specs        ShaderSpecs                 // Preallocated Shader specs
-	sortObjects  bool                        // Flag indicating whether objects should be sorted before rendering
-	redrawGui    bool                        // Flag indicating the gui must be redrawn completely
-	rendered     bool                        // Flag indicating if anything was rendered
-	panList      []gui.IPanel                // list of panels to render
-	frameBuffers int                         // Number of frame buffers
-	frameCount   int                         // Current number of frame buffers to write
+	shaman       Shaman                     // Internal shader manager
+	stats        Stats                      // Renderer statistics
+	prevStats    Stats                      // Renderer statistics for previous frame
+	scene        core.INode                 // Node containing 3D scene to render
+	panelGui     gui.IPanel                 // Panel containing GUI to render
+	panel3D      gui.IPanel                 // Panel which contains the 3D scene
+	ambLights    []*light.Ambient           // Array of ambient lights for last scene
+	dirLights    []*light.Directional       // Array of directional lights for last scene
+	pointLights  []*light.Point             // Array of point
+	spotLights   []*light.Spot              // Array of spot lights for the scene
+	others       []core.INode               // Other nodes (audio, players, etc)
+	rgraphics    []*graphic.Graphic         // Array of rendered graphics
+	cgraphics    []*graphic.Graphic         // Array of rendered graphics
+	grmatsOpaque []*graphic.GraphicMaterial // Array of rendered opaque graphic materials for scene
+	grmatsTransp []*graphic.GraphicMaterial // Array of rendered transparent graphic materials for scene
+	rinfo        core.RenderInfo            // Preallocated Render info
+	specs        ShaderSpecs                // Preallocated Shader specs
+	sortObjects  bool                       // Flag indicating whether objects should be sorted before rendering
+	redrawGui    bool                       // Flag indicating the gui must be redrawn completely
+	rendered     bool                       // Flag indicating if anything was rendered
+	panList      []gui.IPanel               // list of panels to render
+	frameBuffers int                        // Number of frame buffers
+	frameCount   int                        // Current number of frame buffers to write
 }
 
 // Stats describes how many object types were rendered.
@@ -317,7 +317,7 @@ func (r *Renderer) renderScene(iscene core.INode, icam camera.ICamera) error {
 		}
 
 		zSortGraphicMaterials(r.grmatsOpaque, false) // Sort opaque graphics front to back
-		zSortGraphicMaterials(r.grmatsTransp, true) // Sort transparent graphics back to front
+		zSortGraphicMaterials(r.grmatsTransp, true)  // Sort transparent graphics back to front
 	}
 
 	// Render other nodes (audio players, etc)

+ 1 - 1
text/font.go

@@ -290,7 +290,7 @@ func (c Canvas) DrawTextCaret(x, y int, text string, f *Font, line, col int) err
 			// Draw caret vertical line
 			caretH := int(f.attrib.PointSize) + 2
 			caretY := int(d.Dot.Y>>6) - int(f.attrib.PointSize) + 2
-			color := Color4RGBA(&math32.Color4{0,0,0,1}) // Hardcoded to black
+			color := Color4RGBA(&math32.Color4{0, 0, 0, 1}) // Hardcoded to black
 			for j := caretY; j < caretY+caretH; j++ {
 				c.RGBA.Set(x+width, j, color)
 			}

+ 0 - 1
texture/doc.go

@@ -5,4 +5,3 @@
 // Package texture contains several types of textures which
 // can be added to materials.
 package texture
-