g2d

package
v0.0.0-...-a0ccc90 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2022 License: BSD-2-Clause Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsCCW

func IsCCW(v0 V2d, v1 V2d, v2 V2d) bool

func IsPointInside

func IsPointInside(p V2d, v0 V2d, v1 V2d, v2 V2d) bool

func NewShaderFor2DAxes

func NewShaderFor2DAxes(rc gigl.GLRenderingContext) gigl.GLShader

func NewShaderForInstancePoseColor

func NewShaderForInstancePoseColor(rc gigl.GLRenderingContext) gigl.GLShader

func NewShaderForMaterialColors

func NewShaderForMaterialColors(rc gigl.GLRenderingContext) gigl.GLShader

func NewShaderForMaterialTexture

func NewShaderForMaterialTexture(rc gigl.GLRenderingContext) gigl.GLShader

func SelectPoseByWorldXY

func SelectPoseByWorldXY(sobj *SceneObject)

Types

type BBox

type BBox [2][2]float32

func NewBBox

func NewBBox(minx float32, miny float32, maxx float32, maxy float32) *BBox

func NewBBoxEmpty

func NewBBoxEmpty() *BBox

func (*BBox) AddPoint

func (b *BBox) AddPoint(p *[2]float32)

func (*BBox) Center

func (b *BBox) Center() [2]float32

func (*BBox) Height

func (b *BBox) Height() float32

func (*BBox) IsEmpty

func (b *BBox) IsEmpty() bool

func (*BBox) IsIncludingPoint

func (b *BBox) IsIncludingPoint(v *V2d) bool

func (*BBox) Merge

func (b *BBox) Merge(b2 *BBox) *BBox

func (*BBox) Shape

func (b *BBox) Shape() [2]float32

func (*BBox) Width

func (b *BBox) Width() float32

type Camera

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

func NewCamera

func NewCamera(wh_aspect_ratio [2]int, fov_in_clipwidth float32, zoom float32) *Camera

func (*Camera) ApplyBoundingBox

func (self *Camera) ApplyBoundingBox(position bool, zoomlevel bool) *Camera

func (*Camera) IsPointVisible

func (self *Camera) IsPointVisible(wxy [2]float32) bool

func (*Camera) ProjectWorldToCanvas

func (self *Camera) ProjectWorldToCanvas(wxy [2]float32) [2]int

func (*Camera) ProjectWorldToClip

func (self *Camera) ProjectWorldToClip(wxy [2]float32) [2]float32

func (*Camera) Rotate

func (self *Camera) Rotate(angle_in_degree float32) *Camera

func (*Camera) SetAspectRatio

func (self *Camera) SetAspectRatio(width int, height int) *Camera

func (*Camera) SetBoundingBox

func (self *Camera) SetBoundingBox(bbox [2][2]float32) *Camera

func (*Camera) SetFov

func (self *Camera) SetFov(fov float32) *Camera

func (*Camera) SetPose

func (self *Camera) SetPose(cx float32, cy float32, angle_in_degree float32) *Camera

func (*Camera) SetZoom

func (self *Camera) SetZoom(zoom float32) *Camera

func (*Camera) Summary

func (self *Camera) Summary() string

func (*Camera) Translate

func (self *Camera) Translate(tx float32, ty float32) *Camera

func (*Camera) UnprojectCanvasDeltaToWorld

func (self *Camera) UnprojectCanvasDeltaToWorld(deltaxy [2]int) [2]float32

func (*Camera) UnprojectCanvasToWorld

func (self *Camera) UnprojectCanvasToWorld(canvasxy [2]int) [2]float32

type Geometry

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

func NewGeometry

func NewGeometry() *Geometry

func NewGeometryArrow

func NewGeometryArrow() *Geometry

func NewGeometryArrowHead

func NewGeometryArrowHead() *Geometry

func NewGeometryOrigin

func NewGeometryOrigin() *Geometry

func NewGeometryPolygon

func NewGeometryPolygon(n int, radius float32, starting_angle_in_degree float32) *Geometry

func NewGeometryRectangle

func NewGeometryRectangle(size float32) *Geometry

func NewGeometryTriangle

func NewGeometryTriangle(size float32) *Geometry

func (*Geometry) AddEdge

func (self *Geometry) AddEdge(edge []uint32) uint32

func (*Geometry) AddFace

func (self *Geometry) AddFace(face []uint32) uint32

func (*Geometry) AddTextureUV

func (self *Geometry) AddTextureUV(tuv []float32) *Geometry

func (*Geometry) AddVertex

func (self *Geometry) AddVertex(coords [2]float32) uint32

func (*Geometry) AppyMatrix

func (self *Geometry) AppyMatrix(matrix *common.Matrix3) *Geometry

func (*Geometry) BuildDataBuffers

func (self *Geometry) BuildDataBuffers(for_points bool, for_lines bool, for_faces bool)

func (*Geometry) BuildDataBuffersForWireframe

func (self *Geometry) BuildDataBuffersForWireframe()

func (*Geometry) Clear

func (self *Geometry) Clear(geom bool, data_buf bool, webgl_buf bool) *Geometry

func (*Geometry) GetIdxBuffer

func (self *Geometry) GetIdxBuffer(mode int) []uint32

func (*Geometry) GetIdxBufferCount

func (self *Geometry) GetIdxBufferCount(mode int) int

func (*Geometry) GetVtxBuffer

func (self *Geometry) GetVtxBuffer(draw_mode int) []float32

func (*Geometry) GetVtxBufferInfo

func (self *Geometry) GetVtxBufferInfo(draw_mode int) [5]int

func (*Geometry) HasTextureFor

func (self *Geometry) HasTextureFor(mode string) bool

func (*Geometry) IsDataBufferReady

func (self *Geometry) IsDataBufferReady() bool

func (*Geometry) IsVtxBufferRebuiltForFaces

func (self *Geometry) IsVtxBufferRebuiltForFaces() bool

func (*Geometry) Merge

func (self *Geometry) Merge(g *Geometry) *Geometry

func (*Geometry) Rotate

func (self *Geometry) Rotate(angle_in_degree float32) *Geometry

func (*Geometry) Scale

func (self *Geometry) Scale(sx float32, sy float32) *Geometry

func (*Geometry) SetEdges

func (self *Geometry) SetEdges(edges [][]uint32) *Geometry

func (*Geometry) SetFaces

func (self *Geometry) SetFaces(faces [][]uint32) *Geometry

func (*Geometry) SetTextureUVs

func (self *Geometry) SetTextureUVs(tuvs [][]float32) *Geometry

func (*Geometry) SetVertices

func (self *Geometry) SetVertices(vertices [][2]float32) *Geometry

func (*Geometry) String

func (self *Geometry) String() string

func (*Geometry) Summary

func (self *Geometry) Summary() string

func (*Geometry) Translate

func (self *Geometry) Translate(tx float32, ty float32) *Geometry

type MaterialAlphabetTexture

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

func NewMaterialAlphabetTexture

func NewMaterialAlphabetTexture(fontfamily string, fontsize int, color string, outlined bool) *MaterialAlphabetTexture

func (*MaterialAlphabetTexture) GetAlaphabetCharacterIndex

func (self *MaterialAlphabetTexture) GetAlaphabetCharacterIndex(c rune) int

func (*MaterialAlphabetTexture) GetAlaphabetCharacterWH

func (self *MaterialAlphabetTexture) GetAlaphabetCharacterWH(scale float32) [2]float32

func (*MaterialAlphabetTexture) GetAlaphabetLength

func (self *MaterialAlphabetTexture) GetAlaphabetLength() int

func (*MaterialAlphabetTexture) GetAlphabetString

func (self *MaterialAlphabetTexture) GetAlphabetString() string

func (*MaterialAlphabetTexture) GetFontColor

func (self *MaterialAlphabetTexture) GetFontColor() string

func (*MaterialAlphabetTexture) GetFontFamily

func (self *MaterialAlphabetTexture) GetFontFamily() string

func (*MaterialAlphabetTexture) GetFontOutlined

func (self *MaterialAlphabetTexture) GetFontOutlined() bool

func (*MaterialAlphabetTexture) GetFontSize

func (self *MaterialAlphabetTexture) GetFontSize() int

func (*MaterialAlphabetTexture) GetTexture

func (self *MaterialAlphabetTexture) GetTexture() any

func (*MaterialAlphabetTexture) GetTexturePixbuf

func (self *MaterialAlphabetTexture) GetTexturePixbuf() []uint8

func (*MaterialAlphabetTexture) GetTextureRGB

func (self *MaterialAlphabetTexture) GetTextureRGB() [3]float32

func (*MaterialAlphabetTexture) GetTextureWH

func (self *MaterialAlphabetTexture) GetTextureWH() [2]int

func (*MaterialAlphabetTexture) IsLoaded

func (self *MaterialAlphabetTexture) IsLoaded() bool

func (*MaterialAlphabetTexture) IsLoading

func (self *MaterialAlphabetTexture) IsLoading() bool

func (*MaterialAlphabetTexture) IsReady

func (self *MaterialAlphabetTexture) IsReady() bool

func (*MaterialAlphabetTexture) LoadAlphabetTexture

func (self *MaterialAlphabetTexture) LoadAlphabetTexture()

func (*MaterialAlphabetTexture) MaterialSummary

func (self *MaterialAlphabetTexture) MaterialSummary() string

func (*MaterialAlphabetTexture) SetAlphabetWH

func (self *MaterialAlphabetTexture) SetAlphabetWH(wh [2]float32)

func (*MaterialAlphabetTexture) SetError

func (self *MaterialAlphabetTexture) SetError(err error)

func (*MaterialAlphabetTexture) SetTexture

func (self *MaterialAlphabetTexture) SetTexture(texture any)

func (*MaterialAlphabetTexture) SetTextureRGB

func (self *MaterialAlphabetTexture) SetTextureRGB(color any)

func (*MaterialAlphabetTexture) SetTextureWH

func (self *MaterialAlphabetTexture) SetTextureWH(wh [2]int)

type MaterialColors

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

func NewMaterialColors

func NewMaterialColors(colors ...any) *MaterialColors

func (*MaterialColors) GetDrawModeColor

func (self *MaterialColors) GetDrawModeColor(draw_mode int) [4]float32

func (*MaterialColors) MaterialSummary

func (self *MaterialColors) MaterialSummary() string

func (*MaterialColors) SetColorForDrawMode

func (self *MaterialColors) SetColorForDrawMode(draw_mode int, color string) *MaterialColors

type MaterialGlowTexture

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

func NewMaterialGlowTexture

func NewMaterialGlowTexture(color any) *MaterialGlowTexture

func (*MaterialGlowTexture) GetTexture

func (self *MaterialGlowTexture) GetTexture() any

func (*MaterialGlowTexture) GetTexturePixbuf

func (self *MaterialGlowTexture) GetTexturePixbuf() []uint8

func (*MaterialGlowTexture) GetTextureRGB

func (self *MaterialGlowTexture) GetTextureRGB() [3]float32

func (*MaterialGlowTexture) GetTextureWH

func (self *MaterialGlowTexture) GetTextureWH() [2]int

func (*MaterialGlowTexture) IsLoaded

func (self *MaterialGlowTexture) IsLoaded() bool

func (*MaterialGlowTexture) IsLoading

func (self *MaterialGlowTexture) IsLoading() bool

func (*MaterialGlowTexture) IsReady

func (self *MaterialGlowTexture) IsReady() bool

func (*MaterialGlowTexture) LoadGlowTexture

func (self *MaterialGlowTexture) LoadGlowTexture()

func (*MaterialGlowTexture) MaterialSummary

func (self *MaterialGlowTexture) MaterialSummary() string

func (*MaterialGlowTexture) SetTexture

func (self *MaterialGlowTexture) SetTexture(texture any)

func (*MaterialGlowTexture) SetTextureRGB

func (self *MaterialGlowTexture) SetTextureRGB(color any)

type MaterialTexture

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

func NewMaterialTexture

func NewMaterialTexture(filepath string, color ...string) *MaterialTexture

func (*MaterialTexture) GetTexture

func (self *MaterialTexture) GetTexture() any

func (*MaterialTexture) GetTexturePixbuf

func (self *MaterialTexture) GetTexturePixbuf() []uint8

func (*MaterialTexture) GetTextureRGB

func (self *MaterialTexture) GetTextureRGB() [3]float32

func (*MaterialTexture) GetTextureWH

func (self *MaterialTexture) GetTextureWH() [2]int

func (*MaterialTexture) IsLoaded

func (self *MaterialTexture) IsLoaded() bool

func (*MaterialTexture) IsLoading

func (self *MaterialTexture) IsLoading() bool

func (*MaterialTexture) IsReady

func (self *MaterialTexture) IsReady() bool

func (*MaterialTexture) LoadTextureFromLocalFile

func (self *MaterialTexture) LoadTextureFromLocalFile()

func (*MaterialTexture) LoadTextureFromRemoteServer

func (self *MaterialTexture) LoadTextureFromRemoteServer()

func (*MaterialTexture) MaterialSummary

func (self *MaterialTexture) MaterialSummary() string

func (*MaterialTexture) SetTexture

func (self *MaterialTexture) SetTexture(texture any)

func (*MaterialTexture) SetTextureRGB

func (self *MaterialTexture) SetTextureRGB(color any)

type Overlay

type Overlay interface {
	Render(pvm *common.Matrix3)
}

type OverlayLabel

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

func (*OverlayLabel) SetBackground

func (self *OverlayLabel) SetBackground(bkgtype string) *OverlayLabel

func (*OverlayLabel) SetCharacterWH

func (self *OverlayLabel) SetCharacterWH(chwh [2]float32) *OverlayLabel

func (*OverlayLabel) SetPose

func (self *OverlayLabel) SetPose(rotation float32, offset_reference string, offset [2]float32) *OverlayLabel

func (*OverlayLabel) String

func (self *OverlayLabel) String(chwh [2]float32) string

type OverlayLabelLayer

type OverlayLabelLayer struct {
	Labels []*OverlayLabel //
	// contains filtered or unexported fields
}

func NewOverlayLabelLayer

func NewOverlayLabelLayer(rc gigl.GLRenderingContext, fontsize int, outlined bool) *OverlayLabelLayer

func (*OverlayLabelLayer) AddLabel

func (self *OverlayLabelLayer) AddLabel(labels ...*OverlayLabel) *OverlayLabelLayer

func (*OverlayLabelLayer) AddLabelsForTest

func (self *OverlayLabelLayer) AddLabelsForTest() *OverlayLabelLayer

func (*OverlayLabelLayer) AddTextLabel

func (self *OverlayLabelLayer) AddTextLabel(label_text string, xy [2]float32, color string, offref string) *OverlayLabel

func (*OverlayLabelLayer) CreateLabel

func (self *OverlayLabelLayer) CreateLabel(label_text string, xy [2]float32, color string) *OverlayLabel

func (*OverlayLabelLayer) FindLabel

func (self *OverlayLabelLayer) FindLabel(label_text string) *OverlayLabel

func (*OverlayLabelLayer) Render

func (self *OverlayLabelLayer) Render(pvm *common.Matrix3)

func (*OverlayLabelLayer) String

func (self *OverlayLabelLayer) String(chwh [2]float32) string

func (*OverlayLabelLayer) Summary

func (self *OverlayLabelLayer) Summary() string

type OverlayMarkerLayer

type OverlayMarkerLayer struct {
	Markers []*SceneObject // list of OverlayMarkers to be rendered (in pixels in CAMERA space)
	// contains filtered or unexported fields
}

func NewOverlayMarkerLayer

func NewOverlayMarkerLayer(rc gigl.GLRenderingContext) *OverlayMarkerLayer

func (*OverlayMarkerLayer) AddArrowHeadMarker

func (self *OverlayMarkerLayer) AddArrowHeadMarker(size float32, color string, outline_color string, rotation float32, xy [2]float32) *OverlayMarkerLayer

func (*OverlayMarkerLayer) AddArrowMarker

func (self *OverlayMarkerLayer) AddArrowMarker(size float32, color string, outline_color string, rotation float32, xy [2]float32) *OverlayMarkerLayer

func (*OverlayMarkerLayer) AddMarker

func (self *OverlayMarkerLayer) AddMarker(marker ...*SceneObject) *OverlayMarkerLayer

func (*OverlayMarkerLayer) AddMarkersForTest

func (self *OverlayMarkerLayer) AddMarkersForTest() *OverlayMarkerLayer

func (*OverlayMarkerLayer) AddSpriteMarker

func (self *OverlayMarkerLayer) AddSpriteMarker(imgpath string, color string, wh [2]float32, xy [2]float32, offref string) *OverlayMarkerLayer

func (*OverlayMarkerLayer) CreateArrowHeadMarker

func (self *OverlayMarkerLayer) CreateArrowHeadMarker(size float32, color string, outline_color string, use_poses bool) *SceneObject

func (*OverlayMarkerLayer) CreateArrowMarker

func (self *OverlayMarkerLayer) CreateArrowMarker(size float32, color string, outline_color string, use_poses bool) *SceneObject

func (*OverlayMarkerLayer) CreateSpriteMarker

func (self *OverlayMarkerLayer) CreateSpriteMarker(imgpath string, color string, wh [2]float32, offref string, use_poses bool) *SceneObject

func (*OverlayMarkerLayer) GetShaderForMarker

func (self *OverlayMarkerLayer) GetShaderForMarker(use_poses bool) gigl.GLShader

func (*OverlayMarkerLayer) GetShaderForSpriteMarker

func (self *OverlayMarkerLayer) GetShaderForSpriteMarker(wh [2]float32, offrot [3]float32, use_poses bool) gigl.GLShader

func (*OverlayMarkerLayer) Render

func (self *OverlayMarkerLayer) Render(pvm *common.Matrix3)

type Renderer

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

func NewRenderer

func NewRenderer(rc gigl.GLRenderingContext) *Renderer

func (*Renderer) Clear

func (self *Renderer) Clear(scene *Scene)

func (*Renderer) RenderAxes

func (self *Renderer) RenderAxes(camera *Camera, length float32)

func (*Renderer) RenderScene

func (self *Renderer) RenderScene(scene *Scene, camera *Camera)

func (*Renderer) RenderSceneObject

func (self *Renderer) RenderSceneObject(scnobj *SceneObject, pvm *common.Matrix3) error

type Scene

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

func NewScene

func NewScene(bkg_color string) *Scene

func (*Scene) Add

func (self *Scene) Add(scnobj ...*SceneObject) *Scene

func (*Scene) AddOverlay

func (self *Scene) AddOverlay(overlay ...Overlay) *Scene

func (*Scene) Get

func (self *Scene) Get(indices ...int) *SceneObject

func (*Scene) GetBBoxSizeCenter

func (self *Scene) GetBBoxSizeCenter(renew bool) ([2][2]float32, [2]float32, [2]float32)

func (*Scene) GetBkgColor

func (self *Scene) GetBkgColor() [3]float32

func (*Scene) GetBoundingBox

func (self *Scene) GetBoundingBox(renew bool) *BBox

func (*Scene) SetBkgColor

func (self *Scene) SetBkgColor(color string) *Scene

func (*Scene) String

func (self *Scene) String() string

type SceneObject

type SceneObject struct {
	Geometry *Geometry       // geometry interface
	Material gigl.GLMaterial // material
	VShader  gigl.GLShader   // vert shader and its bindings
	EShader  gigl.GLShader   // edge shader and its bindings
	FShader  gigl.GLShader   // face shader and its bindings

	UseDepth bool // depth test flag (default is true)
	UseBlend bool // blending flag with alpha (default is false)
	// contains filtered or unexported fields
}

func NewSceneObject

func NewSceneObject(geometry *Geometry, material gigl.GLMaterial,
	vshader gigl.GLShader, eshader gigl.GLShader, fshader gigl.GLShader) *SceneObject

func NewSceneObject_HexagonWireframe

func NewSceneObject_HexagonWireframe(rc gigl.GLRenderingContext) *SceneObject

func NewSceneObject_RectangleInstancesExample

func NewSceneObject_RectangleInstancesExample(rc gigl.GLRenderingContext) *SceneObject

func NewSceneObject_RedTriangle

func NewSceneObject_RedTriangle(rc gigl.GLRenderingContext) *SceneObject

func SelectObjectByWorldXY

func SelectObjectByWorldXY(scene *Scene) *SceneObject

func (*SceneObject) AddChild

func (self *SceneObject) AddChild(child *SceneObject) *SceneObject

func (*SceneObject) ClearInstanceBuffer

func (self *SceneObject) ClearInstanceBuffer()

func (*SceneObject) GetBoundingBox

func (self *SceneObject) GetBoundingBox(m *common.Matrix3, renew bool) *BBox

func (*SceneObject) IsReady

func (self *SceneObject) IsReady() bool

func (*SceneObject) Rotate

func (self *SceneObject) Rotate(angle_in_degree float32) *SceneObject

func (*SceneObject) Scale

func (self *SceneObject) Scale(sx float32, sy float32) *SceneObject

func (*SceneObject) SetInstanceBuffer

func (self *SceneObject) SetInstanceBuffer(instance_count int, instance_stride int, data []float32) *SceneObject

func (*SceneObject) SetInstanceColorValues

func (self *SceneObject) SetInstanceColorValues(instance_index int, offset int, v0 uint8, v1 uint8, v2 uint8, v3 uint8)

func (*SceneObject) SetInstancePoseValues

func (self *SceneObject) SetInstancePoseValues(instance_index int, offset int, values ...float32)

func (*SceneObject) SetTransformation

func (self *SceneObject) SetTransformation(txy [2]float32, angle_in_degree float32, sxy [2]float32) *SceneObject

func (*SceneObject) Summary

func (self *SceneObject) Summary() string

func (*SceneObject) Translate

func (self *SceneObject) Translate(tx float32, ty float32) *SceneObject

type V2d

type V2d [2]float32

func NewV2d

func NewV2d(x float32, y float32) *V2d

func NewV2dByAvg

func NewV2dByAvg(vs ...[2]float32) *V2d

func NewV2dBySub

func NewV2dBySub(a [2]float32, b [2]float32) *V2d

func NewV2dBySum

func NewV2dBySum(vs ...[2]float32) *V2d

func (*V2d) Add

func (v *V2d) Add(v2 *V2d) *V2d

func (*V2d) Clone

func (v *V2d) Clone() *V2d

func (*V2d) Cross

func (a *V2d) Cross(b *V2d) float32

func (*V2d) Dot

func (a *V2d) Dot(b *V2d) float32

func (*V2d) Length

func (v *V2d) Length() float32

func (*V2d) Normalize

func (v *V2d) Normalize() *V2d

func (*V2d) Scale

func (v *V2d) Scale(sx float32, sy float32) *V2d

func (*V2d) Shift

func (v *V2d) Shift(dx float32, dy float32) *V2d

Jump to

Keyboard shortcuts

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