4.2.交互功能的实现 4.2.1.视点 视点(viewpoint)是用户观察境界的当前位置以及视线的远近距离。在不同的位置(包括高低)场景呈现出不同的形态,场景中设计了Va、Vb、Vc、Vd四个参观点。 内容来自论文无忧网 www.paper51.com DEFVa Viewpoint { copyright paper51.com description "Top View" 内容来自www.paper51.com } 内容来自论文无忧网 www.paper51.com
DEFVb Viewpoint { paper51.com description "Looking AtCollimator" #视点名 paper51.com position -9.29247 -0.318886 2.45218 #视点位置坐标 copyright paper51.com orientation 1 -1 -1 2.0943951 #视点空间朝向 paper51.com
} paper51.com DEFVc Viewpoint { } paper51.com DEFVd Viewpoint { } http://www.paper51.com 当用户选择“Looking AtCollimator”时,便跳转到视点Vb的位置,方便参观,也体现了在三维环境中用户可以从不同的角度观察的优势。 内容来自www.paper51.com 4.2.2.传感器(sensor)和脚本(script) http://www.paper51.com 传感器(sensor)提供时间、位置、点击等信息,是VRML交互性实现的基础。脚本(script)是对VRML交互能力的一种扩展方式。如“光粒子运动”的实现:Transform { 内容来自www.paper51.com translation 0 0 0.8 http://www.paper51.com children [ copyright paper51.com DEF VPm Transform { http://www.paper51.com translation -2.50 0 内容来自www.paper51.com children [ copyright paper51.com DEFRayTimeM TimeSensor { cycleInterval 60 loop FALSE enabled FALSE } #时间传感器节点RayTimeM,周期60秒,不循环输出,状态为关闭 copyright paper51.com DEFPlayRayAnimation TouchSensor { } #触摸传感器 copyright paper51.com DEFPm PositionInterpolator { } #位置插补器 paper51.com DEFOm OrientationInterpolator { } #朝向插补器 http://www.paper51.com Transform{ #演示动画按钮 paper51.com rotation 0 0 1 -1.57079632679490 http://www.paper51.com
children [ 内容来自论文无忧网 www.paper51.com
Shape { http://www.paper51.com appearance Appearance { material Material { emissiveColor 0.1 0.1 0.9diffuseColor 0 0 0 } } http://www.paper51.com
geometry Cone { bottomRadius 0.05 height 0.1 } 内容来自论文无忧网 www.paper51.com } 内容来自www.paper51.com ] 内容来自论文无忧网 www.paper51.com } paper51.com ] http://www.paper51.com ROUTEPm.value_changed TO VPm.set_translation http://www.paper51.com
ROUTEOm.value_changed TO VPm.set_rotation http://www.paper51.com ROUTERayTimeM.fraction_changed TO Pm.set_fraction copyright paper51.com ROUTERayTimeM.fraction_changed TO Om.set_fraction } #动画实现 1 paper51.com
] copyright paper51.com } copyright paper51.com
Transform { copyright paper51.com translation 0 0 0.8 内容来自www.paper51.com children [ 内容来自论文无忧网 www.paper51.com DEF VPf Transform { 内容来自www.paper51.com translation -2.50 0 paper51.com children [ http://www.paper51.com DEFRayTimeF TimeSensor { cycleInterval 60 loop FALSE enabled FALSE } paper51.com
DEFPf PositionInterpolator { } 内容来自论文无忧网 www.paper51.com DEF Of OrientationInterpolator { } paper51.com Transform { copyright paper51.com rotation 0 0 1 -1.57079632679490 copyright paper51.com children [ 内容来自www.paper51.com Shape { #演示动画按钮 内容来自论文无忧网 www.paper51.com appearance Appearance { material Material { emissiveColor 0.1 0.1 0.9diffuseColor 0 0 0 } } paper51.com geometry Cone { bottomRadius 0.05 height 0.1 } 内容来自论文无忧网 www.paper51.com
} paper51.com ] copyright paper51.com } paper51.com
] http://www.paper51.com
ROUTEPf.value_changed TO VPf.set_translation paper51.com ROUTEOf.value_changed TO VPf.set_rotation http://www.paper51.com ROUTERayTimeF.fraction_changed TO Pf.set_fraction 内容来自www.paper51.com ROUTERayTimeF.fraction_changed TO Of.set_fraction copyright paper51.com } #动画实现2 内容来自www.paper51.com ] 内容来自www.paper51.com } paper51.com 光粒子的运动实现是由两个大小一样,初始位置相同的圆锥体的运动分别实现的,一圆锥经过S(图3)后反射到M2(图3),另一圆锥经S后透射到M1(图3)。实现的原理(ROUTE语句传值)图为: paper51.com paper51.com |