{import * from CURL.GRAPHICS.SCENE, using-name="SCENE"}
{import * from CURL.PGUIDE.SCENEUTILS,
location = "../../default/support/SceneUtils.scurl"}
{let quat-quad:Quad = {Quad -10in, -10in, 20in, 20in}}
{let quat-group:SceneGroup = {SceneGroup}}
{do
set quat-quad.fill-pattern = {url "curl://install/docs/default/images/adria.jpg"}
{quat-group.transformation.local-translate 10in, 0in, 0in}
{quat-group.add-object quat-quad}
}
{let controller:TransformController =
{TransformController
"the controller",
null, || translation
null, || rotation
null, || scale
0s,
{Distance3d 20in, 0in, 0in},
{Quaternion.from-axis-rotation 80deg, {Direction3d 0, 0, 1}},
null,
5s,
{Distance3d 0in, 0in, 40in},
{Quaternion.from-axis-rotation -80deg, {Direction3d 0, 0, 1}},
{Fraction3d 3, 3, 3},
10s
}
}
{define-proc {toggle obj:SceneObject}:void
{if obj.controller != null then
set obj.controller.enabled? = not obj.controller.enabled?
}
{if obj isa SceneGroup then
{for each-obj in (obj asa SceneGroup).objects do {toggle each-obj}}
}
}
{value
let scene:ExampleScene = {ExampleScene}
{scene.camera-setup}
{let scene-graphic:SceneGraphic =
{SceneGraphic
scene,
width=4in,
height=4in,
background = {FillPattern.get-black}
}
}
set quat-quad.controller = controller
set controller.loop? = true
set controller.enabled? = false
{scene.add-object quat-group}
{scene.add-object {make-axis-object 1m}}
let tmr:Timer =
{scene-graphic.animate
frequency = 30fps,
{on TimerEvent do
{scene-graphic.update-drawable}
}
}
{VBox
scene-graphic,
{CommandButton
label = "Run/Stop",
{on Action do
{toggle scene}
}
}
}
} | |