Documentation ¶
Index ¶
- type View
- func (vw *View) AddFromLibrary(nm string, gp *svg.Group)
- func (vw *View) ConfigBodyShape(bod eve.Body, shp svg.Node)
- func (vw *View) ConfigView(wn eve.Node, vn svg.Node)
- func (vw *View) Image() (*image.RGBA, error)
- func (vw *View) InitLibShape(bod eve.Body)
- func (vw *View) InitLibrary()
- func (vw *View) InitLibraryBody(wn eve.Node)
- func (vw *View) NewInLibrary(nm string) *svg.Group
- func (vw *View) Prjn2D(pos math32.Vector3) math32.Vector2
- func (vw *View) ProjectXY()
- func (vw *View) ProjectXZ()
- func (vw *View) Sync() bool
- func (vw *View) SyncNode(wn eve.Node, vn svg.Node) bool
- func (vw *View) Transform2D(phys *eve.Phys) math32.Matrix2
- func (vw *View) UpdateBodyView(bodyNames []string)
- func (vw *View) UpdateBodyViewNode(bodyNames []string, wn eve.Node, vn svg.Node)
- func (vw *View) UpdatePose()
- func (vw *View) UpdatePoseNode(wn eve.Node, vn svg.Node)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type View ¶
type View struct { // width of lines for shape rendering, in normalized units LineWidth float32 // projection matrix for converting 3D to 2D -- resulting X, Y coordinates are used from Vector3 Prjn math32.Matrix4 // the root Group node of the virtual world World *eve.Group // the SVG rendering canvas for visualizing in 2D Scene *svg.SVG // the root Group node in the Scene under which the world is rendered Root *svg.Group // library of shapes for bodies -- name matches Body.Vis Library map[string]*svg.Group }
View connects a Virtual World with a 2D SVG Scene to visualize the world
func (*View) AddFromLibrary ¶
AddFromLibrary adds shape from library to given group
func (*View) ConfigBodyShape ¶
ConfigBodyShape configures a shape for a body with current values
func (*View) ConfigView ¶
ConfigView configures the view node to properly display world node
func (*View) InitLibShape ¶
InitLibShape initializes Scene library with basic shape for given body
func (*View) InitLibrary ¶
func (vw *View) InitLibrary()
InitLibrary initializes Scene library with basic shapes based on bodies in the virtual world. More complex visualizations can be configured after this.
func (*View) InitLibraryBody ¶
InitLibraryBody initializes Scene library with basic shapes based on bodies in the virtual world. More complex visualizations can be configured after this.
func (*View) NewInLibrary ¶
NewInLibrary adds a new item of given name in library
func (*View) ProjectXY ¶
func (vw *View) ProjectXY()
ProjectXY sets 2D projection to reflect 3D X,Y coords
func (*View) ProjectXZ ¶
func (vw *View) ProjectXZ()
ProjectXZ sets 2D projection to reflect 3D X,Z coords
func (*View) SyncNode ¶
SyncNode updates the view tree to match the world tree, using ConfigChildren to maximally preserve existing tree elements returns true if view tree was modified (elements added / removed etc)
func (*View) Transform2D ¶
Transform2D returns the full 2D transform matrix for a given position and quat rotation in 3D
func (*View) UpdateBodyView ¶
UpdateBodyView updates the display properties of given body name recurses the tree until this body name is found.
func (*View) UpdateBodyViewNode ¶
UpdateBodyViewNode updates the body view info for given name(s) Essential that both trees are already synchronized.
func (*View) UpdatePose ¶
func (vw *View) UpdatePose()
UpdatePose updates the view pose values only from world tree. Essential that both trees are already synchronized.