Documentation ¶
Overview ¶
Package xyzview provides a GUI view for a 3D xyz scene.
Index ¶
- Constants
- Variables
- type ManipPoint
- type MeshValue
- type Scene
- func (sw *Scene) Config()
- func (sw *Scene) ConfigFrame()
- func (sw *Scene) Destroy()
- func (sw *Scene) DirectRenderDraw(drw system.Drawer, idx int, flipY bool)
- func (sw *Scene) DirectRenderImage(drw system.Drawer, idx int)
- func (sw *Scene) HandleEvents()
- func (sw *Scene) HandleSelectEvents()
- func (sw *Scene) HandleSelectEventsImpl(e events.Event)
- func (sw *Scene) HandleSlideEvents()
- func (sw *Scene) ManipBox()
- func (t *Scene) New() tree.Node
- func (t *Scene) NodeType() *types.Type
- func (sw *Scene) OnAdd()
- func (sw *Scene) OnInit()
- func (sw *Scene) Render()
- func (sw *Scene) SceneXYZ() *xyz.Scene
- func (sw *Scene) SelectBox()
- func (t *Scene) SetCurrentManipPoint(v *ManipPoint) *Scene
- func (t *Scene) SetCurrentSelected(v xyz.Node) *Scene
- func (sw *Scene) SetSelected(nd xyz.Node)
- func (t *Scene) SetSelectionMode(v SelectionModes) *Scene
- func (t *Scene) SetSelectionParams(v SelectionParams) *Scene
- func (sw *Scene) SetStyles()
- func (t *Scene) SetTooltip(v string) *Scene
- type SceneView
- func (sv *SceneView) Config()
- func (sv *SceneView) ConfigSceneView()
- func (sv *SceneView) ConfigToolbar(tb *core.Toolbar)
- func (t *SceneView) New() tree.Node
- func (t *SceneView) NodeType() *types.Type
- func (sv *SceneView) OnInit()
- func (sv *SceneView) SceneWidget() *Scene
- func (sv *SceneView) SceneXYZ() *xyz.Scene
- func (t *SceneView) SetTooltip(v string) *SceneView
- func (sv *SceneView) Toolbar() *core.Toolbar
- func (sv *SceneView) UpdateToolbar()
- type SelectionModes
- func (i SelectionModes) Desc() string
- func (i SelectionModes) Int64() int64
- func (i SelectionModes) MarshalText() ([]byte, error)
- func (i *SelectionModes) SetInt64(in int64)
- func (i *SelectionModes) SetString(s string) error
- func (i SelectionModes) String() string
- func (i *SelectionModes) UnmarshalText(text []byte) error
- func (i SelectionModes) Values() []enums.Enum
- type SelectionParams
Constants ¶
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 ¶
var ManipPointType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyzview.ManipPoint", IDName: "manip-point", Doc: "ManipPoint is a manipulation control point", Directives: []types.Directive{{Tool: "core", Directive: "no-new"}}, Embeds: []types.Field{{Name: "Solid"}}, Instance: &ManipPoint{}})
ManipPointType is the types.Type for ManipPoint
var SceneType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyzview.Scene", IDName: "scene", Doc: "Scene is a core.Widget that manages a xyz.Scene,\nproviding the basic rendering logic for the 3D scene\nin the 2D core GUI context.", Embeds: []types.Field{{Name: "WidgetBase"}}, Fields: []types.Field{{Name: "XYZ", Doc: "XYZ is the 3D xyz.Scene"}, {Name: "SelectionMode", Doc: "how to deal with selection / manipulation events"}, {Name: "CurrentSelected", Doc: "currently selected node"}, {Name: "CurrentManipPoint", Doc: "currently selected manipulation control point"}, {Name: "SelectionParams", Doc: "parameters for selection / manipulation box"}}, Instance: &Scene{}})
SceneType is the types.Type for Scene
var SceneViewType = types.AddType(&types.Type{Name: "cogentcore.org/core/xyzview.SceneView", IDName: "scene-view", Doc: "SceneView provides a toolbar controller for an xyz.Scene,\nand manipulation abilities.", Embeds: []types.Field{{Name: "Layout"}}, Instance: &SceneView{}})
SceneViewType is the types.Type for SceneView
Functions ¶
This section is empty.
Types ¶
type ManipPoint ¶
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
func (*ManipPoint) NodeType ¶
func (t *ManipPoint) NodeType() *types.Type
NodeType returns the *types.Type of ManipPoint
func (*ManipPoint) SetMat ¶
func (t *ManipPoint) SetMat(v xyz.Material) *ManipPoint
SetMat sets the [ManipPoint.Mat]
type MeshValue ¶
MeshValue represents an xyz.MeshName with a button.
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:"-" view:"-"` // currently selected manipulation control point CurrentManipPoint *ManipPoint `copier:"-" json:"-" xml:"-" view:"-"` // parameters for selection / manipulation box SelectionParams SelectionParams `view:"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 ¶
NewScene adds a new Scene with the given name to the given 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) ConfigFrame ¶
func (sw *Scene) ConfigFrame()
ConfigFrame configures the framebuffer for GPU rendering, using the RenderWin GPU and Device.
func (*Scene) DirectRenderDraw ¶
DirectRenderDraw draws the current image to RenderWin drawer
func (*Scene) DirectRenderImage ¶
DirectRenderImage uploads framebuffer image
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) NodeType ¶
NodeType returns the *types.Type of 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 ¶
SetCurrentSelected sets the [Scene.CurrentSelected]: currently selected node
func (*Scene) SetSelected ¶
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
func (*Scene) SetTooltip ¶
SetTooltip sets the [Scene.Tooltip]
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: SceneView provides a toolbar controller for an xyz.Scene, and manipulation abilities.
func (*SceneView) ConfigSceneView ¶
func (sv *SceneView) ConfigSceneView()
func (*SceneView) ConfigToolbar ¶
func (*SceneView) NodeType ¶
NodeType returns the *types.Type of SceneView
func (*SceneView) SceneWidget ¶
SceneWidget returns the core.Widget Scene (xyzv.Scene)
func (*SceneView) SetTooltip ¶
SetTooltip sets the [SceneView.Tooltip]
func (*SceneView) UpdateToolbar ¶
func (sv *SceneView) UpdateToolbar()
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()