canvas3d

package
v2.0.0-...-96ae00f Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2024 License: BSD-3-Clause Imports: 10 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ProjectName = "projection"
	ViewName    = "view"
	ModelName   = "model"
)
View Source
const (
	Forward = iota
	Backward
	Left
	Right
)
View Source
const (
	Yaw       = -90.0
	Pitch     = 0.0
	Speed     = 3.0
	Sensitivy = 0.01
)
View Source
const (
	Near = 0.1
	Far  = 100
)
View Source
const (
	LightConstant    = "light.constant"
	LightLinear      = "light.linear"
	LightQuadratic   = "light.quadratic"
	LightCutOff      = "light.cutOff"
	LightOuterCutOff = "light.outerCutOff"
	LightDirection   = "light.direction"
	LightPosition    = "light.position"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinate

type Coordinate struct {
	*ViewConfig
	*ProjectConfig
	*ModelConfig
	// contains filtered or unexported fields
}

func NewCoordinate

func NewCoordinate() *Coordinate

func (*Coordinate) After

func (c *Coordinate) After(p *gl.Painter3D)

func (*Coordinate) BeforeDraw

func (c *Coordinate) BeforeDraw(p context.Painter, pos fyne.Position, frame fyne.Size)

func (*Coordinate) DragEnd

func (c *Coordinate) DragEnd()

func (*Coordinate) Dragged

func (c *Coordinate) Dragged(event *fyne.DragEvent)

func (*Coordinate) Init

func (c *Coordinate) Init(p *gl.Painter3D)

func (*Coordinate) InitOnce

func (c *Coordinate) InitOnce(p *gl.Painter3D)

func (*Coordinate) NeedShader

func (c *Coordinate) NeedShader() bool

func (*Coordinate) Scrolled

func (c *Coordinate) Scrolled(event *fyne.ScrollEvent)

func (*Coordinate) UpdateFrameSize

func (c *Coordinate) UpdateFrameSize(frameSize fyne.Size)

type DirectionLight

type DirectionLight struct {
	*Light
}

func NewDirectionLight

func NewDirectionLight() *DirectionLight

func (*DirectionLight) After

func (m *DirectionLight) After(p *gl.Painter3D)

func (*DirectionLight) Init

func (m *DirectionLight) Init(p *gl.Painter3D)

type Fog

type Fog struct {
	Start  float32
	End    float32
	Colorf mgl32.Vec4

	Density float32
	// contains filtered or unexported fields
}

func NewFog

func NewFog() *Fog

func (*Fog) After

func (f *Fog) After(p *gl.Painter3D)

func (*Fog) Disable

func (f *Fog) Disable()

func (*Fog) Draw

func (f *Fog) Draw(p *gl.Painter3D, pos fyne.Position, Frame fyne.Size)

func (*Fog) Enable

func (f *Fog) Enable()

func (*Fog) Init

func (f *Fog) Init(p *gl.Painter3D)

func (*Fog) InitOnce

func (f *Fog) InitOnce(p *gl.Painter3D)

func (*Fog) NeedShader

func (f *Fog) NeedShader() bool

func (*Fog) SetModeExp

func (f *Fog) SetModeExp()

func (*Fog) SetModeLinear

func (f *Fog) SetModeLinear()

type Light

type Light struct {
	Position  mgl32.Vec3
	Direction mgl32.Vec3
	Constant  float32
	Linear    float32
	Quadratic float32
	*Material
}

func NewLight

func NewLight() *Light

func (*Light) After

func (m *Light) After(p *gl.Painter3D)

func (*Light) Init

func (m *Light) Init(p *gl.Painter3D)

type Line

type Line struct {
	P1 Point
	P2 Point
}

type Lines

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

func NewLines

func NewLines() *Lines

func (*Lines) After

func (l *Lines) After(p *gl.Painter3D)

func (*Lines) AppendLine

func (l *Lines) AppendLine(v *Line)

func (*Lines) Draw

func (l *Lines) Draw(p *gl.Painter3D, pos fyne.Position, Frame fyne.Size)

func (*Lines) Init

func (l *Lines) Init(p *gl.Painter3D)

func (*Lines) InitOnce

func (l *Lines) InitOnce(p *gl.Painter3D)

func (*Lines) NeedShader

func (l *Lines) NeedShader() bool

func (*Lines) SetDrawLoop

func (l *Lines) SetDrawLoop()

func (*Lines) SetDrawStrIp

func (l *Lines) SetDrawStrIp()

func (*Lines) SetLineWidth

func (l *Lines) SetLineWidth(w float32) *Lines

type Material

type Material struct {
	Ambient          mgl32.Vec3
	Diffuse          mgl32.Vec3
	Specular         mgl32.Vec3
	Shininess        float32
	Name             string
	AmbientStrength  float32
	DiffuseStrength  float32
	SpecularStrength float32
}

func NewMaterial

func NewMaterial() *Material

func (*Material) After

func (m *Material) After(p *gl.Painter3D)

func (*Material) GetName

func (m *Material) GetName(attr string) string

func (*Material) Init

func (m *Material) Init(p *gl.Painter3D)

func (*Material) InitOnce

func (m *Material) InitOnce(p *gl.Painter3D)

func (*Material) NeedShader

func (m *Material) NeedShader() bool

type ModelConfig

type ModelConfig struct {
	Model mgl32.Mat4
	// contains filtered or unexported fields
}

func NewModelConfig

func NewModelConfig() *ModelConfig

func (*ModelConfig) GetModel

func (m *ModelConfig) GetModel() mgl32.Mat4

func (*ModelConfig) Rotate

func (m *ModelConfig) Rotate(angle float32, axis mgl32.Vec3)

func (*ModelConfig) Scale

func (m *ModelConfig) Scale(x, y, z float32)

func (*ModelConfig) TranslateVec3

func (m *ModelConfig) TranslateVec3(vec mgl32.Vec3)

func (*ModelConfig) TranslateXYZ

func (m *ModelConfig) TranslateXYZ(x, y, z float32)

type Point

type Point struct {
	Pos      *mgl32.Vec3
	Color    *mgl32.Vec3
	Colorubs []uint8
}

func NewPoint

func NewPoint() *Point

type PointLight

type PointLight struct {
	*Light
}

func NewPointLight

func NewPointLight() *PointLight

func (*PointLight) After

func (m *PointLight) After(p *gl.Painter3D)

func (*PointLight) Init

func (m *PointLight) Init(p *gl.Painter3D)

type Points

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

func NewPoints

func NewPoints() *Points

func (*Points) After

func (p2 *Points) After(p *gl.Painter3D)

func (*Points) AppendPoint

func (p2 *Points) AppendPoint(v *Point)

func (*Points) Draw

func (p2 *Points) Draw(p *gl.Painter3D, pos fyne.Position, Frame fyne.Size)

func (*Points) Init

func (p2 *Points) Init(p *gl.Painter3D)

func (*Points) InitOnce

func (p2 *Points) InitOnce(p *gl.Painter3D)

func (*Points) NeedShader

func (p2 *Points) NeedShader() bool

func (*Points) SetPointWidth

func (p2 *Points) SetPointWidth(w float32) *Points

type ProjectConfig

type ProjectConfig struct {
	Near float32
	Far  float32
	Fov  float32
}

type SpotLight

type SpotLight struct {
	*Light
	CutOff      float32
	OuterCutOff float32
}

func NewSpotLight

func NewSpotLight() *SpotLight

func (*SpotLight) After

func (m *SpotLight) After(p *gl.Painter3D)

func (*SpotLight) Init

func (m *SpotLight) Init(p *gl.Painter3D)

type Texture

type Texture struct {
	MixParams float32

	LevelDataSize int32
	// contains filtered or unexported fields
}

func NewTexture

func NewTexture() *Texture

func (*Texture) After

func (tex *Texture) After(p *gl.Painter3D)

func (*Texture) AppendImage

func (tex *Texture) AppendImage(p image.Image)

func (*Texture) AppendImageWithCustomAttr

func (tex *Texture) AppendImageWithCustomAttr(attr string, p image.Image)

func (*Texture) AppendPath

func (tex *Texture) AppendPath(p string)

func (*Texture) AppendPathWithCustomAttr

func (tex *Texture) AppendPathWithCustomAttr(attr string, p string)

func (*Texture) Init

func (tex *Texture) Init(p *gl.Painter3D)

func (*Texture) InitOnce

func (tex *Texture) InitOnce(p *gl.Painter3D)

func (*Texture) NeedShader

func (tex *Texture) NeedShader() bool

func (*Texture) SetDefaultLevelData

func (tex *Texture) SetDefaultLevelData(level int32, data []uint32)

func (*Texture) SetLevelData

func (tex *Texture) SetLevelData(index int, level int32, data []uint32)

type VertexFloat32Array

type VertexFloat32Array struct {
	Arr          []float32
	Index        []uint32
	PositionSize []int //大小和偏移
	NormalSize   []int
	TexCoordSize []int
	ColorSize    []int
	// contains filtered or unexported fields
}

func NewVertexFloat32Array

func NewVertexFloat32Array() *VertexFloat32Array

func (*VertexFloat32Array) AddOffset

func (v *VertexFloat32Array) AddOffset(points []float32, pos fyne.Position, size fyne.Size) (res []float32)

func (*VertexFloat32Array) After

func (v *VertexFloat32Array) After(p *gl.Painter3D)

func (*VertexFloat32Array) Draw

func (v *VertexFloat32Array) Draw(p *gl.Painter3D, pos fyne.Position, frame fyne.Size)

func (*VertexFloat32Array) Init

func (v *VertexFloat32Array) Init(p *gl.Painter3D)

func (*VertexFloat32Array) InitOnce

func (v *VertexFloat32Array) InitOnce(p *gl.Painter3D)

func (*VertexFloat32Array) NeedShader

func (v *VertexFloat32Array) NeedShader() bool

type ViewConfig

type ViewConfig struct {
	Position mgl32.Vec3
	Front    mgl32.Vec3
	Up       mgl32.Vec3
	Right    mgl32.Vec3
	WorldUp  mgl32.Vec3

	Yaw   float64
	Pitch float64

	LastX float32
	LastY float32

	MovementSpeed    float64
	MouseSensitivity float64

	ConstrainPitch bool
}

func (*ViewConfig) GetView

func (c *ViewConfig) GetView() mgl32.Mat4

func (*ViewConfig) ProcessKeyboard

func (c *ViewConfig) ProcessKeyboard(direction int, deltaTime float64)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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