Documentation ¶
Index ¶
- func DepthImage(img *image.RGBA, depth []float32, cmap *colormap.Map, cam *Camera)
- func DepthNorm(nd *[]float32, depth []float32, cam *Camera, flipY bool)
- func NoDisplayScene(gp *gpu.GPU, dev *gpu.Device) *xyz.Scene
- type Camera
- type View
- func (vw *View) ConfigBodySolid(bod physics.Body, sld *xyz.Solid)
- func (vw *View) ConfigView(wn physics.Node, vn xyz.Node, sc *xyz.Scene)
- func (vw *View) DepthImage() ([]float32, error)
- func (vw *View) Image() (*image.RGBA, error)
- func (vw *View) InitLibSolid(bod physics.Body, sc *xyz.Scene)
- func (vw *View) InitLibrary()
- func (vw *View) InitLibraryBody(wn physics.Node, sc *xyz.Scene)
- func (vw *View) RenderOffNode(node physics.Node, cam *Camera) error
- func (vw *View) Sync() bool
- func (vw *View) SyncNode(wn physics.Node, vn xyz.Node, sc *xyz.Scene) bool
- func (vw *View) UpdateBodyView(bodyNames ...string)
- func (vw *View) UpdateBodyViewNode(bodyNames []string, wn physics.Node, vn xyz.Node)
- func (vw *View) UpdatePose()
- func (vw *View) UpdatePoseNode(wn physics.Node, vn xyz.Node)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DepthImage ¶
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 ¶
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 NoDisplayScene ¶
NoDisplayScene returns a xyz Scene initialized and ready to use in NoGUI offscreen rendering mode, using given GPU and device. Must manually call Init3D and Style3D on the Scene prior to a RenderOffNode call to grab the image from a specific camera.
Types ¶
type Camera ¶
type Camera struct { // size of image to record Size image.Point // field of view in degrees FOV float32 // near plane z coordinate Near float32 `default:"0.01"` // far plane z coordinate Far float32 `default:"1000"` // 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 `default:"20"` // use the natural log of 1 + depth for normalized depth values in display etc LogD bool `default:"true"` // number of multi-samples to use for antialising -- 4 is best and default MSample int `default:"4"` // up direction for camera -- which way is up -- defaults to positive Y axis, and is reset by call to LookAt method UpDir math32.Vector3 }
Camera defines the properties of a camera needed for offscreen rendering
type View ¶
type View struct { // the root Group node of the virtual world World *physics.Group // the scene object for visualizing Scene *xyz.Scene // the root Group node in the Scene under which the world is rendered Root *xyz.Group }
View connects a Virtual World with a Xyz Scene to visualize the world, including ability to render offscreen
func (*View) ConfigBodySolid ¶
ConfigBodySolid configures a solid for a body with current values
func (*View) ConfigView ¶
ConfigView configures the view node to properly display world node
func (*View) DepthImage ¶
DepthImage returns the current rendered depth image
func (*View) InitLibSolid ¶
InitLibSolid initializes Scene library with Solid for given body
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) InitLibraryBody ¶
InitLibraryBody 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 ¶
RenderOffNode does an offscreen render using given node for the camera position and orientation. Current scene camera is saved and restored
func (*View) SyncNode ¶
SyncNode updates the view tree to match the world tree, using efficient plan-based Build to maximally preserve existing tree elements returns true if view tree was modified (elements added / removed etc)
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.