evev

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: BSD-3-Clause Imports: 8 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var KiT_View = kit.Types.AddType(&View{}, nil)

Functions

func ConfigBodySolid added in v0.9.0

func ConfigBodySolid(bod eve.Body, sld *gi3d.Solid)

ConfigBodySolid configures a solid for a body with current values

func ConfigView

func ConfigView(wn eve.Node, vn gi3d.Node3D, sc *gi3d.Scene)

ConfigView configures the view node to properly display world node

func DepthImage

func DepthImage(img *image.RGBA, depth []float32, cmap *colormap.Map, cam *Camera)

DepthImage renders an image of linear depth map from GPU (0-1 normalized floats) to given image, which must be of appropriate size for map, using given colormap name. Camera params determine whether log is used, and max cutoff distance for sensitive range of distances -- also has Near / Far required to transform numbers into linearized distance values. Y axis is always flipped.

func DepthNorm

func DepthNorm(nd *[]float32, depth []float32, cam *Camera, flipY bool)

DepthNorm renders a normalized linear depth map from GPU (0-1 normalized floats) to given float slice, which is resized if not already appropriate size. if flipY then Y axis is flipped -- input is bottom-Y = 0. Camera params determine whether log is used, and max cutoff distance for sensitive range of distances -- also has Near / Far required to transform numbers into linearized distance values.

func InitLibSolid

func InitLibSolid(bod eve.Body, sc *gi3d.Scene)

InitLibSolid initializes Scene library with Solid for given body

func InitLibrary

func InitLibrary(wn eve.Node, sc *gi3d.Scene)

InitLibrary initializes Scene library with basic Solid shapes based on bodies in the virtual world. More complex visualizations can be configured after this.

func SyncNode

func SyncNode(wn eve.Node, vn gi3d.Node3D, sc *gi3d.Scene) bool

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 UpdateBodyView added in v0.9.2

func UpdateBodyView(bodyNames []string, wn eve.Node, vn gi3d.Node3D)

UpdateBodyView updates the body view info for given name(s) Essential that both trees are already synchronized.

func UpdatePose

func UpdatePose(wn eve.Node, vn gi3d.Node3D)

UpdatePose updates the view pose values only from world tree. Essential that both trees are already synchronized.

Types

type Camera

type Camera struct {

	// size of image to record
	Size image.Point `desc:"size of image to record"`

	// field of view in degrees
	FOV float32 `desc:"field of view in degrees"`

	// [def: 0.01] near plane z coordinate
	Near float32 `def:"0.01" desc:"near plane z coordinate"`

	// [def: 1000] far plane z coordinate
	Far float32 `def:"1000" desc:"far plane z coordinate"`

	// [def: 20] maximum distance for depth maps -- anything above is 1 -- this is independent of Near / Far rendering (though must be < Far) and is for normalized depth maps
	MaxD float32 `` /* 173-byte string literal not displayed */

	// [def: true] use the natural log of 1 + depth for normalized depth values in display etc
	LogD bool `def:"true" desc:"use the natural log of 1 + depth for normalized depth values in display etc"`

	// [def: 4] number of multi-samples to use for antialising -- 4 is best and default
	MSample int `def:"4" desc:"number of multi-samples to use for antialising -- 4 is best and default"`

	// up direction for camera -- which way is up -- defaults to positive Y axis, and is reset by call to LookAt method
	UpDir mat32.Vec3 `desc:"up direction for camera -- which way is up -- defaults to positive Y axis, and is reset by call to LookAt method"`
}

Camera defines the properties of a camera needed for offscreen rendering

func (*Camera) Defaults

func (cm *Camera) Defaults()

type View

type View struct {

	// the root Group node of the virtual world
	World *eve.Group `desc:"the root Group node of the virtual world"`

	// the scene object for visualizing
	Scene *gi3d.Scene `desc:"the scene object for visualizing"`

	// the root Group node in the Scene under which the world is rendered
	Root *gi3d.Group `desc:"the root Group node in the Scene under which the world is rendered"`
}

View connects a Virtual World with a Gi3D Scene to visualize the world, including ability to render offscreen

func NewView

func NewView(world *eve.Group, sc *gi3d.Scene, root *gi3d.Group) *View

NewView returns a new View that links given world with given scene and root group

func (*View) DepthImage added in v0.9.0

func (vw *View) DepthImage() ([]float32, error)

DepthImage returns the current rendered depth image

func (*View) Image added in v0.9.0

func (vw *View) Image() (*image.RGBA, error)

Image returns the current rendered image

func (*View) InitLibrary

func (vw *View) InitLibrary()

InitLibrary initializes Scene library with basic Solid shapes based on bodies in the virtual world. More complex visualizations can be configured after this.

func (*View) RenderOffNode

func (vw *View) RenderOffNode(node eve.Node, cam *Camera) error

RenderOffNode does an offscreen render using given node for the camera position and orientation. Current scene camera is saved and restored

func (*View) Sync

func (vw *View) Sync() bool

Sync synchronizes the view to the world

func (*View) UpdateBodyView added in v0.9.2

func (vw *View) UpdateBodyView(bodyNames []string)

UpdateBodyView updates the display properties of given body name recurses the tree until this body name is found.

func (*View) UpdatePose

func (vw *View) UpdatePose()

UpdatePose updates the view pose values only from world tree. Essential that both trees are already synchronized.

Jump to

Keyboard shortcuts

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