Documentation
¶
Index ¶
- Constants
- Variables
- type ManipPt
- type MeshValue
- type Scene
- func (sw *Scene) ConfigFrame()
- func (sw *Scene) ConfigWidget()
- func (sw *Scene) CopyFieldsFrom(frm any)
- func (sw *Scene) DrawIntoScene()
- func (sw *Scene) HandleEvents()
- func (sw *Scene) HandleSelectEvents()
- func (sw *Scene) HandleSelectEventsImpl(e events.Event)
- func (sw *Scene) HandleSlideEvents()
- func (t *Scene) KiType() *gti.Type
- func (sw *Scene) ManipBox()
- func (t *Scene) New() ki.Ki
- func (sw *Scene) OnInit()
- func (sw *Scene) Render()
- func (sw *Scene) Render3D()
- func (sw *Scene) SceneXYZ() *xyz.Scene
- func (sw *Scene) SelectBox()
- func (t *Scene) SetClass(v string) *Scene
- func (t *Scene) SetCurManipPt(v *ManipPt) *Scene
- func (t *Scene) SetCurSel(v xyz.Node) *Scene
- func (t *Scene) SetCustomContextMenu(v func(m *gi.Scene)) *Scene
- func (sw *Scene) SetManipPt(pt *ManipPt)
- func (sw *Scene) SetSel(nd xyz.Node)
- func (t *Scene) SetSelMode(v SelModes) *Scene
- func (t *Scene) SetSelParams(v SelParams) *Scene
- func (sw *Scene) SetStyles()
- func (t *Scene) SetTooltip(v string) *Scene
- func (sw *Scene) UpdateEnd3D(updt bool)
- func (sw *Scene) UpdateEndConfig3D(updt bool)
- func (sw *Scene) UpdateEndRender3D(updt bool)
- func (sw *Scene) UpdateEndUpdate3D(updt bool)
- func (sw *Scene) UpdateStart3D() bool
- type SceneView
- func (sv *SceneView) ConfigSceneView()
- func (sv *SceneView) ConfigToolbar(tb *gi.Toolbar)
- func (sv *SceneView) ConfigWidget()
- func (t *SceneView) KiType() *gti.Type
- func (t *SceneView) New() ki.Ki
- func (sv *SceneView) OnInit()
- func (sv *SceneView) SceneWidget() *Scene
- func (sv *SceneView) SceneXYZ() *xyz.Scene
- func (t *SceneView) SetClass(v string) *SceneView
- func (t *SceneView) SetCustomContextMenu(v func(m *gi.Scene)) *SceneView
- func (t *SceneView) SetStackTop(v int) *SceneView
- func (t *SceneView) SetTooltip(v string) *SceneView
- func (sv *SceneView) Toolbar() *gi.Toolbar
- func (sv *SceneView) UpdateToolbar()
- type SelModes
- func (i SelModes) Desc() string
- func (i SelModes) Int64() int64
- func (i SelModes) IsValid() bool
- func (i SelModes) MarshalText() ([]byte, error)
- func (i *SelModes) SetInt64(in int64)
- func (i *SelModes) SetString(s string) error
- func (i SelModes) String() string
- func (i *SelModes) UnmarshalText(text []byte) error
- func (i SelModes) Values() []enums.Enum
- type SelParams
Constants ¶
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 ¶
var ManipPtType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/xyzv.ManipPt", ShortName: "xyzv.ManipPt", IDName: "manip-pt", Doc: "ManipPt is a manipulation control point", Directives: gti.Directives{ >i.Directive{Tool: "goki", Directive: "no-new", Args: []string{}}, }, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Solid", >i.Field{Name: "Solid", Type: "goki.dev/xyz.Solid", LocalType: "xyz.Solid", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &ManipPt{}, })
ManipPtType is the gti.Type for ManipPt
var SceneType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/xyzv.Scene", ShortName: "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.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Scene", >i.Field{Name: "Scene", Type: "*goki.dev/xyz.Scene", LocalType: "*xyz.Scene", Doc: "Scene is the 3D Scene", Directives: gti.Directives{}, Tag: "set:\"-\""}}, {"SelMode", >i.Field{Name: "SelMode", Type: "goki.dev/gi/v2/xyzv.SelModes", LocalType: "SelModes", Doc: "how to deal with selection / manipulation events", Directives: gti.Directives{}, Tag: ""}}, {"CurSel", >i.Field{Name: "CurSel", Type: "goki.dev/xyz.Node", LocalType: "xyz.Node", Doc: "currently selected node", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\""}}, {"CurManipPt", >i.Field{Name: "CurManipPt", Type: "*goki.dev/gi/v2/xyzv.ManipPt", LocalType: "*ManipPt", Doc: "currently selected manipulation control point", Directives: gti.Directives{}, Tag: "copy:\"-\" json:\"-\" xml:\"-\" view:\"-\""}}, {"SelParams", >i.Field{Name: "SelParams", Type: "goki.dev/gi/v2/xyzv.SelParams", LocalType: "SelParams", Doc: "parameters for selection / manipulation box", Directives: gti.Directives{}, Tag: "view:\"inline\""}}, }), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"WidgetBase", >i.Field{Name: "WidgetBase", Type: "goki.dev/gi/v2/gi.WidgetBase", LocalType: "gi.WidgetBase", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &Scene{}, })
SceneType is the gti.Type for Scene
var SceneViewType = gti.AddType(>i.Type{ Name: "goki.dev/gi/v2/xyzv.SceneView", ShortName: "xyzv.SceneView", IDName: "scene-view", Doc: "SceneView provides a toolbar controller for an xyz.Scene,\nand manipulation abilities.", Directives: gti.Directives{}, Fields: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{}), Embeds: ordmap.Make([]ordmap.KeyVal[string, *gti.Field]{ {"Layout", >i.Field{Name: "Layout", Type: "goki.dev/gi/v2/gi.Layout", LocalType: "gi.Layout", Doc: "", Directives: gti.Directives{}, Tag: ""}}, }), Methods: ordmap.Make([]ordmap.KeyVal[string, *gti.Method]{}), Instance: &SceneView{}, })
Functions ¶
This section is empty.
Types ¶
type ManipPt ¶
ManipPt is a manipulation control point
func NewManipPt ¶
NewManipPt adds a new manipulation point
type MeshValue ¶
MeshValue presents an action for displaying a MeshName and selecting meshes from a ChooserDialog
func (*MeshValue) ConfigWidget ¶
func (*MeshValue) OpenDialog ¶
func (*MeshValue) UpdateWidget ¶
func (vv *MeshValue) UpdateWidget()
func (*MeshValue) WidgetType ¶
type Scene ¶
type Scene struct { gi.WidgetBase // Scene is the 3D Scene Scene *xyz.Scene `set:"-"` // how to deal with selection / manipulation events SelMode SelModes // currently selected node CurSel xyz.Node `copy:"-" json:"-" xml:"-" view:"-"` // currently selected manipulation control point CurManipPt *ManipPt `copy:"-" 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 ¶
NewScene adds a new Scene with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*Scene) ConfigFrame ¶
func (sw *Scene) ConfigFrame()
ConfigFrame configures the framebuffer for GPU rendering, using the RenderWin GPU and Device.
func (*Scene) ConfigWidget ¶
func (sw *Scene) ConfigWidget()
func (*Scene) CopyFieldsFrom ¶
func (*Scene) DrawIntoScene ¶
func (sw *Scene) DrawIntoScene()
func (*Scene) HandleEvents ¶
func (sw *Scene) HandleEvents()
func (*Scene) HandleSelectEvents ¶
func (sw *Scene) HandleSelectEvents()
func (*Scene) HandleSelectEventsImpl ¶
func (*Scene) HandleSlideEvents ¶
func (sw *Scene) HandleSlideEvents()
func (*Scene) ManipBox ¶
func (sw *Scene) ManipBox()
ManipBox draws a manipulation box around selected node
func (*Scene) SelectBox ¶
func (sw *Scene) SelectBox()
SelectBox draws a selection box around selected node
func (*Scene) SetCurManipPt ¶
SetCurManipPt sets the [Scene.CurManipPt]: currently selected manipulation control point
func (*Scene) SetCustomContextMenu ¶
SetCustomContextMenu sets the [Scene.CustomContextMenu]
func (*Scene) SetSel ¶
SetSel -- if Selectable is true, then given object is selected if node is nil then selection is reset.
func (*Scene) SetSelMode ¶
SetSelMode sets the [Scene.SelMode]: how to deal with selection / manipulation events
func (*Scene) SetSelParams ¶
SetSelParams sets the [Scene.SelParams]: parameters for selection / manipulation box
func (*Scene) SetTooltip ¶
SetTooltip sets the [Scene.Tooltip]
func (*Scene) UpdateEnd3D ¶
UpdateEnd3D calls UpdateEnd on the 3D Scene: resets the scene ScUpdating flag if updt = true
func (*Scene) UpdateEndConfig3D ¶
UpdateEndConfig3D calls UpdateEndConfig on the 3D Scene and calls gi SetNeedsRender. UpdateEndConfig resets the scene ScUpdating flag if updt = true and sets the ScNeedsConfig flag; updt is from UpdateStart(). Config is for Texture, Lighting Meshes or more complex nodes).
func (*Scene) UpdateEndRender3D ¶
UpdateEndRender3D calls UpdateEndRender on the 3D Scene and calls gi SetNeedsRender. resets the scene ScUpdating flag if updt = true and sets the ScNeedsRender flag; updt is from UpdateStart(). Render only updates based on camera changes, not any node-level changes. See [UpdateEndUpdate].
func (*Scene) UpdateEndUpdate3D ¶
UpdateEndUpdate3D calls UpdateEndUpdate on the 3D Scene and calls gi SetNeedsRender. UpdateEndUpdate resets the scene ScUpdating flag if updt = true and sets the ScNeedsUpdate flag; updt is from UpdateStart(). Update is for when any node Pose or material changes happen. See [UpdateEndConfig] for major changes.
func (*Scene) UpdateStart3D ¶
UpdateStart3D calls UpdateStart on the 3D Scene: sets the scene ScUpdating flag to prevent render updates during construction on a scene. if already updating, returns false. Pass the result to UpdateEnd* methods.
type SceneView ¶
SceneView provides a toolbar controller for an xyz.Scene, and manipulation abilities.
func NewSceneView ¶
NewSceneView adds a new SceneView with the given name to the given parent. If the name is unspecified, it defaults to the ID (kebab-case) name of the type, plus the ki.Ki.NumLifetimeChildren of the given parent.
func (*SceneView) ConfigSceneView ¶
func (sv *SceneView) ConfigSceneView()
func (*SceneView) ConfigToolbar ¶
func (*SceneView) ConfigWidget ¶
func (sv *SceneView) ConfigWidget()
func (*SceneView) SceneWidget ¶
SceneWidget returns the gi.Widget Scene (xyzv.Scene)
func (*SceneView) SetCustomContextMenu ¶
SetCustomContextMenu sets the [SceneView.CustomContextMenu]
func (*SceneView) SetStackTop ¶
SetStackTop sets the [SceneView.StackTop]
func (*SceneView) SetTooltip ¶
SetTooltip sets the [SceneView.Tooltip]
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) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*SelModes) SetString ¶
SetString sets the SelModes value from its string representation, and returns an error if the string is invalid.
func (*SelModes) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
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 `def:"0.001"` // radius of the manipulation control point spheres, scaled by view distance Radius float32 `def:"0.005"` }
SelParams are parameters for selection / manipulation box