;; Fu Jie Huang, Feb 2003
;; this demos shows how to use a dragger to control an object
;; more specifically, use a SoTranslate1Dragger to control a cone's bottom Radius
;; we use an engine to connect dragger's translation to cone's BottomRadius, like:
;; mydragger.translation----myengine.vector/myengine.x--------mycone.bottomradius

(libload "inventor/inventor")
(libload "inventor/inventorxt")

(setq mywindow (soxt_init "lush"))
(setq root  (new soseparator ()))

(setq mydragger (new soTranslate1Dragger ()))
(setq myengine (new sodecomposevec3f ()))
(setq mycone (new socone ()))

(==> root ref)
(==> root addChild :mycone:p)
(==> root addChild :mydragger:p)

;;step1. mydragger.translation----myengine.vector
(let ((two (==> myengine  getmf-vector))
      (one (==> mydragger getsf-translation)))
  (==> one setvalue 1 0 0)
  (==> two connectfrom-field :one:p))

;;step2. myengine.x--------mycone.bottomradius
(let ((three (==> mycone   getsf-bottomradius))
      (two   (==> myengine geteo-x)))
  (==> three connectfrom-engine :two:p))

(setq myviewer (new soxtexaminerviewer mywindow "test" 1 1 1 ()))
(==> myviewer setscenegraph :root:p)
(==> myviewer show)

(soxt_show mywindow)

