graphic

package
v0.0.0-...-585686a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 12, 2017 License: BSD-2-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package graphic implements scene objects which have a graphic representation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AxisHelper

type AxisHelper struct {
	Lines
}

func NewAxisHelper

func NewAxisHelper(size float32) *AxisHelper

type Graphic

type Graphic struct {
	core.Node // Embedded Node
	// contains filtered or unexported fields
}

Graphic is a Node which has a visible representation in the scene. It has an associated geometry and one or more materials. It is the base type used by other graphics such as lines, line_strip, points and meshes.

func (*Graphic) AddGroupMaterial

func (gr *Graphic) AddGroupMaterial(igr IGraphic, imat material.IMaterial, gindex int)

Add group material

func (*Graphic) AddMaterial

func (gr *Graphic) AddMaterial(igr IGraphic, imat material.IMaterial, start, count int)

Add material for the specified subset of vertices. If the material applies to all vertices, start and count must be 0.

func (*Graphic) Dispose

func (gr *Graphic) Dispose()

Dispose overrides the embedded Node Dispose method

func (*Graphic) GetGeometry

func (gr *Graphic) GetGeometry() *geometry.Geometry

GetGeometry satisfies the IGraphic interface and returns a pointer to the geometry associated with this graphic

func (*Graphic) GetGraphic

func (gr *Graphic) GetGraphic() *Graphic

GetGraphic satisfies the IGraphic interface and returns pointer to the base Graphic

func (*Graphic) GetMaterial

func (gr *Graphic) GetMaterial(vpos int) material.IMaterial

GetMaterial returns the material associated with the specified vertex position

func (*Graphic) Init

func (gr *Graphic) Init(igeom geometry.IGeometry, mode uint32) *Graphic

Init initializes a Graphic type embedded in another type with the specified geometry and OpenGL mode.

func (*Graphic) Materials

func (gr *Graphic) Materials() []GraphicMaterial

Materials returns slice with this graphic materials

func (*Graphic) Renderable

func (gr *Graphic) Renderable() bool

Renderable satisfies the IGraphic interface and returns the renderable state of this graphic

func (*Graphic) SetRenderable

func (gr *Graphic) SetRenderable(state bool)

SetRenderable satisfies the IGraphic interface and sets the renderable state of this Graphic (default = true)

type GraphicMaterial

type GraphicMaterial struct {
	// contains filtered or unexported fields
}

GraphicMaterial specifies the material to be used for a subset of vertices from the Graphic geometry A Graphic object has at least one GraphicMaterial

func (*GraphicMaterial) GetMaterial

func (grmat *GraphicMaterial) GetMaterial() material.IMaterial

func (*GraphicMaterial) Render

func (grmat *GraphicMaterial) Render(gs *gls.GLS, rinfo *core.RenderInfo)

Render is called by the renderer to render this graphic material

type GridHelper

type GridHelper struct {
	Lines
}

func NewGridHelper

func NewGridHelper(size, step float32, color *math32.Color) *GridHelper

NewGridHelper creates and returns a pointer to a new grid help object with the specified size and step

type IGraphic

type IGraphic interface {
	core.INode
	GetGraphic() *Graphic
	GetGeometry() *geometry.Geometry
	Renderable() bool
	SetRenderable(bool)
	RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)
}

Interface for all Graphics

type LineStrip

type LineStrip struct {
	Graphic
	// contains filtered or unexported fields
}

func NewLineStrip

func NewLineStrip(igeom geometry.IGeometry, imat material.IMaterial) *LineStrip

NewLineStrip creates and returns a pointer to a new LineStrip graphic with the specified geometry and material

func (*LineStrip) Raycast

func (l *LineStrip) Raycast(rc *core.Raycaster, intersects *[]core.Intersect)

Raycast satisfies the INode interface and checks the intersections of this geometry with the specified raycaster

func (*LineStrip) RenderSetup

func (l *LineStrip) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)

RenderSetup is called by the engine before drawing this geometry

type Lines

type Lines struct {
	Graphic
	// contains filtered or unexported fields
}

Lines is a Graphic which is rendered as a collection of independent lines

func NewLines

func NewLines(igeom geometry.IGeometry, imat material.IMaterial) *Lines

func (*Lines) Init

func (l *Lines) Init(igeom geometry.IGeometry, imat material.IMaterial)

func (*Lines) Raycast

func (l *Lines) Raycast(rc *core.Raycaster, intersects *[]core.Intersect)

Raycast satisfies the INode interface and checks the intersections of this geometry with the specified raycaster

func (*Lines) RenderSetup

func (l *Lines) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)

RenderSetup is called by the engine before drawing this geometry

type Mesh

type Mesh struct {
	Graphic // Embedded graphic
	// contains filtered or unexported fields
}

func NewMesh

func NewMesh(igeom geometry.IGeometry, imat material.IMaterial) *Mesh

NewMesh creates and returns a pointer to a mesh with the specified geometry and material If the mesh has multi materials, the material specified here must be nil and the individual materials must be add using "AddMateria" or AddGroupMaterial"

func (*Mesh) AddGroupMaterial

func (m *Mesh) AddGroupMaterial(imat material.IMaterial, gindex int)

Add group material

func (*Mesh) AddMaterial

func (m *Mesh) AddMaterial(imat material.IMaterial, start, count int)

func (*Mesh) Init

func (m *Mesh) Init(igeom geometry.IGeometry, imat material.IMaterial)

func (*Mesh) Raycast

func (m *Mesh) Raycast(rc *core.Raycaster, intersects *[]core.Intersect)

Raycast checks intersections between this geometry and the specified raycaster and if any found appends it to the specified intersects array.

func (*Mesh) RenderSetup

func (m *Mesh) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)

RenderSetup is called by the engine before drawing the mesh geometry It is responsible to updating the current shader uniforms with the model matrices.

type NormalsHelper

type NormalsHelper struct {
	Lines
	// contains filtered or unexported fields
}

func NewNormalsHelper

func NewNormalsHelper(ig IGraphic, size float32, color *math32.Color, lineWidth float32) *NormalsHelper

NewNormalsHelper creates, initializes and returns a pointer to Normals helper object. This helper shows the normal vectors of the specified object.

func (*NormalsHelper) Update

func (nh *NormalsHelper) Update()

Update should be called in the render loop to update the normals from the target object

type Points

type Points struct {
	Graphic // Embedded graphic
	// contains filtered or unexported fields
}

func NewPoints

func NewPoints(igeom geometry.IGeometry, imat material.IMaterial) *Points

NewPoints creates and returns a graphic points object with the specified geometry and material.

func (*Points) Raycast

func (p *Points) Raycast(rc *core.Raycaster, intersects *[]core.Intersect)

Raycast satisfies the INode interface and checks the intersections of this geometry with the specified raycaster

func (*Points) RenderSetup

func (p *Points) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)

RenderSetup is called by the engine before rendering this graphic

type Skybox

type Skybox struct {
	Graphic // embedded graphic object
	// contains filtered or unexported fields
}

func NewSkybox

func NewSkybox(data SkyboxData) (*Skybox, error)

NewSkybox creates and returns a pointer to a skybox with the specified textures

func (*Skybox) RenderSetup

func (skybox *Skybox) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)

RenderSetup is called by the engine before drawing the skybox geometry It is responsible to updating the current shader uniforms with the model matrices.

type SkyboxData

type SkyboxData struct {
	DirAndPrefix string
	Extension    string
	Suffixes     [6]string
}

type Sprite

type Sprite struct {
	Graphic // Embedded graphic
	// contains filtered or unexported fields
}

func NewSprite

func NewSprite(width, height float32, imat material.IMaterial) *Sprite

NewSprite creates and returns a pointer to a sprite with the specified dimensions and material

func (*Sprite) Raycast

func (s *Sprite) Raycast(rc *core.Raycaster, intersects *[]core.Intersect)

Raycast checks intersections between this geometry and the specified raycaster and if any found appends it to the specified intersects array.

func (*Sprite) RenderSetup

func (s *Sprite) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL