xyzv

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SelBoxName 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.
	SelBoxName = "__SelectedBox"

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

Variables

View Source
var ManipPtType = gti.AddType(&gti.Type{Name: "cogentcore.org/core/xyzv.ManipPt", IDName: "manip-pt", Doc: "ManipPt is a manipulation control point", Directives: []gti.Directive{{Tool: "core", Directive: "no-new"}}, Embeds: []gti.Field{{Name: "Solid"}}, Instance: &ManipPt{}})

ManipPtType is the gti.Type for ManipPt

View Source
var SceneType = gti.AddType(&gti.Type{Name: "cogentcore.org/core/xyzv.Scene", IDName: "scene", Doc: "Scene is a gi.Widget that manages a xyz.Scene,\nproviding the basic rendering logic for the 3D scene\nin the 2D gi gui context.", Embeds: []gti.Field{{Name: "WidgetBase"}}, Fields: []gti.Field{{Name: "XYZ", Doc: "XYZ is the 3D xyz.Scene"}, {Name: "SelMode", Doc: "how to deal with selection / manipulation events"}, {Name: "CurSel", Doc: "currently selected node"}, {Name: "CurManipPt", Doc: "currently selected manipulation control point"}, {Name: "SelParams", Doc: "parameters for selection / manipulation box"}}, Instance: &Scene{}})

SceneType is the gti.Type for Scene

View Source
var SceneViewType = gti.AddType(&gti.Type{Name: "cogentcore.org/core/xyzv.SceneView", IDName: "scene-view", Doc: "SceneView provides a toolbar controller for an xyz.Scene,\nand manipulation abilities.", Embeds: []gti.Field{{Name: "Layout"}}, Instance: &SceneView{}})

SceneViewType is the gti.Type for SceneView

Functions

This section is empty.

Types

type ManipPt

type ManipPt struct {
	xyz.Solid
}

ManipPt is a manipulation control point

func NewManipPt

func NewManipPt(par ki.Ki, name string, meshName string, clr color.RGBA, pos mat32.Vec3) *ManipPt

NewManipPt adds a new manipulation point

func (*ManipPt) KiType

func (t *ManipPt) KiType() *gti.Type

KiType returns the *gti.Type of ManipPt

func (*ManipPt) New

func (t *ManipPt) New() ki.Ki

New returns a new *ManipPt value

func (*ManipPt) SetMat

func (t *ManipPt) SetMat(v xyz.Material) *ManipPt

SetMat sets the [ManipPt.Mat]

type MeshValue

type MeshValue struct {
	giv.ValueBase[*gi.Button]
}

MeshValue represents an xyz.MeshName with a button.

func (*MeshValue) Config added in v0.0.8

func (v *MeshValue) Config()

func (*MeshValue) ConfigDialog

func (v *MeshValue) ConfigDialog(d *gi.Body) (bool, func())

func (*MeshValue) Update added in v0.0.8

func (v *MeshValue) Update()

type Scene

type Scene struct {
	gi.WidgetBase

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

	// how to deal with selection / manipulation events
	SelMode SelModes

	// currently selected node
	CurSel xyz.Node `copier:"-" json:"-" xml:"-" view:"-"`

	// currently selected manipulation control point
	CurManipPt *ManipPt `copier:"-" json:"-" xml:"-" view:"-"`

	// parameters for selection / manipulation box
	SelParams SelParams `view:"inline"`
}

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

func NewScene

func NewScene(par ki.Ki, name ...string) *Scene

NewScene adds a new Scene with the given name to the given parent: Scene is a gi.Widget that manages a xyz.Scene, providing the basic rendering logic for the 3D scene in the 2D gi gui context.

func (*Scene) Config added in v0.0.8

func (sw *Scene) Config()

func (*Scene) ConfigFrame

func (sw *Scene) ConfigFrame()

ConfigFrame configures the framebuffer for GPU rendering, using the RenderWin GPU and Device.

func (*Scene) Destroy added in v0.0.8

func (sw *Scene) Destroy()

func (*Scene) DirectRenderDraw added in v0.0.9

func (sw *Scene) DirectRenderDraw(drw goosi.Drawer, idx int, flipY bool)

DirectRenderDraw draws the current image to RenderWin drawer

func (*Scene) DirectRenderImage added in v0.0.9

func (sw *Scene) DirectRenderImage(drw goosi.Drawer, idx int)

DirectRenderImage uploads framebuffer image

func (*Scene) DrawIntoScene

func (sw *Scene) DrawIntoScene()

DrawIntoScene is the slower path for rendering, by grabbing the image down from the GPU and drawing it into the Scene image. This is retained for the time being in case it is needed for another case.

func (*Scene) HandleEvents

func (sw *Scene) HandleEvents()

func (*Scene) HandleSelectEvents

func (sw *Scene) HandleSelectEvents()

func (*Scene) HandleSelectEventsImpl

func (sw *Scene) HandleSelectEventsImpl(e events.Event)

func (*Scene) HandleSlideEvents

func (sw *Scene) HandleSlideEvents()

func (*Scene) KiType

func (t *Scene) KiType() *gti.Type

KiType returns the *gti.Type of Scene

func (*Scene) ManipBox

func (sw *Scene) ManipBox()

ManipBox draws a manipulation box around selected node

func (*Scene) New

func (t *Scene) New() ki.Ki

New returns a new *Scene value

func (*Scene) OnAdd added in v0.0.8

func (sw *Scene) OnAdd()

func (*Scene) OnInit

func (sw *Scene) OnInit()

func (*Scene) Render

func (sw *Scene) Render()

func (*Scene) Render3D

func (sw *Scene) Render3D()

Render renders the Frame Image

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) SetCurManipPt

func (t *Scene) SetCurManipPt(v *ManipPt) *Scene

SetCurManipPt sets the [Scene.CurManipPt]: currently selected manipulation control point

func (*Scene) SetCurSel

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

SetCurSel sets the [Scene.CurSel]: currently selected node

func (*Scene) SetManipPt

func (sw *Scene) SetManipPt(pt *ManipPt)

SetManipPt sets the CurManipPt

func (*Scene) SetSel

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

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

func (*Scene) SetSelMode

func (t *Scene) SetSelMode(v SelModes) *Scene

SetSelMode sets the [Scene.SelMode]: how to deal with selection / manipulation events

func (*Scene) SetSelParams

func (t *Scene) SetSelParams(v SelParams) *Scene

SetSelParams sets the [Scene.SelParams]: parameters for selection / manipulation box

func (*Scene) SetStyles

func (sw *Scene) SetStyles()

func (*Scene) SetTooltip

func (t *Scene) SetTooltip(v string) *Scene

SetTooltip sets the [Scene.Tooltip]

type SceneView

type SceneView struct {
	gi.Layout
}

SceneView provides a toolbar controller for an xyz.Scene, and manipulation abilities.

func NewSceneView

func NewSceneView(par ki.Ki, name ...string) *SceneView

NewSceneView adds a new SceneView with the given name to the given parent: SceneView provides a toolbar controller for an xyz.Scene, and manipulation abilities.

func (*SceneView) Config added in v0.0.8

func (sv *SceneView) Config()

func (*SceneView) ConfigSceneView

func (sv *SceneView) ConfigSceneView()

func (*SceneView) ConfigToolbar

func (sv *SceneView) ConfigToolbar(tb *gi.Toolbar)

func (*SceneView) KiType

func (t *SceneView) KiType() *gti.Type

KiType returns the *gti.Type of SceneView

func (*SceneView) New

func (t *SceneView) New() ki.Ki

New returns a new *SceneView value

func (*SceneView) OnInit

func (sv *SceneView) OnInit()

func (*SceneView) SceneWidget

func (sv *SceneView) SceneWidget() *Scene

SceneWidget returns the gi.Widget Scene (xyzv.Scene)

func (*SceneView) SceneXYZ

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

Scene returns the xyz.Scene

func (*SceneView) SetStackTop

func (t *SceneView) SetStackTop(v int) *SceneView

SetStackTop sets the [SceneView.StackTop]

func (*SceneView) SetTooltip

func (t *SceneView) SetTooltip(v string) *SceneView

SetTooltip sets the [SceneView.Tooltip]

func (*SceneView) Toolbar

func (sv *SceneView) Toolbar() *gi.Toolbar

func (*SceneView) UpdateToolbar

func (sv *SceneView) UpdateToolbar()

type SelModes

type SelModes int32 //enums:enum

SelModes are selection modes for Scene

const (
	// NotSelectable means that selection events are ignored entirely
	NotSelectable SelModes = 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 SelModesN SelModes = 4

SelModesN is the highest valid value for type SelModes, plus one.

func SelModesValues

func SelModesValues() []SelModes

SelModesValues returns all possible values for the type SelModes.

func (SelModes) Desc

func (i SelModes) Desc() string

Desc returns the description of the SelModes value.

func (SelModes) Int64

func (i SelModes) Int64() int64

Int64 returns the SelModes value as an int64.

func (SelModes) MarshalText

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

MarshalText implements the encoding.TextMarshaler interface.

func (*SelModes) SetInt64

func (i *SelModes) SetInt64(in int64)

SetInt64 sets the SelModes value from an int64.

func (*SelModes) SetString

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

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

func (SelModes) String

func (i SelModes) String() string

String returns the string representation of this SelModes value.

func (*SelModes) UnmarshalText

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

UnmarshalText implements the encoding.TextUnmarshaler interface.

func (SelModes) Values

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

Values returns all possible values for the type SelModes.

type SelParams

type SelParams 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"`
}

SelParams are parameters for selection / manipulation box

func (*SelParams) Defaults

func (sp *SelParams) Defaults()

Jump to

Keyboard shortcuts

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