【正文】
t:function keydown (value) {if() {=。 利用JavaScript構(gòu)建燃?xì)庠铋_(kāi)關(guān)和火焰大小的交互功能現(xiàn)實(shí)餐廳中燃?xì)庠钍侵饕呐腼児ぞ撸ㄟ^(guò)旋鈕調(diào)節(jié)火焰大小掌握火候的使用關(guān)鍵,本次設(shè)計(jì)中燃?xì)庠畹脑O(shè)計(jì)旨在實(shí)現(xiàn)這一功能,利用多種傳感器和script結(jié)合實(shí)現(xiàn)這一交互功能并配有火焰聲。 } ] }DEF zhuangS Script {eventIn SFTime Openfield SFNode ob USE niu1eventIn SFBool anniuOpenfield SFNode a USE kaiguanfield SFInt32 PD 1 url javascript:function Open(value){if(PD==0){ }function anniuOpen (value){ if(value){ }ROUTE TO ROUTE TO ROUTE TO ROUTE TO ROUTE TO ROUTE TO 圖55燃?xì)庠铋_(kāi)關(guān)和火焰大小的的原始圖 圖56燃?xì)庠铋_(kāi)關(guān)和火焰大小的的效果圖程序中第一條路由的作用是接觸傳感器anniutouch的isActive域值傳遞給腳本zhuangS的事件域anniuOpen,anniuOpen函數(shù)內(nèi)部的條件判斷語(yǔ)句if……else語(yǔ)句判斷按鈕的開(kāi)啟狀態(tài),當(dāng)按鈕處于關(guān)閉時(shí)旋鈕可以旋轉(zhuǎn)但不會(huì)有火焰出現(xiàn);第二條路由作用是圓柱傳感器zhuangcyc的rotation_changed事件域傳遞域值給Transform節(jié)點(diǎn)niu1的set_rotation域;第三條作用是時(shí)間傳感器timer的cycleTime事件域傳遞域值給腳本zhuangS的事件域open;第四條路由作用是圓柱傳感器kai1的rotation_changed事件域傳遞域值給Transform節(jié)點(diǎn)niu1的rotation域;第五條作用是Transform節(jié)點(diǎn)niu1的rotation域傳遞域值給腳本KSS的事件域keydown,keydown函數(shù)內(nèi)部的條件判斷語(yǔ)句if……else判斷旋鈕的角度,若在火焰范圍內(nèi)顯示火焰,超出范圍火焰消失;最后一條路由的作用是圓柱觸感器kai1的isActive域值傳遞給腳本KSS的事件域shuoshen,最終完成交互控制燃?xì)庠畹拈_(kāi)啟和火焰大小的功能。結(jié)論隨著虛擬現(xiàn)實(shí)技術(shù)的不斷發(fā)展,虛擬現(xiàn)實(shí)技術(shù)的應(yīng)用領(lǐng)域越來(lái)越廣泛,終有一天要走入尋常百姓家?!疤摂M現(xiàn)實(shí)在超市及餐廳中的控制”正是實(shí)現(xiàn)了此項(xiàng)功能,該系統(tǒng)具有多種帶有交互功能的物體場(chǎng)景,操作簡(jiǎn)單,用戶只需輕輕點(diǎn)擊或旋轉(zhuǎn)便可隨意操控各種廚房用電器,還可在虛擬的超市中購(gòu)物,感受虛擬購(gòu)物帶來(lái)的樂(lè)趣。例如:(1)程序應(yīng)具備強(qiáng)大的后臺(tái)數(shù)據(jù)庫(kù),使超市場(chǎng)景中的各種物品種類更加豐富。總結(jié)與體會(huì)此次畢業(yè)設(shè)計(jì)“虛擬現(xiàn)實(shí)在超市及餐廳中的控制”所涉及到的知識(shí)有3ds max建模, VRML實(shí)現(xiàn)動(dòng)畫(huà)與交互功能、 JavaScript控制動(dòng)態(tài)復(fù)雜場(chǎng)景等。(2)在制作動(dòng)畫(huà)方面,使用3ds max、Cosmo world制作出的效果更好,程序也比較小,但導(dǎo)進(jìn)VRML中要加入必要的節(jié)點(diǎn)語(yǔ)言實(shí)現(xiàn)其交互功能。(6)利用JavaScript創(chuàng)造出來(lái)的場(chǎng)景更逼真,比如利用JavaScript編寫(xiě)而成的天空更接近感官上的真實(shí)天空。 黃文麗,盧碧紅,楊志剛,[M].北京:中國(guó)鐵道出版社,2003. 179~183.[2] 陽(yáng)化冰,. 虛擬現(xiàn)實(shí)構(gòu)造語(yǔ)言VRML[M].北京:北京航空航天大學(xué)出版社,2000. 7~25.[6] 陳定方,[M].北京:機(jī)械工業(yè)出版社,2002. 41~49.[10] 董銘,[M].北京:電子工業(yè)出版社,2000. 52~63.[14]s transmission and puting nodes to defer action to deal with the incident. When the calculation has been delayed, if multiple events are delivered to the node, then the list of events to be processed will be longer. Under normal circumstances, the default script mustEvaluate domain value EAI is used for embedding the VRML browser into an application or an applet, which is either independent or within a Web browser. It can be called through both the COM interface and Java classes. Thus, languages such as C++ and Java can be employed to develop applications or applets through VRML EAI. Besides this, since it is a part of the VRML standard, all browsers support it, which ensures better patibility. However, since it is used for creating external programs, the extensions thus implemented cannot be integrated into the browser.DirectOutput domain description script output has been restricted. When this field when the value is FALSE. Script can only read other nodes in the case of public domain and eventOut value, but can not send its events (such as public domain or eventIn events to send a value). When DirectOutput domain value TURE, the script on other nodes can write to the public domain, or events to other nodes send eventIn value. In addition, when DirectOutput domain value is TRUE, the script can also add or remove space in a path. Typically, DirectOutput domain default value FALSE.url is the public domain, through the set_url send eventIn events can change the URL list. When receiving a value from the input, the corresponding threshold will be changed. Of course, the new value will be output by the domain url_changed eventOut event. When the Script node39。 Script node eventIn event interface through a value shall receive an event receiver. Initialization, the program terminated and the event received depends on the specific structure and syntax of the programm。 procedures seeded first read the script to initialize。 Qi Liu,Alexei shape modeling extension of the Virtual Reality Modeling Language[J].Computers amp。 [M].北京:清華大學(xué)出版社,2001. 16~23,[12] 編程實(shí)例講解[M].北京:中國(guó)水利水電出版社,2002. 32~49.[8] [M].北京:高等教育出版社,2004. 198~227.[4]我相信學(xué)好用好這方面的知識(shí)技能,將對(duì)我今后的工作生活帶來(lái)極大地幫助。(4)所有程序在保存時(shí)勾選壓縮保存會(huì)使總程序的大小減少1/3以上。同時(shí),此次的設(shè)計(jì)使我對(duì)以下幾方面的知識(shí)有所重新認(rèn)識(shí)與體會(huì)。(3)程序應(yīng)擴(kuò)充餐廳部分的設(shè)備、更接近現(xiàn)實(shí)餐廳中的配置。程序中所提供的各種廚房電器和超市用品都是現(xiàn)實(shí)生活中常見(jiàn)的,用戶在操作上不會(huì)有任何不了解的地方,更好地讓用戶了解虛擬日常生活帶來(lái)的方便和樂(lè)趣。虛擬現(xiàn)實(shí)技術(shù)在日常生活中的應(yīng)用不應(yīng)該只停留在演示階段,在完善功能技術(shù)的同時(shí)提高外部硬件設(shè)備的支持,使用戶能夠真正感受到虛擬現(xiàn)實(shí)帶來(lái)的“真實(shí)生活”。如圖558所示為實(shí)現(xiàn)購(gòu)物車收獲物品和收銀之間切換的交互功能。以下所示為實(shí)現(xiàn)燃?xì)庠铋_(kāi)關(guān)和火焰大小的交互功能的代碼:DEF niu1 Transform {children [DEF kai1 CylinderSensor { maxAngle }Inline {url } ] }DEF timer TimeSensor {cycleInterval loop TRUE}DEF zhuangcyc CylinderSensor { }]}Sound {source DEF movie MovieTexture{ url }}DEF pic Switch {whichChoice 1choice [DEF dahuo Transform { }DEF dahuoshen Sound {Source AudioClip {url } } ] } ]}DEF KSS Script {field SFNode dahuokaiguan01 USE niu1field SFNode dahuo USE dahuoeventIn SFRotation keydowneventIn SFBool shuoshenurl [javascript:function keydown (value) {if() {=。} }function shuishen(value){ =1。 利用JavaScript構(gòu)建洗手池水龍頭的的交互功能在顯示生活中,洗菜池是廚房中必不可少的組成部分,在本次設(shè)計(jì)中完全還原了現(xiàn)實(shí)生活中的水龍頭,利用script實(shí)現(xiàn)其調(diào)節(jié)龍頭方向和控制出水大小的交互功能,并配有流水聲且會(huì)隨水流大小有聲音強(qiáng)弱的變化。所有事件處理完后程序就調(diào)用Script類中的eventsProcessed方法,在這兒可以加入用戶想要實(shí)現(xiàn)的動(dòng)畫(huà)交互等各種效果[15]。Java 程序通過(guò)替代這兩個(gè)方法對(duì)事件做出相應(yīng)的處理。作為參數(shù)的fieldName、eventInName、eventOutName要與Script節(jié)點(diǎn)中定義的名稱相符合,對(duì)應(yīng)的Field 類的子類也要與Script節(jié)點(diǎn)中定義的各種Type類型一致。當(dāng)與Script節(jié)點(diǎn)有聯(lián)系的節(jié)點(diǎn)發(fā)生事件時(shí),事件通過(guò)路由傳給Script節(jié)點(diǎn)的eventIn域,Script節(jié)點(diǎn)則通過(guò)url域中指定的地址找到j(luò)ava類,該類必須繼承自Script類。這種描述就是一個(gè)程序腳本,典型的為用Java或JavaScript寫(xiě)成的程序腳本。具體來(lái)說(shuō),一個(gè)用來(lái)計(jì)算跌落物體路徑的Script節(jié)點(diǎn),應(yīng)該具有一個(gè)域,這個(gè)域包含了重力的大小、物體的初始高度、物體向前運(yùn)動(dòng)的速度以及其他特征。 第5章 使用JavaScript構(gòu)建動(dòng)態(tài)場(chǎng)景的交互 使用JavaScript構(gòu)建動(dòng)態(tài)場(chǎng)景交互功能的實(shí)現(xiàn)Script節(jié)點(diǎn)可以描述一個(gè)由用戶制作的感應(yīng)器和內(nèi)插器。huike為一個(gè)固定視點(diǎn),通過(guò)調(diào)節(jié)程序里的position等值確定其位置等屬性。以下為實(shí)現(xiàn)抽油煙機(jī)工作功能的代碼:DEF anniutouch01 TouchSensor {}DEF anniutouch02 TouchSensor {}DEF shengyin Sound {source DEF youyan AudioClip {loop FALSE}}ROUTE TO ROUTE TO 圖414抽油煙機(jī)工作功能實(shí)現(xiàn)的效果圖在該程序中第一條路由的作用是接觸傳感器anniutouch01的touchTime事件域傳遞域值給AudioClip youyan的startTime域,開(kāi)啟聲音;第二條路由作用是接觸傳感器anniutouch02的touchTime事件域傳遞域值給AudioClip youyan的stopTime域,關(guān)閉聲音,完成聲音交互。如圖41413所示為超市大門伸縮開(kāi)啟功能的實(shí)現(xiàn)。