xyzcore

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: BSD-3-Clause Imports: 20 Imported by: 4

Documentation

Overview

Package xyzcore provides a GUI view for a 3D xyz scene.

Index

Constants

View Source
const (
	// SelectedBoxName is the reserved top-level Group name for holding
	// a bounding box or manipulator for currently selected object.
	// also used for meshes representing the box.
	SelectedBoxName = "__SelectedBox"

	// ManipBoxName is the reserved top-level name for meshes
	// representing the manipulation box.
	ManipBoxName = "__ManipBox"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ManipPoint

type ManipPoint struct {
	xyz.Solid
}

ManipPoint is a manipulation control point.

func NewManipPoint

func NewManipPoint(parent tree.Node, name string, meshName string, clr color.RGBA, pos math32.Vector3) *ManipPoint

NewManipPoint adds a new manipulation point

type MeshButton

type MeshButton struct {
	core.Button
	MeshName string
}

MeshButton represents an xyz.MeshName value with a button.

func NewMeshButton

func NewMeshButton(parent ...tree.Node) *MeshButton

NewMeshButton returns a new MeshButton with the given optional parent: MeshButton represents an xyz.MeshName value with a button.

func (*MeshButton) Init

func (mb *MeshButton) Init()

func (*MeshButton) SetMeshName

func (t *MeshButton) SetMeshName(v string) *MeshButton

SetMeshName sets the [MeshButton.MeshName]

func (*MeshButton) WidgetValue

func (mb *MeshButton) WidgetValue() any

type Scene

type Scene struct {
	core.WidgetBase

	// XYZ is the 3D xyz.Scene
	XYZ *xyz.Scene `set:"-"`

	// how to deal with selection / manipulation events
	SelectionMode SelectionModes

	// currently selected node
	CurrentSelected xyz.Node `copier:"-" json:"-" xml:"-" display:"-"`

	// currently selected manipulation control point
	CurrentManipPoint *ManipPoint `copier:"-" json:"-" xml:"-" display:"-"`

	// parameters for selection / manipulation box
	SelectionParams SelectionParams `display:"inline"`
}

Scene is a core.Widget that manages a xyz.Scene, providing the basic rendering logic for the 3D scene in the 2D core GUI context.

func NewScene

func NewScene(parent ...tree.Node) *Scene

NewScene returns a new Scene with the given optional parent: Scene is a core.Widget that manages a xyz.Scene, providing the basic rendering logic for the 3D scene in the 2D core GUI context.

func (*Scene) Destroy

func (sw *Scene) Destroy()

func (*Scene) Init

func (sw *Scene) Init()

func (*Scene) ManipBox

func (sw *Scene) ManipBox()

ManipBox draws a manipulation box around selected node

func (*Scene) OnAdd

func (sw *Scene) OnAdd()

func (*Scene) Render

func (sw *Scene) Render()

func (*Scene) RenderDraw added in v0.3.2

func (sw *Scene) RenderDraw(drw system.Drawer, op draw.Op)

RenderDraw draws the current image to RenderWindow drawer

func (*Scene) SceneXYZ

func (sw *Scene) SceneXYZ() *xyz.Scene

SceneXYZ returns the xyz.Scene

func (*Scene) SelectBox

func (sw *Scene) SelectBox()

SelectBox draws a selection box around selected node

func (*Scene) SetCurrentManipPoint

func (t *Scene) SetCurrentManipPoint(v *ManipPoint) *Scene

SetCurrentManipPoint sets the [Scene.CurrentManipPoint]: currently selected manipulation control point

func (*Scene) SetCurrentSelected

func (t *Scene) SetCurrentSelected(v xyz.Node) *Scene

SetCurrentSelected sets the [Scene.CurrentSelected]: currently selected node

func (*Scene) SetSelected

func (sw *Scene) SetSelected(nd xyz.Node)

SetSelected -- if Selectable is true, then given object is selected if node is nil then selection is reset.

func (*Scene) SetSelectionMode

func (t *Scene) SetSelectionMode(v SelectionModes) *Scene

SetSelectionMode sets the [Scene.SelectionMode]: how to deal with selection / manipulation events

func (*Scene) SetSelectionParams

func (t *Scene) SetSelectionParams(v SelectionParams) *Scene

SetSelectionParams sets the [Scene.SelectionParams]: parameters for selection / manipulation box

type SceneEditor

type SceneEditor struct {
	core.Frame
}

SceneEditor provides a toolbar controller and manipulation abilities for a Scene.

func NewSceneEditor

func NewSceneEditor(parent ...tree.Node) *SceneEditor

NewSceneEditor returns a new SceneEditor with the given optional parent: SceneEditor provides a toolbar controller and manipulation abilities for a Scene.

func (*SceneEditor) Init

func (sv *SceneEditor) Init()

func (*SceneEditor) MakeToolbar

func (sv *SceneEditor) MakeToolbar(p *tree.Plan)

func (*SceneEditor) SceneWidget

func (sv *SceneEditor) SceneWidget() *Scene

SceneWidget returns the Scene widget.

func (*SceneEditor) SceneXYZ

func (sv *SceneEditor) SceneXYZ() *xyz.Scene

SceneXYZ returns the xyz.Scene.

type SelectionModes

type SelectionModes int32 //enums:enum

SelectionModes are selection modes for Scene

const (
	// NotSelectable means that selection events are ignored entirely
	NotSelectable SelectionModes = iota

	// Selectable means that nodes can be selected but no visible consequence occurs
	Selectable

	// SelectionBox means that a selection bounding box is drawn around selected nodes
	SelectionBox

	// Manipulable means that a manipulation box will be created for selected nodes,
	// which can update the Pose parameters dynamically.
	Manipulable
)
const SelectionModesN SelectionModes = 4

SelectionModesN is the highest valid value for type SelectionModes, plus one.

func SelectionModesValues

func SelectionModesValues() []SelectionModes

SelectionModesValues returns all possible values for the type SelectionModes.

func (SelectionModes) Desc

func (i SelectionModes) Desc() string

Desc returns the description of the SelectionModes value.

func (SelectionModes) Int64

func (i SelectionModes) Int64() int64

Int64 returns the SelectionModes value as an int64.

func (SelectionModes) MarshalText

func (i SelectionModes) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface.

func (*SelectionModes) SetInt64

func (i *SelectionModes) SetInt64(in int64)

SetInt64 sets the SelectionModes value from an int64.

func (*SelectionModes) SetString

func (i *SelectionModes) SetString(s string) error

SetString sets the SelectionModes value from its string representation, and returns an error if the string is invalid.

func (SelectionModes) String

func (i SelectionModes) String() string

String returns the string representation of this SelectionModes value.

func (*SelectionModes) UnmarshalText

func (i *SelectionModes) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (SelectionModes) Values

func (i SelectionModes) Values() []enums.Enum

Values returns all possible values for the type SelectionModes.

type SelectionParams

type SelectionParams struct {
	// color for selection box (default yellow)
	Color color.RGBA

	// width of the box lines, scaled by view distance
	Width float32 `default:"0.001"`

	// radius of the manipulation control point spheres, scaled by view distance
	Radius float32 `default:"0.005"`
}

SelectionParams are parameters for selection / manipulation box

func (*SelectionParams) Defaults

func (sp *SelectionParams) Defaults()

Jump to

Keyboard shortcuts

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